diff --git a/packages/web/src/designer/designerTools.ts b/packages/web/src/designer/designerTools.ts index 5ed0152d..a1170715 100644 --- a/packages/web/src/designer/designerTools.ts +++ b/packages/web/src/designer/designerTools.ts @@ -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); diff --git a/packages/web/src/designer/types.ts b/packages/web/src/designer/types.ts index c746f7ac..000549de 100644 --- a/packages/web/src/designer/types.ts +++ b/packages/web/src/designer/types.ts @@ -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[]; diff --git a/packages/web/src/tabs/QueryDesignTab.svelte b/packages/web/src/tabs/QueryDesignTab.svelte index 24b7e0ec..5c735f75 100644 --- a/packages/web/src/tabs/QueryDesignTab.svelte +++ b/packages/web/src/tabs/QueryDesignTab.svelte @@ -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 + ); + }, + }, ]; }