change async loading order for form

This commit is contained in:
John Mitchell
2015-10-23 12:23:37 -07:00
parent 58f0f9f6e9
commit f8e4fdf201
2 changed files with 114 additions and 100 deletions

View File

@@ -210,8 +210,6 @@ export function TeamsEdit($scope, $rootScope, $compile, $location, $log, $routeP
});
});
$scope.team_id = id;
// manipulate the choices from the options request to be usable
// by the search option for permission_type, you can't inject the
// list until this is done!
@@ -222,8 +220,11 @@ export function TeamsEdit($scope, $rootScope, $compile, $location, $log, $routeP
});
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
generator.reset();
$scope.$emit('loadTeam');
});
$scope.team_id = id;
$scope.PermissionAddAllowed = false;
// Retrieve each related set and any lookups
@@ -254,6 +255,11 @@ export function TeamsEdit($scope, $rootScope, $compile, $location, $log, $routeP
}
});
// Retrieve each related set and any lookups
if ($scope.loadTeamRemove) {
$scope.loadTeamRemove();
}
$scope.loadTeamRemove = $scope.$on('loadTeam', function () {
// Retrieve detail record and prepopulate the form
Wait('start');
Rest.setUrl(defaultUrl + ':id/');
@@ -307,6 +313,7 @@ export function TeamsEdit($scope, $rootScope, $compile, $location, $log, $routeP
ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to retrieve team: ' + $routeParams.team_id +
'. GET status: ' + status });
});
});
$scope.getPermissionText = function () {
if (this.permission.permission_type !== "admin" && this.permission.run_ad_hoc_commands) {

View File

@@ -242,10 +242,6 @@ export function UsersEdit($scope, $rootScope, $compile, $location, $log, $routeP
});
});
if ($scope.removeFormReady) {
$scope.removeFormReady();
}
$scope.removeFormReady = $scope.$on('formReady', function () {
// manipulate the choices from the options request to be usable
// by the search option for permission_type, you can't inject the
// list until this is done!
@@ -256,8 +252,13 @@ export function UsersEdit($scope, $rootScope, $compile, $location, $log, $routeP
});
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
generator.reset();
$scope.$emit("loadForm");
});
if ($scope.removeFormReady) {
$scope.removeFormReady();
}
$scope.removeFormReady = $scope.$on('formReady', function () {
if ($scope.removePostRefresh) {
$scope.removePostRefresh();
}
@@ -471,6 +472,11 @@ export function UsersEdit($scope, $rootScope, $compile, $location, $log, $routeP
// Put form back to its original state
ResetForm();
if ($scope.removeLoadForm) {
$scope.removeLoadForm();
}
$scope.removeLoadForm = $scope.$on('loadForm', function () {
if ($scope.removeModifyForm) {
$scope.removeModifyForm();
@@ -516,6 +522,7 @@ export function UsersEdit($scope, $rootScope, $compile, $location, $log, $routeP
ProcessErrors($scope, data, status, null, { hdr: 'Error!',
msg: 'Failed to retrieve user: ' + id + '. GET status: ' + status });
});
});
}
UsersEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'UserForm', 'GenerateForm',