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

fix(variable-hydration): fixed variable overhydration issue #18346

Merged
merged 11 commits into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

1. [18319](https://github.com/influxdata/influxdb/pull/18319): Display bucket ID in bucket list and enable 1 click copying
1. [18361](https://github.com/influxdata/influxdb/pull/18361): Tokens list is now consistent with the other resource lists

1. [18346](https://github.com/influxdata/influxdb/pull/18346): Reduce the number of variables being hydrated when toggling variables

## v2.0.0-beta.11 [2020-05-26]

Expand Down
6 changes: 6 additions & 0 deletions flags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,9 @@
contact: Alirie Gray
lifetime: temporary

- name: New Hydrate Vars Functionality
description: Enables a minimalistic variable hydration
key: hydratevars
default: false
contact: Ariel Salem / Monitoring Team
lifetime: temporary
16 changes: 16 additions & 0 deletions kit/feature/list.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions ui/src/variables/actions/thunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {findDependentVariables} from 'src/variables/utils/exportVariables'
import {getOrg} from 'src/organizations/selectors'
import {getLabels, getStatus} from 'src/resources/selectors'
import {currentContext} from 'src/shared/selectors/currentContext'
import {isFlagEnabled} from 'src/shared/utils/featureFlag'

// Constants
import * as copy from 'src/shared/copy/notifications'
Expand Down Expand Up @@ -433,7 +434,10 @@ export const selectValue = (variableID: string, selected: string) => async (

await dispatch(selectValueInState(contextID, variableID, selected))
// only hydrate the changedVariable
dispatch(hydrateVariables(true))
// dispatch(hydrateChangedVariable(variableID))
if (isFlagEnabled('hydratevars')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is the most badass thing i've ever seen

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pushing the limits of feature flagging:

https://media.giphy.com/media/WsvLlmmjx9tnmeTPNc/giphy.gif

dispatch(hydrateChangedVariable(variableID))
} else {
dispatch(hydrateVariables(true))
}
dispatch(updateQueryVars({[variable.name]: selected}))
}
56 changes: 30 additions & 26 deletions ui/src/variables/mocks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ export const defaultVariable: Variable = {
id: '05b73f4bffe8e000',
orgID: '05b73f49a1d1b000',
name: 'static',
description: '',
description: 'defaultVariable',
selected: ['defbuck'],
arguments: {type: 'constant', values: ['beans', 'defbuck']},
createdAt: '2020-05-19T05:54:20.927477-07:00',
Expand All @@ -657,7 +657,7 @@ export const associatedVariable: Variable = {
id: '05b740974228e000',
orgID: '05b740945a91b000',
name: 'dependent',
description: '',
description: 'associatedVariable',
selected: [],
arguments: {
type: 'query',
Expand Down Expand Up @@ -699,32 +699,36 @@ export const timeRangeStartVariable: Variable = {
selected: [],
}

export const timeRangeStopVariable: Variable = {
orgID: '',
id: 'timeRangeStop',
name: 'timeRangeStop',
arguments: {
type: 'system',
values: ['now()'],
},
status: RemoteDataState.Done,
labels: [],
selected: [],
}

export const windowPeriodVariable: Variable = {
orgID: '',
id: 'windowPeriod',
name: 'windowPeriod',
arguments: {
type: 'system',
values: [10000],
},
status: RemoteDataState.Done,
labels: [],
selected: [],
}

export const defaultVariables: Variable[] = [
defaultVariable,
associatedVariable,
timeRangeStartVariable,
{
orgID: '',
id: 'timeRangeStop',
name: 'timeRangeStop',
arguments: {
type: 'system',
values: ['now()'],
},
status: RemoteDataState.Done,
labels: [],
selected: [],
},
{
orgID: '',
id: 'windowPeriod',
name: 'windowPeriod',
arguments: {
type: 'system',
values: [10000],
},
status: RemoteDataState.Done,
labels: [],
selected: [],
},
timeRangeStopVariable,
windowPeriodVariable,
]
Loading