mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Remove buffered rendering from watched words
This is another refactoring in the multi-step process to remove all uses
of our custom Render Buffer.
Previous commit: bb31e7f5b6 in the series.
This commit affects the display of the Webhooks Deliver Status column. It
is just a refactor and does not change any functionality.
This commit is contained in:
@@ -1,33 +1,31 @@
|
|||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||||
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
|
||||||
|
|
||||||
export default Component.extend(
|
export default Component.extend({
|
||||||
bufferedRender({
|
classes: ["text-muted", "text-danger", "text-successful", "text-muted"],
|
||||||
classes: ["text-muted", "text-danger", "text-successful", "text-muted"],
|
icons: ["far-circle", "times-circle", "circle", "circle"],
|
||||||
icons: ["far-circle", "times-circle", "circle", "circle"],
|
circleIcon: null,
|
||||||
|
deliveryStatus: null,
|
||||||
|
|
||||||
@discourseComputed("deliveryStatuses", "model.last_delivery_status")
|
@discourseComputed("deliveryStatuses", "model.last_delivery_status")
|
||||||
status(deliveryStatuses, lastDeliveryStatus) {
|
status(deliveryStatuses, lastDeliveryStatus) {
|
||||||
return deliveryStatuses.find(s => s.id === lastDeliveryStatus);
|
return deliveryStatuses.find(s => s.id === lastDeliveryStatus);
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed("status.id", "icons")
|
@discourseComputed("status.id", "icons")
|
||||||
icon(statusId, icons) {
|
icon(statusId, icons) {
|
||||||
return icons[statusId - 1];
|
return icons[statusId - 1];
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed("status.id", "classes")
|
@discourseComputed("status.id", "classes")
|
||||||
class(statusId, classes) {
|
class(statusId, classes) {
|
||||||
return classes[statusId - 1];
|
return classes[statusId - 1];
|
||||||
},
|
},
|
||||||
|
|
||||||
buildBuffer(buffer) {
|
didReceiveAttrs() {
|
||||||
buffer.push(iconHTML(this.icon, { class: this.class }));
|
this._super(...arguments);
|
||||||
buffer.push(
|
this.set("circleIcon", iconHTML(this.icon, { class: this.class }).htmlSafe());
|
||||||
I18n.t(`admin.web_hooks.delivery_status.${this.get("status.name")}`)
|
this.set("deliveryStatus", I18n.t(`admin.web_hooks.delivery_status.${this.get("status.name")}`));
|
||||||
);
|
}
|
||||||
}
|
});
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
{{circleIcon}} {{deliveryStatus}}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
<div class='web-hooks-listing'>
|
<div class='web-hooks-listing'>
|
||||||
<p>{{i18n 'admin.web_hooks.instruction'}}</p>
|
<p>{{i18n 'admin.web_hooks.instruction'}}</p>
|
||||||
<div class='new-webhook'>
|
<div class='new-webhook'>
|
||||||
|
|||||||
Reference in New Issue
Block a user