windmill-components 1.109.8 → 1.121.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.
- package/package/cloud.js +0 -14
- package/package/common.d.ts +1 -0
- package/package/components/ArgEnum.svelte +53 -0
- package/package/components/ArgEnum.svelte.d.ts +24 -0
- package/package/components/ArgInfo.svelte +26 -14
- package/package/components/ArgInput.svelte +69 -83
- package/package/components/ArgInput.svelte.d.ts +2 -0
- package/package/components/ArrayTypeNarrowing.svelte +73 -0
- package/package/components/ArrayTypeNarrowing.svelte.d.ts +20 -0
- package/package/components/CenteredModal.svelte +7 -9
- package/package/components/DeployToSetting.svelte +35 -0
- package/package/components/DeployToSetting.svelte.d.ts +16 -0
- package/package/components/DeployWorkspace.svelte +555 -0
- package/package/components/DeployWorkspace.svelte.d.ts +23 -0
- package/package/components/DeployWorkspaceDrawer.svelte +35 -0
- package/package/components/DeployWorkspaceDrawer.svelte.d.ts +17 -0
- package/package/components/DiffDrawer.svelte +60 -0
- package/package/components/DiffDrawer.svelte.d.ts +23 -0
- package/package/components/DisplayResult.svelte +17 -24
- package/package/components/DraftBadge.svelte +1 -1
- package/package/components/Editor.svelte +0 -4
- package/package/components/EditorBar.svelte +127 -26
- package/package/components/EditorBar.svelte.d.ts +1 -0
- package/package/components/FieldHeader.svelte +2 -2
- package/package/components/FlowBuilder.svelte +9 -0
- package/package/components/FlowBuilder.svelte.d.ts +6 -0
- package/package/components/FlowJobResult.svelte +3 -2
- package/package/components/FlowJobResult.svelte.d.ts +1 -0
- package/package/components/FlowStatusViewer.svelte +6 -39
- package/package/components/FlowStatusWaitingForEvents.svelte +64 -0
- package/package/components/FlowStatusWaitingForEvents.svelte.d.ts +19 -0
- package/package/components/InputTransformForm.svelte +21 -11
- package/package/components/InputTransformForm.svelte.d.ts +1 -1
- package/package/components/InputTransformSchemaForm.svelte +1 -1
- package/package/components/JobArgs.svelte +120 -27
- package/package/components/LightweightArgInput.svelte +28 -15
- package/package/components/LightweightArgInput.svelte.d.ts +1 -0
- package/package/components/LightweightSchemaForm.svelte +24 -24
- package/package/components/LogViewer.svelte +23 -11
- package/package/components/LogViewer.svelte.d.ts +1 -0
- package/package/components/ModulePreview.svelte +7 -1
- package/package/components/ModulePreviewForm.svelte +8 -0
- package/package/components/ModulePreviewForm.svelte.d.ts +1 -1
- package/package/components/MoveDrawer.svelte +3 -3
- package/package/components/Path.svelte +27 -7
- package/package/components/Popover.svelte +11 -2
- package/package/components/Popover.svelte.d.ts +1 -0
- package/package/components/Required.svelte +1 -1
- package/package/components/ResourcePicker.svelte +7 -1
- package/package/components/RunForm.svelte +15 -8
- package/package/components/RunForm.svelte.d.ts +2 -0
- package/package/components/SchemaEditor.svelte +14 -12
- package/package/components/SchemaForm.svelte +9 -2
- package/package/components/SchemaModal.svelte +9 -5
- package/package/components/ScriptBuilder.svelte +21 -19
- package/package/components/ScriptEditor.svelte +6 -19
- package/package/components/ScriptPicker.svelte +13 -7
- package/package/components/ScriptVersionHistory.svelte +57 -0
- package/package/components/ScriptVersionHistory.svelte.d.ts +16 -0
- package/package/components/SimpleEditor.svelte +3 -1
- package/package/components/SimpleEditor.svelte.d.ts +1 -0
- package/package/components/Slider.svelte +2 -1
- package/package/components/Slider.svelte.d.ts +1 -0
- package/package/components/SuperadminSettings.svelte +12 -14
- package/package/components/SuperadminSettings.svelte.d.ts +0 -2
- package/package/components/Toast.svelte +1 -1
- package/package/components/Uptodate.svelte +26 -0
- package/package/components/Uptodate.svelte.d.ts +14 -0
- package/package/components/UserSettings.svelte +8 -12
- package/package/components/UserSettings.svelte.d.ts +0 -2
- package/package/components/Version.svelte +9 -0
- package/package/components/Version.svelte.d.ts +14 -0
- package/package/components/apps/components/buttons/AppButton.svelte +2 -2
- package/package/components/apps/components/buttons/AppForm.svelte +1 -2
- package/package/components/apps/components/buttons/AppFormButton.svelte +35 -38
- package/package/components/apps/components/buttons/AppSchemaForm.svelte +5 -0
- package/package/components/apps/components/display/AppChartJs.svelte +4 -3
- package/package/components/apps/components/display/AppFlowStatusComponent.svelte +2 -2
- package/package/components/apps/components/display/AppLogsComponent.svelte +7 -1
- package/package/components/apps/components/display/AppMap.svelte +11 -7
- package/package/components/apps/components/display/PlotlyHtml.svelte +1 -1
- package/package/components/apps/components/display/VegaLiteHtml.svelte +1 -1
- package/package/components/apps/components/display/table/AppAggridTable.svelte +86 -39
- package/package/components/apps/components/display/table/AppTable.svelte +29 -3
- package/package/components/apps/components/display/table/AppTableFooter.svelte +48 -43
- package/package/components/apps/components/display/table/AppTableFooter.svelte.d.ts +1 -0
- package/package/components/apps/components/helpers/InputValue.svelte +25 -3
- package/package/components/apps/components/helpers/RunnableComponent.svelte +14 -3
- package/package/components/apps/components/helpers/eval.d.ts +1 -0
- package/package/components/apps/components/helpers/eval.js +3 -1
- package/package/components/apps/components/inputs/AppCheckbox.svelte +5 -0
- package/package/components/apps/components/inputs/AppMultiSelect.svelte +1 -1
- package/package/components/apps/components/inputs/AppNumberInput.svelte +8 -1
- package/package/components/apps/components/inputs/AppQuillEditor.svelte +78 -0
- package/package/components/apps/components/inputs/AppQuillEditor.svelte.d.ts +27 -0
- package/package/components/apps/components/inputs/AppRangeInput.svelte +8 -1
- package/package/components/apps/components/inputs/AppSelect.svelte +17 -2
- package/package/components/apps/components/inputs/AppSliderInputs.svelte +18 -5
- package/package/components/apps/components/inputs/AppTextInput.svelte +66 -57
- package/package/components/apps/components/inputs/currency/AppCurrencyInput.svelte +5 -0
- package/package/components/apps/components/layout/AppDrawer.svelte +2 -2
- package/package/components/apps/components/layout/AppList.svelte +112 -0
- package/package/components/apps/components/layout/AppList.svelte.d.ts +23 -0
- package/package/components/apps/components/layout/AppModal.svelte +35 -33
- package/package/components/apps/components/layout/ListWrapper.svelte +23 -0
- package/package/components/apps/components/layout/ListWrapper.svelte.d.ts +23 -0
- package/package/components/apps/editor/AppEditor.svelte +3 -2
- package/package/components/apps/editor/AppEditorHeader.svelte +14 -9
- package/package/components/apps/editor/AppPreview.svelte +2 -2
- package/package/components/apps/editor/RecomputeAllComponents.svelte +4 -0
- package/package/components/apps/editor/SettingsPanel.svelte +1 -1
- package/package/components/apps/editor/SubGridEditor.svelte +4 -2
- package/package/components/apps/editor/appUtils.d.ts +1 -1
- package/package/components/apps/editor/appUtils.js +2 -2
- package/package/components/apps/editor/component/Component.svelte +13 -0
- package/package/components/apps/editor/component/ComponentNavigation.svelte +9 -7
- package/package/components/apps/editor/component/ComponentWrapper.svelte +1 -4
- package/package/components/apps/editor/component/components.d.ts +138 -3
- package/package/components/apps/editor/component/components.js +131 -4
- package/package/components/apps/editor/component/default-codes.js +65 -35
- package/package/components/apps/editor/component/sets.js +2 -0
- package/package/components/apps/editor/componentsPanel/quickStyleProperties.js +6 -0
- package/package/components/apps/editor/contextPanel/components/IdEditor.svelte +2 -2
- package/package/components/apps/editor/contextPanel/components/OutputHeader.svelte +2 -1
- package/package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +3 -2
- package/package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +1 -1
- package/package/components/apps/editor/settingsPanel/ArrayStaticInputEditor.svelte +3 -3
- package/package/components/apps/editor/settingsPanel/ComponentPanel.svelte +1 -1
- package/package/components/apps/editor/settingsPanel/GridCondition.svelte +1 -1
- package/package/components/apps/editor/settingsPanel/GridPane.svelte +1 -2
- package/package/components/apps/editor/settingsPanel/GridTab.svelte +2 -2
- package/package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +6 -2
- package/package/components/apps/editor/settingsPanel/Recompute.svelte +1 -1
- package/package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte +16 -2
- package/package/components/apps/editor/settingsPanel/inputEditor/JsonEditor.svelte.d.ts +1 -0
- package/package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +7 -4
- package/package/components/apps/editor/settingsPanel/script/shared/ScriptRunConfiguration.svelte +2 -2
- package/package/components/apps/types.d.ts +8 -0
- package/package/components/apps/utils.js +2 -0
- package/package/components/common/badge/Badge.svelte +2 -1
- package/package/components/common/badge/Badge.svelte.d.ts +1 -0
- package/package/components/common/fileInput/FileInput.svelte +1 -1
- package/package/components/common/modal/AlwaysMountedModal.svelte +52 -54
- package/package/components/common/modal/AlwaysMountedModal.svelte.d.ts +1 -0
- package/package/components/common/table/AppRow.svelte +28 -1
- package/package/components/common/table/AppRow.svelte.d.ts +2 -0
- package/package/components/common/table/FlowRow.svelte +29 -2
- package/package/components/common/table/FlowRow.svelte.d.ts +2 -0
- package/package/components/common/table/RawAppRow.svelte +16 -0
- package/package/components/common/table/RawAppRow.svelte.d.ts +2 -0
- package/package/components/common/table/ScriptRow.svelte +29 -2
- package/package/components/common/table/ScriptRow.svelte.d.ts +2 -0
- package/package/components/common/tabs/Tab.svelte +2 -2
- package/package/components/common/tabs/Tabs.svelte +3 -6
- package/package/components/common/tabs/Tabs.svelte.d.ts +1 -1
- package/package/components/common/toggleButton-v2/ToggleButton.svelte +3 -1
- package/package/components/common/toggleButton-v2/ToggleButton.svelte.d.ts +1 -0
- package/package/components/flows/common/FlowCardHeader.svelte +13 -15
- package/package/components/flows/content/FlowBranchesAllWrapper.svelte +8 -1
- package/package/components/flows/content/FlowBranchesOneWrapper.svelte +8 -1
- package/package/components/flows/content/FlowLoop.svelte +8 -1
- package/package/components/flows/content/FlowModuleCache.svelte +1 -1
- package/package/components/flows/content/FlowModuleComponent.svelte +13 -4
- package/package/components/flows/content/FlowModuleHeader.svelte +27 -18
- package/package/components/flows/content/FlowModuleHeader.svelte.d.ts +1 -0
- package/package/components/flows/content/FlowModuleMock.svelte +51 -0
- package/package/components/flows/content/FlowModuleMock.svelte.d.ts +17 -0
- package/package/components/flows/content/FlowModuleSuspend.svelte +49 -2
- package/package/components/flows/flowExplorer.d.ts +11 -0
- package/package/components/flows/flowExplorer.js +137 -0
- package/package/components/flows/map/FlowErrorHandlerItem.svelte +3 -2
- package/package/components/flows/map/FlowModuleSchemaItem.svelte +13 -1
- package/package/components/flows/map/FlowModuleSchemaItem.svelte.d.ts +1 -0
- package/package/components/flows/map/FlowModuleSchemaMap.svelte +1 -1
- package/package/components/flows/map/MapItem.svelte +2 -1
- package/package/components/flows/previousResults.d.ts +0 -2
- package/package/components/flows/previousResults.js +1 -67
- package/package/components/graph/FlowGraph.svelte +71 -13
- package/package/components/graph/svelvet/container/views/GraphView.svelte +22 -0
- package/package/components/graph/svelvet/container/views/GraphView.svelte.d.ts +2 -0
- package/package/components/graph/svelvet/container/views/Svelvet.svelte +13 -1
- package/package/components/graph/svelvet/container/views/Svelvet.svelte.d.ts +2 -0
- package/package/components/graph/svelvet/edges/models/Edge.d.ts +2 -1
- package/package/components/graph/svelvet/edges/models/Edge.js +3 -1
- package/package/components/graph/svelvet/edges/views/Edges/SimpleBezierEdge.svelte +2 -13
- package/package/components/graph/svelvet/store/controllers/util.js +1 -1
- package/package/components/graph/svelvet/types/types.d.ts +1 -0
- package/package/components/home/ItemsList.svelte +50 -41
- package/package/components/home/ListFilters.svelte +0 -1
- package/package/components/jobs/JobDetail.svelte +1 -1
- package/package/components/jobs/JobPreview.svelte +29 -13
- package/package/components/jobs/JobPreview.svelte.d.ts +1 -2
- package/package/components/scriptEditor/LogPanel.svelte +6 -1
- package/package/components/scriptEditor/LogPanel.svelte.d.ts +1 -1
- package/package/gen/core/OpenAPI.js +1 -1
- package/package/gen/index.d.ts +1 -0
- package/package/gen/models/EditResourceType.d.ts +1 -1
- package/package/gen/models/FlowModule.d.ts +7 -0
- package/package/gen/models/ScheduleWJobs.d.ts +8 -0
- package/package/gen/models/ScheduleWJobs.js +4 -0
- package/package/gen/services/DraftService.d.ts +10 -0
- package/package/gen/services/DraftService.js +16 -0
- package/package/gen/services/JobService.d.ts +24 -3
- package/package/gen/services/JobService.js +21 -3
- package/package/gen/services/ScheduleService.d.ts +17 -0
- package/package/gen/services/ScheduleService.js +18 -0
- package/package/gen/services/SettingsService.d.ts +6 -0
- package/package/gen/services/SettingsService.js +11 -0
- package/package/gen/services/WorkspaceService.d.ts +22 -0
- package/package/gen/services/WorkspaceService.js +30 -0
- package/package/infer.js +17 -3
- package/package/script_helpers.js +16 -5
- package/package/scripts.js +11 -1
- package/package/utils.d.ts +1 -0
- package/package/utils.js +1 -0
- package/package.json +21 -12
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from 'svelte';
|
|
2
|
+
import { enterpriseLicense, superadmin, workspaceStore } from '../stores';
|
|
3
|
+
import { AppService, FlowService, RawAppService, ResourceService, ScheduleService, ScriptService, UserService, VariableService, WorkspaceService } from '../gen';
|
|
4
|
+
import { getAllModules } from './flows/flowExplorer';
|
|
5
|
+
import Button from './common/button/Button.svelte';
|
|
6
|
+
import Tooltip from './Tooltip.svelte';
|
|
7
|
+
import Alert from './common/alert/Alert.svelte';
|
|
8
|
+
import Toggle from './Toggle.svelte';
|
|
9
|
+
import { Loader2 } from 'lucide-svelte';
|
|
10
|
+
import Badge from './common/badge/Badge.svelte';
|
|
11
|
+
import DiffDrawer from './DiffDrawer.svelte';
|
|
12
|
+
const dispatch = createEventDispatcher();
|
|
13
|
+
export let kind;
|
|
14
|
+
export let initialPath = '';
|
|
15
|
+
export let workspaceToDeployTo = undefined;
|
|
16
|
+
export let hideButton = false;
|
|
17
|
+
let seeTarget = undefined;
|
|
18
|
+
let dependencies = undefined;
|
|
19
|
+
const allAlreadyExists = {};
|
|
20
|
+
let diffDrawer;
|
|
21
|
+
let notSet = undefined;
|
|
22
|
+
$: WorkspaceService.getDeployTo({ workspace: $workspaceStore }).then((x) => {
|
|
23
|
+
workspaceToDeployTo = x.deploy_to;
|
|
24
|
+
if (x.deploy_to == undefined) {
|
|
25
|
+
notSet = true;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
$: workspaceToDeployTo && reload(initialPath);
|
|
29
|
+
async function reload(path) {
|
|
30
|
+
try {
|
|
31
|
+
if (!$superadmin) {
|
|
32
|
+
await UserService.whoami({ workspace: workspaceToDeployTo });
|
|
33
|
+
}
|
|
34
|
+
seeTarget = true;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
seeTarget = false;
|
|
38
|
+
}
|
|
39
|
+
dependencies = (await getDependencies(kind, path)).map((x) => ({
|
|
40
|
+
...x,
|
|
41
|
+
include: kind == 'variable' ||
|
|
42
|
+
kind == 'resource' ||
|
|
43
|
+
kind == 'resource_type' ||
|
|
44
|
+
(x.kind != 'variable' && x.kind != 'resource' && x.kind != 'resource_type')
|
|
45
|
+
}));
|
|
46
|
+
dependencies.forEach((x) => {
|
|
47
|
+
checkAlreadyExists(x.kind, x.path).then((y) => (allAlreadyExists[computeStatusPath(x.kind, x.path)] = y));
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
async function getDependencies(kind, path) {
|
|
51
|
+
async function rec(kind, path) {
|
|
52
|
+
if (kind == 'schedule') {
|
|
53
|
+
const schedule = await ScheduleService.getSchedule({ workspace: $workspaceStore, path });
|
|
54
|
+
if (schedule.script_path && schedule.script_path != '') {
|
|
55
|
+
if (schedule.script_path) {
|
|
56
|
+
return [{ kind: 'script', path: schedule.script_path }];
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return [{ kind: 'flow', path: schedule.script_path }];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else if (kind == 'flow') {
|
|
67
|
+
const flow = await FlowService.getFlowByPath({ workspace: $workspaceStore, path });
|
|
68
|
+
return getAllModules(flow.value.modules, flow.value.failure_module).flatMap((x) => {
|
|
69
|
+
let result = [];
|
|
70
|
+
if (x.value.type == 'script' || x.value.type == 'rawscript' || x.value.type == 'flow') {
|
|
71
|
+
Object.values(x.value.input_transforms).forEach((y) => {
|
|
72
|
+
if (y.type == 'static' && typeof y.value == 'string') {
|
|
73
|
+
if (y.value.startsWith('$res:')) {
|
|
74
|
+
result.push({ kind: 'resource', path: y.value.substring(5) });
|
|
75
|
+
}
|
|
76
|
+
else if (y.value.startsWith('$var:')) {
|
|
77
|
+
result.push({ kind: 'variable', path: y.value.substring(5) });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (x.value.type == 'script') {
|
|
83
|
+
if (x.value.path && !x.value.path.startsWith('hub/')) {
|
|
84
|
+
result.push({ kind: 'script', path: x.value.path });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else if (x.value.type == 'flow') {
|
|
88
|
+
if (x.value.path) {
|
|
89
|
+
result.push({ kind: 'flow', path: x.value.path });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return result;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
else if (kind == 'resource') {
|
|
96
|
+
const res = await ResourceService.getResource({ workspace: $workspaceStore, path });
|
|
97
|
+
function recObj(obj) {
|
|
98
|
+
if (typeof obj == 'string' && obj.startsWith('$var:')) {
|
|
99
|
+
return [{ kind: 'variable', path: obj.substring(5) }];
|
|
100
|
+
}
|
|
101
|
+
else if (typeof obj == 'object') {
|
|
102
|
+
return Object.values(obj).flatMap((x) => recObj(x));
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return [...recObj(res.value), { kind: 'resource_type', path: res.resource_type }];
|
|
109
|
+
}
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
let toProcess = [{ kind, path }];
|
|
113
|
+
let processed = [];
|
|
114
|
+
while (toProcess.length > 0) {
|
|
115
|
+
const { kind, path } = toProcess.pop();
|
|
116
|
+
console.log('BAR', kind, path);
|
|
117
|
+
toProcess.push(...(await rec(kind, path)));
|
|
118
|
+
processed.push({ kind, path });
|
|
119
|
+
}
|
|
120
|
+
processed.reverse();
|
|
121
|
+
return processed;
|
|
122
|
+
}
|
|
123
|
+
async function checkAlreadyExists(kind, path) {
|
|
124
|
+
if (kind == 'flow') {
|
|
125
|
+
return await FlowService.existsFlowByPath({
|
|
126
|
+
workspace: workspaceToDeployTo,
|
|
127
|
+
path: path
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
else if (kind == 'script') {
|
|
131
|
+
return await ScriptService.existsScriptByPath({
|
|
132
|
+
workspace: workspaceToDeployTo,
|
|
133
|
+
path: path
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
else if (kind == 'app') {
|
|
137
|
+
return await AppService.existsApp({
|
|
138
|
+
workspace: workspaceToDeployTo,
|
|
139
|
+
path: path
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
else if (kind == 'raw_app') {
|
|
143
|
+
return await RawAppService.existsRawApp({
|
|
144
|
+
workspace: workspaceToDeployTo,
|
|
145
|
+
path: path
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
else if (kind == 'variable') {
|
|
149
|
+
return await VariableService.existsVariable({
|
|
150
|
+
workspace: workspaceToDeployTo,
|
|
151
|
+
path: path
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
else if (kind == 'resource') {
|
|
155
|
+
return await ResourceService.existsResource({
|
|
156
|
+
workspace: workspaceToDeployTo,
|
|
157
|
+
path: path
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
else if (kind == 'schedule') {
|
|
161
|
+
return await ScheduleService.existsSchedule({
|
|
162
|
+
workspace: workspaceToDeployTo,
|
|
163
|
+
path: path
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
else if (kind == 'resource_type') {
|
|
167
|
+
return await ResourceService.existsResourceType({
|
|
168
|
+
workspace: workspaceToDeployTo,
|
|
169
|
+
path: path
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
throw new Error(`Unknown kind ${kind}`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const deploymentStatus = {};
|
|
177
|
+
async function deploy(kind, path) {
|
|
178
|
+
const statusPath = `${kind}:${path}`;
|
|
179
|
+
deploymentStatus[statusPath] = { status: 'loading' };
|
|
180
|
+
try {
|
|
181
|
+
let alreadyExists = await checkAlreadyExists(kind, path);
|
|
182
|
+
if (kind == 'flow') {
|
|
183
|
+
const flow = await FlowService.getFlowByPath({
|
|
184
|
+
workspace: $workspaceStore,
|
|
185
|
+
path: path
|
|
186
|
+
});
|
|
187
|
+
getAllModules(flow.value.modules).forEach((x) => {
|
|
188
|
+
if (x.value.type == 'script' && x.value.hash != undefined) {
|
|
189
|
+
x.value.hash = undefined;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
if (alreadyExists) {
|
|
193
|
+
await FlowService.updateFlow({
|
|
194
|
+
workspace: workspaceToDeployTo,
|
|
195
|
+
path: path,
|
|
196
|
+
requestBody: {
|
|
197
|
+
...flow
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
await FlowService.createFlow({
|
|
203
|
+
workspace: workspaceToDeployTo,
|
|
204
|
+
requestBody: {
|
|
205
|
+
...flow
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
else if (kind == 'script') {
|
|
211
|
+
const script = await ScriptService.getScriptByPath({
|
|
212
|
+
workspace: $workspaceStore,
|
|
213
|
+
path: path
|
|
214
|
+
});
|
|
215
|
+
await ScriptService.createScript({
|
|
216
|
+
workspace: workspaceToDeployTo,
|
|
217
|
+
requestBody: {
|
|
218
|
+
...script,
|
|
219
|
+
lock: script.lock?.split('\n'),
|
|
220
|
+
parent_hash: alreadyExists
|
|
221
|
+
? (await ScriptService.getScriptByPath({
|
|
222
|
+
workspace: workspaceToDeployTo,
|
|
223
|
+
path: path
|
|
224
|
+
})).hash
|
|
225
|
+
: undefined
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
else if (kind == 'app') {
|
|
230
|
+
const app = await AppService.getAppByPath({
|
|
231
|
+
workspace: $workspaceStore,
|
|
232
|
+
path: path
|
|
233
|
+
});
|
|
234
|
+
if (alreadyExists) {
|
|
235
|
+
await AppService.updateApp({
|
|
236
|
+
workspace: workspaceToDeployTo,
|
|
237
|
+
path: path,
|
|
238
|
+
requestBody: {
|
|
239
|
+
...app
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
await AppService.createApp({
|
|
245
|
+
workspace: workspaceToDeployTo,
|
|
246
|
+
requestBody: {
|
|
247
|
+
...app
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
else if (kind == 'variable') {
|
|
253
|
+
const variable = await VariableService.getVariable({
|
|
254
|
+
workspace: $workspaceStore,
|
|
255
|
+
path: path,
|
|
256
|
+
decryptSecret: true
|
|
257
|
+
});
|
|
258
|
+
if (alreadyExists) {
|
|
259
|
+
await VariableService.updateVariable({
|
|
260
|
+
workspace: workspaceToDeployTo,
|
|
261
|
+
path: path,
|
|
262
|
+
requestBody: {
|
|
263
|
+
path: path,
|
|
264
|
+
value: variable.value ?? '',
|
|
265
|
+
is_secret: variable.is_secret,
|
|
266
|
+
description: variable.description ?? ''
|
|
267
|
+
},
|
|
268
|
+
alreadyEncrypted: false
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
await VariableService.createVariable({
|
|
273
|
+
workspace: workspaceToDeployTo,
|
|
274
|
+
requestBody: {
|
|
275
|
+
path: path,
|
|
276
|
+
value: variable.value ?? '',
|
|
277
|
+
is_secret: variable.is_secret,
|
|
278
|
+
description: variable.description ?? ''
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
else if (kind == 'resource') {
|
|
284
|
+
const resource = await ResourceService.getResource({
|
|
285
|
+
workspace: $workspaceStore,
|
|
286
|
+
path: path
|
|
287
|
+
});
|
|
288
|
+
if (alreadyExists) {
|
|
289
|
+
await ResourceService.updateResource({
|
|
290
|
+
workspace: workspaceToDeployTo,
|
|
291
|
+
path: path,
|
|
292
|
+
requestBody: {
|
|
293
|
+
path: path,
|
|
294
|
+
value: resource.value ?? '',
|
|
295
|
+
description: resource.description ?? ''
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
await ResourceService.createResource({
|
|
301
|
+
workspace: workspaceToDeployTo,
|
|
302
|
+
requestBody: {
|
|
303
|
+
path: path,
|
|
304
|
+
value: resource.value ?? '',
|
|
305
|
+
resource_type: resource.resource_type,
|
|
306
|
+
description: resource.description ?? ''
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
else if (kind == 'resource_type') {
|
|
312
|
+
const resource = await ResourceService.getResourceType({
|
|
313
|
+
workspace: $workspaceStore,
|
|
314
|
+
path: path
|
|
315
|
+
});
|
|
316
|
+
if (alreadyExists) {
|
|
317
|
+
await ResourceService.updateResourceType({
|
|
318
|
+
workspace: workspaceToDeployTo,
|
|
319
|
+
path: path,
|
|
320
|
+
requestBody: {
|
|
321
|
+
schema: resource.schema,
|
|
322
|
+
description: resource.description ?? ''
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
await ResourceService.createResourceType({
|
|
328
|
+
workspace: workspaceToDeployTo,
|
|
329
|
+
requestBody: {
|
|
330
|
+
description: resource.description ?? '',
|
|
331
|
+
schema: resource.schema,
|
|
332
|
+
name: resource.name
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
else if (kind == 'raw_app') {
|
|
338
|
+
throw new Error('Raw app deploy not implemented yet');
|
|
339
|
+
// const app = await RawAppService.getRawAppData({
|
|
340
|
+
// workspace: $workspaceStore!,
|
|
341
|
+
// path: path
|
|
342
|
+
// })
|
|
343
|
+
// if (alreadyExists) {
|
|
344
|
+
// }
|
|
345
|
+
// await RawAppService.updateRawApp({
|
|
346
|
+
// workspace: $workspaceStore!,
|
|
347
|
+
// path: path,
|
|
348
|
+
// requestBody: {
|
|
349
|
+
// path: path
|
|
350
|
+
// }
|
|
351
|
+
// })
|
|
352
|
+
}
|
|
353
|
+
allAlreadyExists[statusPath] = true;
|
|
354
|
+
deploymentStatus[statusPath] = { status: 'deployed' };
|
|
355
|
+
}
|
|
356
|
+
catch (e) {
|
|
357
|
+
deploymentStatus[statusPath] = { status: 'failed', error: e.body || e.message };
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
export function deployAll() {
|
|
361
|
+
dependencies?.slice().forEach(async ({ kind, path, include }) => {
|
|
362
|
+
if (include) {
|
|
363
|
+
await deploy(kind, path);
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
dispatch('update', initialPath);
|
|
367
|
+
}
|
|
368
|
+
function computeStatusPath(kind, path) {
|
|
369
|
+
return `${kind}:${path}`;
|
|
370
|
+
}
|
|
371
|
+
async function getValue(kind, path, workspace) {
|
|
372
|
+
try {
|
|
373
|
+
if (kind == 'flow') {
|
|
374
|
+
const flow = await FlowService.getFlowByPath({
|
|
375
|
+
workspace: workspace,
|
|
376
|
+
path: path
|
|
377
|
+
});
|
|
378
|
+
getAllModules(flow.value.modules).forEach((x) => {
|
|
379
|
+
if (x.value.type == 'script' && x.value.hash != undefined) {
|
|
380
|
+
x.value.hash = undefined;
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
return flow.value;
|
|
384
|
+
}
|
|
385
|
+
else if (kind == 'script') {
|
|
386
|
+
const script = await ScriptService.getScriptByPath({
|
|
387
|
+
workspace: workspace,
|
|
388
|
+
path: path
|
|
389
|
+
});
|
|
390
|
+
return {
|
|
391
|
+
content: script.content,
|
|
392
|
+
lock: script.lock,
|
|
393
|
+
schema: script.schema,
|
|
394
|
+
summary: script.summary
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
else if (kind == 'app') {
|
|
398
|
+
const app = await AppService.getAppByPath({
|
|
399
|
+
workspace: workspace,
|
|
400
|
+
path: path
|
|
401
|
+
});
|
|
402
|
+
return app;
|
|
403
|
+
}
|
|
404
|
+
else if (kind == 'variable') {
|
|
405
|
+
const variable = await VariableService.getVariable({
|
|
406
|
+
workspace: workspace,
|
|
407
|
+
path: path,
|
|
408
|
+
decryptSecret: true
|
|
409
|
+
});
|
|
410
|
+
return variable.value;
|
|
411
|
+
}
|
|
412
|
+
else if (kind == 'resource') {
|
|
413
|
+
const resource = await ResourceService.getResource({
|
|
414
|
+
workspace: workspace,
|
|
415
|
+
path: path
|
|
416
|
+
});
|
|
417
|
+
return resource.value;
|
|
418
|
+
}
|
|
419
|
+
else if (kind == 'resource_type') {
|
|
420
|
+
const resource = await ResourceService.getResourceType({
|
|
421
|
+
workspace: workspace,
|
|
422
|
+
path: path
|
|
423
|
+
});
|
|
424
|
+
return resource.schema;
|
|
425
|
+
}
|
|
426
|
+
else if (kind == 'raw_app') {
|
|
427
|
+
throw new Error('Raw app deploy not implemented yet');
|
|
428
|
+
// const app = await RawAppService.getRawAppData({
|
|
429
|
+
// workspace: workspace,
|
|
430
|
+
// path: path
|
|
431
|
+
// })
|
|
432
|
+
// if (alreadyExists) {
|
|
433
|
+
// }
|
|
434
|
+
// await RawAppService.updateRawApp({
|
|
435
|
+
// workspace: workspace,
|
|
436
|
+
// path: path,
|
|
437
|
+
// requestBody: {
|
|
438
|
+
// path: path
|
|
439
|
+
// }
|
|
440
|
+
// })
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
catch {
|
|
444
|
+
return {};
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
async function showDiff(kind, path) {
|
|
448
|
+
diffDrawer.openDrawer();
|
|
449
|
+
let values = await Promise.all([
|
|
450
|
+
getValue(kind, path, $workspaceStore),
|
|
451
|
+
getValue(kind, path, workspaceToDeployTo)
|
|
452
|
+
]);
|
|
453
|
+
diffDrawer.setDiff(JSON.stringify(values[0], null, 2), JSON.stringify(values[1], null, 2));
|
|
454
|
+
}
|
|
455
|
+
</script>
|
|
456
|
+
|
|
457
|
+
<div class="mt-6" />
|
|
458
|
+
|
|
459
|
+
{#if !$enterpriseLicense}
|
|
460
|
+
<Alert type="error" title="Enterprise license required"
|
|
461
|
+
>Deploy to staging/prod from the web UI is only available with an enterprise license</Alert
|
|
462
|
+
>
|
|
463
|
+
{:else if notSet == true}
|
|
464
|
+
<Alert type="error" title="Staging/Prod deploy not set up"
|
|
465
|
+
>As an admin, go to "Workspace {'->'} Dev/Staging/Prod"</Alert
|
|
466
|
+
>
|
|
467
|
+
{:else}
|
|
468
|
+
<Alert type="info" title="Shareable page"
|
|
469
|
+
>Share this <a href="/deploy/{kind}/{initialPath}">link</a> to have another properly permissioned
|
|
470
|
+
user do the deployment</Alert
|
|
471
|
+
>
|
|
472
|
+
|
|
473
|
+
<h3 class="mb-2 mt-8"
|
|
474
|
+
>Destination Workspace <Tooltip
|
|
475
|
+
>Workspace to deploy to is set in the workspace settings</Tooltip
|
|
476
|
+
></h3
|
|
477
|
+
>
|
|
478
|
+
<input class="max-w-xs" type="text" disabled value={workspaceToDeployTo} />
|
|
479
|
+
|
|
480
|
+
{#if seeTarget == undefined}
|
|
481
|
+
<div class="mt-6" />
|
|
482
|
+
<Loader2 class="animate-spin" />
|
|
483
|
+
{:else if seeTarget == true}
|
|
484
|
+
<h3 class="mb-6 mt-16">All related deployable items</h3>
|
|
485
|
+
|
|
486
|
+
<DiffDrawer bind:this={diffDrawer} />
|
|
487
|
+
<div class="grid grid-cols-9 justify-center max-w-3xl gap-2">
|
|
488
|
+
{#each dependencies ?? [] as { kind, path, include }}
|
|
489
|
+
{@const statusPath = computeStatusPath(kind, path)}
|
|
490
|
+
<div class="col-span-1 truncate text-gray-700 text-sm">{kind}</div><div
|
|
491
|
+
class="col-span-5 truncate font-semibold">{path}</div
|
|
492
|
+
><div class="col-span-1"><Toggle size="xs" bind:checked={include} /></div><div
|
|
493
|
+
class="col-span-1"
|
|
494
|
+
>
|
|
495
|
+
{#if allAlreadyExists[statusPath] == false}
|
|
496
|
+
{#if include}
|
|
497
|
+
<Badge
|
|
498
|
+
>New <Tooltip
|
|
499
|
+
>This {kind} doesn't exist yet on the target and will be created by the deployment</Tooltip
|
|
500
|
+
></Badge
|
|
501
|
+
>
|
|
502
|
+
{:else}
|
|
503
|
+
<Badge color="red">
|
|
504
|
+
Missing
|
|
505
|
+
<Tooltip
|
|
506
|
+
>{#if kind == 'resource_type'}
|
|
507
|
+
Resource types are not re-deployed by default. We strongly recommend to add
|
|
508
|
+
shared resource types in 'admin' workspace, which will have them be shared to
|
|
509
|
+
every workspace.
|
|
510
|
+
{:else}
|
|
511
|
+
This {kind} doesn't exist and is not included in the deployment. Variables and Resources
|
|
512
|
+
are considered to be workspace specific and are never included by default.
|
|
513
|
+
{/if}</Tooltip
|
|
514
|
+
>
|
|
515
|
+
</Badge>
|
|
516
|
+
{/if}
|
|
517
|
+
{:else if allAlreadyExists[statusPath] == true}
|
|
518
|
+
<button
|
|
519
|
+
class="text-blue-600 font-normal mt-1"
|
|
520
|
+
on:click={() => {
|
|
521
|
+
showDiff(kind, path)
|
|
522
|
+
}}>diff</button
|
|
523
|
+
>
|
|
524
|
+
{/if}</div
|
|
525
|
+
>
|
|
526
|
+
<div class="col-span-1">
|
|
527
|
+
{#if deploymentStatus[statusPath]}
|
|
528
|
+
{#if deploymentStatus[statusPath].status == 'loading'}
|
|
529
|
+
<Loader2 class="animate-spin" />
|
|
530
|
+
{:else if deploymentStatus[statusPath].status == 'deployed'}
|
|
531
|
+
<Badge color="green">Deployed</Badge>
|
|
532
|
+
{:else if deploymentStatus[statusPath].status == 'failed'}
|
|
533
|
+
<Badge color="red">Failed</Badge>
|
|
534
|
+
<Tooltip>{deploymentStatus[statusPath].error}</Tooltip>
|
|
535
|
+
{/if}
|
|
536
|
+
{:else}
|
|
537
|
+
<Button color="light" size="xs" on:click={() => deploy(kind, path)}>Deploy</Button>
|
|
538
|
+
{/if}
|
|
539
|
+
</div>
|
|
540
|
+
{/each}
|
|
541
|
+
</div>
|
|
542
|
+
|
|
543
|
+
{#if !hideButton}
|
|
544
|
+
<div class="mt-16 flex flex-row-reverse max-w-3xl"
|
|
545
|
+
><Button on:click={deployAll}>Deploy All Toggled</Button></div
|
|
546
|
+
>
|
|
547
|
+
{/if}
|
|
548
|
+
{:else}
|
|
549
|
+
<div class="my-2" />
|
|
550
|
+
<Alert type="error" title="User not allowed to deploy to this workspace"
|
|
551
|
+
>Ask a permissioned user to deploy this item using the shareable link or get the proper
|
|
552
|
+
permissions on the target workspace</Alert
|
|
553
|
+
>
|
|
554
|
+
{/if}
|
|
555
|
+
{/if}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
kind: "flow" | "script" | "resource" | "app" | "raw_app" | "schedule" | "variable" | "resource_type";
|
|
5
|
+
initialPath?: string | undefined;
|
|
6
|
+
workspaceToDeployTo?: string | undefined;
|
|
7
|
+
hideButton?: boolean | undefined;
|
|
8
|
+
deployAll?: (() => void) | undefined;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
update: CustomEvent<any>;
|
|
12
|
+
} & {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {};
|
|
16
|
+
};
|
|
17
|
+
export type DeployWorkspaceProps = typeof __propDef.props;
|
|
18
|
+
export type DeployWorkspaceEvents = typeof __propDef.events;
|
|
19
|
+
export type DeployWorkspaceSlots = typeof __propDef.slots;
|
|
20
|
+
export default class DeployWorkspace extends SvelteComponentTyped<DeployWorkspaceProps, DeployWorkspaceEvents, DeployWorkspaceSlots> {
|
|
21
|
+
get deployAll(): () => void;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script>import { Button, Drawer } from './common';
|
|
2
|
+
import DrawerContent from './common/drawer/DrawerContent.svelte';
|
|
3
|
+
import DeployWorkspace from './DeployWorkspace.svelte';
|
|
4
|
+
let initialPath = undefined;
|
|
5
|
+
let kind = undefined;
|
|
6
|
+
let drawer = undefined;
|
|
7
|
+
let workspaceToDeployTo = undefined;
|
|
8
|
+
let deployWorkspace = undefined;
|
|
9
|
+
export async function openDrawer(initialPath_l, kind_l) {
|
|
10
|
+
initialPath = initialPath_l;
|
|
11
|
+
kind = kind_l;
|
|
12
|
+
drawer?.openDrawer();
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<Drawer bind:this={drawer} size="900px">
|
|
17
|
+
<DrawerContent title="Deploy {initialPath} to staging or prod" on:close={drawer.closeDrawer}>
|
|
18
|
+
{#if kind != undefined && initialPath != undefined}
|
|
19
|
+
<DeployWorkspace
|
|
20
|
+
hideButton
|
|
21
|
+
{initialPath}
|
|
22
|
+
{kind}
|
|
23
|
+
bind:workspaceToDeployTo
|
|
24
|
+
bind:this={deployWorkspace}
|
|
25
|
+
/>
|
|
26
|
+
{/if}
|
|
27
|
+
|
|
28
|
+
<svelte:fragment slot="actions">
|
|
29
|
+
<Button
|
|
30
|
+
disabled={workspaceToDeployTo == undefined}
|
|
31
|
+
on:click={() => deployWorkspace?.deployAll()}>Deploy All</Button
|
|
32
|
+
>
|
|
33
|
+
</svelte:fragment>
|
|
34
|
+
</DrawerContent>
|
|
35
|
+
</Drawer>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
openDrawer?: ((initialPath_l: string, kind_l: "flow" | "script" | "resource" | "app" | "raw_app" | "schedule" | "variable") => Promise<void>) | undefined;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {};
|
|
10
|
+
};
|
|
11
|
+
export type DeployWorkspaceDrawerProps = typeof __propDef.props;
|
|
12
|
+
export type DeployWorkspaceDrawerEvents = typeof __propDef.events;
|
|
13
|
+
export type DeployWorkspaceDrawerSlots = typeof __propDef.slots;
|
|
14
|
+
export default class DeployWorkspaceDrawer extends SvelteComponentTyped<DeployWorkspaceDrawerProps, DeployWorkspaceDrawerEvents, DeployWorkspaceDrawerSlots> {
|
|
15
|
+
get openDrawer(): (initialPath_l: string, kind_l: "flow" | "script" | "resource" | "app" | "raw_app" | "schedule" | "variable") => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script>import * as Diff from 'diff';
|
|
2
|
+
import { Button, Drawer, DrawerContent } from './common';
|
|
3
|
+
import { Loader2 } from 'lucide-svelte';
|
|
4
|
+
let diffViewer;
|
|
5
|
+
let diffContent = undefined;
|
|
6
|
+
export let button = undefined;
|
|
7
|
+
export function openDrawer() {
|
|
8
|
+
diffContent = undefined;
|
|
9
|
+
diffViewer.openDrawer();
|
|
10
|
+
}
|
|
11
|
+
export function setDiff(local, remote) {
|
|
12
|
+
let finalString = '';
|
|
13
|
+
for (const part of Diff.diffLines(local, remote)) {
|
|
14
|
+
if (part.removed) {
|
|
15
|
+
// print red if removed without newline
|
|
16
|
+
finalString += `<span class="text-red-600">${part.value}</span>`;
|
|
17
|
+
}
|
|
18
|
+
else if (part.added) {
|
|
19
|
+
// print green if added
|
|
20
|
+
finalString += `<span class="text-green-600">${part.value}</span>`;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
let lines = part.value.split('\n');
|
|
24
|
+
if (lines.length > 12) {
|
|
25
|
+
lines = lines.slice(0, 6);
|
|
26
|
+
lines.push('...');
|
|
27
|
+
lines = lines.concat(part.value.split('\n').slice(-6));
|
|
28
|
+
}
|
|
29
|
+
// print white if unchanged
|
|
30
|
+
finalString += `${lines.join('\n')}`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
diffContent = finalString;
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<Drawer bind:this={diffViewer} size="800px">
|
|
38
|
+
<DrawerContent title="Diff" on:close={diffViewer.closeDrawer}>
|
|
39
|
+
{#if diffContent == undefined}
|
|
40
|
+
<Loader2 class="animate-spin" />
|
|
41
|
+
{:else}
|
|
42
|
+
<pre class="border bg-white p-2"><code>{@html diffContent}</code></pre>
|
|
43
|
+
<div class="flex flex-row-reverse gap-2">
|
|
44
|
+
<div class="text-red-600">Removed</div>
|
|
45
|
+
<div class="text-green-600">Added</div></div
|
|
46
|
+
>
|
|
47
|
+
{/if}
|
|
48
|
+
<svelte:fragment slot="actions">
|
|
49
|
+
{#if button}
|
|
50
|
+
<Button
|
|
51
|
+
color="light"
|
|
52
|
+
on:click={() => {
|
|
53
|
+
button?.onClick()
|
|
54
|
+
diffViewer.closeDrawer()
|
|
55
|
+
}}>{button.text}</Button
|
|
56
|
+
>
|
|
57
|
+
{/if}
|
|
58
|
+
</svelte:fragment>
|
|
59
|
+
</DrawerContent>
|
|
60
|
+
</Drawer>
|