Skip to content

Commit

Permalink
Merge pull request #21 from PhoenixNazarov/dev
Browse files Browse the repository at this point in the history
Add fetch columns, upgrade schema, filters and selects columns
  • Loading branch information
PhoenixNazarov authored Oct 2, 2024
2 parents b7e91ad + 0bed478 commit f993595
Show file tree
Hide file tree
Showing 11 changed files with 662 additions and 375 deletions.
54 changes: 41 additions & 13 deletions client/src/stores/project/tables/table.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export const useTableStore = defineStore({
if (alreadyProject) {
return alreadyProject
}
const result = (await ApiService.post<{table_schema: any} | undefined>('/api/project/tables/main/schema/download',
const result = (await ApiService.post<{
table_schema: any
} | undefined>('/api/project/tables/main/schema/download',
{
project: project,
}
Expand All @@ -43,11 +45,16 @@ export const useTableStore = defineStore({
key: string,
order: 'ask' | 'desc'
}[] | undefined = undefined,
filter: {
key: string | undefined,
value: string | undefined,
like: boolean | undefined
} | undefined = undefined
filters: {
key: string,
value?: string | number | boolean | undefined,
operator: string
}[] | undefined = undefined,
joins: {
table: string
pseudo?: string
condition: string
}[] | undefined = undefined
) {
return await ApiService.post<any[]>('/api/project/tables/list/load',
{
Expand All @@ -57,26 +64,47 @@ export const useTableStore = defineStore({
page: page - 1,
count: count,
order_by: orderBy,
filter: filter?.key ? filter : undefined
filter: filters,
joins: joins
}
)
},
async listCount(
project: string,
table: string,
columns: string[],
filter: {
key: string | undefined,
value: string | undefined,
like: boolean | undefined
} | undefined = undefined
filters: {
key: string,
value?: string | number | boolean | undefined,
operator: string
}[] | undefined = undefined,
joins: {
table: string
pseudo?: string
condition: string
}[] | undefined = undefined
) {
return await ApiService.post<{ count: number }>('/api/project/tables/list/count',
{
project: project,
table: table,
columns: columns,
filter: filter?.key ? filter : undefined
filter: filters,
joins: joins
}
)
},
async fetchColumns(
project: string,
table: string
) {
return await ApiService.post<{
column_name: string,
data_type: string
}[]>('/api/project/tables/list/fetch_columns',
{
project: project,
table: table,
}
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ export default defineComponent({
required: true
}
},
data() {
return {
on: false
}
},
watch: {
model(newVal) {
this.doWrite(newVal)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default defineComponent({
reader.readAsDataURL(file)
reader.onload = () => {
const bytes = reader?.result?.split(',')[1]
this.doWrite(bytes)
this.doWrite({type: 'bytes', value: bytes})
}
}
}
Expand All @@ -38,7 +38,12 @@ export default defineComponent({
@update:model-value="doWriteFile"
/>
<img
v-if="model"
v-if="(model as any)?.value"
:src="'data:image/png;base64,'+ (model as any).value"
:height="componentSchema.size ? CONST_SCHEMA_COMPONENT.image_size[componentSchema.size] : CONST_SCHEMA_COMPONENT.image_size_default"
/>
<img
v-else-if="model"
:src="'data:image/png;base64,'+ model"
:height="componentSchema.size ? CONST_SCHEMA_COMPONENT.image_size[componentSchema.size] : CONST_SCHEMA_COMPONENT.image_size_default"
/>
Expand Down
Loading

0 comments on commit f993595

Please sign in to comment.