support for distinct in query designer

This commit is contained in:
Jan Prochazka 2022-01-02 10:02:31 +01:00
parent 1494fe3078
commit fb9069efe8
3 changed files with 22 additions and 0 deletions

View File

@ -106,6 +106,7 @@ export function generateDesignedQuery(designer: DesignerInfo, engine: EngineDriv
const componentCreator = new DesignerComponentCreator(designer);
const designerDumper = new DesignerQueryDumper(designer, componentCreator.components);
const select = designerDumper.run();
select.distinct = !!designer?.settings?.isDistinct;
const dmp = engine.createDumper();
dumpSqlSelect(dmp, select);

View File

@ -33,7 +33,12 @@ export type DesignerColumnInfo = {
groupFilter?: string;
};
export type DesignerSettings = {
isDistinct?: boolean;
};
export type DesignerInfo = {
settings?: DesignerSettings;
tables: DesignerTableInfo[];
columns: DesignerColumnInfo[];
references: DesignerReferenceInfo[];

View File

@ -215,6 +215,22 @@
{ divider: true },
{ command: 'designer.undo' },
{ command: 'designer.redo' },
{ divider: true },
{
text: `Remove duplicates: ${$editorState.value?.settings?.isDistinct ? 'YES' : 'NO'}`,
onClick: () => {
handleChange(
{
...$editorState.value,
settings: {
...$editorState.value?.settings,
isDistinct: !$editorState.value?.settings?.isDistinct,
},
},
false
);
},
},
];
}
</script>