Remove builderData usage

This commit is contained in:
Adria Navarro 2024-10-23 16:37:46 +02:00
parent a24728394f
commit 7901c2d4ac
4 changed files with 3 additions and 25 deletions

View File

@ -112,7 +112,7 @@
iconColor={automation.disabled iconColor={automation.disabled
? "var(--spectrum-global-color-gray-600)" ? "var(--spectrum-global-color-gray-600)"
: "var(--spectrum-global-color-gray-900)"} : "var(--spectrum-global-color-gray-900)"}
text={automation.displayName} text={automation.name}
selected={automation._id === $selectedAutomation?._id} selected={automation._id === $selectedAutomation?._id}
hovering={automation._id === $contextMenuStore.id} hovering={automation._id === $contextMenuStore.id}
on:click={() => automationStore.actions.select(automation._id)} on:click={() => automationStore.actions.select(automation._id)}

View File

@ -25,15 +25,9 @@
automation.name.toLowerCase().includes(searchString.toLowerCase()) automation.name.toLowerCase().includes(searchString.toLowerCase())
) )
}) })
.map(automation => ({
...automation,
displayName:
$automationStore.automationDisplayData[automation._id]?.displayName ||
automation.name,
}))
.sort((a, b) => { .sort((a, b) => {
const lowerA = a.displayName.toLowerCase() const lowerA = a.name.toLowerCase()
const lowerB = b.displayName.toLowerCase() const lowerB = b.name.toLowerCase()
return lowerA > lowerB ? 1 : -1 return lowerA > lowerB ? 1 : -1
}) })

View File

@ -23,7 +23,6 @@ const initialAutomationState = {
ACTION: {}, ACTION: {},
}, },
selectedAutomationId: null, selectedAutomationId: null,
automationDisplayData: {},
} }
// If this functions, remove the actions elements // If this functions, remove the actions elements
@ -91,7 +90,6 @@ const automationActions = store => ({
state.automations.sort((a, b) => { state.automations.sort((a, b) => {
return a.name < b.name ? -1 : 1 return a.name < b.name ? -1 : 1
}) })
state.automationDisplayData = automationResponse.builderData
state.blockDefinitions = getFinalDefinitions( state.blockDefinitions = getFinalDefinitions(
definitions.trigger, definitions.trigger,
definitions.action definitions.action
@ -153,8 +151,6 @@ const automationActions = store => ({
state.selectedAutomationId = state.automations[0]?._id || null state.selectedAutomationId = state.automations[0]?._id || null
} }
// Clear out automationDisplayData for the automation
delete state.automationDisplayData[automation._id]
return state return state
}) })
}, },
@ -432,13 +428,3 @@ export const selectedAutomation = derived(automationStore, $automationStore => {
x => x._id === $automationStore.selectedAutomationId x => x._id === $automationStore.selectedAutomationId
) )
}) })
export const selectedAutomationDisplayData = derived(
[automationStore, selectedAutomation],
([$automationStore, $selectedAutomation]) => {
if (!$selectedAutomation?._id) {
return null
}
return $automationStore.automationDisplayData[$selectedAutomation._id]
}
)

View File

@ -11,7 +11,6 @@ import {
automationStore, automationStore,
selectedAutomation, selectedAutomation,
automationHistoryStore, automationHistoryStore,
selectedAutomationDisplayData,
} from "./automations.js" } from "./automations.js"
import { userStore, userSelectedResourceMap, isOnlyUser } from "./users.js" import { userStore, userSelectedResourceMap, isOnlyUser } from "./users.js"
import { deploymentStore } from "./deployments.js" import { deploymentStore } from "./deployments.js"
@ -46,7 +45,6 @@ export {
previewStore, previewStore,
automationStore, automationStore,
selectedAutomation, selectedAutomation,
selectedAutomationDisplayData,
automationHistoryStore, automationHistoryStore,
sortedScreens, sortedScreens,
userStore, userStore,