mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 16:06:01 +00:00
perspectives:add to filter ctx menu
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
PerspectiveConfig,
|
||||
PerspectiveConfigColumns,
|
||||
PerspectiveCustomJoinConfig,
|
||||
PerspectiveFilterColumnInfo,
|
||||
} from './PerspectiveConfig';
|
||||
import _isEqual from 'lodash/isEqual';
|
||||
import _cloneDeep from 'lodash/cloneDeep';
|
||||
@@ -152,25 +153,25 @@ export abstract class PerspectiveTreeNode {
|
||||
}
|
||||
}
|
||||
|
||||
setFilter(value) {
|
||||
this.setConfig(
|
||||
cfg => ({
|
||||
...cfg,
|
||||
filters: {
|
||||
...cfg.filters,
|
||||
[this.uniqueName]: value,
|
||||
},
|
||||
filterInfos: {
|
||||
...cfg.filterInfos,
|
||||
[this.uniqueName]: {
|
||||
columnName: this.columnName,
|
||||
filterType: this.filterType,
|
||||
},
|
||||
},
|
||||
}),
|
||||
true
|
||||
);
|
||||
}
|
||||
// setFilter(value) {
|
||||
// this.setConfig(
|
||||
// cfg => ({
|
||||
// ...cfg,
|
||||
// filters: {
|
||||
// ...cfg.filters,
|
||||
// [this.uniqueName]: value,
|
||||
// },
|
||||
// filterInfos: {
|
||||
// ...cfg.filterInfos,
|
||||
// [this.uniqueName]: {
|
||||
// columnName: this.columnName,
|
||||
// filterType: this.filterType,
|
||||
// },
|
||||
// },
|
||||
// }),
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
|
||||
getFilter() {
|
||||
return this.config.filters[this.uniqueName];
|
||||
@@ -232,6 +233,10 @@ export abstract class PerspectiveTreeNode {
|
||||
getBaseTableFromThis() {
|
||||
return null;
|
||||
}
|
||||
|
||||
get filterInfo(): PerspectiveFilterColumnInfo {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export class PerspectiveTableColumnNode extends PerspectiveTreeNode {
|
||||
@@ -344,6 +349,14 @@ export class PerspectiveTableColumnNode extends PerspectiveTreeNode {
|
||||
return this.refTable;
|
||||
}
|
||||
|
||||
get filterInfo(): PerspectiveFilterColumnInfo {
|
||||
return {
|
||||
columnName: this.columnName,
|
||||
filterType: this.filterType,
|
||||
tableName: this.column.pureName,
|
||||
};
|
||||
}
|
||||
|
||||
parseFilterCondition() {
|
||||
const filter = this.getFilter();
|
||||
if (!filter) return null;
|
||||
|
||||
Reference in New Issue
Block a user