소스 검색

refactor: 添加缓存失效按钮

fanyanpeng 2 년 전
부모
커밋
c1c9ae15d0
6개의 변경된 파일367개의 추가작업 그리고 222개의 파일을 삭제
  1. 2 2
      .umirc.ts
  2. 35 0
      nginx.conf
  3. 2 1
      package.json
  4. 302 211
      src/components/ConfigModal.js
  5. 5 5
      src/pages/app/[id]/_layout.tsx
  6. 21 3
      src/pages/app/[id]/environment/[environmentId].js

+ 2 - 2
.umirc.ts

@@ -3,8 +3,8 @@ import { defineConfig } from 'umi';
 export default defineConfig({
   proxy: {
     '/api': {
-      'target': 'http://paas.seec.seecoder.cn/',
-      'changeOrigin': true,
+      target: 'http://172.29.7.104:18080',
+      changeOrigin: true,
     },
   },
   nodeModulesTransform: {

+ 35 - 0
nginx.conf

@@ -0,0 +1,35 @@
+map $http_upgrade $connection_upgrade {
+  default upgrade;
+  '' close;
+}
+upstream websocket {
+    server http://172.29.7.104:8080;
+}
+server {
+        listen 443 ssl http2;
+        listen [::]:443 ssl http2 ;
+        root /srv/paas-ui/dist;
+        server_name paas-test-seec.claws.top;
+ ssl_certificate_key /root/cert/paas-test-seec.claws.top/cert.key;
+ ssl_certificate /root/cert/paas-test-seec.claws.top/fullchain.cer;
+
+  location ~ /ws {
+      proxy_pass http://websocket;
+      proxy_read_timeout 3h;
+      proxy_send_timeout 3h;
+
+      proxy_set_header Host $host;
+      proxy_set_header X-Real-IP $remote_addr;
+      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+
+      proxy_http_version 1.1;
+      proxy_set_header Upgrade $http_upgrade;
+      proxy_set_header Connection $connection_upgrade;
+  }
+  location ~ / {
+    if ($request_uri ~* (api)) {
+        proxy_pass http://172.29.7.104:8080;
+    }
+    try_files $uri $uri/ /index.html;
+  }
+}

+ 2 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "private": true,
   "scripts": {
-    "start": "umi dev",
+    "start": "set NODE_OPTIONS=--openssl-legacy-provider && umi dev",
     "build": "umi build",
     "postinstall": "umi generate tmp",
     "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
@@ -33,6 +33,7 @@
     "umi": "^3.2.24",
     "xterm": "^4.9.0",
     "xterm-addon-fit": "^0.4.0",
+    "yarn": "^1.22.19",
     "yorkie": "^2.0.0"
   }
 }

+ 302 - 211
src/components/ConfigModal.js

@@ -1,22 +1,49 @@
 import React, { PureComponent } from 'react';
-import { PageHeader, Button, Descriptions, Modal, Card, Icon, Row, Col, Form, Popconfirm, Input, Space, Divider } from 'antd';
+import {
+  PageHeader,
+  Button,
+  Descriptions,
+  Modal,
+  Card,
+  Icon,
+  Row,
+  Col,
+  Form,
+  Popconfirm,
+  Input,
+  Space,
+  Divider,
+} from 'antd';
 import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
-import styles from './ConfigModal.less'
+import styles from './ConfigModal.less';
 
 export default class ConfigModal extends PureComponent {
   formRef = React.createRef();
-  state = {
-  }
+  state = {};
 
   setFormValues(config) {
     if (config) {
       this.formRef.current.setFieldsValue({
         ...(config.config || {}),
-        envsArr: Object.keys(config.config.envs || {}).map(key => ({ key, value: config.config.envs[key] })),
-        mountsArr: Object.keys(config.config.mounts || {}).map(key => ({ key, value: config.config.mounts[key] })),
-        ingressAnnotaionsArr: Object.keys(config.config.ingressAnnotaions || {}).map(key => ({ key, value: config.config.ingressAnnotaions[key] })),
-        hostPathArr: Object.keys(config.config.hostPath || {}).map(key => ({ key, value: config.config.hostPath[key] })),
-        pvcPathsArr: Object.keys(config.config.pvcPaths || {}).map(key => ({ key, value: config.config.pvcPaths[key] })),
+        envsArr: Object.keys(config.config.envs || {}).map(key => ({
+          key,
+          value: config.config.envs[key],
+        })),
+        mountsArr: Object.keys(config.config.mounts || {}).map(key => ({
+          key,
+          value: config.config.mounts[key],
+        })),
+        ingressAnnotaionsArr: Object.keys(
+          config.config.ingressAnnotaions || {},
+        ).map(key => ({ key, value: config.config.ingressAnnotaions[key] })),
+        hostPathArr: Object.keys(config.config.hostPath || {}).map(key => ({
+          key,
+          value: config.config.hostPath[key],
+        })),
+        pvcPathsArr: Object.keys(config.config.pvcPaths || {}).map(key => ({
+          key,
+          value: config.config.pvcPaths[key],
+        })),
       });
     }
   }
@@ -26,8 +53,7 @@ export default class ConfigModal extends PureComponent {
   }
 
   componentWillReceiveProps(props) {
-    if (props.config != this.props.config)
-    this.setFormValues(props.config);
+    if (props.config != this.props.config) this.setFormValues(props.config);
   }
 
   onOk() {
@@ -36,7 +62,10 @@ export default class ConfigModal extends PureComponent {
         ...this.props.config,
         config: {
           ...values,
-          nodeIp: values.nodeIp != null && values.nodeIp.trim().length > 0 ? values.nodeIp.trim() : null,
+          nodeIp:
+            values.nodeIp != null && values.nodeIp.trim().length > 0
+              ? values.nodeIp.trim()
+              : null,
           envs: (values.envsArr || []).reduce((obj, item) => {
             obj[item.key] = item.value;
             return obj;
@@ -53,12 +82,15 @@ export default class ConfigModal extends PureComponent {
             obj[item.key] = item.value;
             return obj;
           }, {}),
-          ingressAnnotaions: (values.ingressAnnotaionsArr || []).reduce((obj, item) => {
-            obj[item.key] = item.value;
-            return obj;
-          }, {}),
-        }
-      })
+          ingressAnnotaions: (values.ingressAnnotaionsArr || []).reduce(
+            (obj, item) => {
+              obj[item.key] = item.value;
+              return obj;
+            },
+            {},
+          ),
+        },
+      });
     });
   }
 
