mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 16:02:10 +00:00
nits whitelabel
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
export let workspaceId: string | undefined = undefined
|
||||
export let flowStateStore: Writable<FlowState> = writable({})
|
||||
export let selectedJobStep: string | undefined = undefined
|
||||
export let hideFlowResult = false
|
||||
|
||||
export let isOwner = false
|
||||
export let wideResults = false
|
||||
@@ -45,6 +46,7 @@
|
||||
</script>
|
||||
|
||||
<FlowStatusViewerInner
|
||||
{hideFlowResult}
|
||||
on:jobsLoaded={({ detail }) => {
|
||||
let { job } = detail
|
||||
if (job.script_path != lastScriptPath && job.script_path) {
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
export let reducedPolling = false
|
||||
|
||||
export let wideResults = false
|
||||
export let hideFlowResult = false
|
||||
|
||||
let jobResults: any[] =
|
||||
flowJobIds?.flowJobs?.map((x, id) => `iter #${id + 1} not loaded by frontend yet`) ?? []
|
||||
@@ -642,16 +643,18 @@
|
||||
<Loader2 class="animate-spin" />
|
||||
</div>
|
||||
{:else if `result` in job}
|
||||
<div class="w-full h-full">
|
||||
<FlowJobResult
|
||||
workspaceId={job?.workspace_id}
|
||||
jobId={job?.id}
|
||||
loading={job['running'] == true}
|
||||
result={job.result}
|
||||
logs={job.logs}
|
||||
durationStates={localDurationStatuses}
|
||||
/>
|
||||
</div>
|
||||
{#if !hideFlowResult}
|
||||
<div class="w-full h-full">
|
||||
<FlowJobResult
|
||||
workspaceId={job?.workspace_id}
|
||||
jobId={job?.id}
|
||||
loading={job['running'] == true}
|
||||
result={job.result}
|
||||
logs={job.logs}
|
||||
durationStates={localDurationStatuses}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
{:else if job.flow_status?.modules?.[job?.flow_status?.step]?.type === 'WaitingForEvents'}
|
||||
<FlowStatusWaitingForEvents {workspaceId} {job} {isOwner} />
|
||||
{:else if $suspendStatus && Object.keys($suspendStatus).length > 0}
|
||||
|
||||
@@ -33,9 +33,10 @@
|
||||
import { goto as gotoUrl } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import type DeployWorkspaceDrawer from '$lib/components/DeployWorkspaceDrawer.svelte'
|
||||
import { DELETE, copyToClipboard, isDeployable } from '$lib/utils'
|
||||
import { DELETE, copyToClipboard } from '$lib/utils'
|
||||
import AppDeploymentHistory from '$lib/components/apps/editor/AppDeploymentHistory.svelte'
|
||||
import AppJsonEditor from '$lib/components/apps/editor/AppJsonEditor.svelte'
|
||||
import { isDeployable } from '$lib/utils_deployable'
|
||||
|
||||
export let app: ListableApp & { has_draft?: boolean; draft_only?: boolean; canWrite: boolean }
|
||||
export let marked: string | undefined
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
import Row from './Row.svelte'
|
||||
import DraftBadge from '$lib/components/DraftBadge.svelte'
|
||||
import { sendUserToast } from '$lib/toast'
|
||||
import { DELETE, copyToClipboard, isDeployable, isOwner } from '$lib/utils'
|
||||
import { DELETE, copyToClipboard, isOwner } from '$lib/utils'
|
||||
import { isDeployable } from '$lib/utils_deployable'
|
||||
|
||||
import type DeployWorkspaceDrawer from '$lib/components/DeployWorkspaceDrawer.svelte'
|
||||
import {
|
||||
Pen,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
import { goto } from '$lib/navigation'
|
||||
import type DeployWorkspaceDrawer from '$lib/components/DeployWorkspaceDrawer.svelte'
|
||||
import { FileUp, Globe, Pen, Share, Trash } from 'lucide-svelte'
|
||||
import { isDeployable } from '$lib/utils'
|
||||
import { isDeployable } from '$lib/utils_deployable'
|
||||
|
||||
export let app: ListableRawApp & { canWrite: boolean }
|
||||
export let marked: string | undefined
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
import Row from './Row.svelte'
|
||||
import DraftBadge from '$lib/components/DraftBadge.svelte'
|
||||
import { sendUserToast } from '$lib/toast'
|
||||
import { copyToClipboard, DELETE, isDeployable, isOwner } from '$lib/utils'
|
||||
import { copyToClipboard, DELETE, isOwner } from '$lib/utils'
|
||||
import { isDeployable } from '$lib/utils_deployable'
|
||||
|
||||
import type DeployWorkspaceDrawer from '$lib/components/DeployWorkspaceDrawer.svelte'
|
||||
import { LanguageIcon } from '../languageIcons'
|
||||
import {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
import { ArrowBigUp } from 'lucide-svelte'
|
||||
import { enterpriseLicense, workspaceStore } from '$lib/stores'
|
||||
import { WorkspaceService, type WorkspaceDeployUISettings } from '$lib/gen'
|
||||
import { ALL_DEPLOYABLE } from '$lib/utils'
|
||||
import { ALL_DEPLOYABLE } from '$lib/utils_deployable'
|
||||
|
||||
export let item
|
||||
export let depth: number = 0
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { get } from 'svelte/store'
|
||||
import { dbClockDrift } from './stores'
|
||||
import { JobService } from './gen'
|
||||
import pLimit from 'p-limit'
|
||||
|
||||
function subtractSeconds(date: Date, seconds: number): Date {
|
||||
date.setSeconds(date.getSeconds() - seconds)
|
||||
@@ -12,19 +13,22 @@ function adjustDate(drift: number): Date {
|
||||
}
|
||||
|
||||
export async function computeDrift() {
|
||||
const now = Date.now()
|
||||
const dbClock = await JobService.getDbClock()
|
||||
dbClockDrift.set(dbClock - now)
|
||||
if (get(dbClockDrift) == undefined) {
|
||||
const now = Date.now()
|
||||
const dbClock = await JobService.getDbClock()
|
||||
dbClockDrift.set(dbClock - now)
|
||||
}
|
||||
}
|
||||
|
||||
export function forLater(scheduledString: string): boolean {
|
||||
return getDbClockNow() < subtractSeconds(new Date(scheduledString), 5)
|
||||
}
|
||||
const limit = pLimit(1)
|
||||
|
||||
export function getDbClockNow() {
|
||||
let drift = get(dbClockDrift)
|
||||
if (drift == undefined) {
|
||||
computeDrift()
|
||||
limit(() => computeDrift())
|
||||
drift = 0
|
||||
}
|
||||
return adjustDate(drift)
|
||||
|
||||
@@ -14,7 +14,6 @@ import { sendUserToast } from './toast'
|
||||
import type { Script, WorkspaceDeployUISettings } from './gen'
|
||||
import type { EnumType, SchemaProperty } from './common'
|
||||
import type { Schema } from './common'
|
||||
import { minimatch } from 'minimatch'
|
||||
export { sendUserToast }
|
||||
|
||||
export function validateUsername(username: string): string {
|
||||
@@ -941,34 +940,3 @@ export function getSchemaFromProperties(properties: { [name: string]: SchemaProp
|
||||
order: Object.keys(properties).filter((k) => k !== 'label')
|
||||
}
|
||||
}
|
||||
|
||||
type DeployUIType = 'script' | 'flow' | 'app' | 'resource' | 'variable' | 'secret'
|
||||
|
||||
export function isDeployable(
|
||||
type: DeployUIType,
|
||||
path: string,
|
||||
deployUiSettings: WorkspaceDeployUISettings | undefined
|
||||
) {
|
||||
if (deployUiSettings == undefined) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (deployUiSettings.include_type != undefined && !deployUiSettings.include_type.includes(type)) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (
|
||||
deployUiSettings.include_path != undefined &&
|
||||
deployUiSettings.include_path.length != 0 &&
|
||||
deployUiSettings.include_path.every((x) => !minimatch(path, x))
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
export const ALL_DEPLOYABLE: WorkspaceDeployUISettings = {
|
||||
include_path: [],
|
||||
include_type: ['script', 'flow', 'app', 'resource', 'variable', 'secret']
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { minimatch } from 'minimatch'
|
||||
import type { WorkspaceDeployUISettings } from './gen'
|
||||
|
||||
type DeployUIType = 'script' | 'flow' | 'app' | 'resource' | 'variable' | 'secret'
|
||||
|
||||
export function isDeployable(
|
||||
type: DeployUIType,
|
||||
path: string,
|
||||
deployUiSettings: WorkspaceDeployUISettings | undefined
|
||||
) {
|
||||
if (deployUiSettings == undefined) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (deployUiSettings.include_type != undefined && !deployUiSettings.include_type.includes(type)) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (
|
||||
deployUiSettings.include_path != undefined &&
|
||||
deployUiSettings.include_path.length != 0 &&
|
||||
deployUiSettings.include_path.every((x) => !minimatch(path, x))
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
export const ALL_DEPLOYABLE: WorkspaceDeployUISettings = {
|
||||
include_path: [],
|
||||
include_type: ['script', 'flow', 'app', 'resource', 'variable', 'secret']
|
||||
}
|
||||
@@ -8,7 +8,8 @@
|
||||
type FlowModule,
|
||||
type WorkspaceDeployUISettings
|
||||
} from '$lib/gen'
|
||||
import { ALL_DEPLOYABLE, canWrite, defaultIfEmptyString, emptyString, isDeployable } from '$lib/utils'
|
||||
import { canWrite, defaultIfEmptyString, emptyString } from '$lib/utils'
|
||||
import { isDeployable, ALL_DEPLOYABLE } from '$lib/utils_deployable'
|
||||
|
||||
import DetailPageLayout from '$lib/components/details/DetailPageLayout.svelte'
|
||||
import { goto } from '$lib/navigation'
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
import { OauthService, ResourceService, WorkspaceService, type ListableResource } from '$lib/gen'
|
||||
import { enterpriseLicense, userStore, workspaceStore } from '$lib/stores'
|
||||
import { sendUserToast } from '$lib/toast'
|
||||
import { ALL_DEPLOYABLE, canWrite, classNames, emptySchema, isDeployable, removeMarkdown, truncate } from '$lib/utils'
|
||||
import { canWrite, classNames, emptySchema, removeMarkdown, truncate } from '$lib/utils'
|
||||
import { isDeployable, ALL_DEPLOYABLE } from '$lib/utils_deployable'
|
||||
|
||||
import { convert } from '@redocly/json-to-json-schema'
|
||||
import {
|
||||
Braces,
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores'
|
||||
import { base } from '$lib/base'
|
||||
import { JobService, ScriptService, WorkspaceService, type Script, type WorkspaceDeployUISettings } from '$lib/gen'
|
||||
import {
|
||||
defaultIfEmptyString,
|
||||
emptyString,
|
||||
canWrite,
|
||||
truncateHash,
|
||||
isDeployable,
|
||||
|
||||
ALL_DEPLOYABLE
|
||||
|
||||
} from '$lib/utils'
|
||||
JobService,
|
||||
ScriptService,
|
||||
WorkspaceService,
|
||||
type Script,
|
||||
type WorkspaceDeployUISettings
|
||||
} from '$lib/gen'
|
||||
import { defaultIfEmptyString, emptyString, canWrite, truncateHash } from '$lib/utils'
|
||||
import Tooltip from '$lib/components/Tooltip.svelte'
|
||||
import ShareModal from '$lib/components/ShareModal.svelte'
|
||||
import { enterpriseLicense, hubBaseUrlStore, userStore, workspaceStore } from '$lib/stores'
|
||||
import { isDeployable, ALL_DEPLOYABLE } from '$lib/utils_deployable'
|
||||
|
||||
import SchemaViewer from '$lib/components/SchemaViewer.svelte'
|
||||
import { onDestroy } from 'svelte'
|
||||
import HighlightCode from '$lib/components/HighlightCode.svelte'
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
import { OauthService, VariableService, WorkspaceService } from '$lib/gen'
|
||||
import { enterpriseLicense, userStore, workspaceStore } from '$lib/stores'
|
||||
import { sendUserToast } from '$lib/toast'
|
||||
import { ALL_DEPLOYABLE, canWrite, isDeployable, isOwner, truncate } from '$lib/utils'
|
||||
import { canWrite, isOwner, truncate } from '$lib/utils'
|
||||
import { isDeployable, ALL_DEPLOYABLE } from '$lib/utils_deployable'
|
||||
import {
|
||||
Plus,
|
||||
FileUp,
|
||||
|
||||
Reference in New Issue
Block a user