@@ -360,22 +461,46 @@ class TableList extends React.Component {
Metadata
-
-
-
-
-
- 2d
-
- aryabhataapp:cool
- version:v0
-
-
-
-
+ {Object.keys(metadata).map((currentKey8) => {
+ if (currentKey8 === 'annotations') {
+ return (
+
+
+
+
+
+ {Object.keys(metadata[currentKey8]).map((currentKey9) => {
+ return (
+
+
+
+
+
+ {metadata[currentKey8][currentKey9]}
+
+
+ );
+ })}
+
+
+ );
+ }
+ return (
+
+
+ {currentKey8}
+
+
+ {metadata[currentKey8]}
+
+
+ );
+ })}
+ {/*
Annotations
@@ -421,7 +546,7 @@ class TableList extends React.Component {
cool-aryabhata-v0fnxq6
-
+ */}
diff --git a/dashboard/src/pages/Traits/Scale/index.jsx b/dashboard/src/pages/Traits/Scale/index.jsx
deleted file mode 100644
index a4f91240f..000000000
--- a/dashboard/src/pages/Traits/Scale/index.jsx
+++ /dev/null
@@ -1,57 +0,0 @@
-import React, { Fragment } from 'react';
-import { Spin } from 'antd';
-import { connect } from 'dva';
-import Trait from '../../../components/Trait';
-
-@connect(({ loading }) => ({
- loadingAll: loading.models.trait,
-}))
-class TableList extends React.PureComponent {
- constructor(props) {
- super(props);
- this.state = {
- propsObj: {},
- };
- }
-
- componentDidMount() {
- this.getInitialData();
- }
-
- getInitialData = async () => {
- const res = await this.props.dispatch({
- type: 'trait/getTraitByName',
- payload: {
- traitName: 'scale',
- },
- });
- if (res) {
- let propsObj = {};
- propsObj = {
- title: res.name,
- settings: res.parameters,
- crdInfo: res.crdInfo,
- appliesTo: res.appliesTo,
- btnValue: 'Attach to',
- btnIsShow: true,
- history: this.props.history,
- };
- this.setState({
- propsObj,
- });
- }
- };
-
- render() {
- let { loadingAll } = this.props;
- loadingAll = loadingAll || false;
- const { propsObj } = this.state;
- return (
-
- {propsObj.title ? : }
-
- );
- }
-}
-
-export default TableList;
diff --git a/dashboard/src/pages/Traits/Rollout/index.jsx b/dashboard/src/pages/Traits/index.jsx
similarity index 56%
rename from dashboard/src/pages/Traits/Rollout/index.jsx
rename to dashboard/src/pages/Traits/index.jsx
index e644843c0..7b8143116 100644
--- a/dashboard/src/pages/Traits/Rollout/index.jsx
+++ b/dashboard/src/pages/Traits/index.jsx
@@ -1,7 +1,8 @@
import React, { Fragment } from 'react';
import { Spin } from 'antd';
import { connect } from 'dva';
-import Trait from '../../../components/Trait';
+import _ from 'lodash';
+import Trait from '../../components/Trait';
@connect(({ loading }) => ({
loadingAll: loading.models.trait,
@@ -10,19 +11,38 @@ class TableList extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
+ traitType: '',
propsObj: {},
};
}
componentDidMount() {
- this.getInitialData();
+ const traitType = _.get(this.props, 'match.params.traitType', '');
+ if (traitType) {
+ this.getInitialData(traitType);
+ }
}
- getInitialData = async () => {
+ // 组件更新时被调用
+ UNSAFE_componentWillReceiveProps(nextProps) {
+ const traitType = _.get(nextProps, 'match.params.traitType', '');
+ const prevTraitType = this.state.traitType;
+ // 这里不能直接调用会造成页面死循环,要判断前一个值是否相同
+ if (traitType && traitType !== prevTraitType) {
+ this.getInitialData(traitType);
+ this.setState({
+ traitType,
+ });
+ }
+ }
+
+ getInitialData = async (traitType) => {
+ // eslint-disable-next-line no-param-reassign
+ traitType = traitType.toLowerCase();
const res = await this.props.dispatch({
type: 'trait/getTraitByName',
payload: {
- traitName: 'rollout',
+ traitName: traitType,
},
});
if (res) {
diff --git a/dashboard/src/pages/Workload/Deployment/index.jsx b/dashboard/src/pages/Workload/Deployment/index.jsx
deleted file mode 100644
index 7809c3523..000000000
--- a/dashboard/src/pages/Workload/Deployment/index.jsx
+++ /dev/null
@@ -1,60 +0,0 @@
-import React, { Fragment } from 'react';
-import { connect } from 'dva';
-import { Spin } from 'antd';
-import Workload from '../../../components/Workload';
-
-@connect(({ loading }) => ({
- loadingAll: loading.models.workload,
-}))
-class TableList extends React.PureComponent {
- constructor(props) {
- super(props);
- this.state = {
- propsObj: {},
- };
- }
-
- componentDidMount() {
- this.getInitialData();
- }
-
- getInitialData = async () => {
- const res = await this.props.dispatch({
- type: 'workload/getWorkloadByName',
- payload: {
- workloadName: 'deployment',
- },
- });
- if (res) {
- let propsObj = {};
- propsObj = {
- title: res.name,
- settings: res.parameters,
- pathname: '/ApplicationList/CreateApplication',
- state: {
- WorkloadType: res.name,
- },
- crdInfo: res.crdInfo,
- btnValue: 'Create',
- hrefAddress: '#',
- btnIsShow: true,
- };
- this.setState({
- propsObj,
- });
- }
- };
-
- render() {
- let { loadingAll } = this.props;
- loadingAll = loadingAll || false;
- const { propsObj } = this.state;
- return (
-
- {propsObj.title ? : }
-
- );
- }
-}
-
-export default TableList;
diff --git a/dashboard/src/pages/Workload/Detail/index.jsx b/dashboard/src/pages/Workload/Detail/index.jsx
index c26f1be36..f63001af0 100644
--- a/dashboard/src/pages/Workload/Detail/index.jsx
+++ b/dashboard/src/pages/Workload/Detail/index.jsx
@@ -1,7 +1,9 @@
-import React from 'react';
+import React, { Fragment } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
import './index.less';
-import { Form, Input, Button, Row, Col, Tabs, Table, Tag, Tooltip } from 'antd';
+import { Form, Input, Button, Row, Col, Tabs, Table, Spin } from 'antd';
+import { connect } from 'dva';
+import _ from 'lodash';
const { TabPane } = Tabs;
const layout = {
@@ -118,14 +120,18 @@ const data1 = [
LastTransition: '2d',
},
];
-const demoText = `H4sIAAAAAAAA/6xUwW7bOhD8lYc9U4lsWfazgB4C5Na0DZK0lyKHNbmyWVMkQ66UGob/vSBdt3GCxEXRmwjujmZnZrmFtbYKGrgkb9ymI8sgAL3+QiFqZ6EB9D6eDyMQ0BGjQkZotmCxI2hAOmcKDBtcrJCxGMrWfn+Ygsj30aNMRYpa7E0CloGQtbN3uqPI2HlobG+MAIMLMjEBo/cvcEGAW3wjyZH4LGh3JpHZ0Jl25yuMK2hgPkPV1lRJbKfjWVlNpqps69mkrNu2qv5X5UzV9ULVIOC4P1IYtHxzlOGXFEMJOwForeM8Rib8GjOdZD3Avz6Ae7QUiuWwhuYZtWEk/nuvrXp3+4cgpzw53f3SsePKjrLaHHpKSuTGG2opkJUUofm6Pc7O84FAHPL2e6ZTrPssZDWq5+O6GhVqPquLybyaF9gqKsbVTMpyXFZ1m8yVznJwxlCAJrEUsDBOrj8lopdkiDOvFk2k3f1OQPQkk4mRDEl2IX13yHJ1dSqQx6nYCWDqvEGmDPFkU/4+8/86qUbbNQWVw2lTFKABsrgwpN52+olQSWDUlsLe7VPm6Q6XlPdABspPS1imTihWcC8gUHR9yNHZQqCHniLnb+l7aKAuu/zsdC5soIHp5IPOZDLqdW/MtTNapqsL84ibCLt7cVi5Cyldb/njCYLYs+tS4e1R251bkz1EaK/Rz4IrbdfxEKEkDAdkWm4Sa9749LMbZ4y2y89epTgICEfnZrvb9yH3MZ9+BAAA//+bxjCThQUAAA
- objectset.rio.cattle.io/id service
- objectset.rio.cattle.io/owner-gvk rio.cattle.io/v1, Kind=Service
- objectset.rio.cattle.io/owner-name cool-aryabhata-v0fnxq6
- objectset.rio.cattle.io/owner-namespace default
- rio.cattle.io/mesh true
- Controlled By cool-aryabhata-v0fnxq6`;
+// const demoText = `H4sIAAAAAAAA/6xUwW7bOhD8lYc9U4lsWfazgB4C5Na0DZK0lyKHNbmyWVMkQ66UGob/vSBdt3GCxEXRmwjujmZnZrmFtbYKGrgkb9ymI8sgAL3+QiFqZ6EB9D6eDyMQ0BGjQkZotmCxI2hAOmcKDBtcrJCxGMrWfn+Ygsj30aNMRYpa7E0CloGQtbN3uqPI2HlobG+MAIMLMjEBo/cvcEGAW3wjyZH4LGh3JpHZ0Jl25yuMK2hgPkPV1lRJbKfjWVlNpqps69mkrNu2qv5X5UzV9ULVIOC4P1IYtHxzlOGXFEMJOwForeM8Rib8GjOdZD3Avz6Ae7QUiuWwhuYZtWEk/nuvrXp3+4cgpzw53f3SsePKjrLaHHpKSuTGG2opkJUUofm6Pc7O84FAHPL2e6ZTrPssZDWq5+O6GhVqPquLybyaF9gqKsbVTMpyXFZ1m8yVznJwxlCAJrEUsDBOrj8lopdkiDOvFk2k3f1OQPQkk4mRDEl2IX13yHJ1dSqQx6nYCWDqvEGmDPFkU/4+8/86qUbbNQWVw2lTFKABsrgwpN52+olQSWDUlsLe7VPm6Q6XlPdABspPS1imTihWcC8gUHR9yNHZQqCHniLnb+l7aKAuu/zsdC5soIHp5IPOZDLqdW/MtTNapqsL84ibCLt7cVi5Cyldb/njCYLYs+tS4e1R251bkz1EaK/Rz4IrbdfxEKEkDAdkWm4Sa9749LMbZ4y2y89epTgICEfnZrvb9yH3MZ9+BAAA//+bxjCThQUAAA
+// objectset.rio.cattle.io/id service
+// objectset.rio.cattle.io/owner-gvk rio.cattle.io/v1, Kind=Service
+// objectset.rio.cattle.io/owner-name cool-aryabhata-v0fnxq6
+// objectset.rio.cattle.io/owner-namespace default
+// rio.cattle.io/mesh true
+// Controlled By cool-aryabhata-v0fnxq6`;
+@connect(({ loading, globalData }) => ({
+ loadingAll: loading.models.applist,
+ currentEnv: globalData.currentEnv,
+}))
class TableList extends React.PureComponent {
formRefStep1 = React.createRef();
@@ -136,12 +142,32 @@ class TableList extends React.PureComponent {
this.state = {
hasShowEdit: false,
hasShowEdit2: false,
+ appDetailData: {},
};
}
- // componentDidMount(){
- // console.log(this.props.location.state)
- // }
+ componentDidMount() {
+ this.getInitialData();
+ }
+
+ async getInitialData() {
+ const appName = _.get(this.props, 'location.state.appName', '');
+ const envName = _.get(this.props, 'location.state.envName', '');
+ if (appName && envName) {
+ const res = await this.props.dispatch({
+ type: 'applist/getAppDetail',
+ payload: {
+ envName,
+ appName,
+ },
+ });
+ if (res) {
+ this.setState({
+ appDetailData: res,
+ });
+ }
+ }
+ }
onFinishStep1 = () => {
this.setState({
@@ -169,270 +195,336 @@ class TableList extends React.PureComponent {
render() {
const { hasShowEdit, hasShowEdit2 } = this.state;
- let finallyText;
- if (demoText && demoText.length > 50) {
- finallyText = (
-
-
-
- );
- } else {
- finallyText =
{demoText}
;
- }
+ // let finallyText;
+ // if (demoText && demoText.length > 50) {
+ // finallyText = (
+ //
+ //
+ //
+ // );
+ // } else {
+ // finallyText =
{demoText}
;
+ // }
+ const status = _.get(this.state.appDetailData, 'Status', '');
+ const Workload = _.get(this.state.appDetailData, 'Workload.workload', {});
+ const metadata = _.get(Workload, 'metadata', {});
+ let containers = {};
+ // if (Workload.kind === 'ContainerizedWorkload') {
+ // containers = _.get(Workload, 'spec.containers[0]', {});
+ // } else if (Workload.kind === 'Deployment') {
+ // containers = _.get(Workload, 'spec.template.spec.containers[0]', {});
+ // }
+ containers = _.get(Workload, 'spec.containers[0]', {});
+ let { loadingAll } = this.props;
+ loadingAll = loadingAll || false;
return (
-
-
Deployment
-
- apps/v1,Name=app-foo-comp-v02wqwd
-
-
-
-
-
-
-
-
-
Configuration
-
-
-
-
Deployment Strategy
-
Rolling Update Strategy
-
Selectors
-
Min Ready Seconds
-
Revision History Limit
-
Replicas
-
-
-
- RollingUpdate
- Max Surge 25%, Max Unavailable 25%
-
- aryabhataapp:cool
- version:v0
-
- 0
- 10
- 1
-
-
-
-
-
-
-
-
-
-
-
-
Status
-
-
-
-
Avaliable Replicas
-
Ready Replicas
-
Total Replicas
-
Unavaliable Replicas
-
Updated Replicas
-
-
-
- 0
- 0
- 1
- 1
- 1
-
-
-
-
-
-
-
- Pods
-
-
-
Conditions
-
-
Pod Template
-
-
-
Container cool-aryabhata-v0fnxq6
-
-
-
-
-
- secret
- ['-h']
-
-
-
-
-
-
-
-
-
-
-
-
Metadata
+
+
+
{Workload.kind}
+
+
+ {Workload.apiVersion},Name={_.get(Workload, 'metadata.name', '')}
+
+
+
+
+
-
-
-
Age
-
Labels
+
+
+
+
Configuration
+
+ {Object.keys(containers).map((currentKey) => {
+ if (currentKey === 'ports') {
+ return (
+
+
+ port
+
+
+
+ {_.get(containers[currentKey], '[0].containerPort', '')}
+
+
+
+ );
+ // eslint-disable-next-line no-else-return
+ } else if (currentKey === 'name') {
+ return ;
+ }
+ return (
+
+
+ {currentKey}
+
+
+ {containers[currentKey]}
+
+
+ );
+ })}
+
+ {/*
+
+
+
Deployment Strategy
+
Rolling Update Strategy
+
Selectors
+
Min Ready Seconds
+
Revision History Limit
+
Replicas
+
+
+
+ RollingUpdate
+ Max Surge 25%, Max Unavailable 25%
+
+ aryabhataapp:cool
+ version:v0
+
+ 0
+ 10
+ 1
+
+
*/}
+
+
+
-
-
2d
-
- aryabhataapp:cool
- version:v0
-
+
+
+
+
+
Status
+
{status}
+ {/*
+
+
+
Avaliable Replicas
+
Ready Replicas
+
Total Replicas
+
Unavaliable Replicas
+
Updated Replicas
+
+
+
+ 0
+ 0
+ 1
+ 1
+ 1
+
+
*/}
+
+
-
-
-
-
-
+
+ Pods
+
+
+ Conditions
+
+ Pod Template
+
+
+
Container cool-aryabhata-v0fnxq6
-
+
-
deployment.kubernetes.io/revision
+
Image
+
Args
- 1
+ secret
+ ['-h']
-
-
-
-
objectset.rio.cattle.io/applied
-
-
- {finallyText}
-
-
-
-
-
objectset.rio.cattle.io/id
-
-
-
- service
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
cool-aryabhata-v0fnxq6
-
-
+
+
-
-
-
- Resource Viewer
-
-
- YAML
-
-
-
+
+
+
+
+
Metadata
+ {Object.keys(metadata).map((currentKey6) => {
+ return (
+
+
+ {currentKey6}
+
+
+ {metadata[currentKey6]}
+
+
+ );
+ })}
+ {/*
+
+
+
+
+ 2d
+
+ aryabhataapp:cool
+ version:v0
+
+
+
+
+
+
+
+
+
+
+
+
deployment.kubernetes.io/revision
+
+
+
+ 1
+
+
+
+
+
+
objectset.rio.cattle.io/applied
+
+
+ {finallyText}
+
+
+
+
+
objectset.rio.cattle.io/id
+
+
+
+ service
+
+
+
+
+
+
+
+
+
+ cool-aryabhata-v0fnxq6
+
+
*/}
+
+
+
+
+ Resource Viewer
+
+
+ YAML
+
+
+
+
);
}
diff --git a/dashboard/src/pages/Workload/Containerized/index.jsx b/dashboard/src/pages/Workload/index.jsx
similarity index 56%
rename from dashboard/src/pages/Workload/Containerized/index.jsx
rename to dashboard/src/pages/Workload/index.jsx
index 15afdcd5c..b74b8b4cd 100644
--- a/dashboard/src/pages/Workload/Containerized/index.jsx
+++ b/dashboard/src/pages/Workload/index.jsx
@@ -1,7 +1,8 @@
import React, { Fragment } from 'react';
import { connect } from 'dva';
import { Spin } from 'antd';
-import Workload from '../../../components/Workload';
+import _ from 'lodash';
+import Workload from '../../components/Workload';
@connect(({ loading }) => ({
loadingAll: loading.models.workload,
@@ -11,18 +12,37 @@ class TableList extends React.PureComponent {
super(props);
this.state = {
propsObj: {},
+ workloadType: '',
};
}
componentDidMount() {
- this.getInitialData();
+ const workloadType = _.get(this.props, 'match.params.WorkloadType', '');
+ if (workloadType) {
+ this.getInitialData(workloadType);
+ }
}
- getInitialData = async () => {
+ // 组件更新时被调用
+ UNSAFE_componentWillReceiveProps(nextProps) {
+ const workloadType = _.get(nextProps, 'match.params.WorkloadType', '');
+ const prevWorkloadType = this.state.workloadType;
+ // 这里不能直接调用会造成页面死循环,要判断前一个值是否相同
+ if (workloadType && workloadType !== prevWorkloadType) {
+ this.getInitialData(workloadType);
+ this.setState({
+ workloadType,
+ });
+ }
+ }
+
+ getInitialData = async (workloadType) => {
+ // eslint-disable-next-line no-param-reassign
+ workloadType = workloadType.toLowerCase();
const res = await this.props.dispatch({
type: 'workload/getWorkloadByName',
payload: {
- workloadName: 'containerized',
+ workloadName: workloadType,
},
});
if (res) {