@@ -68,7 +100,7 @@ export default class ConfigModal extends PureComponent {
         visible={this.props.visible}
         forceRender
         onCancel={() => this.props.onCancel()}
-        title={"更新配置"}
+        title={'更新配置'}
         okText="确认"
         cancelText="取消"
         onOk={this.onOk.bind(this)}
@@ -81,49 +113,37 @@ export default class ConfigModal extends PureComponent {
           wrapperCol={{ span: 20 }}
           labelAlign="right"
         >
-          <Form.Item 
+          <Form.Item
             name="hostPrefix"
             label="域名前缀"
             tooltip="有域名前缀时会根据端口对服务进行暴露,生成域名规则为{域名前缀}-{端口}.{主域名}"
           >
             <Input placeholder="域名前缀"></Input>
-          </Form.Item >
-          <Form.Item 
+          </Form.Item>
+          <Form.Item
             name="servicePort"
             label="服务端口"
             tooltip="服务端口,多个用英文逗号隔开"
           >
-            <Input placeholder='服务端口,多个用英文逗号隔开'></Input>
-          </Form.Item >
-          <Form.Item 
-            name="ingressPort"
-            label="暴露端口"
-            tooltip="暴露端口"
-          >
-            <Input placeholder='暴露端口'></Input>
-          </Form.Item >
-          <Form.Item 
+            <Input placeholder="服务端口,多个用英文逗号隔开"></Input>
+          </Form.Item>
+          <Form.Item name="ingressPort" label="暴露端口" tooltip="暴露端口">
+            <Input placeholder="暴露端口"></Input>
+          </Form.Item>
+          <Form.Item
             name="replicas"
             label="实例数"
             tooltip="服务部署的实例数目,即pod数量,默认为1"
           >
             <Input placeholder="实例数"></Input>
           </Form.Item>
-          <Form.Item 
-            name="runArgs"
-            label="运行参数"
-            tooltip="服务运行参数"
-          >
+          <Form.Item name="runArgs" label="运行参数" tooltip="服务运行参数">
             <Input placeholder="运行参数"></Input>
           </Form.Item>
-          <Form.Item 
-            name="runCommands"
-            label="运行命令"
-            tooltip="服务运行命令"
-          >
+          <Form.Item name="runCommands" label="运行命令" tooltip="服务运行命令">
             <Input placeholder="运行命令"></Input>
-          </Form.Item >
-          <Form.Item 
+          </Form.Item>
+          <Form.Item
             name="nodeIp"
             label="部署节点"
             tooltip="指定特定的部署节点"
@@ -133,200 +153,271 @@ export default class ConfigModal extends PureComponent {
           <Divider plain>环境变量配置</Divider>
           <div className={styles.list}>
             <Form.List name="envsArr" label="key-value">
-              {(fields, {add, remove}) => (
-                  <>
-                    {fields.map(field => (
-                        <div key={`env-${field.fieldKey}`} field={field} className={styles.field}>
-                          <Form.Item
-                            {...field}
-                            key={`env-key-${field.fieldKey}`}
-                            label="key"
-                            name={[field.name, 'key']}
-                            fieldKey={[field.fieldKey, 'key']}
-                            rules={[{ required: true, message: 'key不能为空' }]}
-                          >
-                            <Input placeholder="环境变量key" />
-                          </Form.Item>
-                          <Form.Item
-                            {...field}
-                            key={`env-value-${field.fieldKey}`}
-                            label="value"
-                            name={[field.name, 'value']}
-                            fieldKey={[field.fieldKey, 'value']}
-                            rules={[{ required: true, message: 'value不能为空' }]}
-                          >
-                            <Input placeholder="环境变量value" />
-                          </Form.Item>
-                          <MinusCircleOutlined style={{fontSize: 18, marginLeft: 10}} onClick={() => remove(field.name)} />
-                        </div>
-                    ))}
-                    <Form.Item className={styles.addBtn}>
-                      <Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />}>
-                        添加
-                      </Button>
-                    </Form.Item>
-                  </>
+              {(fields, { add, remove }) => (
+                <>
+                  {fields.map(field => (
+                    <div
+                      key={`env-${field.fieldKey}`}
+                      field={field}
+                      className={styles.field}
+                    >
+                      <Form.Item
+                        {...field}
+                        key={`env-key-${field.fieldKey}`}
+                        label="key"
+                        name={[field.name, 'key']}
+                        fieldKey={[field.fieldKey, 'key']}
+                        rules={[{ required: true, message: 'key不能为空' }]}
+                      >
+                        <Input placeholder="环境变量key" />
+                      </Form.Item>
+                      <Form.Item
+                        {...field}
+                        key={`env-value-${field.fieldKey}`}
+                        label="value"
+                        name={[field.name, 'value']}
+                        fieldKey={[field.fieldKey, 'value']}
+                        rules={[{ required: true, message: 'value不能为空' }]}
+                      >
+                        <Input placeholder="环境变量value" />
+                      </Form.Item>
+                      <MinusCircleOutlined
+                        style={{ fontSize: 18, marginLeft: 10 }}
+                        onClick={() => remove(field.name)}
+                      />
+                    </div>
+                  ))}
+                  <Form.Item className={styles.addBtn}>
+                    <Button
+                      type="dashed"
+                      onClick={() => add()}
+                      block
+                      icon={<PlusOutlined />}
+                    >
+                      添加
+                    </Button>
+                  </Form.Item>
+                </>
               )}
             </Form.List>
           </div>
           <Divider plain>挂载文件配置</Divider>
           <div className={styles.list}>
             <Form.List name="mountsArr">
-              {(fields, {add, remove}) => (
-                  <>
-                    {fields.map(field => (
-                        <div key={`mount-${field.fieldKey}`} className={styles.field}>
-                          <Form.Item
-                            {...field}
-                            key={`mount-key-${field.fieldKey}`}
-                            label="文件路径"
-                            name={[field.name, 'key']}
-                            fieldKey={[field.fieldKey, 'key']}
-                            rules={[{ required: true, message: '文件路径不能为空' }]}
-                          >
-                            <Input placeholder="文件路径" />
-                          </Form.Item>
-                          <Form.Item
-                            {...field}
-                            label="文件内容"
-                            key={`mount-value-${field.fieldKey}`}
-                            style={{alignItems: 'center'}}
-                            name={[field.name, 'value']}
-                            fieldKey={[field.fieldKey, 'value']}
-                          >
-                            <Input.TextArea placeholder="文件内容" />
-                          </Form.Item>
-                          <MinusCircleOutlined style={{fontSize: 18, marginLeft: 10}} onClick={() => remove(field.name)} />
-                        </div>
-                    ))}
-                    <Form.Item className={styles.addBtn} >
-                      <Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />}>
-                        添加
-                      </Button>
-                    </Form.Item>
-                  </>
+              {(fields, { add, remove }) => (
+                <>
+                  {fields.map(field => (
+                    <div
+                      key={`mount-${field.fieldKey}`}
+                      className={styles.field}
+                    >
+                      <Form.Item
+                        {...field}
+                        key={`mount-key-${field.fieldKey}`}
+                        label="文件路径"
+                        name={[field.name, 'key']}
+                        fieldKey={[field.fieldKey, 'key']}
+                        rules={[
+                          { required: true, message: '文件路径不能为空' },
+                        ]}
+                      >
+                        <Input placeholder="文件路径" />
+                      </Form.Item>
+                      <Form.Item
+                        {...field}
+                        label="文件内容"
+                        key={`mount-value-${field.fieldKey}`}
+                        style={{ alignItems: 'center' }}
+                        name={[field.name, 'value']}
+                        fieldKey={[field.fieldKey, 'value']}
+                      >
+                        <Input.TextArea
+                          style={{ height: 250 }}
+                          placeholder="文件内容"
+                        />
+                      </Form.Item>
+                      <MinusCircleOutlined
+                        style={{ fontSize: 18, marginLeft: 10 }}
+                        onClick={() => remove(field.name)}
+                      />
+                    </div>
+                  ))}
+                  <Form.Item className={styles.addBtn}>
+                    <Button
+                      type="dashed"
+                      onClick={() => add()}
+                      block
+                      icon={<PlusOutlined />}
+                    >
+                      添加
+                    </Button>
+                  </Form.Item>
+                </>
               )}
             </Form.List>
           </div>
           <Divider plain>持久卷挂载配置</Divider>
           <div className={styles.list}>
             <Form.List name="pvcPathsArr">
-              {(fields, {add, remove}) => (
-                  <>
-                    {fields.map(field => (
-                        <div key={`pvc-${field.fieldKey}`} className={styles.field}>
-                          <Form.Item
-                            {...field}
-                            key={`pvc-key-${field.fieldKey}`}
-                            label="持久卷名称"
-                            name={[field.name, 'key']}
-                            fieldKey={[field.fieldKey, 'key']}
-                            rules={[{ required: true, message: '持久卷名称不能为空' }]}
-                          >
-                            <Input placeholder="持久卷名称" />
-                          </Form.Item>
-                          <Form.Item
-                            {...field}
-                            label="挂载路径"
-                            key={`pvc-value-${field.fieldKey}`}
-                            style={{alignItems: 'center'}}
-                            name={[field.name, 'value']}
-                            fieldKey={[field.fieldKey, 'value']}
-                          >
-                            <Input placeholder="挂载路径" />
-                          </Form.Item>
-                          <MinusCircleOutlined style={{fontSize: 18, marginLeft: 10}} onClick={() => remove(field.name)} />
-                        </div>
-                    ))}
-                    <Form.Item className={styles.addBtn} >
-                      <Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />}>
-                        添加
-                      </Button>
-                    </Form.Item>
-                  </>
+              {(fields, { add, remove }) => (
+                <>
+                  {fields.map(field => (
+                    <div key={`pvc-${field.fieldKey}`} className={styles.field}>
+                      <Form.Item
+                        {...field}
+                        key={`pvc-key-${field.fieldKey}`}
+                        label="持久卷名称"
+                        name={[field.name, 'key']}
+                        fieldKey={[field.fieldKey, 'key']}
+                        rules={[
+                          { required: true, message: '持久卷名称不能为空' },
+                        ]}
+                      >
+                        <Input placeholder="持久卷名称" />
+                      </Form.Item>
+                      <Form.Item
+                        {...field}
+                        label="挂载路径"
+                        key={`pvc-value-${field.fieldKey}`}
+                        style={{ alignItems: 'center' }}
+                        name={[field.name, 'value']}
+                        fieldKey={[field.fieldKey, 'value']}
+                      >
+                        <Input placeholder="挂载路径" />
+                      </Form.Item>
+                      <MinusCircleOutlined
+                        style={{ fontSize: 18, marginLeft: 10 }}
+                        onClick={() => remove(field.name)}
+                      />
+                    </div>
+                  ))}
+                  <Form.Item className={styles.addBtn}>
+                    <Button
+                      type="dashed"
+                      onClick={() => add()}
+                      block
+                      icon={<PlusOutlined />}
+                    >
+                      添加
+                    </Button>
+                  </Form.Item>
+                </>
               )}
             </Form.List>
           </div>
           <Divider plain>节点文件挂载</Divider>
           <div className={styles.list}>
             <Form.List name="hostPathArr">
-              {(fields, {add, remove}) => (
-                  <>
-                    {fields.map(field => (
-                        <div key={`hostPath-${field.fieldKey}`} className={styles.field}>
-                          <Form.Item
-                            {...field}
-                            key={`hostPath-key-${field.fieldKey}`}
-                            name={[field.name, 'key']}
-                            label="节点路径"
-                            fieldKey={[field.fieldKey, 'key']}
-                            rules={[{ required: true, message: '节点文件路径不能为空' }]}
-                          >
-                            <Input placeholder="节点文件路径" />
-                          </Form.Item>
-                          <Form.Item
-                            {...field}
-                            key={`hostPath-value-${field.fieldKey}`}
-                            name={[field.name, 'value']}
-                            label="挂载路径"
-                            fieldKey={[field.fieldKey, 'value']}
-                            rules={[{ required: true, message: '挂载文件路径不能为空' }]}
-                          >
-                            <Input placeholder="挂载文件路径" />
-                          </Form.Item>
-                          <MinusCircleOutlined style={{fontSize: 18, marginLeft: 10}} onClick={() => remove(field.name)} />
-                        </div>
-                    ))}
-                    <Form.Item className={styles.addBtn} >
-                      <Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />}>
-                        添加
-                      </Button>
-                    </Form.Item>
-                  </>
+              {(fields, { add, remove }) => (
+                <>
+                  {fields.map(field => (
+                    <div
+                      key={`hostPath-${field.fieldKey}`}
+                      className={styles.field}
+                    >
+                      <Form.Item
+                        {...field}
+                        key={`hostPath-key-${field.fieldKey}`}
+                        name={[field.name, 'key']}
+                        label="节点路径"
+                        fieldKey={[field.fieldKey, 'key']}
+                        rules={[
+                          { required: true, message: '节点文件路径不能为空' },
+                        ]}
+                      >
+                        <Input placeholder="节点文件路径" />
+                      </Form.Item>
+                      <Form.Item
+                        {...field}
+                        key={`hostPath-value-${field.fieldKey}`}
+                        name={[field.name, 'value']}
+                        label="挂载路径"
+                        fieldKey={[field.fieldKey, 'value']}
+                        rules={[
+                          { required: true, message: '挂载文件路径不能为空' },
+                        ]}
+                      >
+                        <Input placeholder="挂载文件路径" />
+                      </Form.Item>
+                      <MinusCircleOutlined
+                        style={{ fontSize: 18, marginLeft: 10 }}
+                        onClick={() => remove(field.name)}
+                      />
+                    </div>
+                  ))}
+                  <Form.Item className={styles.addBtn}>
+                    <Button
+                      type="dashed"
+                      onClick={() => add()}
+                      block
+                      icon={<PlusOutlined />}
+                    >
+                      添加
+                    </Button>
+                  </Form.Item>
+                </>
               )}
             </Form.List>
           </div>
           <Divider plain>ingress控制器annotations</Divider>
           <div className={styles.list}>
             <Form.List name="ingressAnnotationsArr">
-              {(fields, {add, remove}) => (
-                  <>
-                    {fields.map(field => (
-                        <div key={`ingress-${field.fieldKey}`} className={styles.field}>
-                          <Form.Item
-                            {...field}
-                            label="key"
-                            key={`ingress-key-${field.fieldKey}`}
-                            name={[field.name, 'key']}
-                            fieldKey={[field.fieldKey, 'key']}
-                            rules={[{ required: true, message: 'annotationKey不能为空' }]}
-                          >
-                            <Input placeholder="annotationKey" />
-                          </Form.Item>
-                          <Form.Item
-                            {...field}
-                            key={`ingress-value-${field.fieldKey}`}
-                            name={[field.name, 'value']}
-                            label="value"
-                            fieldKey={[field.fieldKey, 'value']}
-                            rules={[{ required: true, message: 'annotationValue不能为空' }]}
-                          >
-                            <Input placeholder="annotationValue" />
-                          </Form.Item>
-                          <MinusCircleOutlined style={{fontSize: 18, marginLeft: 10}} onClick={() => remove(field.name)} />
-                        </div>
-                    ))}
-                    <Form.Item className={styles.addBtn} >
-                      <Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />}>
-                        添加
-                      </Button>
-                    </Form.Item>
-                  </>
+              {(fields, { add, remove }) => (
+                <>
+                  {fields.map(field => (
+                    <div
+                      key={`ingress-${field.fieldKey}`}
+                      className={styles.field}
+                    >
+                      <Form.Item
+                        {...field}
+                        label="key"
+                        key={`ingress-key-${field.fieldKey}`}
+                        name={[field.name, 'key']}
+                        fieldKey={[field.fieldKey, 'key']}
+                        rules={[
+                          { required: true, message: 'annotationKey不能为空' },
+                        ]}
+                      >
+                        <Input placeholder="annotationKey" />
+                      </Form.Item>
+                      <Form.Item
+                        {...field}
+                        key={`ingress-value-${field.fieldKey}`}
+                        name={[field.name, 'value']}
+                        label="value"
+                        fieldKey={[field.fieldKey, 'value']}
+                        rules={[
+                          {
+                            required: true,
+                            message: 'annotationValue不能为空',
+                          },
+                        ]}
+                      >
+                        <Input placeholder="annotationValue" />
+                      </Form.Item>
+                      <MinusCircleOutlined
+                        style={{ fontSize: 18, marginLeft: 10 }}
+                        onClick={() => remove(field.name)}
+                      />
+                    </div>
+                  ))}
+                  <Form.Item className={styles.addBtn}>
+                    <Button
+                      type="dashed"
+                      onClick={() => add()}
+                      block
+                      icon={<PlusOutlined />}
+                    >
+                      添加
+                    </Button>
+                  </Form.Item>
+                </>
               )}
             </Form.List>
           </div>
         </Form>
       </Modal>
-    )
+    );
   }
-}
+}

+ 5 - 5
src/pages/app/[id]/_layout.tsx

@@ -190,7 +190,7 @@ export default class AppDetailPage extends PureComponent {
   }
   render() {
     return (
-      <PageHeader
+      <PageHeader style={{height:'200%'}}
         backIcon={false}
         title={this.props.app.currentApp?.name ? this.props.app.currentApp.name : '应用'}
         subTitle={this.state.currentApp ? this.state.currentApp.description : null}
@@ -204,9 +204,9 @@ export default class AppDetailPage extends PureComponent {
           </div>
         ) : null}
       >
-        {(this.state.fetching) ? 
+        {(this.state.fetching) ?
           <div style={{textAlign: 'center', marginTop: 30}}><LoadingOutlined style={{ fontSize: '48px'}} /></div> :
-          (this.props.app.currentApp ? 
+          (this.props.app.currentApp ?
             <div className={styles.pageContent}>
               <Descriptions size="small"
               >
@@ -250,10 +250,10 @@ export default class AppDetailPage extends PureComponent {
               </VolumeModal>
               <Modal>
               </Modal>
-            </div> : <Empty />   
+            </div> : <Empty />
           )
         }
       </PageHeader>
     )
   }
-}
+}

+ 21 - 3
src/pages/app/[id]/environment/[environmentId].js

@@ -273,6 +273,20 @@ export default class AppEnvironment extends PureComponent {
       }
     })
   }
