This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/static/js/directives/ui/expiration-status-view/expiration-status-view.component.ts
Joseph Schorr 7d4fed6892 Change error message when trying to pull a deleted or expired tag
Will let the users know they can recover the tag via time machine

Note: This was tested with the Docker protocol, but the new error code is *technically* out of spec; we should make sure its okay.
2017-07-19 17:13:48 -04:00

35 lines
No EOL
1,012 B
TypeScript

import { Input, Component, Inject } from 'ng-metadata/core';
import * as moment from "moment";
import './expiration-status-view.component.css';
/**
* A component that displays expiration status.
*/
@Component({
selector: 'expiration-status-view',
templateUrl: '/static/js/directives/ui/expiration-status-view/expiration-status-view.component.html',
})
export class ExpirationStatusViewComponent {
@Input('<') public expirationDate: Date;
private getExpirationInfo(expirationDate): any {
if (!expirationDate) {
return '';
}
var expiration = moment(expirationDate);
if (moment().isAfter(expiration)) {
return {'className': 'expired', 'icon': 'fa-warning'};
}
if (moment().add(1, 'week').isAfter(expiration)) {
return {'className': 'critical', 'icon': 'fa-warning'};
}
if (moment().add(1, 'month').isAfter(expiration)) {
return {'className': 'warning', 'icon': 'fa-warning'};
}
return {'className': 'info', 'icon': 'fa-clock-o'};
}
}