Skip to content

Commit

Permalink
implementing async query support with polling (opensearch-project#131)
Browse files Browse the repository at this point in the history
* successfully getting async post requests

Signed-off-by: Paul Sebastian <[email protected]>

* get query with hardcoded job id working

Signed-off-by: Paul Sebastian <[email protected]>

* working spark query after constant time wait

Signed-off-by: Paul Sebastian <[email protected]>

* added polling with some hardcoded values

Signed-off-by: Paul Sebastian <[email protected]>

* ability to switch between sources implemented

Signed-off-by: Paul Sebastian <[email protected]>

* implemented basic spinner

Signed-off-by: Paul Sebastian <[email protected]>

* small pr asks and cancellation implemented

Signed-off-by: Paul Sebastian <[email protected]>

* fixing small clear state issues

Signed-off-by: Paul Sebastian <[email protected]>

* reduce route name redundancy

Signed-off-by: Paul Sebastian <[email protected]>

* remove multiple query implementation for async

Signed-off-by: Paul Sebastian <[email protected]>

* needed to modify the endpoint

Signed-off-by: Paul Sebastian <[email protected]>

* default data source being Opensearch and updated snapshots

Signed-off-by: Paul Sebastian <[email protected]>

---------

Signed-off-by: Paul Sebastian <[email protected]>
  • Loading branch information
paulstn authored Oct 3, 2023
1 parent b506714 commit 086a7ef
Show file tree
Hide file tree
Showing 12 changed files with 827 additions and 246 deletions.
2 changes: 2 additions & 0 deletions common/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,5 @@ export interface CreateAccelerationForm {
refreshIntervalOptions: RefreshIntervalType;
formErrors: FormErrorsType;
}

export type AsyncQueryLoadingStatus = "SUCCESS" | "FAILED" | "RUNNING" | "SCHEDULED" | "CANCELED"
262 changes: 234 additions & 28 deletions public/components/Main/__snapshots__/main.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,20 @@ exports[`<Main /> spec click clear button 1`] = `
data-test-subj="comboBoxInput"
tabindex="-1"
>
<p
class="euiComboBoxPlaceholder"
<span
class="euiBadge euiBadge--hollow euiBadge--iconLeft euiComboBoxPill"
title="Opensearch"
>
Connection Name
</p>
<span
class="euiBadge__content"
>
<span
class="euiBadge__text"
>
Opensearch
</span>
</span>
</span>
<div
class="euiComboBox__input"
style="font-size: 14px; display: inline-block;"
Expand All @@ -54,6 +63,27 @@ exports[`<Main /> spec click clear button 1`] = `
<div
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right"
>
<button
aria-label="Clear input"
class="euiFormControlLayoutClearButton"
data-test-subj="comboBoxClearButton"
type="button"
>
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium euiFormControlLayoutClearButton__icon"
focusable="false"
height="16"
role="img"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M7.293 8 3.146 3.854a.5.5 0 1 1 .708-.708L8 7.293l4.146-4.147a.5.5 0 0 1 .708.708L8.707 8l4.147 4.146a.5.5 0 0 1-.708.708L8 8.707l-4.146 4.147a.5.5 0 0 1-.708-.708L7.293 8Z"
/>
</svg>
</button>
<button
aria-label="Open list of options"
class="euiFormControlLayoutCustomIcon euiFormControlLayoutCustomIcon--clickable"
Expand Down Expand Up @@ -573,11 +603,20 @@ exports[`<Main /> spec click run button, and response causes an error 1`] = `
data-test-subj="comboBoxInput"
tabindex="-1"
>
<p
class="euiComboBoxPlaceholder"
<span
class="euiBadge euiBadge--hollow euiBadge--iconLeft euiComboBoxPill"
title="Opensearch"
>
Connection Name
</p>
<span
class="euiBadge__content"
>
<span
class="euiBadge__text"
>
Opensearch
</span>
</span>
</span>
<div
class="euiComboBox__input"
style="font-size: 14px; display: inline-block;"
Expand All @@ -597,6 +636,27 @@ exports[`<Main /> spec click run button, and response causes an error 1`] = `
<div
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right"
>
<button
aria-label="Clear input"
class="euiFormControlLayoutClearButton"
data-test-subj="comboBoxClearButton"
type="button"
>
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium euiFormControlLayoutClearButton__icon"
focusable="false"
height="16"
role="img"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M7.293 8 3.146 3.854a.5.5 0 1 1 .708-.708L8 7.293l4.146-4.147a.5.5 0 0 1 .708.708L8.707 8l4.147 4.146a.5.5 0 0 1-.708.708L8 8.707l-4.146 4.147a.5.5 0 0 1-.708-.708L7.293 8Z"
/>
</svg>
</button>
<button
aria-label="Open list of options"
class="euiFormControlLayoutCustomIcon euiFormControlLayoutCustomIcon--clickable"
Expand Down Expand Up @@ -1116,11 +1176,20 @@ exports[`<Main /> spec click run button, and response is not ok 1`] = `
data-test-subj="comboBoxInput"
tabindex="-1"
>
<p
class="euiComboBoxPlaceholder"
<span
class="euiBadge euiBadge--hollow euiBadge--iconLeft euiComboBoxPill"
title="Opensearch"
>
Connection Name
</p>
<span
class="euiBadge__content"
>
<span
class="euiBadge__text"
>
Opensearch
</span>
</span>
</span>
<div
class="euiComboBox__input"
style="font-size: 14px; display: inline-block;"
Expand All @@ -1140,6 +1209,27 @@ exports[`<Main /> spec click run button, and response is not ok 1`] = `
<div
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right"
>
<button
aria-label="Clear input"
class="euiFormControlLayoutClearButton"
data-test-subj="comboBoxClearButton"
type="button"
>
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium euiFormControlLayoutClearButton__icon"
focusable="false"
height="16"
role="img"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M7.293 8 3.146 3.854a.5.5 0 1 1 .708-.708L8 7.293l4.146-4.147a.5.5 0 0 1 .708.708L8.707 8l4.147 4.146a.5.5 0 0 1-.708.708L8 8.707l-4.146 4.147a.5.5 0 0 1-.708-.708L7.293 8Z"
/>
</svg>
</button>
<button
aria-label="Open list of options"
class="euiFormControlLayoutCustomIcon euiFormControlLayoutCustomIcon--clickable"
Expand Down Expand Up @@ -1659,11 +1749,20 @@ exports[`<Main /> spec click run button, and response is ok 1`] = `
data-test-subj="comboBoxInput"
tabindex="-1"
>
<p
class="euiComboBoxPlaceholder"
<span
class="euiBadge euiBadge--hollow euiBadge--iconLeft euiComboBoxPill"
title="Opensearch"
>
Connection Name
</p>
<span
class="euiBadge__content"
>
<span
class="euiBadge__text"
>
Opensearch
</span>
</span>
</span>
<div
class="euiComboBox__input"
style="font-size: 14px; display: inline-block;"
Expand All @@ -1683,6 +1782,27 @@ exports[`<Main /> spec click run button, and response is ok 1`] = `
<div
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right"
>
<button
aria-label="Clear input"
class="euiFormControlLayoutClearButton"
data-test-subj="comboBoxClearButton"
type="button"
>
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium euiFormControlLayoutClearButton__icon"
focusable="false"
height="16"
role="img"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M7.293 8 3.146 3.854a.5.5 0 1 1 .708-.708L8 7.293l4.146-4.147a.5.5 0 0 1 .708.708L8.707 8l4.147 4.146a.5.5 0 0 1-.708.708L8 8.707l-4.146 4.147a.5.5 0 0 1-.708-.708L7.293 8Z"
/>
</svg>
</button>
<button
aria-label="Open list of options"
class="euiFormControlLayoutCustomIcon euiFormControlLayoutCustomIcon--clickable"
Expand Down Expand Up @@ -2268,11 +2388,20 @@ exports[`<Main /> spec click run button, response fills null and missing values
data-test-subj="comboBoxInput"
tabindex="-1"
>
<p
class="euiComboBoxPlaceholder"
<span
class="euiBadge euiBadge--hollow euiBadge--iconLeft euiComboBoxPill"
title="Opensearch"
>
Connection Name
</p>
<span
class="euiBadge__content"
>
<span
class="euiBadge__text"
>
Opensearch
</span>
</span>
</span>
<div
class="euiComboBox__input"
style="font-size: 14px; display: inline-block;"
Expand All @@ -2292,6 +2421,27 @@ exports[`<Main /> spec click run button, response fills null and missing values
<div
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right"
>
<button
aria-label="Clear input"
class="euiFormControlLayoutClearButton"
data-test-subj="comboBoxClearButton"
type="button"
>
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium euiFormControlLayoutClearButton__icon"
focusable="false"
height="16"
role="img"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M7.293 8 3.146 3.854a.5.5 0 1 1 .708-.708L8 7.293l4.146-4.147a.5.5 0 0 1 .708.708L8.707 8l4.147 4.146a.5.5 0 0 1-.708.708L8 8.707l-4.146 4.147a.5.5 0 0 1-.708-.708L7.293 8Z"
/>
</svg>
</button>
<button
aria-label="Open list of options"
class="euiFormControlLayoutCustomIcon euiFormControlLayoutCustomIcon--clickable"
Expand Down Expand Up @@ -2876,11 +3026,20 @@ exports[`<Main /> spec click translation button, and response is ok 1`] = `
data-test-subj="comboBoxInput"
tabindex="-1"
>
<p
class="euiComboBoxPlaceholder"
<span
class="euiBadge euiBadge--hollow euiBadge--iconLeft euiComboBoxPill"
title="Opensearch"
>
Connection Name
</p>
<span
class="euiBadge__content"
>
<span
class="euiBadge__text"
>
Opensearch
</span>
</span>
</span>
<div
class="euiComboBox__input"
style="font-size: 14px; display: inline-block;"
Expand All @@ -2900,6 +3059,27 @@ exports[`<Main /> spec click translation button, and response is ok 1`] = `
<div
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right"
>
<button
aria-label="Clear input"
class="euiFormControlLayoutClearButton"
data-test-subj="comboBoxClearButton"
type="button"
>
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium euiFormControlLayoutClearButton__icon"
focusable="false"
height="16"
role="img"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M7.293 8 3.146 3.854a.5.5 0 1 1 .708-.708L8 7.293l4.146-4.147a.5.5 0 0 1 .708.708L8.707 8l4.147 4.146a.5.5 0 0 1-.708.708L8 8.707l-4.146 4.147a.5.5 0 0 1-.708-.708L7.293 8Z"
/>
</svg>
</button>
<button
aria-label="Open list of options"
class="euiFormControlLayoutCustomIcon euiFormControlLayoutCustomIcon--clickable"
Expand Down Expand Up @@ -3419,11 +3599,20 @@ exports[`<Main /> spec renders the component 1`] = `
data-test-subj="comboBoxInput"
tabindex="-1"
>
<p
class="euiComboBoxPlaceholder"
<span
class="euiBadge euiBadge--hollow euiBadge--iconLeft euiComboBoxPill"
title="Opensearch"
>
Connection Name
</p>
<span
class="euiBadge__content"
>
<span
class="euiBadge__text"
>
Opensearch
</span>
</span>
</span>
<div
class="euiComboBox__input"
style="font-size: 14px; display: inline-block;"
Expand All @@ -3443,6 +3632,23 @@ exports[`<Main /> spec renders the component 1`] = `
<div
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right"
>
<button
aria-label="Clear input"
class="euiFormControlLayoutClearButton"
data-test-subj="comboBoxClearButton"
type="button"
>
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium euiIcon-isLoading euiFormControlLayoutClearButton__icon"
focusable="false"
height="16"
role="img"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
/>
</button>
<button
aria-label="Open list of options"
class="euiFormControlLayoutCustomIcon euiFormControlLayoutCustomIcon--clickable"
Expand Down
Loading

0 comments on commit 086a7ef

Please sign in to comment.