Skip to content

Commit

Permalink
Merge pull request finos#360 from davidwatkins73/waltz-357-pie-asset-…
Browse files Browse the repository at this point in the history
…codes

Include asset code in entity statistic detail table
  • Loading branch information
davidwatkins73 authored Aug 1, 2016
2 parents f0fc276 + ba58309 commit d0ba0b8
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

<waltz-entity-statistic-detail-table statistic-values="$ctrl.values"
statistic-definition='$ctrl.definition'
filter-outcome="$ctrl.selectedPieSegment.key">
filter-outcome="$ctrl.selectedPieSegment.key"
applications="$ctrl.applications">
</waltz-entity-statistic-detail-table>
</div>
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import _ from "lodash";
import {variableScale} from "../../common/colors";


const bindings = {
applications: '<',
definition: '<',
summary: '<',
values: '<',
definition: '<'
values: '<'
};


Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import _ from 'lodash';


/**
* Intended to show a table similar to:
*
Expand All @@ -8,9 +11,10 @@
**/

const bindings = {
applications: '<',
filterOutcome: '<',
statisticValues: '<',
statisticDefinition: '<'
statisticDefinition: '<',
statisticValues: '<'
};


Expand All @@ -25,11 +29,18 @@ function controller($animate, uiGridConstants) {
}

if(change.filterOutcome) {
const tableOutcomeCell = vm.gridOptions.columnDefs[1];
const tableOutcomeCell = vm.gridOptions.columnDefs[2];
tableOutcomeCell.filter.term = vm.filterOutcome;
}
};

if(change.applications) {
vm.appsById = _.keyBy(vm.applications, 'id');
}

if (vm.appsById && vm.statisticValues) {
_.each(vm.statisticValues, sv => sv.application = vm.appsById[sv.entity.id]);
}
};
}


Expand All @@ -39,7 +50,7 @@ controller.$inject = [
];


const template = "<div style=\"font-size: smaller; height: 300px\"\n ui-grid-exporter\n ui-grid=\"$ctrl.gridOptions\">\n</div>";
const template = "<div style=\"font-size: smaller; height: 300px\"\n ui-grid-exporter\n ui-grid-resize-columns\n ui-grid=\"$ctrl.gridOptions\">\n</div>";


const component = {
Expand Down Expand Up @@ -68,6 +79,12 @@ const outcomeCell = (uiGridConstants) => {
};


const assetCodeCell = {
field: 'application.assetCode',
displayName: 'Asset Code'
};


const valueCell = (uiGridConstants, statisticDefinition) => {
return {
field: 'value',
Expand Down Expand Up @@ -108,6 +125,7 @@ function setupGrid($animate, uiGridConstants, statisticDefinition) {
},
columnDefs: [
appNameCell,
assetCodeCell,
outcomeCell(uiGridConstants),
valueCell(uiGridConstants, statisticDefinition),
reasonCell,
Expand Down
3 changes: 2 additions & 1 deletion waltz-ng/client/entity-statistics/entity-statistic-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
style="border-right: 2px solid #eee">
<waltz-entity-statistic-detail-panel definition='ctrl.statistic.definition'
summary="ctrl.statistic.summary"
values="ctrl.statistic.values">
values="ctrl.statistic.values"
applications="ctrl.applications">
</waltz-entity-statistic-detail-panel>
</div>

Expand Down
8 changes: 8 additions & 0 deletions waltz-ng/client/entity-statistics/entity-statistic-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import _ from "lodash";
import {kindToViewState, initialiseData} from "../common";

const initData = {
applications: [],
statistic: {
definition: null,
summary: null,
Expand Down Expand Up @@ -37,6 +38,7 @@ function hasRelatedDefinitions(defs) {
function controller($q,
$state,
$stateParams,
applicationStore,
bookmarkStore,
entityStatisticUtilities,
entityStatisticStore) {
Expand Down Expand Up @@ -116,6 +118,11 @@ function controller($q,
.findStatValuesByIdSelector(statId, selector)
.then(stats => vm.statistic.values = stats);


applicationStore
.findBySelector(selector)
.then(apps => vm.applications = apps);

updateUrlWithoutReload($state, navItem);
};

Expand All @@ -131,6 +138,7 @@ controller.$inject = [
'$q',
'$state',
'$stateParams',
'ApplicationStore',
'BookmarkStore',
'EntityStatisticUtilities',
'EntityStatisticStore'
Expand Down
1 change: 1 addition & 0 deletions waltz-ng/client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const dependencies = [
'ui.select',
'ui.grid',
'ui.grid.exporter',
'ui.grid.resizeColumns',
'ui-notification',
'ngAnimate',
'ngSanitize',
Expand Down

0 comments on commit d0ba0b8

Please sign in to comment.