Skip to content

Commit 7502fd9

Browse files
committed
Merge branch 'feat/central-loader-heatmap' into experiment
2 parents 8d84b3f + 7d0147f commit 7502fd9

31 files changed

Lines changed: 1140 additions & 917 deletions

.prettierrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
"arrowParens": "avoid",
88
"trailingComma": "es5",
99
"bracketSameLine": true,
10-
"printWidth": 80,
10+
"printWidth": 120,
1111
"endOfLine": "auto"
1212
}

TODO-central-loader.md

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,47 @@
11
# ToDo
22

3+
34
## Doing
5+
- Load TeamProgress yaml
6+
- Store teamProgress as part of activityStore under each activity
7+
- How to deal with deleted progress??? (Do later)
8+
- Refactor Circular Heatmap
9+
- Update progress (when slider is moved) when new sector is selected
10+
- show progress for each activity on the slider
11+
- update progress for each activity in the sector, on teams change
412

513
## Next
6-
- Filter: tags: Fix update on SPACE key
7-
- Show Latest info i activity-description modal view
14+
- Load TeamProgress yaml
15+
- Store in localStorage
16+
- Handle boolean for backwards compatibility
17+
- Merge localStorage and YAML
18+
- Progress Slider
19+
- Data model, contains date, so warning about downgrade can show date
20+
- Handle when previous value does not have a date (backwards compatibility)
21+
- Catch close to save new progresses
22+
- Store TeamProgress to localStorage
23+
- Load localStorage TeamProgress
24+
- Export TeamProgress yaml
25+
- Filters
26+
- filter teams
27+
- filter none => all
28+
829

930

1031
## Later
11-
- Make sure loader.load() only runs once (even with navigations)
12-
- Load TeamProgress yaml
32+
- Add validation for meta.yaml, progress step: include 0% and 100%, and increacing values
33+
- Merge in experiment's way of generating circ heat
34+
- Fix dependsOn that is uuid (e.g. 83057028-0b77-4d2e-8135-40969768ae88)
1335
- Sort linear list of activities (sorted by level, dim)
14-
- Substitute Circular Heatmap
15-
- Store TeamProgress
16-
- Load localStorage TeamProgress
1736
- Move META_FILE constant from data service to main app
18-
19-
- Substitute Activity Detail
37+
- Filter: tags: Fix update on SPACE key (trouble)
2038

2139
# Done
40+
- Load YAML progress
41+
- Navigate to activity-description without site reload
42+
- Refactor Dependecy graph
43+
- Refactor activity-description
44+
- Make sure loader.load() only runs once (even with navigations)
2245
- Handle parsing errors, like Circular Heatmap
2346
- Filter: Make filters for subdimensions
2447
- Matrix: toggle chips

