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
a4f90fd1
Unverified
Commit
a4f90fd1
authored
Oct 10, 2018
by
Dan Cech
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add admin page to show enterprise license status
parent
d20b1583
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
7 deletions
+94
-7
pkg/api/index.go
+14
-7
public/app/features/admin/index.ts
+19
-0
public/app/features/admin/partials/licensing.html
+56
-0
public/app/routes/routes.ts
+5
-0
No files found.
pkg/api/index.go
View file @
a4f90fd1
...
...
@@ -316,6 +316,19 @@ func setIndexViewData(c *m.ReqContext) (*dtos.IndexViewData, error) {
}
if
c
.
IsGrafanaAdmin
{
children
:=
[]
*
dtos
.
NavLink
{
{
Text
:
"Users"
,
Id
:
"global-users"
,
Url
:
setting
.
AppSubUrl
+
"/admin/users"
,
Icon
:
"gicon gicon-user"
},
{
Text
:
"Orgs"
,
Id
:
"global-orgs"
,
Url
:
setting
.
AppSubUrl
+
"/admin/orgs"
,
Icon
:
"gicon gicon-org"
},
{
Text
:
"Settings"
,
Id
:
"server-settings"
,
Url
:
setting
.
AppSubUrl
+
"/admin/settings"
,
Icon
:
"gicon gicon-preferences"
},
{
Text
:
"Stats"
,
Id
:
"server-stats"
,
Url
:
setting
.
AppSubUrl
+
"/admin/stats"
,
Icon
:
"fa fa-fw fa-bar-chart"
},
}
if
setting
.
IsEnterprise
{
children
=
append
(
children
,
&
dtos
.
NavLink
{
Text
:
"Licensing"
,
Id
:
"licensing"
,
Url
:
setting
.
AppSubUrl
+
"/admin/licensing"
,
Icon
:
"fa fa-fw fa-unlock-alt"
})
}
children
=
append
(
children
,
&
dtos
.
NavLink
{
Text
:
"Style Guide"
,
Id
:
"styleguide"
,
Url
:
setting
.
AppSubUrl
+
"/styleguide"
,
Icon
:
"fa fa-fw fa-eyedropper"
})
cfgNode
.
Children
=
append
(
cfgNode
.
Children
,
&
dtos
.
NavLink
{
Text
:
"Server Admin"
,
HideFromTabs
:
true
,
...
...
@@ -323,13 +336,7 @@ func setIndexViewData(c *m.ReqContext) (*dtos.IndexViewData, error) {
Id
:
"admin"
,
Icon
:
"gicon gicon-shield"
,
Url
:
setting
.
AppSubUrl
+
"/admin/users"
,
Children
:
[]
*
dtos
.
NavLink
{
{
Text
:
"Users"
,
Id
:
"global-users"
,
Url
:
setting
.
AppSubUrl
+
"/admin/users"
,
Icon
:
"gicon gicon-user"
},
{
Text
:
"Orgs"
,
Id
:
"global-orgs"
,
Url
:
setting
.
AppSubUrl
+
"/admin/orgs"
,
Icon
:
"gicon gicon-org"
},
{
Text
:
"Settings"
,
Id
:
"server-settings"
,
Url
:
setting
.
AppSubUrl
+
"/admin/settings"
,
Icon
:
"gicon gicon-preferences"
},
{
Text
:
"Stats"
,
Id
:
"server-stats"
,
Url
:
setting
.
AppSubUrl
+
"/admin/stats"
,
Icon
:
"fa fa-fw fa-bar-chart"
},
{
Text
:
"Style Guide"
,
Id
:
"styleguide"
,
Url
:
setting
.
AppSubUrl
+
"/styleguide"
,
Icon
:
"fa fa-fw fa-eyedropper"
},
},
Children
:
children
,
})
}
...
...
public/app/features/admin/index.ts
View file @
a4f90fd1
...
...
@@ -4,6 +4,7 @@ import AdminListOrgsCtrl from './AdminListOrgsCtrl';
import
AdminEditOrgCtrl
from
'./AdminEditOrgCtrl'
;
import
StyleGuideCtrl
from
'./StyleGuideCtrl'
;
import
config
from
'app/core/config'
;
import
coreModule
from
'app/core/core_module'
;
class
AdminSettingsCtrl
{
...
...
@@ -35,3 +36,21 @@ coreModule.controller('AdminEditOrgCtrl', AdminEditOrgCtrl);
coreModule
.
controller
(
'AdminSettingsCtrl'
,
AdminSettingsCtrl
);
coreModule
.
controller
(
'AdminHomeCtrl'
,
AdminHomeCtrl
);
coreModule
.
controller
(
'StyleGuideCtrl'
,
StyleGuideCtrl
);
if
(
config
.
buildInfo
.
isEnterprise
)
{
class
AdminLicensingCtrl
{
navModel
:
any
;
/** @ngInject */
constructor
(
$scope
,
backendSrv
,
navModelSrv
)
{
this
.
navModel
=
navModelSrv
.
getNav
(
'cfg'
,
'admin'
,
'licensing'
,
1
);
backendSrv
.
get
(
'/api/licensing/token'
).
then
(
token
=>
{
token
.
maxUsers
=
token
.
max_users
>=
0
?
token
.
max_users
:
'Unlimited'
;
$scope
.
token
=
token
;
});
}
}
coreModule
.
controller
(
'AdminLicensingCtrl'
,
AdminLicensingCtrl
);
}
public/app/features/admin/partials/licensing.html
0 → 100644
View file @
a4f90fd1
<page-header
model=
"ctrl.navModel"
></page-header>
<div
class=
"page-container page-body"
>
<table
class=
"filter-table form-inline"
>
<tbody>
<tr>
<td
colspan=
"2"
class=
"admin-settings-section"
>
License Details
</td>
</tr>
<tr>
<td>
License ID
</td>
<td>
{{token.lid}} (
<a
href=
"{{token.iss}}/licenses/{{token.lid}}"
target=
"_blank"
rel=
"noopener noreferer"
>
View Details
</a>
)
</td>
</tr>
<tr>
<td>
Licensed URL
</td>
<td><a
href=
"{{token.sub}}"
target=
"_blank"
rel=
"noopener noreferer"
>
{{token.sub}}
</a></td>
</tr>
<tr>
<td>
Company
</td>
<td>
{{token.company}}
</td>
</tr>
<tr>
<td>
Products
</td>
<td>
<div
ng-repeat=
"product in token.prod"
>
{{product}}
</div>
</td>
</tr>
<tr>
<td>
Max Users
</td>
<td>
{{token.maxUsers}}
</td>
</tr>
<tr>
<td>
License Issued
</td>
<td>
{{token.nbf*1000 | date:'medium'}}
</td>
</tr>
<tr>
<td>
License Expires
</td>
<td>
{{token.lexp*1000 | date:'medium'}}
</td>
</tr>
<tr>
<td
colspan=
"2"
class=
"admin-settings-section"
>
Token Details
</td>
</tr>
<tr>
<td>
Token ID
</td>
<td>
{{token.jti}}
</td>
</tr>
<tr>
<td>
Token Issued
</td>
<td>
{{token.iat*1000 | date:'medium'}}
</td>
</tr>
<tr>
<td>
Token Expires
</td>
<td>
{{token.exp*1000 | date:'medium'}}
</td>
</tr>
</tbody>
</table>
</div>
public/app/routes/routes.ts
View file @
a4f90fd1
...
...
@@ -225,6 +225,11 @@ export function setupAngularRoutes($routeProvider, $locationProvider) {
component
:
()
=>
ServerStats
,
},
})
.
when
(
'/admin/licensing'
,
{
templateUrl
:
'public/app/features/admin/partials/licensing.html'
,
controller
:
'AdminLicensingCtrl'
,
controllerAs
:
'ctrl'
,
})
// LOGIN / SIGNUP
.
when
(
'/login'
,
{
templateUrl
:
'public/app/partials/login.html'
,
...
...
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