2016-06-16 01:49:57 +08:00
|
|
|
import computed from 'ember-addons/ember-computed-decorators';
|
2017-07-27 00:13:49 +08:00
|
|
|
import { iconHTML } from 'discourse-common/lib/icon-library';
|
2016-10-25 03:21:44 +08:00
|
|
|
import { bufferedRender } from 'discourse-common/lib/buffered-render';
|
2016-06-16 01:49:57 +08:00
|
|
|
|
2016-10-25 03:21:44 +08:00
|
|
|
export default Ember.Component.extend(bufferedRender({
|
2016-06-16 01:49:57 +08:00
|
|
|
classes: ["text-muted", "text-danger", "text-successful"],
|
|
|
|
icons: ["circle-o", "times-circle", "circle"],
|
|
|
|
|
|
|
|
@computed('deliveryStatuses', 'model.last_delivery_status')
|
|
|
|
status(deliveryStatuses, lastDeliveryStatus) {
|
|
|
|
return deliveryStatuses.find(s => s.id === lastDeliveryStatus);
|
|
|
|
},
|
|
|
|
|
|
|
|
@computed('status.id', 'icons')
|
|
|
|
icon(statusId, icons) {
|
|
|
|
return icons[statusId - 1];
|
|
|
|
},
|
|
|
|
|
|
|
|
@computed('status.id', 'classes')
|
|
|
|
class(statusId, classes) {
|
|
|
|
return classes[statusId - 1];
|
|
|
|
},
|
|
|
|
|
2016-10-25 03:21:44 +08:00
|
|
|
buildBuffer(buffer) {
|
2016-06-16 01:49:57 +08:00
|
|
|
buffer.push(iconHTML(this.get('icon'), { class: this.get('class') }));
|
|
|
|
buffer.push(I18n.t(`admin.web_hooks.delivery_status.${this.get('status.name')}`));
|
|
|
|
}
|
2016-10-25 03:21:44 +08:00
|
|
|
}));
|