diff --git a/app/assets/javascripts/admin/addon/components/webhook-status.gjs b/app/assets/javascripts/admin/addon/components/webhook-status.gjs index f30c149617c..cd76e62b705 100644 --- a/app/assets/javascripts/admin/addon/components/webhook-status.gjs +++ b/app/assets/javascripts/admin/addon/components/webhook-status.gjs @@ -1,10 +1,8 @@ import Component from "@glimmer/component"; -import icon from "discourse-common/helpers/d-icon"; import { i18n } from "discourse-i18n"; export default class WebhookStatus extends Component { - iconNames = ["far-circle", "circle-xmark", "circle", "circle"]; - iconClasses = ["text-muted", "text-danger", "text-successful", "text-muted"]; + statusClasses = ["--inactive", "--critical", "--success", "--inactive"]; get status() { const lastStatus = this.args.webhook.get("last_delivery_status"); @@ -15,16 +13,17 @@ export default class WebhookStatus extends Component { return i18n(`admin.web_hooks.delivery_status.${this.status.name}`); } - get iconName() { - return this.iconNames[this.status.id - 1]; - } - - get iconClass() { - return this.iconClasses[this.status.id - 1]; + get statusClass() { + return this.statusClasses[this.status.id - 1]; } } diff --git a/app/assets/javascripts/admin/addon/templates/web-hooks-index.hbs b/app/assets/javascripts/admin/addon/templates/web-hooks-index.hbs index 064a246e90f..8427ce81f99 100644 --- a/app/assets/javascripts/admin/addon/templates/web-hooks-index.hbs +++ b/app/assets/javascripts/admin/addon/templates/web-hooks-index.hbs @@ -14,19 +14,34 @@ {{#if this.model}} - +
- - + + {{#each this.model as |webhook|}} - - + + + - - - {{/each}} diff --git a/app/assets/javascripts/discourse/tests/integration/components/webhook-status-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/webhook-status-test.gjs index 034828137ae..43d6343cc5a 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/webhook-status-test.gjs +++ b/app/assets/javascripts/discourse/tests/integration/components/webhook-status-test.gjs @@ -33,7 +33,7 @@ module("Integration | Component | webhook-status", function (hooks) { assert.dom().hasText("Failed"); }); - test("iconName", async function (assert) { + test("statusLabelClass", async function (assert) { const webhook = new CoreFabricators(getOwner(this)).webhook(); await render(); - assert.dom(".d-icon-far-circle").exists(); + assert.dom(".status-label").hasClass("--inactive"); webhook.set("last_delivery_status", 2); - await rerender(); + assert.dom(".status-label").hasClass("--critical"); - assert.dom(".d-icon-circle-xmark").exists(); - }); - - test("iconClass", async function (assert) { - const webhook = new CoreFabricators(getOwner(this)).webhook(); - await render(); - - assert.dom(".d-icon").hasClass("text-muted"); - - webhook.set("last_delivery_status", 2); - + webhook.set("last_delivery_status", 3); await rerender(); + assert.dom(".status-label").hasClass("--success"); - assert.dom(".d-icon").hasClass("text-danger"); + webhook.set("last_delivery_status", 4); + await rerender(); + assert.dom(".status-label").hasClass("--inactive"); }); }); diff --git a/app/assets/stylesheets/common/admin/admin_base.scss b/app/assets/stylesheets/common/admin/admin_base.scss index f06bd7f7522..52fb0b00497 100644 --- a/app/assets/stylesheets/common/admin/admin_base.scss +++ b/app/assets/stylesheets/common/admin/admin_base.scss @@ -3,7 +3,8 @@ $mobile-breakpoint: 700px; :root { - --space-1: 0.25rem; + --space-0: 0.125rem; //2px + --space-1: 0.25rem; //4px --space-2: calc(0.25rem * 2); --space-3: calc(0.25rem * 3); --space-4: calc(0.25rem * 4); diff --git a/app/assets/stylesheets/common/admin/admin_table.scss b/app/assets/stylesheets/common/admin/admin_table.scss index fa5d378b77a..1fb5876b86f 100644 --- a/app/assets/stylesheets/common/admin/admin_table.scss +++ b/app/assets/stylesheets/common/admin/admin_table.scss @@ -67,25 +67,27 @@ } } + // Default .status-label { --d-border-radius: var(--space-4); + --status-icon-diameter: 8px; display: flex; flex-wrap: nowrap; width: fit-content; background-color: var(--primary-low); - padding: var(--space-1) var(--space-2); + padding: var(--space-0) var(--space-2); border-radius: var(--d-border-radius); .status-label-indicator { display: inline-block; - width: 6px; - height: 6px; + width: var(--status-icon-diameter); + height: var(--status-icon-diameter); border-radius: 50%; background-color: var(--primary-high); flex-shrink: 0; margin-right: var(--space-1); - margin-top: 0.4rem; + margin-top: 0.35rem; } .status-label-text { @@ -93,6 +95,45 @@ font-size: var(--font-down-1); } } + + // Success badge + .status-label.--success { + background-color: var(--success-low); + + .status-label-indicator { + background-color: var(--success); + } + + .status-label-text { + color: var(--success-hover); + } + } + + // Critical badge + .status-label.--critical { + background-color: var(--danger-low); + + .status-label-indicator { + background-color: var(--danger); + } + + .status-label-text { + color: var(--danger-hover); + } + } + + // Inactive badge + .status-label.--inactive { + background-color: var(--primary-low); + + .status-label-indicator { + background-color: var(--primary-high); + } + + .status-label-text { + color: var(--primary-high); + } + } } .d-admin-row__overview { diff --git a/app/assets/stylesheets/common/admin/api.scss b/app/assets/stylesheets/common/admin/api.scss index f5ff0697b38..2c338bd1857 100644 --- a/app/assets/stylesheets/common/admin/api.scss +++ b/app/assets/stylesheets/common/admin/api.scss @@ -1,44 +1,24 @@ // Styles for admin/api -table.web-hooks.grid { - td.delivery-status { - div { - display: flex; - align-items: center; - } - .d-icon { - margin-right: 0.25em; - } - } - td.payload-url { +.d-admin-table.web-hooks { + .d-admin-row__overview.payload-url { word-wrap: break-word; - max-width: 55vw; - } - td.controls { - display: flex; - button { - margin-left: 0.25em; - } - } - @media screen and (min-width: 550px) { - tbody { - tr { - grid-template-columns: 0.5fr repeat(2, 1fr) 0.5fr; - } + max-width: 20vw; - td.controls { - text-align: right; - } + @include breakpoint(medium) { + max-width: 70vw; } } - @include breakpoint(mobile-extra-large) { - tbody { - tr { - grid-template-columns: 0.5fr 1fr; - } + + .d-admin-row__detail.description { + @include breakpoint(medium) { + display: block; } - td.controls { - grid-row: 2; + + .d-admin-row__mobile-label { + @include breakpoint(medium) { + display: block; + } } } }
{{i18n "admin.web_hooks.delivery_status.title"}} {{i18n "admin.web_hooks.payload_url"}} {{i18n "admin.web_hooks.description_label"}}{{i18n "admin.web_hooks.controls"}}{{i18n "admin.web_hooks.delivery_status.title"}}
+
+ + {{webhook.payload_url}} + + +
+ {{i18n "admin.web_hooks.description_label"}} +
+ {{webhook.description}} +
+
+ {{i18n "admin.web_hooks.delivery_status.title"}} +
+
- - {{webhook.payload_url}} - - {{webhook.description}} - - {{d-icon "far-pen-to-square"}} - + +
+ + {{d-icon "far-pen-to-square"}} + - + +