Skip to content
Snippets Groups Projects
Commit d4cf0c23 authored by Leah Tacke genannt Unterberg's avatar Leah Tacke genannt Unterberg
Browse files

fixing other things

parent 8771a9de
No related branches found
No related tags found
No related merge requests found
Pipeline #468783 failed
...@@ -100,3 +100,7 @@ pnpm-debug.log* ...@@ -100,3 +100,7 @@ pnpm-debug.log*
*.njsproj *.njsproj
*.sln *.sln
*.sw? *.sw?
# custom
preset-definitions/
...@@ -26,7 +26,7 @@ async function getMermaid(selection) { ...@@ -26,7 +26,7 @@ async function getMermaid(selection) {
const r = selection == null ? await api.makeERD(params) : await api.makeERD(params, { selection}) const r = selection == null ? await api.makeERD(params) : await api.makeERD(params, { selection})
if (r?.data) { if (r?.data) {
mermaidText.value = r.data.mermaid mermaidText.value = r.data.mermaid
new Promise(() => setTimeout(unlockSVG, 500)) // never again do this //new Promise(() => setTimeout(unlockSVG, 500)) // never do this again
} }
loading.value = false loading.value = false
} }
......
...@@ -86,12 +86,12 @@ function presetClicked(item) { ...@@ -86,12 +86,12 @@ function presetClicked(item) {
else presetToLoad.value = item else presetToLoad.value = item
} }
function fileDroppedIn(files) { async function fileDroppedIn(files) {
if (files?.length > 0) { if (files?.length > 0) {
const f = files[0] const f = files[0]
const uploadedPreset = JSON.parse(f) const uploadedPreset = JSON.parse(f)
if (!!uploadedPreset) { if (!!uploadedPreset) {
presets.addPreset(uploadedPreset) await presetStore.addPreset(uploadedPreset)
//presetToLoad.value = uploadedPreset //presetToLoad.value = uploadedPreset
} }
} }
......
export const hardcodedPresets = []
import {PresetDefinition} from "@/services/presetStore";
export const TEST_PRESET: PresetDefinition = {
props: {title: 'WZL Export', value: 'test'},
name: 'test',
key: 'test',
db_url: 'sqlite:///../static/test.sqlite3',
preset: {
virtual_views: [{
name: 'events',
schema: 'test-preset',
table_creation: {operation: 'existing', base_table: ['original', 'main', 'event_data']},
transforms: [{
operation: 'edit_columns',
additions: [[0, {
operation: 'add_column', col_name: 'kind', value: '"E"', target_type: {mitm: 'text'}
}], [2, {operation: 'add_column', col_name: 'object', value: '"dummy"', target_type: {mitm: 'text'}}]],
drops: ['show_on_dashboard', 'wqm_folder_name']
}]
},
{
name: 'sensor_a',
schema: 'test-preset',
table_creation: {
operation: 'existing',
base_table: ['original', 'main', 'measurement_data_1segmentedresampled']
},
transforms: [{
operation: 'edit_columns',
additions: [[0, {
operation: 'add_column', col_name: 'kind', value: '"M"', target_type: {mitm: 'text'}
}], [0, {
operation: 'add_column', col_name: 'type', value: '"sensor_a"', target_type: {mitm: 'text'}
}], [0, {operation: 'add_column', col_name: 'object', value: '"dummy"', target_type: {mitm: 'text'}}]],
transforms: {
//'time': {operation: 'cast_column', target_type: {mitm: 'datetime'}},
'x1': {operation: 'cast_column', target_type: {mitm: 'numeric'}},
'y1': {operation: 'cast_column', target_type: {mitm: 'numeric'}},
'z1': {operation: 'cast_column', target_type: {mitm: 'numeric'}},
'c1': {operation: 'cast_column', target_type: {mitm: 'numeric'}},
'a1': {operation: 'cast_column', target_type: {mitm: 'numeric'}},
'x2': {operation: 'cast_column', target_type: {mitm: 'numeric'}},
'y2': {operation: 'cast_column', target_type: {mitm: 'numeric'}},
'z2': {operation: 'cast_column', target_type: {mitm: 'numeric'}},
'xc': {operation: 'cast_column', target_type: {mitm: 'numeric'}},
'yc': {operation: 'cast_column', target_type: {mitm: 'numeric'}},
'zc': {operation: 'cast_column', target_type: {mitm: 'numeric'}},
'ac': {operation: 'cast_column', target_type: {mitm: 'numeric'}}
}
}]
},
{
name: 'sensor_b',
schema: 'test-preset',
table_creation: {
operation: 'existing',
base_table: ['original', 'main', 'measurement_data_2segmentedresampled']
},
transforms: [{
operation: 'edit_columns',
additions: [[0, {
operation: 'add_column', col_name: 'kind', value: '"M"', target_type: {mitm: 'text'}
}], [0, {
operation: 'add_column', col_name: 'type', value: '"sensor_b"', target_type: {mitm: 'text'}
}], [0, {operation: 'add_column', col_name: 'object', value: '"dummy"', target_type: {mitm: 'text'}}]],
transforms: {
//'time': {operation: 'cast_column', target_type: {mitm: 'datetime'}},
'tool_center_point_position_wcs_vector_1': {operation: 'cast_column', target_type: {mitm: 'numeric'}},
'tool_center_point_position_wcs_vector_2': {operation: 'cast_column', target_type: {mitm: 'numeric'}},
'tool_center_point_position_wcs_vector_3': {operation: 'cast_column', target_type: {mitm: 'numeric'}},
}
}]
},
{
name: 'segments',
schema: 'test-preset',
table_creation: {
operation: 'join',
left_table: ['original', 'main', 'machine_trace'],
right_table: ['original', 'main', 'machine_tool'],
on_cols_left: ['machine_id'],
on_cols_right: ['id'],
selected_cols_right: ['name']
},
transforms: [{
operation: 'edit_columns',
drops: ['_id', 'machine_id'],
additions: [[0, {
operation: 'add_column',
col_name: 'concept',
value: '"CNC_TRACE"',
target_type: {mitm: 'text'}
}]],
renames: {'id_serial': 'segment_index', 'name': 'object'},
transforms: {'wqm_data_available': {operation: 'cast_column', target_type: {mitm: 'boolean'}}}
}]
},
{
name: 'segment_data',
schema: 'test-preset',
table_creation: {
operation: 'existing',
base_table: ['virtual', 'test-preset', 'segments'],
},
transforms: [{
operation: 'edit_columns',
additions: [[2, {
operation: 'add_column',
col_name: 'type',
value: '"TRACE_INFO"',
target_type: {mitm: 'text'}
}]],
drops: ['time', 'time_end']
}]
}
], concept_mappings: [
{
mitm: 'MAED',
concept: 'event',
base_table: ['virtual', 'test-preset', 'events'],
kind_col: 'kind',
type_col: 'name',
inline_relations: {
time: 'time', object: 'object'
},
attributes: ['value'],
attribute_dtypes: ['json']
},
{
mitm: 'MAED',
concept: 'measurement',
base_table: ['virtual', 'test-preset', 'sensor_a'],
kind_col: 'kind',
type_col: 'type',
inline_relations: {
time: 'time', object: 'object'
},
attributes: ['x1', 'y1', 'z1', 'c1', 'a1', 'x2', 'y2', 'z2', 'xc', 'yc', 'zc', 'cc', 'ac', 'ss', 'sc', 'ln', 'tn', 'sp'],
attribute_dtypes: ['numeric', 'numeric', 'numeric', 'numeric', 'numeric', 'numeric', 'numeric', 'numeric', 'numeric', 'numeric', 'numeric', 'integer', 'numeric', 'integer', 'integer', 'integer', 'integer', 'text']
},
{
mitm: 'MAED',
concept: 'measurement',
base_table: ['virtual', 'test-preset', 'sensor_b'],
kind_col: 'kind',
type_col: 'type',
inline_relations: {
time: 'time', object: 'object'
},
attributes: ['tool_center_point_position_wcs_vector_1', 'tool_center_point_position_wcs_vector_2', 'tool_center_point_position_wcs_vector_3', 'engagement_repeatedly_cut_material_scalar', 'in_tool_number_actual', 'in_nc_line_number_actual', 'engagement_ap_smoothed_scalar', 'engagement_ae_smoothed_scalar', 'tool_feed_per_tooth_actual_scalar'],
attribute_dtypes: ['numeric', 'numeric', 'numeric', 'integer', 'integer', 'text', 'integer', 'integer', 'integer']
},
{
mitm: 'MAED',
concept: 'segment',
base_table: ['virtual', 'test-preset', 'segments'],
type_col: 'concept',
identity_columns: {
concept: 'concept', object: 'object', segment_index: 'segment_index'
},
inline_relations: {
start: 'time', end: 'time_end'
}
},
{
mitm: 'MAED',
concept: 'segment_data',
base_table: ['virtual', 'test-preset', 'segment_data'],
type_col: 'type',
identity_columns: {
concept: 'concept', object: 'object', segment_index: 'segment_index'
},
attributes: ['nc_name', 'wqm_data_available'],
attribute_dtypes: ['text', 'boolean']
}
]
}
}
export const WZL_PRESET: PresetDefinition = {
props: {title: 'WZL postgres', value: 'wzl'},
name: 'wzl',
key: 'wzl',
db_url: 'postgresql://postgres:password@localhost:5432/test',
preset: {virtual_views: [], concept_mappings: []}
}
...@@ -4,7 +4,8 @@ import {ConceptMapping, useAPI, VirtualViewCreation} from "@/services/api"; ...@@ -4,7 +4,8 @@ import {ConceptMapping, useAPI, VirtualViewCreation} from "@/services/api";
import {useMainStore} from "@/services/mainStore"; import {useMainStore} from "@/services/mainStore";
import {useSelectionStore} from "@/services/selectionStore"; import {useSelectionStore} from "@/services/selectionStore";
import {useMappingStore} from "@/services/mappingStore"; import {useMappingStore} from "@/services/mappingStore";
import {TEST_PRESET, WZL_PRESET} from "@/services/preset-definitions/testing"
import {hardcodedPresets} from "@/services/preset-definitions/hardcoded-presets"
export type PresetContents = { export type PresetContents = {
virtual_views: VirtualViewCreation[], virtual_views: VirtualViewCreation[],
...@@ -19,9 +20,9 @@ export type PresetDefinition = { ...@@ -19,9 +20,9 @@ export type PresetDefinition = {
preset: PresetContents, preset: PresetContents,
} }
const initialPresets: PresetDefinition[] = [TEST_PRESET, WZL_PRESET] const initialPresets: PresetDefinition[] = [...hardcodedPresets]
export const usePresetStore = defineStore('presetStore', () => { export const usePresetStore = defineStore('presets', () => {
const store = useMainStore() const store = useMainStore()
const selection = useSelectionStore() const selection = useSelectionStore()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment