@@ -19,51 +19,6 @@ import { calcPortfolioCost } from '../../asset-cost/services/asset-cost-utilitie
1919import { calcComplexitySummary } from '../../complexity/services/complexity-utilities' ;
2020
2121
22- import {
23- lifecyclePhaseColorScale ,
24- capabilityColorScale ,
25- flowDirectionColorScale ,
26- ragColorScale } from '../../common/colors' ;
27-
28-
29-
30- function calcAppPhasePieStats ( apps ) {
31- return _ . chain ( apps )
32- . countBy ( 'lifecyclePhase' )
33- . map ( ( v , k ) => ( { key : k , count : v } ) )
34- . value ( ) ;
35- }
36-
37-
38- function calcAppInvestmentPieStats ( apps ) {
39- return _ . chain ( apps )
40- . countBy ( 'overallRating' )
41- . map ( ( v , k ) => ( { key : k , count : v } ) )
42- . value ( ) ;
43- }
44-
45-
46- function calcAppConnectionPieStats ( flows , apps ) {
47- const logicalFlows = flows . flows ;
48-
49- const orgMemberAppIds = _ . map ( apps , 'id' ) ;
50-
51- return _ . chain ( logicalFlows )
52- . uniq ( false , f => f . source . id + '.' + f . target . id )
53- . map ( f => {
54- const sourceIsMember = _ . contains ( orgMemberAppIds , f . source . id ) ;
55- const targetIsMember = _ . contains ( orgMemberAppIds , f . target . id ) ;
56- if ( sourceIsMember && targetIsMember ) return 'INTRA' ;
57- if ( sourceIsMember ) return 'INBOUND' ;
58- if ( targetIsMember ) return 'OUTBOUND' ;
59- return 'UNKNOWN' ;
60- } )
61- . countBy ( )
62- . map ( ( v , k ) => ( { key : k , count : v } ) )
63- . value ( ) ;
64- }
65-
66-
6722function calcCapabilityStats ( ratings ) {
6823 const caps = _ . chain ( ratings )
6924 . map ( "capability" )
@@ -90,53 +45,12 @@ function controller($scope, orgUnitStore) {
9045 vm . saveDescriptionFn = ( newValue , oldValue ) =>
9146 orgUnitStore . updateDescription ( vm . unit . id , newValue , oldValue ) ;
9247
93- const investmentLabels = {
94- 'R' : 'Disinvest' ,
95- 'A' : 'Maintain' ,
96- 'G' : 'Invest'
97- } ;
98-
99- const pies = {
100- appPhase : {
101- config : {
102- colorProvider : ( d ) => lifecyclePhaseColorScale ( d . data . key ) ,
103- size : 80
104- }
105- } ,
106- appConnections : {
107- config : {
108- colorProvider : ( d ) => flowDirectionColorScale ( d . data . key ) ,
109- size : 80
110- }
111- } ,
112- appInvestment : {
113- config : {
114- colorProvider : ( d ) => ragColorScale ( d . data . key ) ,
115- size : 80 ,
116- labelProvider : ( k ) => investmentLabels [ k ] || 'Unknown'
117- }
118- }
119- } ;
120-
121- vm . pies = pies ;
122-
123- $scope . $watch ( 'ctrl.apps' , apps => {
124- if ( ! apps ) return ;
125- vm . pies . appPhase . data = calcAppPhasePieStats ( apps ) ;
126- vm . pies . appInvestment . data = calcAppInvestmentPieStats ( apps ) ;
127- } ) ;
12848
12949 $scope . $watch ( 'ctrl.ratings' , ratings => {
13050 if ( ! ratings ) return ;
13151 vm . capabilityStats = calcCapabilityStats ( ratings ) ;
13252 } ) ;
13353
134- $scope . $watch ( 'ctrl.flows' , flows => {
135- if ( ! flows ) return ;
136- vm . pies . appConnections . data = calcAppConnectionPieStats ( flows , this . apps ) ;
137- } ) ;
138-
139-
14054 $scope . $watch ( 'ctrl.costs' , cs => vm . portfolioCostStr = calcPortfolioCost ( cs ) ) ;
14155
14256 $scope . $watch ( 'ctrl.orgServerStats' , stats => {
0 commit comments