Skip to content

Commit

Permalink
Simplify service resolve
Browse files Browse the repository at this point in the history
Need to rework polling on this, as it stands it a flashback whenever conents are filtered or sorted
  • Loading branch information
AllenBW committed Jul 11, 2017
1 parent ab68f9d commit 0b86615
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function ComponentController($state, ServicesState, Language, ListView, Chargeba
Language.fixState(ServicesState.services, vm.toolbarConfig);

resolveServices(vm.limit, 0);
Polling.start('serviceListPolling', pollUpdateServicesList, vm.pollingInterval);
// Polling.start('serviceListPolling', pollUpdateServicesList, vm.pollingInterval);
};

function getCardConfig() {
Expand Down Expand Up @@ -169,9 +169,9 @@ function ComponentController($state, ServicesState, Language, ListView, Chargeba
PowerOperations.suspendService(item);
}

function pollUpdateServicesList() {
resolveServices(vm.limit, vm.offset, true);
}
// function pollUpdateServicesList() {
// resolveServices(vm.limit, vm.offset, true);
// }

function viewSelected(viewId) {
vm.viewType = viewId;
Expand Down Expand Up @@ -363,9 +363,6 @@ function ComponentController($state, ServicesState, Language, ListView, Chargeba
ServicesState.getServices(
limit,
offset,
ServicesState.services.getFilters(),
ServicesState.services.getSort().currentField,
ServicesState.services.getSort().isAscending,
refresh).then(querySuccess, queryFailure);
});

Expand Down
12 changes: 5 additions & 7 deletions client/app/services/services-state.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function ServicesStateFactory(ListConfiguration, CollectionsApi, RBAC) {
return CollectionsApi.query('services', options);
}

function getServices(limit, offset, filters, sortField, sortAscending, refresh) {
function getServices(limit, offset, refresh) {
const options = {
expand: 'resources',
limit: limit,
Expand All @@ -87,15 +87,13 @@ export function ServicesStateFactory(ListConfiguration, CollectionsApi, RBAC) {
'service_resources',
'tags',
],
filter: getQueryFilters(filters),
filter: getQueryFilters(services.getFilters()),
auto_refresh: refresh,
};

if (angular.isDefined(sortField)) {
options.sort_by = services.getSort().currentField.id;
options.sort_options = services.getSort().currentField.sortType === 'alpha' ? 'ignore_case' : '';
options.sort_order = sortAscending ? 'asc' : 'desc';
}
options.sort_by = services.getSort().currentField.id || '';
options.sort_options = services.getSort().currentField.sortType === 'alpha' ? 'ignore_case' : '';
options.sort_order = services.getSort().isAscending ? 'asc' : 'desc';

return CollectionsApi.query('services', options);
}
Expand Down

0 comments on commit 0b86615

Please sign in to comment.