make new folder for reuse ngLib add new features for datatree like change add remove rename datapoints improve pingpong
This commit is contained in:
22
src/vueLib/dbm/updateTable.ts
Normal file
22
src/vueLib/dbm/updateTable.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import type { Subs } from '../models/Subscribe';
|
||||
import { Subscriptions } from '../models/Subscriptions';
|
||||
import { ref } from 'vue';
|
||||
|
||||
export const TableSubs = ref<Subs>();
|
||||
|
||||
export function UpdateTable(targetUuid?: string) {
|
||||
TableSubs.value = Object.values(Subscriptions)
|
||||
.map((sub) => {
|
||||
sub.type = sub.type ?? 'none';
|
||||
return sub;
|
||||
})
|
||||
.sort((a, b) => {
|
||||
if (targetUuid) {
|
||||
if (a.uuid === targetUuid) return -1; // move `a` to front
|
||||
if (b.uuid === targetUuid) return 1; // move `b` to front
|
||||
}
|
||||
const aPath = a.path ?? '';
|
||||
const bPath = b.path ?? '';
|
||||
return aPath.localeCompare(bPath);
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user