Skip to content

Commit e3e1540

Browse files
authored
Different minor improvements (#557)
* do not move view when selecting different attribute of same object * make possible to disable editMode and use schema diagram as viewer only * change initial schemaselection dialog from radiobutton to normal button * apply formatting changes * fix conflict * add example * add title of item type to 'add item' button * refactor usage of useSettings() * work on biochemistry example * fix panels getting messed up because of overwriting shorter arrays with default items * minor improvements * added option to unselect current element in schema diagram * apply formatting changes --------- Co-authored-by: Logende <Logende@users.noreply.github.com>
1 parent 76d1845 commit e3e1540

6 files changed

Lines changed: 14 additions & 5 deletions

File tree

examples/biochemistry/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Notice, that in the GUI preview, the `metal_salt_mass_unit` and `linker_mass_uni
104104

105105
![Result of attribute type change to enum](figs/change_attribute_type_to_enum_result.png)
106106

107-
In the same manner, create a new enum `time_unit` with the values `second`, `minute`, `hour`, `day` and `week`.
107+
In the same manner, create a new enum `time_unit` with the values `s`, `min`, `h`, `day` and `week`.
108108
To the `time_unit` attribute, change the type to the new enumeration.
109109

110110
Also do the same for the `temperature_unit` attribute, with the values `K`, `deg C` and `deg F`.

meta_configurator/src/components/dialogs/snapshot/SaveSnapshotDialog.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- Dialog to import CSV data -->
22
<script setup lang="ts">
3-
import {computed, type Ref, ref} from 'vue';
3+
import {type Ref, ref} from 'vue';
44
import Dialog from 'primevue/dialog';
55
import Button from 'primevue/button';
66
import Message from 'primevue/message';

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ function addEnumItem() {
8787
<template>
8888
<div
8989
:class="{'bg-yellow-100': isHighlighted(), 'vue-flow__node-schemaenum': !isHighlighted}"
90-
@click="clickedNode()">
90+
@click="clickedNode()"
91+
@click.stop>
9192
<Handle type="target" :position="props.targetPosition!" class="vue-flow__handle"></Handle>
9293
<p>&lt;enumeration&gt;</p>
9394

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ function isAttributeHighlighted() {
135135
<div
136136
:class="{'bg-yellow-100': isHighlighted(), 'vue-flow__node-schemaobject': !isHighlighted}"
137137
@click="clickedNode()"
138+
@click.stop
138139
@dblclick="doubleClickedNode()">
139140
<Handle type="target" :position="props.targetPosition!" class="vue-flow__handle"></Handle>
140141

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,11 @@ function addEnum() {
376376
});
377377
selectElement(enumPath);
378378
}
379+
380+
function unselectElement() {
381+
selectedNode.value = undefined;
382+
selectedData.value = undefined;
383+
}
379384
</script>
380385

381386
<template>
@@ -384,16 +389,18 @@ function addEnum() {
384389
:nodes="activeNodes"
385390
:edges="activeEdges"
386391
@nodes-initialized="layoutGraph(graphDirection, true)"
392+
@click="unselectElement()"
387393
fit-view-on-init
388394
:max-zoom="4"
389395
:min-zoom="0.1">
390396
<div class="controls">
391-
<DiagramOptionsPanel @rebuild_graph="updateGraph(true)" @fit_view="fitView()" />
397+
<DiagramOptionsPanel @rebuild_graph="updateGraph(true)" @fit_view="fitView()" @click.stop />
392398

393399
<CurrentPathBreadcrump
394400
:session-mode="SessionMode.SchemaEditor"
395401
:path="schemaSession.currentPath.value"
396402
root-name="document root"
403+
@click.stop
397404
@update:path="updateCurrentPath"></CurrentPathBreadcrump>
398405

399406
<Button label="Add Object" @click="addObject" class="main-options-element" />

meta_configurator/src/utility/settingsUpdater.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function addDefaultsForMissingFields(userFile: any, defaultsFile: any) {
1010
userFile[key] = defaultsFile[key];
1111

1212
// element itself was existing, but maybe it has some missing fields
13-
} else if (typeof defaultsFile[key] === 'object') {
13+
} else if (typeof defaultsFile[key] === 'object' && !Array.isArray(defaultsFile[key])) {
1414
addDefaultsForMissingFields(userFile[key], defaultsFile[key]);
1515
}
1616
}

0 commit comments

Comments
 (0)