|
|
@@ -1,11 +1,7 @@
|
|
|
import React, {Component} from 'react';
|
|
|
-import {Layout, Card, notification, Button, Avatar} from 'antd';
|
|
|
+import {Layout, Card, Button, Avatar} from 'antd';
|
|
|
import lo from '../../../images/lo.png'
|
|
|
import './index.css'
|
|
|
-import {getCookie} from "../../../cookie";
|
|
|
-import {SHOW_CLOUD} from '../../../gql';
|
|
|
-import {request} from 'graphql-request'
|
|
|
-import {graphqlUrl} from "../../../config";
|
|
|
|
|
|
const {Content} = Layout;
|
|
|
const {Meta} = Card;
|
|
|
@@ -13,44 +9,7 @@ const {Meta} = Card;
|
|
|
class ExampleShow extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
- this.state = {
|
|
|
- userID: 'ioobot',
|
|
|
- secretId: '',
|
|
|
- secretKey: ''
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- componentWillMount() {
|
|
|
- let userID = getCookie('user_id');
|
|
|
- if (userID !== undefined && userID !== '') {
|
|
|
- this.setState({
|
|
|
- userID
|
|
|
- });
|
|
|
-
|
|
|
- // 查询是否设置 cloud
|
|
|
- request(graphqlUrl, SHOW_CLOUD, {user_id: userID}).then(data => {
|
|
|
- console.log(data.cloud_by_props);
|
|
|
- data.cloud_by_props.forEach(cloud => {
|
|
|
- switch (cloud.cloudName) {
|
|
|
- case 'tencent':
|
|
|
- this.setState({
|
|
|
- secretId: cloud.secretId,
|
|
|
- secretKey: cloud.secretKey
|
|
|
- });
|
|
|
- break;
|
|
|
- case 'aliyun':
|
|
|
- // 没写
|
|
|
- break;
|
|
|
- case 'amazon':
|
|
|
- // 没写
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- )
|
|
|
- }
|
|
|
+ this.state = {}
|
|
|
}
|
|
|
|
|
|
renderCard = () => {
|
|
|
@@ -97,26 +56,9 @@ class ExampleShow extends Component {
|
|
|
actions={[
|
|
|
<span>已部署: {item.deployedNum}</span>,
|
|
|
<Button type="primary" onClick={() => {
|
|
|
- if (userID) {
|
|
|
- if(this.state.secretId && this.state.secretKey) {
|
|
|
- // 调用接口
|
|
|
-
|
|
|
- } else {
|
|
|
- // 跳转
|
|
|
- this.props.history.push({
|
|
|
- pathname: `/common/deploy-cloud-choose`
|
|
|
- })
|
|
|
- }
|
|
|
- } else {
|
|
|
- notification['warning']({
|
|
|
- message: '需要登录',
|
|
|
- description: '后续使用,需要先登录',
|
|
|
- });
|
|
|
-
|
|
|
- this.props.history.push({
|
|
|
- pathname: `/login`
|
|
|
- })
|
|
|
- }
|
|
|
+ this.props.history.push({
|
|
|
+ pathname: `/common/deploy-cloud-choose`
|
|
|
+ });
|
|
|
}}>部署</Button>
|
|
|
]}
|
|
|
>
|