Skip to content

Commit

Permalink
Merge pull request kubernetes#547 from anvithks/copy-paste-progress
Browse files Browse the repository at this point in the history
Added a progress bar and notification for copy-paste operation.
  • Loading branch information
NajmudheenCT authored Mar 19, 2021
2 parents 382c84d + b055bb3 commit 6d19037
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,8 @@
<acl [bucketId]="bucketId"></acl>
</p-tabPanel>
</p-tabView>
</div>
</div>
<p-dialog [(visible)]="isPasting" [showHeader]="false" [closable]="false" [width]="450" [modal]="true" [height]="50">
<p class="align-center">Object paste initiated. Please check back after sometime.</p>
<p-progressBar mode="indeterminate" [style]="{'height': '10px'}"></p-progressBar>
</p-dialog>
12 changes: 10 additions & 2 deletions src/app/business/block/bucket-detail/bucket-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export class BucketDetailComponent implements OnInit {
msgs: Message[];
allBackends: any[];
archivalEnabled: any = {};
isPasting: boolean = false;
errorMessage = {
"backend_type": { required: "Type is required." },
"backend": { required: "Backend is required." },
Expand Down Expand Up @@ -232,6 +233,8 @@ export class BucketDetailComponent implements OnInit {
}
//paste object
pasteObject() {
this.isPasting = true;
this.msgs = [];
this.copySelectedDir.forEach(item=>{
let key = this.folderId != "" ? this.folderId + item.Key : item.Key;
let copySource = item.folderId != "" ? item.source + '/' + item.folderId + item.Key :
Expand Down Expand Up @@ -266,14 +269,19 @@ export class BucketDetailComponent implements OnInit {
//Copy in the same bucket
options.headers.set('X-Amz-Metadata-Directive', 'REPLACE');
}

let pastedObjectTitle = key + ' pasted.';
let pastedObjectMessage = key + ' will be available in the destination bucket shortly.';
this.msgs.push({severity: 'success', summary: pastedObjectTitle, detail: pastedObjectMessage});
this.BucketService.copyObject(this.bucketId + '/' + key, '', options).subscribe((res) => {
this.isReadyPast = true;
window.sessionStorage['searchIndex'] = "";
this.getAlldir();
res
this.isPasting = false;
}, (error)=>{
window.sessionStorage['searchIndex'] = "";
this.isPasting = false;
let pastedObjectMessage = 'Object' + key + 'could not be pasted. ' + error._body;
this.msgs.push({severity: 'error', summary: 'Error', detail: pastedObjectMessage});
});
})
})
Expand Down
3 changes: 2 additions & 1 deletion src/app/business/block/bucket-detail/bucket-detail.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { LifeCycleModule } from './lifeCycle/lifeCycle.module';
import { AclModule } from './acl/acl.module';
import { TabViewModule,ButtonModule, DataTableModule, DropMenuModule, DialogModule, FormModule, InputTextModule, InputSwitchModule, InputTextareaModule,
ConfirmDialogModule ,ConfirmationService,CheckboxModule,DropdownModule, SplitButtonModule, GrowlModule} from './../../../components/common/api';

import { ProgressBarModule } from '../../../components/progressbar/progressbar';
import { HttpService } from './../../../shared/service/Http.service';
import { BucketService } from '../buckets.service';
import { HttpClientModule } from '@angular/common/http';
Expand Down Expand Up @@ -38,6 +38,7 @@ let routers = [{
HttpClientModule,
SplitButtonModule,
GrowlModule,
ProgressBarModule,
AclModule
],
declarations: [
Expand Down

0 comments on commit 6d19037

Please sign in to comment.