100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
or-scheduler: hide scheduler time fields (#2478)
Koen06d67278ed0e
diff --git a/ui/component/or-scheduler/src/index.ts b/ui/component/or-scheduler/src/index.tsindex d1bc15ba1..2c787e974 100644--- a/ui/component/or-scheduler/src/index.ts+++ b/ui/component/or-scheduler/src/index.ts@@ -75,7 +75,6 @@ declare global {@customElement("or-scheduler")export class OrScheduler extends translate(i18next)(LitElement) {-@property({ type: Object })public defaultSchedule?: CalendarEvent;@@ -525,13 +524,13 @@ export class OrScheduler extends translate(i18next)(LitElement) {<div id="period" class="section"><label class="title"><or-translate value="period"></or-translate></label><div style="display: flex; gap: 8px;" class="layout horizontal">- <div>- <or-mwc-input value="${moment(calendar.start).format("YYYY-MM-DD")}" .type="${InputType.DATE}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "start")}" .label="${i18next.t("from")}"></or-mwc-input>- <or-mwc-input .disabled=${this.isAllDay} .value="${moment(calendar.start).format("HH:mm")}" .type="${InputType.TIME}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "start-time")}" .label="${i18next.t("from")}"></or-mwc-input>+ <div style="display: flex; flex: 1; gap: 4px">+ <or-mwc-input style="flex: 1" value="${moment(calendar.start).format("YYYY-MM-DD")}" .type="${InputType.DATE}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "start")}" .label="${i18next.t("from")}"></or-mwc-input>+ <or-mwc-input ?hidden=${this.isAllDay} .value="${moment(calendar.start).format("HH:mm")}" .type="${InputType.TIME}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "start-time")}" .label="${i18next.t("from")}"></or-mwc-input></div>- <div>- <or-mwc-input .value="${moment(calendar.end).format("YYYY-MM-DD")}" .type="${InputType.DATE}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "end")}" .label="${i18next.t("to")}"></or-mwc-input>- <or-mwc-input .disabled=${this.isAllDay} .value="${moment(calendar.end).format("HH:mm")}" .type="${InputType.TIME}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "end-time")}" .label="${i18next.t("to")}"></or-mwc-input>+ <div style="display: flex; flex: 1; gap: 4px">+ <or-mwc-input style="flex: 1" .value="${moment(calendar.end).format("YYYY-MM-DD")}" .type="${InputType.DATE}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "end")}" .label="${i18next.t("to")}"></or-mwc-input>+ <or-mwc-input ?hidden=${this.isAllDay} .value="${moment(calendar.end).format("HH:mm")}" .type="${InputType.TIME}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "end-time")}" .label="${i18next.t("to")}"></or-mwc-input></div></div>diff --git a/ui/component/or-scheduler/test/or-scheduler.test.ts b/ui/component/or-scheduler/test/or-scheduler.test.tsindex 0d4f4e702..7178dc4c3 100644--- a/ui/component/or-scheduler/test/or-scheduler.test.ts+++ b/ui/component/or-scheduler/test/or-scheduler.test.ts@@ -121,9 +121,9 @@ ct.describe("Period event type should", () => {await expect(dialog.locator("#period")).toBeVisible();await expect(dialog.locator("label", { hasText: "from" })).toHaveCount(2);- await expect(dialog.locator("label", { hasText: "from" }).last()).toBeDisabled();+ await expect(dialog.locator("label", { hasText: "from" }).last()).toBeHidden();await expect(dialog.locator("label", { hasText: "to" })).toHaveCount(2);- await expect(dialog.locator("label", { hasText: "to" }).last()).toBeDisabled();+ await expect(dialog.locator("label", { hasText: "to" }).last()).toBeHidden();await expect(dialog.getByRole("checkbox", { checked: true, name: "All day" })).toBeVisible();await expect(dialog.locator("#recurrence")).not.toBeVisible();@@ -162,9 +162,9 @@ ct.describe("Period event type should", () => {await selectEventType("Plan an occurrence", dialog, mwcInput);await dialog.getByRole("checkbox", { name: "All day" }).uncheck();- await expect(dialog.locator("label", { hasText: "from" }).last()).toBeEnabled();+ await expect(dialog.locator("label", { hasText: "from" }).last()).toBeVisible();await dialog.locator("label", { hasText: "from" }).last().fill("09:00");- await expect(dialog.locator("label", { hasText: "to" }).last()).toBeEnabled();+ await expect(dialog.locator("label", { hasText: "to" }).last()).toBeVisible();await dialog.locator("label", { hasText: "to" }).last().fill("18:00");await dialog.getByRole("button", { name: "apply" }).click();@@ -195,9 +195,9 @@ ct.describe("Recurrence event type should", () => {await expect(dialog.locator("#period")).toBeVisible();await expect(dialog.locator("label", { hasText: "from" })).toHaveCount(2);- await expect(dialog.locator("label", { hasText: "from" }).last()).toBeDisabled();+ await expect(dialog.locator("label", { hasText: "from" }).last()).toBeHidden();await expect(dialog.locator("label", { hasText: "to" })).toHaveCount(2);- await expect(dialog.locator("label", { hasText: "to" }).last()).toBeDisabled();+ await expect(dialog.locator("label", { hasText: "to" }).last()).toBeHidden();await expect(dialog.getByRole("checkbox", { checked: true, name: "All day" })).toBeVisible();await expect(dialog.locator("#recurrence")).toBeVisible();@@ -275,9 +275,9 @@ ct.describe("Recurrence event type should", () => {await selectEventType("Plan a repeating occurrence", dialog, mwcInput);await dialog.getByRole("checkbox", { name: "All day" }).uncheck();- await expect(dialog.locator("label", { hasText: "from" }).last()).toBeEnabled();+ await expect(dialog.locator("label", { hasText: "from" }).last()).toBeVisible();await dialog.locator("label", { hasText: "from" }).last().fill("09:00");- await expect(dialog.locator("label", { hasText: "to" }).last()).toBeEnabled();+ await expect(dialog.locator("label", { hasText: "to" }).last()).toBeVisible();await dialog.locator("label", { hasText: "to" }).last().fill("18:00");await dialog.getByRole("button", { name: "apply" }).click();