Skip to content

Commit

Permalink
fix: minor ui issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Ionov committed May 21, 2024
1 parent d2488b8 commit d657433
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 17 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
"description": "",
"scripts": {
"start": "vite",
"dev": "vite",
"dev": "tauri dev",
"build": "vite build",
"serve": "vite preview",
"tauri": "tauri",
"update-deps": "pnpm up -Li",
"clean": "rm -rf node_modules src-tauri/target dist",
"release": "standard-version"
},
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"build": {
"beforeDevCommand": "pnpm dev",
"beforeDevCommand": "pnpm start",
"beforeBuildCommand": "pnpm build",
"devPath": "http://localhost:1420",
"distDir": "../dist",
Expand Down
6 changes: 4 additions & 2 deletions src/components/Screens/Console/Content/QueryTab/Results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const Results = (props: { editorTheme: EditorTheme; gridTheme: string; ed
openDrawerForm,
});
if (result_set?.rows?.length) {
return { rows: result_set.rows, columns, colDef, count: result_set.count, start_time, end_time };
return { rows: result_set.rows, columns, colDef, count: result_set.count, start_time, end_time, info: result_set.info };
}
if (!result_set || result_set?.status !== 'Completed') {
return { rows: [], columns, colDef, exhausted: true, notReady: true };
Expand All @@ -134,6 +134,7 @@ export const Results = (props: { editorTheme: EditorTheme; gridTheme: string; ed
path: result_set.path,
start_time,
end_time,
info: result_set.info
};
} catch (error) {
notify(error);
Expand Down Expand Up @@ -167,7 +168,7 @@ export const Results = (props: { editorTheme: EditorTheme; gridTheme: string; ed

const onBtnExport = async (t: 'csv' | 'json') => {
if (!data()?.path) return;
const filename = props.table + '_' + new Date().toISOString() + '.' + t;
const filename = (props.table ?? '') + new Date().toISOString() + '.' + t;
const filePath = (await save({ defaultPath: filename })) ?? '';
const dataPath = data()?.path;
if (!filePath || !dataPath) return;
Expand Down Expand Up @@ -328,6 +329,7 @@ export const Results = (props: { editorTheme: EditorTheme; gridTheme: string; ed
onPageSizeChange,
onBtnExport,
count: data()?.count ?? 0,
info: data()?.info ?? '',
openDrawerForm: props.editable ? openDrawerForm : undefined,
executionTime: (data()?.end_time ?? 0) - (data()?.start_time ?? 0),
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type PaginationProps = {
applyChanges: () => void;
undoChanges: () => void;
count: number;
info: string;
openDrawerForm?: (s: Pick<DrawerState, 'mode' | 'rowIndex' | 'data'>) => void;
executionTime?: number;
};
Expand Down Expand Up @@ -97,7 +98,7 @@ export const Pagination = (props: PaginationProps) => {
</div>
</Show>
<Show when={props.executionTime}>
<span class="text-xs">{t('console.table.ran', { duration: props.executionTime })} </span>
<span class="text-xs font-medium">{t('console.table.ran', { duration: props.executionTime })} | {props.info}</span>
</Show>
</div>
<Show when={resultSet.status === 'Completed' && !resultSet.info}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export const Search = (props: SearchProps) => {
});

const onSubmit = async (values: Form) => {
console.log('onSubmit: ', values);
try {
setLoading(true);
const { column, operator, value } = values;
Expand Down
3 changes: 2 additions & 1 deletion src/components/Screens/Console/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export const Sidebar = () => {
<Select
name="mode"
value={getConnection().selectedSchema}
suppressTitlecase
onChange={(e) => selectSchema(e.currentTarget.value)}
options={getConnection().schemas ?? []}
/>
Expand Down Expand Up @@ -186,7 +187,7 @@ export const Sidebar = () => {
<div class="text-xs font-bold py-1">{t('sidebar.routines')}</div>
<For each={getSchemaEntity('routines')}>
{(routine) => (
<div class="px-2 w-fit truncate w-full hover:bg-base-100">
<div class="px-2 truncate w-full hover:bg-base-100">
<div
onContextMenu={(e) => {
hideAll();
Expand Down
21 changes: 11 additions & 10 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ input::-webkit-inner-spin-button {
}

/* Firefox */
input[type="number"] {
input[type='number'] {
-moz-appearance: textfield;
}

Expand All @@ -78,7 +78,7 @@ input[type="number"] {
}

.cm-button {
@apply !rounded-full !text-xs !text-info ;
@apply !rounded-full !text-xs !text-info;
}

*:focus {
Expand Down Expand Up @@ -108,10 +108,12 @@ dialog {
cursor: col-resize;
}

#results {
-webkit-user-select: auto; /* Safari */
-ms-user-select: auto; /* IE 10 and IE 11 */
user-select: auto;
::-moz-selection { /* Code for Firefox */
@apply bg-primary text-primary-content;
}

::selection {
@apply bg-primary text-primary-content;
}

.solid-contextmenu__item__content {
Expand All @@ -130,10 +132,9 @@ dialog {
@apply z-50;
}


/* ag-grid */
div[class*='ag-theme'] {
--ag-grid-size: 4px;
--ag-list-item-height: 16px;
--ag-cell-horizontal-padding: calc(var(--ag-grid-size) * 2);
--ag-grid-size: 4px;
--ag-list-item-height: 16px;
--ag-cell-horizontal-padding: calc(var(--ag-grid-size) * 2);
}
1 change: 1 addition & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export type Row = Record<string, JSONValue>;

export type ResultSet = {
id?: string;
info?: string;
count?: number;
affected_rows?: number;
warnings?: number;
Expand Down

0 comments on commit d657433

Please sign in to comment.