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
Hide 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
{
inject
,
observer
}
from
'mobx-react'
;
import
{
toJS
}
from
'mobx'
;
import
{
toJS
}
from
'mobx'
;
import
IContainerProps
from
'app/containers/IContainerProps'
;
import
IContainerProps
from
'app/containers/IContainerProps'
;
...
@@ -8,6 +8,7 @@ import Tooltip from 'app/core/components/Tooltip/Tooltip';
...
@@ -8,6 +8,7 @@ import Tooltip from 'app/core/components/Tooltip/Tooltip';
import
PermissionsInfo
from
'app/core/components/Permissions/PermissionsInfo'
;
import
PermissionsInfo
from
'app/core/components/Permissions/PermissionsInfo'
;
import
AddPermissions
from
'app/core/components/Permissions/AddPermissions'
;
import
AddPermissions
from
'app/core/components/Permissions/AddPermissions'
;
import
SlideDown
from
'app/core/components/Animations/SlideDown'
;
import
SlideDown
from
'app/core/components/Animations/SlideDown'
;
@
inject
(
'nav'
,
'folder'
,
'view'
,
'permissions'
)
@
inject
(
'nav'
,
'folder'
,
'view'
,
'permissions'
)
@
observer
@
observer
export
class
FolderPermissions
extends
Component
<
IContainerProps
,
any
>
{
export
class
FolderPermissions
extends
Component
<
IContainerProps
,
any
>
{
...
...
public/app/containers/ManageDashboards/FolderSettings.jest.tsx
View file @
e6b82b2f
...
@@ -14,6 +14,7 @@ describe('FolderSettings', () => {
...
@@ -14,6 +14,7 @@ describe('FolderSettings', () => {
dashboard
:
{
dashboard
:
{
id
:
1
,
id
:
1
,
title
:
'Folder Name'
,
title
:
'Folder Name'
,
uid
:
'uid-str'
,
},
},
meta
:
{
meta
:
{
url
:
'/dashboards/f/uid/folder-name'
,
url
:
'/dashboards/f/uid/folder-name'
,
...
@@ -23,19 +24,27 @@ describe('FolderSettings', () => {
...
@@ -23,19 +24,27 @@ describe('FolderSettings', () => {
);
);
const
store
=
RootStore
.
create
(
const
store
=
RootStore
.
create
(
{},
{
view
:
{
path
:
'asd'
,
query
:
{},
routeParams
:
{
uid
:
'uid-str'
,
},
},
},
{
{
backendSrv
:
backendSrv
,
backendSrv
:
backendSrv
,
}
}
);
);
wrapper
=
shallow
(<
FolderSettings
backendSrv=
{
backendSrv
}
{
...
store
}
/>);
wrapper
=
shallow
(<
FolderSettings
backendSrv=
{
backendSrv
}
{
...
store
}
/>);
return
wrapper
page
=
wrapper
.
dive
();
.
dive
()
return
page
.
instance
()
.
instance
()
.
loadStore
()
.
loadStore
()
.
then
(()
=>
{
.
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', {
...
@@ -5,6 +5,7 @@ export const Folder = types.model('Folder', {
title
:
types
.
string
,
title
:
types
.
string
,
url
:
types
.
string
,
url
:
types
.
string
,
canSave
:
types
.
boolean
,
canSave
:
types
.
boolean
,
uid
:
types
.
string
,
hasChanged
:
types
.
boolean
,
hasChanged
:
types
.
boolean
,
});
});
...
@@ -14,15 +15,23 @@ export const FolderStore = types
...
@@ -14,15 +15,23 @@ export const FolderStore = types
})
})
.
actions
(
self
=>
({
.
actions
(
self
=>
({
load
:
flow
(
function
*
load
(
uid
:
string
)
{
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
backendSrv
=
getEnv
(
self
).
backendSrv
;
const
res
=
yield
backendSrv
.
getDashboardByUid
(
uid
);
const
res
=
yield
backendSrv
.
getDashboardByUid
(
uid
);
self
.
folder
=
Folder
.
create
({
self
.
folder
=
Folder
.
create
({
id
:
res
.
dashboard
.
id
,
id
:
res
.
dashboard
.
id
,
title
:
res
.
dashboard
.
title
,
title
:
res
.
dashboard
.
title
,
url
:
res
.
meta
.
url
,
url
:
res
.
meta
.
url
,
uid
:
res
.
dashboard
.
uid
,
canSave
:
res
.
meta
.
canSave
,
canSave
:
res
.
meta
.
canSave
,
hasChanged
:
false
,
hasChanged
:
false
,
});
});
return
res
;
return
res
;
}),
}),
...
...
public/app/stores/PermissionsStore/PermissionsStore.ts
View file @
e6b82b2f
...
@@ -115,6 +115,7 @@ export const PermissionsStore = types
...
@@ -115,6 +115,7 @@ export const PermissionsStore = types
self
.
fetching
=
false
;
self
.
fetching
=
false
;
self
.
error
=
null
;
self
.
error
=
null
;
}),
}),
addStoreItem
:
flow
(
function
*
addStoreItem
()
{
addStoreItem
:
flow
(
function
*
addStoreItem
()
{
self
.
error
=
null
;
self
.
error
=
null
;
let
item
=
{
let
item
=
{
...
@@ -152,11 +153,13 @@ export const PermissionsStore = types
...
@@ -152,11 +153,13 @@ export const PermissionsStore = types
resetNewType
();
resetNewType
();
return
updateItems
(
self
);
return
updateItems
(
self
);
}),
}),
removeStoreItem
:
flow
(
function
*
removeStoreItem
(
idx
:
number
)
{
removeStoreItem
:
flow
(
function
*
removeStoreItem
(
idx
:
number
)
{
self
.
error
=
null
;
self
.
error
=
null
;
self
.
items
.
splice
(
idx
,
1
);
self
.
items
.
splice
(
idx
,
1
);
return
updateItems
(
self
);
return
updateItems
(
self
);
}),
}),
updatePermissionOnIndex
:
flow
(
function
*
updatePermissionOnIndex
(
updatePermissionOnIndex
:
flow
(
function
*
updatePermissionOnIndex
(
idx
:
number
,
idx
:
number
,
permission
:
number
,
permission
:
number
,
...
@@ -166,18 +169,19 @@ export const PermissionsStore = types
...
@@ -166,18 +169,19 @@ export const PermissionsStore = types
self
.
items
[
idx
].
updatePermission
(
permission
,
permissionName
);
self
.
items
[
idx
].
updatePermission
(
permission
,
permissionName
);
return
updateItems
(
self
);
return
updateItems
(
self
);
}),
}),
setNewType
(
newType
:
string
)
{
setNewType
(
newType
:
string
)
{
self
.
newItem
=
NewPermissionsItem
.
create
({
type
:
newType
});
self
.
newItem
=
NewPermissionsItem
.
create
({
type
:
newType
});
},
},
resetNewType
()
{
resetNewType
()
{
resetNewType
();
resetNewType
();
},
},
toggleAddPermissions
()
{
toggleAddPermissions
()
{
self
.
isAddPermissionsVisible
=
!
self
.
isAddPermissionsVisible
;
self
.
isAddPermissionsVisible
=
!
self
.
isAddPermissionsVisible
;
},
},
showAddPermissions
()
{
self
.
isAddPermissionsVisible
=
true
;
},
hideAddPermissions
()
{
hideAddPermissions
()
{
self
.
isAddPermissionsVisible
=
false
;
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