diff --git a/webapp/src/apiService/mock.ts b/webapp/src/apiService/mock.ts index 41eba76..23deb44 100644 --- a/webapp/src/apiService/mock.ts +++ b/webapp/src/apiService/mock.ts @@ -73,7 +73,7 @@ export const useMockAPI = ( ...auto, source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], }, ]; return { diff --git a/webapp/src/components/AutomationEditor/AutoInfoBox.stories.tsx b/webapp/src/components/AutomationEditor/AutoInfoBox.stories.tsx index 0cfb517..6944315 100644 --- a/webapp/src/components/AutomationEditor/AutoInfoBox.stories.tsx +++ b/webapp/src/components/AutomationEditor/AutoInfoBox.stories.tsx @@ -46,7 +46,7 @@ export const NoTags = make({ mode: "single", source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], }, }); @@ -65,6 +65,6 @@ export const SomeTags = make({ mode: "single", source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], }, }); diff --git a/webapp/src/components/AutomationEditor/index.stories.tsx b/webapp/src/components/AutomationEditor/index.stories.tsx index ea0ebc2..d0d2162 100644 --- a/webapp/src/components/AutomationEditor/index.stories.tsx +++ b/webapp/src/components/AutomationEditor/index.stories.tsx @@ -55,7 +55,7 @@ Simple.args = { mode: "single", source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], trigger: [ { platform: "numeric_state", @@ -107,7 +107,7 @@ EmptyStart.args = { description: "Example Metadata", source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], trigger_variables: { wowo: "!", }, @@ -139,7 +139,7 @@ BadAutomationInvalidTriggers.args = { description: "Example Metadata", source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], trigger_variables: { wowo: "!", }, @@ -180,7 +180,7 @@ RepeatExample.args = { mode: "single", source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], trigger: [ { type: "opened", diff --git a/webapp/src/components/AutomationManager/ListBoxGroup/index.stories.tsx b/webapp/src/components/AutomationManager/ListBoxGroup/index.stories.tsx index 3570ce9..1cd91b8 100644 --- a/webapp/src/components/AutomationManager/ListBoxGroup/index.stories.tsx +++ b/webapp/src/components/AutomationManager/ListBoxGroup/index.stories.tsx @@ -28,7 +28,7 @@ const { make, componentMeta } = makeStory({ state: "on", source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], flags: { isSelected: false, isModified: false, @@ -42,7 +42,7 @@ const { make, componentMeta } = makeStory({ state: "on", source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], flags: { isSelected: false, isModified: false, @@ -92,7 +92,7 @@ export const Nested = make({ state: "on", source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], flags: { isSelected: true, isModified: false, @@ -107,7 +107,7 @@ export const Nested = make({ state: "off", source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], flags: { isSelected: false, isModified: false, @@ -122,7 +122,7 @@ export const Nested = make({ state: "offing", source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], flags: { isSelected: false, isModified: false, @@ -163,7 +163,7 @@ export const Nested = make({ }, source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], state: "on", tags: { type: "good", diff --git a/webapp/src/components/AutomationManager/Loaded/automationDB.ts b/webapp/src/components/AutomationManager/Loaded/automationDB.ts index ebe9bd6..7f44d0f 100644 --- a/webapp/src/components/AutomationManager/Loaded/automationDB.ts +++ b/webapp/src/components/AutomationManager/Loaded/automationDB.ts @@ -60,7 +60,7 @@ export const useAutomationDB = ( isNew: true, source_file: "n/a", source_file_type: "n/a", - configuration_key: "n/a", + configuration_key: ["n/a"], }, auto, ]); @@ -97,7 +97,7 @@ const genMapping = ( let found: AutomationData | null = null; let source_file = "n/a"; let source_file_type = "n/a"; - let configuration_key = "n/a"; + let configuration_key = ["n/a"]; if (configData[autoId]) { found = configData[entityData.attributes.id]; title = found.alias ?? title; diff --git a/webapp/src/components/AutomationManager/Sidebar/index.stories.tsx b/webapp/src/components/AutomationManager/Sidebar/index.stories.tsx index bde5485..d7283b9 100644 --- a/webapp/src/components/AutomationManager/Sidebar/index.stories.tsx +++ b/webapp/src/components/AutomationManager/Sidebar/index.stories.tsx @@ -70,7 +70,7 @@ const story = makeStory({ state: "on", source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], }, ]); setSelAutoId(id); @@ -99,7 +99,7 @@ const makeAuto = ( tags: {}, source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], ...data, }; }; diff --git a/webapp/src/components/AutomationManager/automationGrouper.test.ts b/webapp/src/components/AutomationManager/automationGrouper.test.ts index f5d8612..ab668cb 100644 --- a/webapp/src/components/AutomationManager/automationGrouper.test.ts +++ b/webapp/src/components/AutomationManager/automationGrouper.test.ts @@ -42,7 +42,7 @@ const automations: AutomationManagerAuto[] = [ isSelected: false, source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], })); const bigList = bigMockAutoList.map((a) => ({ @@ -55,7 +55,7 @@ const bigList = bigMockAutoList.map((a) => ({ isSelected: false, source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], })); test("no grouping", () => { diff --git a/webapp/src/components/AutomationManager/index.stories.tsx b/webapp/src/components/AutomationManager/index.stories.tsx index 99b4c06..942b842 100644 --- a/webapp/src/components/AutomationManager/index.stories.tsx +++ b/webapp/src/components/AutomationManager/index.stories.tsx @@ -156,7 +156,7 @@ export const BadAutomation = make({ description: "", source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], trigger: [ { platform: "sun", diff --git a/webapp/src/components/AutomationManager/types.ts b/webapp/src/components/AutomationManager/types.ts index 2025618..739f5da 100644 --- a/webapp/src/components/AutomationManager/types.ts +++ b/webapp/src/components/AutomationManager/types.ts @@ -11,7 +11,7 @@ export type AutomationManagerAuto = AutomationManagerAutoUpdatable & { isNew?: boolean; source_file: string; source_file_type: string; - configuration_key: string; + configuration_key: string[]; }; export type AutomationManagerAutoItem = AutomationManagerAuto & { flags: AutomationManagerItemFlags; diff --git a/webapp/src/types/validators/autmation.ts b/webapp/src/types/validators/autmation.ts index e70d31d..6d36e2b 100644 --- a/webapp/src/types/validators/autmation.ts +++ b/webapp/src/types/validators/autmation.ts @@ -12,7 +12,7 @@ export const AutomationData = st.object({ source_file: st.optional(st.string()), source_file_type: st.optional(st.string()), - configuration_key: st.optional(st.string()), + configuration_key: st.optional(st.array(st.string())), trigger: st.array(st.object()), condition: st.array(st.object()), diff --git a/webapp/src/types/validators/metadata.ts b/webapp/src/types/validators/metadata.ts index 51d8293..7953828 100644 --- a/webapp/src/types/validators/metadata.ts +++ b/webapp/src/types/validators/metadata.ts @@ -13,5 +13,5 @@ export const AutomationMetadata = st.object({ export const AutomationShortumationMetadata = st.object({ source_file: st.string(), source_file_type: st.string(), - configuration_key: st.string(), + configuration_key: st.array(st.string()), }); diff --git a/webapp/src/utils/mocks.ts b/webapp/src/utils/mocks.ts index cb70bef..81c826e 100644 --- a/webapp/src/utils/mocks.ts +++ b/webapp/src/utils/mocks.ts @@ -18,7 +18,7 @@ export const createMockAuto = ({ condition: [], source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], trigger: [ { platform: "numeric_state", @@ -87,7 +87,7 @@ export const bigMockAutoList: AutomationData[] = [ mode: "single", source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], trigger: [ { device_id: "asdasdasdas", @@ -239,7 +239,7 @@ export const bigMockAutoList: AutomationData[] = [ mode: "single", source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], trigger: [ { platform: "device", @@ -282,7 +282,7 @@ export const bigMockAutoList: AutomationData[] = [ mode: "single", source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], trigger: [ { platform: "state", @@ -417,7 +417,7 @@ export const bigMockAutoList: AutomationData[] = [ mode: "single", source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], trigger: [ { platform: "time", @@ -480,7 +480,7 @@ export const bigMockAutoList: AutomationData[] = [ mode: "single", source_file: "automation.yaml", source_file_type: "list", - configuration_key: "automation", + configuration_key: ["automation"], tags: {}, trigger: [ {