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

some edits around presets

parent d860acab
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>MitM Extractor</title>
<title>MitM Exporter</title>
</head>
<body>
......
......@@ -4,7 +4,7 @@ import {useAPI} from '@/services/api'
import {useMainStore} from "@/services/mainStore"
import {reactive, ref} from "vue"
import {useConstantsStore} from "@/services/constantsStore";
import {PresetDefinition, usePresetStore} from "@/services/presetStore";
import {PresetEntry, usePresetStore} from "@/services/presetStore";
import {storeToRefs} from "pinia";
import {rules} from "@/services/utils";
......@@ -53,9 +53,9 @@ async function reflectAction() {
loading.value = true
try {
await api.reflectDB()
const selectedPresetDefinition = presetToLoad.value
if (!!selectedPresetDefinition) {
const validations = await presetStore.recreatePreset(selectedPresetDefinition.preset)
const selectedPresetEntry = presetToLoad.value
if (!!selectedPresetEntry) {
const validations = await presetStore.recreatePreset(selectedPresetEntry.preset)
}
await store.retrieveAndStoreDBInfo()
await store.retrieveAndStoreVirtualDBInfo()
......@@ -79,7 +79,7 @@ const steps = [
{title: 'Reflect Database Schema', value: 3, key: 3}
]
const presetToLoad = ref<PresetDefinition>(null)
const presetToLoad = ref<PresetEntry>(null)
function presetClicked(item) {
if (item.key === presetToLoad.value?.key) presetToLoad.value = null
......
......@@ -32,7 +32,7 @@ async function onResetAction() {
<v-app-bar border>
<PresetMenu></PresetMenu>
<v-app-bar-title>MitM Extractor</v-app-bar-title>
<v-app-bar-title>MitM Exporter</v-app-bar-title>
<v-select class="pa-2 align-self-center" :items="mitms" v-model="selectedMitM" variant="plain" hide-details>
</v-select>
......
<script setup lang="ts">
import {ref} from "vue";
import {PresetContents, usePresetStore} from "@/services/presetStore";
import {PresetDefinition, usePresetStore} from "@/services/presetStore";
import {saveAs} from "file-saver";
import {storeToRefs} from "pinia";
import {useSelectionStore} from "@/services/selectionStore";
......@@ -14,7 +14,7 @@ const {selectedMitM} = storeToRefs(selection)
const loading = ref(false)
async function loadPreset(preset: PresetContents) {
async function loadPreset(preset: PresetDefinition) {
loading.value = true
const validations = await presetStore.recreatePreset(preset)
......
......@@ -82,7 +82,7 @@ function resetAll() {
function createTransforms(): Transforms.Transform[] {
const additions = []
const additions = {0: []}
const transforms = {} as { [k: string]: object }
const renames = {} as { [k: string]: string }
const selection = []
......@@ -95,13 +95,13 @@ function createTransforms(): Transforms.Transform[] {
// targetType = {mitm: targetType.substring("mitm.".length)}
if (item.isArtificial) {
additions.push([0, // the index does not actually matter due to the reselect transform after
{
// the index does not actually matter due to the reselect transform after
additions[0].push({
col_name: item.name,
value: `"${item.rawValue}"`,
target_type: targetType,
operation: "add_column"
} as Transforms.AddColumn])
} as Transforms.AddColumn)
selection.push(item.name)
} else {
if (!!targetType)
......
......@@ -69,7 +69,7 @@ function createTransforms(): Transforms.Transform[] {
attributes[c] = path.split(".")// .slice(1) // remove prefix
})
return [{
additions: [[0, {attributes, json_col: baseCol.name, operation: "extract_json"}]], operation: "edit_columns"
additions: {0: [{attributes, json_col: baseCol.name, operation: "extract_json"}]}, operation: "edit_columns"
} as Transforms.EditColumns]
}
}
......
......@@ -41,7 +41,7 @@ watch(rightCols, () => selection.right = rightCols.value ?? [], {deep: false})
watchEffect(() => {
const lt = !!leftTable.value
const rt = !!rightTable.value
const matchingOn = sameLengthOn()
const matchingOn = !!sameLengthOn()
isValid.value = lt && rt && matchingOn
})
......
Need to install the following packages:
openapicmd@2.6.1
Ok to proceed? (y)
import type {
OpenAPIClient,
Parameters,
......@@ -384,27 +381,27 @@ declare namespace Components {
/**
* Max
*/
max: string; // date-time
max?: /* Max */ string /* date-time */ | null;
/**
* Mean
*/
mean: string; // date-time
mean?: /* Mean */ string /* date-time */ | null;
/**
* Min
*/
min: string; // date-time
min?: /* Min */ string /* date-time */ | null;
/**
* Percentile 25
*/
percentile_25: string; // date-time
percentile_25?: /* Percentile 25 */ string /* date-time */ | null;
/**
* Percentile 50
*/
percentile_50: string; // date-time
percentile_50?: /* Percentile 50 */ string /* date-time */ | null;
/**
* Percentile 75
*/
percentile_75: string; // date-time
percentile_75?: /* Percentile 75 */ string /* date-time */ | null;
}
/**
* ERVariant
......@@ -417,7 +414,9 @@ declare namespace Components {
/**
* Additions
*/
additions?: any[][];
additions?: {
[name: string]: (/* AddColumn */ AddColumn | /* ExtractJson */ ExtractJson)[];
};
/**
* Drops
*/
......@@ -958,7 +957,7 @@ declare namespace Components {
/**
* SimpleSQLOperator
*/
export type SimpleSQLOperator = "ilike" | "like" | "=" | ">=" | ">" | "<=" | "<";
export type SimpleSQLOperator = "ilike" | "like" | "=" | ">=" | ">" | "<=" | "<" | "in" | "notin";
/**
* SimpleWhere
*/
......@@ -1386,7 +1385,8 @@ declare namespace Paths {
}
export type RequestBody = /* ExportRequest */ Components.Schemas.ExportRequest;
namespace Responses {
export type $200 = any;
export interface $200 {
}
export type $422 = /* HTTPValidationError */ Components.Schemas.HTTPValidationError;
}
}
......@@ -2831,8 +2831,8 @@ export type CastColumn = Components.Schemas.CastColumn;
export type CategoricalSummaryStatistics = Components.Schemas.CategoricalSummaryStatistics;
export type ColumnProperties = Components.Schemas.ColumnProperties;
export type CompiledVirtualView = Components.Schemas.CompiledVirtualView;
export type ConceptMapping-Input = Components.Schemas.ConceptMappingInput;
export type ConceptMapping-Output = Components.Schemas.ConceptMappingOutput;
export type ConceptMapping_Input = Components.Schemas.ConceptMappingInput;
export type ConceptMapping_Output = Components.Schemas.ConceptMappingOutput;
export type ConceptNature = Components.Schemas.ConceptNature;
export type ConceptProperties = Components.Schemas.ConceptProperties;
export type DBConnTestResponse = Components.Schemas.DBConnTestResponse;
......@@ -2850,8 +2850,8 @@ export type ExtractJson = Components.Schemas.ExtractJson;
export type FKCreationResponse = Components.Schemas.FKCreationResponse;
export type ForeignKeyConstraintBase = Components.Schemas.ForeignKeyConstraintBase;
export type ForeignKeyConstraintRequest = Components.Schemas.ForeignKeyConstraintRequest;
export type ForeignRelation-Input = Components.Schemas.ForeignRelationInput;
export type ForeignRelation-Output = Components.Schemas.ForeignRelationOutput;
export type ForeignRelation_Input = Components.Schemas.ForeignRelationInput;
export type ForeignRelation_Output = Components.Schemas.ForeignRelationOutput;
export type HTTPValidationError = Components.Schemas.HTTPValidationError;
export type KeepAliveResponse = Components.Schemas.KeepAliveResponse;
export type Limit = Components.Schemas.Limit;
......
This diff is collapsed.
......@@ -477,37 +477,43 @@ components:
title: Count
type: integer
max:
format: date-time
title: Max
anyOf:
- format: date-time
type: string
- type: 'null'
title: Max
mean:
format: date-time
title: Mean
anyOf:
- format: date-time
type: string
- type: 'null'
title: Mean
min:
format: date-time
title: Min
anyOf:
- format: date-time
type: string
- type: 'null'
title: Min
percentile_25:
format: date-time
title: Percentile 25
anyOf:
- format: date-time
type: string
- type: 'null'
title: Percentile 25
percentile_50:
format: date-time
title: Percentile 50
anyOf:
- format: date-time
type: string
- type: 'null'
title: Percentile 50
percentile_75:
format: date-time
title: Percentile 75
anyOf:
- format: date-time
type: string
- type: 'null'
title: Percentile 75
required:
- count
- mean
- min
- max
- percentile_25
- percentile_50
- percentile_75
title: DatetimeSummaryStatistics
type: object
ERVariant:
......@@ -519,12 +525,9 @@ components:
EditColumns:
properties:
additions:
additionalProperties:
items:
maxItems: 2
minItems: 2
prefixItems:
- type: integer
- discriminator:
discriminator:
mapping:
add_column: '#/components/schemas/AddColumn'
extract_json: '#/components/schemas/ExtractJson'
......@@ -534,7 +537,7 @@ components:
- $ref: '#/components/schemas/ExtractJson'
type: array
title: Additions
type: array
type: object
drops:
items:
type: string
......@@ -1328,6 +1331,8 @@ components:
- '>'
- <=
- <
- in
- notin
title: SimpleSQLOperator
type: string
SimpleWhere:
......@@ -2503,9 +2508,6 @@ paths:
required: true
responses:
'200':
content:
application/json:
schema: {}
description: Successful Response
'422':
content:
......
......@@ -77,7 +77,7 @@ export namespace Transforms {
const backendUrl = process.env.API_URL ?? 'http://localhost:8080' // import.meta.env?.VITE_API_URL ||
console.log(`Using following (backend) API_URL: ${backendUrl} (ENV vars: ${process.env.API_URL} ${process.env.BASE_URL})`)
console.log(`Using following (backend) API_URL: ${backendUrl}`)
// const f = jsYaml.loadAll('./api-schema/openapi.yaml')
const openAPIClient = new OpenAPIClientAxios({
......
......@@ -7,20 +7,20 @@ import {useMappingStore} from "@/services/mappingStore";
import {hardcodedPresets} from "@/services/preset-definitions/hardcoded-presets"
export type PresetContents = {
export type PresetDefinition = {
virtual_views: VirtualViewCreation[],
concept_mappings: ConceptMapping[]
}
export type PresetDefinition = {
export type PresetEntry = {
props: { title: string, [key: string]: any },
name: string,
key: string,
db_url?: string,
preset: PresetContents,
preset: PresetDefinition,
}
const initialPresets: PresetDefinition[] = [...hardcodedPresets]
const initialPresets: PresetEntry[] = [...hardcodedPresets]
export const usePresetStore = defineStore('presets', () => {
......@@ -29,13 +29,13 @@ export const usePresetStore = defineStore('presets', () => {
const mapping = useMappingStore()
const api = useAPI()
const presets = shallowRef<PresetDefinition[]>([...initialPresets])
const presets = shallowRef<PresetEntry[]>([...initialPresets])
async function addPreset(preset: PresetDefinition) {
async function addPreset(preset: PresetEntry) {
presets.value.push(preset)
}
async function recreatePreset(preset: PresetContents) {
async function recreatePreset(preset: PresetDefinition) {
console.log("Recreating preset:\n", preset)
......@@ -69,7 +69,7 @@ export const usePresetStore = defineStore('presets', () => {
const concept_mappings = [...Object.values(mapping.currentMappings)]
const presetEntry: PresetDefinition = {
const presetEntry: PresetEntry = {
props: {title: name.toLocaleUpperCase(), value: name},
name: name,
key: name.toLowerCase(),
......@@ -82,7 +82,9 @@ export const usePresetStore = defineStore('presets', () => {
return presetEntry
}
function $reset() {presets.value = [...initialPresets]}
function $reset() {
presets.value = [...initialPresets]
}
return {presets, addPreset, recreatePreset, saveCurrentStateAsPreset, $reset}
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment