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, well: false,
formLabelSize: 'col-lg-3', formLabelSize: 'col-lg-3',
formFieldSize: 'col-lg-9', formFieldSize: 'col-lg-9',
cancelButton: false,
showHeader: false,
fields: { fields: {
name: { name: {

View File

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

View File

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