@@ -61,9 +61,9 @@ export class SettingsComponent implements OnInit {
6161 ] ;
6262 selectedDateFormat : string = this . BROWSER_LOCALE ;
6363
64- customTeamLabel : string = 'Team ' ;
64+ customTeamLabel : string = '' ;
6565 customTeamLabelPlural : string = '' ;
66- customGroupLabel : string = 'Group ' ;
66+ customGroupLabel : string = '' ;
6767 customGroupLabelPlural : string = '' ;
6868
6969 // GitHub release check state
@@ -90,6 +90,7 @@ export class SettingsComponent implements OnInit {
9090 . then ( ( dataStore : DataStore ) => {
9191 this . setYamlData ( dataStore ) ;
9292 this . updateProgressDefinitionsForm ( ) ;
93+ this . initLabels ( ) ; // Re-read labels now that meta.yaml is loaded
9394 } )
9495 . catch ( err => {
9596 this . modal . openDialog ( new DialogInfo ( err . message , 'An error occurred' ) ) ;
@@ -150,19 +151,7 @@ export class SettingsComponent implements OnInit {
150151
151152 initialize ( ) : void {
152153 this . selectedDateFormat = this . settings . getDateFormat ( ) || this . BROWSER_LOCALE ;
153- this . customTeamLabel = this . settings . getTeamLabel ( ) ;
154- this . customTeamLabelPlural = this . settings . getTeamLabelPlural ( ) ;
155- this . customGroupLabel = this . settings . getGroupLabel ( ) ;
156- this . customGroupLabelPlural = this . settings . getGroupLabelPlural ( ) ;
157-
158- // If the plural is just the auto-generated default (singular + 's'),
159- // leave the field empty so the dynamic placeholder shows instead.
160- if ( this . customTeamLabelPlural === this . customTeamLabel + 's' ) {
161- this . customTeamLabelPlural = '' ;
162- }
163- if ( this . customGroupLabelPlural === this . customGroupLabel + 's' ) {
164- this . customGroupLabelPlural = '' ;
165- }
154+ this . initLabels ( ) ;
166155
167156 // Init dates
168157 let date : Date = new Date ( ) ;
@@ -176,6 +165,29 @@ export class SettingsComponent implements OnInit {
176165 }
177166 }
178167
168+ /**
169+ * Read current labels from the service into the component fields.
170+ * Called both on init and after meta.yaml loads.
171+ */
172+ initLabels ( ) : void {
173+ const teamLabel = this . settings . getTeamLabel ( ) ;
174+ const teamPlural = this . settings . getTeamLabelPlural ( ) ;
175+ const groupLabel = this . settings . getGroupLabel ( ) ;
176+ const groupPlural = this . settings . getGroupLabelPlural ( ) ;
177+
178+ // Show the value in the field only if it differs from the meta.yaml default.
179+ // Otherwise, leave the field empty and let the placeholder show the default.
180+ const metaTeam = this . settings . getMetaTeamLabel ( ) ;
181+ const metaGroup = this . settings . getMetaGroupLabel ( ) ;
182+
183+ this . customTeamLabel = teamLabel === metaTeam . singular ? '' : teamLabel ;
184+ this . customGroupLabel = groupLabel === metaGroup . singular ? '' : groupLabel ;
185+
186+ // For plural: show empty if it matches the auto-generated default (singular + 's')
187+ this . customTeamLabelPlural = teamPlural === teamLabel + 's' ? '' : teamPlural ;
188+ this . customGroupLabelPlural = groupPlural === groupLabel + 's' ? '' : groupPlural ;
189+ }
190+
179191 setYamlData ( dataStore : DataStore ) : void {
180192 this . dataStoreMaxLevel = dataStore . getMaxLevel ( ) ;
181193 this . selectedMaxLevel = this . settings . getMaxLevel ( ) || this . dataStoreMaxLevel ;
@@ -198,38 +210,49 @@ export class SettingsComponent implements OnInit {
198210 }
199211
200212 onTeamLabelChange ( ) : void {
201- this . settings . setTeamLabel ( this . customTeamLabel , this . customTeamLabelPlural ) ;
202- // Update plural placeholder when singular changes
203- if ( ! this . customTeamLabelPlural || this . customTeamLabelPlural === this . customTeamLabel + 's' ) {
213+ // If cleared, revert to meta.yaml default
214+ const effective = this . customTeamLabel || this . settings . getMetaTeamLabel ( ) . singular ;
215+ this . settings . setTeamLabel ( effective , this . customTeamLabelPlural ) ;
216+ // Clear plural so placeholder updates
217+ if ( ! this . customTeamLabelPlural || this . customTeamLabelPlural === effective + 's' ) {
204218 this . customTeamLabelPlural = '' ;
205219 }
206220 }
207221
208222 onTeamLabelPluralChange ( ) : void {
209- this . settings . setTeamLabel ( this . customTeamLabel , this . customTeamLabelPlural ) ;
223+ const effective = this . customTeamLabel || this . settings . getMetaTeamLabel ( ) . singular ;
224+ this . settings . setTeamLabel ( effective , this . customTeamLabelPlural ) ;
210225 }
211226
212227 onGroupLabelChange ( ) : void {
213- this . settings . setGroupLabel ( this . customGroupLabel , this . customGroupLabelPlural ) ;
214- // Update plural placeholder when singular changes
215- if (
216- ! this . customGroupLabelPlural ||
217- this . customGroupLabelPlural === this . customGroupLabel + 's'
218- ) {
228+ // If cleared, revert to meta.yaml default
229+ const effective = this . customGroupLabel || this . settings . getMetaGroupLabel ( ) . singular ;
230+ this . settings . setGroupLabel ( effective , this . customGroupLabelPlural ) ;
231+ // Clear plural so placeholder updates
232+ if ( ! this . customGroupLabelPlural || this . customGroupLabelPlural === effective + 's' ) {
219233 this . customGroupLabelPlural = '' ;
220234 }
221235 }
222236
223237 onGroupLabelPluralChange ( ) : void {
224- this . settings . setGroupLabel ( this . customGroupLabel , this . customGroupLabelPlural ) ;
238+ const effective = this . customGroupLabel || this . settings . getMetaGroupLabel ( ) . singular ;
239+ this . settings . setGroupLabel ( effective , this . customGroupLabelPlural ) ;
240+ }
241+
242+ getTeamSingularPlaceholder ( ) : string {
243+ return this . settings . getMetaTeamLabel ( ) . singular || 'Team' ;
244+ }
245+
246+ getGroupSingularPlaceholder ( ) : string {
247+ return this . settings . getMetaGroupLabel ( ) . singular || 'Group' ;
225248 }
226249
227250 getTeamPluralPlaceholder ( ) : string {
228- return ( this . customTeamLabel || 'Team' ) + 's' ;
251+ return ( this . customTeamLabel || this . settings . getMetaTeamLabel ( ) . singular || 'Team' ) + 's' ;
229252 }
230253
231254 getGroupPluralPlaceholder ( ) : string {
232- return ( this . customGroupLabel || 'Group' ) + 's' ;
255+ return ( this . customGroupLabel || this . settings . getMetaGroupLabel ( ) . singular || 'Group' ) + 's' ;
233256 }
234257
235258 onMaxLevelChange ( value : number | null ) : void {
0 commit comments