Skip to content

Commit 3aef850

Browse files
authored
Merge pull request #231 from ptechofficial/master
Activity Tags feature completed
2 parents a6ebcb3 + e35a0c8 commit 3aef850

File tree

10 files changed

+335
-126
lines changed

10 files changed

+335
-126
lines changed

package-lock.json

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717
"@angular/compiler": "^13.0.0",
1818
"@angular/core": "^13.0.0",
1919
"@angular/forms": "^13.0.0",
20+
"@angular/localize": "^13.0.0",
2021
"@angular/material": "^13.0.0",
2122
"@angular/platform-browser": "^13.0.0",
2223
"@angular/platform-browser-dynamic": "^13.0.0",
2324
"@angular/router": "^13.0.0",
24-
"@angular/localize": "^13.0.0",
25+
"@ngneat/until-destroy": "^10.0.0-beta.0",
2526
"d3": "^7.5.0",
2627
"js-yaml": "^4.1.0",
2728
"markdown-it": "^13.0.1",

src/app/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NgModule } from '@angular/core';
1+
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
22
import { BrowserModule } from '@angular/platform-browser';
33
import { ReactiveFormsModule } from '@angular/forms';
44

src/app/component/matrix/matrix.component.css

Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,57 @@
1-
.content{
2-
width: 100%;
3-
/*background-color: gainsboro;*/
4-
}
5-
.mat-form-field{
6-
margin: 20px;
7-
width: 90%;
8-
}
1+
.content {
2+
width: 100%;
3+
/*background-color: gainsboro;*/
4+
}
5+
.mat-form-field {
6+
margin: 20px;
7+
margin-bottom: 0;
8+
width: 90%;
9+
}
910

