From 44031da7b1aec32a36e8f6ab363db4f62db1db6f Mon Sep 17 00:00:00 2001 From: Jeppe Bundgaard Date: Tue, 24 Mar 2026 11:22:36 +0100 Subject: [PATCH] Add support for `CompanyID` in Workfeed configuration and update localization files: - Extend i18n locales to include `company_id` and `company_id_desc` strings for API synchronization. - Add `CompanyID` field to Workfeed configuration UI in `ConfigurationWorkfeed.vue`. - Update unit and e2e tests to validate `CompanyID` functionality. - Adjust Workfeed module logic to handle `CompanyID` get/set operations. --- .../session/token/superUser/modules/workfeed/Config.vue | 8 ++++++++ src/i18n/locales/da.json | 4 +++- src/i18n/locales/de.json | 4 +++- src/i18n/locales/en.json | 4 +++- src/i18n/locales/no.json | 4 +++- src/i18n/locales/sv.json | 4 +++- .../configuration/ConfigurationWorkfeed.vue | 9 +++++++++ tests/e2e/support/network.js | 1 + tests/e2e/workfeed-config.smoke.spec.js | 2 ++ tests/unit/workfeed-i18n.spec.js | 2 ++ tests/unit/workfeed-module.spec.js | 6 ++++++ 11 files changed, 43 insertions(+), 5 deletions(-) diff --git a/src/components/session/token/superUser/modules/workfeed/Config.vue b/src/components/session/token/superUser/modules/workfeed/Config.vue index 5e86596d..4629ab0e 100644 --- a/src/components/session/token/superUser/modules/workfeed/Config.vue +++ b/src/components/session/token/superUser/modules/workfeed/Config.vue @@ -44,6 +44,14 @@ export const Config = { return Config.set("api_key", value); }, }, + companyId: { + get: async () => { + return Config.get("CompanyID"); + }, + set: async (value) => { + return Config.set("CompanyID", value); + }, + }, }, enabled: { get: async () => { diff --git a/src/i18n/locales/da.json b/src/i18n/locales/da.json index fc316a63..d503ab13 100644 --- a/src/i18n/locales/da.json +++ b/src/i18n/locales/da.json @@ -1188,7 +1188,9 @@ "result_shifts": "Shift lookup result", "result_employee": "Employee result", "result_shift": "Shift result" - } + }, + "company_id": "Company ID", + "company_id_desc": "The Workfeed company identifier used for API synchronization." } }, "customer_creation": { diff --git a/src/i18n/locales/de.json b/src/i18n/locales/de.json index c512dfa0..07365b2f 100644 --- a/src/i18n/locales/de.json +++ b/src/i18n/locales/de.json @@ -1188,7 +1188,9 @@ "result_shifts": "Shift lookup result", "result_employee": "Employee result", "result_shift": "Shift result" - } + }, + "company_id": "Company ID", + "company_id_desc": "The Workfeed company identifier used for API synchronization." } }, "customer_creation": { diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 35da69e5..772c3ade 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -1188,7 +1188,9 @@ "result_shifts": "Shift lookup result", "result_employee": "Employee result", "result_shift": "Shift result" - } + }, + "company_id": "Company ID", + "company_id_desc": "The Workfeed company identifier used for API synchronization." } }, "customer_creation": { diff --git a/src/i18n/locales/no.json b/src/i18n/locales/no.json index f4399dc7..408283fb 100644 --- a/src/i18n/locales/no.json +++ b/src/i18n/locales/no.json @@ -1183,7 +1183,9 @@ "result_shifts": "Shift lookup result", "result_employee": "Employee result", "result_shift": "Shift result" - } + }, + "company_id": "Company ID", + "company_id_desc": "The Workfeed company identifier used for API synchronization." } }, "customer_creation": { diff --git a/src/i18n/locales/sv.json b/src/i18n/locales/sv.json index 940db41f..b73aa7d0 100644 --- a/src/i18n/locales/sv.json +++ b/src/i18n/locales/sv.json @@ -1183,7 +1183,9 @@ "result_shifts": "Shift lookup result", "result_employee": "Employee result", "result_shift": "Shift result" - } + }, + "company_id": "Company ID", + "company_id_desc": "The Workfeed company identifier used for API synchronization." } }, "customer_creation": { diff --git a/src/views/dashboards/superUserDashboard/configuration/ConfigurationWorkfeed.vue b/src/views/dashboards/superUserDashboard/configuration/ConfigurationWorkfeed.vue index 8caef1b9..2fd31493 100644 --- a/src/views/dashboards/superUserDashboard/configuration/ConfigurationWorkfeed.vue +++ b/src/views/dashboards/superUserDashboard/configuration/ConfigurationWorkfeed.vue @@ -206,6 +206,15 @@ onMounted(async () => { :value="getModuleConfigValue('api_url')" :on-save="SessionUser.superUser.modules.workfeed.config.keys.api_url.set" /> + { await expect(page.locator("body")).toContainText("Workfeed configuration"); await expandCategory(page, "General settings"); await expect(page.locator("body")).toContainText("Enable Workfeed"); + await expandCategory(page, "API connection settings"); + await expect(page.locator("body")).toContainText("Company ID"); await expandCategory(page, "Diagnostics"); await expect(page.locator('[data-testid="workfeed-diagnostics-list-departments"]:visible').first()).toBeVisible(); diff --git a/tests/unit/workfeed-i18n.spec.js b/tests/unit/workfeed-i18n.spec.js index 65d46d34..384c9615 100644 --- a/tests/unit/workfeed-i18n.spec.js +++ b/tests/unit/workfeed-i18n.spec.js @@ -49,6 +49,8 @@ describe("workfeed i18n coverage", () => { "enable", "api_settings", "api_url", + "company_id", + "company_id_desc", "api_key", "close", "lookup", diff --git a/tests/unit/workfeed-module.spec.js b/tests/unit/workfeed-module.spec.js index 8ceb139a..77bdc4b7 100644 --- a/tests/unit/workfeed-module.spec.js +++ b/tests/unit/workfeed-module.spec.js @@ -55,9 +55,11 @@ describe("workfeed config contract", () => { expect(workfeedConfigSource).toContain('Config.get("enabled")'); expect(workfeedConfigSource).toContain('Config.get("api_url")'); expect(workfeedConfigSource).toContain('Config.get("api_key")'); + expect(workfeedConfigSource).toContain('Config.get("CompanyID")'); expect(workfeedConfigSource).toContain('Config.set("enabled", enabled)'); expect(workfeedConfigSource).toContain('Config.set("api_url", value)'); expect(workfeedConfigSource).toContain('Config.set("api_key", value)'); + expect(workfeedConfigSource).toContain('Config.set("CompanyID", value)'); }); }); @@ -67,6 +69,7 @@ describe("workfeed config page contract", () => { expect(workfeedPageSource).toContain("$t('configuration.workfeed.subtitle')"); expect(workfeedPageSource).toContain("$t('configuration.workfeed.enable')"); expect(workfeedPageSource).toContain("$t('configuration.workfeed.api_url')"); + expect(workfeedPageSource).toContain("$t('configuration.workfeed.company_id')"); expect(workfeedPageSource).toContain("$t('configuration.workfeed.api_key')"); expect(workfeedPageSource).toContain( ":on-switch=\"SessionUser.superUser.modules.workfeed.config.enabled.set\"" @@ -74,6 +77,9 @@ describe("workfeed config page contract", () => { expect(workfeedPageSource).toContain( ":on-save=\"SessionUser.superUser.modules.workfeed.config.keys.api_url.set\"" ); + expect(workfeedPageSource).toContain( + ":on-save=\"SessionUser.superUser.modules.workfeed.config.keys.companyId.set\"" + ); expect(workfeedPageSource).toContain( ":on-save=\"SessionUser.superUser.modules.workfeed.config.keys.api_key.set\"" );