mirror of https://github.com/apache/druid.git
append to exisitng callout (#13130)
This commit is contained in:
parent
eb760c3d1d
commit
f1d3728371
|
@ -16,12 +16,13 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Callout, Code, FormGroup } from '@blueprintjs/core';
|
import { Button, Callout, Code, FormGroup, Intent } from '@blueprintjs/core';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { ExternalLink, LearnMore } from '../../components';
|
import { ExternalLink, LearnMore } from '../../components';
|
||||||
import { DimensionMode, getIngestionDocLink, IngestionSpec } from '../../druid-models';
|
import { DimensionMode, getIngestionDocLink, IngestionSpec } from '../../druid-models';
|
||||||
import { getLink } from '../../links';
|
import { getLink } from '../../links';
|
||||||
|
import { deepGet, deepSet } from '../../utils';
|
||||||
|
|
||||||
export interface ConnectMessageProps {
|
export interface ConnectMessageProps {
|
||||||
inlineMode: boolean;
|
inlineMode: boolean;
|
||||||
|
@ -216,3 +217,48 @@ export const SpecMessage = React.memo(function SpecMessage() {
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export interface AppendToExistingIssueProps {
|
||||||
|
spec: Partial<IngestionSpec>;
|
||||||
|
onChangeSpec(newSpec: Partial<IngestionSpec>): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const AppendToExistingIssue = React.memo(function AppendToExistingIssue(
|
||||||
|
props: AppendToExistingIssueProps,
|
||||||
|
) {
|
||||||
|
const { spec, onChangeSpec } = props;
|
||||||
|
|
||||||
|
const partitionsSpecType = deepGet(spec, 'spec.tuningConfig.partitionsSpec.type');
|
||||||
|
if (
|
||||||
|
partitionsSpecType === 'dynamic' ||
|
||||||
|
deepGet(spec, 'spec.ioConfig.appendToExisting') !== true
|
||||||
|
) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dynamicPartitionSpec = {
|
||||||
|
type: 'dynamic',
|
||||||
|
maxRowsPerSegment:
|
||||||
|
deepGet(spec, 'spec.tuningConfig.partitionsSpec.maxRowsPerSegment') ||
|
||||||
|
deepGet(spec, 'spec.tuningConfig.partitionsSpec.targetRowsPerSegment'),
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<FormGroup>
|
||||||
|
<Callout intent={Intent.DANGER}>
|
||||||
|
<p>
|
||||||
|
Only <Code>dynamic</Code> partitioning supports <Code>appendToExisting: true</Code>. You
|
||||||
|
have currently selected <Code>{partitionsSpecType}</Code> partitioning.
|
||||||
|
</p>
|
||||||
|
<Button
|
||||||
|
intent={Intent.SUCCESS}
|
||||||
|
onClick={() =>
|
||||||
|
onChangeSpec(deepSet(spec, 'spec.tuningConfig.partitionsSpec', dynamicPartitionSpec))
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Change to <Code>dynamic</Code> partitioning
|
||||||
|
</Button>
|
||||||
|
</Callout>
|
||||||
|
</FormGroup>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
|
@ -168,6 +168,7 @@ import { ExamplePicker } from './example-picker/example-picker';
|
||||||
import { FilterTable, filterTableSelectedColumnName } from './filter-table/filter-table';
|
import { FilterTable, filterTableSelectedColumnName } from './filter-table/filter-table';
|
||||||
import { FormEditor } from './form-editor/form-editor';
|
import { FormEditor } from './form-editor/form-editor';
|
||||||
import {
|
import {
|
||||||
|
AppendToExistingIssue,
|
||||||
ConnectMessage,
|
ConnectMessage,
|
||||||
FilterMessage,
|
FilterMessage,
|
||||||
ParserMessage,
|
ParserMessage,
|
||||||
|
@ -3002,6 +3003,7 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
|
||||||
<div className="control">
|
<div className="control">
|
||||||
<PartitionMessage />
|
<PartitionMessage />
|
||||||
{nonsensicalSingleDimPartitioningMessage}
|
{nonsensicalSingleDimPartitioningMessage}
|
||||||
|
<AppendToExistingIssue spec={spec} onChangeSpec={this.updateSpec} />
|
||||||
</div>
|
</div>
|
||||||
{this.renderNextBar({
|
{this.renderNextBar({
|
||||||
disabled: invalidPartitionConfig(spec),
|
disabled: invalidPartitionConfig(spec),
|
||||||
|
@ -3095,8 +3097,8 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
|
||||||
label: 'Append to existing',
|
label: 'Append to existing',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
defined: spec =>
|
// appendToExisting can only be set on 'dynamic' portioning.
|
||||||
deepGet(spec, 'spec.tuningConfig.partitionsSpec.type') === 'dynamic',
|
// We chose to show it always and instead have a specific message, separate from this form, to notify the user of the issue.
|
||||||
info: (
|
info: (
|
||||||
<>
|
<>
|
||||||
Creates segments as additional shards of the latest version, effectively
|
Creates segments as additional shards of the latest version, effectively
|
||||||
|
@ -3165,6 +3167,7 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
|
||||||
</div>
|
</div>
|
||||||
<div className="control">
|
<div className="control">
|
||||||
<PublishMessage />
|
<PublishMessage />
|
||||||
|
<AppendToExistingIssue spec={spec} onChangeSpec={this.updateSpec} />
|
||||||
</div>
|
</div>
|
||||||
{this.renderNextBar({})}
|
{this.renderNextBar({})}
|
||||||
</>
|
</>
|
||||||
|
@ -3233,6 +3236,7 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
|
||||||
>{`There is an issue with the spec: ${issueWithSpec}`}</Callout>
|
>{`There is an issue with the spec: ${issueWithSpec}`}</Callout>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
)}
|
)}
|
||||||
|
<AppendToExistingIssue spec={spec} onChangeSpec={this.updateSpec} />
|
||||||
</div>
|
</div>
|
||||||
<div className="next-bar">
|
<div className="next-bar">
|
||||||
{!isEmptyIngestionSpec(spec) && (
|
{!isEmptyIngestionSpec(spec) && (
|
||||||
|
|
Loading…
Reference in New Issue