mirror of
https://github.com/ansible/awx.git
synced 2026-01-21 22:48:02 -03:30
replacing all stateChangeSuccess for $transition.onSuccess
This commit is contained in:
parent
6e3f4a7a6e
commit
f9c991e660
@ -1,10 +1,10 @@
|
||||
const templateUrl = require('~components/layout/layout.partial.html');
|
||||
|
||||
function AtLayoutController ($scope, strings) {
|
||||
function AtLayoutController ($scope, strings, $transitions) {
|
||||
const vm = this || {};
|
||||
|
||||
$scope.$on('$stateChangeSuccess', (event, next) => {
|
||||
vm.currentState = next.name;
|
||||
$transitions.onSuccess({}, (transition) => {
|
||||
vm.currentState = transition.to().name;
|
||||
});
|
||||
|
||||
$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 () {
|
||||
return {
|
||||
|
||||
@ -273,9 +273,9 @@ angular
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
if (next.name !== "templates.editWorkflowJobTemplate.workflowMaker" &&
|
||||
next.name !== "templates.editWorkflowJobTemplate.workflowMaker.inventory" &&
|
||||
next.name !== "templates.editWorkflowJobTemplate.workflowMaker.credential") {
|
||||
if (trans.to().name !== "templates.editWorkflowJobTemplate.workflowMaker" &&
|
||||
trans.to().name !== "templates.editWorkflowJobTemplate.workflowMaker.inventory" &&
|
||||
trans.to().name !== "templates.editWorkflowJobTemplate.workflowMaker.credential") {
|
||||
$('.ui-dialog-content').each(function() {
|
||||
$(this).dialog('close');
|
||||
});
|
||||
@ -318,21 +318,20 @@ angular
|
||||
activateTab();
|
||||
});
|
||||
|
||||
// $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) {
|
||||
$transitions.onSuccess({}, function(trans) {
|
||||
|
||||
if(trans.to() === trans.from()) {
|
||||
// check to see if something other than a search param has changed
|
||||
let toParamsWithoutSearchKeys = {};
|
||||
let fromParamsWithoutSearchKeys = {};
|
||||
for (let key in trans.$to().params) {
|
||||
if (trans.$to().params.hasOwnProperty(key) && !/_search/.test(key)) {
|
||||
toParamsWithoutSearchKeys[key] = trans.$to().params[key];
|
||||
for (let key in trans.params('to')) {
|
||||
if (trans.params('to').hasOwnProperty(key) && !/_search/.test(key)) {
|
||||
toParamsWithoutSearchKeys[key] = trans.params('to')[key];
|
||||
}
|
||||
}
|
||||
for (let key in trans.$from().params) {
|
||||
if (trans.$from().params.hasOwnProperty(key) && !/_search/.test(key)) {
|
||||
fromParamsWithoutSearchKeys[key] = trans.$from().params[key];
|
||||
for (let key in trans.params('from')) {
|
||||
if (trans.params('from').hasOwnProperty(key) && !/_search/.test(key)) {
|
||||
fromParamsWithoutSearchKeys[key] = trans.params('from')[key];
|
||||
}
|
||||
}
|
||||
|
||||
@ -344,8 +343,8 @@ angular
|
||||
document.body.scrollTop = document.documentElement.scrollTop = 0;
|
||||
}
|
||||
|
||||
if (trans.from().name === 'license' && trans.$to().params.hasOwnProperty('licenseMissing')) {
|
||||
$rootScope.licenseMissing = trans.$to().params.licenseMissing;
|
||||
if (trans.from().name === 'license' && trans.params('to').hasOwnProperty('licenseMissing')) {
|
||||
$rootScope.licenseMissing = trans.params('to').licenseMissing;
|
||||
}
|
||||
var list, id;
|
||||
// broadcast event change if editing crud object
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
export default
|
||||
['templateUrl', '$state', 'FeaturesService','$rootScope', 'Store', 'Empty', '$window', 'BreadCrumbService', 'i18n',
|
||||
function(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, $transitions) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: templateUrl('bread-crumb/bread-crumb'),
|
||||
@ -15,21 +15,21 @@ export default
|
||||
scope.alwaysShowRefreshButton = false;
|
||||
scope.loadingLicense = true;
|
||||
|
||||
scope.$on("$stateChangeSuccess", function updateActivityStreamButton(event, toState, toParams, fromState, fromParams) {
|
||||
if(fromState && !Empty(fromState.name)) {
|
||||
$transitions.onSuccess({}, function updateActivityStreamButton(trans) {
|
||||
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
|
||||
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
|
||||
// activity stream
|
||||
//Store('previous_state', fromState);
|
||||
}
|
||||
|
||||
streamConfig = (toState && toState.data) ? toState.data : {};
|
||||
streamConfig = (trans.to() && trans.to().data) ? trans.to().data : {};
|
||||
|
||||
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
|
||||
// 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
|
||||
@ -37,9 +37,9 @@ export default
|
||||
var features = FeaturesService.get();
|
||||
if(features){
|
||||
scope.loadingLicense = false;
|
||||
scope.activityStreamActive = (toState.name === 'activityStream') ? true : false;
|
||||
scope.activityStreamTooltip = (toState.name === 'activityStream') ? i18n._('Hide Activity Stream') : i18n._('View Activity Stream');
|
||||
scope.showActivityStreamButton = (FeaturesService.featureEnabled('activity_streams') || toState.name ==='activityStream') ? true : false;
|
||||
scope.activityStreamActive = (trans.to().name === 'activityStream') ? true : false;
|
||||
scope.activityStreamTooltip = (trans.to().name === 'activityStream') ? i18n._('Hide Activity Stream') : i18n._('View Activity Stream');
|
||||
scope.showActivityStreamButton = (FeaturesService.featureEnabled('activity_streams') || trans.to().name ==='activityStream') ? true : false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
function HostsList($scope, HostsList, $rootScope, GetBasePath,
|
||||
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
|
||||
HostsService, SetStatus, canAdd) {
|
||||
HostsService, SetStatus, canAdd, $transitions) {
|
||||
|
||||
let list = HostsList;
|
||||
|
||||
@ -33,10 +33,10 @@ function HostsList($scope, HostsList, $rootScope, GetBasePath,
|
||||
setJobStatus();
|
||||
});
|
||||
|
||||
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) {
|
||||
if(toParams && toParams.host_search) {
|
||||
$transitions.onSuccess({}, function(trans) {
|
||||
if(trans.params('to') && trans.params('to').host_search) {
|
||||
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') {
|
||||
hasMoreThanDefaultKeys = true;
|
||||
}
|
||||
@ -114,5 +114,5 @@ function HostsList($scope, HostsList, $rootScope, GetBasePath,
|
||||
|
||||
export default ['$scope', 'HostsList', '$rootScope', 'GetBasePath',
|
||||
'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',
|
||||
'ParseTypeChange', 'GroupsService', 'GetChoices', 'GetBasePath', 'CreateSelect2', 'groupData', '$rootScope',
|
||||
'$transitions',
|
||||
function($state, $stateParams, $scope, ParseVariableString, rbacUiControlService, ToJSON,
|
||||
ParseTypeChange, GroupsService, GetChoices, GetBasePath, CreateSelect2, groupData, $rootScope) {
|
||||
ParseTypeChange, GroupsService, GetChoices, GetBasePath, CreateSelect2, groupData, $rootScope,
|
||||
$transitions) {
|
||||
|
||||
init();
|
||||
|
||||
@ -30,8 +32,8 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', 'rbac
|
||||
$scope.parseType = 'yaml';
|
||||
$scope.envParseType = 'yaml';
|
||||
|
||||
$rootScope.$on('$stateChangeSuccess', function(event, toState) {
|
||||
if(toState.name === 'inventories.edit.groups.edit') {
|
||||
$transitions.onSuccess({}, function(trans) {
|
||||
if(trans.to().name === 'inventories.edit.groups.edit') {
|
||||
ParseTypeChange({
|
||||
scope: $scope,
|
||||
field_id: 'group_group_variables',
|
||||
|
||||
@ -7,11 +7,11 @@
|
||||
['$scope', '$rootScope', '$state', '$stateParams', 'GroupList', 'InventoryUpdate',
|
||||
'GroupsService', 'CancelSourceUpdate', 'rbacUiControlService', 'GetBasePath',
|
||||
'GetHostsStatusMsg', 'Dataset', 'Find', 'QuerySet', 'inventoryData', 'canAdd',
|
||||
'InventoryHostsStrings',
|
||||
'InventoryHostsStrings', '$transitions',
|
||||
function($scope, $rootScope, $state, $stateParams, GroupList, InventoryUpdate,
|
||||
GroupsService, CancelSourceUpdate, rbacUiControlService, GetBasePath,
|
||||
GetHostsStatusMsg, Dataset, Find, qs, inventoryData, canAdd,
|
||||
InventoryHostsStrings){
|
||||
InventoryHostsStrings, $transitions){
|
||||
|
||||
let list = GroupList;
|
||||
|
||||
@ -173,9 +173,9 @@
|
||||
CancelSourceUpdate({ scope: $scope, id: id });
|
||||
};
|
||||
|
||||
var cleanUpStateChangeListener = $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) {
|
||||
if (toState.name === "inventories.edit.groups.edit") {
|
||||
$scope.rowBeingEdited = toParams.group_id;
|
||||
var cleanUpStateChangeListener = $transitions.onSuccess({}, function(trans) {
|
||||
if (trans.to().name === "inventories.edit.groups.edit") {
|
||||
$scope.rowBeingEdited = trans.params('to').group_id;
|
||||
$scope.listBeingEdited = "groups";
|
||||
}
|
||||
else {
|
||||
|
||||
@ -7,9 +7,11 @@
|
||||
['$scope', '$rootScope', '$state', '$stateParams', 'NestedGroupListDefinition', 'InventoryUpdate',
|
||||
'GroupsService', 'CancelSourceUpdate', 'rbacUiControlService', 'GetBasePath',
|
||||
'GetHostsStatusMsg', 'Dataset', 'Find', 'QuerySet', 'inventoryData', 'canAdd', 'groupData', 'ProcessErrors',
|
||||
'$transitions',
|
||||
function($scope, $rootScope, $state, $stateParams, NestedGroupListDefinition, InventoryUpdate,
|
||||
GroupsService, CancelSourceUpdate, rbacUiControlService, GetBasePath,
|
||||
GetHostsStatusMsg, Dataset, Find, qs, inventoryData, canAdd, groupData, ProcessErrors){
|
||||
GetHostsStatusMsg, Dataset, Find, qs, inventoryData, canAdd, groupData, ProcessErrors,
|
||||
$transitions){
|
||||
|
||||
let list = NestedGroupListDefinition;
|
||||
|
||||
@ -132,9 +134,9 @@
|
||||
$state.go('inventories.edit.groups.edit.nested_groups', {group_id: id});
|
||||
};
|
||||
|
||||
var cleanUpStateChangeListener = $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) {
|
||||
if (toState.name === "inventories.edit.groups.edit.nested_groups.edit") {
|
||||
$scope.rowBeingEdited = toParams.group_id;
|
||||
var cleanUpStateChangeListener = $transitions.onSuccess({}, function(trans) {
|
||||
if (trans.to().name === "inventories.edit.groups.edit.nested_groups.edit") {
|
||||
$scope.rowBeingEdited = trans.params('to').group_id;
|
||||
$scope.listBeingEdited = "groups";
|
||||
}
|
||||
else {
|
||||
|
||||
@ -7,9 +7,11 @@
|
||||
export default ['$scope', 'NestedHostsListDefinition', '$rootScope', 'GetBasePath',
|
||||
'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
|
||||
'HostsService', 'SetStatus', 'canAdd', 'GroupsService', 'ProcessErrors', 'groupData', 'inventoryData',
|
||||
'$transitions',
|
||||
function($scope, NestedHostsListDefinition, $rootScope, GetBasePath,
|
||||
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
|
||||
HostsService, SetStatus, canAdd, GroupsService, ProcessErrors, groupData, inventoryData) {
|
||||
HostsService, SetStatus, canAdd, GroupsService, ProcessErrors, groupData, inventoryData,
|
||||
$transitions) {
|
||||
|
||||
let list = NestedHostsListDefinition;
|
||||
|
||||
@ -46,10 +48,10 @@ export default ['$scope', 'NestedHostsListDefinition', '$rootScope', 'GetBasePat
|
||||
setJobStatus();
|
||||
});
|
||||
|
||||
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) {
|
||||
if(toParams && toParams.host_search) {
|
||||
$transitions.onSuccess({}, function(trans) {
|
||||
if(trans.params('to') && trans.params('to').host_search) {
|
||||
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') {
|
||||
hasMoreThanDefaultKeys = true;
|
||||
}
|
||||
|
||||
@ -7,10 +7,10 @@
|
||||
// import HostsService from './../hosts/host.service';
|
||||
export default ['$scope', 'ListDefinition', '$rootScope', 'GetBasePath',
|
||||
'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
|
||||
'HostsService', 'SetStatus', 'canAdd', 'i18n',
|
||||
'HostsService', 'SetStatus', 'canAdd', 'i18n', '$transitions',
|
||||
function($scope, ListDefinition, $rootScope, GetBasePath,
|
||||
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
|
||||
HostsService, SetStatus, canAdd, i18n) {
|
||||
HostsService, SetStatus, canAdd, i18n, $transitions) {
|
||||
|
||||
let list = ListDefinition;
|
||||
|
||||
@ -41,10 +41,10 @@ export default ['$scope', 'ListDefinition', '$rootScope', 'GetBasePath',
|
||||
setJobStatus();
|
||||
});
|
||||
|
||||
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) {
|
||||
if(toParams && toParams.host_search) {
|
||||
$transitions.onSuccess({}, function(trans) {
|
||||
if(trans.params('to') && trans.params('to').host_search) {
|
||||
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') {
|
||||
hasMoreThanDefaultKeys = true;
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ function SmartInventoryEdit($scope, $location,
|
||||
$stateParams, InventoryForm, Rest, ProcessErrors,
|
||||
GetBasePath, ParseTypeChange, Wait, ToJSON,
|
||||
ParseVariableString, $state, OrgAdminLookup, resourceData,
|
||||
$rootScope, InstanceGroupsService, InstanceGroupsData) {
|
||||
$rootScope, InstanceGroupsService, InstanceGroupsData, $transitions) {
|
||||
|
||||
// Inject dynamic view
|
||||
var defaultUrl = GetBasePath('inventory'),
|
||||
@ -37,8 +37,8 @@ function SmartInventoryEdit($scope, $location,
|
||||
|
||||
$scope.parseType = 'yaml';
|
||||
|
||||
$rootScope.$on('$stateChangeSuccess', function(event, toState) {
|
||||
if(toState.name === 'inventories.editSmartInventory') {
|
||||
$transitions.onSuccess({}, function(trans) {
|
||||
if(trans.to().name === 'inventories.editSmartInventory') {
|
||||
ParseTypeChange({
|
||||
scope: $scope,
|
||||
variable: 'smartinventory_variables',
|
||||
@ -109,5 +109,5 @@ export default [ '$scope', '$location',
|
||||
'ProcessErrors', 'GetBasePath', 'ParseTypeChange', 'Wait',
|
||||
'ToJSON', 'ParseVariableString',
|
||||
'$state', 'OrgAdminLookup', 'resourceData',
|
||||
'$rootScope', 'InstanceGroupsService', 'InstanceGroupsData', SmartInventoryEdit
|
||||
'$rootScope', 'InstanceGroupsService', 'InstanceGroupsData', '$transitions', SmartInventoryEdit
|
||||
];
|
||||
|
||||
@ -14,7 +14,8 @@ function InventoriesEdit($scope, $location,
|
||||
$stateParams, InventoryForm, Rest, ProcessErrors,
|
||||
GetBasePath, ParseTypeChange, Wait, ToJSON,
|
||||
ParseVariableString, $state, OrgAdminLookup, $rootScope, resourceData,
|
||||
CreateSelect2, InstanceGroupsService, InstanceGroupsData, CanRemediate) {
|
||||
CreateSelect2, InstanceGroupsService, InstanceGroupsData, CanRemediate,
|
||||
$transitions) {
|
||||
|
||||
// Inject dynamic view
|
||||
let defaultUrl = GetBasePath('inventory'),
|
||||
@ -40,8 +41,8 @@ function InventoriesEdit($scope, $location,
|
||||
$scope.instance_groups = InstanceGroupsData;
|
||||
$scope.canRemediate = CanRemediate;
|
||||
|
||||
$rootScope.$on('$stateChangeSuccess', function(event, toState) {
|
||||
if(toState.name === 'inventories.edit') {
|
||||
$transitions.onSuccess({}, function(trans) {
|
||||
if(trans.to().name === 'inventories.edit') {
|
||||
ParseTypeChange({
|
||||
scope: $scope,
|
||||
variable: 'inventory_variables',
|
||||
@ -118,5 +119,6 @@ export default ['$scope', '$location',
|
||||
'ProcessErrors', 'GetBasePath', 'ParseTypeChange', 'Wait',
|
||||
'ToJSON', 'ParseVariableString',
|
||||
'$state', 'OrgAdminLookup', '$rootScope', 'resourceData', 'CreateSelect2',
|
||||
'InstanceGroupsService', 'InstanceGroupsData', 'CanRemediate', InventoriesEdit,
|
||||
'InstanceGroupsService', 'InstanceGroupsData', 'CanRemediate',
|
||||
'$transitions', InventoriesEdit,
|
||||
];
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
|
||||
import jobSubmissionController from './job-submission.controller';
|
||||
|
||||
export default [ 'templateUrl', 'CreateDialog', 'Wait', 'CreateSelect2', 'ParseTypeChange', 'GetSurveyQuestions', 'i18n', 'credentialTypesLookup',
|
||||
function(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, $transitions) {
|
||||
return {
|
||||
scope: {
|
||||
submitJobId: '=',
|
||||
@ -130,7 +130,7 @@ export default [ 'templateUrl', 'CreateDialog', 'Wait', 'CreateSelect2', 'ParseT
|
||||
}
|
||||
};
|
||||
|
||||
scope.$on("$stateChangeStart", function() {
|
||||
$transitions.onStart({}, function() {
|
||||
scope.$evalAsync(function( scope ) {
|
||||
scope.clearDialog();
|
||||
});
|
||||
|
||||
@ -9,11 +9,11 @@ export default
|
||||
[ 'Wait', 'CreateDialog', 'GetBasePath' ,
|
||||
'Rest' ,
|
||||
'ProcessErrors', '$rootScope', '$state',
|
||||
'$scope', 'CreateSelect2', 'i18n',
|
||||
'$scope', 'CreateSelect2', 'i18n', '$transitions',
|
||||
function( Wait, CreateDialog, GetBasePath,
|
||||
Rest, ProcessErrors,
|
||||
$rootScope, $state, $scope,
|
||||
CreateSelect2, i18n) {
|
||||
CreateSelect2, i18n, $transitions) {
|
||||
|
||||
var defaultUrl = GetBasePath('system_job_templates') + "?order_by=name";
|
||||
|
||||
@ -263,15 +263,15 @@ export default
|
||||
});
|
||||
};
|
||||
|
||||
var cleanUpStateChangeListener = $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) {
|
||||
if(toState.name === "managementJobsList") {
|
||||
var cleanUpStateChangeListener = $transitions.onSuccess({}, function(trans) {
|
||||
if(trans.to().name === "managementJobsList") {
|
||||
// We are on the management job list view - nothing needs to be highlighted
|
||||
delete $scope.activeCard;
|
||||
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
|
||||
$scope.activeCard = parseInt(toParams.management_id);
|
||||
$scope.activeCard = parseInt(trans.params('to').management_id);
|
||||
$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
|
||||
* default placement to the left and delay to the config setting.
|
||||
*/
|
||||
.directive('awToolTip', [function() {
|
||||
.directive('awToolTip', ['$transitions', function($transitions) {
|
||||
return {
|
||||
link: function(scope, element, attrs) {
|
||||
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
|
||||
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)
|
||||
$(element).tooltip('hide');
|
||||
// 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 {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
@ -9,7 +9,7 @@ export default ['$rootScope', function($rootScope) {
|
||||
|
||||
scope.maxPanels = parseInt(scope.maxPanels);
|
||||
|
||||
$rootScope.$on('$stateChangeSuccess', function() {
|
||||
$transitions.onSuccess({}, function() {
|
||||
let panels = angular.element('#' + scope.panelContainer).find('.Panel');
|
||||
|
||||
if(panels.length > scope.maxPanels) {
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
export default ['$stateParams', '$scope', '$state', 'GetBasePath', 'QuerySet', 'SmartSearchService', 'i18n', 'ConfigService',
|
||||
function($stateParams, $scope, $state, GetBasePath, qs, SmartSearchService, i18n, configService) {
|
||||
export default ['$stateParams', '$scope', '$state', 'GetBasePath', 'QuerySet', 'SmartSearchService', 'i18n', 'ConfigService', '$transitions',
|
||||
function($stateParams, $scope, $state, GetBasePath, qs, SmartSearchService, i18n, configService, $transitions) {
|
||||
|
||||
let path,
|
||||
defaults,
|
||||
queryset,
|
||||
stateChangeSuccessListener;
|
||||
transitionSuccessListener;
|
||||
|
||||
configService.getConfig()
|
||||
.then(config => init(config));
|
||||
@ -62,17 +62,17 @@ export default ['$stateParams', '$scope', '$state', 'GetBasePath', 'QuerySet', '
|
||||
return true;
|
||||
}
|
||||
|
||||
if(stateChangeSuccessListener) {
|
||||
stateChangeSuccessListener();
|
||||
if(transitionSuccessListener) {
|
||||
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
|
||||
if(fromState.name === toState.name) {
|
||||
if(!compareParams(fromParams[`${$scope.iterator}_search`], toParams[`${$scope.iterator}_search`])) {
|
||||
if(trans.from().name === trans.to().name) {
|
||||
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
|
||||
// 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) => {
|
||||
$scope.dataset = res.data;
|
||||
$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){
|
||||
if(disableSearch) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user