Skip to content

Commit

Permalink
Rename OutputContext to Recording
Browse files Browse the repository at this point in the history
  • Loading branch information
somebody1234 committed Feb 27, 2024
1 parent 432533d commit 81c357f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app/gui2/src/components/CircularMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import SvgIcon from '@/components/SvgIcon.vue'
import ToggleIcon from '@/components/ToggleIcon.vue'
const props = defineProps<{
isOutputContextEnabledGlobally: boolean
isRecordingEnabledGlobally: boolean
isRecordingOverridden: boolean
isDocsVisible: boolean
isVisualizationVisible: boolean
Expand Down Expand Up @@ -42,7 +42,7 @@ const emit = defineEmits<{
class="icon-container button slot7"
:class="{ 'output-context-overridden': props.isRecordingOverridden }"
:alt="`${
props.isOutputContextEnabledGlobally != props.isRecordingOverridden ? 'Disable' : 'Enable'
props.isRecordingEnabledGlobally != props.isRecordingOverridden ? 'Disable' : 'Enable'
} output context`"
:modelValue="props.isRecordingOverridden"
@update:modelValue="emit('update:isRecordingOverridden', $event)"
Expand Down
9 changes: 4 additions & 5 deletions app/gui2/src/components/GraphEditor/GraphNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,16 @@ const dragPointer = usePointer((pos, event, type) => {
const isRecordingOverridden = computed({
get() {
console.log(':o', props.node.prefixes.enableOutputContext)
return props.node.prefixes.enableOutputContext != null
return props.node.prefixes.enableRecording != null
},
set(shouldOverride) {
const edit = props.node.innerExpr.module.edit()
const replacement =
shouldOverride && !projectStore.isOutputContextEnabled
shouldOverride && !projectStore.isRecordingEnabled
? [Ast.TextLiteral.new(projectStore.executionMode, edit)]
: undefined
console.log('...', shouldOverride, replacement)
prefixes.modify(edit.getVersion(props.node.innerExpr), { enableOutputContext: replacement })
prefixes.modify(edit.getVersion(props.node.innerExpr), { enableRecording: replacement })
graph.commitEdit(edit)
},
})
Expand Down Expand Up @@ -366,7 +365,7 @@ function openFullMenu() {
v-if="menuVisible === MenuState.Full || menuVisible === MenuState.Partial"
v-model:isRecordingOverridden="isRecordingOverridden"
v-model:isDocsVisible="isDocsVisible"
:isOutputContextEnabledGlobally="projectStore.isOutputContextEnabled"
:isRecordingEnabledGlobally="projectStore.isRecordingEnabled"
:isVisualizationVisible="isVisualizationVisible"
:isFullMenuVisible="menuVisible === MenuState.Full"
@update:isVisualizationVisible="emit('update:visualizationVisible', $event)"
Expand Down
4 changes: 2 additions & 2 deletions app/gui2/src/stores/graph/graphDatabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,15 +473,15 @@ export interface Node {
innerExpr: Ast.Ast
position: Vec2
vis: Opt<VisualizationMetadata>
prefixes: Record<'enableOutputContext', Ast.AstId[] | undefined>
prefixes: Record<'enableRecording', Ast.AstId[] | undefined>
/** A child AST in a syntactic position to be a self-argument input to the node. */
primarySubject: Ast.AstId | undefined
}

const baseMockNode = {
position: Vec2.Zero,
vis: undefined,
prefixes: { enableOutputContext: undefined },
prefixes: { enableRecording: undefined },
primarySubject: undefined,
} satisfies Partial<Node>

Expand Down
4 changes: 2 additions & 2 deletions app/gui2/src/stores/project/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ export const useProjectStore = defineStore('project', () => {
})
})

const isOutputContextEnabled = computed(() => executionMode.value === 'live')
const isRecordingEnabled = computed(() => executionMode.value === 'live')

function stopCapturingUndo() {
module.value?.undoManager.stopCapturing()
Expand Down Expand Up @@ -714,7 +714,7 @@ export const useProjectStore = defineStore('project', () => {
lsRpcConnection: markRaw(lsRpcConnection),
dataConnection: markRaw(dataConnection),
useVisualizationData,
isOutputContextEnabled,
isRecordingEnabled,
stopCapturingUndo,
executionMode,
recordMode,
Expand Down
2 changes: 1 addition & 1 deletion app/gui2/src/util/ast/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Prefixes } from '@/util/ast/prefixes'
import { Vec2 } from '@/util/data/vec2'

export const prefixes = Prefixes.FromLines({
enableOutputContext:
enableRecording:
'Standard.Base.Runtime.with_enabled_context Standard.Base.Runtime.Context.Output __ <| __',
})

Expand Down
2 changes: 1 addition & 1 deletion app/gui2/stories/GraphNode.story.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const node = computed((): Node => {
rootSpanId: '' as any,
pattern: pattern.value,
position: position.value,
prefixes: { enableOutputContext: undefined },
prefixes: { enableRecording: undefined },
innerExpr: innerExpr.value,
primarySubject: undefined,
vis: undefined,
Expand Down

0 comments on commit 81c357f

Please sign in to comment.