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
9d1dacb8
Commit
9d1dacb8
authored
Jan 15, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Worked on account update, moved collaborators to its own view
parent
f3bb2d41
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
142 additions
and
83 deletions
+142
-83
src/app/features/account/accountCtrl.js
+3
-19
src/app/features/account/collaboratorsCtrl.js
+48
-0
src/app/features/account/partials/account.html
+40
-63
src/app/features/account/partials/collaborators.html
+42
-0
src/app/features/all.js
+1
-0
src/app/partials/sidemenu.html
+4
-1
src/app/routes/backend/all.js
+4
-0
No files found.
src/app/features/account/accountCtrl.js
View file @
9d1dacb8
...
...
@@ -18,7 +18,6 @@ function (angular) {
$scope
.
getAccount
=
function
()
{
backendSrv
.
get
(
'/api/account/'
).
then
(
function
(
account
)
{
$scope
.
account
=
account
;
$scope
.
collaborators
=
account
.
collaborators
;
});
};
...
...
@@ -36,25 +35,10 @@ function (angular) {
}).
then
(
$scope
.
getOtherAccounts
);
};
$scope
.
removeCollaborator
=
function
(
collaborator
)
{
backendSrv
.
request
({
method
:
'DELETE'
,
url
:
'/api/account/collaborators/'
+
collaborator
.
id
,
desc
:
'Remove collaborator'
,
}).
then
(
$scope
.
getAccount
);
};
$scope
.
update
=
function
()
{
if
(
!
$scope
.
accountForm
.
$valid
)
{
return
;
}
$scope
.
addCollaborator
=
function
()
{
if
(
!
$scope
.
addCollaboratorForm
.
$valid
)
{
return
;
}
backendSrv
.
request
({
method
:
'PUT'
,
url
:
'/api/account/collaborators'
,
data
:
$scope
.
collaborator
,
desc
:
'Add collaborator'
}).
then
(
$scope
.
getAccount
);
backendSrv
.
post
(
'/api/account/'
,
$scope
.
account
);
};
$scope
.
init
();
...
...
src/app/features/account/collaboratorsCtrl.js
0 → 100644
View file @
9d1dacb8
define
([
'angular'
,
],
function
(
angular
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'CollaboratorsCtrl'
,
function
(
$scope
,
$http
,
backendSrv
)
{
$scope
.
collaborator
=
{};
$scope
.
init
=
function
()
{
$scope
.
get
();
};
$scope
.
get
=
function
()
{
backendSrv
.
get
(
'/api/account/collaborators'
).
then
(
function
(
collaborators
)
{
$scope
.
collaborators
=
collaborators
;
console
.
log
(
collaborators
);
});
};
$scope
.
removeCollaborator
=
function
(
collaborator
)
{
backendSrv
.
request
({
method
:
'DELETE'
,
url
:
'/api/account/collaborators/'
+
collaborator
.
id
,
desc
:
'Remove collaborator'
,
}).
then
(
$scope
.
get
);
};
$scope
.
addCollaborator
=
function
()
{
if
(
!
$scope
.
addCollaboratorForm
.
$valid
)
{
return
;
}
backendSrv
.
request
({
method
:
'PUT'
,
url
:
'/api/account/collaborators'
,
data
:
$scope
.
collaborator
,
desc
:
'Add collaborator'
}).
then
(
$scope
.
get
);
};
$scope
.
init
();
});
});
src/app/features/account/partials/account.html
View file @
9d1dacb8
...
...
@@ -8,38 +8,54 @@
<div
class=
"dashboard-editor-header"
>
<div
class=
"dashboard-editor-title"
>
<i
class=
"fa fa-user"
></i>
Personal information
Account details
</div>
</div>
<div
class=
"dashboard-editor-body"
>
<div
class=
"editor-row"
>
<div
class=
"editor-option"
>
<label
class=
"small"
>
Name
</label>
<input
type=
"text"
class=
"input-xxlarge"
ng-model=
'account.name'
placeholder=
"name"
></input>
</div>
</div>
<div
class=
"editor-row"
>
<div
class=
"editor-option"
>
<label
class=
"small"
>
Email
</label>
<input
type=
"text"
class=
"input-xxlarge"
ng-model=
'account.email'
placeholder=
"name"
></input>
<form
name=
"accountForm"
>
<div
class=
"grafana-target"
>
<div
class=
"grafana-target-inner"
>
<ul
class=
"grafana-segment-list"
>
<li
class=
"grafana-target-segment"
style=
"width: 80px"
>
<strong>
Name
</strong>
</li>
<li>
<input
type=
"text"
ng-model=
"account.name"
class=
"input-xxlarge grafana-target-segment-input last"
>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
<div
class=
"grafana-target-inner"
style=
"margin-top: 10px"
>
<ul
class=
"grafana-segment-list"
>
<li
class=
"grafana-target-segment"
style=
"width: 80px"
>
<strong>
Email
</strong>
</li>
<li>
<input
type=
"text"
ng-model=
"account.email"
class=
"input-xxlarge grafana-target-segment-input last"
>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
<div
class=
"grafana-target-inner"
style=
"margin-top: 10px"
>
<ul
class=
"grafana-segment-list"
>
<li
class=
"grafana-target-segment"
style=
"width: 80px"
>
<strong>
Username
</strong>
</li>
<li>
<input
type=
"text"
ng-model=
"account.login"
class=
"input-xxlarge grafana-target-segment-input last"
>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
</div>
</div>
<div
class=
"editor-row"
>
<div
class=
"editor-option"
>
<label
class=
"small"
>
Account Name
</label>
<input
type=
"text"
class=
"input-xxlarge"
ng-model=
'account.accountName'
placeholder=
"name"
></input>
</div>
</div>
</div>
<div
class=
"dashboard-editor-footer"
>
<button
class=
"btn btn-success"
>
Update
</button>
<br>
<button
type=
"submit"
class=
"btn btn-success"
ng-click=
"update()"
>
Update
</button>
</form>
</div>
</div>
<div
class=
"section"
>
...
...
@@ -70,43 +86,4 @@
</div>
</div>
<div
class=
"dashboard-edit-view"
style=
"border-top: solid 1px black;"
>
<div
class=
"dashboard-editor-header"
>
<div
class=
"dashboard-editor-title"
>
<i
class=
"fa fa-users"
></i>
Collaborators
</div>
</div>
<div
class=
"dashboard-editor-body"
>
<div
class=
"editor-row"
>
<div
class=
"editor-option"
>
<form
name=
"addCollaboratorForm"
class=
"form-inline"
>
<label
class=
"small"
>
Add a collaborator
</label>
<input
type=
"text"
class=
"input-xxlarge"
ng-model=
'collaborator.email'
placeholder=
"collaborator@email.com"
></input>
<button
class=
"btn btn-success"
ng-click=
"addCollaborator()"
>
Add
</button>
</form>
</div>
</div>
<div
class=
"editor-row row"
>
<table
class=
"grafana-options-table span5"
>
<tr
ng-repeat=
"collaborator in account.collaborators"
>
<td>
{{collaborator.email}}
</td>
<td>
{{collaborator.role}}
</td>
<td
style=
"width: 1%"
>
<a
ng-click=
"removeCollaborator(collaborator)"
class=
"btn btn-danger btn-mini"
>
<i
class=
"fa fa-remove"
></i>
</a>
</td>
</tr>
</table>
</div>
</div>
</div>
src/app/features/account/partials/collaborators.html
0 → 100644
View file @
9d1dacb8
<div
ng-include=
"'app/partials/navbar.html'"
ng-init=
"pageTitle='Account > Collaborators'"
></div>
<div
class=
"dashboard-edit-view"
>
<div
class=
"dashboard-editor-header"
>
<div
class=
"dashboard-editor-title"
>
<i
class=
"fa fa-users"
></i>
Collaborators
</div>
</div>
<div
class=
"dashboard-editor-body"
>
<div
class=
"editor-row"
>
<div
class=
"editor-option"
>
<form
name=
"addCollaboratorForm"
class=
"form-inline"
>
<label
class=
"small"
>
Add a collaborator
</label>
<input
type=
"text"
class=
"input-xxlarge"
ng-model=
'collaborator.email'
placeholder=
"collaborator@email.com"
></input>
<button
class=
"btn btn-success"
ng-click=
"addCollaborator()"
>
Add
</button>
</form>
</div>
</div>
<div
class=
"editor-row row"
>
<table
class=
"grafana-options-table span5"
>
<tr
ng-repeat=
"collaborator in collaborators"
>
<td>
{{collaborator.email}}
</td>
<td>
{{collaborator.role}}
</td>
<td
style=
"width: 1%"
>
<a
ng-click=
"removeCollaborator(collaborator)"
class=
"btn btn-danger btn-mini"
>
<i
class=
"fa fa-remove"
></i>
</a>
</td>
</tr>
</table>
</div>
</div>
</div>
src/app/features/all.js
View file @
9d1dacb8
...
...
@@ -8,6 +8,7 @@ define([
'./elasticsearch/datasource'
,
'./dashboard/all'
,
'./account/accountCtrl'
,
'./account/collaboratorsCtrl'
,
'./account/datasourcesCtrl'
,
'./admin/accountsCtrl'
,
'./grafanaDatasource/datasource'
,
...
...
src/app/partials/sidemenu.html
View file @
9d1dacb8
...
...
@@ -22,12 +22,15 @@
</a>
<a
class=
"pro-sidemenu-link"
href=
"account/datasources"
>
<i
class=
"fa fa-sitemap"
></i>
Data
sources
Data
</a>
<a
class=
"pro-sidemenu-link"
href=
"account"
>
<i
class=
"fa fa-user"
></i>
Account
</a>
<a
class=
"pro-sidemenu-link"
href=
"account/collaborators"
>
<i
class=
"fa fa-users"
></i>
Collaborators
</a>
<a
class=
"pro-sidemenu-link"
href=
"admin/accounts"
ng-if=
"grafana.user.isAdmin"
>
<i
class=
"fa fa-institution"
></i>
Admin
</a>
...
...
src/app/routes/backend/all.js
View file @
9d1dacb8
...
...
@@ -34,6 +34,10 @@ define([
templateUrl
:
'app/features/account/partials/datasources.html'
,
controller
:
'DataSourcesCtrl'
,
})
.
when
(
'/account/collaborators'
,
{
templateUrl
:
'app/features/account/partials/collaborators.html'
,
controller
:
'CollaboratorsCtrl'
,
})
.
when
(
'/account'
,
{
templateUrl
:
'app/features/account/partials/account.html'
,
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