diff --git a/src/components/DashboardSelect/index.tsx b/src/components/DashboardSelect/index.tsx index 6e3472ba..da482d2c 100644 --- a/src/components/DashboardSelect/index.tsx +++ b/src/components/DashboardSelect/index.tsx @@ -6,7 +6,7 @@ import './index.less'; export const DashboardSelect = (props: SelectProps) => ( } - className="dashboard-select" + className={`dashboard-select ${props.className || ''}`} {...props} /> ); diff --git a/src/pages/MetricDetail/index.tsx b/src/pages/MetricDetail/index.tsx index be57592b..fb9aaad9 100644 --- a/src/pages/MetricDetail/index.tsx +++ b/src/pages/MetricDetail/index.tsx @@ -105,7 +105,6 @@ function MetricDetail(props: Props) { } else { metrics = SUPPORT_METRICS[metricType]; } - console.log('metrics', metrics) const metricItem = metrics.find(item => item.metric === metricName) || { metric: '', valueType: '', diff --git a/src/pages/ServiceManage/PartitionDistribution/index.tsx b/src/pages/ServiceManage/PartitionDistribution/index.tsx index ae030909..c82e5b70 100644 --- a/src/pages/ServiceManage/PartitionDistribution/index.tsx +++ b/src/pages/ServiceManage/PartitionDistribution/index.tsx @@ -51,7 +51,7 @@ class PartitionDistribution extends React.Component { async componentDidMount() { const { nebulaConnect } = this.props; - if (isCommunityVersion() || (nebulaConnect)) { + if (isCommunityVersion() || nebulaConnect) { await this.props.asyncGetSpaces(); const { currentSpace } = this.props; if (currentSpace) { diff --git a/src/pages/ServiceManage/ServiceInfo/index.tsx b/src/pages/ServiceManage/ServiceInfo/index.tsx index d2967c46..d9ad5da0 100644 --- a/src/pages/ServiceManage/ServiceInfo/index.tsx +++ b/src/pages/ServiceManage/ServiceInfo/index.tsx @@ -23,7 +23,7 @@ const mapDispatch: any = (dispatch: IDispatch) => ({ }); interface IProps extends ReturnType, - ReturnType {} + ReturnType { } class ServiceInfo extends React.Component { modalHandler; diff --git a/src/utils/index.ts b/src/utils/index.ts index c2152d02..0bd87f09 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,5 +1,6 @@ -import { DashboardType, NebulaVersionType } from './interface'; +import { DashboardType, NebulaConnectInfo, NebulaVersionType } from './interface'; import intl from 'react-intl-universal'; +import cookies from 'js-cookie'; /** * this folder for utils @@ -34,10 +35,16 @@ export let getNebulaVersionName = (_versionType: NebulaVersionType, version) => return `${intl.get('common.nebulaVersion.community')} ${version}`; } +export let hasNebulaConnected = (nebulaConnect?: NebulaConnectInfo, clusterID?: number): boolean => { + return !!nebulaConnect +} + export const updateFn = (service: { getNebulaVersionName: typeof getNebulaVersionName + hasNebulaConnected: typeof hasNebulaConnected }) => { getNebulaVersionName = service.getNebulaVersionName; + hasNebulaConnected = service.hasNebulaConnected; } export class SessionStorageUtil { @@ -55,4 +62,9 @@ export class SessionStorageUtil { static removeItem(key: string) { sessionStorage.removeItem(key); } +} + +export const clearNebulaConnection = () => { + SessionStorageUtil.removeItem('nebulaConnect'); + cookies.remove('nsid'); } \ No newline at end of file diff --git a/src/utils/interface.ts b/src/utils/interface.ts index 7097d19c..4e8b9e55 100644 --- a/src/utils/interface.ts +++ b/src/utils/interface.ts @@ -118,4 +118,5 @@ export interface VersionFeatureInfo { export interface NebulaConnectInfo { address: string; port: number; + clusterID: number; } \ No newline at end of file