diff --git a/console-ui/src/components/NameSpaceList/NameSpaceList.js b/console-ui/src/components/NameSpaceList/NameSpaceList.js index 825337cfd..0b2355a49 100644 --- a/console-ui/src/components/NameSpaceList/NameSpaceList.js +++ b/console-ui/src/components/NameSpaceList/NameSpaceList.js @@ -16,10 +16,11 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { ConfigProvider, Dialog } from '@alifd/next'; +import { ConfigProvider, Dialog, Select } from '@alifd/next'; import { getParams, setParams, request } from '../../globalLib'; import './index.scss'; +import { NAME_SHOW } from '../../constants'; /** * 命名空间列表 @@ -42,6 +43,7 @@ class NameSpaceList extends React.Component { this.state = { nownamespace: window.nownamespace || this._namespace || '', namespaceList: window.namespaceList || [], + nameShow: localStorage.getItem(NAME_SHOW), // namespaceShowName: window.namespaceShowName || this._namespaceShowName || '', // _dingdingLink: "", // _forumLink: "" @@ -100,6 +102,11 @@ class NameSpaceList extends React.Component { this.props.setNowNameSpace && this.props.setNowNameSpace(nsName, ns, nsDesc); } + changeName(...value) { + let space = value[2]; + this.changeNameSpace(space.namespace, space.namespaceShowName, space.namespaceDesc); + } + calleeParent(needclean = false) { this.props.namespaceCallBack && this.props.namespaceCallBack(needclean); } @@ -166,7 +173,29 @@ class NameSpaceList extends React.Component { } rendernamespace(namespaceList) { - const { nownamespace } = this.state; // 获得当前namespace + const { nownamespace, nameShow } = this.state; // 获得当前namespace + if (nameShow && nameShow === 'select') { + let de = { + value: nownamespace, + }; + namespaceList.forEach(obj => { + obj.label = obj.namespaceShowName + ' ' + (obj.namespaceDesc ? obj.namespaceDesc : ''); + obj.value = obj.namespace; + if (obj.value !== undefined && obj.value === de.value) { + de = obj; + } + }); + return ( +