From 7eab4b6b850075fdd591be6bcaf4999d50bcd995 Mon Sep 17 00:00:00 2001 From: vapao Date: Thu, 14 Apr 2022 23:24:00 +0800 Subject: [PATCH] =?UTF-8?q?A=20=E8=87=AA=E5=AE=9A=E4=B9=89=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E9=85=8D=E7=BD=AE=E6=94=AF=E6=8C=81=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=8A=A8=E4=BD=9C=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_web/src/pages/deploy/app/Ext2Setup2.js | 56 +++++++++++++++---- .../src/pages/deploy/app/index.module.css | 22 +++++++- 2 files changed, 66 insertions(+), 12 deletions(-) diff --git a/spug_web/src/pages/deploy/app/Ext2Setup2.js b/spug_web/src/pages/deploy/app/Ext2Setup2.js index c36f7d2..418611d 100644 --- a/spug_web/src/pages/deploy/app/Ext2Setup2.js +++ b/spug_web/src/pages/deploy/app/Ext2Setup2.js @@ -5,7 +5,7 @@ */ import React from 'react'; import { observer } from 'mobx-react'; -import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; +import { MinusCircleOutlined, PlusOutlined, UpOutlined, DownOutlined } from '@ant-design/icons'; import { Form, Input, Button, message, Divider, Alert, Select } from 'antd'; import { ACEditor } from 'components'; import styles from './index.module.css'; @@ -21,7 +21,7 @@ class Ext2Setup2 extends React.Component { this.helpMap = { '0': null, '1': '相对于输入的本地路径的文件路径,仅将匹配到文件传输至要发布的目标主机。', - '2': '支持模糊匹配,如果路径以 / 开头则基于输入的本地路径匹配,匹配到文件将不会被传输。' + '2': '支持模糊匹配,基于输入的本地路径匹配,匹配到文件将不会被传输。' } this.state = { loading: false, @@ -43,6 +43,28 @@ class Ext2Setup2 extends React.Component { }, () => this.setState({loading: false})) }; + _doAction = (actions, index, action) => { + if (action === 'up') { + if (index > 0) { + [actions[index], actions[index - 1]] = [actions[index - 1], actions[index]] + } + } else { + if (index < actions.length - 1) { + [actions[index], actions[index + 1]] = [actions[index + 1], actions[index]] + } + } + } + + handleHostAction = (index, action) => { + const actions = store.deploy['host_actions']; + this._doAction(actions, index, action) + } + + handleServerAction = (index, action) => { + const actions = store.deploy['server_actions']; + this._doAction(actions, index, action) + } + render() { const server_actions = store.deploy['server_actions']; const host_actions = store.deploy['host_actions']; @@ -81,16 +103,22 @@ class Ext2Setup2 extends React.Component { placeholder="请输入要执行的动作"/> {!store.isReadOnly && ( -
server_actions.splice(index, 1)}> - 移除 -
+ + )} @@ -159,16 +187,22 @@ class Ext2Setup2 extends React.Component { )} {!store.isReadOnly && ( -
host_actions.splice(index, 1)}> - 移除 -
+ + )} diff --git a/spug_web/src/pages/deploy/app/index.module.css b/spug_web/src/pages/deploy/app/index.module.css index e7093dc..7053a13 100644 --- a/spug_web/src/pages/deploy/app/index.module.css +++ b/spug_web/src/pages/deploy/app/index.module.css @@ -50,7 +50,7 @@ cursor: pointer; position: absolute; width: 35px; - padding: 10px; + padding: 5px 10px; text-align: center; top: 32px; right: 60px; @@ -63,6 +63,26 @@ color: rgb(255, 96, 59); } +.upAction { + position: absolute; + width: 35px; + height: 26px; + top: 0; + right: 60px; + border-radius: 5px; + color: #d9d9d9; +} + +.downAction { + position: absolute; + width: 35px; + height: 26px; + bottom: 0; + right: 60px; + border-radius: 5px; + color: #d9d9d9; +} + .fullScreen { background-color: #fff; position: fixed;