Skip to content

Commit

Permalink
Wire up CoT Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Nov 25, 2024
1 parent 780db38 commit d2f90e3
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 86 deletions.
120 changes: 60 additions & 60 deletions api/web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/web/src/components/CloudTAK/CoTView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@
<CoTStyle
v-if='feat.properties.archived'
:key='feat.id'
v-model='feat'
:feature='feat'
/>

<div
Expand Down
33 changes: 12 additions & 21 deletions api/web/src/components/CloudTAK/util/CoTStyle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,32 +94,23 @@
</div>
</template>

<script>
<script setup lang='ts'>
import { watch, ref } from 'vue';
import IconSelect from '../../util/IconSelect.vue';
import {
TablerRange,
TablerInput,
TablerEnum
} from '@tak-ps/vue-tabler';
export default {
name: 'CoTStyle',
components: {
TablerRange,
TablerEnum,
TablerInput,
IconSelect,
},
props: {
modelValue: {
type: Object,
required: true
},
},
data: function() {
return {
feat: this.modelValue,
};
}
}
const props = defineProps<{
feature: COT
}>();
const feat = ref(props.feature.as_feature());
watch(feat.value, () => {
props.feature.update(feat.value);
});
</script>
5 changes: 2 additions & 3 deletions api/web/src/stores/base/cot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ export default class COT implements Feature {
//TODO Detect Geometry changes, use centroid?!
this.geometry = feat["geometry"];

if (changed) {
this.store.pending.set(this.id, this);
}
// TODO only update if Geometry or Rendered Prop changes
this.store.pending.set(this.id, this);

await this.save();

Expand Down
3 changes: 2 additions & 1 deletion api/web/src/stores/cots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,8 @@ export const useCOTStore = defineStore('cots', {
if (exists) {
await exists.update(feat)
} else {
new COT(feat);
const cot = new COT(feat);
await cot.save();
}
}
}
Expand Down

0 comments on commit d2f90e3

Please sign in to comment.