Skip to content

Commit

Permalink
Fix/bulk action (#38)
Browse files Browse the repository at this point in the history
#30

---------

Signed-off-by: seven <[email protected]>
  • Loading branch information
Blankll authored Mar 31, 2024
1 parent 81a1e8c commit fb7e824
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/common/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export const buildSearchToken = (lines: Array<{ lineNumber: number; lineContent:
const qdsl = lines
.slice(lineNumber, endLineNumber)
.map(({ lineContent }) => lineContent)
.join('');
.join('\n');

return {
qdsl,
Expand Down
10 changes: 5 additions & 5 deletions src/common/httpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const fetchWrapper = async ({
method: string;
path?: string;
queryParameters?: string;
payload?: unknown;
payload?: string;
username?: string;
password?: string;
host: string;
Expand All @@ -51,7 +51,7 @@ const fetchWrapper = async ({
const { data, status, details } = await fetchApi.fetch(url, {
method,
authorization,
payload: payload ? JSON.stringify(payload) : undefined,
payload,
ssl,
});
return handleFetch({ data, status, details });
Expand All @@ -72,7 +72,7 @@ export const loadHttpClient = (con: {
queryParameters,
ssl: con.sslCertVerification,
}),
post: async (path: string, queryParameters?: string, payload?: unknown) =>
post: async (path: string, queryParameters?: string, payload?: string) =>
fetchWrapper({
...con,
method: 'POST',
Expand All @@ -81,7 +81,7 @@ export const loadHttpClient = (con: {
payload,
ssl: con.sslCertVerification,
}),
put: async (path: string, queryParameters?: string, payload?: unknown) =>
put: async (path: string, queryParameters?: string, payload?: string) =>
fetchWrapper({
...con,
method: 'PUT',
Expand All @@ -91,7 +91,7 @@ export const loadHttpClient = (con: {
ssl: con.sslCertVerification,
}),

delete: async (path: string, queryParameters?: string, payload?: unknown) =>
delete: async (path: string, queryParameters?: string, payload?: string) =>
fetchWrapper({
...con,
method: 'DELETE',
Expand Down
2 changes: 1 addition & 1 deletion src/store/connectionStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const useConnectionStore = defineStore('connectionStore', {
const client = loadHttpClient(this.established);

const reqPath = buildPath(index, path);
const body = qdsl ? JSON.parse(qdsl) : undefined;
const body = qdsl ?? undefined;

const dispatch: { [method: string]: () => Promise<unknown> } = {
POST: async () => client.post(reqPath, undefined, body),
Expand Down
4 changes: 3 additions & 1 deletion src/views/editor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ const executeQueryAction = async (
});
return;
}
if (action.path.includes('_bulk')) {
action.qdsl += '\n';
}
const data = await searchQDSL({
...action,
index: action.index || established.value?.activeIndex?.index,
Expand Down

0 comments on commit fb7e824

Please sign in to comment.