From 1bb5a57036d435299bc287bb4e93eab92b77f7bd Mon Sep 17 00:00:00 2001 From: Patrick O'Carroll Date: Fri, 27 Jul 2018 13:45:16 +0200 Subject: [PATCH] frontend part with mock-team-list --- public/app/features/org/partials/profile.html | 99 +++++++++++-------- public/app/features/org/profile_ctrl.ts | 15 +++ 2 files changed, 73 insertions(+), 41 deletions(-) diff --git a/public/app/features/org/partials/profile.html b/public/app/features/org/partials/profile.html index 66e41fbb4b4..96540911290 100644 --- a/public/app/features/org/partials/profile.html +++ b/public/app/features/org/partials/profile.html @@ -3,53 +3,70 @@

User Profile

-
+ -
- Name - -
-
- Email - +
+ Name + +
+
+ Email +
-
- Username +
+ Username
-
- -
- +
+ +
+ - + -

Organizations

+

Teams

+
+ + + + + + + + + + + + + +
NameEmail
{{team.name}}{{team.email}}
+
+ +

Organizations

- - - - - - - - - - - - - - - -
NameRole
{{org.name}}{{org.role}} - - Current - - - Select - -
-
- + + + + + + + + + + + + + + + +
NameRole
{{org.name}}{{org.role}} + + Current + + + Select + +
+
diff --git a/public/app/features/org/profile_ctrl.ts b/public/app/features/org/profile_ctrl.ts index 5c62a7a5fdb..1ac950699be 100644 --- a/public/app/features/org/profile_ctrl.ts +++ b/public/app/features/org/profile_ctrl.ts @@ -4,8 +4,10 @@ import { coreModule } from 'app/core/core'; export class ProfileCtrl { user: any; old_theme: any; + teams: any = []; orgs: any = []; userForm: any; + showTeamsList = false; showOrgsList = false; readonlyLoginFields = config.disableLoginForm; navModel: any; @@ -13,6 +15,7 @@ export class ProfileCtrl { /** @ngInject **/ constructor(private backendSrv, private contextSrv, private $location, navModelSrv) { this.getUser(); + this.getUserTeams(); this.getUserOrgs(); 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() { this.backendSrv.get('/api/user/orgs').then(orgs => { this.orgs = orgs;