Skip to content

Commit e3fb8cb

Browse files
committed
fixed :comments and added new terminology section in settings page
1 parent 6d800a9 commit e3fb8cb

9 files changed

Lines changed: 481 additions & 70 deletions

File tree

src/app/model/meta-store.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@ import { ProgressDefinitions, TeamNames, TeamGroups } from './types';
44
import { perfNow } from 'src/app/util/util';
55

66
export interface MetaStrings {
7+
team: string;
8+
group: string;
79
allTeamsGroupName: string;
810
labels: string[];
911
maturityLevels: string[];
1012
knowledgeLabels: string[];
1113
}
1214
const fallbackMetaStrings: MetaStrings = {
15+
team: 'Team',
16+
group: 'Group',
1317
allTeamsGroupName: 'All',
1418
maturityLevels: ['Level 1', 'Level 2'],
1519
labels: ['Easy', 'Medium', 'Hard'],

src/app/pages/settings/settings.component.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,31 @@ mat-icon.mandatory-icon {
248248
margin-left: 0.5rem;
249249
font-weight: 500;
250250
}
251+
252+
/* Terminology section */
253+
.terminology-section {
254+
margin-top: 1rem;
255+
}
256+
257+
.terminology-description {
258+
color: #666;
259+
font-size: 0.9em;
260+
margin-bottom: 1em;
261+
}
262+
263+
.terminology-grid {
264+
display: flex;
265+
flex-direction: column;
266+
gap: 0.5em;
267+
}
268+
269+
.terminology-row {
270+
display: flex;
271+
gap: 16px;
272+
flex-wrap: wrap;
273+
}
274+
275+
.terminology-row mat-form-field {
276+
flex: 1;
277+
min-width: 180px;
278+
}

src/app/pages/settings/settings.component.html

Lines changed: 50 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,30 +35,6 @@
3535
</div>
3636
</mat-card-content>
3737

38-
<mat-card-content>
39-
<div
40-
class="terminology-container"
41-
style="display: flex; gap: 16px; flex-wrap: wrap; margin-top: 16px">
42-
<mat-form-field appearance="fill">
43-
<mat-label>Custom Team Terminology</mat-label>
44-
<input
45-
matInput
46-
placeholder="e.g. App"
47-
name="customTeamLabel"
48-
[(ngModel)]="customTeamLabel"
49-
(ngModelChange)="onTeamLabelChange()" />
50-
</mat-form-field>
51-
<mat-form-field appearance="fill">
52-
<mat-label>Custom Group Terminology</mat-label>
53-
<input
54-
matInput
55-
placeholder="e.g. Portfolio"
56-
name="customGroupLabel"
57-
[(ngModel)]="customGroupLabel"
58-
(ngModelChange)="onGroupLabelChange()" />
59-
</mat-form-field>
60-
</div>
61-
</mat-card-content>
6238
</mat-card>
6339

6440
<mat-card class="progress-definitions-section">
@@ -181,6 +157,56 @@ <h2>Progress Definitions</h2>
181157
</div>
182158
</div>
183159
</mat-card>
160+
161+
<mat-card class="terminology-section">
162+
<h2>Terminology</h2>
163+
<p class="terminology-description">
164+
Customize the terminology to how you organize your "teams" and how you group them
165+
(e.g. 'Apps' and 'Portfolios').
166+
</p>
167+
<div class="terminology-grid">
168+
<div class="terminology-row">
169+
<mat-form-field appearance="fill">
170+
<mat-label>Team (singular)</mat-label>
171+
<input
172+
matInput
173+
placeholder="e.g. App"
174+
name="customTeamLabel"
175+
[(ngModel)]="customTeamLabel"
176+
(ngModelChange)="onTeamLabelChange()" />
177+
</mat-form-field>
178+
<mat-form-field appearance="fill">
179+
<mat-label>Team (plural)</mat-label>
180+
<input
181+
matInput
182+
[placeholder]="getTeamPluralPlaceholder()"
183+
name="customTeamLabelPlural"
184+
[(ngModel)]="customTeamLabelPlural"
185+
(ngModelChange)="onTeamLabelPluralChange()" />
186+
</mat-form-field>
187+
</div>
188+
<div class="terminology-row">
189+
<mat-form-field appearance="fill">
190+
<mat-label>Group (singular)</mat-label>
191+
<input
192+
matInput
193+
placeholder="e.g. Portfolio"
194+
name="customGroupLabel"
195+
[(ngModel)]="customGroupLabel"
196+
(ngModelChange)="onGroupLabelChange()" />
197+
</mat-form-field>
198+
<mat-form-field appearance="fill">
199+
<mat-label>Group (plural)</mat-label>
200+
<input
201+
matInput
202+
[placeholder]="getGroupPluralPlaceholder()"
203+
name="customGroupLabelPlural"
204+
[(ngModel)]="customGroupLabelPlural"
205+
(ngModelChange)="onGroupLabelPluralChange()" />
206+
</mat-form-field>
207+
</div>
208+
</div>
209+
</mat-card>
184210
<mat-card class="settings-about-section">
185211
<h2>About the DSOMM Model</h2>
186212
<div class="card-content">

src/app/pages/settings/settings.component.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,17 @@ describe('SettingsComponent', () => {
4444
'getDateFormat',
4545
'setDateFormat',
4646
'getTeamLabel',
47+
'getTeamLabelPlural',
4748
'getGroupLabel',
49+
'getGroupLabelPlural',
50+
'setTeamLabel',
51+
'setGroupLabel',
52+
'initFromMeta',
4853
]);
4954
settingsService.getTeamLabel.and.returnValue('Team');
55+
settingsService.getTeamLabelPlural.and.returnValue('Teams');
5056
settingsService.getGroupLabel.and.returnValue('Group');
57+
settingsService.getGroupLabelPlural.and.returnValue('Groups');
5158
modalComponent = jasmine.createSpyObj('ModalMessageComponent', ['openDialog']);
5259

5360
await TestBed.configureTestingModule({

src/app/pages/settings/settings.component.ts

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, OnInit } from '@angular/core';
22
import { FormBuilder, FormGroup, FormArray, AbstractControl } from '@angular/forms';
3-
import { SettingsService } from '../../service/settings/settings.service';
3+
import { SettingsService, LabelParts } from '../../service/settings/settings.service';
44
import { GithubService, GithubReleaseInfo } from 'src/app/service/settings/github.service';
55
import { LoaderService } from 'src/app/service/loader/data-loader.service';
66
import { DataStore } from 'src/app/model/data-store';
@@ -62,7 +62,9 @@ export class SettingsComponent implements OnInit {
6262
selectedDateFormat: string = this.BROWSER_LOCALE;
6363

6464
customTeamLabel: string = 'Team';
65+
customTeamLabelPlural: string = '';
6566
customGroupLabel: string = 'Group';
67+
customGroupLabelPlural: string = '';
6668

6769
// GitHub release check state
6870
checkingLatest: boolean = false;
@@ -149,7 +151,9 @@ export class SettingsComponent implements OnInit {
149151
initialize(): void {
150152
this.selectedDateFormat = this.settings.getDateFormat() || this.BROWSER_LOCALE;
151153
this.customTeamLabel = this.settings.getTeamLabel();
154+
this.customTeamLabelPlural = this.settings.getTeamLabelPlural();
152155
this.customGroupLabel = this.settings.getGroupLabel();
156+
this.customGroupLabelPlural = this.settings.getGroupLabelPlural();
153157

154158
// Init dates
155159
let date: Date = new Date();
@@ -185,11 +189,35 @@ export class SettingsComponent implements OnInit {
185189
}
186190

187191
onTeamLabelChange(): void {
188-
this.settings.setTeamLabel(this.customTeamLabel);
192+
this.settings.setTeamLabel(this.customTeamLabel, this.customTeamLabelPlural);
193+
// Update plural placeholder when singular changes
194+
if (!this.customTeamLabelPlural || this.customTeamLabelPlural === this.customTeamLabel + 's') {
195+
this.customTeamLabelPlural = '';
196+
}
197+
}
198+
199+
onTeamLabelPluralChange(): void {
200+
this.settings.setTeamLabel(this.customTeamLabel, this.customTeamLabelPlural);
189201
}
190202

191203
onGroupLabelChange(): void {
192-
this.settings.setGroupLabel(this.customGroupLabel);
204+
this.settings.setGroupLabel(this.customGroupLabel, this.customGroupLabelPlural);
205+
// Update plural placeholder when singular changes
206+
if (!this.customGroupLabelPlural || this.customGroupLabelPlural === this.customGroupLabel + 's') {
207+
this.customGroupLabelPlural = '';
208+
}
209+
}
210+
211+
onGroupLabelPluralChange(): void {
212+
this.settings.setGroupLabel(this.customGroupLabel, this.customGroupLabelPlural);
213+
}
214+
215+
getTeamPluralPlaceholder(): string {
216+
return (this.customTeamLabel || 'Team') + 's';
217+
}
218+
219+
getGroupPluralPlaceholder(): string {
220+
return (this.customGroupLabel || 'Group') + 's';
193221
}
194222

195223
onMaxLevelChange(value: number | null): void {

src/app/service/loader/data-loader.service.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
} from 'src/app/model/activity-store';
1414
import { DataStore } from 'src/app/model/data-store';
1515
import { NotificationService } from '../notification.service';
16+
import { SettingsService } from '../settings/settings.service';
1617

1718
export class DataValidationError extends Error {
1819
constructor(message: string) {
@@ -38,7 +39,8 @@ export class LoaderService {
3839
constructor(
3940
private yamlService: YamlService,
4041
private githubService: GithubService,
41-
private notificationService: NotificationService
42+
private notificationService: NotificationService,
43+
private settingsService: SettingsService
4244
) {
4345
this.DSOMM_MODEL_URL = this.githubService.getDsommModelUrl() + '/tree/main/generated';
4446
}
@@ -62,6 +64,9 @@ export class LoaderService {
6264
this.dataStore.meta = await this.loadMeta();
6365
this.dataStore.progressStore?.init(this.dataStore.meta.progressDefinition);
6466

67+
// Initialize SettingsService with meta.yaml defaults for team/group terminology
68+
this.settingsService.initFromMeta(this.dataStore.getMetaStrings());
69+
6570
// Then load activities
6671
this.dataStore.addActivities(await this.loadActivities(this.dataStore.meta));
6772

0 commit comments

Comments
 (0)