windmill-components 1.430.5 → 1.433.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/package/components/AppConnectInner.svelte +27 -2
  2. package/package/components/ConfirmButton.svelte +31 -0
  3. package/package/components/ConfirmButton.svelte.d.ts +20 -0
  4. package/package/components/DiffEditor.svelte +0 -6
  5. package/package/components/FlowStatusViewerInner.svelte +8 -4
  6. package/package/components/InstanceSettings.svelte +20 -1
  7. package/package/components/Login.svelte +31 -6
  8. package/package/components/ServiceLogsInner.svelte +365 -337
  9. package/package/components/apps/components/buttons/AppSchemaForm.svelte +1 -1
  10. package/package/components/apps/components/display/AppNavbarItem.svelte +1 -1
  11. package/package/components/apps/components/helpers/RunnableComponent.svelte +2 -2
  12. package/package/components/apps/components/inputs/AppS3FileInput.svelte +1 -1
  13. package/package/components/apps/editor/AppEditor.svelte +18 -8
  14. package/package/components/apps/editor/AppEditor.svelte.d.ts +5 -0
  15. package/package/components/apps/editor/AppEditorHeader.svelte +58 -58
  16. package/package/components/apps/editor/AppEditorHeader.svelte.d.ts +2 -0
  17. package/package/components/apps/editor/AppPreview.svelte +6 -1
  18. package/package/components/apps/editor/AppReportsDrawer.svelte +3 -613
  19. package/package/components/apps/editor/AppReportsDrawerInner.svelte +622 -0
  20. package/package/components/apps/editor/AppReportsDrawerInner.svelte.d.ts +17 -0
  21. package/package/components/apps/editor/component/components.d.ts +79 -79
  22. package/package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +1 -1
  23. package/package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +1 -1
  24. package/package/components/apps/editor/settingsPanel/GridNavbar.svelte +1 -1
  25. package/package/components/apps/types.d.ts +1 -1
  26. package/package/components/splitPanes/SplitPanesOrColumnOnMobile.svelte +34 -0
  27. package/package/components/splitPanes/SplitPanesOrColumnOnMobile.svelte.d.ts +23 -0
  28. package/package/components/wizards/AppPicker.svelte +4 -4
  29. package/package/gen/core/OpenAPI.js +1 -1
  30. package/package/gen/schemas.gen.d.ts +2 -2
  31. package/package/gen/schemas.gen.js +2 -2
  32. package/package/gen/services.gen.d.ts +0 -1
  33. package/package/gen/services.gen.js +0 -2
  34. package/package/gen/types.gen.d.ts +2 -4
  35. package/package.json +5 -5
