mirror of
https://github.com/ansible/awx.git
synced 2026-05-14 12:57:40 -02:30
replacing all stateChangeSuccess for $transition.onSuccess
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
const templateUrl = require('~components/layout/layout.partial.html');
|
const templateUrl = require('~components/layout/layout.partial.html');
|
||||||
|
|
||||||
function AtLayoutController ($scope, strings) {
|
function AtLayoutController ($scope, strings, $transitions) {
|
||||||
const vm = this || {};
|
const vm = this || {};
|
||||||
|
|
||||||
$scope.$on('$stateChangeSuccess', (event, next) => {
|
$transitions.onSuccess({}, (transition) => {
|
||||||
vm.currentState = next.name;
|
vm.currentState = transition.to().name;
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.$watch('$root.current_user', (val) => {
|
$scope.$watch('$root.current_user', (val) => {
|
||||||
@@ -34,7 +34,7 @@ function AtLayoutController ($scope, strings) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
AtLayoutController.$inject = ['$scope', 'ComponentsStrings'];
|
AtLayoutController.$inject = ['$scope', 'ComponentsStrings', '$transitions'];
|
||||||
|
|
||||||
function atLayout () {
|
function atLayout () {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -273,9 +273,9 @@ angular
|
|||||||
$(this).remove();
|
$(this).remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (next.name !== "templates.editWorkflowJobTemplate.workflowMaker" &&
|
if (trans.to().name !== "templates.editWorkflowJobTemplate.workflowMaker" &&
|
||||||
next.name !== "templates.editWorkflowJobTemplate.workflowMaker.inventory" &&
|
trans.to().name !== "templates.editWorkflowJobTemplate.workflowMaker.inventory" &&
|
||||||
next.name !== "templates.editWorkflowJobTemplate.workflowMaker.credential") {
|
trans.to().name !== "templates.editWorkflowJobTemplate.workflowMaker.credential") {
|
||||||
$('.ui-dialog-content').each(function() {
|
$('.ui-dialog-content').each(function() {
|
||||||
$(this).dialog('close');
|
$(this).dialog('close');
|
||||||
});
|
});
|
||||||
@@ -318,21 +318,20 @@ angular
|
|||||||
activateTab();
|
activateTab();
|
||||||
});
|
});
|
||||||
|
|
||||||
// $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) {
|
|
||||||
$transitions.onSuccess({}, function(trans) {
|
$transitions.onSuccess({}, function(trans) {
|
||||||
|
|
||||||
if(trans.to() === trans.from()) {
|
if(trans.to() === trans.from()) {
|
||||||
// check to see if something other than a search param has changed
|
// check to see if something other than a search param has changed
|
||||||
let toParamsWithoutSearchKeys = {};
|
let toParamsWithoutSearchKeys = {};
|
||||||
let fromParamsWithoutSearchKeys = {};
|
let fromParamsWithoutSearchKeys = {};
|
||||||
for (let key in trans.$to().params) {
|
for (let key in trans.params('to')) {
|
||||||
if (trans.$to().params.hasOwnProperty(key) && !/_search/.test(key)) {
|
if (trans.params('to').hasOwnProperty(key) && !/_search/.test(key)) {
|
||||||
toParamsWithoutSearchKeys[key] = trans.$to().params[key];
|
toParamsWithoutSearchKeys[key] = trans.params('to')[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let key in trans.$from().params) {
|
for (let key in trans.params('from')) {
|
||||||
if (trans.$from().params.hasOwnProperty(key) && !/_search/.test(key)) {
|
if (trans.params('from').hasOwnProperty(key) && !/_search/.test(key)) {
|
||||||
fromParamsWithoutSearchKeys[key] = trans.$from().params[key];
|
fromParamsWithoutSearchKeys[key] = trans.params('from')[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,8 +343,8 @@ angular
|
|||||||
document.body.scrollTop = document.documentElement.scrollTop = 0;
|
document.body.scrollTop = document.documentElement.scrollTop = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trans.from().name === 'license' && trans.$to().params.hasOwnProperty('licenseMissing')) {
|
if (trans.from().name === 'license' && trans.params('to').hasOwnProperty('licenseMissing')) {
|
||||||
$rootScope.licenseMissing = trans.$to().params.licenseMissing;
|
$rootScope.licenseMissing = trans.params('to').licenseMissing;
|
||||||
}
|
}
|
||||||
var list, id;
|
var list, id;
|
||||||
// broadcast event change if editing crud object
|
// broadcast event change if editing crud object
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export default
|
export default
|
||||||
['templateUrl', '$state', 'FeaturesService','$rootScope', 'Store', 'Empty', '$window', 'BreadCrumbService', 'i18n',
|
['templateUrl', '$state', 'FeaturesService','$rootScope', 'Store', 'Empty', '$window', 'BreadCrumbService', 'i18n', '$transitions',
|
||||||
function(templateUrl, $state, FeaturesService, $rootScope, Store, Empty, $window, BreadCrumbService, i18n) {
|
function(templateUrl, $state, FeaturesService, $rootScope, Store, Empty, $window, BreadCrumbService, i18n, $transitions) {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
templateUrl: templateUrl('bread-crumb/bread-crumb'),
|
templateUrl: templateUrl('bread-crumb/bread-crumb'),
|
||||||
@@ -15,21 +15,21 @@ export default
|
|||||||
scope.alwaysShowRefreshButton = false;
|
scope.alwaysShowRefreshButton = false;
|
||||||
scope.loadingLicense = true;
|
scope.loadingLicense = true;
|
||||||
|
|
||||||
scope.$on("$stateChangeSuccess", function updateActivityStreamButton(event, toState, toParams, fromState, fromParams) {
|
$transitions.onSuccess({}, function updateActivityStreamButton(trans) {
|
||||||
if(fromState && !Empty(fromState.name)) {
|
if(trans.from() && !Empty(trans.from().name)) {
|
||||||
// Go ahead and attach the from params to the state object so that it can all be stored together
|
// Go ahead and attach the from params to the state object so that it can all be stored together
|
||||||
fromState.fromParams = fromParams ? fromParams : {};
|
|
||||||
|
|
||||||
|
trans.from().fromParams = trans.params('from') ? trans.params('from') : {};
|
||||||
// Store the state that we're coming from in local storage to be accessed when navigating away from the
|
// Store the state that we're coming from in local storage to be accessed when navigating away from the
|
||||||
// activity stream
|
// activity stream
|
||||||
//Store('previous_state', fromState);
|
//Store('previous_state', fromState);
|
||||||
}
|
}
|
||||||
|
|
||||||
streamConfig = (toState && toState.data) ? toState.data : {};
|
streamConfig = (trans.to() && trans.to().data) ? trans.to().data : {};
|
||||||
|
|
||||||
if(streamConfig && streamConfig.activityStream) {
|
if(streamConfig && streamConfig.activityStream) {
|
||||||
|
|
||||||
// Check to see if activity_streams is an enabled feature. $stateChangeSuccess fires
|
// Check to see if activity_streams is an enabled feature. $transition.onSuccess fires
|
||||||
// after the resolve on the state declaration so features should be available at this
|
// after the resolve on the state declaration so features should be available at this
|
||||||
// point. We use the get() function call here just in case the features aren't available.
|
// point. We use the get() function call here just in case the features aren't available.
|
||||||
// The get() function will only fire off the server call if the features aren't already
|
// The get() function will only fire off the server call if the features aren't already
|
||||||
@@ -37,9 +37,9 @@ export default
|
|||||||
var features = FeaturesService.get();
|
var features = FeaturesService.get();
|
||||||
if(features){
|
if(features){
|
||||||
scope.loadingLicense = false;
|
scope.loadingLicense = false;
|
||||||
scope.activityStreamActive = (toState.name === 'activityStream') ? true : false;
|
scope.activityStreamActive = (trans.to().name === 'activityStream') ? true : false;
|
||||||
scope.activityStreamTooltip = (toState.name === 'activityStream') ? i18n._('Hide Activity Stream') : i18n._('View Activity Stream');
|
scope.activityStreamTooltip = (trans.to().name === 'activityStream') ? i18n._('Hide Activity Stream') : i18n._('View Activity Stream');
|
||||||
scope.showActivityStreamButton = (FeaturesService.featureEnabled('activity_streams') || toState.name ==='activityStream') ? true : false;
|
scope.showActivityStreamButton = (FeaturesService.featureEnabled('activity_streams') || trans.to().name ==='activityStream') ? true : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
function HostsList($scope, HostsList, $rootScope, GetBasePath,
|
function HostsList($scope, HostsList, $rootScope, GetBasePath,
|
||||||
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
|
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
|
||||||
HostsService, SetStatus, canAdd) {
|
HostsService, SetStatus, canAdd, $transitions) {
|
||||||
|
|
||||||
let list = HostsList;
|
let list = HostsList;
|
||||||
|
|
||||||
@@ -33,10 +33,10 @@ function HostsList($scope, HostsList, $rootScope, GetBasePath,
|
|||||||
setJobStatus();
|
setJobStatus();
|
||||||
});
|
});
|
||||||
|
|
||||||
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) {
|
$transitions.onSuccess({}, function(trans) {
|
||||||
if(toParams && toParams.host_search) {
|
if(trans.params('to') && trans.params('to').host_search) {
|
||||||
let hasMoreThanDefaultKeys = false;
|
let hasMoreThanDefaultKeys = false;
|
||||||
angular.forEach(toParams.host_search, function(value, key) {
|
angular.forEach(trans.params('to').host_search, function(value, key) {
|
||||||
if(key !== 'order_by' && key !== 'page_size') {
|
if(key !== 'order_by' && key !== 'page_size') {
|
||||||
hasMoreThanDefaultKeys = true;
|
hasMoreThanDefaultKeys = true;
|
||||||
}
|
}
|
||||||
@@ -114,5 +114,5 @@ function HostsList($scope, HostsList, $rootScope, GetBasePath,
|
|||||||
|
|
||||||
export default ['$scope', 'HostsList', '$rootScope', 'GetBasePath',
|
export default ['$scope', 'HostsList', '$rootScope', 'GetBasePath',
|
||||||
'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
|
'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
|
||||||
'HostsService', 'SetStatus', 'canAdd', HostsList
|
'HostsService', 'SetStatus', 'canAdd', '$transitions', HostsList
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -6,8 +6,10 @@
|
|||||||
|
|
||||||
export default ['$state', '$stateParams', '$scope', 'ParseVariableString', 'rbacUiControlService', 'ToJSON',
|
export default ['$state', '$stateParams', '$scope', 'ParseVariableString', 'rbacUiControlService', 'ToJSON',
|
||||||
'ParseTypeChange', 'GroupsService', 'GetChoices', 'GetBasePath', 'CreateSelect2', 'groupData', '$rootScope',
|
'ParseTypeChange', 'GroupsService', 'GetChoices', 'GetBasePath', 'CreateSelect2', 'groupData', '$rootScope',
|
||||||
|
'$transitions',
|
||||||
function($state, $stateParams, $scope, ParseVariableString, rbacUiControlService, ToJSON,
|
function($state, $stateParams, $scope, ParseVariableString, rbacUiControlService, ToJSON,
|
||||||
ParseTypeChange, GroupsService, GetChoices, GetBasePath, CreateSelect2, groupData, $rootScope) {
|
ParseTypeChange, GroupsService, GetChoices, GetBasePath, CreateSelect2, groupData, $rootScope,
|
||||||
|
$transitions) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
@@ -30,8 +32,8 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', 'rbac
|
|||||||
$scope.parseType = 'yaml';
|
$scope.parseType = 'yaml';
|
||||||
$scope.envParseType = 'yaml';
|
$scope.envParseType = 'yaml';
|
||||||
|
|
||||||
$rootScope.$on('$stateChangeSuccess', function(event, toState) {
|
$transitions.onSuccess({}, function(trans) {
|
||||||
if(toState.name === 'inventories.edit.groups.edit') {
|
if(trans.to().name === 'inventories.edit.groups.edit') {
|
||||||
ParseTypeChange({
|
ParseTypeChange({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
field_id: 'group_group_variables',
|
field_id: 'group_group_variables',
|
||||||
|
|||||||
@@ -7,11 +7,11 @@
|
|||||||
['$scope', '$rootScope', '$state', '$stateParams', 'GroupList', 'InventoryUpdate',
|
['$scope', '$rootScope', '$state', '$stateParams', 'GroupList', 'InventoryUpdate',
|
||||||
'GroupsService', 'CancelSourceUpdate', 'rbacUiControlService', 'GetBasePath',
|
'GroupsService', 'CancelSourceUpdate', 'rbacUiControlService', 'GetBasePath',
|
||||||
'GetHostsStatusMsg', 'Dataset', 'Find', 'QuerySet', 'inventoryData', 'canAdd',
|
'GetHostsStatusMsg', 'Dataset', 'Find', 'QuerySet', 'inventoryData', 'canAdd',
|
||||||
'InventoryHostsStrings',
|
'InventoryHostsStrings', '$transitions',
|
||||||
function($scope, $rootScope, $state, $stateParams, GroupList, InventoryUpdate,
|
function($scope, $rootScope, $state, $stateParams, GroupList, InventoryUpdate,
|
||||||
GroupsService, CancelSourceUpdate, rbacUiControlService, GetBasePath,
|
GroupsService, CancelSourceUpdate, rbacUiControlService, GetBasePath,
|
||||||
GetHostsStatusMsg, Dataset, Find, qs, inventoryData, canAdd,
|
GetHostsStatusMsg, Dataset, Find, qs, inventoryData, canAdd,
|
||||||
InventoryHostsStrings){
|
InventoryHostsStrings, $transitions){
|
||||||
|
|
||||||
let list = GroupList;
|
let list = GroupList;
|
||||||
|
|
||||||
@@ -173,9 +173,9 @@
|
|||||||
CancelSourceUpdate({ scope: $scope, id: id });
|
CancelSourceUpdate({ scope: $scope, id: id });
|
||||||
};
|
};
|
||||||
|
|
||||||
var cleanUpStateChangeListener = $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) {
|
var cleanUpStateChangeListener = $transitions.onSuccess({}, function(trans) {
|
||||||
if (toState.name === "inventories.edit.groups.edit") {
|
if (trans.to().name === "inventories.edit.groups.edit") {
|
||||||
$scope.rowBeingEdited = toParams.group_id;
|
$scope.rowBeingEdited = trans.params('to').group_id;
|
||||||
$scope.listBeingEdited = "groups";
|
$scope.listBeingEdited = "groups";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -7,9 +7,11 @@
|
|||||||
['$scope', '$rootScope', '$state', '$stateParams', 'NestedGroupListDefinition', 'InventoryUpdate',
|
['$scope', '$rootScope', '$state', '$stateParams', 'NestedGroupListDefinition', 'InventoryUpdate',
|
||||||
'GroupsService', 'CancelSourceUpdate', 'rbacUiControlService', 'GetBasePath',
|
'GroupsService', 'CancelSourceUpdate', 'rbacUiControlService', 'GetBasePath',
|
||||||
'GetHostsStatusMsg', 'Dataset', 'Find', 'QuerySet', 'inventoryData', 'canAdd', 'groupData', 'ProcessErrors',
|
'GetHostsStatusMsg', 'Dataset', 'Find', 'QuerySet', 'inventoryData', 'canAdd', 'groupData', 'ProcessErrors',
|
||||||
|
'$transitions',
|
||||||
function($scope, $rootScope, $state, $stateParams, NestedGroupListDefinition, InventoryUpdate,
|
function($scope, $rootScope, $state, $stateParams, NestedGroupListDefinition, InventoryUpdate,
|
||||||
GroupsService, CancelSourceUpdate, rbacUiControlService, GetBasePath,
|
GroupsService, CancelSourceUpdate, rbacUiControlService, GetBasePath,
|
||||||
GetHostsStatusMsg, Dataset, Find, qs, inventoryData, canAdd, groupData, ProcessErrors){
|
GetHostsStatusMsg, Dataset, Find, qs, inventoryData, canAdd, groupData, ProcessErrors,
|
||||||
|
$transitions){
|
||||||
|
|
||||||
let list = NestedGroupListDefinition;
|
let list = NestedGroupListDefinition;
|
||||||
|
|
||||||
@@ -132,9 +134,9 @@
|
|||||||
$state.go('inventories.edit.groups.edit.nested_groups', {group_id: id});
|
$state.go('inventories.edit.groups.edit.nested_groups', {group_id: id});
|
||||||
};
|
};
|
||||||
|
|
||||||
var cleanUpStateChangeListener = $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) {
|
var cleanUpStateChangeListener = $transitions.onSuccess({}, function(trans) {
|
||||||
if (toState.name === "inventories.edit.groups.edit.nested_groups.edit") {
|
if (trans.to().name === "inventories.edit.groups.edit.nested_groups.edit") {
|
||||||
$scope.rowBeingEdited = toParams.group_id;
|
$scope.rowBeingEdited = trans.params('to').group_id;
|
||||||
$scope.listBeingEdited = "groups";
|
$scope.listBeingEdited = "groups";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -7,9 +7,11 @@
|
|||||||
export default ['$scope', 'NestedHostsListDefinition', '$rootScope', 'GetBasePath',
|
export default ['$scope', 'NestedHostsListDefinition', '$rootScope', 'GetBasePath',
|
||||||
'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
|
'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
|
||||||
'HostsService', 'SetStatus', 'canAdd', 'GroupsService', 'ProcessErrors', 'groupData', 'inventoryData',
|
'HostsService', 'SetStatus', 'canAdd', 'GroupsService', 'ProcessErrors', 'groupData', 'inventoryData',
|
||||||
|
'$transitions',
|
||||||
function($scope, NestedHostsListDefinition, $rootScope, GetBasePath,
|
function($scope, NestedHostsListDefinition, $rootScope, GetBasePath,
|
||||||
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
|
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
|
||||||
HostsService, SetStatus, canAdd, GroupsService, ProcessErrors, groupData, inventoryData) {
|
HostsService, SetStatus, canAdd, GroupsService, ProcessErrors, groupData, inventoryData,
|
||||||
|
$transitions) {
|
||||||
|
|
||||||
let list = NestedHostsListDefinition;
|
let list = NestedHostsListDefinition;
|
||||||
|
|
||||||
@@ -46,10 +48,10 @@ export default ['$scope', 'NestedHostsListDefinition', '$rootScope', 'GetBasePat
|
|||||||
setJobStatus();
|
setJobStatus();
|
||||||
});
|
});
|
||||||
|
|
||||||
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) {
|
$transitions.onSuccess({}, function(trans) {
|
||||||
if(toParams && toParams.host_search) {
|
if(trans.params('to') && trans.params('to').host_search) {
|
||||||
let hasMoreThanDefaultKeys = false;
|
let hasMoreThanDefaultKeys = false;
|
||||||
angular.forEach(toParams.host_search, function(value, key) {
|
angular.forEach(trans.params('to').host_search, function(value, key) {
|
||||||
if(key !== 'order_by' && key !== 'page_size') {
|
if(key !== 'order_by' && key !== 'page_size') {
|
||||||
hasMoreThanDefaultKeys = true;
|
hasMoreThanDefaultKeys = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
// import HostsService from './../hosts/host.service';
|
// import HostsService from './../hosts/host.service';
|
||||||
export default ['$scope', 'ListDefinition', '$rootScope', 'GetBasePath',
|
export default ['$scope', 'ListDefinition', '$rootScope', 'GetBasePath',
|
||||||
'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
|
'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
|
||||||
'HostsService', 'SetStatus', 'canAdd', 'i18n',
|
'HostsService', 'SetStatus', 'canAdd', 'i18n', '$transitions',
|
||||||
function($scope, ListDefinition, $rootScope, GetBasePath,
|
function($scope, ListDefinition, $rootScope, GetBasePath,
|
||||||
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
|
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
|
||||||
HostsService, SetStatus, canAdd, i18n) {
|
HostsService, SetStatus, canAdd, i18n, $transitions) {
|
||||||
|
|
||||||
let list = ListDefinition;
|
let list = ListDefinition;
|
||||||
|
|
||||||
@@ -41,10 +41,10 @@ export default ['$scope', 'ListDefinition', '$rootScope', 'GetBasePath',
|
|||||||
setJobStatus();
|
setJobStatus();
|
||||||
});
|
});
|
||||||
|
|
||||||
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) {
|
$transitions.onSuccess({}, function(trans) {
|
||||||
if(toParams && toParams.host_search) {
|
if(trans.params('to') && trans.params('to').host_search) {
|
||||||
let hasMoreThanDefaultKeys = false;
|
let hasMoreThanDefaultKeys = false;
|
||||||
angular.forEach(toParams.host_search, function(value, key) {
|
angular.forEach(trans.params('to').host_search, function(value, key) {
|
||||||
if(key !== 'order_by' && key !== 'page_size') {
|
if(key !== 'order_by' && key !== 'page_size') {
|
||||||
hasMoreThanDefaultKeys = true;
|
hasMoreThanDefaultKeys = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ function SmartInventoryEdit($scope, $location,
|
|||||||
$stateParams, InventoryForm, Rest, ProcessErrors,
|
$stateParams, InventoryForm, Rest, ProcessErrors,
|
||||||
GetBasePath, ParseTypeChange, Wait, ToJSON,
|
GetBasePath, ParseTypeChange, Wait, ToJSON,
|
||||||
ParseVariableString, $state, OrgAdminLookup, resourceData,
|
ParseVariableString, $state, OrgAdminLookup, resourceData,
|
||||||
$rootScope, InstanceGroupsService, InstanceGroupsData) {
|
$rootScope, InstanceGroupsService, InstanceGroupsData, $transitions) {
|
||||||
|
|
||||||
// Inject dynamic view
|
// Inject dynamic view
|
||||||
var defaultUrl = GetBasePath('inventory'),
|
var defaultUrl = GetBasePath('inventory'),
|
||||||
@@ -37,8 +37,8 @@ function SmartInventoryEdit($scope, $location,
|
|||||||
|
|
||||||
$scope.parseType = 'yaml';
|
$scope.parseType = 'yaml';
|
||||||
|
|
||||||
$rootScope.$on('$stateChangeSuccess', function(event, toState) {
|
$transitions.onSuccess({}, function(trans) {
|
||||||
if(toState.name === 'inventories.editSmartInventory') {
|
if(trans.to().name === 'inventories.editSmartInventory') {
|
||||||
ParseTypeChange({
|
ParseTypeChange({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
variable: 'smartinventory_variables',
|
variable: 'smartinventory_variables',
|
||||||
@@ -109,5 +109,5 @@ export default [ '$scope', '$location',
|
|||||||
'ProcessErrors', 'GetBasePath', 'ParseTypeChange', 'Wait',
|
'ProcessErrors', 'GetBasePath', 'ParseTypeChange', 'Wait',
|
||||||
'ToJSON', 'ParseVariableString',
|
'ToJSON', 'ParseVariableString',
|
||||||
'$state', 'OrgAdminLookup', 'resourceData',
|
'$state', 'OrgAdminLookup', 'resourceData',
|
||||||
'$rootScope', 'InstanceGroupsService', 'InstanceGroupsData', SmartInventoryEdit
|
'$rootScope', 'InstanceGroupsService', 'InstanceGroupsData', '$transitions', SmartInventoryEdit
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ function InventoriesEdit($scope, $location,
|
|||||||
$stateParams, InventoryForm, Rest, ProcessErrors,
|
$stateParams, InventoryForm, Rest, ProcessErrors,
|
||||||
GetBasePath, ParseTypeChange, Wait, ToJSON,
|
GetBasePath, ParseTypeChange, Wait, ToJSON,
|
||||||
ParseVariableString, $state, OrgAdminLookup, $rootScope, resourceData,
|
ParseVariableString, $state, OrgAdminLookup, $rootScope, resourceData,
|
||||||
CreateSelect2, InstanceGroupsService, InstanceGroupsData, CanRemediate) {
|
CreateSelect2, InstanceGroupsService, InstanceGroupsData, CanRemediate,
|
||||||
|
$transitions) {
|
||||||
|
|
||||||
// Inject dynamic view
|
// Inject dynamic view
|
||||||
let defaultUrl = GetBasePath('inventory'),
|
let defaultUrl = GetBasePath('inventory'),
|
||||||
@@ -40,8 +41,8 @@ function InventoriesEdit($scope, $location,
|
|||||||
$scope.instance_groups = InstanceGroupsData;
|
$scope.instance_groups = InstanceGroupsData;
|
||||||
$scope.canRemediate = CanRemediate;
|
$scope.canRemediate = CanRemediate;
|
||||||
|
|
||||||
$rootScope.$on('$stateChangeSuccess', function(event, toState) {
|
$transitions.onSuccess({}, function(trans) {
|
||||||
if(toState.name === 'inventories.edit') {
|
if(trans.to().name === 'inventories.edit') {
|
||||||
ParseTypeChange({
|
ParseTypeChange({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
variable: 'inventory_variables',
|
variable: 'inventory_variables',
|
||||||
@@ -118,5 +119,6 @@ export default ['$scope', '$location',
|
|||||||
'ProcessErrors', 'GetBasePath', 'ParseTypeChange', 'Wait',
|
'ProcessErrors', 'GetBasePath', 'ParseTypeChange', 'Wait',
|
||||||
'ToJSON', 'ParseVariableString',
|
'ToJSON', 'ParseVariableString',
|
||||||
'$state', 'OrgAdminLookup', '$rootScope', 'resourceData', 'CreateSelect2',
|
'$state', 'OrgAdminLookup', '$rootScope', 'resourceData', 'CreateSelect2',
|
||||||
'InstanceGroupsService', 'InstanceGroupsData', 'CanRemediate', InventoriesEdit,
|
'InstanceGroupsService', 'InstanceGroupsData', 'CanRemediate',
|
||||||
|
'$transitions', InventoriesEdit,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
import jobSubmissionController from './job-submission.controller';
|
import jobSubmissionController from './job-submission.controller';
|
||||||
|
|
||||||
export default [ 'templateUrl', 'CreateDialog', 'Wait', 'CreateSelect2', 'ParseTypeChange', 'GetSurveyQuestions', 'i18n', 'credentialTypesLookup',
|
export default [ 'templateUrl', 'CreateDialog', 'Wait', 'CreateSelect2', 'ParseTypeChange', 'GetSurveyQuestions', 'i18n', 'credentialTypesLookup', '$transitions',
|
||||||
function(templateUrl, CreateDialog, Wait, CreateSelect2, ParseTypeChange, GetSurveyQuestions, i18n, credentialTypesLookup) {
|
function(templateUrl, CreateDialog, Wait, CreateSelect2, ParseTypeChange, GetSurveyQuestions, i18n, credentialTypesLookup, $transitions) {
|
||||||
return {
|
return {
|
||||||
scope: {
|
scope: {
|
||||||
submitJobId: '=',
|
submitJobId: '=',
|
||||||
@@ -130,7 +130,7 @@ export default [ 'templateUrl', 'CreateDialog', 'Wait', 'CreateSelect2', 'ParseT
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
scope.$on("$stateChangeStart", function() {
|
$transitions.onStart({}, function() {
|
||||||
scope.$evalAsync(function( scope ) {
|
scope.$evalAsync(function( scope ) {
|
||||||
scope.clearDialog();
|
scope.clearDialog();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ export default
|
|||||||
[ 'Wait', 'CreateDialog', 'GetBasePath' ,
|
[ 'Wait', 'CreateDialog', 'GetBasePath' ,
|
||||||
'Rest' ,
|
'Rest' ,
|
||||||
'ProcessErrors', '$rootScope', '$state',
|
'ProcessErrors', '$rootScope', '$state',
|
||||||
'$scope', 'CreateSelect2', 'i18n',
|
'$scope', 'CreateSelect2', 'i18n', '$transitions',
|
||||||
function( Wait, CreateDialog, GetBasePath,
|
function( Wait, CreateDialog, GetBasePath,
|
||||||
Rest, ProcessErrors,
|
Rest, ProcessErrors,
|
||||||
$rootScope, $state, $scope,
|
$rootScope, $state, $scope,
|
||||||
CreateSelect2, i18n) {
|
CreateSelect2, i18n, $transitions) {
|
||||||
|
|
||||||
var defaultUrl = GetBasePath('system_job_templates') + "?order_by=name";
|
var defaultUrl = GetBasePath('system_job_templates') + "?order_by=name";
|
||||||
|
|
||||||
@@ -263,15 +263,15 @@ export default
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var cleanUpStateChangeListener = $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) {
|
var cleanUpStateChangeListener = $transitions.onSuccess({}, function(trans) {
|
||||||
if(toState.name === "managementJobsList") {
|
if(trans.to().name === "managementJobsList") {
|
||||||
// We are on the management job list view - nothing needs to be highlighted
|
// We are on the management job list view - nothing needs to be highlighted
|
||||||
delete $scope.activeCard;
|
delete $scope.activeCard;
|
||||||
delete $scope.cardAction;
|
delete $scope.cardAction;
|
||||||
}
|
}
|
||||||
else if(toState.name === "managementJobsList.notifications") {
|
else if(trans.to().name === "managementJobsList.notifications") {
|
||||||
// We are on the notifications view - update the active card and the action
|
// We are on the notifications view - update the active card and the action
|
||||||
$scope.activeCard = parseInt(toParams.management_id);
|
$scope.activeCard = parseInt(trans.params('to').management_id);
|
||||||
$scope.cardAction = "notifications";
|
$scope.cardAction = "notifications";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -749,7 +749,7 @@ function(ConfigurationUtils, i18n, $rootScope) {
|
|||||||
* Include the standard TB data-XXX attributes to controll a tooltip's appearance. We will
|
* Include the standard TB data-XXX attributes to controll a tooltip's appearance. We will
|
||||||
* default placement to the left and delay to the config setting.
|
* default placement to the left and delay to the config setting.
|
||||||
*/
|
*/
|
||||||
.directive('awToolTip', [function() {
|
.directive('awToolTip', ['$transitions', function($transitions) {
|
||||||
return {
|
return {
|
||||||
link: function(scope, element, attrs) {
|
link: function(scope, element, attrs) {
|
||||||
var delay = { show: 200, hide: 0 },
|
var delay = { show: 200, hide: 0 },
|
||||||
@@ -783,7 +783,8 @@ function(ConfigurationUtils, i18n, $rootScope) {
|
|||||||
// Un-bind - we don't want a bunch of listeners firing
|
// Un-bind - we don't want a bunch of listeners firing
|
||||||
stateChangeWatcher();
|
stateChangeWatcher();
|
||||||
}
|
}
|
||||||
stateChangeWatcher = scope.$on('$stateChangeStart', function() {
|
|
||||||
|
stateChangeWatcher = $transitions.onStart({}, function() {
|
||||||
// Go ahead and force the tooltip setTimeout to expire (if it hasn't already fired)
|
// Go ahead and force the tooltip setTimeout to expire (if it hasn't already fired)
|
||||||
$(element).tooltip('hide');
|
$(element).tooltip('hide');
|
||||||
// Clean up any existing tooltips including this one
|
// Clean up any existing tooltips including this one
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export default ['$rootScope', function($rootScope) {
|
export default ['$rootScope', '$transitions', function($rootScope, $transitions) {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
scope: {
|
scope: {
|
||||||
@@ -9,7 +9,7 @@ export default ['$rootScope', function($rootScope) {
|
|||||||
|
|
||||||
scope.maxPanels = parseInt(scope.maxPanels);
|
scope.maxPanels = parseInt(scope.maxPanels);
|
||||||
|
|
||||||
$rootScope.$on('$stateChangeSuccess', function() {
|
$transitions.onSuccess({}, function() {
|
||||||
let panels = angular.element('#' + scope.panelContainer).find('.Panel');
|
let panels = angular.element('#' + scope.panelContainer).find('.Panel');
|
||||||
|
|
||||||
if(panels.length > scope.maxPanels) {
|
if(panels.length > scope.maxPanels) {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
export default ['$stateParams', '$scope', '$state', 'GetBasePath', 'QuerySet', 'SmartSearchService', 'i18n', 'ConfigService',
|
export default ['$stateParams', '$scope', '$state', 'GetBasePath', 'QuerySet', 'SmartSearchService', 'i18n', 'ConfigService', '$transitions',
|
||||||
function($stateParams, $scope, $state, GetBasePath, qs, SmartSearchService, i18n, configService) {
|
function($stateParams, $scope, $state, GetBasePath, qs, SmartSearchService, i18n, configService, $transitions) {
|
||||||
|
|
||||||
let path,
|
let path,
|
||||||
defaults,
|
defaults,
|
||||||
queryset,
|
queryset,
|
||||||
stateChangeSuccessListener;
|
transitionSuccessListener;
|
||||||
|
|
||||||
configService.getConfig()
|
configService.getConfig()
|
||||||
.then(config => init(config));
|
.then(config => init(config));
|
||||||
@@ -62,17 +62,17 @@ export default ['$stateParams', '$scope', '$state', 'GetBasePath', 'QuerySet', '
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(stateChangeSuccessListener) {
|
if(transitionSuccessListener) {
|
||||||
stateChangeSuccessListener();
|
transitionSuccessListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
stateChangeSuccessListener = $scope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) {
|
transitionSuccessListener = $transitions.onSuccess({}, function(trans) {
|
||||||
// State has changed - check to see if this is a param change
|
// State has changed - check to see if this is a param change
|
||||||
if(fromState.name === toState.name) {
|
if(trans.from().name === trans.to().name) {
|
||||||
if(!compareParams(fromParams[`${$scope.iterator}_search`], toParams[`${$scope.iterator}_search`])) {
|
if(!compareParams(trans.params('from')[`${$scope.iterator}_search`], trans.params('to')[`${$scope.iterator}_search`])) {
|
||||||
// Params are not the same - we need to update the search. This should only happen when the user
|
// Params are not the same - we need to update the search. This should only happen when the user
|
||||||
// hits the forward/back navigation buttons in their browser.
|
// hits the forward/back navigation buttons in their browser.
|
||||||
queryset = toParams[`${$scope.iterator}_search`];
|
queryset = trans.params('to')[`${$scope.iterator}_search`];
|
||||||
qs.search(path, queryset).then((res) => {
|
qs.search(path, queryset).then((res) => {
|
||||||
$scope.dataset = res.data;
|
$scope.dataset = res.data;
|
||||||
$scope.collection = res.data.results;
|
$scope.collection = res.data.results;
|
||||||
@@ -84,7 +84,7 @@ export default ['$stateParams', '$scope', '$state', 'GetBasePath', 'QuerySet', '
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.$on('$destroy', stateChangeSuccessListener);
|
$scope.$on('$destroy', transitionSuccessListener);
|
||||||
|
|
||||||
$scope.$watch('disableSearch', function(disableSearch){
|
$scope.$watch('disableSearch', function(disableSearch){
|
||||||
if(disableSearch) {
|
if(disableSearch) {
|
||||||
|
|||||||
Reference in New Issue
Block a user