fix: deploy dev/staging/prod small fixes

This commit is contained in:
Ruben Fiszel
2023-06-19 11:32:39 +02:00
parent 9fc0b4398f
commit 2d5854c84a
9 changed files with 154 additions and 5 deletions

View File

@@ -100,7 +100,7 @@
})
}
if (x.value.type == 'script') {
if (x.value.path) {
if (x.value.path && !x.value.path.startsWith('hub/')) {
result.push({ kind: 'script', path: x.value.path })
}
} else if (x.value.type == 'flow') {
@@ -336,7 +336,7 @@
}
}
function deployAll() {
export function deployAll() {
dependencies?.slice().forEach(async ({ kind, path, include }) => {
if (include) {
await deploy(kind, path)

View File

@@ -548,7 +548,7 @@
size="sm"
startIcon={{ icon: faSave }}
on:click={() => editScript()}
dropdownItems={initialPath != '' ? computeDropdownItems : []}
dropdownItems={initialPath != '' ? computeDropdownItems : undefined}
>
Deploy
</Button>

View File

@@ -0,0 +1,85 @@
<script lang="ts">
import { getContext } from 'svelte'
import { initConfig, initOutput } from '../../editor/appUtils'
import SubGridEditor from '../../editor/SubGridEditor.svelte'
import type { AppViewerContext, ComponentCustomCSS, RichConfigurations } from '../../types'
import { concatCustomCss } from '../../utils'
import InitializeComponent from '../helpers/InitializeComponent.svelte'
import ListWrapper from './ListWrapper.svelte'
import type { AppInput } from '../../inputType'
import ResolveConfig from '../helpers/ResolveConfig.svelte'
import { components } from '../../editor/component'
import RunnableWrapper from '../helpers/RunnableWrapper.svelte'
export let id: string
export let componentContainerHeight: number
export let componentInput: AppInput | undefined
export let configuration: RichConfigurations
export let customCss: ComponentCustomCSS<'containercomponent'> | undefined = undefined
export let render: boolean
export let initializing: boolean | undefined
const { app, focusedGrid, selectedComponent, worldStore, connectingInput } =
getContext<AppViewerContext>('AppViewerContext')
const outputs = initOutput($worldStore, id, {
result: undefined,
loading: false
})
let resolvedConfig = initConfig(
components['listcomponent'].initialData.configuration,
configuration
)
function onFocus() {
$focusedGrid = {
parentComponentId: id,
subGridIndex: 0
}
}
$: css = concatCustomCss($app.css?.containercomponent, customCss)
let result: any[] | undefined = undefined
</script>
{#each Object.keys(components['listcomponent'].initialData.configuration) as key (key)}
<ResolveConfig
{id}
{key}
bind:resolvedConfig={resolvedConfig[key]}
configuration={configuration[key]}
/>
{/each}
<InitializeComponent {id} />
<RunnableWrapper {outputs} {render} autoRefresh {componentInput} {id} bind:initializing bind:result>
<div class="w-full h-full flex flex-wrap overflow-auto gap-2">
{#if $app.subgrids?.[`${id}-0`]}
{#each result ?? [] as value, index}
<div
style={`min-width: ${resolvedConfig.minWidthPx}px; max-height: ${resolvedConfig.maxHeightPx}px;`}
class="border overflow-auto"
>
<ListWrapper {value} {index}>
<SubGridEditor
visible={render}
{id}
class={css?.container?.class}
style={css?.container?.style}
subGridId={`${id}-0`}
containerHeight={componentContainerHeight}
forceView={index != 0}
on:focus={() => {
if (!$connectingInput.opened) {
$selectedComponent = [id]
}
onFocus()
}}
/>
</ListWrapper>
</div>
{/each}
{/if}
</div>
</RunnableWrapper>

View File

@@ -0,0 +1,11 @@
<script lang="ts">
import { setContext } from 'svelte'
import type { ListContext } from '../../types'
export let index: number
export let value: any
setContext<ListContext>('ListWrapperContext', { index, value })
</script>
<slot />

View File

@@ -22,6 +22,7 @@
export let visible: boolean = true
export let id: string
export let shouldHighlight: boolean = true
export let forceView = false
const dispatch = createEventDispatcher()
@@ -77,7 +78,7 @@
)}
style="{containerHeight ? `height: ${containerHeight}px;` : ''} {style ?? ''}"
>
{#if $mode !== 'preview'}
{#if $mode !== 'preview' || forceView}
<div
class={highlight ? 'border-gray-600 animate-border border-dashed border-2 min-h-full' : ''}
>

View File

@@ -50,6 +50,7 @@
import AppFlowStatusComponent from '../../components/display/AppFlowStatusComponent.svelte'
import AppChartJs from '../../components/display/AppChartJs.svelte'
import AppQuillEditor from '../../components/inputs/AppQuillEditor.svelte'
import AppList from '../../components/layout/AppList.svelte'
export let component: AppComponent
export let selected: boolean
@@ -453,6 +454,16 @@
{componentContainerHeight}
{render}
/>
{:else if component.type === 'listcomponent'}
<AppList
id={component.id}
customCss={component.customCss}
configuration={component.configuration}
componentInput={component.componentInput}
{componentContainerHeight}
{render}
bind:initializing
/>
{:else if component.type === 'verticalsplitpanescomponent'}
<AppSplitpanes
id={component.id}

View File

@@ -38,7 +38,8 @@ import {
Split,
Download,
PanelLeft,
PanelTopInactive
PanelTopInactive,
ListIcon
} from 'lucide-svelte'
import type {
Aligned,
@@ -109,6 +110,7 @@ export type TabsComponent = BaseComponent<'tabscomponent'> & {
tabs: string[]
disabledTabs: RichConfiguration[]
}
export type ListComponent = BaseComponent<'listcomponent'>
export type ContainerComponent = BaseComponent<'containercomponent'>
export type DrawerComponent = BaseComponent<'drawercomponent'>
export type MapComponent = BaseComponent<'mapcomponent'>
@@ -163,6 +165,7 @@ export type TypedComponent =
| PlotlyComponent
| TabsComponent
| ContainerComponent
| ListComponent
| IconComponent
| HorizontalDividerComponent
| VerticalDividerComponent
@@ -469,6 +472,38 @@ export const components = {
numberOfSubgrids: 1
}
},
listcomponent: {
name: 'List',
icon: ListIcon,
dims: '2:8-6:8' as AppComponentDimensions,
customCss: {
container: { class: '', style: '' }
},
initialData: {
configuration: {
minWidthPx: {
type: 'static',
fieldType: 'number',
value: 300,
tooltip: 'Min Width in pixels'
},
maxHeightPx: {
type: 'static',
fieldType: 'number',
value: 300,
tooltip: 'Max Height in pixels'
}
},
componentInput: {
type: 'static',
fieldType: 'array',
subFieldType: 'object',
value: [{ foo: 1 }, { foo: 2 }, { foo: 3 }] as object[]
},
numberOfSubgrids: 1
}
},
textcomponent: {
name: 'Text',
icon: Type,

View File

@@ -10,6 +10,7 @@ const layout: ComponentSet = {
title: 'Layout',
components: [
'containercomponent',
// 'listcomponent',
'horizontaldividercomponent',
'verticaldividercomponent',
'drawercomponent',

View File

@@ -150,6 +150,11 @@ export interface CancelablePromise<T> extends Promise<T> {
cancel: () => void
}
export type ListContext = {
index: number
value: any
}
export type AppViewerContext = {
worldStore: Writable<World>
app: Writable<App>