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
85837881
Commit
85837881
authored
Oct 10, 2018
by
Peter Holmberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disable permissions
parent
83480a1d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
9 deletions
+28
-9
public/app/features/datasources/DataSourcePermissions.tsx
+21
-9
public/app/features/datasources/state/actions.ts
+7
-0
No files found.
public/app/features/datasources/DataSourcePermissions.tsx
View file @
85837881
...
...
@@ -6,6 +6,7 @@ import DataSourcePermissionsList from './DataSourcePermissionsList';
import
{
AclTarget
}
from
'app/types/acl'
;
import
{
addDataSourcePermission
,
disableDataSourcePermissions
,
enableDataSourcePermissions
,
loadDataSourcePermissions
,
removeDataSourcePermission
,
...
...
@@ -18,6 +19,7 @@ export interface Props {
pageId
:
number
;
addDataSourcePermission
:
typeof
addDataSourcePermission
;
enableDataSourcePermissions
:
typeof
enableDataSourcePermissions
;
disableDataSourcePermissions
:
typeof
disableDataSourcePermissions
;
loadDataSourcePermissions
:
typeof
loadDataSourcePermissions
;
removeDataSourcePermission
:
typeof
removeDataSourcePermission
;
}
...
...
@@ -52,6 +54,12 @@ export class DataSourcePermissions extends PureComponent<Props, State> {
enableDataSourcePermissions
(
pageId
);
};
onDisablePermissions
=
()
=>
{
const
{
pageId
,
disableDataSourcePermissions
}
=
this
.
props
;
disableDataSourcePermissions
(
pageId
);
};
onAddPermission
=
state
=>
{
const
{
pageId
,
addDataSourcePermission
}
=
this
.
props
;
const
data
=
{
...
...
@@ -89,16 +97,19 @@ export class DataSourcePermissions extends PureComponent<Props, State> {
<
div
className=
"page-action-bar"
>
<
h3
className=
"page-sub-heading"
>
Permissions
</
h3
>
<
div
className=
"page-action-bar__spacer"
/>
{
!
isPermissionsEnabled
&&
(
<
button
className=
"btn btn-success pull-right"
onClick=
{
this
.
onEnablePermissions
}
disabled=
{
isAdding
}
>
Enable Permissions
</
button
>
)
}
{
isPermissionsEnabled
&&
(
<
button
className=
"btn btn-success pull-right"
onClick=
{
this
.
onOpenAddPermissions
}
disabled=
{
isAdding
}
>
{
isPermissionsEnabled
&&
[
<
button
key=
"add-permission"
className=
"btn btn-success pull-right"
onClick=
{
this
.
onOpenAddPermissions
}
disabled=
{
isAdding
}
>
<
i
className=
"fa fa-plus"
/>
Add Permission
</
button
>
)
}
</
button
>,
<
button
key=
"disable-permissions"
className=
"btn btn-danger pull-right"
onClick=
{
this
.
onDisablePermissions
}
>
Disable Permissions
</
button
>,
]
}
</
div
>
{
!
isPermissionsEnabled
?
(
<
div
className=
"empty-list-cta"
>
...
...
@@ -140,6 +151,7 @@ function mapStateToProps(state) {
const
mapDispatchToProps
=
{
addDataSourcePermission
,
enableDataSourcePermissions
,
disableDataSourcePermissions
,
loadDataSourcePermissions
,
removeDataSourcePermission
,
};
...
...
public/app/features/datasources/state/actions.ts
View file @
85837881
...
...
@@ -173,6 +173,13 @@ export function enableDataSourcePermissions(id: number): ThunkResult<void> {
};
}
export
function
disableDataSourcePermissions
(
id
:
number
):
ThunkResult
<
void
>
{
return
async
dispatch
=>
{
await
getBackendSrv
().
post
(
`/api/datasources/
${
id
}
/disable-permissions`
,
{});
dispatch
(
loadDataSourcePermissions
(
id
));
};
}
export
function
addDataSourcePermission
(
id
:
number
,
data
:
object
):
ThunkResult
<
void
>
{
return
async
dispatch
=>
{
await
getBackendSrv
().
post
(
`/api/datasources/
${
id
}
/permissions`
,
data
);
...
...
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