Skip to content
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

feat(native-filters): add refresh button to default value picker #14375

Merged
merged 3 commits into from Apr 27, 2021

Conversation

villebro
Copy link
Member

SUMMARY

Adds feature not automatically always populate the default value picker unless explicitly asked to do so.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

default_loader.mp4

TEST PLAN

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Comment on lines +179 to +224
const refreshHandler = () => {
if (!hasDataset || !formFilter?.dataset?.value) {
forceUpdate();
return;
}
const formData = getFormData({
datasetId: formFilter?.dataset?.value,
groupby: formFilter?.column,
defaultValue: formFilter?.defaultValue,
...formFilter,
});
setNativeFilterFieldValues(form, filterId, {
defaultValueQueriesData: null,
isDataDirty: false,
});
forceUpdate();
getChartDataRequest({
formData,
force: false,
requestParams: { dashboardId: 0 },
}).then(response => {
if (isFeatureEnabled(FeatureFlag.GLOBAL_ASYNC_QUERIES)) {
// deal with getChartDataRequest transforming the response data
const result = 'result' in response ? response.result[0] : response;
waitForAsyncData(result)
.then((asyncResult: ChartDataResponseResult[]) => {
setNativeFilterFieldValues(form, filterId, {
defaultValueQueriesData: asyncResult,
});
forceUpdate();
})
.catch((error: ClientErrorObject) => {
// TODO: show error once this logic is moved into new NativeFilter
// component
console.error(
error.message || error.error || t('Check configuration'),
);
});
} else {
setNativeFilterFieldValues(form, filterId, {
defaultValueQueriesData: response.result,
});
forceUpdate();
}
});
};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic is mostly copied over 1-1 from ./state.ts

@junlincc junlincc added dashboard:native-filters Related to the native filters of the Dashboard test:case labels Apr 27, 2021
Copy link
Member

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codecov
Copy link

codecov bot commented Apr 27, 2021

Codecov Report

Merging #14375 (1e3b73e) into master (41ccebc) will decrease coverage by 0.02%.
The diff coverage is 43.85%.

❗ Current head 1e3b73e differs from pull request most recent head 3bde406. Consider uploading reports for the commit 3bde406 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14375      +/-   ##
==========================================
- Coverage   76.89%   76.86%   -0.03%     
==========================================
  Files         954      954              
  Lines       48197    48207      +10     
  Branches     6006     6008       +2     
==========================================
- Hits        37062    37056       -6     
- Misses      10939    10956      +17     
+ Partials      196      195       -1     
Flag Coverage Δ
javascript 71.64% <43.85%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...onfigModal/FiltersConfigForm/FiltersConfigForm.tsx 66.46% <37.25%> (-14.69%) ⬇️
...ters/FiltersConfigModal/FiltersConfigForm/state.ts 100.00% <100.00%> (+51.92%) ⬆️
...ters/FiltersConfigModal/FiltersConfigForm/utils.ts 92.85% <100.00%> (ø)
...tersConfigModal/FiltersConfigForm/DefaultValue.tsx 27.77% <0.00%> (-61.12%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 41ccebc...3bde406. Read the comment docs.

@villebro villebro merged commit 87a895c into apache:master Apr 27, 2021
@villebro villebro deleted the villebro/native-filter-refresh branch April 27, 2021 16:31
amitmiran137 pushed a commit that referenced this pull request Apr 28, 2021
)

* feat(native-filters): add refresh button to default value picker

* skip flaky test

(cherry picked from commit 87a895c)
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
…che#14375)

* feat(native-filters): add refresh button to default value picker

* skip flaky test
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.2.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels dashboard:native-filters Related to the native filters of the Dashboard preset-io release:note size/L test:case v1.2 🚢 1.2.0
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants