mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-20 08:01:35 +00:00
fix: restore flow local storage
This commit is contained in:
@@ -267,6 +267,8 @@
|
||||
Connect input →
|
||||
</span>
|
||||
{/if}
|
||||
<!-- {inputCat}
|
||||
{propertyType} -->
|
||||
{#if isStaticTemplate(inputCat) && propertyType == 'static' && !noDynamicToggle}
|
||||
<div class="mt-2 min-h-[28px]">
|
||||
{#if arg}
|
||||
|
||||
@@ -486,85 +486,89 @@
|
||||
|
||||
jsLoader = setTimeout(async () => {
|
||||
jsLoader = undefined
|
||||
const worker = await languages.typescript.getJavaScriptWorker()
|
||||
const client = await worker(extraModel.uri)
|
||||
try {
|
||||
const worker = await languages.typescript.getJavaScriptWorker()
|
||||
const client = await worker(extraModel.uri)
|
||||
|
||||
cip = languages.registerCompletionItemProvider('template', {
|
||||
triggerCharacters: ['.'],
|
||||
cip = languages.registerCompletionItemProvider('template', {
|
||||
triggerCharacters: ['.'],
|
||||
|
||||
provideCompletionItems: async (model, position) => {
|
||||
extraModel.setValue('`' + model.getValue() + '`')
|
||||
provideCompletionItems: async (model, position) => {
|
||||
extraModel.setValue('`' + model.getValue() + '`')
|
||||
|
||||
const offset = model.getOffsetAt(position) + 1
|
||||
const info = await client.getCompletionsAtPosition(extraModel.uri.toString(), offset)
|
||||
if (!info) {
|
||||
return { suggestions: [] }
|
||||
}
|
||||
const wordInfo = model.getWordUntilPosition(position)
|
||||
const wordRange = new Range(
|
||||
position.lineNumber,
|
||||
wordInfo.startColumn,
|
||||
position.lineNumber,
|
||||
wordInfo.endColumn
|
||||
)
|
||||
const offset = model.getOffsetAt(position) + 1
|
||||
const info = await client.getCompletionsAtPosition(extraModel.uri.toString(), offset)
|
||||
if (!info) {
|
||||
return { suggestions: [] }
|
||||
}
|
||||
const wordInfo = model.getWordUntilPosition(position)
|
||||
const wordRange = new Range(
|
||||
position.lineNumber,
|
||||
wordInfo.startColumn,
|
||||
position.lineNumber,
|
||||
wordInfo.endColumn
|
||||
)
|
||||
|
||||
const suggestions = info.entries
|
||||
.filter((x) => x.kind != 'keyword' && x.kind != 'var')
|
||||
.map((entry) => {
|
||||
let range = wordRange
|
||||
if (entry.replacementSpan) {
|
||||
const p1 = model.getPositionAt(entry.replacementSpan.start)
|
||||
const p2 = model.getPositionAt(
|
||||
entry.replacementSpan.start + entry.replacementSpan.length
|
||||
)
|
||||
range = new Range(p1.lineNumber, p1.column, p2.lineNumber, p2.column)
|
||||
const suggestions = info.entries
|
||||
.filter((x) => x.kind != 'keyword' && x.kind != 'var')
|
||||
.map((entry) => {
|
||||
let range = wordRange
|
||||
if (entry.replacementSpan) {
|
||||
const p1 = model.getPositionAt(entry.replacementSpan.start)
|
||||
const p2 = model.getPositionAt(
|
||||
entry.replacementSpan.start + entry.replacementSpan.length
|
||||
)
|
||||
range = new Range(p1.lineNumber, p1.column, p2.lineNumber, p2.column)
|
||||
}
|
||||
|
||||
const tags: languages.CompletionItemTag[] = []
|
||||
if (entry.kindModifiers?.indexOf('deprecated') !== -1) {
|
||||
tags.push(languages.CompletionItemTag.Deprecated)
|
||||
}
|
||||
return {
|
||||
uri: model.uri,
|
||||
position: position,
|
||||
offset: offset,
|
||||
range: range,
|
||||
label: entry.name,
|
||||
insertText: entry.name,
|
||||
sortText: entry.sortText,
|
||||
kind: convertKind(entry.kind),
|
||||
tags
|
||||
}
|
||||
})
|
||||
return { suggestions }
|
||||
},
|
||||
resolveCompletionItem: async (item: languages.CompletionItem, token: any) => {
|
||||
extraModel.setValue('`' + model.getValue() + '`')
|
||||
|
||||
const myItem = <any>item
|
||||
const position = myItem.position
|
||||
const offset = myItem.offset
|
||||
|
||||
const details = await client.getCompletionEntryDetails(
|
||||
extraModel.uri.toString(),
|
||||
offset,
|
||||
myItem.label
|
||||
)
|
||||
if (!details) {
|
||||
return myItem
|
||||
}
|
||||
return <any>{
|
||||
uri: model.uri,
|
||||
position: position,
|
||||
label: details.name,
|
||||
kind: convertKind(details.kind),
|
||||
detail: displayPartsToString(details.displayParts),
|
||||
documentation: {
|
||||
value: createDocumentationString(details)
|
||||
}
|
||||
|
||||
const tags: languages.CompletionItemTag[] = []
|
||||
if (entry.kindModifiers?.indexOf('deprecated') !== -1) {
|
||||
tags.push(languages.CompletionItemTag.Deprecated)
|
||||
}
|
||||
return {
|
||||
uri: model.uri,
|
||||
position: position,
|
||||
offset: offset,
|
||||
range: range,
|
||||
label: entry.name,
|
||||
insertText: entry.name,
|
||||
sortText: entry.sortText,
|
||||
kind: convertKind(entry.kind),
|
||||
tags
|
||||
}
|
||||
})
|
||||
return { suggestions }
|
||||
},
|
||||
resolveCompletionItem: async (item: languages.CompletionItem, token: any) => {
|
||||
extraModel.setValue('`' + model.getValue() + '`')
|
||||
|
||||
const myItem = <any>item
|
||||
const position = myItem.position
|
||||
const offset = myItem.offset
|
||||
|
||||
const details = await client.getCompletionEntryDetails(
|
||||
extraModel.uri.toString(),
|
||||
offset,
|
||||
myItem.label
|
||||
)
|
||||
if (!details) {
|
||||
return myItem
|
||||
}
|
||||
return <any>{
|
||||
uri: model.uri,
|
||||
position: position,
|
||||
label: details.name,
|
||||
kind: convertKind(details.kind),
|
||||
detail: displayPartsToString(details.displayParts),
|
||||
documentation: {
|
||||
value: createDocumentationString(details)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
} catch (e) {
|
||||
console.error('Error setting template js worker', e)
|
||||
}
|
||||
}, 300)
|
||||
}
|
||||
|
||||
|
||||
@@ -54,18 +54,19 @@
|
||||
async function loadFlow(): Promise<void> {
|
||||
loading = true
|
||||
let flow: Flow
|
||||
if (stateLoadedFromUrl != undefined && stateLoadedFromUrl?.flow?.path == $page.params.path) {
|
||||
let statePath = stateLoadedFromUrl?.path
|
||||
if (stateLoadedFromUrl != undefined && statePath == $page.params.path) {
|
||||
savedFlow = await FlowService.getFlowByPathWithDraft({
|
||||
workspace: $workspaceStore!,
|
||||
path: stateLoadedFromUrl.flow.path
|
||||
path: statePath
|
||||
})
|
||||
|
||||
const draftOrDeployed = cleanValueProperties(savedFlow?.draft || savedFlow)
|
||||
const urlScript = cleanValueProperties(stateLoadedFromUrl.flow)
|
||||
const urlScript = cleanValueProperties(statePath)
|
||||
flow = stateLoadedFromUrl.flow
|
||||
const reloadAction = () => {
|
||||
stateLoadedFromUrl = undefined
|
||||
goto(`/flows/edit/${flow!.path}`)
|
||||
goto(`/flows/edit/${statePath}`)
|
||||
loadFlow()
|
||||
}
|
||||
if (orderedJsonStringify(draftOrDeployed) === orderedJsonStringify(urlScript)) {
|
||||
|
||||
Reference in New Issue
Block a user