diff --git a/app/gui2/src/components/GraphEditor/GraphNode.vue b/app/gui2/src/components/GraphEditor/GraphNode.vue index ef5e43f09d..d30b102a3f 100644 --- a/app/gui2/src/components/GraphEditor/GraphNode.vue +++ b/app/gui2/src/components/GraphEditor/GraphNode.vue @@ -8,7 +8,7 @@ import { injectGraphSelection } from '@/providers/graphSelection' import { useGraphStore, type Node } from '@/stores/graph' import { useApproach } from '@/util/animation' import { usePointer, useResizeObserver } from '@/util/events' -import { methodNameToIcon, typeNameToIcon } from '@/util/getIconName' +import { mapOldIconName, typeNameToIcon } from '@/util/getIconName' import type { Opt } from '@/util/opt' import { Rect } from '@/util/rect' import { Vec2 } from '@/util/vec2' @@ -124,15 +124,14 @@ const suggestionEntry = computed(() => graph.db.nodeMainSuggestion.lookup(nodeId const color = computed(() => graph.db.getNodeColorStyle(nodeId.value)) const icon = computed(() => { if (suggestionEntry.value?.iconName) { - return suggestionEntry.value.iconName + return mapOldIconName(suggestionEntry.value.iconName) } + const methodName = expressionInfo.value?.methodCall?.methodPointer.name - if (methodName != null) { - return methodNameToIcon(methodName) - } else if (outputTypeName.value != null) { + if (methodName == null && outputTypeName.value != null) { return typeNameToIcon(outputTypeName.value) } else { - return 'in_out' + return 'enso_logo' } }) diff --git a/app/gui2/src/util/getIconName.ts b/app/gui2/src/util/getIconName.ts index c6825f9347..c27c5bd498 100644 --- a/app/gui2/src/util/getIconName.ts +++ b/app/gui2/src/util/getIconName.ts @@ -1,28 +1,37 @@ import type { Icon } from '@/util/iconName' -const methodNameToIconLookup: Record = { +const oldIconNameToNewIconNameLookup: Record = { /* eslint-disable camelcase */ - read: 'text', - join: 'join3', - union: 'union', - set: 'edit', - filter: 'preparation', - add_columns: 'add_column', - add_rows: 'add_row', - remove_columns: 'remove_column', - remove_rows: 'remove_row', + dataframe_clean: 'clean_dataframe', + dataframe_map_row: 'map_row', + dataframe_map_column: 'add_column', + dataframes_join: 'join3', + dataframes_union: 'union', + sigma: 'transform4', + io: 'in_out', + date_and_time: 'time', + spatial: 'location', + predictive: 'predict', + machine_learning: 'robot', /* eslint-enable camelcase */ } -export function methodNameToIcon(methodName: string): Icon { - return methodNameToIconLookup[methodName] ?? 'in_out' +export function mapOldIconName(oldIconName: string): Icon { + const mappedName = oldIconNameToNewIconNameLookup[oldIconName] ?? oldIconName + return mappedName as Icon } const typeNameToIconLookup: Record = { - 'Standard.Base.Data.Table.Table': 'array_new', - 'Standard.Base.Data.Vector.Vector': 'array_new2', + 'Standard.Base.Data.Text.Text': 'text_input', + 'Standard.Base.Data.Numbers.Integer': 'number_input', + 'Standard.Base.Data.Numbers.Float': 'number_input', + 'Standard.Base.Data.Array.Array': 'array_new', + 'Standard.Base.Data.Vector.Vector': 'array_new', + 'Standard.Base.Data.Time.Date.Date': 'calendar', + 'Standard.Base.Data.Time.Date_Time.Date_Time': 'calendar', + 'Standard.Base.Data.Time.Time_Of_Day.Time_Of_Day': 'time', } export function typeNameToIcon(typeName: string): Icon { - return typeNameToIconLookup[typeName] ?? 'in_out' + return typeNameToIconLookup[typeName] ?? 'enso_logo' }