implement driver add update remove and improve rename tree experience

This commit is contained in:
Adrian Zuercher
2025-07-31 12:29:16 +02:00
parent dac7130544
commit d50bf9c058
18 changed files with 663 additions and 112 deletions

View File

@@ -1,14 +1,21 @@
import type { Driver } from './Drivers';
export type Publish = {
event: string;
uuid: string;
path: string;
type: string;
drivers?: Record<string, Driver>;
value: string | number | boolean | null;
hasChild: boolean;
};
export type Pubs = Publish[];
import { updateSubscriptionValue, removeRawSubscriptions } from './Subscriptions';
import {
updateSubscriptionValue,
removeRawSubscriptions,
addRawSubscription,
removeRawSubscription,
} from './Subscriptions';
import { buildTree, buildTreeWithRawSubs, removeNodes } from '../dbm/dbmTree';
import type { RawSubs, RawSubscribe } from '../models/Subscribe';
import { ref } from 'vue';
@@ -33,6 +40,11 @@ export function publishToSubscriptions(pubs: Pubs) {
rawSubs.value.push(pub as RawSubscribe);
break;
}
if (pub.drivers) {
removeRawSubscription(pub as RawSubscribe);
addRawSubscription(pub as RawSubscribe);
UpdateTable();
}
updateSubscriptionValue(pub.uuid, pub.value);
});