mirror of https://github.com/openspug/spug
				
				
				
			fix issues
							parent
							
								
									513a92504e
								
							
						
					
					
						commit
						aca586a153
					
				| 
						 | 
				
			
			@ -6,22 +6,16 @@
 | 
			
		|||
import React from 'react';
 | 
			
		||||
import { observer } from 'mobx-react';
 | 
			
		||||
import { QuestionCircleOutlined } from '@ant-design/icons';
 | 
			
		||||
import { Form, Radio, Button, Tooltip } from "antd";
 | 
			
		||||
import { Form, Radio, Button, Tooltip } from 'antd';
 | 
			
		||||
import { cleanCommand } from 'libs';
 | 
			
		||||
import Editor from 'react-ace';
 | 
			
		||||
import 'ace-builds/src-noconflict/mode-text';
 | 
			
		||||
import 'ace-builds/src-noconflict/mode-sh';
 | 
			
		||||
import 'ace-builds/src-noconflict/theme-tomorrow';
 | 
			
		||||
import Tips from './Tips';
 | 
			
		||||
import store from './store';
 | 
			
		||||
 | 
			
		||||
export default observer(function () {
 | 
			
		||||
  const Tips = (
 | 
			
		||||
    <a
 | 
			
		||||
      target="_blank"
 | 
			
		||||
      rel="noopener noreferrer"
 | 
			
		||||
      href="https://spug.cc/docs/deploy-config/#%E5%85%A8%E5%B1%80%E5%8F%98%E9%87%8F">内置全局变量</a>
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  function handleNext() {
 | 
			
		||||
    store.page += 1
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -66,7 +60,7 @@ export default observer(function () {
 | 
			
		|||
      <Form.Item
 | 
			
		||||
        label="代码检出前执行"
 | 
			
		||||
        tooltip="在运行 Spug 的服务器(或容器)上执行,当前目录为仓库源代码目录,可以执行任意自定义命令。"
 | 
			
		||||
        help={<span>可使用 {Tips},请避免在此修改已跟踪的文件,防止在检出代码时失败。</span>}>
 | 
			
		||||
        help={<span>{Tips},请避免在此修改已跟踪的文件,防止在检出代码时失败。</span>}>
 | 
			
		||||
        <Editor
 | 
			
		||||
          readOnly={store.isReadOnly}
 | 
			
		||||
          mode="sh"
 | 
			
		||||
| 
						 | 
				
			
			@ -82,7 +76,7 @@ export default observer(function () {
 | 
			
		|||
        label="代码检出后执行"
 | 
			
		||||
        style={{marginTop: 12, marginBottom: 24}}
 | 
			
		||||
        tooltip="在运行 Spug 的服务器(或容器)上执行,当前目录为检出后的源代码目录,可执行任意自定义命令。"
 | 
			
		||||
        help={<span>可使用 {Tips},大多数情况下在此进行构建操作。</span>}>
 | 
			
		||||
        help={<span>{Tips},大多数情况下在此进行构建操作。</span>}>
 | 
			
		||||
        <Editor
 | 
			
		||||
          readOnly={store.isReadOnly}
 | 
			
		||||
          mode="sh"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,16 +11,11 @@ import 'ace-builds/src-noconflict/mode-text';
 | 
			
		|||
import 'ace-builds/src-noconflict/mode-sh';
 | 
			
		||||
import 'ace-builds/src-noconflict/theme-tomorrow';
 | 
			
		||||
import { http, cleanCommand } from 'libs';
 | 
			
		||||
import Tips from './Tips';
 | 
			
		||||
import store from './store';
 | 
			
		||||
 | 
			
		||||
export default observer(function () {
 | 
			
		||||
  const [loading, setLoading] = useState(false);
 | 
			
		||||
  const Tips = (
 | 
			
		||||
    <a
 | 
			
		||||
      target="_blank"
 | 
			
		||||
      rel="noopener noreferrer"
 | 
			
		||||
      href="https://spug.cc/docs/deploy-config/#%E5%85%A8%E5%B1%80%E5%8F%98%E9%87%8F">内置全局变量</a>
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  function handleSubmit() {
 | 
			
		||||
    const {dst_dir, dst_repo} = store.deploy;
 | 
			
		||||
| 
						 | 
				
			
			@ -60,7 +55,7 @@ export default observer(function () {
 | 
			
		|||
      <Form.Item
 | 
			
		||||
        label="应用发布前执行"
 | 
			
		||||
        tooltip="在发布的目标主机上运行,当前目录为目标主机上待发布的源代码目录,可执行任意自定义命令。"
 | 
			
		||||
        help={<span>可使用 {Tips},此时还未进行文件变更,可进行一些发布前置操作。</span>}>
 | 
			
		||||
        help={<span>{Tips},此时还未进行文件变更,可进行一些发布前置操作。</span>}>
 | 
			
		||||
        <Editor
 | 
			
		||||
          readOnly={store.isReadOnly}
 | 
			
		||||
          mode="sh"
 | 
			
		||||
| 
						 | 
				
			
			@ -76,7 +71,7 @@ export default observer(function () {
 | 
			
		|||
        label="应用发布后执行"
 | 
			
		||||
        style={{marginTop: 12, marginBottom: 24}}
 | 
			
		||||
        tooltip="在发布的目标主机上运行,当前目录为已发布的应用目录,可执行任意自定义命令。"
 | 
			
		||||
        help={<span>可使用 {Tips},可以在发布后进行重启服务等操作。</span>}>
 | 
			
		||||
        help={<span>{Tips},可以在发布后进行重启服务等操作。</span>}>
 | 
			
		||||
        <Editor
 | 
			
		||||
          readOnly={store.isReadOnly}
 | 
			
		||||
          mode="sh"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -89,7 +89,7 @@ export default observer(function Ext2Setup1() {
 | 
			
		|||
      <Form.Item wrapperCol={{span: 14, offset: 6}}>
 | 
			
		||||
        <Button
 | 
			
		||||
          type="primary"
 | 
			
		||||
          disabled={!info.env_id}
 | 
			
		||||
          disabled={!(info.env_id && info.host_ids.length)}
 | 
			
		||||
          onClick={() => store.page += 1}>下一步</Button>
 | 
			
		||||
      </Form.Item>
 | 
			
		||||
      <Selector
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,6 +12,7 @@ import 'ace-builds/src-noconflict/mode-sh';
 | 
			
		|||
import 'ace-builds/src-noconflict/theme-tomorrow';
 | 
			
		||||
import styles from './index.module.css';
 | 
			
		||||
import { http, cleanCommand } from 'libs';
 | 
			
		||||
import Tips from './Tips';
 | 
			
		||||
import store from './store';
 | 
			
		||||
import lds from 'lodash';
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -59,7 +60,8 @@ class Ext2Setup2 extends React.Component {
 | 
			
		|||
            description={[
 | 
			
		||||
              <p key={1}>Spug 将遵循先本地后目标主机的原则,按照顺序依次执行添加的动作,例如:本地动作1 -> 本地动作2 -> 目标主机动作1 -> 目标主机动作2 ...</p>,
 | 
			
		||||
              <p key={2}>执行的命令内可以使用发布申请中设置的环境变量 SPUG_RELEASE,一般可用于标记一次发布的版本号或提交ID等,在执行的脚本内通过使用 $SPUG_RELEASE
 | 
			
		||||
                获取其值来执行相应操作。</p>
 | 
			
		||||
                获取其值来执行相应操作。</p>,
 | 
			
		||||
              <p key={3}>{Tips}。</p>
 | 
			
		||||
            ]}/>
 | 
			
		||||
        )}
 | 
			
		||||
        {server_actions.map((item, index) => (
 | 
			
		||||
| 
						 | 
				
			
			@ -180,7 +182,7 @@ class Ext2Setup2 extends React.Component {
 | 
			
		|||
            </Button>
 | 
			
		||||
          </Form.Item>
 | 
			
		||||
        )}
 | 
			
		||||
        <Form.Item wrapperCol={{span: 14, offset: 6}}>
 | 
			
		||||
        <Form.Item wrapperCol={{span: 14, offset: 6}} style={{marginTop: 24}}>
 | 
			
		||||
          <Button
 | 
			
		||||
            type="primary"
 | 
			
		||||
            disabled={store.isReadOnly || [...host_actions, ...server_actions].filter(x => x.title && x.data).length === 0}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,24 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Copyright (c) OpenSpug Organization. https://github.com/openspug/spug
 | 
			
		||||
 * Copyright (c) <spug.dev@gmail.com>
 | 
			
		||||
 * Released under the AGPL-3.0 License.
 | 
			
		||||
 */
 | 
			
		||||
import React from 'react';
 | 
			
		||||
import { Tooltip } from 'antd';
 | 
			
		||||
 | 
			
		||||
const Tips1 = (
 | 
			
		||||
  <a
 | 
			
		||||
    target="_blank"
 | 
			
		||||
    rel="noopener noreferrer"
 | 
			
		||||
    href="https://spug.cc/docs/deploy-config/#%E5%85%A8%E5%B1%80%E5%8F%98%E9%87%8F">内置全局变量</a>
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const Tips2 = (
 | 
			
		||||
  <Tooltip title="配置中心应用的配置将会以 _SPUG_标识符_Key 方式组合成环境变量,可通过执行 env | grep SPUG 来查看所有的内置的和配置中心的可使用变量。">
 | 
			
		||||
    <span style={{color: '#1890ff'}}>配置中心的配置变量</span>
 | 
			
		||||
  </Tooltip>
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
export default (
 | 
			
		||||
  <span>可使用 {Tips1} 和 {Tips2}</span>
 | 
			
		||||
)
 | 
			
		||||
		Loading…
	
		Reference in New Issue