-
Notifications
You must be signed in to change notification settings - Fork 16.6k
refactor(explore): convert ControlPanelsContainer to typescript #13221
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
Changes from all commits
624f994
2f00a4f
d01a7b9
187bcaf
dd8f2cc
aa6be68
88eac59
25c509a
0b1d301
1901dde
fd18840
4a3b616
3520efa
634b84c
ab8dfce
e4e6172
891fadc
430874c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /** | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| describe('Annotations', () => { | ||
| beforeEach(() => { | ||
| cy.login(); | ||
| cy.intercept('GET', '/superset/explore_json/**').as('getJson'); | ||
| cy.intercept('POST', '/superset/explore_json/**').as('postJson'); | ||
| }); | ||
|
|
||
| it('Create formula annotation y-axis goal line', () => { | ||
| cy.visitChartByName('Num Births Trend'); | ||
| cy.verifySliceSuccess({ waitAlias: '@postJson' }); | ||
|
|
||
| const layerLabel = 'Goal line'; | ||
|
|
||
| cy.get('[data-test=annotation_layers] button').click(); | ||
|
|
||
| cy.get('[data-test="popover-content"]').within(() => { | ||
| cy.get('[data-test=annotation-layer-name-header]') | ||
| .siblings() | ||
| .first() | ||
| .within(() => { | ||
| cy.get('input').type(layerLabel); | ||
| }); | ||
| cy.get('[data-test=annotation-layer-value-header]') | ||
| .siblings() | ||
| .first() | ||
| .within(() => { | ||
| cy.get('input').type('y=1400000'); | ||
| }); | ||
| cy.get('button').contains('OK').click(); | ||
|
||
| }); | ||
|
|
||
| cy.get('button[data-test="run-query-button"]').click(); | ||
| cy.get('[data-test=annotation_layers]').contains(layerLabel); | ||
|
|
||
| cy.verifySliceSuccess({ | ||
| waitAlias: '@postJson', | ||
| chartSelector: 'svg', | ||
| }); | ||
| cy.get('.nv-legend-text').should('have.length', 2); | ||
| }); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,7 @@ describe('Visualization > Pivot Table', () => { | |
| adhoc_filters: [], | ||
| groupby: ['name'], | ||
| columns: ['state'], | ||
| row_limit: 50000, | ||
| row_limit: 5000, | ||
|
||
| pandas_aggfunc: 'sum', | ||
| pivot_margins: true, | ||
| number_format: '.3s', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,7 +99,7 @@ export const SET_FIELD_VALUE = 'SET_FIELD_VALUE'; | |
| export function setControlValue( | ||
| controlName: string, | ||
| value: any, | ||
| validationErrors: any[], | ||
| validationErrors?: any[], | ||
| ) { | ||
| return { type: SET_FIELD_VALUE, controlName, value, validationErrors }; | ||
| } | ||
|
|
@@ -109,11 +109,6 @@ export function setExploreControls(formData: QueryFormData) { | |
| return { type: SET_EXPLORE_CONTROLS, formData }; | ||
| } | ||
|
|
||
| export const REMOVE_CONTROL_PANEL_ALERT = 'REMOVE_CONTROL_PANEL_ALERT'; | ||
| export function removeControlPanelAlert() { | ||
| return { type: REMOVE_CONTROL_PANEL_ALERT }; | ||
| } | ||
|
||
|
|
||
| export const UPDATE_CHART_TITLE = 'UPDATE_CHART_TITLE'; | ||
| export function updateChartTitle(sliceName: string) { | ||
| return { type: UPDATE_CHART_TITLE, sliceName }; | ||
|
|
@@ -154,7 +149,6 @@ export const exploreActions = { | |
| saveFaveStar, | ||
| setControlValue, | ||
| setExploreControls, | ||
| removeControlPanelAlert, | ||
| updateChartTitle, | ||
| createNewSlice, | ||
| sliceUpdated, | ||
|
|
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disabling as we have seen fairly often nested-ternary in TypeScript
extends. It should not be that hard to understand the code withprettier's help.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nested ternary was used in this code:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm a fan of nested ternaries when used sparingly. however, couldn't this be simplified to:
or something like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if that's really cleaner, but it doesn't use a nested ternary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'name' in itemis needed for type inference so to avoid forced type conversion asitemcan be of many types, otherwise this could also be as simple asitem?.name || item || null.Here's the error with your approach: