Skip to content

Commit

Permalink
fix for missing id in old nav
Browse files Browse the repository at this point in the history
Signed-off-by: sumukhswamy <[email protected]>
  • Loading branch information
sumukhswamy committed Aug 30, 2024
1 parent c839459 commit 41162df
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
24 changes: 13 additions & 11 deletions public/components/Main/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ interface MainState {
dataSourceOptions: DataSourceOption[];
mdsClusterName: string;
flintDataConnections: boolean;
newNavEnabled: boolean | undefined;
}

const SUCCESS_MESSAGE = 'Success';
Expand Down Expand Up @@ -295,6 +296,7 @@ export class Main extends React.Component<MainProps, MainState> {
selectedMDSDataConnectionId: this.props.dataSourceMDSId,
mdsClusterName: '',
flintDataConnections: false,
newNavEnabled: coreRefs?.chrome?.navGroup.getNavGroupEnabled()

Check failure on line 299 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Insert `,`
};
this.httpClient = this.props.httpClient;
this.updateSQLQueries = _.debounce(this.updateSQLQueries, 250).bind(this);
Expand All @@ -318,7 +320,7 @@ export class Main extends React.Component<MainProps, MainState> {
fetchFlintDataSources = () => {
fetchDataSources(
this.httpClient,
this.props.dataSourceMDSId,
this.state.newNavEnabled ? this.props.dataSourceMDSId : this.state.selectedMDSDataConnectionId ,

Check failure on line 323 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Replace `·?·this.props.dataSourceMDSId·:·this.state.selectedMDSDataConnectionId·` with `⏎········?·this.props.dataSourceMDSId⏎········:·this.state.selectedMDSDataConnectionId`
this.props.urlDataSource,
(dataOptions) => {
if (dataOptions.length > 0) {
Expand Down Expand Up @@ -440,7 +442,7 @@ export class Main extends React.Component<MainProps, MainState> {
const endpoint = '/api/sql_console/' + (_.isEqual(language, 'SQL') ? 'sqlquery' : 'pplquery');
let query = {};
if (this.props.dataSourceEnabled) {
query = { dataSourceMDSId: this.props.dataSourceMDSId };
query = { dataSourceMDSId: this.state.newNavEnabled? this.props.dataSourceMDSId: this.state.selectedMDSDataConnectionId };

Check failure on line 445 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Replace `·dataSourceMDSId:·this.state.newNavEnabled?·this.props.dataSourceMDSId:·this.state.selectedMDSDataConnectionId` with `⏎··········dataSourceMDSId:·this.state.newNavEnabled⏎············?·this.props.dataSourceMDSId⏎············:·this.state.selectedMDSDataConnectionId,⏎·······`
}
const responsePromise = Promise.all(
queries.map((eachQuery: string) =>
Expand Down Expand Up @@ -575,7 +577,7 @@ export class Main extends React.Component<MainProps, MainState> {
});
}
},
this.props.dataSourceMDSId,
this.state.newNavEnabled? this.props.dataSourceMDSId: this.state.selectedMDSDataConnectionId,

Check failure on line 580 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Replace `?·this.props.dataSourceMDSId` with `⏎············?·this.props.dataSourceMDSId⏎············`
(errorDetails: string) => {
this.setState({
asyncLoading: false,
Expand Down Expand Up @@ -604,7 +606,7 @@ export class Main extends React.Component<MainProps, MainState> {
if (queries.length > 0) {
let query = {};
if (this.props.dataSourceEnabled) {
query = { dataSourceMDSId: this.props.dataSourceMDSId };
query = { dataSourceMDSId: this.state.newNavEnabled? this.props.dataSourceMDSId: this.state.selectedMDSDataConnectionId };

Check failure on line 609 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Replace `·dataSourceMDSId:·this.state.newNavEnabled?·this.props.dataSourceMDSId:·this.state.selectedMDSDataConnectionId` with `⏎··········dataSourceMDSId:·this.state.newNavEnabled⏎············?·this.props.dataSourceMDSId⏎············:·this.state.selectedMDSDataConnectionId,⏎·······`
}
const endpoint =
'/api/sql_console/' + (_.isEqual(language, 'SQL') ? 'translatesql' : 'translateppl');
Expand Down Expand Up @@ -656,7 +658,7 @@ export class Main extends React.Component<MainProps, MainState> {
if (queries.length > 0) {
let query = {};
if (this.props.dataSourceEnabled) {
query = { dataSourceMDSId: this.props.dataSourceMDSId };
query = { dataSourceMDSId: this.state.newNavEnabled? this.props.dataSourceMDSId: this.state.selectedMDSDataConnectionId};

Check failure on line 661 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Replace `·dataSourceMDSId:·this.state.newNavEnabled?·this.props.dataSourceMDSId:·this.state.selectedMDSDataConnectionId` with `⏎··········dataSourceMDSId:·this.state.newNavEnabled⏎············?·this.props.dataSourceMDSId⏎············:·this.state.selectedMDSDataConnectionId,⏎········`
}
Promise.all(
queries.map((eachQuery: string) =>
Expand Down Expand Up @@ -693,7 +695,7 @@ export class Main extends React.Component<MainProps, MainState> {
if (queries.length > 0) {
let query = {};
if (this.props.dataSourceEnabled) {
query = { dataSourceMDSId: this.props.dataSourceMDSId };
query = { dataSourceMDSId: this.state.newNavEnabled? this.props.dataSourceMDSId: this.state.selectedMDSDataConnectionId};

Check failure on line 698 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Replace `·dataSourceMDSId:·this.state.newNavEnabled?·this.props.dataSourceMDSId:·this.state.selectedMDSDataConnectionId` with `⏎··········dataSourceMDSId:·this.state.newNavEnabled⏎············?·this.props.dataSourceMDSId⏎············:·this.state.selectedMDSDataConnectionId,⏎········`
}
const endpoint = '/api/sql_console/' + (_.isEqual(language, 'SQL') ? 'sqlquery' : 'pplquery');
Promise.all(
Expand Down Expand Up @@ -731,7 +733,7 @@ export class Main extends React.Component<MainProps, MainState> {
if (queries.length > 0) {
let query = {};
if (this.props.dataSourceEnabled) {
query = { dataSourceMDSId: this.props.dataSourceMDSId };
query = { dataSourceMDSId: this.state.newNavEnabled? this.props.dataSourceMDSId: this.state.selectedMDSDataConnectionId };

Check failure on line 736 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Replace `·dataSourceMDSId:·this.state.newNavEnabled?·this.props.dataSourceMDSId:·this.state.selectedMDSDataConnectionId` with `⏎··········dataSourceMDSId:·this.state.newNavEnabled⏎············?·this.props.dataSourceMDSId⏎············:·this.state.selectedMDSDataConnectionId,⏎·······`
}
const endpoint = '/api/sql_console/' + (_.isEqual(language, 'SQL') ? 'sqlcsv' : 'pplcsv');
Promise.all(
Expand Down Expand Up @@ -769,7 +771,7 @@ export class Main extends React.Component<MainProps, MainState> {
if (queries.length > 0) {
let query = {};
if (this.props.dataSourceEnabled) {
query = { dataSourceMDSId: this.props.dataSourceMDSId };
query = { dataSourceMDSId: this.state.newNavEnabled? this.props.dataSourceMDSId: this.state.selectedMDSDataConnectionId };

Check failure on line 774 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Replace `·dataSourceMDSId:·this.state.newNavEnabled?·this.props.dataSourceMDSId:·this.state.selectedMDSDataConnectionId` with `⏎··········dataSourceMDSId:·this.state.newNavEnabled⏎············?·this.props.dataSourceMDSId⏎············:·this.state.selectedMDSDataConnectionId,⏎·······`
}
const endpoint = '/api/sql_console/' + (_.isEqual(language, 'SQL') ? 'sqltext' : 'ppltext');
Promise.all(
Expand Down Expand Up @@ -952,7 +954,7 @@ export class Main extends React.Component<MainProps, MainState> {
openAccelerationFlyout={
this.props.isAccelerationFlyoutOpen && !this.state.isAccelerationFlyoutOpened
}
dataSourceMDSId={this.props.dataSourceMDSId}
dataSourceMDSId={this.state.newNavEnabled? this.props.dataSourceMDSId: this.state.selectedMDSDataConnectionId}

Check failure on line 957 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Replace `this.state.newNavEnabled?·this.props.dataSourceMDSId:·this.state.selectedMDSDataConnectionId` with `⏎············this.state.newNavEnabled⏎··············?·this.props.dataSourceMDSId⏎··············:·this.state.selectedMDSDataConnectionId⏎··········`
setIsAccelerationFlyoutOpened={this.setIsAccelerationFlyoutOpened}
/>
);
Expand Down Expand Up @@ -1091,7 +1093,7 @@ export class Main extends React.Component<MainProps, MainState> {
onSelect={this.handleDataSelect}
urlDataSource={this.props.urlDataSource}
asyncLoading={this.state.asyncLoading}
dataSourceMDSId={this.props.dataSourceMDSId}
dataSourceMDSId={coreRefs?.chrome?.navGroup.getNavGroupEnabled()? this.props.dataSourceMDSId : this.state.selectedMDSDataConnectionId}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
Expand All @@ -1110,7 +1112,7 @@ export class Main extends React.Component<MainProps, MainState> {
updateSQLQueries={this.updateSQLQueries}
refreshTree={this.state.refreshTree}
dataSourceEnabled={this.props.dataSourceEnabled}
dataSourceMDSId={this.props.dataSourceMDSId}
dataSourceMDSId={coreRefs?.chrome?.navGroup.getNavGroupEnabled()? this.props.dataSourceMDSId : this.state.selectedMDSDataConnectionId}
clusterTab={this.state.cluster}
language={this.state.language}
updatePPLQueries={this.updatePPLQueries}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const AccelerationDataSourceSelector = ({
setAccelerationFormData,
selectedDatasource,
}: AccelerationDataSourceSelectorProps) => {
console.log(selectedDatasource)
const { setToast } = useToast();
const [dataConnections, setDataConnections] = useState<Array<EuiComboBoxOptionOption<string>>>(
[]
Expand Down

0 comments on commit 41162df

Please sign in to comment.