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
1e064f6c
Commit
1e064f6c
authored
Jun 21, 2017
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: first draft of permissionlist panel
for folder home page
parent
38142b37
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
213 additions
and
7 deletions
+213
-7
public/app/core/services/backend_srv.ts
+19
-7
public/app/plugins/panel/permissionlist/editor.html
+13
-0
public/app/plugins/panel/permissionlist/img/icn-singlestat-panel.svg
+75
-0
public/app/plugins/panel/permissionlist/module.html
+30
-0
public/app/plugins/panel/permissionlist/module.ts
+60
-0
public/app/plugins/panel/permissionlist/plugin.json
+16
-0
No files found.
public/app/core/services/backend_srv.ts
View file @
1e064f6c
...
...
@@ -220,7 +220,7 @@ export class BackendSrv {
createDashboardFolder
(
name
)
{
const
dash
=
{
title
:
name
,
editable
:
fals
e
,
editable
:
tru
e
,
hideControls
:
true
,
rows
:
[
{
...
...
@@ -228,22 +228,33 @@ export class BackendSrv {
{
folderId
:
0
,
headings
:
false
,
id
:
1
,
limit
:
1000
,
links
:
[],
query
:
''
,
recent
:
false
,
search
:
true
,
span
:
12
,
span
:
4
,
starred
:
false
,
tags
:
[],
title
:
'Dashboards'
,
title
:
'Dashboards
in this folder
'
,
type
:
'dashlist'
},
{
onlyAlertsOnDashboard
:
true
,
span
:
4
,
title
:
'Alerts in this folder'
,
type
:
'alertlist'
},
{
span
:
4
,
title
:
'Permissions for this folder'
,
type
:
'permissionlist'
,
folderId
:
0
}
],
showTitle
:
fals
e
,
title
:
'Dashboard List'
,
titleSize
:
'h
6
'
showTitle
:
tru
e
,
title
:
name
,
titleSize
:
'h
1
'
}
]
};
...
...
@@ -254,6 +265,7 @@ export class BackendSrv {
})
.
then
(
res
=>
{
res
.
dashboard
.
rows
[
0
].
panels
[
0
].
folderId
=
res
.
dashboard
.
id
;
res
.
dashboard
.
rows
[
0
].
panels
[
2
].
folderId
=
res
.
dashboard
.
id
;
return
this
.
saveDashboard
(
res
.
dashboard
,
{
overwrite
:
false
});
});
}
...
...
public/app/plugins/panel/permissionlist/editor.html
0 → 100644
View file @
1e064f6c
<div>
<div
class=
"section gf-form-group"
>
<h5
class=
"section-heading"
>
Options
</h5>
<div
class=
"gf-form"
>
<folder-picker
root-name=
"All"
initial-folder-id=
"ctrl.panel.folderId"
on-change=
"ctrl.onFolderChange($folder)"
label-class=
"width-6"
>
</folder-picker>
</div>
</div>
</div>
public/app/plugins/panel/permissionlist/img/icn-singlestat-panel.svg
0 → 100644
View file @
1e064f6c
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 20.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
version=
"1.1"
id=
"Layer_1"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
x=
"0px"
y=
"0px"
width=
"100px"
height=
"100px"
viewBox=
"0 0 100 100"
enable-background=
"new 0 0 100 100"
xml:space=
"preserve"
>
<g>
<path
fill=
"#1F1F1F"
d=
"M18.2,4.2c-1.5,0-2.9,0.6-3.9,1.6l-0.5,0.5l-0.5-0.5c-1-1.1-2.4-1.6-3.9-1.6S6.6,4.8,5.5,5.8
c-1,1-1.6,2.4-1.6,3.9s0.6,2.9,1.6,3.9l8.3,8.3l8.3-8.3c1-1,1.6-2.4,1.6-3.9s-0.6-2.9-1.6-3.9C21.1,4.8,19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7,0.7-1.1,1.7-1.1,2.8c0,1,0.4,2,1.1,2.8l7.1,7.1l7.2-7.2c0.7-0.7,1.1-1.7,1.1-2.8c0-1-0.4-2-1.1-2.8
c-0.7-0.7-1.7-1.1-2.8-1.1c-0.8,0-1.5,0.2-2.1,0.6l0.7-2.1c0.5-0.1,0.9-0.2,1.4-0.2c1.5,0,2.9,0.6,3.9,1.6c1,1,1.6,2.4,1.6,3.9
C23.8,60,23.2,61.4,22.1,62.4z"
/>
</g>
</svg>
public/app/plugins/panel/permissionlist/module.html
0 → 100644
View file @
1e064f6c
<section
class=
"card-section card-list-layout-list"
>
<ol
class=
"card-list"
>
<li
class=
"card-item-wrapper"
ng-repeat=
"permission in ctrl.userPermissions"
>
<div
class=
"card-item card-item--alert"
>
<div
class=
"card-item-header"
>
<div
class=
"card-item-sub-name"
>
{{permission.permissionName}}
</div>
</div>
<div
class=
"card-item-body"
>
<div
class=
"card-item-details"
>
<div
class=
"card-item-notice"
>
{{permission.userLogin}}
</div>
</div>
</div>
</div>
</div>
</li>
<li
class=
"card-item-wrapper"
ng-repeat=
"permission in ctrl.userGroupPermissions"
>
<div
class=
"card-item card-item--alert"
>
<div
class=
"card-item-header"
>
<div
class=
"card-item-sub-name"
>
{{permission.permissionName}}
</div>
</div>
<div
class=
"card-item-body"
>
<div
class=
"card-item-details"
>
<div
class=
"card-item-notice"
>
{{permission.userGroup}}
</div>
</div>
</div>
</div>
</div>
</li>
</ol>
</section>
public/app/plugins/panel/permissionlist/module.ts
0 → 100644
View file @
1e064f6c
///<reference path="../../../headers/common.d.ts" />
import
_
from
'lodash'
;
import
config
from
'app/core/config'
;
import
{
PanelCtrl
}
from
'app/plugins/sdk'
;
import
{
impressions
}
from
'app/features/dashboard/impression_store'
;
class
PermissionListCtrl
extends
PanelCtrl
{
static
templateUrl
=
'module.html'
;
userPermissions
:
any
[];
userGroupPermissions
:
any
[];
roles
:
any
[];
panelDefaults
=
{
folderId
:
0
};
/** @ngInject */
constructor
(
$scope
,
$injector
,
private
backendSrv
)
{
super
(
$scope
,
$injector
);
_
.
defaults
(
this
.
panel
,
this
.
panelDefaults
);
this
.
events
.
on
(
'refresh'
,
this
.
onRefresh
.
bind
(
this
));
this
.
events
.
on
(
'init-edit-mode'
,
this
.
onInitEditMode
.
bind
(
this
));
this
.
getPermissions
();
}
onInitEditMode
()
{
this
.
editorTabIndex
=
1
;
this
.
addEditorTab
(
'Options'
,
'public/app/plugins/panel/permissionlist/editor.html'
);
}
onRefresh
()
{
var
promises
=
[];
promises
.
push
(
this
.
getPermissions
());
return
Promise
.
all
(
promises
)
.
then
(
this
.
renderingCompleted
.
bind
(
this
));
}
onFolderChange
(
folder
:
any
)
{
this
.
panel
.
folderId
=
folder
.
id
;
this
.
refresh
();
}
getPermissions
()
{
return
this
.
backendSrv
.
get
(
`/api/dashboards/id/
${
this
.
panel
.
folderId
}
/acl`
)
.
then
(
result
=>
{
this
.
userPermissions
=
_
.
filter
(
result
,
p
=>
{
return
p
.
userId
>
0
;});
this
.
userGroupPermissions
=
_
.
filter
(
result
,
p
=>
{
return
p
.
userGroupId
>
0
;});
// this.roles = this.setRoles(result);
});
}
}
export
{
PermissionListCtrl
,
PermissionListCtrl
as
PanelCtrl
};
public/app/plugins/panel/permissionlist/plugin.json
0 → 100644
View file @
1e064f6c
{
"type"
:
"panel"
,
"name"
:
"Permission List"
,
"id"
:
"permissionlist"
,
"info"
:
{
"author"
:
{
"name"
:
"Grafana Project"
,
"url"
:
"https://grafana.com"
},
"logos"
:
{
"small"
:
"img/icn-singlestat-panel.svg"
,
"large"
:
"img/icn-singlestat-panel.svg"
}
}
}
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