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
4ece7fc0
Commit
4ece7fc0
authored
Jan 16, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/tokens' into pro
parents
d3cc6e51
3887aa72
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
0 deletions
+68
-0
src/app/features/account/accountCtrl.js
+29
-0
src/app/features/account/partials/account.html
+39
-0
No files found.
src/app/features/account/accountCtrl.js
View file @
4ece7fc0
...
...
@@ -9,10 +9,20 @@ function (angular) {
module
.
controller
(
'AccountCtrl'
,
function
(
$scope
,
$http
,
backendSrv
)
{
$scope
.
collaborator
=
{};
$scope
.
token
=
{
role
:
"ReadWrite"
};
$scope
.
roleTypes
=
[
"ReadWrite"
,
"Read"
];
$scope
.
showTokens
=
false
;
$scope
.
init
=
function
()
{
$scope
.
getAccount
();
$scope
.
getOtherAccounts
();
$scope
.
getTokens
();
};
$scope
.
getAccount
=
function
()
{
...
...
@@ -35,6 +45,25 @@ function (angular) {
}).
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
()
{
if
(
!
$scope
.
accountForm
.
$valid
)
{
return
;
}
...
...
src/app/features/account/partials/account.html
View file @
4ece7fc0
...
...
@@ -81,6 +81,45 @@
</table>
</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>
...
...
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