@@ -118,7 +118,7 @@ function computeS3ForceViewerPolicies() {
118
118
  bind:this={schemaForm}
119
119
  displayType={Boolean(resolvedConfig.displayType)}
120
120
  largeGap={Boolean(resolvedConfig.largeGap)}
121
- appPath={defaultIfEmptyString(appPath, `u/${$userStore?.username ?? 'unknown'}/newapp`)}
121
+ appPath={defaultIfEmptyString($appPath, `u/${$userStore?.username ?? 'unknown'}/newapp`)}
122
122
  {computeS3ForceViewerPolicies}
123
123
  {workspace}
124
124
  {css}
@@ -44,7 +44,7 @@ function initSelection() {
44
44
  }
45
45
  $: !initialized && resolvedPath && initSelection();
46
46
  function getButtonProps(resolvedPath) {
47
- if (appPath && resolvedPath?.includes(appPath)) {
47
+ if ($appPath && resolvedPath?.includes($appPath)) {
48
48
  return {
49
49
  onClick: () => {
50
50
  output.result.set({ currentPath: resolvedPath ?? '' });
@@ -300,7 +300,7 @@ async function executeComponent(noToast = false, inlineScriptOverride, setRunnab
300
300
  }
301
301
  const uuid = await AppService.executeComponent({
302
302
  workspace,
303
- path: defaultIfEmptyString(appPath, `u/${$userStore?.username ?? 'unknown'}/newapp`),
303
+ path: defaultIfEmptyString($appPath, `u/${$userStore?.username ?? 'unknown'}/newapp`),
304
304
  requestBody
305
305
  });
306
306
  if (isEditor) {
@@ -617,7 +617,7 @@ function computeS3ForceViewerPolicies() {
617
617
  <div class="px-2 h-fit min-h-0">
618
618
  <LightweightSchemaForm
619
619
  schema={schemaStripped}
620
- appPath={defaultIfEmptyString(appPath, `u/${$userStore?.username ?? 'unknown'}/newapp`)}
620
+ appPath={defaultIfEmptyString($appPath, `u/${$userStore?.username ?? 'unknown'}/newapp`)}
621
621
  {computeS3ForceViewerPolicies}
622
622
  {workspace}
623
623
  bind:this={schemaForm}
@@ -126,7 +126,7 @@ function computeForceViewerPolicies() {
126
126
  outputs.result.set(value)
127
127
  }}
128
128
  {forceDisplayUploads}
129
- appPath={defaultIfEmptyString(appPath, `u/${$userStore?.username ?? 'unknown'}/newapp`)}
129
+ appPath={defaultIfEmptyString($appPath, `u/${$userStore?.username ?? 'unknown'}/newapp`)}
130
130
  {computeForceViewerPolicies}
131
131
  />
132
132
  {/if}
@@ -14,7 +14,6 @@ import { classNames, encodeState, getModifierKey, sendUserToast } from '../../..
14
14
  import AppPreview from './AppPreview.svelte';
15
15
  import ComponentList from './componentsPanel/ComponentList.svelte';
16
16
  import ContextPanel from './contextPanel/ContextPanel.svelte';
17
- import { page } from '$app/stores';
18
17
  import ItemPicker from '../../ItemPicker.svelte';
19
18
  import VariableEditor from '../../VariableEditor.svelte';
20
19
  import { VariableService } from '../../../gen';
@@ -31,7 +30,6 @@ import DarkModeObserver from '../../DarkModeObserver.svelte';
31
30
  import { getTheme } from './componentsPanel/themeUtils';
32
31
  import StylePanel from './settingsPanel/StylePanel.svelte';
33
32
  import RunnableJobPanel from './RunnableJobPanel.svelte';
34
- import { goto, replaceState } from '$app/navigation';
35
33
  import HideButton from './settingsPanel/HideButton.svelte';
36
34
  import AppEditorBottomPanel from './AppEditorBottomPanel.svelte';
37
35
  import panzoom from 'panzoom';
@@ -43,6 +41,10 @@ export let fromHub = false;
43
41
  export let diffDrawer = undefined;
44
42
  export let savedApp = undefined;
45
43
  export let version = undefined;
44
+ export let newApp = false;
45
+ export let newPath = undefined;
46
+ export let replaceStateFn = (path) => window.history.replaceState(null, '', path);
47
+ export let gotoFn = (path, opt) => window.history.pushState(null, '', path);
46
48
  migrateApp(app);
47
49
  const appStore = writable(app);
48
50
  const selectedComponent = writable(undefined);
@@ -69,8 +71,8 @@ let context = {
69
71
  email: $userStore?.email,
70
72
  groups: $userStore?.groups,
71
73
  username: $userStore?.username,
72
- query: Object.fromEntries($page.url.searchParams.entries()),
73
- hash: $page.url.hash.substring(1),
74
+ query: Object.fromEntries(new URL(window.location.href).searchParams.entries()),
75
+ hash: window.location.hash.substring(1),
74
76
  workspace: $workspaceStore,
75
77
  mode: 'editor',
76
78
  summary: $summaryStore,
@@ -83,6 +85,11 @@ const initialized = writable({ initialized: false, initializedComponents: [] });
83
85
  const panzoomActive = writable(false);
84
86
  $secondaryMenuRightStore.isOpen = false;
85
87
  $secondaryMenuLeftStore.isOpen = false;
88
+ let writablePath = writable(path);
89
+ $: path && onPathChange();
90
+ function onPathChange() {
91
+ writablePath.set(path);
92
+ }
86
93
  setContext('AppViewerContext', {
87
94
  worldStore,
88
95
  app: appStore,
@@ -94,7 +101,7 @@ setContext('AppViewerContext', {
94
101
  bgRuns: writable([]),
95
102
  breakpoint,
96
103
  runnableComponents: writable({}),
97
- appPath: path,
104
+ appPath: writablePath,
98
105
  workspace: $workspaceStore ?? '',
99
106
  onchange: () => saveFrontendDraft(),
100
107
  isEditor: true,
@@ -115,7 +122,7 @@ setContext('AppViewerContext', {
115
122
  cssEditorOpen,
116
123
  previewTheme,
117
124
  debuggingComponents: writable({}),
118
- replaceStateFn: (path) => replaceState(path, $page.state),
125
+ replaceStateFn: replaceStateFn,
119
126
  policy: policy,
120
127
  recomputeAllContext: writable({
121
128
  loading: false,
@@ -653,6 +660,8 @@ $: forceDeactivatePanzoom = isModifierKeyPressed && handMode;
653
660
  {#if !$userStore?.operator}
654
661
  {#if $appStore}
655
662
  <AppEditorHeader
663
+ {newPath}
664
+ {newApp}
656
665
  on:restore
657
666
  {policy}
658
667
  {fromHub}
@@ -663,6 +672,7 @@ $: forceDeactivatePanzoom = isModifierKeyPressed && handMode;
663
672
  leftPanelHidden={leftPanelSize === 0}
664
673
  rightPanelHidden={rightPanelSize === 0}
665
674
  bottomPanelHidden={runnablePanelSize === 0}
675
+ on:savedNewAppPath
666
676
  on:showLeftPanel={() => showLeftPanel()}
667
677
  on:showRightPanel={() => showRightPanel()}
668
678
  on:hideLeftPanel={() => hideLeftPanel()}
@@ -690,8 +700,8 @@ $: forceDeactivatePanzoom = isModifierKeyPressed && handMode;
690
700
  isEditor
691
701
  {context}
692
702
  noBackend={false}
693
- replaceStateFn={(path) => replaceState(path, $page.state)}
694
- gotoFn={(path, opt) => goto(path, opt)}
703
+ {replaceStateFn}
704
+ {gotoFn}
695
705
  />
696
706
  </div>
697
707
  </SplitPanesWrapper>
@@ -19,10 +19,15 @@ declare const __propDef: {
19
19
  draft_only?: boolean | undefined;
20
20
  } | undefined;
21
21
  version?: number | undefined;
22
+ newApp?: boolean | undefined;
23
+ newPath?: string | undefined;
24
+ replaceStateFn?: ((path: string) => void) | undefined;
25
+ gotoFn?: ((path: string, opt?: Record<string, any> | undefined) => void) | undefined;
22
26
  triggerTutorial?: (() => void) | undefined;
23
27
  };
24
28
  events: {
25
29
  restore: CustomEvent<any>;
30
+ savedNewAppPath: CustomEvent<any>;
26
31
  pointerdown: PointerEvent;
27
32
  } & {
28
33
  [evt: string]: CustomEvent<any>;
@@ -1,6 +1,4 @@
1
- <script>import { goto } from '../../../navigation';
2
- import { page } from '$app/stores';
3
- import { Alert, Badge, Drawer, DrawerContent, Tab, Tabs, UndoRedo } from '../../common';
1
+ <script>import { Alert, Badge, Drawer, DrawerContent, Tab, Tabs, UndoRedo } from '../../common';
4
2
  import Button from '../../common/button/Button.svelte';
5
3
  import DisplayResult from '../../DisplayResult.svelte';
6
4
  import FlowProgressBar from '../../flows/FlowProgressBar.svelte';
@@ -75,6 +73,9 @@ export let version = undefined;
75
73
  export let leftPanelHidden = false;
76
74
  export let rightPanelHidden = false;
77
75
  export let bottomPanelHidden = false;
76
+ export let newApp;
77
+ export let newPath = '';
78
+ let newEditedPath = '';
78
79
  let deployedValue = undefined; // Value to diff against
79
80
  let deployedBy = undefined; // Author
80
81
  let confirmCallback = () => { }; // What happens when user clicks `override` in warning
@@ -92,7 +93,6 @@ $: if ($openDebugRun == undefined) {
92
93
  selectedJobId = jobId;
93
94
  };
94
95
  }
95
- let newPath = '';
96
96
  let pathError = undefined;
97
97
  let appExport;
98
98
  let draftDrawerOpen = false;
@@ -157,7 +157,6 @@ async function computeTriggerables() {
157
157
  input: getCountInput(resourceValue, tableValue, dbType, columnDefs, whereClause),
158
158
  id: x.id + '_count'
159
159
  });
160
- console.log(x.id, getCountInput(resourceValue, tableValue, dbType, columnDefs, whereClause), columnDefs);
161
160
  r.push({
162
161
  input: getInsertInput(tableValue, columnDefs, resourceValue, dbType),
163
162
  id: x.id + '_insert'
@@ -254,7 +253,7 @@ async function processRunnable(id, runnable, fields) {
254
253
  async function createApp(path) {
255
254
  await computeTriggerables();
256
255
  try {
257
- const appId = await AppService.createApp({
256
+ await AppService.createApp({
258
257
  workspace: $workspaceStore,
259
258
  requestBody: {
260
259
  value: $app,
@@ -278,7 +277,7 @@ async function createApp(path) {
278
277
  catch (e) {
279
278
  console.error('error interacting with local storage', e);
280
279
  }
281
- goto(`/apps/edit/${appId}`);
280
+ dispatch('savedNewAppPath', path);
282
281
  }
283
282
  catch (e) {
284
283
  sendUserToast('Error creating app', e);
@@ -303,7 +302,7 @@ async function handleUpdateApp(npath) {
303
302
  orderedJsonStringify(replaceFalseWithUndefined({
304
303
  summary: $summary,
305
304
  value: $app,
306
- path: newPath || savedApp.draft?.path || savedApp.path,
305
+ path: newEditedPath || savedApp.draft?.path || savedApp.path,
307
306
  policy
308
307
  }))) {
309
308
  await updateApp(npath);
@@ -321,7 +320,7 @@ async function handleUpdateApp(npath) {
321
320
  async function syncWithDeployed() {
322
321
  const deployedApp = await AppService.getAppByPath({
323
322
  workspace: $workspaceStore,
324
- path: appPath,
323
+ path: $appPath,
325
324
  withStarredInfo: true
326
325
  });
327
326
  deployedBy = deployedApp.created_by;
@@ -339,7 +338,7 @@ async function updateApp(npath) {
339
338
  await computeTriggerables();
340
339
  await AppService.updateApp({
341
340
  workspace: $workspaceStore,
342
- path: appPath,
341
+ path: $appPath,
343
342
  requestBody: {
344
343
  value: $app,
345
344
  summary: $summary,
@@ -361,29 +360,29 @@ async function updateApp(npath) {
361
360
  version = appHistory[0]?.version;
362
361
  closeSaveDrawer();
363
362
  sendUserToast('App deployed successfully');
364
- if (appPath !== npath) {
363
+ if ($appPath !== npath) {
365
364
  try {
366
365
  localStorage.removeItem(`app-${appPath}`);
367
366
  }
368
367
  catch (e) {
369
368
  console.error('error interacting with local storage', e);
370
369
  }
371
- window.location.pathname = `/apps/edit/${npath}?nodraft=true`;
370
+ dispatch('savedNewAppPath', npath);
372
371
  }
373
372
  }
374
373
  let secretUrl = undefined;
375
- $: appPath != '' && secretUrl == undefined && getSecretUrl();
374
+ $: $appPath && $appPath != '' && secretUrl == undefined && getSecretUrl();
376
375
  async function getSecretUrl() {
377
376
  secretUrl = await AppService.getPublicSecretOfApp({
378
377
  workspace: $workspaceStore,
379
- path: appPath
378
+ path: $appPath
380
379
  });
381
380
  }
382
381
  async function setPublishState() {
383
382
  await computeTriggerables();
384
383
  await AppService.updateApp({
385
384
  workspace: $workspaceStore,
386
- path: appPath,
385
+ path: $appPath,
387
386
  requestBody: { policy }
388
387
  });
389
388
  if (policy.execution_mode == 'anonymous') {
@@ -406,7 +405,7 @@ async function saveInitialDraft() {
406
405
  workspace: $workspaceStore,
407
406
  requestBody: {
408
407
  value: $app,
409
- path: newPath,
408
+ path: newEditedPath,
410
409
  summary: $summary,
411
410
  policy,
412
411
  draft_only: true
@@ -415,11 +414,11 @@ async function saveInitialDraft() {
415
414
  await DraftService.createDraft({
416
415
  workspace: $workspaceStore,
417
416
  requestBody: {
418
- path: newPath,
417
+ path: newEditedPath,
419
418
  typ: 'app',
420
419
  value: {
421
420
  value: $app,
422
- path: newPath,
421
+ path: newEditedPath,
423
422
  summary: $summary,
424
423
  policy
425
424
  }
@@ -428,18 +427,18 @@ async function saveInitialDraft() {
428
427
  savedApp = {
429
428
  summary: $summary,
430
429
  value: structuredClone($app),
431
- path: newPath,
430
+ path: newEditedPath,
432
431
  policy,
433
432
  draft_only: true,
434
433
  draft: {
435
434
  summary: $summary,
436
435
  value: structuredClone($app),
437
- path: newPath,
436
+ path: newEditedPath,
438
437
  policy
439
438
  }
440
439
  };
441
440
  draftDrawerOpen = false;
442
- goto(`/apps/edit/${newPath}`);
441
+ dispatch('savedNewAppPath', newEditedPath);
443
442
  }
444
443
  catch (e) {
445
444
  sendUserToast('Error saving initial draft', e);
@@ -447,7 +446,7 @@ async function saveInitialDraft() {
447
446
  draftDrawerOpen = false;
448
447
  }
449
448
  async function saveDraft(forceSave = false) {
450
- if ($page.params.path == undefined) {
449
+ if (newApp) {
451
450
  // initial draft
452
451
  draftDrawerOpen = true;
453
452
  return;
@@ -459,7 +458,7 @@ async function saveDraft(forceSave = false) {
459
458
  const current = cleanValueProperties({
460
459
  summary: $summary,
461
460
  value: $app,
462
- path: newPath || savedApp.draft?.path || savedApp.path,
461
+ path: newEditedPath || savedApp.draft?.path || savedApp.path,
463
462
  policy
464
463
  });
465
464
  if (!forceSave && orderedJsonStringify(draftOrDeployed) === orderedJsonStringify(current)) {
@@ -476,7 +475,7 @@ async function saveDraft(forceSave = false) {
476
475
  loading.saveDraft = true;
477
476
  try {
478
477
  await computeTriggerables();
479
- let path = $page.params.path;
478
+ let path = $appPath;
480
479
  if (savedApp.draft_only) {
481
480
  await AppService.deleteApp({
482
481
  workspace: $workspaceStore,
@@ -488,7 +487,7 @@ async function saveDraft(forceSave = false) {
488
487
  value: $app,
489
488
  summary: $summary,
490
489
  policy,
491
- path: newPath || path,
490
+ path: newEditedPath || path,
492
491
  draft_only: true
493
492
  }
494
493
  });
@@ -496,13 +495,13 @@ async function saveDraft(forceSave = false) {
496
495
  await DraftService.createDraft({
497
496
  workspace: $workspaceStore,
498
497
  requestBody: {
499
- path: savedApp.draft_only ? newPath || path : path,
498
+ path: savedApp.draft_only ? newEditedPath || path : path,
500
499
  typ: 'app',
501
500
  value: {
502
501
  value: $app,
503
502
  summary: $summary,
504
503
  policy,
505
- path: newPath || path
504
+ path: newEditedPath || path
506
505
  }
507
506
  }
508
507
  });
@@ -511,14 +510,15 @@ async function saveDraft(forceSave = false) {
511
510
  ? {
512
511
  summary: $summary,
513
512
  value: structuredClone($app),
514
- path: savedApp.draft_only ? newPath || path : path,
515
- policy
513
+ path: savedApp.draft_only ? newEditedPath || path : path,
514
+ policy,
515
+ draft_only: true
516
516
  }
517
517
  : savedApp),
518
518
  draft: {
519
519
  summary: $summary,
520
520
  value: structuredClone($app),
521
- path: newPath || path,
521
+ path: newEditedPath || path,
522
522
  policy
523
523
  }
524
524
  };
@@ -530,8 +530,8 @@ async function saveDraft(forceSave = false) {
530
530
  console.error('error interacting with local storage', e);
531
531
  }
532
532
  loading.saveDraft = false;
533
- if (newPath || path !== path) {
534
- goto(`/apps/edit/${newPath || path}`);
533
+ if (newApp || savedApp.draft_only) {
534
+ dispatch('savedNewAppPath', newEditedPath || path);
535
535
  }
536
536
  }
537
537
  catch (e) {
@@ -547,9 +547,9 @@ async function compareVersions() {
547
547
  try {
548
548
  const appVersion = await AppService.getAppLatestVersion({
549
549
  workspace: $workspaceStore,
550
- path: appPath
550
+ path: $appPath
551
551
  });
552
- onLatest = version === appVersion?.version;
552
+ onLatest = appVersion?.version === undefined || version === appVersion?.version;
553
553
  }
554
554
  catch (e) {
555
555
  console.error('Error comparing versions', e);
@@ -681,7 +681,7 @@ let moreItems = [
681
681
  current: {
682
682
  summary: $summary,
683
683
  value: $app,
684
- path: newPath || savedApp.draft?.path || savedApp.path,
684
+ path: newEditedPath || savedApp.draft?.path || savedApp.path,
685
685
  policy
686
686
  }
687
687
  });
@@ -732,7 +732,7 @@ setTheme($app?.darkMode);
732
732
  modifiedValue={{
733
733
  summary: $summary,
734
734
  value: $app,
735
- path: newPath || savedApp?.draft?.path || savedApp?.path,
735
+ path: newEditedPath || savedApp?.draft?.path || savedApp?.path,
736
736
  policy
737
737
  }}
738
738
  additionalExitAction={() => {
@@ -749,12 +749,12 @@ setTheme($app?.darkMode);
749
749
  currentValue={{
750
750
  summary: $summary,
751
751
  value: $app,
752
- path: newPath || savedApp?.draft?.path || savedApp?.path,
752
+ path: newEditedPath || savedApp?.draft?.path || savedApp?.path,
753
753
  policy
754
754
  }}
755
755
  />
756
756
 
757
- {#if appPath == ''}
757
+ {#if $appPath == ''}
758
758
  <Drawer bind:open={draftDrawerOpen} size="800px">
759
759
  <DrawerContent title="Initial draft save" on:close={() => closeDraftDrawer()}>
760
760
  <Alert title="Require path" type="info">
@@ -771,7 +771,7 @@ setTheme($app?.darkMode);
771
771
  on:keydown|stopPropagation
772
772
  bind:value={$summary}
773
773
  on:keyup={() => {
774
- if (appPath == '' && $summary?.length > 0 && !dirtyPath) {
774
+ if ($appPath == '' && $summary?.length > 0 && !dirtyPath) {
775
775
  path?.setName(
776
776
  $summary
777
777
  .toLowerCase()
@@ -788,7 +788,7 @@ setTheme($app?.darkMode);
788
788
  autofocus={false}
789
789
  bind:this={path}
790
790
  bind:error={pathError}
791
- bind:path={newPath}
791
+ bind:path={newEditedPath}
792
792
  bind:dirty={dirtyPath}
793
793
  initialPath=""
794
794
  namePlaceholder="app"
@@ -827,7 +827,7 @@ setTheme($app?.darkMode);
827
827
  bind:value={$summary}
828
828
  on:keydown|stopPropagation
829
829
  on:keyup={() => {
830
- if (appPath == '' && $summary?.length > 0 && !dirtyPath) {
830
+ if ($appPath == '' && $summary?.length > 0 && !dirtyPath) {
831
831
  path?.setName(
832
832
  $summary
833
833
  .toLowerCase()
@@ -856,8 +856,8 @@ setTheme($app?.darkMode);
856
856
  bind:this={path}
857
857
  bind:dirty={dirtyPath}
858
858
  bind:error={pathError}
859
- bind:path={newPath}
860
- initialPath={appPath}
859
+ bind:path={newEditedPath}
860
+ initialPath={newPath}
861
861
  namePlaceholder="app"
862
862
  kind="app"
863
863
  autofocus={false}
@@ -884,16 +884,16 @@ setTheme($app?.darkMode);
884
884
  current: {
885
885
  summary: $summary,
886
886
  value: $app,
887
- path: newPath || savedApp.draft?.path || savedApp.path,
887
+ path: newEditedPath || savedApp.draft?.path || savedApp.path,
888
888
  policy
889
889
  },
890
890
  button: {
891
891
  text: 'Looks good, deploy',
892
892
  onClick: () => {
893
- if (appPath == '') {
894
- createApp(newPath)
893
+ if ($appPath == '') {
894
+ createApp(newEditedPath)
895
895
  } else {
896
- handleUpdateApp(newPath)
896
+ handleUpdateApp(newEditedPath)
897
897
  }
898
898
  }
899
899
  }
@@ -909,10 +909,10 @@ setTheme($app?.darkMode);
909
909
  startIcon={{ icon: Save }}
910
910
  disabled={pathError != ''}
911
911
  on:click={() => {
912
- if (appPath == '') {
913
- createApp(newPath)
912
+ if ($appPath == '') {
913
+ createApp(newEditedPath)
914
914
  } else {
915
- handleUpdateApp(newPath)
915
+ handleUpdateApp(newEditedPath)
916
916
  }
917
917
  }}
918
918
  >
@@ -920,7 +920,7 @@ setTheme($app?.darkMode);
920
920
  </Button>
921
921
  </div>
922
922
  <div class="py-2" />
923
- {#if appPath == ''}
923
+ {#if $appPath == ''}
924
924
  <Alert title="Require saving" type="error">
925
925
  Save this app once before you can publish it
926
926
  </Alert>
@@ -959,8 +959,8 @@ setTheme($app?.darkMode);
959
959
  <div class="my-6 box">
960
960
  Public url:
961
961
  {#if secretUrl}
962
- {@const url = `${$page.url.hostname}/public/${$workspaceStore}/${secretUrl}`}
963
- {@const href = $page.url.protocol + '//' + url}
962
+ {@const url = `${window.location.hostname}/public/${$workspaceStore}/${secretUrl}`}
963
+ {@const href = window.location.protocol + '//' + url}
964
964
  <a
965
965
  on:click={(e) => {
966
966
  e.preventDefault()
@@ -1001,7 +1001,7 @@ setTheme($app?.darkMode);
1001
1001
 
1002
1002
  <Drawer bind:open={historyBrowserDrawerOpen} size="1200px">
1003
1003
  <DrawerContent title="Deployment History" on:close={() => (historyBrowserDrawerOpen = false)}>
1004
- <DeploymentHistory on:restore {appPath} />
1004
+ <DeploymentHistory on:restore appPath={$appPath} />
1005
1005
  </DrawerContent>
1006
1006
  </Drawer>
1007
1007
 
@@ -1257,7 +1257,7 @@ setTheme($app?.darkMode);
1257
1257
  </DrawerContent>
1258
1258
  </Drawer>
1259
1259
 
1260
- <AppReportsDrawer bind:open={appReportingDrawerOpen} {appPath} />
1260
+ <AppReportsDrawer bind:open={appReportingDrawerOpen} appPath={$appPath ?? ''} />
1261
1261
 
1262
1262
  <div
1263
1263
  class="border-b flex flex-row justify-between py-1 gap-2 gap-y-2 px-2 items-center overflow-y-visible overflow-x-auto"
@@ -1385,7 +1385,7 @@ setTheme($app?.darkMode);
1385
1385
  />
1386
1386
  </div>
1387
1387
  {/if}
1388
- {#if $enterpriseLicense && appPath != ''}
1388
+ {#if $enterpriseLicense && $appPath != ''}
1389
1389
  <Awareness />
1390
1390
  {/if}
1391
1391
  <div class="flex flex-row gap-2 justify-end items-center overflow-visible">
@@ -1465,7 +1465,7 @@ setTheme($app?.darkMode);
1465
1465
  startIcon={{ icon: Save }}
1466
1466
  on:click={() => saveDraft()}
1467
1467
  size="xs"
1468
- disabled={$page.params.path !== undefined && !savedApp}
1468
+ disabled={!newApp && !savedApp}
1469
1469
  shortCut={{ key: 'S' }}
1470
1470
  >
1471
1471
  Draft
@@ -1475,7 +1475,7 @@ setTheme($app?.darkMode);
1475
1475
  startIcon={{ icon: Save }}
1476
1476
  on:click={save}
1477
1477
  size="xs"
1478
- dropdownItems={appPath != ''
1478
+ dropdownItems={$appPath != ''
1479
1479
  ? () => [
1480
1480
  {
1481
1481
  label: 'Fork',
@@ -19,6 +19,8 @@ declare const __propDef: {
19
19
  leftPanelHidden?: boolean | undefined;
20
20
  rightPanelHidden?: boolean | undefined;
21
21
  bottomPanelHidden?: boolean | undefined;
22
+ newApp: boolean;
23
+ newPath?: string | undefined;
22
24
  toggleTutorial?: (() => void) | undefined;
23
25
  openTroubleshootPanel?: (() => void) | undefined;
24
26
  };
@@ -86,6 +86,11 @@ function hashchange(e) {
86
86
  return x;
87
87
  });
88
88
  }
89
+ let writablePath = writable(appPath);
90
+ $: appPath && onPathChange();
91
+ function onPathChange() {
92
+ writablePath.set(appPath);
93
+ }
89
94
  setContext('AppViewerContext', {
90
95
  worldStore: worldStore,
91
96
  initialized: writable({ initialized: false, initializedComponents: [] }),
@@ -97,7 +102,7 @@ setContext('AppViewerContext', {
97
102
  connectingInput,
98
103
  breakpoint,
99
104
  runnableComponents: writable({}),
100
- appPath,
105
+ appPath: writablePath,
101
106
  workspace,
102
107
  onchange: undefined,
103
108
  isEditor,