forked from apache/druid
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Web console: reflect the changes to interval requirement in the data …
…loader flow (apache#10647) * no need for intervals * don't set redundant fields * fix tests * better filter control * work with not * wrap callout with form group * update snapshot * add split hint * highlight issues with spec * fixes * fix default value * move intervals back to partition step * work with all sorts of chars * fix enabled view
- Loading branch information
1 parent
d59cfbe
commit abffd8b
Showing
26 changed files
with
952 additions
and
747 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
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
19 changes: 19 additions & 0 deletions
19
...ponents/numeric-input-with-default/__snapshots__/numeric-input-with-default.spec.tsx.snap
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,19 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`NumericInputWithDefault matches snapshot 1`] = ` | ||
<Blueprint3.NumericInput | ||
allowNumericCharactersOnly={true} | ||
buttonPosition="right" | ||
clampValueOnBlur={false} | ||
defaultValue="" | ||
large={false} | ||
majorStepSize={10} | ||
minorStepSize={0.1} | ||
onBlur={[Function]} | ||
onValueChange={[Function]} | ||
selectAllOnFocus={false} | ||
selectAllOnIncrement={false} | ||
stepSize={1} | ||
value={5} | ||
/> | ||
`; |
30 changes: 30 additions & 0 deletions
30
web-console/src/components/numeric-input-with-default/numeric-input-with-default.spec.tsx
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,30 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import { shallow } from 'enzyme'; | ||
import React from 'react'; | ||
|
||
import { NumericInputWithDefault } from './numeric-input-with-default'; | ||
|
||
describe('NumericInputWithDefault', () => { | ||
it('matches snapshot', () => { | ||
const numericInputWithDefault = shallow(<NumericInputWithDefault value={5} defaultValue={3} />); | ||
|
||
expect(numericInputWithDefault).toMatchSnapshot(); | ||
}); | ||
}); |
51 changes: 51 additions & 0 deletions
51
web-console/src/components/numeric-input-with-default/numeric-input-with-default.tsx
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,51 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import { HTMLInputProps, INumericInputProps, NumericInput } from '@blueprintjs/core'; | ||
import React, { useState } from 'react'; | ||
|
||
export type NumericInputWithDefaultProps = HTMLInputProps & INumericInputProps; | ||
|
||
export const NumericInputWithDefault = React.memo(function NumericInputWithDefault( | ||
props: NumericInputWithDefaultProps, | ||
) { | ||
const { value, defaultValue, onValueChange, onBlur, ...rest } = props; | ||
const [hasChanged, setHasChanged] = useState(false); | ||
|
||
let effectiveValue = value; | ||
if (effectiveValue == null) { | ||
effectiveValue = hasChanged ? '' : typeof defaultValue !== 'undefined' ? defaultValue : ''; | ||
} | ||
|
||
return ( | ||
<NumericInput | ||
value={effectiveValue} | ||
onValueChange={(valueAsNumber, valueAsString, inputElement) => { | ||
setHasChanged(true); | ||
if (!onValueChange) return; | ||
return onValueChange(valueAsNumber, valueAsString, inputElement); | ||
}} | ||
onBlur={e => { | ||
setHasChanged(false); | ||
if (!onBlur) return; | ||
return onBlur(e); | ||
}} | ||
{...rest} | ||
/> | ||
); | ||
}); |
Oops, something went wrong.