mirror of https://github.com/grafana/grafana
Add avatar to team and team members page (#10305)
* teams: add db migration for email column in teams table * teams: /teams should render index page with a 200 OK * teams: additional backend functionality for team and team members Possibility to save/update email for teams. Possibility to retrive avatar url when searching for teams. Possibility to retrive avatar url when searching for team members. * teams: display team avatar and team member avatars Possibility to save and update email for a team * teams: create team on separate page instead of modal dialogpull/10313/head
parent
d41ce4f9ca
commit
af34f9977e
@ -1,13 +1,13 @@ |
|||||||
import './org_users_ctrl'; |
import "./org_users_ctrl"; |
||||||
import './profile_ctrl'; |
import "./profile_ctrl"; |
||||||
import './org_users_ctrl'; |
import "./org_users_ctrl"; |
||||||
import './select_org_ctrl'; |
import "./select_org_ctrl"; |
||||||
import './change_password_ctrl'; |
import "./change_password_ctrl"; |
||||||
import './new_org_ctrl'; |
import "./new_org_ctrl"; |
||||||
import './user_invite_ctrl'; |
import "./user_invite_ctrl"; |
||||||
import './teams_ctrl'; |
import "./teams_ctrl"; |
||||||
import './team_details_ctrl'; |
import "./team_details_ctrl"; |
||||||
import './create_team_modal'; |
import "./create_team_ctrl"; |
||||||
import './org_api_keys_ctrl'; |
import "./org_api_keys_ctrl"; |
||||||
import './org_details_ctrl'; |
import "./org_details_ctrl"; |
||||||
import './prefs_control'; |
import "./prefs_control"; |
||||||
|
|||||||
@ -0,0 +1,26 @@ |
|||||||
|
import coreModule from "app/core/core_module"; |
||||||
|
|
||||||
|
export default class CreateTeamCtrl { |
||||||
|
name: string; |
||||||
|
email: string; |
||||||
|
navModel: any; |
||||||
|
|
||||||
|
/** @ngInject **/ |
||||||
|
constructor(private backendSrv, private $location, navModelSrv) { |
||||||
|
this.navModel = navModelSrv.getNav("cfg", "teams", 0); |
||||||
|
} |
||||||
|
|
||||||
|
create() { |
||||||
|
const payload = { |
||||||
|
name: this.name, |
||||||
|
email: this.email |
||||||
|
}; |
||||||
|
this.backendSrv.post("/api/teams", payload).then(result => { |
||||||
|
if (result.teamId) { |
||||||
|
this.$location.path("/org/teams/edit/" + result.teamId); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
coreModule.controller("CreateTeamCtrl", CreateTeamCtrl); |
||||||
@ -1,36 +0,0 @@ |
|||||||
///<reference path="../../headers/common.d.ts" />
|
|
||||||
|
|
||||||
import coreModule from 'app/core/core_module'; |
|
||||||
import appEvents from 'app/core/app_events'; |
|
||||||
|
|
||||||
export class CreateTeamCtrl { |
|
||||||
teamName = ''; |
|
||||||
|
|
||||||
/** @ngInject */ |
|
||||||
constructor(private backendSrv, private $location) {} |
|
||||||
|
|
||||||
createTeam() { |
|
||||||
this.backendSrv.post('/api/teams', { name: this.teamName }).then(result => { |
|
||||||
if (result.teamId) { |
|
||||||
this.$location.path('/org/teams/edit/' + result.teamId); |
|
||||||
} |
|
||||||
this.dismiss(); |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
dismiss() { |
|
||||||
appEvents.emit('hide-modal'); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
export function createTeamModal() { |
|
||||||
return { |
|
||||||
restrict: 'E', |
|
||||||
templateUrl: 'public/app/features/org/partials/create_team.html', |
|
||||||
controller: CreateTeamCtrl, |
|
||||||
bindToController: true, |
|
||||||
controllerAs: 'ctrl', |
|
||||||
}; |
|
||||||
} |
|
||||||
|
|
||||||
coreModule.directive('createTeamModal', createTeamModal); |
|
||||||
@ -1,27 +1,26 @@ |
|||||||
<div class="modal-body"> |
<page-header model="ctrl.navModel"></page-header> |
||||||
<div class="modal-header"> |
|
||||||
<h2 class="modal-header-title"> |
|
||||||
<i class="gicon gicon-team"></i> |
|
||||||
<span class="p-l-1">Create Team</span> |
|
||||||
</h2> |
|
||||||
|
|
||||||
<a class="modal-header-close" ng-click="ctrl.dismiss();"> |
<div class="page-container page-body" ng-cloak> |
||||||
<i class="fa fa-remove"></i> |
<h3 class="page-sub-heading">New Team</h3> |
||||||
</a> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="modal-content"> |
<form name="ctrl.saveForm" class="gf-form-group" ng-submit="ctrl.create()"> |
||||||
<form name="ctrl.createTeamForm" class="gf-form-group" novalidate> |
<div class="gf-form max-width-30"> |
||||||
<div class="p-t-2"> |
<span class="gf-form-label width-10">Name</span> |
||||||
<div class="gf-form-inline"> |
<input type="text" required ng-model="ctrl.name" class="gf-form-input max-width-22" give-focus="true"> |
||||||
<div class="gf-form max-width-21"> |
</div> |
||||||
<input type="text" class="gf-form-input" ng-model='ctrl.teamName' required give-focus="true" placeholder="Enter Team Name"></input> |
<div class="gf-form max-width-30"> |
||||||
</div> |
<span class="gf-form-label width-10"> |
||||||
<div class="gf-form"> |
Email |
||||||
<button class="btn gf-form-btn btn-success" ng-click="ctrl.createTeam();ctrl.dismiss();">Create</button> |
<info-popover mode="right-normal"> |
||||||
</div> |
This is optional and is primarily used for allowing custom team avatars. |
||||||
</div> |
</info-popover> |
||||||
</div> |
</span> |
||||||
</form> |
<input class="gf-form-input max-width-22" type="email" ng-model="ctrl.email" placeholder="email@test.com"> |
||||||
</div> |
</div> |
||||||
|
<div class="gf-form-button-row"> |
||||||
|
<button type="submit" class="btn btn-success width-12"> |
||||||
|
<i class="fa fa-save"></i> Create |
||||||
|
</button> |
||||||
|
</div> |
||||||
|
</form> |
||||||
</div> |
</div> |
||||||
|
|||||||
Loading…
Reference in new issue