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

possibly fixed .env file no. 2

parent bc04581a
No related branches found
No related tags found
No related merge requests found
Pipeline #481778 passed
<script setup lang="ts"> <script setup lang="ts">
import {ConceptMapping, Mappings} from "@/services/api" import {ConceptMapping, Mappings, TableIdentifier} from "@/services/api"
import {useSelectionStore} from "@/services/selectionStore"; import {useSelectionStore} from "@/services/selectionStore";
import {computed, reactive, ref, watch} from "vue"; import {computed, reactive, ref, watch, toValue} from "vue";
import TableSelector from "@/components/helpers/TableSelector.vue"; import TableSelector from "@/components/helpers/TableSelector.vue";
import InlineColumnMapper from "@/components/subcomponents/map/InlineColumnMapper.vue"; import InlineColumnMapper from "@/components/subcomponents/map/InlineColumnMapper.vue";
import {storeToRefs} from "pinia"; import {storeToRefs} from "pinia";
...@@ -27,7 +27,7 @@ const {selectedMitM, selectedMitMDef, selectedTable} = storeToRefs(selection) ...@@ -27,7 +27,7 @@ const {selectedMitM, selectedMitMDef, selectedTable} = storeToRefs(selection)
const formvalidity = reactive({identityCols: false, inlineCols: false, fkRelationCols: false}) const formvalidity = reactive({identityCols: false, inlineCols: false, fkRelationCols: false})
const loading = ref(false) const loading = ref(false)
const dialog = reactive({show: false, success: false, content: "", title: "Mapping Validation"}) const dialog = ref({show: false, success: false, content: "", title: "Mapping Validation"})
const recreatedMapping = ref<ConceptMapping>(null) const recreatedMapping = ref<ConceptMapping>(null)
...@@ -106,7 +106,7 @@ function suggestIdColMap(columns?: ExtendedColumnListItem[]) { ...@@ -106,7 +106,7 @@ function suggestIdColMap(columns?: ExtendedColumnListItem[]) {
function suggestInlineColMap(columns?: ExtendedColumnListItem[]) { function suggestInlineColMap(columns?: ExtendedColumnListItem[]) {
if (!!recreatedMapping.value?.inline_relations) if (!!recreatedMapping.value?.inline_relations)
return colMapFromNames(columns, harmonizeToObj(recreatedMapping.value.inline_relations)) return colMapFromNames(columns, harmonizeToObj(recreatedMapping.value.inline_relations))
else return suggestColMap(columns, currentConceptRelations.value?.inline_relations) else return suggestColMap(columns, currentConceptRelations.value?.inline)
} }
function suggestFKColMaps(columns?: ExtendedColumnListItem[]): { function suggestFKColMaps(columns?: ExtendedColumnListItem[]): {
...@@ -185,7 +185,7 @@ async function onSubmit() { ...@@ -185,7 +185,7 @@ async function onSubmit() {
Object.entries(foreignRelationMappings.value).forEach(([fkRelName, fkMapping]) => { Object.entries(foreignRelationMappings.value).forEach(([fkRelName, fkMapping]) => {
foreign_relations[fkRelName] = { foreign_relations[fkRelName] = {
fk_columns: Object.fromEntries(Object.entries(fkMapping.fk_columns).map(([nameToMap, col]) => [nameToMap, col.name])), fk_columns: Object.fromEntries(Object.entries(fkMapping.fk_columns).map(([nameToMap, col]) => [nameToMap, col.name])),
referred_table: fkMapping.referred_table referred_table: toValue(fkMapping.referred_table)
} }
}) })
...@@ -220,13 +220,13 @@ async function onSubmit() { ...@@ -220,13 +220,13 @@ async function onSubmit() {
loading.value = false loading.value = false
if (res?.validation_result.is_valid) { if (res?.validation_result.is_valid) {
dialog.success = true dialog.value.success = true
dialog.content = "Successfully validated mapping." dialog.value.content = "Successfully validated mapping."
} else { } else {
dialog.success = false dialog.value.success = false
dialog.content = "Mapping validation failed." dialog.value.content = "Mapping validation failed."
} }
dialog.show = true dialog.value.show = true
} }
function recreate(cmEntry: ConceptMappingEntry) { function recreate(cmEntry: ConceptMappingEntry) {
......
...@@ -61,7 +61,7 @@ const api = useAPI() ...@@ -61,7 +61,7 @@ const api = useAPI()
const {virtualDBSchema} = storeToRefs(store) const {virtualDBSchema} = storeToRefs(store)
const {selectedTable} = storeToRefs(selection) const {selectedTable} = storeToRefs(selection)
const dialog = reactive({content: "", show: false, success: null, title: "Virtual View Creation"}) const dialog = ref({content: "", show: false, success: null, title: "Virtual View Creation"})
const loading = ref(false) const loading = ref(false)
const mode = ref<WidgetKind>("transform") const mode = ref<WidgetKind>("transform")
const removeBaseTable = ref(false) const removeBaseTable = ref(false)
...@@ -108,21 +108,21 @@ async function attemptCreation(request: VirtualViewCreation, options?: { ...@@ -108,21 +108,21 @@ async function attemptCreation(request: VirtualViewCreation, options?: {
const r = await api.createVirtualView(request, {override_if_exists: permitOverride.value}) const r = await api.createVirtualView(request, {override_if_exists: permitOverride.value})
const success = !!r?.data const success = !!r?.data
dialog.success = success dialog.value.success = success
if (success) { if (success) {
dialog.content = `"${r.data.table_meta.name}" has been created` dialog.value.content = `"${r.data.table_meta.name}" has been created`
if (options?.dropBase) { if (options?.dropBase) {
const t = options.base const t = options.base
const r2 = await api.dropVirtualView({schema: t.schema, view: t.name}) const r2 = await api.dropVirtualView({schema: t.schema, view: t.name})
if (r2) if (r2)
dialog.content += ` and its base ${t.name} has been dropped` dialog.value.content += ` and its base ${t.name} has been dropped`
} }
} else { } else {
dialog.content = `Virtual view creation has failed` dialog.value.content = `Virtual view creation has failed`
} }
dialog.show = true dialog.value.show = true
loading.value = false loading.value = false
......
...@@ -22,7 +22,7 @@ const rightFKCols = ref([] as string[]) ...@@ -22,7 +22,7 @@ const rightFKCols = ref([] as string[])
const sourceDB = ref<SourceDBType>(props.sourceDB ?? "original") const sourceDB = ref<SourceDBType>(props.sourceDB ?? "original")
const loading = ref(false) const loading = ref(false)
const form = ref(null) const form = ref(null)
const dialog = reactive({success: null, show: false, content: null, title: "Outcome"}) const dialog = ref({success: null, show: false, content: null, title: "Outcome"})
const {columnList: leftColumnList} = useColumnsOfTable(leftTable) const {columnList: leftColumnList} = useColumnsOfTable(leftTable)
...@@ -50,12 +50,12 @@ async function markFK() { ...@@ -50,12 +50,12 @@ async function markFK() {
loading.value = false loading.value = false
dialog.success = r?.data?.status dialog.value.success = r?.data?.status
if (!r?.data?.status) if (!r?.data?.status)
dialog.content = r?.data?.error ? "Operation failed\n" + r.data.error : "Request failed" dialog.value.content = r?.data?.error ? "Operation failed\n" + r.data.error : "Request failed"
else else
dialog.content = "Successfully marked foreign key relationship." dialog.value.content = "Successfully marked foreign key relationship."
dialog.show = true dialog.value.show = true
} }
function reset() { function reset() {
......
...@@ -46,7 +46,7 @@ export const rules = { ...@@ -46,7 +46,7 @@ export const rules = {
required: v => !!v || "required", required: v => !!v || "required",
isInt: v => v == null || Number.parseInt(v) == Number.parseFloat(v) || "must be an integer", isInt: v => v == null || Number.parseInt(v) == Number.parseFloat(v) || "must be an integer",
isNonNeg: v => v == null || Number.parseInt(v) >= 0 || "must be non-negative", isNonNeg: v => v == null || Number.parseInt(v) >= 0 || "must be non-negative",
uniqueWithin<T>(collection: MaybeRef<Array<T>>, accessor: CallableFunction<T, string> = item => item, errMsg = "name already exists") { uniqueWithin<T>(collection: MaybeRef<Array<T>>, accessor: ((arg0: T) => string) = item => item, errMsg = "name already exists") {
return v => v == null || !toValue(collection).some((item) => accessor(item) === v) || errMsg return v => v == null || !toValue(collection).some((item) => accessor(item) === v) || errMsg
}, },
url: v => { url: v => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment