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
aaa717aa
Commit
aaa717aa
authored
Jan 16, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring apikeys into its own view
parent
4ece7fc0
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
105 additions
and
67 deletions
+105
-67
src/app/features/account/accountCtrl.js
+0
-27
src/app/features/account/apiKeysCtrl.js
+40
-0
src/app/features/account/partials/account.html
+0
-40
src/app/features/account/partials/apikeys.html
+57
-0
src/app/features/all.js
+1
-0
src/app/partials/sidemenu.html
+3
-0
src/app/routes/backend/all.js
+4
-0
No files found.
src/app/features/account/accountCtrl.js
View file @
aaa717aa
...
@@ -9,19 +9,11 @@ function (angular) {
...
@@ -9,19 +9,11 @@ function (angular) {
module
.
controller
(
'AccountCtrl'
,
function
(
$scope
,
$http
,
backendSrv
)
{
module
.
controller
(
'AccountCtrl'
,
function
(
$scope
,
$http
,
backendSrv
)
{
$scope
.
collaborator
=
{};
$scope
.
collaborator
=
{};
$scope
.
token
=
{
role
:
"ReadWrite"
};
$scope
.
roleTypes
=
[
"ReadWrite"
,
"Read"
];
$scope
.
showTokens
=
false
;
$scope
.
showTokens
=
false
;
$scope
.
init
=
function
()
{
$scope
.
init
=
function
()
{
$scope
.
getAccount
();
$scope
.
getAccount
();
$scope
.
getOtherAccounts
();
$scope
.
getOtherAccounts
();
$scope
.
getTokens
();
};
};
...
@@ -45,25 +37,6 @@ function (angular) {
...
@@ -45,25 +37,6 @@ function (angular) {
}).
then
(
$scope
.
getOtherAccounts
);
}).
then
(
$scope
.
getOtherAccounts
);
};
};
$scope
.
getTokens
=
function
()
{
backendSrv
.
get
(
'/api/tokens'
).
then
(
function
(
tokens
)
{
$scope
.
tokens
=
tokens
;
});
}
$scope
.
removeToken
=
function
(
id
)
{
backendSrv
.
delete
(
'/api/tokens/'
+
id
).
then
(
$scope
.
getTokens
);
}
$scope
.
addToken
=
function
()
{
backendSrv
.
request
({
method
:
'PUT'
,
url
:
'/api/tokens'
,
data
:
$scope
.
token
,
desc
:
'Add token'
}).
then
(
$scope
.
getTokens
);
}
$scope
.
update
=
function
()
{
$scope
.
update
=
function
()
{
if
(
!
$scope
.
accountForm
.
$valid
)
{
return
;
}
if
(
!
$scope
.
accountForm
.
$valid
)
{
return
;
}
...
...
src/app/features/account/apiKeysCtrl.js
0 → 100644
View file @
aaa717aa
define
([
'angular'
,
],
function
(
angular
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'ApiKeysCtrl'
,
function
(
$scope
,
$http
,
backendSrv
)
{
$scope
.
roleTypes
=
[
'Viewer'
,
'Editor'
,
'Admin'
];
$scope
.
token
=
{
role
:
'Viewer'
};
$scope
.
init
=
function
()
{
$scope
.
getTokens
();
};
$scope
.
getTokens
=
function
()
{
backendSrv
.
get
(
'/api/tokens'
).
then
(
function
(
tokens
)
{
$scope
.
tokens
=
tokens
;
});
};
$scope
.
removeToken
=
function
(
id
)
{
backendSrv
.
delete
(
'/api/tokens/'
+
id
).
then
(
$scope
.
getTokens
);
};
$scope
.
addToken
=
function
()
{
backendSrv
.
request
({
method
:
'PUT'
,
url
:
'/api/tokens'
,
data
:
$scope
.
token
,
desc
:
'Add token'
}).
then
(
$scope
.
getTokens
);
};
$scope
.
init
();
});
});
src/app/features/account/partials/account.html
View file @
aaa717aa
<div
ng-include=
"'app/partials/navbar.html'"
ng-init=
"pageTitle='Account Settings'"
></div>
<div
ng-include=
"'app/partials/navbar.html'"
ng-init=
"pageTitle='Account Settings'"
></div>
<div
class=
"dashboard-edit-view"
>
<div
class=
"dashboard-edit-view"
>
...
@@ -81,45 +80,6 @@
...
@@ -81,45 +80,6 @@
</table>
</table>
</div>
</div>
<div
class=
"clearfix"
></div><br><br>
<div
class=
"section"
>
<div
class=
"dashboard-editor-header"
>
<div
class=
"dashboard-editor-title"
>
<i
class=
"fa fa-key"
></i>
API Tokens
<a
ng-click=
"showTokens=!showTokens"
>
<i
class=
"fa fa-sort-up"
ng-show=
"showTokens"
></i>
<i
class=
"fa fa-sort-down"
ng-hide=
"showTokens"
></i>
</a>
</div>
</div>
<br>
<div
ng-show=
"showTokens"
>
<div
class=
"editor-row"
>
<div
class=
"editor-option"
>
<form
name=
"addTokenrForm"
class=
"form-inline"
>
<label
class=
"small"
>
Add a Token
</label>
<input
type=
"text"
class=
"input-xlarge"
ng-model=
'token.name'
placeholder=
"Name"
></input>
<select
ng-model=
"token.role"
ng-options=
"r for r in roleTypes"
></select>
<button
class=
"btn btn-success"
ng-click=
"addToken()"
>
Add
</button>
</form>
</div>
</div>
<table
class=
"grafana-options-table"
>
<tr
ng-repeat=
"t in tokens"
>
<td>
{{t.name}}
</td>
<td>
{{t.role}}
</td>
<td>
{{t.token}}
</td>
<td
style=
"width: 1%"
>
<a
ng-click=
"removeToken(t.id)"
class=
"btn btn-danger btn-mini"
>
<i
class=
"fa fa-remove"
></i>
</a>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
src/app/features/account/partials/apikeys.html
0 → 100644
View file @
aaa717aa
<div
ng-include=
"'app/partials/navbar.html'"
ng-init=
"pageTitle='Account > API Keys'"
></div>
<div
class=
"dashboard-edit-view"
style=
"min-height: 500px"
>
<div
class=
"dashboard-editor-header"
>
<div
class=
"dashboard-editor-title"
>
<i
class=
"fa fa-key"
></i>
API Tokens
</div>
</div>
<div
class=
"dashboard-editor-body"
>
<div
class=
"editor-row"
>
<div
class=
"section"
>
<form
name=
"addTokenrForm"
class=
"form-inline tight-form"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
>
Add a Token
</li>
<li>
<input
type=
"text"
class=
"input-xlarge tight-form-input"
ng-model=
'token.name'
placeholder=
"Name"
></input>
</li>
<li
class=
"tight-form-item"
>
Role
</li>
<li>
<select
class=
"input-small tight-form-input"
ng-model=
"token.role"
ng-options=
"r for r in roleTypes"
></select>
</li>
<button
class=
"btn btn-success tight-form-btn"
ng-click=
"addToken()"
>
Add
</button>
</li>
</ul>
<div
class=
"clearfix"
></div>
</form>
</div>
<div
class=
"editor-row row"
>
<div
class=
"section span6"
>
<table
class=
"grafana-options-table"
>
<tr
ng-repeat=
"t in tokens"
>
<td>
{{t.name}}
</td>
<td>
{{t.role}}
</td>
<td>
{{t.token}}
</td>
<td
style=
"width: 1%"
>
<a
ng-click=
"removeToken(t.id)"
class=
"btn btn-danger btn-mini"
>
<i
class=
"fa fa-remove"
></i>
</a>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
src/app/features/all.js
View file @
aaa717aa
...
@@ -10,6 +10,7 @@ define([
...
@@ -10,6 +10,7 @@ define([
'./account/accountCtrl'
,
'./account/accountCtrl'
,
'./account/collaboratorsCtrl'
,
'./account/collaboratorsCtrl'
,
'./account/datasourcesCtrl'
,
'./account/datasourcesCtrl'
,
'./account/apiKeysCtrl'
,
'./admin/accountsCtrl'
,
'./admin/accountsCtrl'
,
'./grafanaDatasource/datasource'
,
'./grafanaDatasource/datasource'
,
],
function
()
{});
],
function
()
{});
src/app/partials/sidemenu.html
View file @
aaa717aa
...
@@ -31,6 +31,9 @@
...
@@ -31,6 +31,9 @@
<a
class=
"pro-sidemenu-link"
href=
"account/collaborators"
>
<a
class=
"pro-sidemenu-link"
href=
"account/collaborators"
>
<i
class=
"fa fa-users"
></i>
Collaborators
<i
class=
"fa fa-users"
></i>
Collaborators
</a>
</a>
<a
class=
"pro-sidemenu-link"
href=
"account/apikeys"
>
<i
class=
"fa fa-key"
></i>
API Keys
</a>
<a
class=
"pro-sidemenu-link"
href=
"admin/accounts"
ng-if=
"grafana.user.isAdmin"
>
<a
class=
"pro-sidemenu-link"
href=
"admin/accounts"
ng-if=
"grafana.user.isAdmin"
>
<i
class=
"fa fa-institution"
></i>
Admin
<i
class=
"fa fa-institution"
></i>
Admin
</a>
</a>
...
...
src/app/routes/backend/all.js
View file @
aaa717aa
...
@@ -38,6 +38,10 @@ define([
...
@@ -38,6 +38,10 @@ define([
templateUrl
:
'app/features/account/partials/collaborators.html'
,
templateUrl
:
'app/features/account/partials/collaborators.html'
,
controller
:
'CollaboratorsCtrl'
,
controller
:
'CollaboratorsCtrl'
,
})
})
.
when
(
'/account/apikeys'
,
{
templateUrl
:
'app/features/account/partials/apikeys.html'
,
controller
:
'ApiKeysCtrl'
,
})
.
when
(
'/account'
,
{
.
when
(
'/account'
,
{
templateUrl
:
'app/features/account/partials/account.html'
,
templateUrl
:
'app/features/account/partials/account.html'
,
controller
:
'AccountCtrl'
,
controller
:
'AccountCtrl'
,
...
...
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