Skip to content

Commit

Permalink
Merge pull request #644 from davidwatkins73/waltz-639-optimise-ou-view
Browse files Browse the repository at this point in the history
Optimised ordering of ou-view data loading
  • Loading branch information
davidwatkins73 authored Sep 30, 2016
2 parents 1dab281 + 6e4ee69 commit 8b34969
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 207 deletions.
3 changes: 1 addition & 2 deletions waltz-ng/client/org-units/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ export default (module) => {
module
.config(require('./routes'))
.service('OrgUnitStore', require('./services/org-unit-store'))
.service('OrgUnitViewDataService', require('./services/org-unit-view-data'))
.service('OrgUnitViewOptionsService', require('./services/org-unit-view-options'));
.service('OrgUnitViewDataService', require('./services/org-unit-view-data'));

module.component(
'waltzOrgUnitOverview',
Expand Down
3 changes: 2 additions & 1 deletion waltz-ng/client/org-units/services/org-unit-view-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function loadCapabilityRatings(store, selector, holder) {
function loadAppCapabilities(store, selector, holder) {
return store
.findApplicationCapabilitiesByAppIdSelector(selector)
.then(r => holder.rawAppCapabilities = r);
.then(r => holder.appCapabilities = r);
}


Expand Down Expand Up @@ -272,6 +272,7 @@ function service($q,


return {
data: rawData,
loadAll,
selectAssetBucket,
loadFlowDetail,
Expand Down
185 changes: 0 additions & 185 deletions waltz-ng/client/org-units/services/org-unit-view-options.js

This file was deleted.

2 changes: 1 addition & 1 deletion waltz-ng/client/org-units/unit-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

<!-- CAPABILITIES -->
<waltz-rating-explorer-section applications="ctrl.viewData.apps"
app-capabilities="ctrl.viewData.rawAppCapabilities"
app-capabilities="ctrl.viewData.appCapabilities"
capabilities="ctrl.viewData.capabilities"
ratings="ctrl.viewData.capabilityRatings"
source-data-ratings="ctrl.viewData.sourceDataRatings">
Expand Down
30 changes: 12 additions & 18 deletions waltz-ng/client/org-units/unit-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,33 @@
import EventDispatcher from "../common/EventDispatcher";


const addToHistory = (historyStore, orgUnit) => {
historyStore.put(
orgUnit.name,
'ORG_UNIT',
'main.org-unit.view',
{ id: orgUnit.id });
};


function controller($stateParams,
$scope,
viewDataService,
viewOptions,
historyStore,
tourService) {

const id = $stateParams.id;
const vm = this;

const refresh = () => {
if (!vm.rawViewData) return;
const orgUnit = vm.rawViewData.orgUnit;

historyStore.put(orgUnit.name, 'ORG_UNIT', 'main.org-unit.view', { id: orgUnit.id });

vm.viewData = viewOptions.filter(vm.rawViewData);
};

$scope.$watch(
() => viewOptions.options,
refresh,
true);

vm.entityRef = { kind: 'ORG_UNIT', id };

vm.eventDispatcher = new EventDispatcher();

vm.viewData = viewDataService.data;

viewDataService
.loadAll(id)
.then(data => vm.rawViewData = data)
.then(refresh)
.then(() => addToHistory(historyStore, vm.viewData.orgUnit))
.then(() => tourService.initialiseForKey('main.org-unit.view', true))
.then(tour => vm.tour = tour);

Expand All @@ -68,7 +63,6 @@ controller.$inject = [
'$stateParams',
'$scope',
'OrgUnitViewDataService',
'OrgUnitViewOptionsService',
'HistoryStore',
'TourService'
];
Expand Down

0 comments on commit 8b34969

Please sign in to comment.