Fixed title bar for hosts addition and edit in inventory section

This commit is contained in:
Ken Hoes 2016-04-22 11:37:40 -04:00
parent cf7b71ae2c
commit a1fbfba850
3 changed files with 24 additions and 27 deletions

View File

@ -20,6 +20,8 @@ export default
well: false,
formLabelSize: 'col-lg-3',
formFieldSize: 'col-lg-9',
cancelButton: false,
showHeader: false,
fields: {
name: {

View File

@ -30,23 +30,22 @@ function manageHostsDirectiveController($rootScope, $location, $log, $stateParam
url, form_scope;
var host_id = $stateParams.host_id || undefined;
var hostName = '';
form_scope =
generator.inject(HostForm, {
mode: 'edit',
mode: mode,
id: 'host-panel-form',
related: false,
scope: scope,
cancelButton: false
});
generator.reset();
// Retrieve detail record and prepopulate the form
if (mode === 'edit') {
defaultUrl = GetBasePath('hosts') + host_id + '/';
Rest.setUrl(defaultUrl);
Rest.get()
.success(function(data) {
vm.hostName = data.name;
var set, fld, related;
for (fld in form.fields) {
if (data[fld]) {
@ -187,7 +186,8 @@ function manageHostsDirectiveController($rootScope, $location, $log, $stateParam
angular.extend(vm, {
cancelPanel: cancelPanel,
saveHost: saveHost,
mode: mode
mode: mode,
hostName: hostName
});
}

View File

@ -1,25 +1,20 @@
<div>
<div class="Form-header" ng-if="vm.mode === 'add'">
<div class="Form-title ng-binding" >Create Host</div>
<div class="Form-exitHolder">
<button class="Form-exit" ng-click="vm.cancelPanel()">
<i class="fa fa-times-circle"></i>
</button>
</div>
</div>
<div class="Form-exitHolder" ng-if="vm.mode === 'edit'">
<button class="Form-exit" ng-click="vm.cancelPanel()">
<i class="fa fa-times-circle"></i>
</button>
</div>
<div id="host-panel-form"></div>
<div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
<div class="ui-dialog-buttonset">
<button type="button" class="btn btn-primary Form-saveButton" id="Inventory-hostManage--okButton" ng-click="vm.saveHost()">
Save</button>
<button type="button" class="btn btn-default Form-cancelButton" id="Inventory-hostManage--cancelButton" ng-click="vm.cancelPanel()">
Cancel</button>
<div class="Form-header">
<div class="Form-title" ng-if="vm.mode === 'edit'">{{vm.hostName}}</div>
<div class="Form-title" ng-if="vm.mode === 'add'">Create Host</div>
<div class="Form-exitHolder">
<button class="Form-exit" ng-click="vm.cancelPanel()">
<i class="fa fa-times-circle"></i>
</button>
</div>
</div>
<div id="host-panel-form"></div>
<div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
<div class="ui-dialog-buttonset">
<button type="button" class="btn btn-primary Form-saveButton" id="Inventory-hostManage--okButton" ng-click="vm.saveHost()">
Save</button>
<button type="button" class="btn btn-default Form-cancelButton" id="Inventory-hostManage--cancelButton" ng-click="vm.cancelPanel()">
Cancel</button>
</div>
</div>
</div>
</div>