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
? "var(--spectrum-global-color-gray-600)"
: "var(--spectrum-global-color-gray-900)"}
text={automation.displayName}
text={automation.name}
selected={automation._id === $selectedAutomation?._id}
hovering={automation._id === $contextMenuStore.id}
on:click={() => automationStore.actions.select(automation._id)}

View File

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

View File

@ -23,7 +23,6 @@ const initialAutomationState = {
ACTION: {},
},
selectedAutomationId: null,
automationDisplayData: {},
}
// If this functions, remove the actions elements
@ -91,7 +90,6 @@ const automationActions = store => ({
state.automations.sort((a, b) => {
return a.name < b.name ? -1 : 1
})
state.automationDisplayData = automationResponse.builderData
state.blockDefinitions = getFinalDefinitions(
definitions.trigger,
definitions.action
@ -153,8 +151,6 @@ const automationActions = store => ({
state.selectedAutomationId = state.automations[0]?._id || null
}
// Clear out automationDisplayData for the automation
delete state.automationDisplayData[automation._id]
return state
})
},
@ -432,13 +428,3 @@ export const selectedAutomation = derived(automationStore, $automationStore => {
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,
selectedAutomation,
automationHistoryStore,
selectedAutomationDisplayData,
} from "./automations.js"
import { userStore, userSelectedResourceMap, isOnlyUser } from "./users.js"
import { deploymentStore } from "./deployments.js"
@ -46,7 +45,6 @@ export {
previewStore,
automationStore,
selectedAutomation,
selectedAutomationDisplayData,
automationHistoryStore,
sortedScreens,
userStore,