Skip to content

Commit da6e21c

Browse files
committed
Added "Load example" in version update sandbox page
1 parent e0afad3 commit da6e21c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/routes/sandbox/version/+page.svelte

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,23 @@
141141
args_schema_parallel: newSchema
142142
};
143143
}
144+
145+
function loadExample() {
146+
const oldSchemaExample = {
147+
title: 'Test',
148+
type: 'object',
149+
properties: { foo: { title: 'foo', type: 'string' } },
150+
required: ['foo']
151+
};
152+
const newSchemaExample = deepCopy(oldSchemaExample);
153+
newSchemaExample.properties.bar = { title: 'bar', type: 'string' };
154+
newSchemaExample.required.push('bar');
155+
oldJsonSchemaString = JSON.stringify(oldSchemaExample, null, 2);
156+
oldJsonDataString = JSON.stringify({ foo: 'something' }, null, 2);
157+
newJsonSchemaString = JSON.stringify(newSchemaExample, null, 2);
158+
forceRedrawOld();
159+
handleNewJsonSchemaStringChanged();
160+
}
144161
</script>
145162
146163
<h1 class="fw-light">Sandbox page for task version update</h1>
@@ -152,6 +169,9 @@
152169
<div class="col-lg-6 mt-3">
153170
<div class="row">
154171
<div class="col">
172+
<button class="btn btn-outline-primary float-end" on:click={loadExample}>
173+
Load example
174+
</button>
155175
<div class="form-check form-switch">
156176
<input
157177
class="form-check-input"

0 commit comments

Comments
 (0)