Skip to content

Commit

Permalink
Merge pull request #279 from votdev/issue_764_del_specific_obj_vers
Browse files Browse the repository at this point in the history
  • Loading branch information
votdev authored Oct 24, 2023
2 parents 492603d + 570b90a commit 1c2c9e0
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.23.0]

### Added

Allow the deletion of specific object versions (gh#aquarist-labs/s3gw#764).

## [0.22.0]

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ export class ObjectVersionDatatablePageComponent implements OnInit {
},
callback: (event: Event, action: DatatableAction, table: Datatable) =>
this.doRestore(table.selected[0] as S3ObjectVersion)
},
{
type: 'button',
text: TEXT('Delete'),
icon: this.icons.delete,
enabledConstraints: {
minSelected: 1,
maxSelected: 1
},
callback: (event: Event, action: DatatableAction, table: Datatable) =>
this.doDelete(table.selected[0] as S3ObjectVersion)
}
];
this.datatableColumns = [
Expand Down Expand Up @@ -186,6 +197,14 @@ export class ObjectVersionDatatablePageComponent implements OnInit {
icon: this.icons.restore,
disabled: object.IsDeleted || object.IsLatest,
callback: () => this.doRestore(object)
},
{
type: 'divider'
},
{
title: TEXT('Delete'),
icon: this.icons.delete,
callback: () => this.doDelete(object)
}
];
return result;
Expand All @@ -201,7 +220,7 @@ export class ObjectVersionDatatablePageComponent implements OnInit {
this.modalDialogService.yesNo(
format(
TEXT(
'Are you sure you want to restore the following object?<br>Key: <strong>{{ key | reverse | truncate(45) | reverse }}</strong><br>Version ID: <strong>{{ versionId }}</strong>'
'Are you sure you want to restore this object version?<br>Key: <strong>{{ key | reverse | truncate(45) | reverse }}</strong><br>Version ID: <strong>{{ versionId }}</strong>'
),
{
key: object.Key,
Expand All @@ -212,7 +231,7 @@ export class ObjectVersionDatatablePageComponent implements OnInit {
if (!restore) {
return;
}
this.blockUiService.start(TEXT('Please wait, restoring object...'));
this.blockUiService.start(TEXT('Please wait, restoring object version...'));
this.subscriptions.add(
this.s3BucketService
.restoreObject(this.bid, object.Key!, object.VersionId!)
Expand All @@ -222,4 +241,30 @@ export class ObjectVersionDatatablePageComponent implements OnInit {
}
);
}

private doDelete(object: S3ObjectVersion): void {
this.modalDialogService.yesNo(
format(
TEXT(
'Do you really want to delete this object version?<br>Key: <strong>{{ key | reverse | truncate(45) | reverse }}</strong><br>Version ID: <strong>{{ versionId }}</strong>'
),
{
key: object.Key,
versionId: object.VersionId
}
),
(restore: boolean) => {
if (!restore) {
return;
}
this.blockUiService.start(TEXT('Please wait, deleting object version...'));
this.subscriptions.add(
this.s3BucketService
.deleteObject(this.bid, object.Key!, object.VersionId!)
.pipe(finalize(() => this.blockUiService.stop()))
.subscribe(() => this.loadData())
);
}
);
}
}

0 comments on commit 1c2c9e0

Please sign in to comment.