Skip to content

Commit

Permalink
feat: enable data source info in new left navigation
Browse files Browse the repository at this point in the history
Signed-off-by: SuZhou-Joe <[email protected]>
  • Loading branch information
SuZhou-Joe committed Jul 5, 2024
1 parent d686d75 commit a7a70d1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
5 changes: 4 additions & 1 deletion public/apps/configuration/top-nav-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import React from 'react';
import { DataSourceSelectableConfig } from 'src/plugins/data_source_management/public';
import { DataSourceOption } from 'src/plugins/data_source_management/public/components/data_source_menu/types';
import { AppDependencies } from '../types';
import { setDataSourceInUrl, setDataSource as setDataSourceInSubscription } from '../../utils/datasource-utils';
import {
setDataSourceInUrl,
setDataSource as setDataSourceInSubscription,
} from '../../utils/datasource-utils';

export interface TopNavMenuProps extends AppDependencies {
dataSourcePickerReadOnly: boolean;
Expand Down
10 changes: 7 additions & 3 deletions public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ import { addTenantToShareURL } from './services/shared-link';
import { interceptError } from './utils/logout-utils';
import { tenantColumn, getNamespacesToRegister } from './apps/configuration/utils/tenant-utils';
import { getDashboardsInfoSafe } from './utils/dashboards-info-utils';
import { dataSource$, getDataSourceEnabledUrl, getDataSourceFromUrl, setDataSourceInUrl } from './utils/datasource-utils';
import {
dataSource$,
getDataSourceEnabledUrl,
getDataSourceFromUrl,
} from './utils/datasource-utils';

async function hasApiPermission(core: CoreSetup): Promise<boolean | undefined> {
try {
Expand Down Expand Up @@ -94,9 +98,9 @@ export class SecurityPlugin
private updateDefaultRouteOfSecurityApplications: AppUpdater = () => {
const url = getDataSourceEnabledUrl(getDataSourceFromUrl());
return {
defaultPath: `?${url.searchParams.toString()}`
defaultPath: `?${url.searchParams.toString()}`,
};
}
};

private appStateUpdater = new BehaviorSubject(this.updateDefaultRouteOfSecurityApplications);

Expand Down
4 changes: 3 additions & 1 deletion public/utils/datasource-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ export function setDataSourceInUrl(dataSource: DataSourceOption) {

export const LocalCluster = { label: 'Local cluster', id: '' };

export const dataSource$ = new BehaviorSubject<DataSourceOption>(getDataSourceFromUrl() || LocalCluster);
export const dataSource$ = new BehaviorSubject<DataSourceOption>(
getDataSourceFromUrl() || LocalCluster
);

export function setDataSource(dataSource: DataSourceOption) {
dataSource$.next(dataSource);
Expand Down

0 comments on commit a7a70d1

Please sign in to comment.