mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
frontend part with mock-team-list
This commit is contained in:
parent
0550ec6de1
commit
1bb5a57036
@ -3,53 +3,70 @@
|
|||||||
<div class="page-container page-body">
|
<div class="page-container page-body">
|
||||||
<h3 class="page-sub-heading">User Profile</h3>
|
<h3 class="page-sub-heading">User Profile</h3>
|
||||||
|
|
||||||
<form name="ctrl.userForm" class="gf-form-group">
|
<form name="ctrl.userForm" class="gf-form-group">
|
||||||
|
|
||||||
<div class="gf-form max-width-30">
|
<div class="gf-form max-width-30">
|
||||||
<span class="gf-form-label width-8">Name</span>
|
<span class="gf-form-label width-8">Name</span>
|
||||||
<input class="gf-form-input max-width-22" type="text" required ng-model="ctrl.user.name" >
|
<input class="gf-form-input max-width-22" type="text" required ng-model="ctrl.user.name">
|
||||||
</div>
|
</div>
|
||||||
<div class="gf-form max-width-30">
|
<div class="gf-form max-width-30">
|
||||||
<span class="gf-form-label width-8">Email</span>
|
<span class="gf-form-label width-8">Email</span>
|
||||||
<input class="gf-form-input max-width-22" type="email" ng-readonly="ctrl.readonlyLoginFields" required ng-model="ctrl.user.email">
|
<input class="gf-form-input max-width-22" type="email" ng-readonly="ctrl.readonlyLoginFields" required ng-model="ctrl.user.email">
|
||||||
<i ng-if="ctrl.readonlyLoginFields" class="fa fa-lock gf-form-icon--right-absolute" bs-tooltip="'Login Details Locked - managed in another system.'"></i>
|
<i ng-if="ctrl.readonlyLoginFields" class="fa fa-lock gf-form-icon--right-absolute" bs-tooltip="'Login Details Locked - managed in another system.'"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="gf-form max-width-30">
|
<div class="gf-form max-width-30">
|
||||||
<span class="gf-form-label width-8">Username</span>
|
<span class="gf-form-label width-8">Username</span>
|
||||||
<input class="gf-form-input max-width-22" type="text" ng-readonly="ctrl.readonlyLoginFields" required ng-model="ctrl.user.login">
|
<input class="gf-form-input max-width-22" type="text" ng-readonly="ctrl.readonlyLoginFields" required ng-model="ctrl.user.login">
|
||||||
<i ng-if="ctrl.readonlyLoginFields" class="fa fa-lock gf-form-icon--right-absolute" bs-tooltip="'Login Details Locked - managed in another system.'"></i>
|
<i ng-if="ctrl.readonlyLoginFields" class="fa fa-lock gf-form-icon--right-absolute" bs-tooltip="'Login Details Locked - managed in another system.'"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="gf-form-button-row">
|
<div class="gf-form-button-row">
|
||||||
<button type="submit" class="btn btn-success" ng-click="ctrl.update()">Save</button>
|
<button type="submit" class="btn btn-success" ng-click="ctrl.update()">Save</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<prefs-control mode="user"></prefs-control>
|
<prefs-control mode="user"></prefs-control>
|
||||||
|
|
||||||
<h3 class="page-heading" ng-show="ctrl.showOrgsList">Organizations</h3>
|
<h3 class="page-heading">Teams</h3>
|
||||||
|
<div class="gf-form-group" ng-show="ctrl.showTeamsList">
|
||||||
|
<table class="filter-table form-inline">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Email</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr ng-repeat="team in ctrl.user.teams">
|
||||||
|
<td>{{team.name}}</td>
|
||||||
|
<td>{{team.email}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3 class="page-heading" ng-show="ctrl.showOrgsList">Organizations</h3>
|
||||||
<div class="gf-form-group" ng-show="ctrl.showOrgsList">
|
<div class="gf-form-group" ng-show="ctrl.showOrgsList">
|
||||||
<table class="filter-table form-inline">
|
<table class="filter-table form-inline">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Role</th>
|
<th>Role</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="org in ctrl.orgs">
|
<tr ng-repeat="org in ctrl.orgs">
|
||||||
<td>{{org.name}}</td>
|
<td>{{org.name}}</td>
|
||||||
<td>{{org.role}}</td>
|
<td>{{org.role}}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<span class="btn btn-primary btn-mini" ng-show="org.orgId === contextSrv.user.orgId">
|
<span class="btn btn-primary btn-mini" ng-show="org.orgId === contextSrv.user.orgId">
|
||||||
Current
|
Current
|
||||||
</span>
|
</span>
|
||||||
<a ng-click="ctrl.setUsingOrg(org)" class="btn btn-inverse btn-mini" ng-show="org.orgId !== contextSrv.user.orgId">
|
<a ng-click="ctrl.setUsingOrg(org)" class="btn btn-inverse btn-mini" ng-show="org.orgId !== contextSrv.user.orgId">
|
||||||
Select
|
Select
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -4,8 +4,10 @@ import { coreModule } from 'app/core/core';
|
|||||||
export class ProfileCtrl {
|
export class ProfileCtrl {
|
||||||
user: any;
|
user: any;
|
||||||
old_theme: any;
|
old_theme: any;
|
||||||
|
teams: any = [];
|
||||||
orgs: any = [];
|
orgs: any = [];
|
||||||
userForm: any;
|
userForm: any;
|
||||||
|
showTeamsList = false;
|
||||||
showOrgsList = false;
|
showOrgsList = false;
|
||||||
readonlyLoginFields = config.disableLoginForm;
|
readonlyLoginFields = config.disableLoginForm;
|
||||||
navModel: any;
|
navModel: any;
|
||||||
@ -13,6 +15,7 @@ export class ProfileCtrl {
|
|||||||
/** @ngInject **/
|
/** @ngInject **/
|
||||||
constructor(private backendSrv, private contextSrv, private $location, navModelSrv) {
|
constructor(private backendSrv, private contextSrv, private $location, navModelSrv) {
|
||||||
this.getUser();
|
this.getUser();
|
||||||
|
this.getUserTeams();
|
||||||
this.getUserOrgs();
|
this.getUserOrgs();
|
||||||
this.navModel = navModelSrv.getNav('profile', 'profile-settings', 0);
|
this.navModel = navModelSrv.getNav('profile', 'profile-settings', 0);
|
||||||
}
|
}
|
||||||
@ -24,6 +27,18 @@ export class ProfileCtrl {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getUserTeams() {
|
||||||
|
console.log(this.backendSrv.get('/api/teams'));
|
||||||
|
this.backendSrv.get('/api/user').then(teams => {
|
||||||
|
this.user.teams = [
|
||||||
|
{ name: 'Backend', email: 'backend@grafana.com', members: 2 },
|
||||||
|
{ name: 'Frontend', email: 'frontend@grafana.com', members: 2 },
|
||||||
|
{ name: 'Ops', email: 'ops@grafana.com', members: 2 },
|
||||||
|
];
|
||||||
|
this.showTeamsList = this.user.teams.length > 1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
getUserOrgs() {
|
getUserOrgs() {
|
||||||
this.backendSrv.get('/api/user/orgs').then(orgs => {
|
this.backendSrv.get('/api/user/orgs').then(orgs => {
|
||||||
this.orgs = orgs;
|
this.orgs = orgs;
|
||||||
|
Loading…
Reference in New Issue
Block a user