From 245ec7afe8b6313a03e1be3dd83340a453f8dda8 Mon Sep 17 00:00:00 2001 From: Kaz Wesley Date: Fri, 23 Feb 2024 12:10:43 -0800 Subject: [PATCH] Replace execution context controls with record mode controls (#9133) Closes #8673. Stacked on #9132. Before: ![image](https://github.com/enso-org/enso/assets/1047859/1b1ca9f4-eda9-45fd-bec1-cd7e255112fa) ![image](https://github.com/enso-org/enso/assets/1047859/b8cf6de1-d75c-48d0-ac0d-9e6e0c659dd4) After: ![image](https://github.com/enso-org/enso/assets/1047859/91d13862-96e7-4175-a61e-40aecd6d62b0) ![image](https://github.com/enso-org/enso/assets/1047859/ef20511f-00f2-4042-b4d4-97728817500b) # Important Notes - The model has been refactored from execution-modes (live/design) to record-mode (on/off) up to the point of the project store, where it's translated (since the backend still uses the live/design concepts). --- app/gui2/scripts/generateIconMetadata.js | 4 +- app/gui2/src/assets/icons.svg | 8 + .../src/components/ExecutionModeSelector.vue | 143 ------------------ app/gui2/src/components/GraphEditor.vue | 10 +- app/gui2/src/components/RecordControl.vue | 61 ++++++++ app/gui2/src/components/TopBar.vue | 18 +-- app/gui2/src/stores/project/index.ts | 10 ++ app/gui2/stories/TopBar.story.vue | 13 +- 8 files changed, 98 insertions(+), 169 deletions(-) delete mode 100644 app/gui2/src/components/ExecutionModeSelector.vue create mode 100644 app/gui2/src/components/RecordControl.vue diff --git a/app/gui2/scripts/generateIconMetadata.js b/app/gui2/scripts/generateIconMetadata.js index 06e5f056e6..ab755ef1c2 100644 --- a/app/gui2/scripts/generateIconMetadata.js +++ b/app/gui2/scripts/generateIconMetadata.js @@ -11,8 +11,8 @@ console.info('Writing icon name type to "./src/util/iconName.ts"...') await fs.writeFile( './src/util/iconName.ts', `\ -// Generated by \`scripts/generateIcons.js\`. -// Please run \`npm run generate\` to regenerate this file whenever \`icons.svg\` is changed. +// Generated by \`scripts/generateIconMetadata.js\`. +// Please run \`npm run generate-metadata\` to regenerate this file whenever \`icons.svg\` is changed. import iconNames from '@/util/iconList.json' export type Icon = diff --git a/app/gui2/src/assets/icons.svg b/app/gui2/src/assets/icons.svg index 03a7486e5a..848cee9ef9 100644 --- a/app/gui2/src/assets/icons.svg +++ b/app/gui2/src/assets/icons.svg @@ -676,6 +676,14 @@ + + + + + + + + diff --git a/app/gui2/src/components/ExecutionModeSelector.vue b/app/gui2/src/components/ExecutionModeSelector.vue deleted file mode 100644 index 9573bb73ad..0000000000 --- a/app/gui2/src/components/ExecutionModeSelector.vue +++ /dev/null @@ -1,143 +0,0 @@ - - - - - diff --git a/app/gui2/src/components/GraphEditor.vue b/app/gui2/src/components/GraphEditor.vue index 3e0b868152..789926de7f 100644 --- a/app/gui2/src/components/GraphEditor.vue +++ b/app/gui2/src/components/GraphEditor.vue @@ -38,7 +38,6 @@ import { computed, onMounted, onScopeDispose, onUnmounted, ref, watch } from 'vu import { ProjectManagerEvents } from '../../../ide-desktop/lib/dashboard/src/utilities/ProjectManager' import { type Usage } from './ComponentBrowser/input' -const EXECUTION_MODES = ['design', 'live'] // Assumed size of a newly created node. This is used to place the component browser. const DEFAULT_NODE_SIZE = new Vec2(0, 24) const gapBetweenNodes = 48.0 @@ -334,8 +333,8 @@ const codeEditorHandler = codeEditorBindings.handler({ }, }) -/** Track play button presses. */ -function onPlayButtonPress() { +/** Handle record-once button presses. */ +function onRecordOnceButtonPress() { projectStore.lsRpcConnection.then(async () => { const modeValue = projectStore.executionMode if (modeValue == undefined) { @@ -657,8 +656,7 @@ function handleEdgeDrop(source: AstId, position: Vec2) { @canceled="onComponentBrowserCancel" /> +import SvgIcon from '@/components/SvgIcon.vue' +import ToggleIcon from '@/components/ToggleIcon.vue' + +const props = defineProps<{ recordMode: boolean }>() +const emit = defineEmits<{ recordOnce: []; 'update:recordMode': [enabled: boolean] }>() + + + + + diff --git a/app/gui2/src/components/TopBar.vue b/app/gui2/src/components/TopBar.vue index 70ae9973a6..772f6dd090 100644 --- a/app/gui2/src/components/TopBar.vue +++ b/app/gui2/src/components/TopBar.vue @@ -1,25 +1,24 @@ @@ -15,21 +14,19 @@ const breadcrumbs = ref(['main', 'ad_analytics'])