From a23ec087958b4c81742f3170491dd0983614c06e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20M=C3=BCller?= Date: Tue, 16 Apr 2019 17:22:41 +0200 Subject: [PATCH] mgr/dashboard: RBD snapshot name suggestion with local time suffix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The new suffix is still a time that follows the ISO standard as it can be converted into any other time zone through the time zone prefix of itself. Fixes: https://tracker.ceph.com/issues/23858 Signed-off-by: Stephan Müller --- .../rbd-snapshot-list/rbd-snapshot-list.component.spec.ts | 2 +- .../block/rbd-snapshot-list/rbd-snapshot-list.component.ts | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts index 522c60f8737..e6d0031b6d5 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts @@ -206,7 +206,7 @@ describe('RbdSnapshotListComponent', () => { it('should display suggested snapshot name', () => { component.openCreateSnapshotModal(); expect(component.modalRef.content.snapName).toMatch( - RegExp(`^${component.rbdName}-\\d+T\\d+Z\$`) + RegExp(`^${component.rbdName}_[\\d-]+T[\\d.:]+\\+[\\d:]+\$`) ); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts index cc40bea3032..101525bf30b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts @@ -167,9 +167,7 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges { } else { // Auto-create a name for the snapshot: _ // https://en.wikipedia.org/wiki/ISO_8601 - snapName = `${this.rbdName}-${moment() - .utc() - .format('YYYYMMDD[T]HHmmss[Z]')}`; + snapName = `${this.rbdName}_${moment().toISOString(true)}`; } this.modalRef.content.setSnapName(snapName); this.modalRef.content.onSubmit.subscribe((snapshotName: string) => {