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
efe7279e
Commit
efe7279e
authored
Jan 19, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Quick fix for frontend for account to user split
parent
1c5f9027
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
79 additions
and
82 deletions
+79
-82
src/app/features/account/accountUsersCtrl.js
+9
-11
src/app/features/account/partials/users.html
+10
-10
src/app/features/admin/adminUsersCtrl.js
+5
-6
src/app/features/admin/partials/users.html
+7
-7
src/app/features/all.js
+3
-3
src/app/features/profile/partials/profile.html
+12
-12
src/app/features/profile/profileCtrl.js
+14
-17
src/app/partials/sidemenu.html
+10
-7
src/app/routes/backend/all.js
+9
-9
No files found.
src/app/features/account/
collaborato
rsCtrl.js
→
src/app/features/account/
accountUse
rsCtrl.js
View file @
efe7279e
...
...
@@ -6,9 +6,9 @@ function (angular) {
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'
Collaborato
rsCtrl'
,
function
(
$scope
,
$http
,
backendSrv
)
{
module
.
controller
(
'
AccountUse
rsCtrl'
,
function
(
$scope
,
$http
,
backendSrv
)
{
$scope
.
collaborato
r
=
{
$scope
.
use
r
=
{
loginOrEmail
:
''
,
role
:
'Viewer'
,
};
...
...
@@ -18,29 +18,27 @@ function (angular) {
};
$scope
.
get
=
function
()
{
backendSrv
.
get
(
'/api/account/
collaborators'
).
then
(
function
(
collaborato
rs
)
{
$scope
.
collaborators
=
collaborato
rs
;
backendSrv
.
get
(
'/api/account/
users'
).
then
(
function
(
use
rs
)
{
$scope
.
users
=
use
rs
;
});
};
$scope
.
remove
Collaborator
=
function
(
collaborato
r
)
{
$scope
.
remove
User
=
function
(
use
r
)
{
backendSrv
.
request
({
method
:
'DELETE'
,
url
:
'/api/account/collaborators/'
+
collaborator
.
id
,
desc
:
'Remove collaborator'
,
url
:
'/api/account/users/'
+
user
.
id
,
}).
then
(
$scope
.
get
);
};
$scope
.
add
Collaborato
r
=
function
()
{
$scope
.
add
Use
r
=
function
()
{
if
(
!
$scope
.
form
.
$valid
)
{
return
;
}
backendSrv
.
request
({
method
:
'PUT'
,
url
:
'/api/account/collaborators'
,
data
:
$scope
.
collaborator
,
desc
:
'Add collaborator'
url
:
'/api/account/users'
,
data
:
$scope
.
user
,
}).
then
(
$scope
.
get
);
};
...
...
src/app/features/account/partials/
collaborato
rs.html
→
src/app/features/account/partials/
use
rs.html
View file @
efe7279e
<div
ng-include=
"'app/partials/navbar.html'"
ng-init=
"pageTitle='Account >
Collaborato
rs'"
></div>
<div
ng-include=
"'app/partials/navbar.html'"
ng-init=
"pageTitle='Account >
Use
rs'"
></div>
<div
class=
"dashboard-edit-view"
style=
"min-height: 500px"
>
<div
class=
"dashboard-editor-header"
>
<div
class=
"dashboard-editor-title"
>
<i
class=
"fa fa-users"
></i>
Collaborato
rs
Account use
rs
</div>
</div>
...
...
@@ -17,20 +17,20 @@
<div
class=
"tight-form"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 160px"
>
<strong>
username or e
mail
</strong>
<strong>
Username or E
mail
</strong>
</li>
<li>
<input
type=
"text"
ng-model=
"
collaborator.loginoremail"
required
class=
"input-xlarge tight-form-input"
placeholder=
"collaborator@email.com
"
>
<input
type=
"text"
ng-model=
"
user.loginOrEmail"
required
class=
"input-xlarge tight-form-input"
placeholder=
"user@email.com or username
"
>
</li>
<li
class=
"tight-form-item"
>
role
</li>
<li>
<select
type=
"text"
ng-model=
"
collaborato
r.role"
class=
"input-small tight-form-input"
ng-options=
"f for f in ['viewer', 'editor', 'admin']"
>
<select
type=
"text"
ng-model=
"
use
r.role"
class=
"input-small tight-form-input"
ng-options=
"f for f in ['viewer', 'editor', 'admin']"
>
</select>
</li>
<li>
<button
class=
"btn btn-success tight-form-btn"
ng-click=
"add
collaborator()"
>
a
dd
</button>
<button
class=
"btn btn-success tight-form-btn"
ng-click=
"add
User()"
>
A
dd
</button>
</li>
</ul>
<div
class=
"clearfix"
></div>
...
...
@@ -42,13 +42,13 @@
<div
class=
"editor-row row"
>
<table
class=
"grafana-options-table span5"
>
<tr
ng-repeat=
"
collaborator in collaborato
rs"
>
<td>
{{
collaborato
r.email}}
</td>
<tr
ng-repeat=
"
user in use
rs"
>
<td>
{{
use
r.email}}
</td>
<td>
{{
collaborato
r.role}}
{{
use
r.role}}
</td>
<td
style=
"width: 1%"
>
<a
ng-click=
"remove
Collaborator(collaborato
r)"
class=
"btn btn-danger btn-mini"
>
<a
ng-click=
"remove
User(use
r)"
class=
"btn btn-danger btn-mini"
>
<i
class=
"fa fa-remove"
></i>
</a>
</td>
...
...
src/app/features/admin/a
ccount
sCtrl.js
→
src/app/features/admin/a
dminUser
sCtrl.js
View file @
efe7279e
...
...
@@ -6,17 +6,16 @@ function (angular) {
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'A
ccount
sCtrl'
,
function
(
$scope
,
backendSrv
)
{
module
.
controller
(
'A
dminUser
sCtrl'
,
function
(
$scope
,
backendSrv
)
{
$scope
.
init
=
function
()
{
$scope
.
accounts
=
[];
$scope
.
get
Account
s
();
$scope
.
get
User
s
();
};
$scope
.
getAccounts
=
function
()
{
backendSrv
.
get
(
'/api/admin/accounts'
).
then
(
function
(
accounts
)
{
console
.
log
(
accounts
);
$scope
.
accounts
=
accounts
;
$scope
.
getUsers
=
function
()
{
backendSrv
.
get
(
'/api/admin/users'
).
then
(
function
(
users
)
{
$scope
.
users
=
users
;
});
};
...
...
src/app/features/admin/partials/
account
s.html
→
src/app/features/admin/partials/
user
s.html
View file @
efe7279e
<div
ng-include=
"'app/partials/navbar.html'"
ng-init=
"pageTitle='Admin >
Account
s'"
></div>
<div
ng-include=
"'app/partials/navbar.html'"
ng-init=
"pageTitle='Admin >
User
s'"
></div>
<div
class=
"dashboard-edit-view"
style=
"min-height: 500px"
>
...
...
@@ -15,12 +15,12 @@
<th>
Admin
</th>
<th></th>
</tr>
<tr
ng-repeat=
"
account in account
s"
>
<td>
{{
account
.id}}
</td>
<td>
{{
account
.login}}
</td>
<td>
{{
account
.email}}
</td>
<td>
{{
account
.name}}
</td>
<td>
{{
account
.isAdmin}}
</td>
<tr
ng-repeat=
"
user in user
s"
>
<td>
{{
user
.id}}
</td>
<td>
{{
user
.login}}
</td>
<td>
{{
user
.email}}
</td>
<td>
{{
user
.name}}
</td>
<td>
{{
user
.isAdmin}}
</td>
<td
style=
"width: 1%"
>
<a
ng-click=
"edit(variable)"
class=
"btn btn-success btn-small"
>
<i
class=
"fa fa-edit"
></i>
...
...
src/app/features/all.js
View file @
efe7279e
...
...
@@ -7,11 +7,11 @@ define([
'./opentsdb/datasource'
,
'./elasticsearch/datasource'
,
'./dashboard/all'
,
'./
account/account
Ctrl'
,
'./account/
collaborato
rsCtrl'
,
'./
profile/profile
Ctrl'
,
'./account/
accountUse
rsCtrl'
,
'./account/datasourcesCtrl'
,
'./account/apiKeysCtrl'
,
'./account/importCtrl'
,
'./admin/a
ccount
sCtrl'
,
'./admin/a
dminUser
sCtrl'
,
'./grafanaDatasource/datasource'
,
],
function
()
{});
src/app/features/
account/partials/account
.html
→
src/app/features/
profile/partials/profile
.html
View file @
efe7279e
<div
ng-include=
"'app/partials/navbar.html'"
ng-init=
"pageTitle='
Account Settings
'"
></div>
<div
ng-include=
"'app/partials/navbar.html'"
ng-init=
"pageTitle='
Profile
'"
></div>
<div
class=
"dashboard-edit-view"
>
<div
class=
"editor-row"
>
...
...
@@ -7,13 +7,13 @@
<div
class=
"dashboard-editor-header"
>
<div
class=
"dashboard-editor-title"
>
<i
class=
"fa fa-user"
></i>
Account details
Your info
</div>
</div>
<div
class=
"dashboard-editor-body"
>
<form
name=
"
account
Form"
>
<form
name=
"
user
Form"
>
<div
class=
"tight-form"
>
<ul
class=
"tight-form-list"
>
...
...
@@ -21,7 +21,7 @@
<strong>
Name
</strong>
</li>
<li>
<input
type=
"text"
required
ng-model=
"
account
.name"
class=
"input-xxlarge tight-form-input last"
>
<input
type=
"text"
required
ng-model=
"
user
.name"
class=
"input-xxlarge tight-form-input last"
>
</li>
</ul>
<div
class=
"clearfix"
></div>
...
...
@@ -32,7 +32,7 @@
<strong>
Email
</strong>
</li>
<li>
<input
type=
"text"
required
ng-model=
"
account
.email"
class=
"input-xxlarge tight-form-input last"
>
<input
type=
"text"
required
ng-model=
"
user
.email"
class=
"input-xxlarge tight-form-input last"
>
</li>
</ul>
<div
class=
"clearfix"
></div>
...
...
@@ -43,7 +43,7 @@
<strong>
Username
</strong>
</li>
<li>
<input
type=
"text"
required
ng-model=
"
account
.login"
class=
"input-xxlarge tight-form-input last"
>
<input
type=
"text"
required
ng-model=
"
user
.login"
class=
"input-xxlarge tight-form-input last"
>
</li>
</ul>
<div
class=
"clearfix"
></div>
...
...
@@ -65,14 +65,14 @@
<br>
<table
class=
"grafana-options-table"
>
<tr
ng-repeat=
"
other in otherA
ccounts"
>
<td>
email: {{
other
.email}}
</td>
<td>
role: {{
other
.role}}
</td>
<td
ng-show=
"
other
.isUsing"
>
<tr
ng-repeat=
"
ac in a
ccounts"
>
<td>
email: {{
ac
.email}}
</td>
<td>
role: {{
ac
.role}}
</td>
<td
ng-show=
"
ac
.isUsing"
>
currently using this account
</td>
<td
ng-show=
"!
other
.isUsing"
>
<a
ng-click=
"setUsingAccount(
other
)"
class=
"btn btn-success btn-mini"
>
<td
ng-show=
"!
ac
.isUsing"
>
<a
ng-click=
"setUsingAccount(
ac
)"
class=
"btn btn-success btn-mini"
>
Select
</a>
</td>
...
...
src/app/features/
account/account
Ctrl.js
→
src/app/features/
profile/profile
Ctrl.js
View file @
efe7279e
...
...
@@ -6,40 +6,37 @@ function (angular) {
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'AccountCtrl'
,
function
(
$scope
,
$http
,
backendSrv
)
{
$scope
.
collaborator
=
{};
module
.
controller
(
'ProfileCtrl'
,
function
(
$scope
,
$http
,
backendSrv
)
{
$scope
.
init
=
function
()
{
$scope
.
getAccount
();
$scope
.
getOtherAccounts
();
$scope
.
getUser
();
$scope
.
getUserAccounts
();
};
$scope
.
get
Account
=
function
()
{
backendSrv
.
get
(
'/api/
account/'
).
then
(
function
(
account
)
{
$scope
.
account
=
account
;
$scope
.
get
User
=
function
()
{
backendSrv
.
get
(
'/api/
user'
).
then
(
function
(
user
)
{
$scope
.
user
=
user
;
});
};
$scope
.
get
Oth
erAccounts
=
function
()
{
backendSrv
.
get
(
'/api/
account/others'
).
then
(
function
(
otherA
ccounts
)
{
$scope
.
otherAccounts
=
otherA
ccounts
;
$scope
.
get
Us
erAccounts
=
function
()
{
backendSrv
.
get
(
'/api/
user/accounts'
).
then
(
function
(
a
ccounts
)
{
$scope
.
accounts
=
a
ccounts
;
});
};
$scope
.
setUsingAccount
=
function
(
otherA
ccount
)
{
$scope
.
setUsingAccount
=
function
(
a
ccount
)
{
backendSrv
.
request
({
method
:
'POST'
,
url
:
'/api/
account/using/'
+
otherA
ccount
.
accountId
,
url
:
'/api/
user/using/'
+
a
ccount
.
accountId
,
desc
:
'Change active account'
,
}).
then
(
$scope
.
get
Oth
erAccounts
);
}).
then
(
$scope
.
get
Us
erAccounts
);
};
$scope
.
update
=
function
()
{
if
(
!
$scope
.
account
Form
.
$valid
)
{
return
;
}
if
(
!
$scope
.
user
Form
.
$valid
)
{
return
;
}
backendSrv
.
post
(
'/api/
account/'
,
$scope
.
account
);
backendSrv
.
post
(
'/api/
user/'
,
$scope
.
user
);
};
$scope
.
init
();
...
...
src/app/partials/sidemenu.html
View file @
efe7279e
...
...
@@ -16,12 +16,8 @@
<i
class=
"fa fa-sitemap"
></i>
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
class=
"pro-sidemenu-link"
href=
"account/users"
>
<i
class=
"fa fa-users"
></i>
Users
</a>
<a
class=
"pro-sidemenu-link"
href=
"account/apikeys"
>
<i
class=
"fa fa-key"
></i>
API Keys
...
...
@@ -30,9 +26,16 @@
<i
class=
"fa fa-download"
></i>
Import
</a>
<a
class=
"pro-sidemenu-link"
href=
"admin/accounts"
ng-if=
"grafana.user.isGrafanaAdmin"
>
<a
class=
"pro-sidemenu-link"
href=
"profile"
>
<i
class=
"fa fa-user"
></i>
Profile
</a>
<a
class=
"pro-sidemenu-link"
href=
"admin/users"
ng-if=
"grafana.user.isGrafanaAdmin"
>
<i
class=
"fa fa-institution"
></i>
Admin
</a>
<a
class=
"pro-sidemenu-link"
href=
"login?logout"
>
<i
class=
"fa fa-sign-out"
></i>
Sign out
</a>
...
...
src/app/routes/backend/all.js
View file @
efe7279e
...
...
@@ -34,9 +34,9 @@ define([
templateUrl
:
'app/features/account/partials/datasources.html'
,
controller
:
'DataSourcesCtrl'
,
})
.
when
(
'/account/
collaborato
rs'
,
{
templateUrl
:
'app/features/account/partials/
collaborato
rs.html'
,
controller
:
'
Collaborato
rsCtrl'
,
.
when
(
'/account/
use
rs'
,
{
templateUrl
:
'app/features/account/partials/
use
rs.html'
,
controller
:
'
AccountUse
rsCtrl'
,
})
.
when
(
'/account/apikeys'
,
{
templateUrl
:
'app/features/account/partials/apikeys.html'
,
...
...
@@ -46,13 +46,13 @@ define([
templateUrl
:
'app/features/account/partials/import.html'
,
controller
:
'ImportCtrl'
,
})
.
when
(
'/
account
'
,
{
templateUrl
:
'app/features/
account/partials/account
.html'
,
controller
:
'
Account
Ctrl'
,
.
when
(
'/
profile
'
,
{
templateUrl
:
'app/features/
profile/partials/profile
.html'
,
controller
:
'
Profile
Ctrl'
,
})
.
when
(
'/admin/
account
s'
,
{
templateUrl
:
'app/features/admin/partials/
account
s.html'
,
controller
:
'A
ccount
sCtrl'
,
.
when
(
'/admin/
user
s'
,
{
templateUrl
:
'app/features/admin/partials/
user
s.html'
,
controller
:
'A
dminUser
sCtrl'
,
})
.
when
(
'/login'
,
{
templateUrl
:
'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