Merge pull request #4776 from jaredevantabor/portal-mode

fixing filter and sockets for portal jobs
This commit is contained in:
Jared Tabor 2017-01-18 10:23:50 -08:00 committed by GitHub
commit 94b9d6f95a
2 changed files with 13 additions and 11 deletions

View File

@ -9,27 +9,25 @@ export function PortalModeJobsController($scope, $rootScope, $state, $stateParam
var list = PortalJobsList;
$scope.$on('ws-jobs', function() {
// @issue: OLD SEARCH
//$scope.search('job');
});
if ($rootScope.removeJobStatusChange) {
$rootScope.removeJobStatusChange();
}
$rootScope.removeJobStatusChange = $rootScope.$on('JobStatusChange-portal', function() {
$state.go('.', null, { reload: true });
});
init();
function init() {
function init(data) {
let d = (!data) ? Dataset : data;
// search init
$scope.list = list;
$scope[`${list.iterator}_dataset`] = Dataset.data;
$scope[`${list.iterator}_dataset`] = d.data;
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
$scope.iterator = list.iterator;
}
$scope.$on('filterPortalJobs', function(e, data){
init(data);
});
$scope.refresh = function() {
$state.go('.', null, {reload: true});
};

View File

@ -47,14 +47,18 @@ export default {
$scope.activeFilter = 'user';
path = GetBasePath('jobs');
$stateParams.job_search.created_by = $rootScope.current_user.id;
qs.search(path, $stateParams.job_search);
qs.search(path, $stateParams.job_search).then((response) => {
$scope.$broadcast('filterPortalJobs', response);
});
};
$scope.filterAll = function() {
$scope.activeFilter = 'all';
delete $stateParams.job_search.created_by;
path = GetBasePath('jobs');
qs.search(path, $stateParams.job_search);
qs.search(path, $stateParams.job_search).then((response) => {
$scope.$broadcast('filterPortalJobs', response);
});
};
}
]