Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
godicked committed Jul 4, 2024
1 parent 157dcd7 commit 7b6b5c9
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 33 deletions.
3 changes: 1 addition & 2 deletions panoptic_front/src/components/inputs/PropertyInputTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import PropInput from './PropInput.vue';
import TagBadge from '../tagtree/TagBadge.vue';
import { useDataStore } from '@/data/dataStore';
const project = useProjectStore()
const data = useDataStore()
const props = defineProps<{
Expand Down Expand Up @@ -51,7 +50,7 @@ function toggleProperty(property: Property) {
<p v-if="property.type != PropertyType._folders" class="m-0 p-0">{{
image.properties[property.id] }}</p>
<span v-else>
<TagBadge :tag="project.data.folders[image.properties[property.id]].name" :color="-1" />
<TagBadge :tag="data.folders[image.properties[property.id]].name" :color="-1" />
</span>
</td>

Expand Down
4 changes: 2 additions & 2 deletions panoptic_front/src/components/menu/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useProjectStore } from '@/data/projectStore';
import { usePanopticStore } from '@/data/panopticStore';
import { goNext } from '@/utils/utils';
import TaskStatus from './TaskStatus.vue';
import { useDataStore } from '@/data/dataStore';
import { deletedID, useDataStore } from '@/data/dataStore';
const project = useProjectStore()
const data = useDataStore()
Expand Down Expand Up @@ -164,7 +164,7 @@ watch(() => project.status.import.to_import, () => showImport.value = true)
}}</b></wTT>
<div class="mt-2" v-if="project.status.loaded">
<template v-for="property in data.properties">
<div class="property-item" v-if="property.id < 0">
<div class="property-item" v-if="property.id < 0 && property.id != deletedID">
<wTT pos="bottom"
:message="'main.nav.computed.' + Math.abs(property.id).toString() + '_tooltip'">
<PropertyOptions :property="property" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Zoomable from '@/components/Zoomable.vue';
import CenteredImage from '@/components/images/CenteredImage.vue';
import PropertyInputTable from '@/components/inputs/PropertyInputTable.vue';
import { GroupManager, ImageIterator } from '@/core/GroupManager';
import { useDataStore } from '@/data/dataStore';
import { deletedID, useDataStore } from '@/data/dataStore';
import { PropertyMode } from '@/data/models';
import { Ref, computed, inject, ref } from 'vue';
Expand Down Expand Up @@ -41,7 +41,7 @@ const properties = computed(() => {
if (mode.value == 2) {
res.push(...data.propertyList.filter(p => p.computed))
}
return res
return res.filter(p => p.id != deletedID)
})
function setMode(value) {
Expand Down
2 changes: 1 addition & 1 deletion panoptic_front/src/components/scrollers/tree/PropInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const width = computed(() => props.size ?? 100)
<div v-else class="d-felx flex-row overflow-hidden text-nowrap" style="line-height: 26px;" >
<PropertyIcon :type="property.type" style="margin-right: 3px;"/>
<span v-if="property.type == PropertyType._folders">
<TagBadge :tag="project.data.folders[data.instances[props.image.id].properties[props.property.id]].name" :color="-1" />
<TagBadge :tag="data.folders[data.instances[props.image.id].properties[props.property.id]].name" :color="-1" />
</span>
<span v-else>{{ data.instances[props.image.id].properties[props.property.id] }}</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion panoptic_front/src/core/GroupManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ export class GroupManager {

verifyState(properties: PropertyIndex) {
this.state.groupBy = this.state.groupBy.filter(id => properties[id] && properties[id].id != deletedID)
Object.keys(this.state.options).filter(id => !properties[id] || properties[id].id != deletedID).forEach(id => delete this.state.options[id])
Object.keys(this.state.options).filter(id => !properties[id] || properties[id].id == deletedID).forEach(id => delete this.state.options[id])
}

registerIterator(it: GroupIterator) {
Expand Down
8 changes: 8 additions & 0 deletions panoptic_front/src/core/TabManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useProjectStore } from "@/data/projectStore"
import { reactive, toRefs } from "vue"
import { EventEmitter } from "@/utils/utils"
import { useDataStore } from "@/data/dataStore"
import { defaultPropertyOption } from "@/data/builder"

export class TabManager {
isLoaded: boolean
Expand Down Expand Up @@ -34,7 +35,14 @@ export class TabManager {
}

verifyState() {
const data = useDataStore()
this.collection.verifyState()
if (this.state.propertyOptions == undefined) {
this.state.propertyOptions = {}
}
for (let propId in data.properties) {
this.state.propertyOptions[propId] = Object.assign(defaultPropertyOption(), this.state.propertyOptions[propId])
}
}

saveState() {
Expand Down
6 changes: 6 additions & 0 deletions panoptic_front/src/data/dataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,18 @@ export const useDataStore = defineStore('dataStore', () => {
}

function importProperties(toImport: Property[]) {
const someNew = toImport.some(p => properties.value[p.id] == undefined)
for (let property of toImport) {
if (property.id in properties.value) {
property.tags = properties.value[property.id].tags
}
properties.value[property.id] = property
}
if(someNew) {
const project = useProjectStore()
const tab = project.getTabManager()
tab.verifyState()
}
}

function importTags(toImport: Tag[]) {
Expand Down
5 changes: 3 additions & 2 deletions panoptic_front/src/data/projectStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const useProjectStore = defineStore('projectStore', () => {

console.log('init')
if (!tabManager) {
tabManager = new TabManager((data.tabs[data.selectedTabId]))
tabManager = new TabManager()
}
// Execute all async functions here before setting any data into the store
// This avoids other UI elements to react to changes before the init function is finished
Expand Down Expand Up @@ -103,6 +103,7 @@ export const useProjectStore = defineStore('projectStore', () => {
await loadTabs(tabs)
verifyData()


status.loaded = true
}

Expand Down Expand Up @@ -321,7 +322,7 @@ export const useProjectStore = defineStore('projectStore', () => {
actions,
// setActionFunctions, hasGroupFunction, hasSimilaryFunction,
setDefaultVectors,
backendStatus, reload,
backendStatus, reload, updatePropertyOptions,
showTutorial
}

Expand Down
23 changes: 0 additions & 23 deletions panoptic_front/src/views/TabContainer.vue

This file was deleted.

0 comments on commit 7b6b5c9

Please sign in to comment.