From dc61ce92b7e8f952a3b229fb2654ff66a08c9be3 Mon Sep 17 00:00:00 2001 From: Faton Ramadani Date: Thu, 12 Oct 2023 14:17:25 +0200 Subject: [PATCH] fix(frontend): fix style panel overflow (#2437) * fix(frontend): fix style panel overflow * fix(frontend): hide deprecated options --- .../components/apps/editor/AppEditor.svelte | 7 +- .../apps/editor/AppEditorHeader.svelte | 121 ++++++++++-------- .../components/apps/editor/TabsDebug.svelte | 3 +- .../lib/components/apps/editor/appUtils.ts | 11 +- .../apps/editor/component/components.ts | 10 +- .../editor/componentsPanel/CssProperty.svelte | 7 +- .../OneOfInputSpecsEditor.svelte | 12 +- 7 files changed, 109 insertions(+), 62 deletions(-) diff --git a/frontend/src/lib/components/apps/editor/AppEditor.svelte b/frontend/src/lib/components/apps/editor/AppEditor.svelte index 49ba5bce7e..ff42c37e03 100644 --- a/frontend/src/lib/components/apps/editor/AppEditor.svelte +++ b/frontend/src/lib/components/apps/editor/AppEditor.svelte @@ -433,7 +433,12 @@ -
+
diff --git a/frontend/src/lib/components/apps/editor/AppEditorHeader.svelte b/frontend/src/lib/components/apps/editor/AppEditorHeader.svelte index 7a963b625d..fda5dfed57 100644 --- a/frontend/src/lib/components/apps/editor/AppEditorHeader.svelte +++ b/frontend/src/lib/components/apps/editor/AppEditorHeader.svelte @@ -6,7 +6,6 @@ import { dirtyStore } from '$lib/components/common/confirmationModal/dirtyStore' import Skeleton from '$lib/components/common/skeleton/Skeleton.svelte' import DisplayResult from '$lib/components/DisplayResult.svelte' - import Dropdown from '$lib/components/Dropdown.svelte' import FlowProgressBar from '$lib/components/flows/FlowProgressBar.svelte' import FlowStatusViewer from '$lib/components/FlowStatusViewer.svelte' import JobArgs from '$lib/components/JobArgs.svelte' @@ -17,20 +16,19 @@ import { AppService, DraftService, Job, Policy } from '$lib/gen' import { redo, undo } from '$lib/history' import { enterpriseLicense, workspaceStore } from '$lib/stores' - import { - faClipboard, - faFileExport, - faHistory, - faSave, - faSlidersH - } from '@fortawesome/free-solid-svg-icons' + import { faClipboard, faSave } from '@fortawesome/free-solid-svg-icons' import { AlignHorizontalSpaceAround, BellOff, Bug, Expand, + FileJson, + FileUp, + FormInput, + History, Laptop2, Loader2, + MoreVertical, Smartphone } from 'lucide-svelte' import { getContext } from 'svelte' @@ -62,6 +60,8 @@ import DeploymentHistory from './DeploymentHistory.svelte' import Awareness from '$lib/components/Awareness.svelte' import { secondaryMenuLeftStore, secondaryMenuRightStore } from './settingsPanel/secondaryMenu' + import ButtonDropdown from '$lib/components/common/button/ButtonDropdown.svelte' + import { MenuItem } from '@rgossiaux/svelte-headlessui' async function hash(message) { try { @@ -393,6 +393,45 @@ let dirtyPath = false let path: Path | undefined = undefined + + let moreItems = [ + { + displayName: 'Deployment History', + icon: History, + action: () => { + historyBrowserDrawerOpen = true + } + }, + { + displayName: 'JSON', + icon: FileJson, + action: () => { + appExport.open($app) + } + }, + // { + // displayName: 'Publish to Hub', + // icon: faGlobe, + // action: () => { + // const url = appToHubUrl(toStatic($app, $staticExporter, $summary)) + // window.open(url.toString(), '_blank') + // } + // }, + { + displayName: 'Hub compatible JSON', + icon: FileUp, + action: () => { + appExport.open(toStatic($app, $staticExporter, $summary).app) + } + }, + { + displayName: 'App Inputs', + icon: FormInput, + action: () => { + inputsDrawerOpen = true + } + } + ] @@ -595,6 +634,7 @@
{#each $jobs ?? [] as { job, component } (job)} +
{/if}
- { - historyBrowserDrawerOpen = true - } - }, - { - displayName: 'JSON', - icon: faFileExport, - action: () => { - appExport.open($app) - } - }, - // { - // displayName: 'Publish to Hub', - // icon: faGlobe, - // action: () => { - // const url = appToHubUrl(toStatic($app, $staticExporter, $summary)) - // window.open(url.toString(), '_blank') - // } - // }, - { - displayName: 'Hub compatible JSON', - icon: faFileExport, - action: () => { - appExport.open(toStatic($app, $staticExporter, $summary).app) - } - }, - { - displayName: 'App Inputs', - icon: faSlidersH, - action: () => { - inputsDrawerOpen = true - } - } - ]} - /> + + + + + + {#each moreItems as item} + +
+ + {item.displayName} +
+
+ {/each} +
+
- +
{/if} diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/OneOfInputSpecsEditor.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/OneOfInputSpecsEditor.svelte index d88f71c80b..9cfa89e862 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/OneOfInputSpecsEditor.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/OneOfInputSpecsEditor.svelte @@ -38,6 +38,14 @@ } } } + + function getValueOfDeprecated(obj: object): boolean { + if (!obj) return false + + let innerObject = obj[Object.keys(obj)[0]] + + return innerObject?.deprecated + }
@@ -55,7 +63,9 @@ }} > {#each Object.keys(inputSpecsConfiguration ?? {}) as choice} - + {#if !getValueOfDeprecated(inputSpecsConfiguration[choice]) || oneOf.selected === choice} + + {/if} {/each} {#if oneOf.selected !== 'none' && oneOf.selected !== 'errorOverlay'}