From: Stephan Müller Date: Tue, 16 Apr 2019 15:22:41 +0000 (+0200) Subject: mgr/dashboard: RBD snapshot name suggestion with local time suffix X-Git-Tag: v15.1.0~2789^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a23ec087958b4c81742f3170491dd0983614c06e;p=ceph.git mgr/dashboard: RBD snapshot name suggestion with local time suffix 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 --- 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 522c60f87372..e6d0031b6d5e 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 cc40bea3032a..101525bf30b5 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) => {