From 2246ca0511a1098c1d799a4c6c741ea778fb5286 Mon Sep 17 00:00:00 2001 From: Vegard Bakke Date: Thu, 28 Nov 2024 20:55:26 +0100 Subject: [PATCH 1/5] Add deliberate delays to emulate what happens when the files arrive in unexpected order --- .../circular-heatmap.component.ts | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/app/component/circular-heatmap/circular-heatmap.component.ts b/src/app/component/circular-heatmap/circular-heatmap.component.ts index 267a34d0d..b76213000 100644 --- a/src/app/component/circular-heatmap/circular-heatmap.component.ts +++ b/src/app/component/circular-heatmap/circular-heatmap.component.ts @@ -75,9 +75,11 @@ export class CircularHeatmapComponent implements OnInit { matChipsArray: MatChip[] = []; private LoadMaturityDataFromGeneratedYaml() { + console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityDataFromGeneratedYaml Fetch'); this.yaml.setURI('./assets/YAML/generated/generated.yaml'); this.yaml.getJson().subscribe(data => { + console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityDataFromGeneratedYaml Downloaded'); this.YamlObject = data; var allDimensionNames = Object.keys(this.YamlObject); var totalTeamsImplemented: number = 0; @@ -191,6 +193,8 @@ export class CircularHeatmapComponent implements OnInit { this.segment_labels ); this.noActivitytoGrey(); + console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityDataFromGeneratedYaml End'); + }); } @@ -225,20 +229,25 @@ export class CircularHeatmapComponent implements OnInit { } private LoadTeamsFromMetaYaml() { + console.log((performance.now()/1000).toFixed(3) + 's: LoadTeamsFromMetaYaml Fetch'); this.yaml.setURI('./assets/YAML/meta.yaml'); - this.yaml.getJson().subscribe(data => { + this.yaml.getJson().subscribe(data => { setTimeout((data) => { + console.log((performance.now()/1000).toFixed(3) + 's: LoadTeamsFromMetaYaml Downloaded'); this.YamlObject = data; this.teamList = this.YamlObject['teams']; this.teamGroups = this.YamlObject['teamGroups']; this.teamVisible = [...this.teamList]; - }); + console.log((performance.now()/1000).toFixed(3) + 's: LoadTeamsFromMetaYaml End'); + }, 500, data)}); // Delay Teams by half a second } private LoadMaturityLevels() { + console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityLevels Fetch'); this.yaml.setURI('./assets/YAML/meta.yaml'); // Function sets column header - this.yaml.getJson().subscribe(data => { + this.yaml.getJson().subscribe(data => { setTimeout((data) => { + console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityLevels Downloaded'); this.YamlObject = data; // Levels header @@ -247,7 +256,8 @@ export class CircularHeatmapComponent implements OnInit { this.radial_labels.push('Level ' + y); this.maxLevelOfActivities = y; } - }); + console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityLevels End'); + }, 700, data)}); // Delay meta data even more than half a second. This order may happen on flaky network } toggleTeamGroupSelection(chip: MatChip) { @@ -702,11 +712,8 @@ export class CircularHeatmapComponent implements OnInit { } noActivitytoGrey(): void { - console.log(this.ALL_CARD_DATA); for (var x = 0; x < this.ALL_CARD_DATA.length; x++) { if (this.ALL_CARD_DATA[x]['Done%'] == -1) { - console.log(this.ALL_CARD_DATA[x]['SubDimension']); - console.log(this.ALL_CARD_DATA[x]['Level']); d3.selectAll( '#segment-' + this.ALL_CARD_DATA[x]['SubDimension'].replace(/ /g, '-') + From 3aa694c5843509b7ce86ff15ed68833cfd0dc7b3 Mon Sep 17 00:00:00 2001 From: Vegard Bakke Date: Thu, 28 Nov 2024 21:33:11 +0100 Subject: [PATCH 2/5] Ensure correct load order, using promises --- .../circular-heatmap.component.ts | 272 +++++++++--------- 1 file changed, 141 insertions(+), 131 deletions(-) diff --git a/src/app/component/circular-heatmap/circular-heatmap.component.ts b/src/app/component/circular-heatmap/circular-heatmap.component.ts index b76213000..6e822c036 100644 --- a/src/app/component/circular-heatmap/circular-heatmap.component.ts +++ b/src/app/component/circular-heatmap/circular-heatmap.component.ts @@ -66,135 +66,139 @@ export class CircularHeatmapComponent implements OnInit { } ngOnInit(): void { - this.LoadMaturityLevels(); - this.LoadTeamsFromMetaYaml(); - this.LoadMaturityDataFromGeneratedYaml(); + // Ensure that Levels and Teams load before MaturityData + // using promises, since ngOnInit does not support async/await + this.LoadMaturityLevels() + .then(() => this.LoadTeamsFromMetaYaml()) + .then(() => this.LoadMaturityDataFromGeneratedYaml()); } @ViewChildren(MatChip) chips!: QueryList; matChipsArray: MatChip[] = []; private LoadMaturityDataFromGeneratedYaml() { - console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityDataFromGeneratedYaml Fetch'); - this.yaml.setURI('./assets/YAML/generated/generated.yaml'); - - this.yaml.getJson().subscribe(data => { - console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityDataFromGeneratedYaml Downloaded'); - this.YamlObject = data; - var allDimensionNames = Object.keys(this.YamlObject); - var totalTeamsImplemented: number = 0; - var totalActivityTeams: number = 0; - - this.AddSegmentLabels(allDimensionNames); - - for (var l = 0; l < this.maxLevelOfActivities; l++) { - for (var d = 0; d < allDimensionNames.length; d++) { - var allSubDimensionInThisDimension = Object.keys( - this.YamlObject[allDimensionNames[d]] - ); - for (var s = 0; s < allSubDimensionInThisDimension.length; s++) { - var allActivityInThisSubDimension = Object.keys( - this.YamlObject[allDimensionNames[d]][ - allSubDimensionInThisDimension[s] - ] + return new Promise((resolve, reject) => { + console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityDataFromGeneratedYaml Fetch'); + this.yaml.setURI('./assets/YAML/generated/generated.yaml'); + + this.yaml.getJson().subscribe(data => { + console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityDataFromGeneratedYaml Downloaded'); + this.YamlObject = data; + var allDimensionNames = Object.keys(this.YamlObject); + var totalTeamsImplemented: number = 0; + var totalActivityTeams: number = 0; + + this.AddSegmentLabels(allDimensionNames); + + for (var l = 0; l < this.maxLevelOfActivities; l++) { + for (var d = 0; d < allDimensionNames.length; d++) { + var allSubDimensionInThisDimension = Object.keys( + this.YamlObject[allDimensionNames[d]] ); - var level = 'Level ' + (l + 1); - var activity: activitySchema[] = []; - var activityCompletionStatus: number = -1; - - for (var a = 0; a < allActivityInThisSubDimension.length; a++) { - try { - var uuid = - this.YamlObject[allDimensionNames[d]][ - allSubDimensionInThisDimension[s] - ][allActivityInThisSubDimension[a]]['uuid']; - - var lvlOfCurrentActivity = - this.YamlObject[allDimensionNames[d]][ - allSubDimensionInThisDimension[s] - ][allActivityInThisSubDimension[a]]['level']; - - if (lvlOfCurrentActivity == l + 1) { - var nameOfActivity: string = allActivityInThisSubDimension[a]; - var teamStatus: { [key: string]: boolean } = {}; - const teams = this.teamList; - - totalActivityTeams += 1; - - teams.forEach((singleTeam: any) => { - teamStatus[singleTeam] = false; - }); - - var teamsImplemented: any = + for (var s = 0; s < allSubDimensionInThisDimension.length; s++) { + var allActivityInThisSubDimension = Object.keys( + this.YamlObject[allDimensionNames[d]][ + allSubDimensionInThisDimension[s] + ] + ); + var level = 'Level ' + (l + 1); + var activity: activitySchema[] = []; + var activityCompletionStatus: number = -1; + + for (var a = 0; a < allActivityInThisSubDimension.length; a++) { + try { + var uuid = this.YamlObject[allDimensionNames[d]][ allSubDimensionInThisDimension[s] - ][allActivityInThisSubDimension[a]]['teamsImplemented']; - - if (teamsImplemented) { - teamStatus = teamsImplemented; - } - - var localStorageData = this.getFromBrowserState(); + ][allActivityInThisSubDimension[a]]['uuid']; - if (localStorageData != null && localStorageData.length > 0) { + var lvlOfCurrentActivity = this.YamlObject[allDimensionNames[d]][ allSubDimensionInThisDimension[s] - ][allActivityInThisSubDimension[a]]['teamsImplemented'] = - this.getTeamImplementedFromJson( - localStorageData, - allActivityInThisSubDimension[a] - ); - } + ][allActivityInThisSubDimension[a]]['level']; + + if (lvlOfCurrentActivity == l + 1) { + var nameOfActivity: string = allActivityInThisSubDimension[a]; + var teamStatus: { [key: string]: boolean } = {}; + const teams = this.teamList; - ( - Object.keys(teamStatus) as (keyof typeof teamStatus)[] - ).forEach((key, index) => { totalActivityTeams += 1; - if (teamStatus[key] === true) { - totalTeamsImplemented += 1; + + teams.forEach((singleTeam: any) => { + teamStatus[singleTeam] = false; + }); + + var teamsImplemented: any = + this.YamlObject[allDimensionNames[d]][ + allSubDimensionInThisDimension[s] + ][allActivityInThisSubDimension[a]]['teamsImplemented']; + + if (teamsImplemented) { + teamStatus = teamsImplemented; } - }); - activity.push({ - uuid: uuid, - activityName: nameOfActivity, - teamsImplemented: teamStatus, - }); - } + var localStorageData = this.getFromBrowserState(); + + if (localStorageData != null && localStorageData.length > 0) { + this.YamlObject[allDimensionNames[d]][ + allSubDimensionInThisDimension[s] + ][allActivityInThisSubDimension[a]]['teamsImplemented'] = + this.getTeamImplementedFromJson( + localStorageData, + allActivityInThisSubDimension[a] + ); + } + + ( + Object.keys(teamStatus) as (keyof typeof teamStatus)[] + ).forEach((key, index) => { + totalActivityTeams += 1; + if (teamStatus[key] === true) { + totalTeamsImplemented += 1; + } + }); + + activity.push({ + uuid: uuid, + activityName: nameOfActivity, + teamsImplemented: teamStatus, + }); + } - if (totalActivityTeams > 0) { - activityCompletionStatus = - totalTeamsImplemented / totalActivityTeams; + if (totalActivityTeams > 0) { + activityCompletionStatus = + totalTeamsImplemented / totalActivityTeams; + } + } catch { + console.log('level for activity does not exist'); } - } catch { - console.log('level for activity does not exist'); } - } - var cardSchemaData: cardSchema = { - Dimension: allDimensionNames[d], - SubDimension: allSubDimensionInThisDimension[s], - Level: level, - 'Done%': activityCompletionStatus, - Activity: activity, - }; + var cardSchemaData: cardSchema = { + Dimension: allDimensionNames[d], + SubDimension: allSubDimensionInThisDimension[s], + Level: level, + 'Done%': activityCompletionStatus, + Activity: activity, + }; - this.ALL_CARD_DATA.push(cardSchemaData); + this.ALL_CARD_DATA.push(cardSchemaData); + } } } - } - - console.log('ALL CARD DATA', this.ALL_CARD_DATA); - this.loadState(); - this.loadCircularHeatMap( - this.ALL_CARD_DATA, - '#chart', - this.radial_labels, - this.segment_labels - ); - this.noActivitytoGrey(); - console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityDataFromGeneratedYaml End'); + console.log('ALL CARD DATA', this.ALL_CARD_DATA); + this.loadState(); + this.loadCircularHeatMap( + this.ALL_CARD_DATA, + '#chart', + this.radial_labels, + this.segment_labels + ); + this.noActivitytoGrey(); + console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityDataFromGeneratedYaml End'); + resolve(); + }); }); } @@ -229,35 +233,41 @@ export class CircularHeatmapComponent implements OnInit { } private LoadTeamsFromMetaYaml() { - console.log((performance.now()/1000).toFixed(3) + 's: LoadTeamsFromMetaYaml Fetch'); - this.yaml.setURI('./assets/YAML/meta.yaml'); - this.yaml.getJson().subscribe(data => { setTimeout((data) => { - console.log((performance.now()/1000).toFixed(3) + 's: LoadTeamsFromMetaYaml Downloaded'); - this.YamlObject = data; - - this.teamList = this.YamlObject['teams']; - this.teamGroups = this.YamlObject['teamGroups']; - this.teamVisible = [...this.teamList]; - console.log((performance.now()/1000).toFixed(3) + 's: LoadTeamsFromMetaYaml End'); - }, 500, data)}); // Delay Teams by half a second + return new Promise((resolve, reject) => { + console.log((performance.now()/1000).toFixed(3) + 's: LoadTeamsFromMetaYaml Fetch'); + this.yaml.setURI('./assets/YAML/meta.yaml'); + this.yaml.getJson().subscribe(data => { setTimeout((data) => { + console.log((performance.now()/1000).toFixed(3) + 's: LoadTeamsFromMetaYaml Downloaded'); + this.YamlObject = data; + + this.teamList = this.YamlObject['teams']; + this.teamGroups = this.YamlObject['teamGroups']; + this.teamVisible = [...this.teamList]; + console.log((performance.now()/1000).toFixed(3) + 's: LoadTeamsFromMetaYaml End'); + resolve(); // Resolve the promise, and allow the next Load to run + }, 500, data)}); // Delay Teams by half a second + }); } private LoadMaturityLevels() { - console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityLevels Fetch'); - this.yaml.setURI('./assets/YAML/meta.yaml'); - // Function sets column header - this.yaml.getJson().subscribe(data => { setTimeout((data) => { - console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityLevels Downloaded'); - this.YamlObject = data; - - // Levels header - for (let x in this.YamlObject['strings']['en']['maturity_levels']) { - var y = parseInt(x) + 1; - this.radial_labels.push('Level ' + y); - this.maxLevelOfActivities = y; - } - console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityLevels End'); - }, 700, data)}); // Delay meta data even more than half a second. This order may happen on flaky network + return new Promise((resolve, reject) => { + console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityLevels Fetch'); + this.yaml.setURI('./assets/YAML/meta.yaml'); + // Function sets column header + this.yaml.getJson().subscribe(data => { setTimeout((data) => { + console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityLevels Downloaded'); + this.YamlObject = data; + + // Levels header + for (let x in this.YamlObject['strings']['en']['maturity_levels']) { + var y = parseInt(x) + 1; + this.radial_labels.push('Level ' + y); + this.maxLevelOfActivities = y; + } + console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityLevels End'); + resolve(); // Resolve the promise, and allow the next Load to run + }, 700, data)}); // Delay meta data even more than half a second. This order may happen on flaky network + }); } toggleTeamGroupSelection(chip: MatChip) { From 102224716a0fe5d1024cfff81405362a732908d1 Mon Sep 17 00:00:00 2001 From: Vegard Bakke Date: Thu, 28 Nov 2024 21:38:34 +0100 Subject: [PATCH 3/5] Remove deliberate delays --- .../circular-heatmap/circular-heatmap.component.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/component/circular-heatmap/circular-heatmap.component.ts b/src/app/component/circular-heatmap/circular-heatmap.component.ts index 6e822c036..b9f0ee0bf 100644 --- a/src/app/component/circular-heatmap/circular-heatmap.component.ts +++ b/src/app/component/circular-heatmap/circular-heatmap.component.ts @@ -236,7 +236,7 @@ export class CircularHeatmapComponent implements OnInit { return new Promise((resolve, reject) => { console.log((performance.now()/1000).toFixed(3) + 's: LoadTeamsFromMetaYaml Fetch'); this.yaml.setURI('./assets/YAML/meta.yaml'); - this.yaml.getJson().subscribe(data => { setTimeout((data) => { + this.yaml.getJson().subscribe(data => { console.log((performance.now()/1000).toFixed(3) + 's: LoadTeamsFromMetaYaml Downloaded'); this.YamlObject = data; @@ -245,7 +245,7 @@ export class CircularHeatmapComponent implements OnInit { this.teamVisible = [...this.teamList]; console.log((performance.now()/1000).toFixed(3) + 's: LoadTeamsFromMetaYaml End'); resolve(); // Resolve the promise, and allow the next Load to run - }, 500, data)}); // Delay Teams by half a second + }); }); } @@ -254,7 +254,7 @@ export class CircularHeatmapComponent implements OnInit { console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityLevels Fetch'); this.yaml.setURI('./assets/YAML/meta.yaml'); // Function sets column header - this.yaml.getJson().subscribe(data => { setTimeout((data) => { + this.yaml.getJson().subscribe(data => { console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityLevels Downloaded'); this.YamlObject = data; @@ -266,7 +266,7 @@ export class CircularHeatmapComponent implements OnInit { } console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityLevels End'); resolve(); // Resolve the promise, and allow the next Load to run - }, 700, data)}); // Delay meta data even more than half a second. This order may happen on flaky network + }); }); } From b7ba406f018ac369d6f16569df903b592d27200f Mon Sep 17 00:00:00 2001 From: Vegard Bakke Date: Thu, 28 Nov 2024 22:21:51 +0100 Subject: [PATCH 4/5] Confirm with ESLint --- .../circular-heatmap.component.ts | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/app/component/circular-heatmap/circular-heatmap.component.ts b/src/app/component/circular-heatmap/circular-heatmap.component.ts index b9f0ee0bf..9e87ab1b4 100644 --- a/src/app/component/circular-heatmap/circular-heatmap.component.ts +++ b/src/app/component/circular-heatmap/circular-heatmap.component.ts @@ -78,11 +78,11 @@ export class CircularHeatmapComponent implements OnInit { private LoadMaturityDataFromGeneratedYaml() { return new Promise((resolve, reject) => { - console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityDataFromGeneratedYaml Fetch'); + console.log(`${this.perfNow()}s: LoadMaturityDataFromGeneratedYaml Fetch`); this.yaml.setURI('./assets/YAML/generated/generated.yaml'); this.yaml.getJson().subscribe(data => { - console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityDataFromGeneratedYaml Downloaded'); + console.log(`${this.perfNow()}s: LoadMaturityDataFromGeneratedYaml Downloaded`); this.YamlObject = data; var allDimensionNames = Object.keys(this.YamlObject); var totalTeamsImplemented: number = 0; @@ -118,7 +118,8 @@ export class CircularHeatmapComponent implements OnInit { ][allActivityInThisSubDimension[a]]['level']; if (lvlOfCurrentActivity == l + 1) { - var nameOfActivity: string = allActivityInThisSubDimension[a]; + var nameOfActivity: string = + allActivityInThisSubDimension[a]; var teamStatus: { [key: string]: boolean } = {}; const teams = this.teamList; @@ -139,7 +140,10 @@ export class CircularHeatmapComponent implements OnInit { var localStorageData = this.getFromBrowserState(); - if (localStorageData != null && localStorageData.length > 0) { + if ( + localStorageData != null && + localStorageData.length > 0 + ) { this.YamlObject[allDimensionNames[d]][ allSubDimensionInThisDimension[s] ][allActivityInThisSubDimension[a]]['teamsImplemented'] = @@ -196,7 +200,7 @@ export class CircularHeatmapComponent implements OnInit { this.segment_labels ); this.noActivitytoGrey(); - console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityDataFromGeneratedYaml End'); + console.log(`${this.perfNow()}s: LoadMaturityDataFromGeneratedYaml End`); resolve(); }); }); @@ -234,16 +238,16 @@ export class CircularHeatmapComponent implements OnInit { private LoadTeamsFromMetaYaml() { return new Promise((resolve, reject) => { - console.log((performance.now()/1000).toFixed(3) + 's: LoadTeamsFromMetaYaml Fetch'); + console.log(`${this.perfNow()}s: LoadTeamsFromMetaYaml Fetch`); this.yaml.setURI('./assets/YAML/meta.yaml'); this.yaml.getJson().subscribe(data => { - console.log((performance.now()/1000).toFixed(3) + 's: LoadTeamsFromMetaYaml Downloaded'); + console.log(`${this.perfNow()}s: LoadTeamsFromMetaYaml Downloaded`); this.YamlObject = data; this.teamList = this.YamlObject['teams']; this.teamGroups = this.YamlObject['teamGroups']; this.teamVisible = [...this.teamList]; - console.log((performance.now()/1000).toFixed(3) + 's: LoadTeamsFromMetaYaml End'); + console.log(`${this.perfNow()}s: LoadTeamsFromMetaYaml End`); resolve(); // Resolve the promise, and allow the next Load to run }); }); @@ -251,11 +255,11 @@ export class CircularHeatmapComponent implements OnInit { private LoadMaturityLevels() { return new Promise((resolve, reject) => { - console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityLevels Fetch'); + console.log(`${this.perfNow()}s: LoadMaturityLevels Fetch`); this.yaml.setURI('./assets/YAML/meta.yaml'); // Function sets column header - this.yaml.getJson().subscribe(data => { - console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityLevels Downloaded'); + this.yaml.getJson().subscribe(data => { + console.log(`${this.perfNow()}s: LoadMaturityLevels Downloaded`); this.YamlObject = data; // Levels header @@ -264,9 +268,9 @@ export class CircularHeatmapComponent implements OnInit { this.radial_labels.push('Level ' + y); this.maxLevelOfActivities = y; } - console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityLevels End'); + console.log(`${this.perfNow()}s: LoadMaturityLevels End`); resolve(); // Resolve the promise, and allow the next Load to run - }); + }); }); } @@ -418,7 +422,7 @@ export class CircularHeatmapComponent implements OnInit { .append('svg') .attr('width', '60%') // 70% forces the heatmap down .attr('height', 'auto') - .attr('viewBox', '0 0 1150 1150') + .attr('viewBox', '0 0 1150 1150') .append('g') .attr( 'transform', @@ -838,4 +842,8 @@ export class CircularHeatmapComponent implements OnInit { return JSON.parse(content); } } + + perfNow(): string { + return (performance.now()/1000).toFixed(3); + } } From 3d32dbd2009f0cfc560cded9c221a9e3a521541c Mon Sep 17 00:00:00 2001 From: Vegard Bakke Date: Thu, 28 Nov 2024 22:30:58 +0100 Subject: [PATCH 5/5] More linting --- .../circular-heatmap.component.ts | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/app/component/circular-heatmap/circular-heatmap.component.ts b/src/app/component/circular-heatmap/circular-heatmap.component.ts index 9e87ab1b4..2f848ed61 100644 --- a/src/app/component/circular-heatmap/circular-heatmap.component.ts +++ b/src/app/component/circular-heatmap/circular-heatmap.component.ts @@ -78,11 +78,15 @@ export class CircularHeatmapComponent implements OnInit { private LoadMaturityDataFromGeneratedYaml() { return new Promise((resolve, reject) => { - console.log(`${this.perfNow()}s: LoadMaturityDataFromGeneratedYaml Fetch`); + console.log( + `${this.perfNow()}s: LoadMaturityDataFromGeneratedYaml Fetch` + ); this.yaml.setURI('./assets/YAML/generated/generated.yaml'); this.yaml.getJson().subscribe(data => { - console.log(`${this.perfNow()}s: LoadMaturityDataFromGeneratedYaml Downloaded`); + console.log( + `${this.perfNow()}s: LoadMaturityDataFromGeneratedYaml Downloaded` + ); this.YamlObject = data; var allDimensionNames = Object.keys(this.YamlObject); var totalTeamsImplemented: number = 0; @@ -118,7 +122,7 @@ export class CircularHeatmapComponent implements OnInit { ][allActivityInThisSubDimension[a]]['level']; if (lvlOfCurrentActivity == l + 1) { - var nameOfActivity: string = + var nameOfActivity: string = allActivityInThisSubDimension[a]; var teamStatus: { [key: string]: boolean } = {}; const teams = this.teamList; @@ -200,7 +204,9 @@ export class CircularHeatmapComponent implements OnInit { this.segment_labels ); this.noActivitytoGrey(); - console.log(`${this.perfNow()}s: LoadMaturityDataFromGeneratedYaml End`); + console.log( + `${this.perfNow()}s: LoadMaturityDataFromGeneratedYaml End` + ); resolve(); }); }); @@ -240,15 +246,15 @@ export class CircularHeatmapComponent implements OnInit { return new Promise((resolve, reject) => { console.log(`${this.perfNow()}s: LoadTeamsFromMetaYaml Fetch`); this.yaml.setURI('./assets/YAML/meta.yaml'); - this.yaml.getJson().subscribe(data => { - console.log(`${this.perfNow()}s: LoadTeamsFromMetaYaml Downloaded`); + this.yaml.getJson().subscribe(data => { + console.log(`${this.perfNow()}s: LoadTeamsFromMetaYaml Downloaded`); this.YamlObject = data; this.teamList = this.YamlObject['teams']; this.teamGroups = this.YamlObject['teamGroups']; this.teamVisible = [...this.teamList]; console.log(`${this.perfNow()}s: LoadTeamsFromMetaYaml End`); - resolve(); // Resolve the promise, and allow the next Load to run + resolve(); }); }); } @@ -269,7 +275,7 @@ export class CircularHeatmapComponent implements OnInit { this.maxLevelOfActivities = y; } console.log(`${this.perfNow()}s: LoadMaturityLevels End`); - resolve(); // Resolve the promise, and allow the next Load to run + resolve(); }); }); } @@ -844,6 +850,6 @@ export class CircularHeatmapComponent implements OnInit { } perfNow(): string { - return (performance.now()/1000).toFixed(3); + return (performance.now() / 1000).toFixed(3); } }