Hooked up inventory source scheduling. Fixed various small bugs

This commit is contained in:
Michael Abashian 2017-04-24 21:03:12 -04:00 committed by Jared Tabor
parent 8734ad738f
commit 0de2f7deb4
18 changed files with 169 additions and 228 deletions

View File

@ -169,7 +169,7 @@ function adhocController($q, $scope, $stateParams,
ParseTypeChange({ scope: $scope, field_id: 'adhoc_extra_vars' , variable: "extra_vars"});
$scope.formCancel = function(){
$state.go('inventoryManage');
$state.go('^');
};
// remove all data input into the form and reset the form back to defaults

View File

@ -53,7 +53,7 @@ export default ['$state', '$stateParams', '$scope', 'GroupForm',
return GroupManageService.associateGroup(res.data, _.last($stateParams.group))
.then(() => $state.go('^', null, { reload: true }));
} else {
$state.go('inventoryManage.editGroup', { group_id: res.data.group }, { reload: true });
$state.go('^.edit', { group_id: res.data.id }, { reload: true });
}
});

View File

@ -50,8 +50,9 @@ export default {
mode: 'all',
ngDisabled: '!groupsSelected',
ngClick: 'setAdhocPattern()',
awToolTip: "Select an inventory source by clicking the check box beside it. The inventory source can be a single group or host, a selection of multiple hosts, or a selection of multiple groups.",
awToolTip: "Select an inventory source by clicking the check box beside it. The inventory source can be a single group or a selection of multiple groups.",
dataTipWatch: "adhocCommandTooltip",
dataPlacement: 'top',
actionClass: 'btn List-buttonDefault',
buttonContent: 'RUN COMMANDS',
showTipWhenDisabled: true,

View File

@ -35,7 +35,7 @@
// https://github.com/ncuillery/angular-breadcrumb/issues/42 for a little more information on the
// problem that this solves.
$scope.ncyBreadcrumbIgnore = true;
if($state.current.name === "inventoryManage.editGroup") {
if($state.current.name === "inventories.edit.groups") {
$scope.rowBeingEdited = $state.params.group_id;
$scope.listBeingEdited = "groups";
}
@ -79,18 +79,6 @@
{hosts_status_class: hosts_status.class});
}
$scope.groupSelect = function(id){
var group = $stateParams.group === undefined ? [id] : _($stateParams.group).concat(id).value();
$state.go('inventoryManage', {
inventory_id: $stateParams.inventory_id,
group: group,
group_search: {
page_size: '20',
page: '1',
order_by: 'name',
}
}, {reload: true});
};
$scope.createGroup = function(){
$state.go('inventories.edit.groups.add');
};
@ -116,7 +104,7 @@
// Remove the event handler so that we don't end up with multiple bindings
$('#group-delete-modal').off('hidden.bs.modal');
// Reload the inventory manage page and show that the group has been removed
$state.go('inventoryManage', null, {reload: true});
$state.go('.', null, {reload: true});
});
switch($scope.deleteOption){
@ -124,7 +112,7 @@
GroupManageService.promote($scope.toDelete.id, $stateParams.inventory_id)
.then(() => {
if (parseInt($state.params.group_id) === $scope.toDelete.id) {
$state.go("inventoryManage", null, {reload: true});
$state.go("^", null, {reload: true});
} else {
$state.go($state.current, null, {reload: true});
}
@ -136,7 +124,7 @@
default:
GroupManageService.delete($scope.toDelete.id).then(() => {
if (parseInt($state.params.group_id) === $scope.toDelete.id) {
$state.go("inventoryManage", null, {reload: true});
$state.go("^", null, {reload: true});
} else {
$state.go($state.current, null, {reload: true});
}
@ -202,22 +190,15 @@
});
};
$scope.showFailedHosts = function() {
$state.go('inventoryManage', {failed: true}, {reload: true});
};
$scope.scheduleGroup = function(id) {
// Add this group's id to the array of group id's so that it gets
// added to the breadcrumb trail
var groupsArr = $stateParams.group ? $stateParams.group : [];
groupsArr.push(id);
$state.go('inventoryManage.editGroup.schedules', {group_id: id, group: groupsArr}, {reload: true});
// TODO: implement
};
$scope.copyMoveGroup = function(id){
$state.go('inventoryManage.copyMoveGroup', {group_id: id, groups: $stateParams.groups});
// TODO: implement
};
var cleanUpStateChangeListener = $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) {
if (toState.name === "inventoryManage.editGroup") {
if (toState.name === "inventories.edit.groups.edit") {
$scope.rowBeingEdited = toParams.group_id;
$scope.listBeingEdited = "groups";
}

View File

@ -35,7 +35,7 @@
// https://github.com/ncuillery/angular-breadcrumb/issues/42 for a little more information on the
// problem that this solves.
$scope.ncyBreadcrumbIgnore = true;
if($state.current.name === "inventoryManage.editGroup") {
if($state.current.name === "inventories.edit.groups.edit.nested_groups.edit") {
$scope.rowBeingEdited = $state.params.group_id;
$scope.listBeingEdited = "groups";
}
@ -63,18 +63,6 @@
{hosts_status_class: hosts_status.class});
}
$scope.groupSelect = function(id){
var group = $stateParams.group === undefined ? [id] : _($stateParams.group).concat(id).value();
$state.go('inventoryManage', {
inventory_id: $stateParams.inventory_id,
group: group,
group_search: {
page_size: '20',
page: '1',
order_by: 'name',
}
}, {reload: true});
};
$scope.createGroup = function(){
$state.go('inventories.edit.groups.add');
};
@ -100,7 +88,7 @@
// Remove the event handler so that we don't end up with multiple bindings
$('#group-delete-modal').off('hidden.bs.modal');
// Reload the inventory manage page and show that the group has been removed
$state.go('inventoryManage', null, {reload: true});
$state.go('.', null, {reload: true});
});
switch($scope.deleteOption){
@ -108,7 +96,7 @@
GroupManageService.promote($scope.toDelete.id, $stateParams.inventory_id)
.then(() => {
if (parseInt($state.params.group_id) === $scope.toDelete.id) {
$state.go("inventoryManage", null, {reload: true});
$state.go("^", null, {reload: true});
} else {
$state.go($state.current, null, {reload: true});
}
@ -120,7 +108,7 @@
default:
GroupManageService.delete($scope.toDelete.id).then(() => {
if (parseInt($state.params.group_id) === $scope.toDelete.id) {
$state.go("inventoryManage", null, {reload: true});
$state.go("^", null, {reload: true});
} else {
$state.go($state.current, null, {reload: true});
}
@ -186,14 +174,7 @@
});
};
$scope.showFailedHosts = function() {
$state.go('inventoryManage', {failed: true}, {reload: true});
};
$scope.scheduleGroup = function(id) {
// Add this group's id to the array of group id's so that it gets
// added to the breadcrumb trail
var groupsArr = $stateParams.group ? $stateParams.group : [];
groupsArr.push(id);
$state.go('inventoryManage.editGroup.schedules', {group_id: id, group: groupsArr}, {reload: true});
// TODO: implement
};
// $scope.$parent governed by InventoryManageController, for unified multiSelect options
$scope.$on('multiSelectList.selectionChanged', (event, selection) => {
@ -202,11 +183,11 @@
});
$scope.copyMoveGroup = function(id){
$state.go('inventoryManage.copyMoveGroup', {group_id: id, groups: $stateParams.groups});
// TODO: implement
};
var cleanUpStateChangeListener = $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) {
if (toState.name === "inventoryManage.editGroup") {
if (toState.name === "inventories.edit.groups.edit.nested_groups.edit") {
$scope.rowBeingEdited = toParams.group_id;
$scope.listBeingEdited = "groups";
}

View File

@ -1,14 +0,0 @@
/*************************************************
* Copyright (c) 2017 Ansible, Inc.
*
* All Rights Reserved
*************************************************/
function HostsAdd() {
console.log('inside host add');
}
export default [ HostsAdd
];

View File

@ -1,11 +0,0 @@
/*************************************************
* Copyright (c) 2017 Ansible, Inc.
*
* All Rights Reserved
*************************************************/
import controller from './host-add.controller';
export default
angular.module('hostsAdd', [])
.controller('HostAddController', controller);

View File

@ -4,7 +4,6 @@
* All Rights Reserved
*************************************************/
import hostAdd from './add/main';
import hostEdit from './edit/main';
import hostList from './list/main';
import HostsList from './host.list';
@ -16,7 +15,6 @@
export default
angular.module('host', [
hostAdd.name,
hostEdit.name,
hostList.name,
SmartInventory.name,

View File

@ -36,12 +36,9 @@ angular.module('inventory', [
.service('InventoryManageService', InventoryManageService)
.config(['$stateProvider', 'stateDefinitionsProvider', '$stateExtenderProvider',
function($stateProvider, stateDefinitionsProvider, $stateExtenderProvider) {
// When stateDefinition.lazyLoad() resolves, states matching name.** or /url** will be de-registered and replaced with resolved states
// This means inventoryManage states will not be registered correctly on page refresh, unless they're registered at the same time as the inventories state tree
let stateDefinitions = stateDefinitionsProvider.$get(),
stateExtender = $stateExtenderProvider.$get();
function generateInventoryStates() {
let basicInventoryAdd = stateDefinitions.generateTree({
@ -138,6 +135,93 @@ angular.module('inventory', [
}
};
let listSchedules = {
name: 'inventories.edit.inventory_sources.edit.schedules',
url: '/schedules',
searchPrefix: 'schedule',
ncyBreadcrumb: {
label: N_('SCHEDULES')
},
resolve: {
Dataset: ['ScheduleList', 'QuerySet', '$stateParams', 'GetBasePath', 'inventorySourceData',
function(list, qs, $stateParams, GetBasePath, inventorySourceData) {
let path = `${inventorySourceData.related.schedules}`;
return qs.search(path, $stateParams[`${list.iterator}_search`]);
}
],
ParentObject: ['inventorySourceData', function(inventorySourceData) {
return inventorySourceData;
}],
UnifiedJobsOptions: ['Rest', 'GetBasePath', '$stateParams', '$q',
function(Rest, GetBasePath, $stateParams, $q) {
Rest.setUrl(GetBasePath('unified_jobs'));
var val = $q.defer();
Rest.options()
.then(function(data) {
val.resolve(data.data);
}, function(data) {
val.reject(data);
});
return val.promise;
}],
ScheduleList: ['SchedulesList', 'inventorySourceData',
(SchedulesList, inventorySourceData) => {
let list = _.cloneDeep(SchedulesList);
list.basePath = `${inventorySourceData.related.schedules}`;
return list;
}
]
},
views: {
// clear form template when views render in this substate
'form': {
templateProvider: () => ''
},
// target the un-named ui-view @ root level
'@': {
templateProvider: function(ScheduleList, generateList, ParentObject) {
// include name of parent resource in listTitle
ScheduleList.listTitle = `${ParentObject.name}<div class='List-titleLockup'></div>` + N_('SCHEDULES');
let html = generateList.build({
list: ScheduleList,
mode: 'edit'
});
html = generateList.wrapPanel(html);
return "<div class='InventoryManage-container'>" + generateList.insertFormView() + html + "</div>";
},
controller: 'schedulerListController'
}
}
};
let addSchedule = {
name: 'inventories.edit.inventory_sources.edit.schedules.add',
url: '/add',
ncyBreadcrumb: {
label: N_("CREATE SCHEDULE")
},
views: {
'form': {
controller: 'schedulerAddController',
templateUrl: templateUrl("scheduler/schedulerForm")
}
}
};
let editSchedule = {
name: 'inventories.edit.inventory_sources.edit.schedules.edit',
url: '/:schedule_id',
ncyBreadcrumb: {
label: "{{schedule_obj.name}}"
},
views: {
'form': {
templateUrl: templateUrl("scheduler/schedulerForm"),
controller: 'schedulerEditController',
}
}
};
return Promise.all([
basicInventoryAdd,
basicInventoryEdit,
@ -180,7 +264,10 @@ angular.module('inventory', [
}
}),
stateExtender.buildDefinition(adHocRoute),
stateExtender.buildDefinition(adhocCredentialLookup)
stateExtender.buildDefinition(adhocCredentialLookup),
stateExtender.buildDefinition(listSchedules),
stateExtender.buildDefinition(addSchedule),
stateExtender.buildDefinition(editSchedule)
])
};
});

View File

@ -52,10 +52,10 @@ export default ['$state', '$stateParams', '$scope', 'RelatedHostsFormDefinition'
// assign the host to current group if not at the root level
if ($stateParams.group) {
HostManageService.associateGroup(res.data, _.last($stateParams.group)).then(function() {
$state.go('inventoryManage.editHost', { host_id: res.data.id }, { reload: true });
$state.go('^.edit', { host_id: res.data.id }, { reload: true });
});
} else {
$state.go('inventoryManage.editHost', { host_id: res.data.id }, { reload: true });
$state.go('^.edit', { host_id: res.data.id }, { reload: true });
}
});
};

View File

@ -87,8 +87,9 @@ export default {
mode: 'all',
ngDisabled: '!hostsSelected',
ngClick: 'setAdhocPattern()',
awToolTip: "Select an inventory source by clicking the check box beside it. The inventory source can be a single group or host, a selection of multiple hosts, or a selection of multiple groups.",
awToolTip: "Select an inventory source by clicking the check box beside it. The inventory source can be a single host or a selection of multiple hosts.",
dataTipWatch: "adhocCommandTooltip",
dataPlacement: 'top',
actionClass: 'btn List-buttonDefault',
buttonContent: 'RUN COMMANDS',
showTipWhenDisabled: true,

View File

@ -50,31 +50,31 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition',
};
$scope.formSave = function() {
var params, source, json_data;
var params, json_data;
json_data = ToJSON($scope.parseType, $scope.variables, true);
params = {
name: $scope.name,
description: $scope.description,
inventory: inventoryData.id,
instance_filters: $scope.instance_filters,
source_script: $scope.inventory_script,
credential: $scope.credential,
overwrite: $scope.overwrite,
overwrite_vars: $scope.overwrite_vars,
update_on_launch: $scope.update_on_launch,
update_cache_timeout: $scope.update_cache_timeout || 0,
variables: json_data,
// comma-delimited strings
group_by: _.map($scope.group_by, 'value').join(','),
source_regions: _.map($scope.source_regions, 'value').join(',')
};
if ($scope.source) {
params = {
name: $scope.name,
description: $scope.description,
inventory: inventoryData.id,
instance_filters: $scope.instance_filters,
source_vars: $scope[$scope.source.value + '_variables'] === '---' || $scope[$scope.source.value + '_variables'] === '{}' ? null : $scope[$scope.source.value + '_variables'],
source_script: $scope.inventory_script,
source: $scope.source.value,
credential: $scope.credential,
overwrite: $scope.overwrite,
overwrite_vars: $scope.overwrite_vars,
update_on_launch: $scope.update_on_launch,
update_cache_timeout: $scope.update_cache_timeout || 0,
variables: json_data,
// comma-delimited strings
group_by: _.map($scope.group_by, 'value').join(','),
source_regions: _.map($scope.source_regions, 'value').join(',')
};
source = $scope.source.value;
params.source_vars = $scope[$scope.source.value + '_variables'] === '---' || $scope[$scope.source.value + '_variables'] === '{}' ? null : $scope[$scope.source.value + '_variables'];
params.source = $scope.source.value;
} else {
source = null;
params.source = null;
}
// switch (source) {
// // no inventory source set, just create a new group
@ -109,7 +109,7 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition',
// _.assign(params, { group: res.data.id }), res.data.related.inventory_source))
// .then(res => $state.go('inventoryManage.editGroup', { group_id: res.data.group }, { reload: true }));
SourcesService.post(params).then(function(){
$state.go('.', null, {reload: true});
$state.go('^.edit', null, {reload: true});
});
// break;
// }

View File

@ -14,7 +14,7 @@ export default ['$stateExtender', 'templateUrl', '$injector',
breadcrumbLabel = (field.iterator.replace('_', ' ') + 's').toUpperCase(),
stateConfig = {
name: `${formStateDefinition.name}.${list.iterator}s.edit`,
url: `/edit/:source_id`,
url: `/edit/:inventory_source_id`,
ncyBreadcrumb: {
parent: `${formStateDefinition.name}`,
label: `${breadcrumbLabel}`
@ -36,7 +36,7 @@ export default ['$stateExtender', 'templateUrl', '$injector',
return definition;
}],
inventorySourceData: ['$stateParams', 'SourcesService', function($stateParams, SourcesService) {
return SourcesService.get({id: $stateParams.source_id }).then(res => res.data.results[0]);
return SourcesService.get({id: $stateParams.inventory_source_id }).then(res => res.data.results[0]);
}]
}
};

View File

@ -7,11 +7,11 @@
export default ['$state', '$stateParams', '$scope', 'ParseVariableString',
'rbacUiControlService', 'ToJSON', 'ParseTypeChange', 'GroupManageService',
'GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions',
'inventorySourceData', 'SourcesService',
'inventorySourceData', 'SourcesService', 'inventoryData',
function($state, $stateParams, $scope, ParseVariableString,
rbacUiControlService, ToJSON,ParseTypeChange, GroupManageService,
GetChoices, GetBasePath, CreateSelect2, GetSourceTypeOptions,
inventorySourceData, SourcesService) {
inventorySourceData, SourcesService, inventoryData) {
init();
@ -76,39 +76,37 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString',
$state.go('^');
};
$scope.formSave = function() {
var params, source, json_data;
var params, json_data;
json_data = ToJSON($scope.parseType, $scope.variables, true);
params = {
name: $scope.name,
description: $scope.description,
inventory: inventoryData.id,
instance_filters: $scope.instance_filters,
source_script: $scope.inventory_script,
credential: $scope.credential,
overwrite: $scope.overwrite,
overwrite_vars: $scope.overwrite_vars,
update_on_launch: $scope.update_on_launch,
update_cache_timeout: $scope.update_cache_timeout || 0,
variables: json_data,
// comma-delimited strings
group_by: _.map($scope.group_by, 'value').join(','),
source_regions: _.map($scope.source_regions, 'value').join(',')
};
if ($scope.source) {
// inventory_source fields
params = {
id: $scope.id,
variables: json_data,
name: $scope.name,
description: $scope.description,
inventory: $scope.inventory,
source: $scope.source.value,
credential: $scope.credential,
overwrite: $scope.overwrite,
overwrite_vars: $scope.overwrite_vars,
source_script: $scope.inventory_script,
update_on_launch: $scope.update_on_launch,
update_cache_timeout: $scope.update_cache_timeout || 0,
// comma-delimited strings
group_by: _.map($scope.group_by, 'value').join(','),
source_regions: _.map($scope.source_regions, 'value').join(','),
instance_filters: $scope.instance_filters,
source_vars: $scope[$scope.source.value + '_variables'] === '---' || $scope[$scope.source.value + '_variables'] === '{}' ? null : $scope[$scope.source.value + '_variables']
};
source = $scope.source.value;
params.source_vars = $scope[$scope.source.value + '_variables'] === '---' || $scope[$scope.source.value + '_variables'] === '{}' ? null : $scope[$scope.source.value + '_variables'];
params.source = $scope.source.value;
} else {
source = null;
params.source = null;
}
// switch (source) {
// no inventory source set, just create a new group
// '' is the value supplied for Manual source type
// case null || '':
SourcesService.put(params).then(() => $state.go($state.current, null, { reload: true }));
SourcesService.put(params).then(() => $state.go('.', null, { reload: true }));
// break;
// // create a new group and create/associate an inventory source
// // equal to case 'rax' || 'ec2' || 'azure' || 'azure_rm' || 'vmware' || 'satellite6' || 'cloudforms' || 'openstack' || 'custom'

View File

@ -39,10 +39,6 @@
// https://github.com/ncuillery/angular-breadcrumb/issues/42 for a little more information on the
// problem that this solves.
$scope.ncyBreadcrumbIgnore = true;
if($state.current.name === "inventoryManage.editGroup") {
$scope.rowBeingEdited = $state.params.group_id;
$scope.listBeingEdited = "groups";
}
$scope.inventory_id = $stateParams.inventory_id;
_.forEach($scope[list.name], buildStatusIndicators);
@ -79,23 +75,11 @@
{status: inventory_source ? inventory_source.status : null});
}
$scope.groupSelect = function(id){
var group = $stateParams.group === undefined ? [id] : _($stateParams.group).concat(id).value();
$state.go('inventoryManage', {
inventory_id: $stateParams.inventory_id,
group: group,
group_search: {
page_size: '20',
page: '1',
order_by: 'name',
}
}, {reload: true});
};
$scope.createSource = function(){
$state.go('inventories.edit.inventory_sources.add');
};
$scope.editSource = function(id){
$state.go('inventories.edit.inventory_sources.edit', {source_id: id});
$state.go('inventories.edit.inventory_sources.edit', {inventory_source_id: id});
};
$scope.deleteSource = function(inventory_source){
var body = '<div class=\"Prompt-bodyQuery\">Are you sure you want to permanently delete the inventory source below from the inventory?</div><div class=\"Prompt-bodyTarget\">' + $filter('sanitize')(inventory_source.name) + '</div>';
@ -129,42 +113,6 @@
});
};
$scope.$on(`ws-jobs`, function(e, data){
var group = Find({ list: $scope.groups, key: 'id', val: data.group_id });
if (group === undefined || group === null) {
group = {};
}
if(data.status === 'failed' || data.status === 'successful'){
let path;
if($stateParams && $stateParams.group && $stateParams.group.length > 0) {
path = GetBasePath('groups') + _.last($stateParams.group) + '/children';
}
else {
//reaches here if the user is on the root level group
path = GetBasePath('inventory') + $stateParams.inventory_id + '/root_groups';
}
qs.search(path, $state.params[`${list.iterator}_search`])
.then(function(searchResponse) {
$scope[`${list.iterator}_dataset`] = searchResponse.data;
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
// _.forEach($scope[list.name], buildStatusIndicators);
});
} else {
var status = GetSyncStatusMsg({
status: data.status,
has_inventory_sources: group.has_inventory_sources,
source: group.source
});
group.status = data.status;
group.status_class = status.class;
group.status_tooltip = status.tooltip;
group.launch_tooltip = status.launch_tip;
group.launch_class = status.launch_class;
}
});
$scope.cancelUpdate = function (id) {
GroupsCancelUpdate({ scope: $scope, id: id });
};
@ -174,40 +122,10 @@
group_id: id
});
};
$scope.showFailedHosts = function() {
$state.go('inventoryManage', {failed: true}, {reload: true});
};
$scope.scheduleGroup = function(id) {
$scope.scheduleSource = function(id) {
// Add this group's id to the array of group id's so that it gets
// added to the breadcrumb trail
var groupsArr = $stateParams.group ? $stateParams.group : [];
groupsArr.push(id);
$state.go('inventoryManage.editGroup.schedules', {group_id: id, group: groupsArr}, {reload: true});
$state.go('inventories.edit.inventory_sources.edit.schedules', {inventory_source_id: id}, {reload: true});
};
// $scope.$parent governed by InventoryManageController, for unified multiSelect options
$scope.$on('multiSelectList.selectionChanged', (event, selection) => {
$scope.$parent.groupsSelected = selection.length > 0 ? true : false;
$scope.$parent.groupsSelectedItems = selection.selectedItems;
});
$scope.copyMoveGroup = function(id){
$state.go('inventoryManage.copyMoveGroup', {group_id: id, groups: $stateParams.groups});
};
var cleanUpStateChangeListener = $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) {
if (toState.name === "inventoryManage.editGroup") {
$scope.rowBeingEdited = toParams.group_id;
$scope.listBeingEdited = "groups";
}
else {
delete $scope.rowBeingEdited;
delete $scope.listBeingEdited;
}
});
// Remove the listener when the scope is destroyed to avoid a memory leak
$scope.$on('$destroy', function() {
cleanUpStateChangeListener();
});
}];