src/app/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { DependencyGraphComponent } from './component/dependency-graph/dependenc
2424
import { TeamsComponent } from './component/teams/teams.component';
2525
import { ToStringValuePipe } from './pipe/to-string-value.pipe';
2626
import { ModalMessageComponent } from './component/modal-message/modal-message.component';
27+
import { ProgressSliderComponent } from './component/progress-slider/progress-slider.component';
2728
import {
2829
MatDialogModule,
2930
MAT_DIALOG_DATA,
@@ -48,6 +49,7 @@ import {
4849
ToStringValuePipe,
4950
UserdayComponent,
5051
ModalMessageComponent,
52+
ProgressSliderComponent,
5153
],
5254
imports: [
5355
BrowserModule,

src/app/component/activity-description/activity-description.component.html

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="content-box">
22
<h1>
3-
{{ currentActivity.dimension }} -> {{ currentActivity.subDimension }}:
4-
{{ currentActivity.activityName }}
3+
{{ currentActivity.category }} -> {{ currentActivity.dimension }}:
4+
{{ currentActivity.name }}
55
</h1>
66

77
<div class="example-action-buttons">
@@ -52,9 +52,7 @@ <h1>
5252
<b>Implementation Guide</b>
5353
</mat-panel-title>
5454
</mat-expansion-panel-header>
55-
<p
56-
id="implementatonGuide"
57-
[innerHTML]="currentActivity.implementatonGuide"></p>
55+
<p id="implementatonGuide" [innerHTML]="currentActivity.implementatonGuide"></p>
5856
</mat-expansion-panel>
5957

6058
<mat-expansion-panel>
@@ -63,11 +61,9 @@ <h1>
6361
<b>Difficulty of Implementation</b>
6462
</mat-panel-title>
6563
</mat-expansion-panel-header>
66-
<p>
67-
Knowledge: {{ this.KnowledgeLabels[this.currentActivity.knowledge] }}
68-
</p>
69-
<p>Time: {{ this.GeneralLabels[this.currentActivity.time] }}</p>
70-
<p>Resources: {{ this.GeneralLabels[this.currentActivity.resources] }}</p>
64+
<p>Knowledge: {{ this.KnowledgeLabel }}</p>
65+
<p>Time: {{ this.TimeLabel }}</p>
66+
<p>Resources: {{ this.ResourceLabel }}</p>
7167
</mat-expansion-panel>
7268

7369
<mat-expansion-panel *ngIf="currentActivity.usefulness !== -1">
@@ -76,7 +72,7 @@ <h1>
7672
<b>Usefulness</b>
7773
</mat-panel-title>
7874
</mat-expansion-panel-header>
79-
<p>{{ this.GeneralLabels[this.currentActivity.usefulness] }}</p>
75+
<p>{{ this.UsefullnessLabel }}</p>
8076
</mat-expansion-panel>
8177

8278
<mat-expansion-panel>
@@ -86,9 +82,7 @@ <h1>
8682
</mat-panel-title>
8783
</mat-expansion-panel-header>
8884
<mat-accordion multi="true">
89-
<mat-expansion-panel
90-
id="teamsEvidence"
91-
*ngFor="let item of this.currentActivity.teamsEvidence | keyvalue">
85+
<mat-expansion-panel id="teamsEvidence" *ngFor="let item of this.currentActivity.teamsEvidence | keyvalue">
9286
<mat-expansion-panel-header>
9387
<mat-panel-title>
9488
<b [innerHTML]="item.key"></b>
@@ -116,8 +110,7 @@ <h1>
116110
</mat-expansion-panel-header>
117111
<p>
118112
<mat-accordion multi="true">
119-
<mat-expansion-panel
120-
*ngFor="let implement of this.currentActivity.implementation">
113+
<mat-expansion-panel *ngFor="let implement of this.currentActivity.implementation">
121114
<mat-expansion-panel-header>
122115
<mat-panel-title>
123116
<b [innerHTML]="implement['name']"></b>
@@ -220,12 +213,7 @@ <h1>
220213
<b>Implemented By</b>
221214
</mat-panel-title>
222215
</mat-expansion-panel-header>
223-
<div
224-
*ngIf="
225-
currentActivity.teamsImplemented;
226-
then thenBlock;
227-
else elseBlock
228-
"></div>
216+
<div *ngIf="currentActivity.teamsImplemented; then thenBlock; else elseBlock"></div>
229217
<ng-template #thenBlock>
230218
<ul class="teams-implemented-list">
231219
<li *ngFor="let item of currentActivity.teamsImplemented | keyvalue">
@@ -246,12 +234,9 @@ <h1>
246234
<b>Depends on</b>
247235
</mat-panel-title>
248236
</mat-expansion-panel-header>
249-
<app-dependency-graph
250-
dimension="{{ currentActivity.dimension }}"
251-
subDimension="{{ currentActivity.subDimension }}"
252-
activityName="{{
253-
currentActivity.activityName
254-
}}"></app-dependency-graph>
237+
<div *ngIf="currentActivity && currentActivity.name">
238+
<app-dependency-graph [activityName]="currentActivity.name"></app-dependency-graph>
239+
</div>
255240
</mat-expansion-panel>
256241

257242
<mat-expansion-panel>

src/app/component/activity-description/activity-description.component.spec.ts

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,29 @@ import { sample } from 'rxjs';
55
import { ymlService } from 'src/app/service/yaml-parser/yaml-parser.service';
66

77
import { ActivityDescriptionComponent } from './activity-description.component';
8+
import { LoaderService } from 'src/app/service/loader/data-loader.service';
9+
import { MockLoaderService } from 'src/app/service/loader/mock-data-loader.service';
10+
11+
let mockLoaderService: MockLoaderService;
812

