Skip to content

Commit 2246ca0

Browse files
committed
Add deliberate delays to emulate what happens when the files arrive in unexpected order
1 parent b2b6132 commit 2246ca0

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

src/app/component/circular-heatmap/circular-heatmap.component.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,11 @@ export class CircularHeatmapComponent implements OnInit {
7575
matChipsArray: MatChip[] = [];
7676

7777
private LoadMaturityDataFromGeneratedYaml() {
78+
console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityDataFromGeneratedYaml Fetch');
7879
this.yaml.setURI('./assets/YAML/generated/generated.yaml');
7980

8081
this.yaml.getJson().subscribe(data => {
82+
console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityDataFromGeneratedYaml Downloaded');
8183
this.YamlObject = data;
8284
var allDimensionNames = Object.keys(this.YamlObject);
8385
var totalTeamsImplemented: number = 0;
@@ -191,6 +193,8 @@ export class CircularHeatmapComponent implements OnInit {
191193
this.segment_labels
192194
);
193195
this.noActivitytoGrey();
196+
console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityDataFromGeneratedYaml End');
197+
194198
});
195199
}
196200

@@ -225,20 +229,25 @@ export class CircularHeatmapComponent implements OnInit {
225229
}
226230

227231
private LoadTeamsFromMetaYaml() {
232+
console.log((performance.now()/1000).toFixed(3) + 's: LoadTeamsFromMetaYaml Fetch');
228233
this.yaml.setURI('./assets/YAML/meta.yaml');
229-
this.yaml.getJson().subscribe(data => {
234+
this.yaml.getJson().subscribe(data => { setTimeout((data) => {
235+
console.log((performance.now()/1000).toFixed(3) + 's: LoadTeamsFromMetaYaml Downloaded');
230236
this.YamlObject = data;
231237

232238
this.teamList = this.YamlObject['teams'];
233239
this.teamGroups = this.YamlObject['teamGroups'];
234240
this.teamVisible = [...this.teamList];
235-
});
241+
console.log((performance.now()/1000).toFixed(3) + 's: LoadTeamsFromMetaYaml End');
242+
}, 500, data)}); // Delay Teams by half a second
236243
}
237244

238245
private LoadMaturityLevels() {
246+
console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityLevels Fetch');
239247
this.yaml.setURI('./assets/YAML/meta.yaml');
240248
// Function sets column header
241-
this.yaml.getJson().subscribe(data => {
249+
this.yaml.getJson().subscribe(data => { setTimeout((data) => {
250+
console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityLevels Downloaded');
242251
this.YamlObject = data;
243252

244253
// Levels header
@@ -247,7 +256,8 @@ export class CircularHeatmapComponent implements OnInit {
247256
this.radial_labels.push('Level ' + y);
248257
this.maxLevelOfActivities = y;
249258
}
250-
});
259+
console.log((performance.now()/1000).toFixed(3) + 's: LoadMaturityLevels End');
260+
}, 700, data)}); // Delay meta data even more than half a second. This order may happen on flaky network
251261
}
252262

253263
toggleTeamGroupSelection(chip: MatChip) {
@@ -702,11 +712,8 @@ export class CircularHeatmapComponent implements OnInit {
702712
}
703713

704714
noActivitytoGrey(): void {
705-
console.log(this.ALL_CARD_DATA);
706715
for (var x = 0; x < this.ALL_CARD_DATA.length; x++) {
707716
if (this.ALL_CARD_DATA[x]['Done%'] == -1) {
708-
console.log(this.ALL_CARD_DATA[x]['SubDimension']);
709-
console.log(this.ALL_CARD_DATA[x]['Level']);
710717
d3.selectAll(
711718
'#segment-' +
712719
this.ALL_CARD_DATA[x]['SubDimension'].replace(/ /g, '-') +

0 commit comments

Comments
 (0)