Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 11x 11x 11x 11x 5x 2x 5x 3x 3x 3x 2x 3x 1x 3x 3x 5x | import { Component, OnInit } from '@angular/core'; import * as moment from 'moment'; import { BsModalRef } from 'ngx-bootstrap/modal'; import { RbdService } from '../../../shared/api/rbd.service'; import { CdFormBuilder } from '../../../shared/forms/cd-form-builder'; import { CdFormGroup } from '../../../shared/forms/cd-form-group'; import { CdValidators } from '../../../shared/forms/cd-validators'; import { ExecutingTask } from '../../../shared/models/executing-task'; import { FinishedTask } from '../../../shared/models/finished-task'; import { TaskWrapperService } from '../../../shared/services/task-wrapper.service'; @Component({ selector: 'cd-rbd-trash-move-modal', template: require('./rbd-trash-move-modal.component.html'), styles: [] }) export class RbdTrashMoveModalComponent implements OnInit { metaType: string; poolName: string; imageName: string; executingTasks: ExecutingTask[]; moveForm: CdFormGroup; minDate = new Date(); bsConfig = { dateInputFormat: 'YYYY-MM-DD HH:mm:ss', containerClass: 'theme-default' }; pattern: string; constructor( private rbdService: RbdService, public modalRef: BsModalRef, private fb: CdFormBuilder, private taskWrapper: TaskWrapperService ) { this.createForm(); } createForm() { this.moveForm = this.fb.group({ expiresAt: [ '', [ CdValidators.custom('format', (expiresAt) => { const result = expiresAt === '' || moment(expiresAt, 'YYYY-MM-DD HH:mm:ss').isValid(); return !result; }), CdValidators.custom('expired', (expiresAt) => { const result = moment().isAfter(expiresAt); return result; }) ] ] }); } ngOnInit() { this.pattern = `${this.poolName}/${this.imageName}`; } moveImage() { let delay = 0; const expiresAt = this.moveForm.getValue('expiresAt'); if (expiresAt) { delay = moment(expiresAt).diff(moment(), 'seconds', true); } if (delay < 0) { delay = 0; } this.taskWrapper .wrapTaskAroundCall({ task: new FinishedTask('rbd/trash/move', { pool_name: this.poolName, image_name: this.imageName }), call: this.rbdService.moveTrash(this.poolName, this.imageName, delay) }) .subscribe(undefined, undefined, () => { this.modalRef.hide(); }); } } |