-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98df977
commit 333e7f1
Showing
12 changed files
with
258 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<template> | ||
<div class="my-auto ml-2 mr-auto flex dark:text-gray-400"> | ||
<div | ||
class="mx-1 flex cursor-pointer items-center rounded-r-full border-2 border-gray-50 bg-gray-600 p-2 text-white" | ||
v-on:click="$emit('clicked', ['/'])" | ||
> | ||
<svg | ||
id="home-icon" | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke-width="2" | ||
stroke="currentColor" | ||
class="h-8 w-8" | ||
> | ||
<path | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
d="M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25" | ||
/> | ||
</svg> | ||
</div> | ||
|
||
<div | ||
v-for="x in chain" | ||
v-bind:key="x.name" | ||
class="mx-2 flex cursor-pointer items-center rounded-r-full border-2 border-gray-50 bg-gray-600 p-2 text-white" | ||
v-on:click="$emit('clicked', x)" | ||
> | ||
<svg | ||
id="home-icon" | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke-width="2" | ||
stroke="currentColor" | ||
class="h-8 w-8" | ||
> | ||
<path | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
v-bind:d="worstModels[x[0]].skema.svg_path" | ||
/> | ||
</svg> | ||
<span class="mx-1">{{ x[2] }}</span> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
defineProps({ | ||
// if the prop is 'modelValue', we can use v-model | ||
chain: { | ||
type: Array<any>, | ||
required: true, | ||
}, | ||
worstModels: { | ||
type: Object, | ||
required: true, | ||
}, | ||
}); | ||
defineEmits(["clicked"]); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<template> | ||
<div class="flex h-full w-full"> | ||
<section id="context-bar" class="flex w-88">Context bar</section> | ||
|
||
<section | ||
id="content-container" | ||
class="flex h-full w-full flex-col bg-gray-300 dark:bg-gray-700" | ||
> | ||
<FabTable | ||
v-bind:data="modelStore.get_filtered_models()" | ||
v-bind:model-fields=" | ||
modelStore.worst_models[model_name]['skema']['fields'] | ||
" | ||
v-bind:model-default-fields="modelDefaultFields" | ||
v-on:row-clicked="modelLink($event)" | ||
v-on:delete-clicked="deleteModel($event)" | ||
v-on:new-clicked="createNewModel()" | ||
/> | ||
</section> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { computed, onMounted, watch } from "vue"; | ||
import { useRoute, useRouter } from "vue-router"; | ||
import { useModelStore } from "@/stores/modelStore"; | ||
import FabTable from "@/components/FabTable.vue"; | ||
import type { Model } from "@/types"; | ||
const modelStore = useModelStore(); | ||
const modelDefaultFields = [ | ||
{ name: "id", in_overview: false, type: "" }, | ||
{ name: "name", in_overview: true, type: "" }, | ||
{ name: "owned_by", in_overview: true, type: "" }, | ||
{ name: "tags", in_overview: true, type: "tag" }, | ||
{ name: "updated_by", in_overview: false, type: "" }, | ||
{ | ||
name: "updated_at", | ||
in_overview: false, | ||
type: "date", | ||
}, | ||
{ name: "created_by", header: "Created By ", in_overview: false, type: "" }, | ||
{ | ||
name: "created_at", | ||
in_overview: false, | ||
type: "date", | ||
}, | ||
]; | ||
// "store.worst_models[model_name]['skema']['fields']" | ||
const router = useRouter(); | ||
const route = useRoute(); | ||
const createNewModel = () => { | ||
console.log(`new model ${model_name.value}`); | ||
}; | ||
const deleteModel = (m: Model) => { | ||
console.log(`delete model: ${model_name.value}/${m.id}`); | ||
}; | ||
const modelLink = (m: Model) => { | ||
router.push(`/${model_name.value}/${m.id}`); | ||
}; | ||
const model_name = computed(() => { | ||
return route.params.model as string; | ||
}); | ||
onMounted(async () => { | ||
console.log("modelview-mount", model_name.value); | ||
await modelStore.fetch_all_instances(model_name.value); | ||
}); | ||
watch( | ||
() => route.fullPath, | ||
async () => { | ||
if (route.params.model && !route.params.id) { | ||
console.info("modelview-watch", model_name.value); | ||
await modelStore.fetch_all_instances(model_name.value); | ||
} | ||
} | ||
); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,7 @@ export default defineConfig({ | |
globals: true, | ||
setupFiles: ["./tests/setup.js"], | ||
}, | ||
server: { | ||
port: 8800, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.