From 5f62f7b8a22d8eeceeaffc951c9aa0fc44406df7 Mon Sep 17 00:00:00 2001 From: hanxie Date: Tue, 25 Aug 2020 17:27:39 +0800 Subject: [PATCH] remove workspacedropdown temp --- .../GlobalHeader/WorkSpaceDropDown.jsx | 84 ------------------- .../GlobalHeader/workSpaceDropDown.jsx | 84 ------------------- 2 files changed, 168 deletions(-) delete mode 100644 dashboard/src/components/GlobalHeader/WorkSpaceDropDown.jsx delete mode 100644 dashboard/src/components/GlobalHeader/workSpaceDropDown.jsx diff --git a/dashboard/src/components/GlobalHeader/WorkSpaceDropDown.jsx b/dashboard/src/components/GlobalHeader/WorkSpaceDropDown.jsx deleted file mode 100644 index 7f1e364ec..000000000 --- a/dashboard/src/components/GlobalHeader/WorkSpaceDropDown.jsx +++ /dev/null @@ -1,84 +0,0 @@ -import { Menu, Dropdown, Button, message } from 'antd'; -import { DownOutlined } from '@ant-design/icons'; -import React from 'react'; -import { connect } from 'dva'; - -@connect(() => ({})) -export default class WorkSpaceDropDown extends React.Component { - constructor(props) { - super(props); - this.state = { - workSpaceName: '', - envs: [], - }; - } - - async componentDidMount() { - const envs = await this.props.dispatch({ - type: 'envs/getEnvs', // applist对应models层的命名空间namespace - }); - if (envs) { - const { name = 'test' } = envs.find((a) => { - return a.current === '*'; - }); - this.setState({ - envs, - workSpaceName: name, - }); - this.props.dispatch({ - type: 'globalData/currentEnv', - payload: { - currentEnv: name, - }, - }); - } - } - - handleMenuClick = async (e) => { - // 发送切换envs的接口 - const switchResult = await this.props.dispatch({ - type: 'envs/switchEnv', - payload: { - currentEnv: e.key, - }, - }); - if (switchResult) { - message.success(switchResult); - } - this.setState( - { - workSpaceName: e.key, - }, - () => { - // 值切换存储 - this.props.dispatch({ - type: 'globalData/currentEnv', - payload: { - currentEnv: e.key, - }, - }); - }, - ); - }; - - render() { - const menu = ( - - {/* default - oam-system - linkerd - rio-system */} - {this.state.envs.map((item) => { - return {item.name}; - })} - - ); - return ( - - - - ); - } -} diff --git a/dashboard/src/components/GlobalHeader/workSpaceDropDown.jsx b/dashboard/src/components/GlobalHeader/workSpaceDropDown.jsx deleted file mode 100644 index 7f1e364ec..000000000 --- a/dashboard/src/components/GlobalHeader/workSpaceDropDown.jsx +++ /dev/null @@ -1,84 +0,0 @@ -import { Menu, Dropdown, Button, message } from 'antd'; -import { DownOutlined } from '@ant-design/icons'; -import React from 'react'; -import { connect } from 'dva'; - -@connect(() => ({})) -export default class WorkSpaceDropDown extends React.Component { - constructor(props) { - super(props); - this.state = { - workSpaceName: '', - envs: [], - }; - } - - async componentDidMount() { - const envs = await this.props.dispatch({ - type: 'envs/getEnvs', // applist对应models层的命名空间namespace - }); - if (envs) { - const { name = 'test' } = envs.find((a) => { - return a.current === '*'; - }); - this.setState({ - envs, - workSpaceName: name, - }); - this.props.dispatch({ - type: 'globalData/currentEnv', - payload: { - currentEnv: name, - }, - }); - } - } - - handleMenuClick = async (e) => { - // 发送切换envs的接口 - const switchResult = await this.props.dispatch({ - type: 'envs/switchEnv', - payload: { - currentEnv: e.key, - }, - }); - if (switchResult) { - message.success(switchResult); - } - this.setState( - { - workSpaceName: e.key, - }, - () => { - // 值切换存储 - this.props.dispatch({ - type: 'globalData/currentEnv', - payload: { - currentEnv: e.key, - }, - }); - }, - ); - }; - - render() { - const menu = ( - - {/* default - oam-system - linkerd - rio-system */} - {this.state.envs.map((item) => { - return {item.name}; - })} - - ); - return ( - - - - ); - } -}