Skip to content

Commit e5eb384

Browse files
committed
Replaced string concatenation with template strings
(Mostly) only applied to locations where at least 3 strings were concatenated. Request: MO Change-Id: I23dd131f38068eb0ed0f15ab869665c456e1ce74
1 parent 2e83b3b commit e5eb384

25 files changed

Lines changed: 137 additions & 142 deletions

File tree

ui/webapp/src/app/modules/core/components/bd-data-grouping/bd-data-grouping.component.ts

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,26 @@ enum PresetType {
3333
}
3434

3535
@Component({
36-
selector: 'app-bd-data-grouping',
37-
templateUrl: './bd-data-grouping.component.html',
38-
styleUrls: ['./bd-data-grouping.component.css'],
39-
encapsulation: ViewEncapsulation.None,
40-
imports: [BdButtonPopupComponent, MatTooltip, MatCard, MatFormField, MatLabel, MatSelect, MatOption, BdButtonComponent, MatDivider, CdkDropList, BdDataGroupingPanelComponent, CdkDrag, MatIcon, CdkDragHandle]
36+
selector: 'app-bd-data-grouping',
37+
templateUrl: './bd-data-grouping.component.html',
38+
styleUrls: ['./bd-data-grouping.component.css'],
39+
encapsulation: ViewEncapsulation.None,
40+
imports: [
41+
BdButtonPopupComponent,
42+
MatTooltip,
43+
MatCard,
44+
MatFormField,
45+
MatLabel,
46+
MatSelect,
47+
MatOption,
48+
BdButtonComponent,
49+
MatDivider,
50+
CdkDropList,
51+
BdDataGroupingPanelComponent,
52+
CdkDrag,
53+
MatIcon,
54+
CdkDragHandle,
55+
],
4156
})
4257
export class BdDataGroupingComponent<T> implements OnInit, OnChanges {
4358
private readonly snackBar = inject(MatSnackBar);
@@ -124,7 +139,7 @@ export class BdDataGroupingComponent<T> implements OnInit, OnChanges {
124139
}
125140

126141
private getStorageKey() {
127-
return 'grouping-' + (this.multiple ? 'm-' : 's-') + this.presetKey;
142+
return `grouping-${this.multiple ? 'm-' : 's-'}${this.presetKey}`;
128143
}
129144

130145
private loadPreset() {
@@ -168,7 +183,7 @@ export class BdDataGroupingComponent<T> implements OnInit, OnChanges {
168183
({
169184
name: g.definition.name,
170185
selected: g.selected,
171-
}) as CustomDataGrouping,
186+
} as CustomDataGrouping)
172187
);
173188
}
174189

@@ -184,7 +199,7 @@ export class BdDataGroupingComponent<T> implements OnInit, OnChanges {
184199
}
185200

186201
private presetTypeKey(): string {
187-
return 'preset-type-' + (this.multiple ? 'm-' : 's-') + this.presetKey;
202+
return `preset-type-${this.multiple ? 'm-' : 's-'}${this.presetKey}`;
188203
}
189204

190205
private loadPresetType() {

ui/webapp/src/app/modules/core/components/bd-file-upload/bd-file-upload.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export class BdFileUploadComponent<D> implements OnInit {
7070
return 'Software version already exists. Nothing to do.';
7171
}
7272
const softwares: ManifestKey[] = status.detail;
73-
return 'New software: ' + softwares.map((key) => key.name + ' ' + key.tag).join(',');
73+
return `New software: ${softwares.map((key) => key.name + ' ' + key.tag).join(',')}`;
7474
}
7575

7676
private getIcon() {

ui/webapp/src/app/modules/core/components/bd-popup/bd-popup.directive.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ const RIGHT_BELOW: ConnectedPosition = {
111111
};
112112

113113
@Directive({
114-
selector: '[appBdPopup]',
115-
exportAs: 'appBdPopup'
114+
selector: '[appBdPopup]',
115+
exportAs: 'appBdPopup'
116116
})
117117
export class BdPopupDirective implements OnDestroy {
118118
private readonly host = inject(ElementRef);
@@ -258,7 +258,7 @@ export class BdPopupDirective implements OnDestroy {
258258
const result: ConnectedPosition[] = [];
259259
pos.forEach((p) => {
260260
const x: ConnectedPosition = cloneDeep(p);
261-
x.panelClass = x.panelClass + '-' + name;
261+
x.panelClass = `${x.panelClass}-${name}`;
262262
result.push(x);
263263
});
264264
return result;

ui/webapp/src/app/modules/core/interceptors/error-handler.interceptor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class HttpErrorHandlerInterceptor implements HttpInterceptor {
5555
// silent.
5656
}
5757
// response status texts are HTML encoded, so we need to decode that here manually.
58-
this.snackbar.open(e.status + ': ' + he.decode(e.statusText) + ': ' + displayPath, 'DISMISS', {
58+
this.snackbar.open(`${e.status}: ${he.decode(e.statusText)}: ${displayPath}`, 'DISMISS', {
5959
panelClass: 'error-snackbar',
6060
});
6161
return throwError(() => e);

ui/webapp/src/app/modules/core/services/authentication.service.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -317,38 +317,38 @@ export class AuthenticationService {
317317
}
318318

319319
public getAuthPackForCurrentUser(genFull: boolean): Observable<string> {
320-
return this.http.get(this.cfg.config.api + '/auth/auth-pack-self', {
320+
return this.http.get(`${this.cfg.config.api}/auth/auth-pack-self`, {
321321
responseType: 'text',
322322
params: new HttpParams().append('full', genFull ? 'true' : 'false'),
323323
});
324324
}
325325

326326
public getUserInfo(): Observable<UserInfo> {
327327
this.http
328-
.get<UserInfo>(this.cfg.config.api + '/auth/user')
328+
.get<UserInfo>(`${this.cfg.config.api}/auth/user`)
329329
.subscribe((userInfo) => this.userInfoSubject$.next(userInfo));
330330
return this.userInfoSubject$.asObservable();
331331
}
332332

333333
public getUserProfileInfo(): Observable<UserProfileInfo> {
334-
return this.http.get<UserProfileInfo>(this.cfg.config.api + '/auth/user-profile');
334+
return this.http.get<UserProfileInfo>(`${this.cfg.config.api}/auth/user-profile`);
335335
}
336336

337337
public updateCurrentUser(info: UserInfo): Observable<object> {
338338
this.userInfoSubject$.next(info);
339-
return this.http.post(this.cfg.config.api + '/auth/user', info);
339+
return this.http.post(`${this.cfg.config.api}/auth/user`, info);
340340
}
341341

342342
public removeCurrentUserFromGroup(groupId: string): Observable<object> {
343-
return this.http.delete(this.cfg.config.api + '/auth/group/' + groupId);
343+
return this.http.delete(`${this.cfg.config.api}/auth/group/${groupId}`);
344344
}
345345

346346
public deleteCurrentUser(): Observable<object> {
347-
return this.http.delete(this.cfg.config.api + '/auth');
347+
return this.http.delete(`${this.cfg.config.api}/auth`);
348348
}
349349

350350
public changePassword(dto: UserChangePasswordDto): Observable<unknown> {
351-
return this.http.post(this.cfg.config.api + '/auth/change-password', dto, {
351+
return this.http.post(`${this.cfg.config.api}/auth/change-password`, dto, {
352352
responseType: 'text',
353353
headers: suppressGlobalErrorHandling(new HttpHeaders()),
354354
});

ui/webapp/src/app/modules/core/services/config.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ export class ConfigService {
269269

270270
/** The base URL for a given plugin */
271271
public getPluginUrl(plugin: PluginInfoDto) {
272-
return this.config.api + '/plugins/' + plugin.id.id;
272+
return `${this.config.api}/plugins/${plugin.id.id}`;
273273
}
274274

275275
/** Tries to fetch the current server version, suppresses global error handling */

ui/webapp/src/app/modules/core/services/download.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class DownloadService {
1919
private readonly cfg = inject(ConfigService);
2020

2121
public buildResponseFileName(productName: string, instanceTemplateName: string) {
22-
return 'ResponseFile - ' + productName + ' - ' + instanceTemplateName + '.yaml';
22+
return `ResponseFile - ${productName} - ${instanceTemplateName}.yaml`;
2323
}
2424

2525
/**
@@ -100,6 +100,6 @@ export class DownloadService {
100100
* Creates a new URL to download a file that has been prepared by another call.
101101
*/
102102
public createDownloadUrl(token: string) {
103-
return this.cfg.config.api + '/download/file/' + token;
103+
return `${this.cfg.config.api}/download/file/${token}`;
104104
}
105105
}

ui/webapp/src/app/modules/core/services/upload.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export class UploadService {
191191
}
192192
},
193193
error: (error: HttpErrorResponse) => {
194-
uploadStatus.error = error.statusText + ' (Status ' + error.status + ')';
194+
uploadStatus.error = `${error.statusText} (Status ${error.status})`;
195195
stateSubject.next(UploadState.FAILED);
196196
progressSubject.complete();
197197
stateSubject.complete();
@@ -221,7 +221,7 @@ export class UploadService {
221221
stateSubject.complete();
222222
},
223223
error: (error: HttpErrorResponse) => {
224-
importStatus.detail = error.statusText + ' (Status ' + error.status + ')';
224+
importStatus.detail = `${error.statusText} (Status ${error.status})`;
225225
stateSubject.next(ImportState.FAILED);
226226
stateSubject.complete();
227227
},

ui/webapp/src/app/modules/core/utils/completion.utils.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ const RECURSIVE_PREFIXES = ['DELAYED', 'JSON', 'XML', 'YAML'];
1818
export function getRecursivePrefix(
1919
word: string,
2020
acc: string,
21-
recursivePrefixes: string[] = RECURSIVE_PREFIXES,
21+
recursivePrefixes: string[] = RECURSIVE_PREFIXES
2222
): string {
2323
for (const prefix of recursivePrefixes) {
24-
if (word.startsWith(acc + prefix + ':')) {
25-
return getRecursivePrefix(word, acc + prefix + ':');
24+
const s = `${acc + prefix}:`;
25+
if (word.startsWith(s)) {
26+
return getRecursivePrefix(word, s);
2627
}
2728
}
2829
return acc;
@@ -110,7 +111,7 @@ export function buildCompletions(
110111
instance: InstanceConfigurationDto,
111112
system: SystemConfiguration,
112113
process: ApplicationConfiguration,
113-
apps: ApplicationDto[],
114+
apps: ApplicationDto[]
114115
): ContentCompletion[] {
115116
return [
116117
...gatherVariableExpansions(instance, system).map((l) => ({

ui/webapp/src/app/modules/core/utils/manifest.utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function getTemplateAppKey(
2121
template: FlattenedApplicationTemplateConfiguration,
2222
node: MinionDto,
2323
) {
24-
return product.product + '/' + template.application + '/' + node.os.toLowerCase();
24+
return `${product.product}/${template.application}/${node.os.toLowerCase()}`;
2525
}
2626

2727
/**

0 commit comments

Comments
 (0)