View File

@ -12,7 +12,6 @@ export default {
wellOverride: true,
index: false,
hover: true,
multiSelect: true,
trackBy: 'inventory_source.id',
basePath: 'api/v2/inventories/{{$stateParams.inventory_id}}/inventory_sources/',

View File

@ -157,7 +157,7 @@ export default
// If we are on the inventory manage page or any child state of that
// page then we want to stay on that page. Otherwise go to the stdout
// view.
if(!$state.includes('inventoryManage')) {
if(!$state.includes('inventories.edit')) {
goTojobResults('inventorySyncStdout');
}
}

View File

@ -1493,7 +1493,8 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
if(this.mode === "edit"){
html += `<div id="${this.form.name}_tab" class="Form-tab" `;
html += this.form.detailsClick ? `ng-click="` + this.form.detailsClick + `" ` : `ng-click="$state.go('${this.form.stateTree}.edit')" `;
html += `ng-class="{'is-selected': $state.is('${this.form.activeEditState}') || $state.is('${this.form.stateTree}.edit') || $state.$current.data.formChildState }">` +
let detailsTabSelected = this.form.activeEditState ? `$state.is('${this.form.activeEditState}') || $state.is('${this.form.stateTree}.edit') || $state.$current.data.formChildState` : `$state.is('${this.form.stateTree}.edit') || $state.$current.data.formChildState`;
html += `ng-class="{'is-selected': ${detailsTabSelected} }">` +
`${details}</div>`;
for (itm in this.form.related) {
@ -1506,7 +1507,8 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
`aw-tip-placement="${collection.dataPlacement}" ` +
`data-tip-watch="${collection.dataTipWatch}" `;
}
html += `ng-class="{'is-selected' : $state.is('${this.form.activeEditState}.${itm}') || $state.is('${this.form.stateTree}.edit.${itm}') ` ;
let relatedTabSelected = this.form.activeEditState ? `$state.includes('${this.form.activeEditState}.${itm}') || $state.includes('${this.form.stateTree}.edit.${itm}')` : `$state.includes('${this.form.stateTree}.edit.${itm}')`;
html += `ng-class="{'is-selected' : ${relatedTabSelected}` ;
if(this.form.related[itm].disabled){
html += `, 'Form-tab--disabled' : ${this.form.related[itm].disabled }`;
}