refresh displayed ai in dashboard when store is reloaded
This commit is contained in:
@@ -4,6 +4,7 @@ import AiInstanceComponent from '@/components/dashboard/AiInstanceComponent.vue'
|
||||
import Alert from '@/components/Bootstrap/Alert.vue';
|
||||
import {AiInstanceVmV1} from 'ai-oas';
|
||||
import {AiInstanceStore} from '@/stores/AiInstanceStore';
|
||||
import {Watch} from 'vue-property-decorator';
|
||||
|
||||
@Options({
|
||||
name: 'AiInstanceTabs',
|
||||
@@ -16,6 +17,13 @@ export default class AiInstanceTabs extends Vue {
|
||||
mounted(): void {
|
||||
this.aiInstanceStore.loadIfAbsent();
|
||||
}
|
||||
|
||||
@Watch('aiInstanceStore.aiInstances', {deep: true})
|
||||
private onAiInstancesChanged(newValue: AiInstanceVmV1[]): void {
|
||||
if (this.selectedAiInstance && !newValue.find(e => e === this.selectedAiInstance)) {
|
||||
this.selectedAiInstance = newValue.find(e => e.configuration.id === this.selectedAiInstance?.configuration.id) ?? null;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user