Skip to content

Feat/alasql #1457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
added alasql query in editor query panel
  • Loading branch information
raheeliftikhar5 committed Jan 22, 2025
commit 3a4ab7c1dc13d1305fb8557b8b5a1036d121fcb1
8 changes: 8 additions & 0 deletions client/packages/lowcoder/src/components/ResCreatePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@ const ResButton = (props: {
compType: "streamApi",
},
},
alasql: {
label: trans("query.quickAlasql"),
type: BottomResTypeEnum.Query,
extra: {
compType: "alasql",
},
},
graphql: {
label: trans("query.quickGraphql"),
type: BottomResTypeEnum.Query,
Expand Down Expand Up @@ -319,6 +326,7 @@ export function ResCreatePanel(props: ResCreateModalProps) {
<DataSourceListWrapper $placement={placement}>
<ResButton size={buttonSize} identifier={"restApi"} onSelect={onSelect} />
<ResButton size={buttonSize} identifier={"streamApi"} onSelect={onSelect} />
<ResButton size={buttonSize} identifier={"alasql"} onSelect={onSelect} />
<ResButton size={buttonSize} identifier={"graphql"} onSelect={onSelect} />
{datasource.map((i) => (
<ResButton size={buttonSize} key={i.id} identifier={i} onSelect={onSelect} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@ function useDatasourceStatus(datasourceId: string, datasourceType: ResourceType)
datasourceType === "js" ||
datasourceType === "streamApi" ||
datasourceType === "libraryQuery" ||
datasourceType === "alasql" ||
datasourceId === QUICK_REST_API_ID ||
datasourceId === QUICK_GRAPHQL_ID
) {
Expand Down
16 changes: 16 additions & 0 deletions client/packages/lowcoder/src/comps/queries/resourceDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ const QuickGraphqlValue: ResourceOptionValue = {
type: "graphql",
};

const QuickAlasqlValue: ResourceOptionValue = {
id: "",
type: "alasql",
};

interface ResourceDropdownProps {
changeResource: (datasourceId: string, value: string) => void;
selectedResource: ResourceOptionValue;
Expand Down Expand Up @@ -265,6 +270,17 @@ export const ResourceDropdown = (props: ResourceDropdownProps) => {
<SelectOptionLabel>{trans("query.quickStreamAPI")} </SelectOptionLabel>
</SelectOptionContains>
</SelectOption>

<SelectOption
key={JSON.stringify(QuickAlasqlValue)}
label={trans("query.quickAlasql")}
value={JSON.stringify(QuickAlasqlValue)}
>
<SelectOptionContains>
{getBottomResIcon("restApi")}
<SelectOptionLabel>{trans("query.quickAlasql")} </SelectOptionLabel>
</SelectOptionContains>
</SelectOption>

<SelectOption
key={JSON.stringify(QuickGraphqlValue)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ export const NOT_SUPPORT_GUI_SQL_QUERY: string[] = [
"snowflake",
"tdengine",
"dameng",
"alasql",
];
const SUPPORT_UPSERT_SQL_QUERY: string[] = [
"mysql",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const databasePlugins: Partial<DatasourceType>[] = [
"clickHouse",
"snowflake",
"mariadb",
"alasql",
];

export const apiPluginsForQueryLibrary: Partial<DatasourceType>[] = [
Expand Down
5 changes: 4 additions & 1 deletion client/packages/lowcoder/src/constants/queryConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { GraphqlQuery } from "../comps/queries/httpQuery/graphqlQuery";
import { toPluginQuery } from "comps/queries/pluginQuery/pluginQuery";
import { MultiCompConstructor } from "lowcoder-core";
import { DataSourcePluginMeta } from "lowcoder-sdk/dataSource";
import { AlaSqlQuery } from "@lowcoder-ee/comps/queries/httpQuery/alasqlQuery";

export type DatasourceType =
| "mysql"
Expand All @@ -29,13 +30,15 @@ export type DatasourceType =
| "googleSheets"
| "graphql"
| "snowflake"
| "mariadb";
| "mariadb"
| "alasql";

export type ResourceType = DatasourceType | "js" | "libraryQuery" | "view";

export const QueryMap = {
js: JSQuery,
mysql: SQLQuery,
alasql: AlaSqlQuery,
restApi: HttpQuery,
streamApi: StreamQuery,
mongodb: MongoQuery,
Expand Down
3 changes: 3 additions & 0 deletions client/packages/lowcoder/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,9 @@ export const en = {
"quickRestAPI": "REST Query",
"quickStreamAPI": "Stream Query",
"quickGraphql": "GraphQL Query",
"quickAlasql": "Local SQL Query",
"databaseType": "Database Type",
"chooseDatabase": "Choose Database",
"lowcoderAPI": "Lowcoder API",
"executeJSCode": "Run JavaScript Code",
"importFromQueryLibrary": "Import from Query Library",
Expand Down
Loading