mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
preferences UI poc
This commit is contained in:
parent
cf926134ef
commit
1ef332e82c
@ -111,9 +111,6 @@ func UserSetUsingOrg(c *middleware.Context) Response {
|
||||
}
|
||||
|
||||
func ChangeUserPassword(c *middleware.Context, cmd m.ChangeUserPasswordCommand) Response {
|
||||
|
||||
log.Info("%v", cmd)
|
||||
|
||||
userQuery := m.GetUserByIdQuery{Id: c.UserId}
|
||||
|
||||
if err := bus.Dispatch(&userQuery); err != nil {
|
||||
|
@ -39,6 +39,7 @@ export class SideMenuCtrl {
|
||||
this.orgMenu = [
|
||||
{section: 'You', cssClass: 'dropdown-menu-title'},
|
||||
{text: 'Profile', url: this.getUrl('/profile')},
|
||||
{text: 'Preferences', url: this.getUrl('/preferences')},
|
||||
];
|
||||
|
||||
if (this.isSignedIn) {
|
||||
|
@ -89,6 +89,10 @@ function setupAngularRoutes($routeProvider, $locationProvider) {
|
||||
templateUrl: 'public/app/features/profile/partials/profile.html',
|
||||
controller : 'ProfileCtrl',
|
||||
})
|
||||
.when('/preferences', {
|
||||
templateUrl: 'public/app/features/profile/partials/preferences.html',
|
||||
controller : 'PreferencesCtrl',
|
||||
})
|
||||
.when('/profile/password', {
|
||||
templateUrl: 'public/app/features/profile/partials/password.html',
|
||||
controller : 'ChangePasswordCtrl',
|
||||
|
@ -10,5 +10,6 @@ define([
|
||||
'./profile/profileCtrl',
|
||||
'./profile/changePasswordCtrl',
|
||||
'./profile/selectOrgCtrl',
|
||||
'./profile/preferencesCtrl',
|
||||
'./styleguide/styleguide',
|
||||
], function () {});
|
||||
|
32
public/app/features/profile/partials/preferences.html
Normal file
32
public/app/features/profile/partials/preferences.html
Normal file
@ -0,0 +1,32 @@
|
||||
<navbar icon="icon-gf icon-gf-users" title="Preferences" title-url="preferences">
|
||||
</navbar>
|
||||
|
||||
<div class="page-container">
|
||||
<div class="page-header">
|
||||
<h1>Preferences</h1>
|
||||
</div>
|
||||
|
||||
<form name="userForm" class="gf-form-group">
|
||||
<div class="gf-form">
|
||||
<span class="gf-form-label width-10">Home Dashboard</span>
|
||||
<input class="gf-form-input max-width-21" type="text" ng-model="command.homeDashboard">
|
||||
</div>
|
||||
|
||||
<div class="gf-form">
|
||||
<span class="gf-form-label width-10">Time Range</span>
|
||||
<input class="gf-form-input max-width-21" type="text" ng-model="command.timeRange">
|
||||
</div>
|
||||
|
||||
<div class="gf-form">
|
||||
<span class="gf-form-label width-10">Theme</span>
|
||||
<input class="gf-form-input max-width-21" type="text" ng-model="command.theme">
|
||||
</div>
|
||||
|
||||
<div class="gf-form-button-row">
|
||||
<button type="submit" class="btn btn-success" ng-click="setUserPreferences()">Set Preferences</button>
|
||||
<a class="btn-text" href="profile">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
@ -7,7 +7,7 @@
|
||||
</div>
|
||||
|
||||
<form name="userForm" class="gf-form-group">
|
||||
<h3 class="page-heading">Preferences</h3>
|
||||
<h3 class="page-heading">Information</h3>
|
||||
|
||||
<div class="gf-form">
|
||||
<span class="gf-form-label width-7">Name</span>
|
||||
|
25
public/app/features/profile/preferencesCtrl.js
Normal file
25
public/app/features/profile/preferencesCtrl.js
Normal file
@ -0,0 +1,25 @@
|
||||
define([
|
||||
'angular',
|
||||
'app/core/config',
|
||||
],
|
||||
function (angular) {
|
||||
'use strict';
|
||||
|
||||
var module = angular.module('grafana.controllers');
|
||||
|
||||
module.controller('PreferencesCtrl', function($scope, backendSrv, $location) {
|
||||
|
||||
$scope.command = {};
|
||||
|
||||
$scope.setUserPreferences = function() {
|
||||
if (!$scope.userForm.$valid) { return; }
|
||||
|
||||
console.log($scope.command);
|
||||
|
||||
backendSrv.put('/api/user/prefs', $scope.command).then(function() {
|
||||
$location.path("profile");
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user