-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Support dark mode and session for sql, minor bug fixes (#165)
* suport dark mode and editor theming from dev tools Signed-off-by: Shenoy Pratik <[email protected]> * remove sql editor theme, add session check Signed-off-by: Shenoy Pratik <[email protected]> * update snapshots Signed-off-by: Shenoy Pratik <[email protected]> * minor fixes Signed-off-by: Shenoy Pratik <[email protected]> * fix import Signed-off-by: Shenoy Pratik <[email protected]> * fix job query url Signed-off-by: Shenoy Pratik <[email protected]> * update poll interval to 2000 Signed-off-by: Shenoy Pratik <[email protected]> --------- Signed-off-by: Shenoy Pratik <[email protected]> (cherry picked from commit 937ff30) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent
50e2d1a
commit f88003f
Showing
20 changed files
with
357 additions
and
529 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import _ from 'lodash'; | ||
import { CoreStart } from '../../../../src/core/public'; | ||
import { | ||
ASYNC_QUERY_ENDPOINT, | ||
ASYNC_QUERY_JOB_ENDPOINT, | ||
ASYNC_QUERY_SESSION_ID, | ||
POLL_INTERVAL_MS, | ||
} from '../constants'; | ||
|
||
export const setAsyncSessionId = (value: string | null) => { | ||
if (value === null) sessionStorage.removeItem(ASYNC_QUERY_SESSION_ID); | ||
else sessionStorage.setItem(ASYNC_QUERY_SESSION_ID, value); | ||
}; | ||
|
||
export const getAsyncSessionId = () => { | ||
return sessionStorage.getItem(ASYNC_QUERY_SESSION_ID); | ||
}; | ||
|
||
export const getJobId = (query: {}, http: CoreStart['http'], callback) => { | ||
http | ||
.post(ASYNC_QUERY_ENDPOINT, { | ||
body: JSON.stringify({ ...query, sessionId: getAsyncSessionId() ?? undefined }), | ||
}) | ||
.then((res) => { | ||
const id = res.data.resp.queryId; | ||
setAsyncSessionId(_.get(res.data.resp, 'sessionId', null)); | ||
callback(id); | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
}); | ||
}; | ||
|
||
export const pollQueryStatus = (id: string, http: CoreStart['http'], callback) => { | ||
http | ||
.get(ASYNC_QUERY_JOB_ENDPOINT + id) | ||
.then((res) => { | ||
const status = res.data.resp.status.toLowerCase(); | ||
if ( | ||
status === 'pending' || | ||
status === 'running' || | ||
status === 'scheduled' || | ||
status === 'waiting' | ||
) { | ||
setTimeout(() => pollQueryStatus(id, http, callback), POLL_INTERVAL_MS); | ||
} else if (status === 'failed') { | ||
callback([]); | ||
} else if (status === 'success') { | ||
const results = _.get(res.data.resp, 'datarows'); | ||
callback(results); | ||
} | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
callback([]); | ||
}); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
348 changes: 178 additions & 170 deletions
348
public/components/QueryResults/__snapshots__/QueryResultsBody.test.tsx.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.