10-
.matrix-table{
11-
margin: 20px;
11+
.matrix-table {
12+
margin: 20px;
1213
}
1314

14-
.mat-cell{
15-
padding: 20px;
16-
width: 12.5%;
17-
max-width: 17%;
18-
word-wrap: break-word;
15+
.mat-cell {
16+
padding: 20px;
17+
/* padding-bottom: 0; */
18+
width: 12.5%;
19+
max-width: 17%;
20+
word-wrap: break-word;
1921
}
2022

21-
.mat-header-cell{
22-
padding: 10px;
23-
width: 12.5%;
24-
max-width: 17%;
25-
word-wrap: break-word;
26-
font-size: 16px;
27-
font-weight: bold;
23+
.mat-header-cell {
24+
padding: 10px;
25+
width: 12.5%;
26+
max-width: 17%;
27+
word-wrap: break-word;
28+
font-size: 16px;
29+
font-weight: bold;
2830
}
2931

30-
.table-small-width{
31-
width: 5%;
32-
max-width: 9%;
32+
.table-small-width {
33+
width: 5%;
34+
max-width: 9%;
3335
}
3436

35-
button{
36-
background-color: white;
37-
border: none;
38-
text-align: left;
39-
cursor:pointer;
37+
button {
38+
background-color: white;
39+
border: none;
40+
text-align: left;
41+
cursor: pointer;
42+
}
43+
44+
.tags-task {
45+
font-weight: 800;
46+
font-style: italic;
47+
color: rgb(0, 113, 151);
48+
font-size: 12px;
49+
}
50+
.reset-button {
51+
background-color: #66bb6a;
52+
display: block;
53+
margin: 0 20px;
54+
padding: 7px 12px;
55+
border-radius: 16px;
56+
font: 500 14px / 20px Roboto, 'Helvetica Neue', sans-serif;
4057
}
41-

src/app/component/matrix/matrix.component.html

Lines changed: 49 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
<div class="content">
22
<app-top-header section="Matrix"></app-top-header>
3-
<mat-form-field class="example-chip-list">
4-
<mat-label>Filter</mat-label>
5-
<mat-chip-list #chipList aria-label="Filter" color="primary">
3+
<mat-form-field class="activity-chip-list">
4+
<mat-label>SubDimension Filter</mat-label>
5+
<mat-chip-list #chipList selectable multiple>
66
<mat-chip
7-
color="primary"
8-
*ngFor="let row of rowsCurrentlyBeingShown"
9-
(removed)="remove(row)"
10-
[selected]="true">
11-
{{ row }}
12-
<button matChipRemove>
13-
<mat-icon>cancel</mat-icon>
14-
</button>
7+
#c="matChip"
8+
*ngFor="let subDimension of listSubDimension"
9+
(click)="toggleSubDimensionSelection(c)"
10+
[value]="subDimension"
11+
selected>
12+
{{ subDimension }}
1513
</mat-chip>
16-
<input
17-
#rowInput
18-
[formControl]="rowCtrl"
19-
[matAutocomplete]="auto"
20-
[matChipInputFor]="chipList"
21-
[matChipInputSeparatorKeyCodes]="separatorKeysCodes" />
2214
</mat-chip-list>
23-
<mat-autocomplete
24-
#auto="matAutocomplete"
25-
(optionSelected)="selected($event)">
26-
<mat-option *ngFor="let row of filteredRows | async" [value]="row">
27-
{{ row }}
28-
</mat-option>
29-
</mat-autocomplete>
3015
</mat-form-field>
16+
<mat-form-field class="activity-chip-list">
17+
<mat-label>Activity Tag Filter</mat-label>
18+
<mat-chip-list selectable multiple>
19+
<mat-chip
20+
#c="matChip"
21+
*ngFor="let tag of listTags"
22+
(click)="toggleTagSelection(c)"
23+
[value]="tag"
24+
selected>
25+
{{ tag }}
26+
</mat-chip>
27+
</mat-chip-list>
28+
</mat-form-field>
29+
30+
<button class="reset-button" (click)="reload()">RESET</button>
3131

3232
<table
3333
mat-table
@@ -64,6 +64,7 @@
6464
<ul>
6565
<li *ngFor="let task of element[lvl]; index as j">
6666
<button
67+
style="margin-bottom: 1em"
6768
(click)="
6869
navigate(element.Dimension, element.SubDimension, i + 1, task)
6970
">
@@ -76,11 +77,33 @@
7677
else elseBlock
7778
"></div>
7879
<ng-template #thenBlock>
79-
<p style="color: green">{{ task }}</p>
80+
<p style="color: green; margin: 0">{{ task }}</p>
8081
</ng-template>
8182
<ng-template #elseBlock>
82-
<p>{{ task }}</p>
83+
<p style="margin: 0">{{ task }}</p>
8384
</ng-template>
85+
<span class="tags-task">
86+
[
87+
<span
88+
*ngFor="
89+
let tag of YamlObject[element.Dimension][
90+
element.SubDimension
91+
][task].tags;
92+
let i = index
93+
">
94+
{{ tag }}
95+
<span
96+
*ngIf="
97+
i + 1 <
98+
YamlObject[element.Dimension][element.SubDimension][
99+
task
100+
].tags.length
101+
">
102+
,
103+
</span>
104+
</span>
105+
]
106+
</span>
84107
</button>
85108
</li>
86109
</ul>

src/app/component/matrix/matrix.component.spec.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { HttpClientModule, HttpHandler } from '@angular/common/http';
22
import { HttpClientTestingModule } from '@angular/common/http/testing';
33
import { ComponentFixture, TestBed } from '@angular/core/testing';
4-
import { MatAutocomplete } from '@angular/material/autocomplete';
4+
// import { MatAutocomplete } from '@angular/material/autocomplete';
55
import { RouterTestingModule } from '@angular/router/testing';
66
import { ymlService } from 'src/app/service/yaml-parser/yaml-parser.service';
77
import { MatrixComponent } from './matrix.component';
8+
import { MatChip } from '@angular/material/chips';
89

910
describe('MatrixComponent', () => {
1011
let component: MatrixComponent;
@@ -14,7 +15,7 @@ describe('MatrixComponent', () => {
1415
await TestBed.configureTestingModule({
1516
providers: [ymlService, HttpClientTestingModule],
1617
imports: [RouterTestingModule, HttpClientModule],
17-
declarations: [MatrixComponent, MatAutocomplete],
18+
declarations: [MatrixComponent, MatChip],
1819
}).compileComponents();
1920
});
2021

@@ -36,10 +37,13 @@ describe('MatrixComponent', () => {
3637
});
3738

3839
it('check for chip deletion', () => {
39-
component.rowsCurrentlyBeingShown = ['row1', 'row2'];
40-
component.remove('row1');
40+
component.listSubDimension = ['row1', 'row2'];
41+
component.currentSubDimensions = ['row2'];
42+
component.listTags = ['row1', 'row2'];
43+
component.currentTags = ['row2'];
4144
const newChipRow = ['row2'];
4245
fixture.detectChanges();
43-
expect(component.rowsCurrentlyBeingShown).toEqual(newChipRow);
46+
expect(component.currentSubDimensions).toEqual(newChipRow);
47+
expect(component.currentTags).toEqual(newChipRow);
4448
});
4549
});

0 commit comments

Comments
 (0)