+  invokeDeployNoCache() {
+    this.props.dispatch({
+      type: 'environment/deploy',
+      payload: {
+        id: this.state.currentEnvironment.id,
+        useCache: false,
+        callback: (response) => {
+          if (response && response.code == 0) {
+            this.requestInterval();
+          }
+        }
+      }
+    })
+  }
   requestAndSetLog(logType, id, record) {
     const type = logType == 'build' || logType == 'deploy' ? 'environment/get' : 'environment/getLog';
     this.props.dispatch({
@@ -432,9 +446,13 @@ export default class AppEnvironment extends PureComponent {
                   </Popconfirm>
                   <Button style={{marginLeft: 10}} type="primary" onClick={this.showEnvUpdate.bind(this)} >更新环境</Button>
                   <Button style={{marginLeft: 10}} type="primary" onClick={this.showEnvConfig.bind(this)}>环境配置</Button>
-                  <Popconfirm title="确认要触发吗?" onConfirm={this.invokeDeploy.bind(this)} okText="确定" cancelText="取消">
-                    <Button style={{marginLeft: 10}} type="primary">触发部署</Button>
+                  <Popconfirm title="确认要触发吗?有缓存部署更快,但是当你通过git修改依赖项文件时,请使用无缓存部署。" onConfirm={this.invokeDeploy.bind(this)} okText="确定" cancelText="取消">
+                    <Button style={{marginLeft: 10}} type="primary">有缓存部署</Button>
+                    <Popconfirm title="确认要触发吗?(清除构建缓存)" onConfirm={this.invokeDeployNoCache.bind(this)} okText="确定" cancelText="取消">
+                      <Button  style={{marginLeft: 10}} type="danger">无缓存部署</Button>
+                    </Popconfirm>
                   </Popconfirm>
+
                 </div>
               ) : null}
             >
@@ -527,4 +545,4 @@ export default class AppEnvironment extends PureComponent {
       </div>
     )
   }
-}
+}