913
describe('ActivityDescriptionComponent', () => {
1014
let component: ActivityDescriptionComponent;
1115
let fixture: ComponentFixture<ActivityDescriptionComponent>;
16+
mockLoaderService = new MockLoaderService({});
1217

18+
/* eslint-disable */
1319
beforeEach(async () => {
1420
await TestBed.configureTestingModule({
15-
providers: [ymlService, HttpClient, HttpHandler],
21+
providers: [
22+
HttpClient,
23+
HttpHandler,
24+
{ provide: LoaderService, useValue: mockLoaderService },
25+
],
1626
imports: [RouterTestingModule],
1727
declarations: [ActivityDescriptionComponent],
1828
}).compileComponents();
1929
});
30+
/* eslint-enable */
2031

2132
beforeEach(() => {
2233
fixture = TestBed.createComponent(ActivityDescriptionComponent);
@@ -31,8 +42,8 @@ describe('ActivityDescriptionComponent', () => {
3142
it('check if header is being generated', () => {
3243
const testDimension = 'Sample Dimension';
3344
const testSubDimension = 'Sample subDimension';
34-
component.currentActivity.dimension = testDimension;
35-
component.currentActivity.subDimension = testSubDimension;
45+
component.currentActivity.category = testDimension;
46+
component.currentActivity.dimension = testSubDimension;
3647
fixture.detectChanges();
3748
const HTMLElement: HTMLElement = fixture.nativeElement;
3849
const heading = HTMLElement.querySelector('h1')!;
@@ -54,11 +65,8 @@ describe('ActivityDescriptionComponent', () => {
5465
component.currentActivity.description = testDescription;
5566
fixture.detectChanges();
5667
const HTMLElement: HTMLElement = fixture.nativeElement;
57-
const contentDisplayedinParagraphTag =
58-
HTMLElement.querySelector('#description')!;
59-
expect(contentDisplayedinParagraphTag.textContent).toContain(
60-
testDescription
61-
);
68+
const contentDisplayedinParagraphTag = HTMLElement.querySelector('#description')!;
69+
expect(contentDisplayedinParagraphTag.textContent).toContain(testDescription);
6270
});
6371

6472
it('check if risk is being generated', () => {
@@ -75,8 +83,7 @@ describe('ActivityDescriptionComponent', () => {
7583
component.currentActivity.measure = testMeasure;
7684
fixture.detectChanges();
7785
const HTMLElement: HTMLElement = fixture.nativeElement;
78-
const contentDisplayedinParagraphTag =
79-
HTMLElement.querySelector('#measure')!;
86+
const contentDisplayedinParagraphTag = HTMLElement.querySelector('#measure')!;
8087
expect(contentDisplayedinParagraphTag.textContent).toContain(testMeasure);
8188
});
8289

@@ -85,12 +92,8 @@ describe('ActivityDescriptionComponent', () => {
8592
component.currentActivity.implementatonGuide = testImplementationGuide;
8693
fixture.detectChanges();
8794
const HTMLElement: HTMLElement = fixture.nativeElement;
88-
const contentDisplayedinParagraphTag = HTMLElement.querySelector(
89-
'#implementatonGuide'
90-
)!;
91-
expect(contentDisplayedinParagraphTag.textContent).toContain(
92-
testImplementationGuide
93-
);
95+
const contentDisplayedinParagraphTag = HTMLElement.querySelector('#implementatonGuide')!;
96+
expect(contentDisplayedinParagraphTag.textContent).toContain(testImplementationGuide);
9497
});
9598

9699
it('check if evidence is being generated', () => {
@@ -102,30 +105,24 @@ describe('ActivityDescriptionComponent', () => {
102105
console.log('parentElement', parentElement[1].textContent);
103106
const lengthOfObject = Object.keys(testEvidence).length;
104107
for (var i = 0; i > lengthOfObject; i++)
105-
expect(parentElement[i].textContent).toContain(
106-
Object.keys(testEvidence)[i] + Object.values(testEvidence)[i]
107-
);
108+
expect(parentElement[i].textContent).toContain(Object.keys(testEvidence)[i] + Object.values(testEvidence)[i]);
108109
});
109110

110111
it('check if assessment is being generated', () => {
111112
const testAssessment = 'Sample Assessment';
112113
component.currentActivity.assessment = testAssessment;
113114
fixture.detectChanges();
114115
const HTMLElement: HTMLElement = fixture.nativeElement;
115-
const contentDisplayedinParagraphTag =
116-
HTMLElement.querySelector('#assessment')!;
117-
expect(contentDisplayedinParagraphTag.textContent).toContain(
118-
testAssessment
119-
);
116+
const contentDisplayedinParagraphTag = HTMLElement.querySelector('#assessment')!;
117+
expect(contentDisplayedinParagraphTag.textContent).toContain(testAssessment);
120118
});
121119

122120
it('check if comments is being generated', () => {
123121
const testComments = 'Sample Comments';
124122
component.currentActivity.comments = testComments;
125123
fixture.detectChanges();
126124
const HTMLElement: HTMLElement = fixture.nativeElement;
127-
const contentDisplayedinParagraphTag =
128-
HTMLElement.querySelector('#comments')!;
125+
const contentDisplayedinParagraphTag = HTMLElement.querySelector('#comments')!;
129126
expect(contentDisplayedinParagraphTag.textContent).toContain(testComments);
130127
});
131128

@@ -142,8 +139,7 @@ describe('ActivityDescriptionComponent', () => {
142139

143140
fixture.detectChanges();
144141
const HTMLElement: HTMLElement = fixture.nativeElement;
145-
const contentDisplayedinParagraphTag =
146-
HTMLElement.querySelectorAll('#references')!;
142+
const contentDisplayedinParagraphTag = HTMLElement.querySelectorAll('#references')!;
147143

148144
expect(contentDisplayedinParagraphTag[0].textContent).toContain(
149145
component.SAMMVersion +
@@ -152,8 +148,7 @@ describe('ActivityDescriptionComponent', () => {
152148
testISO[0] +
153149
component.ISO22Version +
154150
testISO22[0] +
155-
component.openCREVersion +
156-
uuid
151+
component.openCREVersion
157152
);
158153
});
159154
});

0 commit comments

Comments
 (0)