Add edit configuration page

Change-Id: I9ec8d699a6f99b6fa10d0c7f2a83c2c6af3fc27a
This commit is contained in:
flavien peyre 2015-07-21 11:24:03 -04:00 committed by Vincent Fournier
parent 8f877fdcc2
commit a97fb551c7
7 changed files with 37 additions and 1 deletions

View File

@ -81,3 +81,9 @@
padding: 0 15px;
color: #FFFFFF;
}
.configuration {
color:black !important;
margin-left:30px;
font-family: Courier New;
}

View File

@ -75,6 +75,11 @@ angular.module('bansho.config', [])
return config.data;
};
this.saveConfig = function(configuration) {
config.data = configuration;
saveConfig();
};
this.setThemeAndSave = function (theme) {
config.data.banshoConfig.theme = theme;
saveConfig();

View File

@ -393,5 +393,8 @@
"hostsMap": {
"drupal": "Wonderful Drupal Website"
}
},
"config": {
"template": "config"
}
}

View File

@ -128,7 +128,7 @@
<ul class="topbar__settings__sublist">
<li class="topbar__settings__subitem"><a href="#">Missing Plugins</a></li>
<li class="topbar__settings__subitem"><a href="#">Object History</a></li>
<li class="topbar__settings__subitem"><a href="#">Configure</a></li>
<li class="topbar__settings__subitem"><a href="#/view?view=config">Configure</a></li>
<li class="topbar__settings__subitem" ng-click="switchTheme()"><a>Change theme</a></li>
<li class="topbar__settings__subitem" ng-click="logout()"><a>Logout</a></li>
</ul>

View File

@ -110,6 +110,7 @@
<script src="templates/dashboard/dashboard.js"></script>
<script src="templates/tables/tables.js"></script>
<script src="templates/host/host.js"></script>
<script src="templates/config/config.js"></script>
<script src="templates/service/service.js"></script>
<script src="templates/drupal_dashboard/drupal_dashboard.js"></script>
<script src="templates/drupal/drupal.js"></script>

View File

@ -0,0 +1,7 @@
<div ng-controller="ConfigCtrl">
<h1>Edit Configuration</h1>
<div>
<textarea rows="50" cols="80" ng-model='configuration' class="configuration"> </textarea>
</div>
<button type="button" ng-click="saveConfiguration()">Save</button>
</div>

View File

@ -0,0 +1,14 @@
/*global jQuery */
'use strict';
angular.module('bansho.view.singleTable')
.controller('ConfigCtrl', ['$scope', '$window', 'configManager',
function ($scope, $window, configManager) {
$scope.configuration = JSON.stringify(configManager.readConfig(),null,4);
$scope.saveConfiguration = function () {
configManager.saveConfig(JSON.parse($scope.configuration));
$window.location.reload();
};
}]);