mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 08:42:15 +08:00
feat(user invite): progress on user invite feature, #2353
This commit is contained in:
@ -3,6 +3,7 @@ define([
|
||||
'./datasourceEditCtrl',
|
||||
'./orgUsersCtrl',
|
||||
'./newOrgCtrl',
|
||||
'./userInviteCtrl',
|
||||
'./orgApiKeysCtrl',
|
||||
'./orgDetailsCtrl',
|
||||
], function () {});
|
||||
|
@ -39,7 +39,7 @@ function (angular) {
|
||||
|
||||
$scope.openInviteModal = function() {
|
||||
$scope.appEvent('show-modal', {
|
||||
src: './app/partials/invite_users.html',
|
||||
src: './app/features/org/partials/invite.html',
|
||||
modalClass: 'modal-no-header invite-modal',
|
||||
scope: $scope.$new()
|
||||
});
|
||||
|
68
public/app/features/org/partials/invite.html
Normal file
68
public/app/features/org/partials/invite.html
Normal file
@ -0,0 +1,68 @@
|
||||
<div class="modal-body" ng-controller="UserInviteCtrl" ng-init="init()">
|
||||
|
||||
<a class="modal-close" ng-click="dismiss();">
|
||||
<i class="fa fa-remove"></i>
|
||||
</a>
|
||||
|
||||
<h3>
|
||||
Invite Users
|
||||
</h3>
|
||||
|
||||
<div class="modal-tagline">
|
||||
Invite new or existing Grafana users to the organization
|
||||
<span class="highlight-word">{{contextSrv.user.orgName}}</span>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<form name="inviteForm">
|
||||
<div style="display: inline-block">
|
||||
<div>
|
||||
<div class="tight-form" ng-repeat="invite in invites">
|
||||
<ul class="tight-form-list">
|
||||
<li class="tight-form-item">
|
||||
Email
|
||||
</li>
|
||||
<li>
|
||||
<input type="email" ng-model="invite.email" required
|
||||
class="input-large tight-form-input" placeholder="email@test.com">
|
||||
</li>
|
||||
<li class="tight-form-item">
|
||||
Name
|
||||
</li>
|
||||
<li>
|
||||
<input type="text" ng-model="invite.name" class="input-large tight-form-input" placeholder="name (optional)">
|
||||
</li>
|
||||
|
||||
<li class="tight-form-item">
|
||||
Role
|
||||
</li>
|
||||
<li>
|
||||
<select ng-model="invite.role" class="input-small tight-form-input" ng-options="f for f in ['Viewer', 'Editor', 'Read Only Editor', 'Admin']">
|
||||
</select>
|
||||
</li>
|
||||
<li class="tight-form-item last" ng-show="$index > 0">
|
||||
<a class="pointer" tabindex="1" ng-click="removeInvite(invite)">
|
||||
<i class="fa fa-remove"></i>
|
||||
</a>
|
||||
</li>
|
||||
<div class="clearfix"></div>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div style="text-align: left">
|
||||
<a ng-click="addInvite()">+ Invite another</a>
|
||||
</div>
|
||||
|
||||
<div class="" style="margin-top: 30px; margin-bottom: 20px;">
|
||||
<button type="button" class="btn btn-inverse" ng-click="dismiss()">Cancel</button>
|
||||
<button type="submit" class="btn btn-success" ng-click="sendInvites();">Invite Users</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
33
public/app/features/org/userInviteCtrl.js
Normal file
33
public/app/features/org/userInviteCtrl.js
Normal file
@ -0,0 +1,33 @@
|
||||
define([
|
||||
'angular',
|
||||
'lodash',
|
||||
],
|
||||
function (angular, _) {
|
||||
'use strict';
|
||||
|
||||
var module = angular.module('grafana.controllers');
|
||||
|
||||
module.controller('UserInviteCtrl', function($scope) {
|
||||
|
||||
$scope.invites = [
|
||||
{name: '', email: '', role: 'Editor'},
|
||||
];
|
||||
|
||||
$scope.init = function() {
|
||||
};
|
||||
|
||||
$scope.addInvite = function() {
|
||||
$scope.invites.push({name: '', email: '', role: 'Editor'});
|
||||
};
|
||||
|
||||
$scope.removeInvite = function(invite) {
|
||||
$scope.invites = _.without($scope.invites, invite);
|
||||
};
|
||||
|
||||
$scope.sendInvites = function() {
|
||||
if (!$scope.inviteForm.$valid) { return; }
|
||||
|
||||
$scope.dismiss();
|
||||
};
|
||||
});
|
||||
});
|
@ -1,55 +0,0 @@
|
||||
<div class="modal-body">
|
||||
|
||||
<a class="modal-close" ng-click="dismiss();">
|
||||
<i class="fa fa-remove"></i>
|
||||
</a>
|
||||
|
||||
<h3>
|
||||
Invite Users
|
||||
</h3>
|
||||
|
||||
<div class="modal-tagline">
|
||||
Invite new or existing Grafana users to the organization
|
||||
<span class="highlight-word">{{contextSrv.user.orgName}}</span>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<form name="addOrgForm" style="display: inline-block;">
|
||||
<div class="tight-form">
|
||||
<ul class="tight-form-list">
|
||||
<li class="tight-form-item">
|
||||
Email
|
||||
</li>
|
||||
<li>
|
||||
<input type="text" ng-model="newOrg.name" bs-typeahead="searchOrgs"
|
||||
required class="input-large tight-form-input" placeholder="email@test.com">
|
||||
</li>
|
||||
<li class="tight-form-item">
|
||||
Name
|
||||
</li>
|
||||
<li>
|
||||
<input type="text" ng-model="newOrg.name" bs-typeahead="searchOrgs"
|
||||
required class="input-large tight-form-input" placeholder="name (optional)">
|
||||
</li>
|
||||
|
||||
<li class="tight-form-item">
|
||||
Role
|
||||
</li>
|
||||
<li>
|
||||
<select type="text" ng-model="newOrg.role" class="input-small tight-form-input" ng-options="f for f in ['Viewer', 'Editor', 'Read Only Editor', 'Admin']">
|
||||
</select>
|
||||
</li>
|
||||
<div class="clearfix"></div>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="" style="margin-top: 30px; margin-bottom: 20px;">
|
||||
<button type="button" class="btn btn-inverse" ng-click="dismiss()">Cancel</button>
|
||||
<button type="button" class="btn btn-success" ng-click="onConfirm();dismiss();">Invite Users</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -165,7 +165,7 @@ select.tight-form-input {
|
||||
margin: 0px;
|
||||
border-radius: 0;
|
||||
height: 36px;
|
||||
padding: 8px 3px;
|
||||
padding: 9px 3px;
|
||||
&.last {
|
||||
border-right: none;
|
||||
}
|
||||
|
Reference in New Issue
Block a user