perspective fixes

This commit is contained in:
Jan Prochazka
2022-08-28 07:52:36 +02:00
parent 4e799885b5
commit 894a864110
4 changed files with 88 additions and 29 deletions

View File

@@ -37,6 +37,7 @@
PerspectiveTableColumnNode,
PerspectiveTableNode,
processPerspectiveDefaultColunns,
shouldProcessPerspectiveDefaultColunns,
} from 'dbgate-datalib';
import _ from 'lodash';
@@ -150,20 +151,23 @@
: null;
$: {
tick().then(() => {
const newConfig = processPerspectiveDefaultColunns(config, $dbInfos, conid, database);
if (newConfig) {
if (
newConfig.nodes.filter(x => x.defaultColumnsProcessed).length >
config.nodes.filter(x => x.defaultColumnsProcessed).length
) {
console.log('CONFIG CHANGED');
setConfig(() => newConfig);
} else {
console.warn('No new default columns', newConfig);
}
}
});
if (shouldProcessPerspectiveDefaultColunns(config, $dbInfos, conid, database)) {
setConfig(cfg => processPerspectiveDefaultColunns(cfg, $dbInfos, conid, database));
}
// tick().then(() => {
// const newConfig = processPerspectiveDefaultColunns(config, $dbInfos, conid, database);
// if (newConfig) {
// if (
// newConfig.nodes.filter(x => x.defaultColumnsProcessed).length >
// config.nodes.filter(x => x.defaultColumnsProcessed).length
// ) {
// console.log('CONFIG CHANGED');
// setConfig(() => newConfig);
// } else {
// console.warn('No new default columns', newConfig);
// }
// }
// });
}
</script>