Merge pull request #27613 from Devp00l/wip-issue-23858

mgr/dashboard: RBD snapshot name suggestion with local time suffix

Reviewed-by: Alfonso Martínez <almartin@redhat.com>
Reviewed-by: Ricardo Marques <rimarques@suse.com>
This commit is contained in:
Lenz Grimmer 2019-04-30 09:43:01 +02:00 committed by GitHub
commit 3ec1130719
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View File

@ -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:]+\$`)
);
});
});

View File

@ -167,9 +167,7 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges {
} else {
// Auto-create a name for the snapshot: <image_name>_<timestamp_ISO_8601>
// 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) => {