mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-19 16:02:14 +00:00
fix(frontend): Fix typing (#1774)
* feat(frontend): Add documentation link in the component settings * feat(frontend): Add missing type * feat(frontend): fix typing errors * feat(frontend): fix typing errors
This commit is contained in:
@@ -2181,8 +2181,7 @@ paths:
|
||||
schema:
|
||||
type: string
|
||||
- name: first_parent_hash
|
||||
description:
|
||||
mask to filter scripts whom first direct parent has exact hash
|
||||
description: mask to filter scripts whom first direct parent has exact hash
|
||||
in: query
|
||||
schema:
|
||||
type: string
|
||||
@@ -2350,8 +2349,7 @@ paths:
|
||||
|
||||
/workers/custom_tags:
|
||||
get:
|
||||
summary:
|
||||
get all instance custom tags (tags are used to dispatch jobs to
|
||||
summary: get all instance custom tags (tags are used to dispatch jobs to
|
||||
different worker groups)
|
||||
operationId: getCustomTags
|
||||
tags:
|
||||
@@ -2402,8 +2400,7 @@ paths:
|
||||
|
||||
/w/{workspace}/scripts/delete/h/{hash}:
|
||||
post:
|
||||
summary:
|
||||
delete script by hash (erase content but keep hash, require admin)
|
||||
summary: delete script by hash (erase content but keep hash, require admin)
|
||||
operationId: deleteScriptByHash
|
||||
tags:
|
||||
- script
|
||||
@@ -2595,16 +2592,14 @@ paths:
|
||||
type: string
|
||||
format: date-time
|
||||
- name: scheduled_in_secs
|
||||
description:
|
||||
schedule the script to execute in the number of seconds starting now
|
||||
description: schedule the script to execute in the number of seconds starting now
|
||||
in: query
|
||||
schema:
|
||||
type: integer
|
||||
- $ref: "#/components/parameters/ParentJob"
|
||||
- $ref: "#/components/parameters/NewJobId"
|
||||
- name: invisible_to_owner
|
||||
description:
|
||||
make the run invisible to the the script owner (default false)
|
||||
description: make the run invisible to the the script owner (default false)
|
||||
in: query
|
||||
schema:
|
||||
type: boolean
|
||||
@@ -3483,8 +3478,7 @@ paths:
|
||||
type: string
|
||||
format: date-time
|
||||
- name: scheduled_in_secs
|
||||
description:
|
||||
schedule the script to execute in the number of seconds starting now
|
||||
description: schedule the script to execute in the number of seconds starting now
|
||||
in: query
|
||||
schema:
|
||||
type: integer
|
||||
@@ -3492,8 +3486,7 @@ paths:
|
||||
- $ref: "#/components/parameters/NewJobId"
|
||||
- $ref: "#/components/parameters/IncludeHeader"
|
||||
- name: invisible_to_owner
|
||||
description:
|
||||
make the run invisible to the the flow owner (default false)
|
||||
description: make the run invisible to the the flow owner (default false)
|
||||
in: query
|
||||
schema:
|
||||
type: boolean
|
||||
@@ -3531,8 +3524,7 @@ paths:
|
||||
type: string
|
||||
format: date-time
|
||||
- name: scheduled_in_secs
|
||||
description:
|
||||
schedule the script to execute in the number of seconds starting now
|
||||
description: schedule the script to execute in the number of seconds starting now
|
||||
in: query
|
||||
schema:
|
||||
type: integer
|
||||
@@ -3540,8 +3532,7 @@ paths:
|
||||
- $ref: "#/components/parameters/NewJobId"
|
||||
- $ref: "#/components/parameters/IncludeHeader"
|
||||
- name: invisible_to_owner
|
||||
description:
|
||||
make the run invisible to the the script owner (default false)
|
||||
description: make the run invisible to the the script owner (default false)
|
||||
in: query
|
||||
schema:
|
||||
type: boolean
|
||||
@@ -3572,8 +3563,7 @@ paths:
|
||||
- $ref: "#/components/parameters/WorkspaceId"
|
||||
- $ref: "#/components/parameters/IncludeHeader"
|
||||
- name: invisible_to_owner
|
||||
description:
|
||||
make the run invisible to the the script owner (default false)
|
||||
description: make the run invisible to the the script owner (default false)
|
||||
in: query
|
||||
schema:
|
||||
type: boolean
|
||||
@@ -3606,8 +3596,7 @@ paths:
|
||||
- $ref: "#/components/parameters/WorkspaceId"
|
||||
- $ref: "#/components/parameters/IncludeHeader"
|
||||
- name: invisible_to_owner
|
||||
description:
|
||||
make the run invisible to the the script owner (default false)
|
||||
description: make the run invisible to the the script owner (default false)
|
||||
in: query
|
||||
schema:
|
||||
type: boolean
|
||||
@@ -3978,8 +3967,7 @@ paths:
|
||||
|
||||
/w/{workspace}/jobs/resume_urls/{id}/{resume_id}:
|
||||
get:
|
||||
summary:
|
||||
get resume urls given a job_id, resume_id and a nonce to resume a flow
|
||||
summary: get resume urls given a job_id, resume_id and a nonce to resume a flow
|
||||
operationId: getResumeUrls
|
||||
tags:
|
||||
- job
|
||||
@@ -4451,8 +4439,7 @@ paths:
|
||||
- $ref: "#/components/parameters/WorkspaceId"
|
||||
- name: only_member_of
|
||||
in: query
|
||||
description:
|
||||
only list the groups the user is member of (default false)
|
||||
description: only list the groups the user is member of (default false)
|
||||
schema:
|
||||
type: boolean
|
||||
responses:
|
||||
@@ -4640,8 +4627,7 @@ paths:
|
||||
- $ref: "#/components/parameters/WorkspaceId"
|
||||
- name: only_member_of
|
||||
in: query
|
||||
description:
|
||||
only list the folders the user is member of (default false)
|
||||
description: only list the folders the user is member of (default false)
|
||||
schema:
|
||||
type: boolean
|
||||
responses:
|
||||
@@ -5279,8 +5265,7 @@ components:
|
||||
type: integer
|
||||
PerPage:
|
||||
name: per_page
|
||||
description:
|
||||
number of items to return for a given page (default 30, max 100)
|
||||
description: number of items to return for a given page (default 30, max 100)
|
||||
in: query
|
||||
schema:
|
||||
type: integer
|
||||
@@ -5396,8 +5381,7 @@ components:
|
||||
type: boolean
|
||||
ArgsFilter:
|
||||
name: args
|
||||
description:
|
||||
filter on jobs containing those args as a json subset (@> in postgres)
|
||||
description: filter on jobs containing those args as a json subset (@> in postgres)
|
||||
in: query
|
||||
schema:
|
||||
type: string
|
||||
@@ -5409,8 +5393,7 @@ components:
|
||||
type: string
|
||||
ResultFilter:
|
||||
name: result
|
||||
description:
|
||||
filter on jobs containing those result as a json subset (@> in postgres)
|
||||
description: filter on jobs containing those result as a json subset (@> in postgres)
|
||||
in: query
|
||||
schema:
|
||||
type: string
|
||||
@@ -5586,7 +5569,7 @@ components:
|
||||
type: string
|
||||
language:
|
||||
type: string
|
||||
enum: [python3, deno, go, bash]
|
||||
enum: [python3, deno, go, bash, postgresql]
|
||||
kind:
|
||||
type: string
|
||||
enum: [script, failure, trigger, command, approval]
|
||||
@@ -5747,7 +5730,7 @@ components:
|
||||
type: boolean
|
||||
language:
|
||||
type: string
|
||||
enum: [python3, deno, go, bash]
|
||||
enum: [python3, deno, go, bash, postgresql]
|
||||
email:
|
||||
type: string
|
||||
visible_to_owner:
|
||||
@@ -5822,6 +5805,7 @@ components:
|
||||
"identity",
|
||||
"http",
|
||||
"graphql",
|
||||
"postgresql",
|
||||
]
|
||||
schedule_path:
|
||||
type: string
|
||||
@@ -5838,7 +5822,7 @@ components:
|
||||
type: boolean
|
||||
language:
|
||||
type: string
|
||||
enum: [python3, deno, go, bash]
|
||||
enum: [python3, deno, go, bash, postgresql]
|
||||
is_skipped:
|
||||
type: boolean
|
||||
email:
|
||||
@@ -6266,7 +6250,7 @@ components:
|
||||
$ref: "#/components/schemas/ScriptArgs"
|
||||
language:
|
||||
type: string
|
||||
enum: [python3, deno, go, bash]
|
||||
enum: [python3, deno, go, bash, postgresql]
|
||||
tag:
|
||||
type: string
|
||||
kind:
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
{/each}
|
||||
</select>
|
||||
{:else}
|
||||
<!-- svelte-ignore a11y-autofocus -->
|
||||
<input
|
||||
{autofocus}
|
||||
on:focus
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
let divEl: HTMLDivElement | null = null
|
||||
let editor: meditor.IStandaloneCodeEditor
|
||||
|
||||
export let lang: 'typescript' | 'python' | 'go' | 'shell'
|
||||
export let lang: 'typescript' | 'python' | 'go' | 'shell' | 'postgresql'
|
||||
export let code: string = ''
|
||||
export let cmdEnterAction: (() => void) | undefined = undefined
|
||||
export let formatAction: (() => void) | undefined = undefined
|
||||
|
||||
@@ -35,10 +35,10 @@
|
||||
import Toggle from './Toggle.svelte'
|
||||
import { Link, Users } from 'lucide-svelte'
|
||||
import { capitalize } from '$lib/utils'
|
||||
import type { Schema, SchemaProperty } from '$lib/common'
|
||||
import type { Schema, SchemaProperty, SupportedLanguage } from '$lib/common'
|
||||
import ScriptVersionHistory from './ScriptVersionHistory.svelte'
|
||||
|
||||
export let lang: 'python3' | 'deno' | 'go' | 'bash'
|
||||
export let lang: SupportedLanguage
|
||||
export let editor: Editor | undefined
|
||||
export let websocketAlive: {
|
||||
pyright: boolean
|
||||
@@ -64,8 +64,7 @@
|
||||
let resourceEditor: ResourceEditor
|
||||
|
||||
let codeViewer: Drawer
|
||||
let codeObj: { language: 'python3' | 'deno' | 'go' | 'bash'; content: string } | undefined =
|
||||
undefined
|
||||
let codeObj: { language: SupportedLanguage; content: string } | undefined = undefined
|
||||
|
||||
function addEditorActions() {
|
||||
editor?.addAction('insert-variable', 'Windmill: Insert variable', () => {
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
import typescript from 'svelte-highlight/languages/typescript'
|
||||
import go from 'svelte-highlight/languages/go'
|
||||
import shell from 'svelte-highlight/languages/shell'
|
||||
import type { Script } from '$lib/gen'
|
||||
|
||||
export let code: string = ''
|
||||
export let language: 'python3' | 'deno' | 'go' | 'bash' | undefined
|
||||
export let language: Script.language | undefined
|
||||
export let lines = false
|
||||
|
||||
function getLang(lang: string | undefined) {
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
}
|
||||
|
||||
function initContent(
|
||||
language: 'deno' | 'python3' | 'go' | 'bash',
|
||||
language: SupportedLanguage,
|
||||
kind: Script.kind | undefined,
|
||||
template: 'pgsql' | 'mysql' | 'script' | 'docker'
|
||||
) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { BROWSER } from 'esm-env'
|
||||
|
||||
import type { Schema } from '$lib/common'
|
||||
import type { Schema, SupportedLanguage } from '$lib/common'
|
||||
import { CompletedJob, Job, JobService, SettingsService } from '$lib/gen'
|
||||
import { enterpriseLicense, userStore, workspaceStore } from '$lib/stores'
|
||||
import { copyToClipboard, emptySchema, getModifierKey, sendUserToast } from '$lib/utils'
|
||||
@@ -97,7 +97,7 @@
|
||||
})
|
||||
}
|
||||
|
||||
export async function inferSchema(code: string, nlang?: 'go' | 'bash' | 'python3' | 'deno') {
|
||||
export async function inferSchema(code: string, nlang?: SupportedLanguage) {
|
||||
let nschema = schema ?? emptySchema()
|
||||
|
||||
try {
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
import ToggleButton from './common/toggleButton-v2/ToggleButton.svelte'
|
||||
import ToggleButtonGroup from './common/toggleButton-v2/ToggleButtonGroup.svelte'
|
||||
import { Code2, Globe } from 'lucide-svelte'
|
||||
import type { SupportedLanguage } from '$lib/common'
|
||||
|
||||
export let initialPath: string | undefined = undefined
|
||||
export let scriptPath: string | undefined = undefined
|
||||
@@ -27,7 +28,7 @@
|
||||
let drawerViewer: Drawer
|
||||
let drawerFlowViewer: Drawer
|
||||
let code: string = ''
|
||||
let lang: 'deno' | 'python3' | 'go' | 'bash' | undefined
|
||||
let lang: SupportedLanguage | undefined
|
||||
|
||||
let options: [[string, any, any]] = [['Script', 'script', Code2]]
|
||||
allowHub && options.unshift(['Hub', 'hub', Globe])
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import { onDestroy, tick } from 'svelte'
|
||||
import type { Preview } from '$lib/gen/models/Preview'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import type { SupportedLanguage } from '$lib/common'
|
||||
|
||||
export let isLoading = false
|
||||
export let job: Job | undefined = undefined
|
||||
@@ -83,7 +84,7 @@
|
||||
export async function runPreview(
|
||||
path: string | undefined,
|
||||
code: string,
|
||||
lang: 'deno' | 'go' | 'python3' | 'bash',
|
||||
lang: SupportedLanguage,
|
||||
args: Record<string, any>,
|
||||
tag: string | undefined
|
||||
): Promise<string> {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Schema } from '$lib/common'
|
||||
import type { Schema, SupportedLanguage } from '$lib/common'
|
||||
import { FlowService, ScriptService } from '$lib/gen'
|
||||
import { inferArgs } from '$lib/infer'
|
||||
import { emptySchema } from '$lib/utils'
|
||||
@@ -70,7 +70,7 @@ export async function loadSchema(
|
||||
script.schema = emptySchema()
|
||||
}
|
||||
|
||||
await inferArgs(script.language, script.content, script.schema)
|
||||
await inferArgs(script.language as SupportedLanguage, script.content, script.schema)
|
||||
return { schema: script.schema, summary: script.summary }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
mysql: MySQLIcon,
|
||||
javascript: JavaScript,
|
||||
fetch: FetchIcon,
|
||||
docker: DockerIcon
|
||||
docker: DockerIcon,
|
||||
postgresql: PostgresIcon
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import type { SupportedLanguage } from '$lib/common'
|
||||
import HighlightCode from '$lib/components/HighlightCode.svelte'
|
||||
import { ScriptService } from '$lib/gen'
|
||||
import { getScriptByPath } from '$lib/scripts'
|
||||
@@ -8,7 +9,7 @@
|
||||
export let hash: string | undefined = undefined
|
||||
|
||||
let code: string
|
||||
let language: 'deno' | 'python3' | 'go' | 'bash'
|
||||
let language: SupportedLanguage
|
||||
|
||||
async function loadCode(path: string, hash: string | undefined) {
|
||||
const script = hash
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { MainArgSignature } from '$lib/gen'
|
||||
import { get, writable } from 'svelte/store'
|
||||
import type { Schema, SchemaProperty } from './common.js'
|
||||
import type { Schema, SchemaProperty, SupportedLanguage } from './common.js'
|
||||
import { sortObject } from './utils.js'
|
||||
import { tick } from 'svelte'
|
||||
import init, { parse_deno, parse_bash, parse_go, parse_python } from 'windmill-parser-wasm'
|
||||
@@ -11,7 +11,7 @@ init(wasmUrl)
|
||||
const loadSchemaLastRun = writable<[string | undefined, MainArgSignature | undefined]>(undefined)
|
||||
|
||||
export async function inferArgs(
|
||||
language: 'python3' | 'deno' | 'go' | 'bash',
|
||||
language: SupportedLanguage,
|
||||
code: string,
|
||||
schema: Schema
|
||||
): Promise<void> {
|
||||
|
||||
@@ -4,6 +4,7 @@ import PYTHON_INIT_CODE from '$lib/init_scripts/python_init_code'
|
||||
import PYTHON_INIT_CODE_CLEAR from '$lib/init_scripts/python_init_code_clear'
|
||||
import PYTHON_INIT_CODE_TRIGGER from '$lib/init_scripts/python_init_code_trigger'
|
||||
import PYTHON_FAILURE_MODULE_CODE from '$lib/init_scripts/python_failure_module'
|
||||
import type { SupportedLanguage } from './common'
|
||||
|
||||
export {
|
||||
PYTHON_INIT_CODE,
|
||||
@@ -274,7 +275,7 @@ export function isInitialCode(content: string): boolean {
|
||||
}
|
||||
|
||||
export function initialCode(
|
||||
language: 'deno' | 'python3' | 'go' | 'bash',
|
||||
language: SupportedLanguage,
|
||||
kind: Script.kind | undefined,
|
||||
subkind: 'pgsql' | 'mysql' | 'flow' | 'script' | 'fetch' | 'docker' | undefined
|
||||
): string {
|
||||
|
||||
@@ -22,7 +22,7 @@ export async function loadSchema(path: string, hash?: string): Promise<Schema> {
|
||||
const { content, language, schema } = await ScriptService.getHubScriptByPath({ path })
|
||||
if (language == 'deno') {
|
||||
const newSchema = emptySchema()
|
||||
await inferArgs('deno', content ?? '', newSchema)
|
||||
await inferArgs('deno' as SupportedLanguage, content ?? '', newSchema)
|
||||
return newSchema
|
||||
} else {
|
||||
return schema ?? emptySchema()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { AppService, FlowService, type OpenFlow } from '$lib/gen'
|
||||
import { AppService, FlowService, Script, type OpenFlow } from '$lib/gen'
|
||||
import { userStore, workspaceStore } from '$lib/stores'
|
||||
import { Alert, Button, Drawer, DrawerContent, Tab, Tabs } from '$lib/components/common'
|
||||
import PageHeader from '$lib/components/PageHeader.svelte'
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
let codeViewer: Drawer
|
||||
let codeViewerContent: string = ''
|
||||
let codeViewerLanguage: 'deno' | 'python3' | 'go' | 'bash' = 'deno'
|
||||
let codeViewerLanguage: Script.language = 'deno' as Script.language
|
||||
let codeViewerObj: HubItem | undefined = undefined
|
||||
|
||||
const breakpoint = writable<EditorBreakpoint>('lg')
|
||||
|
||||
Reference in New Issue
Block a user