Skip to content

Commit bcac4c7

Browse files
authored
different minor improvements (#548)
* improve schema diagram * hide mergeAllOfs option and add disclaimer * stop propagating clicks that should not be * rename tooltip * update backend rate limit * fix schema diagram layouting * apply formatting changes --------- Co-authored-by: Logende <Logende@users.noreply.github.com>
1 parent a96b736 commit bcac4c7

9 files changed

Lines changed: 37 additions & 19 deletions

File tree

backend/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def add_snapshot():
140140

141141

142142
@app.route('/snapshot/<snapshot_id>', methods=['GET'])
143-
@limiter.limit("30 per minute")
143+
@limiter.limit("20 per minute")
144144
def get_snapshot(snapshot_id):
145145
try:
146146
snapshots_collection = db['snapshots']

meta_configurator/src/components/panels/schema-diagram/DiagramOptionsPanel.vue

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,6 @@ function rebuildGraph() {
5252
class="options-input-switch" />
5353
</label>
5454
</div>
55-
<div>
56-
<label
57-
>Merge allOfs
58-
<InputSwitch
59-
v-model="useSettings().schemaDiagram.mergeAllOfs"
60-
class="options-input-switch" />
61-
</label>
62-
</div>
63-
6455
<div class="container">
6556
<div>
6657
<Button label="Rebuild Graph" @click="rebuildGraph" class="options-element" />

meta_configurator/src/components/panels/schema-diagram/SchemaEnumNode.vue

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,20 @@ function addEnumItem() {
102102
v-tooltip.bottom="'Extract inlined Object to definitions (will enable renaming and more)'"
103103
@mousedown.stop
104104
@click.stop
105+
@dblclick.stop
105106
@click="_ => extractInlinedObject()">
106107
<FontAwesomeIcon :icon="'fa-wrench fa-solid'" />
107108
</Button>
108109

109110
<hr />
110111

111-
<p v-if="useSettings().schemaDiagram.showEnumValues" v-for="value in props.data!.values">
112-
{{ value }}
113-
</p>
112+
<div
113+
v-if="useSettings().schemaDiagram.showEnumValues"
114+
v-for="(value,index) in props.data!.values">
115+
<p v-if="index < useSettings().schemaDiagram.maxEnumValuesToShow">
116+
{{ value }}
117+
</p>
118+
</div>
114119
</div>
115120

116121
<div v-else>
@@ -120,6 +125,8 @@ function addEnumItem() {
120125
v-model="enumName"
121126
@blur="updateEnumName"
122127
@mousedown.stop
128+
@click.stop
129+
@dblclick.stop
123130
@keydown.stop
124131
@keyup.enter="updateEnumName" />
125132
<Button
@@ -128,6 +135,7 @@ function addEnumItem() {
128135
v-tooltip.bottom="'Delete Enum'"
129136
@mousedown.stop
130137
@click.stop
138+
@dblclick.stop
131139
@click="_ => deleteEnum()">
132140
<FontAwesomeIcon :icon="'fa-trash fa-solid'" />
133141
</Button>
@@ -141,6 +149,8 @@ function addEnumItem() {
141149
v-model="enumValues[index]"
142150
@blur="updateEnumValues"
143151
@mousedown.stop
152+
@click.stop
153+
@dblclick.stop
144154
@keydown.stop
145155
@keyup.enter="updateEnumValues">
146156
</InputText>
@@ -151,6 +161,7 @@ function addEnumItem() {
151161
v-tooltip.bottom="'Delete Item'"
152162
@mousedown.stop
153163
@click.stop
164+
@dblclick.stop
154165
@click="_ => deleteEnumItem(index)">
155166
<FontAwesomeIcon :icon="'fa-trash fa-solid'" />
156167
</Button>
@@ -162,6 +173,7 @@ function addEnumItem() {
162173
v-tooltip.bottom="'Add Item'"
163174
@mousedown.stop
164175
@click.stop
176+
@dblclick.stop
165177
@click="_ => addEnumItem()">
166178
<FontAwesomeIcon :icon="'fa-plus fa-solid'" />
167179
</Button>

meta_configurator/src/components/panels/schema-diagram/SchemaObjectAttribute.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ function getHandleTop() {
9898
v-model="attrName"
9999
@blur="updateAttributeName"
100100
@mousedown.stop
101+
@click.stop
102+
@dblclick.stop
101103
@keydown.stop
102104
@keyup.enter="updateAttributeName" />
103105
<span class="text-red-600">{{ props.data.required ? '*' : '' }}</span>
@@ -109,6 +111,8 @@ function getHandleTop() {
109111
optionLabel="label"
110112
@mousedown.stop
111113
@keydown.stop
114+
@click.stop
115+
@dblclick.stop
112116
placeholder="Select Type" />
113117

114118
<Button
@@ -117,6 +121,7 @@ function getHandleTop() {
117121
v-tooltip.bottom="'Delete Property'"
118122
@mousedown.stop
119123
@click.stop
124+
@dblclick.stop
120125
@click="_ => deleteAttribute()">
121126
<FontAwesomeIcon :icon="'fa-trash fa-solid'" />
122127
</Button>

meta_configurator/src/components/panels/schema-diagram/SchemaObjectNode.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,12 @@ function isAttributeHighlighted() {
143143
v-if="!isDefinedInDefinitions() && (isHighlighted() || isAttributeHighlighted())"
144144
class="vue-flow-object-button"
145145
size="small"
146-
v-tooltip.bottom="'Extract inlined Object to definitions (will enable renaming and more)'"
146+
v-tooltip.bottom="
147+
'Extract inlined object schema to definitions (will enable renaming and more)'
148+
"
147149
@mousedown.stop
148150
@click.stop
151+
@dblclick.stop
149152
@click="_ => extractInlinedObject()">
150153
<FontAwesomeIcon :icon="'fa-wrench fa-solid'" />
151154
</Button>
@@ -158,6 +161,8 @@ function isAttributeHighlighted() {
158161
v-model="objectName"
159162
@blur="updateObjectName"
160163
@mousedown.stop
164+
@click.stop
165+
@dblclick.stop
161166
@keydown.stop
162167
@keyup.enter="updateObjectName" />
163168
<Button
@@ -166,6 +171,7 @@ function isAttributeHighlighted() {
166171
v-tooltip.bottom="'Delete Object'"
167172
@mousedown.stop
168173
@click.stop
174+
@dblclick.stop
169175
@click="_ => deleteObject()">
170176
<FontAwesomeIcon :icon="'fa-trash fa-solid'" />
171177
</Button>
@@ -190,6 +196,7 @@ function isAttributeHighlighted() {
190196
v-tooltip.bottom="'Add Property'"
191197
@click="_ => addAttribute()"
192198
@click.stop
199+
@dblclick.stop
193200
@mousedown.stop
194201
class="vue-flow-object-button">
195202
<FontAwesomeIcon :icon="'fa-plus fa-solid'" />
@@ -201,7 +208,7 @@ function isAttributeHighlighted() {
201208
type="source"
202209
:position="props.sourcePosition!"
203210
class="vue-flow__handle"
204-
style="bottom: 10px"></Handle>
211+
:style="[props.sourcePosition == Position.Right ? {top: '14px'} : {}]"></Handle>
205212
</div>
206213
</template>
207214

meta_configurator/src/components/panels/schema-diagram/VueFlowPanel.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ function updateGraph(forceRebuild: boolean = false) {
158158
updateToSubgraph(currentPath);
159159
}
160160
161-
if (graphNeedsLayouting && forceRebuild) {
161+
if (graphNeedsLayouting || forceRebuild) {
162162
layoutGraph(graphDirection.value, false);
163163
}
164164

meta_configurator/src/components/panels/schema-diagram/schemaDiagramTypes.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export class SchemaGraph {
3131
let type = 'default';
3232
let color = 'black';
3333
const markerEnd = MarkerType.Arrow;
34+
const sourceHandle = individualAttributeHandles ? data.startHandle : null;
3435

3536
switch (data.edgeType) {
3637
case EdgeType.ATTRIBUTE:
@@ -62,7 +63,7 @@ export class SchemaGraph {
6263
id: pathsToEdgeId(data.start.absolutePath, data.end.absolutePath, data.label, data.isArray),
6364
source: pathToNodeId(data.start.absolutePath),
6465
target: pathToNodeId(data.end.absolutePath),
65-
sourceHandle: individualAttributeHandles ? data.startHandle : 'main',
66+
sourceHandle: sourceHandle ? sourceHandle : 'main',
6667
type: type,
6768
label: data.label,
6869
data: data,

meta_configurator/src/components/panels/schema-diagram/typeUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type {Path} from '@/utility/path';
66
export type AttributeTypeChoice = {label: string; schema: JsonSchemaObjectType};
77

88
export function collectTypeChoices(nodesData: SchemaNodeData[]): AttributeTypeChoice[] {
9-
const simpleTypes: SchemaPropertyTypes = ['string', 'number', 'boolean', 'null'];
9+
const simpleTypes: SchemaPropertyTypes = ['string', 'number', 'integer', 'boolean', 'null'];
1010

1111
const result: AttributeTypeChoice[] = [];
1212

meta_configurator/src/settings/settingsSchema.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ export const SETTINGS_SCHEMA: TopLevelSchema = {
175175
type: 'boolean',
176176
description:
177177
'If set to true, allOf schemas will be merged in the schema diagram. This can make the diagram more readable, but sometimes also is not desired, because some information gets lost.',
178-
default: true,
178+
$comment:
179+
'Warning: has undefined behavior when merging multiple allOfs using the "$ref" keyword.',
180+
default: false,
179181
},
180182
},
181183
},

0 commit comments

Comments
 (0)