Skip to content

Commit

Permalink
feat: update for nebula connect token (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
xigongdaEricyang authored Sep 22, 2022
1 parent 1f8680d commit a893b75
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/DashboardSelect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import './index.less';
export const DashboardSelect = (props: SelectProps<any>) => (
<AntSelect
suffixIcon={<Icon className="select-icon" icon="#iconnav-foldTriangle" />}
className="dashboard-select"
className={`dashboard-select ${props.className || ''}`}
{...props}
/>
);
Expand Down
1 change: 0 additions & 1 deletion src/pages/MetricDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: '',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ServiceManage/PartitionDistribution/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class PartitionDistribution extends React.Component<IProps, IState> {

async componentDidMount() {
const { nebulaConnect } = this.props;
if (isCommunityVersion() || (nebulaConnect)) {
if (isCommunityVersion() || nebulaConnect) {
await this.props.asyncGetSpaces();
const { currentSpace } = this.props;
if (currentSpace) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ServiceManage/ServiceInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const mapDispatch: any = (dispatch: IDispatch) => ({
});
interface IProps
extends ReturnType<typeof mapState>,
ReturnType<typeof mapDispatch> {}
ReturnType<typeof mapDispatch> { }

class ServiceInfo extends React.Component<IProps> {
modalHandler;
Expand Down
14 changes: 13 additions & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -55,4 +62,9 @@ export class SessionStorageUtil {
static removeItem(key: string) {
sessionStorage.removeItem(key);
}
}

export const clearNebulaConnection = () => {
SessionStorageUtil.removeItem('nebulaConnect');
cookies.remove('nsid');
}
1 change: 1 addition & 0 deletions src/utils/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,5 @@ export interface VersionFeatureInfo {
export interface NebulaConnectInfo {
address: string;
port: number;
clusterID: number;
}

0 comments on commit a893b75

Please sign in to comment.