Skip to content

Commit a416f31

Browse files
committed
Dependency: Swap uuids with activity names
1 parent e8d7bb2 commit a416f31

3 files changed

Lines changed: 22 additions & 4 deletions

File tree

src/app/model/activity-store.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ const baseYaml: any = {
139139
uuid: '00000000-1111-1111-2222-000000000000',
140140
level: 1,
141141
description: 'Description from base yaml',
142+
dependsOn: ['Activity 111', '00000000-1111-2222-1111-000000000000'],
142143
},
143144
},
144145
'Dimension 12': {

src/app/model/activity-store.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { appendHashElement } from '../util/ArrayHash';
22
import { IgnoreList } from './ignore-list';
3-
import { Progress } from './types';
43
import { MarkdownText } from './markdown-text';
54

65
export type Data = Record<string, Category>;
@@ -55,6 +54,8 @@ export interface DifficultyOfImplementation {
5554
resources: number;
5655
}
5756

57+
const UUID = /([0-9a-f]{6,}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{6,})/i;
58+
5859
export class ActivityStore {
5960
public data: Data = {};
6061
private _activityList: Activity[] = [];
@@ -122,6 +123,7 @@ export class ActivityStore {
122123
this._activityByName = {};
123124
this._activityByUuid = {};
124125
this.buildLookups(this._activityList, this._activityByName, this._activityByUuid, errors);
126+
this.replaceDependsOnUUids(this._activityList, this._activityByUuid);
125127
}
126128
this.buildDataHierarchy(this._activityList);
127129
this.buildDimensionList(this._activityList);
@@ -246,6 +248,23 @@ export class ActivityStore {
246248
}
247249
}
248250

251+
/**
252+
* Substitute dependsOn UUIDs with activity names
253+
*/
254+
replaceDependsOnUUids(activityList: Activity[], activityByUuid: Record<string, Activity>) {
255+
for (let activity of activityList) {
256+
if (activity.dependsOn && activity.dependsOn.length > 0) {
257+
for (let i = 0; i < activity.dependsOn.length; i++) {
258+
if (activity.dependsOn[i].match(UUID)) {
259+
if (activityByUuid.hasOwnProperty(activity.dependsOn[i])) {
260+
activity.dependsOn[i] = activityByUuid[activity.dependsOn[i]].name;
261+
}
262+
}
263+
}
264+
}
265+
}
266+
}
267+
249268
addActivityLookup(
250269
activity: Activity,
251270
activityByName: Record<string, Activity>,

src/assets/Markdown Files/TODO-v4.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
## Doing
22
### Dependency graph
33

4-
- Heatmap: Handle dependsOn uuid (example)
5-
- http://localhost:4200/activity-description?uuid=13e9757e-58e2-4277-bc0f-eadc674891e6
6-
74
- Dependency graph: Make connecting nodes clickable
85
- Heatmap: Add #uuid to URL
96

@@ -74,6 +71,7 @@
7471
- Meta.yaml: Allow admins to customize the terms 'Team' and 'Group' (e.g. to 'App' and 'Portfolio')
7572

7673
# Done
74+
- Dependency: Handle dependsOn uuid, not just name
7775
- Matrix: Dependency graph: Render in center of page
7876
- Dependency graph: Add to CircularHeatmap Details
7977
- Dependency graph: Support dark mode

0 commit comments

Comments
 (0)