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
e6b82b2f
Commit
e6b82b2f
authored
Feb 05, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: fixed permission list caching issue, fixes #10750
parent
2d1bd270
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
8 deletions
+31
-8
public/app/containers/ManageDashboards/FolderPermissions.tsx
+2
-1
public/app/containers/ManageDashboards/FolderSettings.jest.tsx
+13
-4
public/app/stores/FolderStore/FolderStore.ts
+9
-0
public/app/stores/PermissionsStore/PermissionsStore.ts
+7
-3
No files found.
public/app/containers/ManageDashboards/FolderPermissions.tsx
View file @
e6b82b2f
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
{
inject
,
observer
}
from
'mobx-react'
;
import
{
toJS
}
from
'mobx'
;
import
IContainerProps
from
'app/containers/IContainerProps'
;
...
...
@@ -8,6 +8,7 @@ import Tooltip from 'app/core/components/Tooltip/Tooltip';
import
PermissionsInfo
from
'app/core/components/Permissions/PermissionsInfo'
;
import
AddPermissions
from
'app/core/components/Permissions/AddPermissions'
;
import
SlideDown
from
'app/core/components/Animations/SlideDown'
;
@
inject
(
'nav'
,
'folder'
,
'view'
,
'permissions'
)
@
observer
export
class
FolderPermissions
extends
Component
<
IContainerProps
,
any
>
{
...
...
public/app/containers/ManageDashboards/FolderSettings.jest.tsx
View file @
e6b82b2f
...
...
@@ -14,6 +14,7 @@ describe('FolderSettings', () => {
dashboard
:
{
id
:
1
,
title
:
'Folder Name'
,
uid
:
'uid-str'
,
},
meta
:
{
url
:
'/dashboards/f/uid/folder-name'
,
...
...
@@ -23,19 +24,27 @@ describe('FolderSettings', () => {
);
const
store
=
RootStore
.
create
(
{},
{
view
:
{
path
:
'asd'
,
query
:
{},
routeParams
:
{
uid
:
'uid-str'
,
},
},
},
{
backendSrv
:
backendSrv
,
}
);
wrapper
=
shallow
(<
FolderSettings
backendSrv=
{
backendSrv
}
{
...
store
}
/>);
return
wrapper
.
dive
()
page
=
wrapper
.
dive
();
return
page
.
instance
()
.
loadStore
()
.
then
(()
=>
{
page
=
wrapper
.
div
e
();
page
.
updat
e
();
});
});
...
...
public/app/stores/FolderStore/FolderStore.ts
View file @
e6b82b2f
...
...
@@ -5,6 +5,7 @@ export const Folder = types.model('Folder', {
title
:
types
.
string
,
url
:
types
.
string
,
canSave
:
types
.
boolean
,
uid
:
types
.
string
,
hasChanged
:
types
.
boolean
,
});
...
...
@@ -14,15 +15,23 @@ export const FolderStore = types
})
.
actions
(
self
=>
({
load
:
flow
(
function
*
load
(
uid
:
string
)
{
// clear folder state
if
(
self
.
folder
&&
self
.
folder
.
uid
!==
uid
)
{
self
.
folder
=
null
;
}
const
backendSrv
=
getEnv
(
self
).
backendSrv
;
const
res
=
yield
backendSrv
.
getDashboardByUid
(
uid
);
self
.
folder
=
Folder
.
create
({
id
:
res
.
dashboard
.
id
,
title
:
res
.
dashboard
.
title
,
url
:
res
.
meta
.
url
,
uid
:
res
.
dashboard
.
uid
,
canSave
:
res
.
meta
.
canSave
,
hasChanged
:
false
,
});
return
res
;
}),
...
...
public/app/stores/PermissionsStore/PermissionsStore.ts
View file @
e6b82b2f
...
...
@@ -115,6 +115,7 @@ export const PermissionsStore = types
self
.
fetching
=
false
;
self
.
error
=
null
;
}),
addStoreItem
:
flow
(
function
*
addStoreItem
()
{
self
.
error
=
null
;
let
item
=
{
...
...
@@ -152,11 +153,13 @@ export const PermissionsStore = types
resetNewType
();
return
updateItems
(
self
);
}),
removeStoreItem
:
flow
(
function
*
removeStoreItem
(
idx
:
number
)
{
self
.
error
=
null
;
self
.
items
.
splice
(
idx
,
1
);
return
updateItems
(
self
);
}),
updatePermissionOnIndex
:
flow
(
function
*
updatePermissionOnIndex
(
idx
:
number
,
permission
:
number
,
...
...
@@ -166,18 +169,19 @@ export const PermissionsStore = types
self
.
items
[
idx
].
updatePermission
(
permission
,
permissionName
);
return
updateItems
(
self
);
}),
setNewType
(
newType
:
string
)
{
self
.
newItem
=
NewPermissionsItem
.
create
({
type
:
newType
});
},
resetNewType
()
{
resetNewType
();
},
toggleAddPermissions
()
{
self
.
isAddPermissionsVisible
=
!
self
.
isAddPermissionsVisible
;
},
showAddPermissions
()
{
self
.
isAddPermissionsVisible
=
true
;
},
hideAddPermissions
()
{
self
.
isAddPermissionsVisible
=
false
;
},
...
...
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