Skip to content

Commit 57b2b3d

Browse files
authored
Web console: fix Diff with current supervisor in data loader (#18810)
1 parent 7a1d83b commit 57b2b3d

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

web-console/src/druid-models/ingestion-spec/ingestion-spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ const CURRENT_YEAR = new Date().getUTCFullYear();
7777

7878
export interface IngestionSpec {
7979
readonly type: IngestionType;
80+
readonly id?: string;
8081
readonly spec: IngestionSpecInner;
8182
readonly context?: { useConcurrentLocks?: boolean };
8283
readonly suspended?: boolean;
8384

8485
// Added by the server
85-
readonly id?: string;
8686
readonly groupId?: string;
8787
readonly resource?: any;
8888
}

web-console/src/helpers/spec-conversion.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ export function getSpecDatasourceName(spec: Partial<IngestionSpec>): string | un
5151
return deepGet(spec, 'spec.dataSchema.dataSource');
5252
}
5353

54+
export function getSpecSupervisorId(spec: Partial<IngestionSpec>): string | undefined {
55+
return typeof spec.id === 'string' ? spec.id : getSpecDatasourceName(spec);
56+
}
57+
5458
function convertFilter(filter: any): SqlExpression {
5559
switch (filter.type) {
5660
case 'selector':

web-console/src/views/load-data-view/load-data-view.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ import {
143143
updateSchemaWithSample,
144144
upgradeSpec,
145145
} from '../../druid-models';
146-
import { getSpecDatasourceName } from '../../helpers';
146+
import { getSpecDatasourceName, getSpecSupervisorId } from '../../helpers';
147147
import { getLink } from '../../links';
148148
import { Api, AppToaster, UrlBaser } from '../../singletons';
149149
import {
@@ -3386,6 +3386,20 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
33863386
</>
33873387
),
33883388
},
3389+
{
3390+
name: 'id',
3391+
label: 'Supervisor ID',
3392+
type: 'string',
3393+
defined: isStreamingSpec,
3394+
placeholder: '(default to the datasource name if not set)',
3395+
info: (
3396+
<p>
3397+
The ID of the supervisor that will manage the ingestion. This should generally
3398+
be set to the datasource name (the default if left unset) unless you are setting
3399+
up multiple supervisors for the same datasource.
3400+
</p>
3401+
),
3402+
},
33893403
{
33903404
name: 'spec.ioConfig.appendToExisting',
33913405
label: 'Append to existing',
@@ -3568,7 +3582,7 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
35683582
}
35693583

35703584
let currentSupervisorSpec: Partial<IngestionSpec> | undefined;
3571-
const supervisorId = getSpecDatasourceName(spec);
3585+
const supervisorId = getSpecSupervisorId(spec);
35723586
if (isStreamingSpec(spec) && supervisorId) {
35733587
try {
35743588
currentSupervisorSpec = cleanSpec(

0 commit comments

Comments
 (0)