Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
89a75343
Unverified
Commit
89a75343
authored
Apr 22, 2020
by
Alex Khomenko
Committed by
GitHub
Apr 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Search: Load folder page (#23768)
parent
5bf43af5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
14 deletions
+71
-14
public/app/features/search/components/DashboardListPage.tsx
+13
-14
public/app/features/search/loaders.ts
+58
-0
No files found.
public/app/features/search/components/DashboardListPage.tsx
View file @
89a75343
...
...
@@ -7,7 +7,7 @@ import { StoreState } from 'app/types';
import
{
getNavModel
}
from
'app/core/selectors/navModel'
;
import
{
getRouteParams
}
from
'app/core/selectors/location'
;
import
Page
from
'app/core/components/Page/Page'
;
import
{
backendSrv
}
from
'app/core/services/backend_srv
'
;
import
{
loadFolderPage
}
from
'../loaders
'
;
import
{
ManageDashboards
}
from
'./ManageDashboards'
;
interface
Props
{
...
...
@@ -17,25 +17,24 @@ interface Props {
export
const
DashboardListPage
:
FC
<
Props
>
=
memo
(({
navModel
,
uid
})
=>
{
const
{
loading
,
value
}
=
useAsync
(()
=>
{
if
(
uid
)
{
return
backendSrv
.
getFolderByUid
(
uid
).
then
((
folder
:
any
)
=>
{
const
url
=
locationUtil
.
stripBaseFromUrl
(
folder
.
url
);
if
(
!
uid
)
{
return
Promise
.
resolve
({
pageNavModel
:
navModel
});
}
return
loadFolderPage
(
uid
,
'manage-folder-dashboards'
).
then
(({
folder
,
model
})
=>
{
const
url
=
locationUtil
.
stripBaseFromUrl
(
folder
.
url
);
if
(
url
!==
location
.
pathname
)
{
getLocationSrv
().
update
({
path
:
url
});
}
if
(
url
!==
location
.
pathname
)
{
getLocationSrv
().
update
({
path
:
url
});
}
return
folder
.
id
;
});
}
else
{
return
Promise
.
resolve
(
undefined
);
}
return
{
id
:
folder
.
id
,
pageNavModel
:
{
...
navModel
,
...
model
}
};
});
},
[
uid
]);
return
(
<
Page
navModel=
{
n
avModel
}
>
<
Page
navModel=
{
value
?.
pageN
avModel
}
>
<
Page
.
Contents
isLoading=
{
loading
}
>
<
ManageDashboards
folderUid=
{
uid
}
folderId=
{
value
}
/>
<
ManageDashboards
folderUid=
{
uid
}
folderId=
{
value
?.
id
}
/>
</
Page
.
Contents
>
</
Page
>
);
...
...
public/app/features/search/loaders.ts
0 → 100644
View file @
89a75343
import
{
backendSrv
}
from
'app/core/services/backend_srv'
;
export
const
loadFolderPage
=
(
uid
:
string
,
activeChildId
:
string
)
=>
{
const
navModel
=
{
main
:
{
icon
:
'folder-open'
,
id
:
'manage-folder'
,
subTitle
:
'Manage folder dashboards & permissions'
,
url
:
''
,
text
:
''
,
breadcrumbs
:
[{
title
:
'Dashboards'
,
url
:
'dashboards'
}],
children
:
[
{
active
:
activeChildId
===
'manage-folder-dashboards'
,
icon
:
'th-large'
,
id
:
'manage-folder-dashboards'
,
text
:
'Dashboards'
,
url
:
'dashboards'
,
},
{
active
:
activeChildId
===
'manage-folder-permissions'
,
icon
:
'lock'
,
id
:
'manage-folder-permissions'
,
text
:
'Permissions'
,
url
:
'dashboards/permissions'
,
},
{
active
:
activeChildId
===
'manage-folder-settings'
,
icon
:
'cog'
,
id
:
'manage-folder-settings'
,
text
:
'Settings'
,
url
:
'dashboards/settings'
,
},
],
},
};
return
backendSrv
.
getFolderByUid
(
uid
).
then
((
folder
:
any
)
=>
{
const
folderTitle
=
folder
.
title
;
const
folderUrl
=
folder
.
url
;
navModel
.
main
.
text
=
folderTitle
;
const
dashTab
=
navModel
.
main
.
children
.
find
((
child
:
any
)
=>
child
.
id
===
'manage-folder-dashboards'
);
dashTab
.
url
=
folderUrl
;
if
(
folder
.
canAdmin
)
{
const
permTab
=
navModel
.
main
.
children
.
find
((
child
:
any
)
=>
child
.
id
===
'manage-folder-permissions'
);
permTab
.
url
=
folderUrl
+
'/permissions'
;
const
settingsTab
=
navModel
.
main
.
children
.
find
((
child
:
any
)
=>
child
.
id
===
'manage-folder-settings'
);
settingsTab
.
url
=
folderUrl
+
'/settings'
;
}
else
{
navModel
.
main
.
children
=
[
dashTab
];
}
return
{
folder
,
model
:
navModel
};
});
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment