From 2f54a3b843a44235aa2a4927f2ce34e2b5b2026f Mon Sep 17 00:00:00 2001 From: Ishan Rai Date: Mon, 8 Jun 2020 06:53:57 +0000 Subject: [PATCH] mgr/dashboard: Use a unified quoting style Use single quotes across all UI elements such as notifications Fixes: https://tracker.ceph.com/issues/36070 Signed-off-by: Ishan Rai --- .../cephfs-clients.component.ts | 2 +- .../cephfs-directories.component.spec.ts | 52 +++++++++---------- .../cephfs-directories.component.ts | 10 ++-- .../mgr-module-form.component.ts | 2 +- .../osd/osd-list/osd-list.component.ts | 2 +- .../osd-recv-speed-modal.component.ts | 2 +- .../rgw-bucket-form.component.spec.ts | 4 +- .../rgw-bucket-form.component.ts | 4 +- .../rgw-user-form.component.spec.ts | 4 +- .../rgw-user-form/rgw-user-form.component.ts | 4 +- .../auth/user-form/user-form.component.ts | 4 +- .../auth/user-list/user-list.component.ts | 6 +-- src/pybind/mgr/dashboard/frontend/tslint.json | 2 +- 13 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.ts index 327a4e1245bc2..c4041af1c5972 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.ts @@ -82,7 +82,7 @@ export class CephfsClientsComponent implements OnInit { this.modalRef.hide(); this.notificationService.show( NotificationType.success, - this.i18n('Evicted client "{{clientId}}"', { clientId: clientId }) + this.i18n(`Evicted client '{{clientId}}'`, { clientId: clientId }) ); }, () => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts index 25a64a3b01ec3..bfb71ab0c4636 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts @@ -783,9 +783,9 @@ describe('CephfsDirectoriesComponent', () => { it('shows the right texts', () => { assert.quotaUpdateModalTexts( - "Update CephFS files quota for '/a/c/b'", - "The inherited files quota 10 from '/a' is the maximum value to be used.", - "Updated CephFS files quota for '/a/c/b'" + `Update CephFS files quota for '/a/c/b'`, + `The inherited files quota 10 from '/a' is the maximum value to be used.`, + `Updated CephFS files quota for '/a/c/b'` ); }); }); @@ -807,9 +807,9 @@ describe('CephfsDirectoriesComponent', () => { it('shows the right texts', () => { assert.quotaUpdateModalTexts( - "Update CephFS size quota for '/a/c/b'", - "The inherited size quota 1 KiB from '/a' is the maximum value to be used.", - "Updated CephFS size quota for '/a/c/b'" + `Update CephFS size quota for '/a/c/b'`, + `The inherited size quota 1 KiB from '/a' is the maximum value to be used.`, + `Updated CephFS size quota for '/a/c/b'` ); }); }); @@ -821,13 +821,13 @@ describe('CephfsDirectoriesComponent', () => { assert.quotaUpdateModalField('binary', 'Max size', 'max_bytes', 512, 1024); }); - it("uses 'Set' action instead of 'Update' if the quota is not set (0)", () => { + it(`uses 'Set' action instead of 'Update' if the quota is not set (0)`, () => { mockLib.updateQuotaThroughModal('max_bytes', 0); mockLib.updateQuotaThroughModal('max_bytes', 200); assert.quotaUpdateModalTexts( - "Set CephFS size quota for '/a/c/b'", - "The inherited size quota 1 KiB from '/a' is the maximum value to be used.", - "Set CephFS size quota for '/a/c/b'" + `Set CephFS size quota for '/a/c/b'`, + `The inherited size quota 1 KiB from '/a' is the maximum value to be used.`, + `Set CephFS size quota for '/a/c/b'` ); }); }); @@ -847,9 +847,9 @@ describe('CephfsDirectoriesComponent', () => { it('shows the right texts', () => { assert.quotaUnsetModalTexts( - "Unset CephFS files quota for '/a/c/b'", - "Unset files quota 5 from '/a/c/b' in order to inherit files quota 10 from '/a'.", - "Unset CephFS files quota for '/a/c/b'" + `Unset CephFS files quota for '/a/c/b'`, + `Unset files quota 5 from '/a/c/b' in order to inherit files quota 10 from '/a'.`, + `Unset CephFS files quota for '/a/c/b'` ); }); }); @@ -867,9 +867,9 @@ describe('CephfsDirectoriesComponent', () => { it('shows the right texts', () => { assert.quotaUnsetModalTexts( - "Unset CephFS size quota for '/a/c/b'", - "Unset size quota 512 B from '/a/c/b' in order to inherit size quota 1 KiB from '/a'.", - "Unset CephFS size quota for '/a/c/b'" + `Unset CephFS size quota for '/a/c/b'`, + `Unset size quota 512 B from '/a/c/b' in order to inherit size quota 1 KiB from '/a'.`, + `Unset CephFS size quota for '/a/c/b'` ); }); }); @@ -879,19 +879,19 @@ describe('CephfsDirectoriesComponent', () => { mockLib.selectNode('/a'); mockLib.unsetQuotaThroughModal('max_bytes'); assert.quotaUnsetModalTexts( - "Unset CephFS size quota for '/a'", - "Unset size quota 1 KiB from '/a' in order to have no quota on the directory.", - "Unset CephFS size quota for '/a'" + `Unset CephFS size quota for '/a'`, + `Unset size quota 1 KiB from '/a' in order to have no quota on the directory.`, + `Unset CephFS size quota for '/a'` ); }); it('uses different Text if quota is already inherited', () => { mockLib.unsetQuotaThroughModal('max_bytes'); assert.quotaUnsetModalTexts( - "Unset CephFS size quota for '/a/c/b'", - "Unset size quota 2 KiB from '/a/c/b' which isn't used because of the inheritance " + - "of size quota 1 KiB from '/a'.", - "Unset CephFS size quota for '/a/c/b'" + `Unset CephFS size quota for '/a/c/b'`, + `Unset size quota 2 KiB from '/a/c/b' which isn't used because of the inheritance ` + + `of size quota 1 KiB from '/a'.`, + `Unset CephFS size quota for '/a/c/b'` ); }); }); @@ -913,21 +913,21 @@ describe('CephfsDirectoriesComponent', () => { actions = component.quota.tableActions; }); - it("shows 'Set' for empty and not set quotas", () => { + it(`shows 'Set' for empty and not set quotas`, () => { const isSetVisible = actions[0].visible; expect(isSetVisible(empty())).toBe(true); expect(isSetVisible(select(0))).toBe(true); expect(isSetVisible(select(1))).toBe(false); }); - it("shows 'Update' for set quotas only", () => { + it(`shows 'Update' for set quotas only`, () => { const isUpdateVisible = actions[1].visible; expect(isUpdateVisible(empty())).toBeFalsy(); expect(isUpdateVisible(select(0))).toBe(false); expect(isUpdateVisible(select(1))).toBe(true); }); - it("only enables 'Unset' for set quotas only", () => { + it(`only enables 'Unset' for set quotas only`, () => { const isUnsetDisabled = actions[2].disable; expect(isUnsetDisabled(empty())).toBe(true); expect(isUnsetDisabled(select(0))).toBe(true); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.ts index c715e5448ab99..e9db99eed52ff 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.ts @@ -434,7 +434,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges { } private getModalQuotaTitle(action: string, path: string): string { - return this.i18n("{{action}} CephFS {{quotaName}} quota for '{{path}}'", { + return this.i18n(`{{action}} CephFS {{quotaName}} quota for '{{path}}'`, { action, quotaName: this.getQuotaName(), path @@ -450,7 +450,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges { } private getQuotaValueFromPathMsg(value: number, path: string): string { - return this.i18n("{{quotaName}} quota {{value}} from '{{path}}'", { + return this.i18n(`{{quotaName}} quota {{value}} from '{{path}}'`, { value: this.isBytesQuotaSelected() ? this.dimlessBinaryPipe.transform(value) : value, quotaName: this.getQuotaName(), path @@ -526,7 +526,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges { ? this.i18n('in order to inherit {{quotaValue}}', { quotaValue: this.getQuotaValueFromPathMsg(nextMax.value, nextMax.path) }) - : this.i18n("which isn't used because of the inheritance of {{quotaValue}}", { + : this.i18n(`which isn't used because of the inheritance of {{quotaValue}}`, { quotaValue: this.getQuotaValueFromPathMsg(nextMax.value, nextMax.path) }) : this.i18n('in order to have no quota on the directory') @@ -556,7 +556,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges { this.cephfsService.mkSnapshot(this.id, path, values.name).subscribe((name) => { this.notificationService.show( NotificationType.success, - this.i18n('Created snapshot "{{name}}" for "{{path}}"', { + this.i18n(`Created snapshot '{{name}}' for '{{path}}'`, { name: name, path: path }) @@ -690,7 +690,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges { this.cephfsService.rmSnapshot(this.id, path, name).subscribe(() => { this.notificationService.show( NotificationType.success, - this.i18n('Deleted snapshot "{{name}}" for "{{path}}"', { + this.i18n(`Deleted snapshot '{{name}}' for '{{path}}'`, { name: name, path: path }) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.ts index f8474b1f04ae0..ea92c9fc550c9 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.ts @@ -129,7 +129,7 @@ export class MgrModuleFormComponent extends CdForm implements OnInit { () => { this.notificationService.show( NotificationType.success, - this.i18n('Updated options for module "{{name}}".', { name: this.moduleName }) + this.i18n(`Updated options for module '{{name}}'.`, { name: this.moduleName }) ); this.goToListView(); }, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts index 850cdf66f3275..e9dfb0c29f320 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts @@ -418,7 +418,7 @@ export class OsdListComponent extends ListWithDetails implements OnInit { this.osdService.update(selectedOsd.id, values.deviceClass).subscribe(() => { this.notificationService.show( NotificationType.success, - this.i18n('Updated OSD "{{id}}"', { + this.i18n(`Updated OSD '{{id}}'`, { id: selectedOsd.id }) ); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.ts index f23430800e01a..eaaa70a4bc356 100755 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.ts @@ -224,7 +224,7 @@ export class OsdRecvSpeedModalComponent implements OnInit { () => { this.notificationService.show( NotificationType.success, - this.i18n('Updated OSD recovery speed priority "{{value}}"', { + this.i18n(`Updated OSD recovery speed priority '{{value}}'`, { value: this.osdRecvSpeedForm.getValue('priority') }) ); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.spec.ts index c7cb01402842b..acaecac88bae1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.spec.ts @@ -204,7 +204,7 @@ describe('RgwBucketFormComponent', () => { component.submit(); expect(notificationService.show).toHaveBeenCalledWith( NotificationType.success, - 'Created Object Gateway bucket ""' + `Created Object Gateway bucket ''` ); }); @@ -215,7 +215,7 @@ describe('RgwBucketFormComponent', () => { component.submit(); expect(notificationService.show).toHaveBeenCalledWith( NotificationType.success, - 'Updated Object Gateway bucket "".' + `Updated Object Gateway bucket ''.` ); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts index 77ce8badcabd5..21531ed734400 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts @@ -189,7 +189,7 @@ export class RgwBucketFormComponent extends CdForm implements OnInit { () => { this.notificationService.show( NotificationType.success, - this.i18n('Updated Object Gateway bucket "{{bid}}".', values) + this.i18n(`Updated Object Gateway bucket '{{bid}}'.`, values) ); this.goToListView(); }, @@ -215,7 +215,7 @@ export class RgwBucketFormComponent extends CdForm implements OnInit { () => { this.notificationService.show( NotificationType.success, - this.i18n('Created Object Gateway bucket "{{bid}}"', values) + this.i18n(`Created Object Gateway bucket '{{bid}}'`, values) ); this.goToListView(); }, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.spec.ts index eb4a9619cf70f..e297c330be08c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.spec.ts @@ -296,7 +296,7 @@ describe('RgwUserFormComponent', () => { component.onSubmit(); expect(notificationService.show).toHaveBeenCalledWith( NotificationType.success, - 'Created Object Gateway user ""' + `Created Object Gateway user ''` ); }); @@ -307,7 +307,7 @@ describe('RgwUserFormComponent', () => { component.onSubmit(); expect(notificationService.show).toHaveBeenCalledWith( NotificationType.success, - 'Updated Object Gateway user ""' + `Updated Object Gateway user ''` ); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts index faad689dbe6d5..44d1e1eddc94b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts @@ -250,12 +250,12 @@ export class RgwUserFormComponent extends CdForm implements OnInit { const args = this._getUpdateArgs(); this.submitObservables.push(this.rgwUserService.update(uid, args)); } - notificationTitle = this.i18n('Updated Object Gateway user "{{uid}}"', { uid: uid }); + notificationTitle = this.i18n(`Updated Object Gateway user '{{uid}}'`, { uid: uid }); } else { // Add const args = this._getCreateArgs(); this.submitObservables.push(this.rgwUserService.create(args)); - notificationTitle = this.i18n('Created Object Gateway user "{{uid}}"', { uid: uid }); + notificationTitle = this.i18n(`Created Object Gateway user '{{uid}}'`, { uid: uid }); } // Check if user quota has been modified. if (this._isUserQuotaDirty()) { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.ts index e48bb99f5ce5b..9bd83ac16758d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.ts @@ -209,7 +209,7 @@ export class UserFormComponent extends CdForm implements OnInit { () => { this.notificationService.show( NotificationType.success, - this.i18n('Created user "{{username}}"', { username: userFormModel.username }) + this.i18n(`Created user '{{username}}'`, { username: userFormModel.username }) ); this.router.navigate(['/user-management/users']); }, @@ -284,7 +284,7 @@ export class UserFormComponent extends CdForm implements OnInit { } else { this.notificationService.show( NotificationType.success, - this.i18n('Updated user "{{username}}"', { username: userFormModel.username }) + this.i18n(`Updated user '{{username}}'`, { username: userFormModel.username }) ); this.router.navigate(['/user-management/users']); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.ts index c9f4a0c8ec464..9f2a6207f0702 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.ts @@ -137,7 +137,7 @@ export class UserListComponent implements OnInit { this.modalRef.hide(); this.notificationService.show( NotificationType.success, - this.i18n('Deleted user "{{username}}"', { username: username }) + this.i18n(`Deleted user '{{username}}'`, { username: username }) ); }, () => { @@ -152,8 +152,8 @@ export class UserListComponent implements OnInit { if (sessionUsername === username) { this.notificationService.show( NotificationType.error, - this.i18n('Failed to delete user "{{username}}"', { username: username }), - this.i18n('You are currently logged in as "{{username}}".', { username: username }) + this.i18n(`Failed to delete user '{{username}}'`, { username: username }), + this.i18n(`You are currently logged in as '{{username}}'.`, { username: username }) ); return; } diff --git a/src/pybind/mgr/dashboard/frontend/tslint.json b/src/pybind/mgr/dashboard/frontend/tslint.json index cc3f6582c779e..59bc6bcd17907 100644 --- a/src/pybind/mgr/dashboard/frontend/tslint.json +++ b/src/pybind/mgr/dashboard/frontend/tslint.json @@ -45,7 +45,7 @@ "object-literal-sort-keys": false, "one-line": [true, "check-open-brace", "check-catch", "check-else", "check-whitespace"], "prefer-const": true, - "quotemark": [true, "single", "avoid-escape"], + "quotemark": [true, "single"], "radix": true, "triple-equals": [true, "allow-null-check"], "typedef-whitespace": [ -- 2.47.3