diff --git a/docker/Dockerfile b/docker/Dockerfile
deleted file mode 100644
index d201ad62be72dd1c5474af667f4a5556ab1632b2..0000000000000000000000000000000000000000
--- a/docker/Dockerfile
+++ /dev/null
@@ -1,3 +0,0 @@
-FROM hub.c.163.com/library/nginx:alpine
-MAINTAINER fanghailiang fanghailiang2016@gmail.com
-ADD build /usr/share/nginx/html
\ No newline at end of file
diff --git a/docker/client.onlinetool.fanghailiang.cn.conf b/docker/client.onlinetool.fanghailiang.cn.conf
deleted file mode 100644
index fbccb9ed0ab51d91675336abbfcbd130a5469381..0000000000000000000000000000000000000000
--- a/docker/client.onlinetool.fanghailiang.cn.conf
+++ /dev/null
@@ -1,11 +0,0 @@
-server {
- listen 80;
- server_name client.onlinetool.fanghailiang.cn;
-
- location / {
- proxy_pass http://onlinetool_client:9535;
- index index.html index.htm index.jsp;
- }
-
- access_log /var/log/nginx/client.onlinetool.fanghailiang.cn.log main;
-}
\ No newline at end of file
diff --git a/docker/push.sh b/docker/push.sh
deleted file mode 100755
index 309bcc405a21cc7623ebc9df6ed368d6df2f921a..0000000000000000000000000000000000000000
--- a/docker/push.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-static_version=1.0
-
-# sudo docker login --username=1274404072@qq.com registry.cn-shanghai.aliyuncs.com
-cd ../ && npm run build && cd docker
-cp -rf ../build ./
-docker build -t onlinetool:static .
-docker tag onlinetool:static registry.cn-shanghai.aliyuncs.com/onlinetool/onlinetool_static:${static_version}
-docker push registry.cn-shanghai.aliyuncs.com/onlinetool/onlinetool_static:${static_version}
-rm -rf build
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index a21d4fcfe3a0b077fbefa911722ac7bf876dc549..0191488b0231ae10c33bdc12848480500d79b2c8 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2746,7 +2746,8 @@
},
"ansi-regex": {
"version": "2.1.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"aproba": {
"version": "1.2.0",
@@ -2764,11 +2765,13 @@
},
"balanced-match": {
"version": "1.0.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
+ "optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -2781,15 +2784,18 @@
},
"code-point-at": {
"version": "1.1.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"concat-map": {
"version": "0.0.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"console-control-strings": {
"version": "1.1.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"core-util-is": {
"version": "1.0.2",
@@ -2892,7 +2898,8 @@
},
"inherits": {
"version": "2.0.3",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"ini": {
"version": "1.3.5",
@@ -2902,6 +2909,7 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
+ "optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -2914,17 +2922,20 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
+ "optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
+ "optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@@ -2941,6 +2952,7 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
+ "optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -3013,7 +3025,8 @@
},
"number-is-nan": {
"version": "1.0.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"object-assign": {
"version": "4.1.1",
@@ -3023,6 +3036,7 @@
"once": {
"version": "1.4.0",
"bundled": true,
+ "optional": true,
"requires": {
"wrappy": "1"
}
@@ -3098,7 +3112,8 @@
},
"safe-buffer": {
"version": "5.1.2",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -3128,6 +3143,7 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
+ "optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -3145,6 +3161,7 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
+ "optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -3183,11 +3200,13 @@
},
"wrappy": {
"version": "1.0.2",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"yallist": {
"version": "3.0.3",
- "bundled": true
+ "bundled": true,
+ "optional": true
}
}
},
@@ -6939,7 +6958,8 @@
},
"ansi-regex": {
"version": "2.1.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"aproba": {
"version": "1.2.0",
@@ -6963,6 +6983,7 @@
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
+ "optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -6975,7 +6996,8 @@
},
"code-point-at": {
"version": "1.1.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"concat-map": {
"version": "0.0.1",
@@ -6984,7 +7006,8 @@
},
"console-control-strings": {
"version": "1.1.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"core-util-is": {
"version": "1.0.2",
@@ -7087,7 +7110,8 @@
},
"inherits": {
"version": "2.0.3",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"ini": {
"version": "1.3.5",
@@ -7097,6 +7121,7 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
+ "optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -7109,17 +7134,20 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
+ "optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
+ "optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@@ -7136,6 +7164,7 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
+ "optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -7208,7 +7237,8 @@
},
"number-is-nan": {
"version": "1.0.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"object-assign": {
"version": "4.1.1",
@@ -7218,6 +7248,7 @@
"once": {
"version": "1.4.0",
"bundled": true,
+ "optional": true,
"requires": {
"wrappy": "1"
}
@@ -7293,7 +7324,8 @@
},
"safe-buffer": {
"version": "5.1.2",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -7323,6 +7355,7 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
+ "optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -7340,6 +7373,7 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
+ "optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -7378,11 +7412,13 @@
},
"wrappy": {
"version": "1.0.2",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"yallist": {
"version": "3.0.3",
- "bundled": true
+ "bundled": true,
+ "optional": true
}
}
}
diff --git a/src/actions/deploy.js b/src/actions/deploy.js
index 88a54b97e3b4c63a4f408cd6ab594790b4142eb6..e866a1f6c9bc2041badab1c08b3afdd035892418 100644
--- a/src/actions/deploy.js
+++ b/src/actions/deploy.js
@@ -59,6 +59,19 @@ export function function_get_logger (deployUrl, projectId, taskId, servsId, env,
});
}
+export function function_set_task_failured(projectId, taskId, dispatch, cb){
+ MyAjax(API_URL.setTaskFailured, {
+ projectId,
+ taskId
+ }, function (result) {
+ if (result.code === CODE.SUCCESS) {
+ function_get_task(projectId, taskId, dispatch, ()=>cb());
+ }else{
+ alert(result.message);
+ }
+ })
+}
+
export function function_deploy_test_task(deployUrl, projectId, taskId, reloadFlg, cb){
ClientAjax(deployUrl, API_URL.deployTaskTest, {
projectId,
@@ -321,13 +334,15 @@ export function function_get_branches_by_servsid (deployUrl, servsid, dispatch,
});
}
-export function function_save_task (projectId, title, servsId, branch, sqls, admin, tester, dispatch, cb) {
+export function function_save_task (projectId, title, mark, servsId, branch, sqls, jobs, admin, tester, dispatch, cb) {
MyAjax(API_URL.saveMergeRequest, {
projectId,
title,
+ mark,
servsId,
branch,
sqls,
+ jobs,
admin,
tester
}, function (result) {
@@ -337,13 +352,15 @@ export function function_save_task (projectId, title, servsId, branch, sqls, adm
})
}
-export function function_add_task (projectId, title, servsId, branch, sqls, admin, tester, dispatch, cb) {
+export function function_add_task (projectId, title, mark, servsId, branch, sqls, jobs, admin, tester, dispatch, cb) {
MyAjax(API_URL.addMergeRequest, {
projectId,
title,
+ mark,
servsId,
branch,
sqls,
+ jobs,
admin,
tester
}, function (result) {
@@ -353,14 +370,16 @@ export function function_add_task (projectId, title, servsId, branch, sqls, admi
})
}
-export function function_save_task_from_trash (taskId, projectId, title, servsId, branch, sqls, admin, tester, dispatch, cb) {
+export function function_save_task_from_trash (taskId, projectId, title, mark, servsId, branch, sqls, jobs, admin, tester, dispatch, cb) {
MyAjax(API_URL.saveMergeRequestFromTrash, {
taskId,
projectId,
title,
+ mark,
servsId,
branch,
sqls,
+ jobs,
admin,
tester
}, function (result) {
@@ -370,14 +389,16 @@ export function function_save_task_from_trash (taskId, projectId, title, servsId
})
}
-export function function_add_task_from_trash (taskId, projectId, title, servsId, branch, sqls, admin, tester, dispatch, cb) {
+export function function_add_task_from_trash (taskId, projectId, title, mark, servsId, branch, sqls, jobs, admin, tester, dispatch, cb) {
MyAjax(API_URL.addMergeRequestFromTrash, {
taskId,
projectId,
title,
+ mark,
servsId,
branch,
sqls,
+ jobs,
admin,
tester
}, function (result) {
diff --git a/src/actions/member.js b/src/actions/member.js
index 1253ef0b0729a639bb1fb616088aaa5198d2bedb..efca5dbcd18d7a297169d250f86ce4ca6877c532 100644
--- a/src/actions/member.js
+++ b/src/actions/member.js
@@ -94,13 +94,22 @@ export function function_removeRoleByProject (tuid, projectId, role, cb) {
});
}
-export function function_addMemberByProject (projectId, email, nickname, roleList, cb) {
+/**
+ * 项目添加用户
+ * @param {int} projectId
+ * @param {string} email
+ * @param {string} nickname
+ * @param {array} roleList
+ * @param {function} cb
+ */
+export function function_addMemberByProject (projectId, email, nickname, roleList, dispatch, cb) {
MyAjax(API_URL.addMemberByProject, {
email,
nickname,
roleList,
projectId
}, result => {
+ function_getuserinfo(dispatch);
cb(result);
});
}
\ No newline at end of file
diff --git a/src/actions/project.js b/src/actions/project.js
index d976fc11ca2b7eb768967b6b40889c2aab11e61a..152b2149aa1a0a5799cd18ef3bacb8576137f3aa 100644
--- a/src/actions/project.js
+++ b/src/actions/project.js
@@ -1,4 +1,5 @@
import { API_URL, MyAjax, upFileAjax, CODE } from '../config';
+import { function_getuserinfo } from './member';
export const add_project = 'add_project';
export const get_project = 'get_project';
@@ -101,6 +102,7 @@ export function function_add_project (name, chatType, notifyUrl, notifySecret, d
id: projectId,
name: name
});
+ function_getuserinfo(dispatch);
}
});
}
\ No newline at end of file
diff --git a/src/actions/servs.js b/src/actions/servs.js
index 5e6bd2c470bd6b17d3a4e735bb05a3d4d2eefdd9..62e62c4e3193ba71d6225a8a0f38274a49d237fb 100644
--- a/src/actions/servs.js
+++ b/src/actions/servs.js
@@ -34,6 +34,11 @@ export function function_edit_servs (
excludeFiles,
commandBeforeDeploy,
commandAfterDeploy,
+ udtGitDir,
+ jobType,
+ lineJobHost,
+ isTestJobDeployed,
+ isPrevJobDeployed,
cb) {
MyAjax(API_URL.editServersById, {
projectId,
@@ -51,7 +56,12 @@ export function function_edit_servs (
packageDir,
excludeFiles,
commandBeforeDeploy,
- commandAfterDeploy
+ commandAfterDeploy,
+ udtGitDir,
+ jobType,
+ lineJobHost,
+ isTestJobDeployed,
+ isPrevJobDeployed,
}, result => {
cb(result);
})
@@ -84,6 +94,11 @@ export function function_add_servs (
excludeFiles,
commandBeforeDeploy,
commandAfterDeploy,
+ udtGitDir,
+ jobType,
+ lineJobHost,
+ isTestJobDeployed,
+ isPrevJobDeployed,
cb
) {
MyAjax(API_URL.addServersByProject, {
@@ -101,7 +116,12 @@ export function function_add_servs (
packageDir,
excludeFiles,
commandBeforeDeploy,
- commandAfterDeploy
+ commandAfterDeploy,
+ udtGitDir,
+ jobType,
+ lineJobHost,
+ isTestJobDeployed,
+ isPrevJobDeployed,
}, (result) => {
cb(result);
});
diff --git a/src/actions/task.js b/src/actions/task.js
index d9cfd84fdbc1c484f48e89969ee8d8d3266c9d91..aa5ac7b55323afd633e84b8d4da975dffea0f5f9 100644
--- a/src/actions/task.js
+++ b/src/actions/task.js
@@ -95,6 +95,7 @@ export function function_get_task(projectId, taskId, dispatch, cb){
testHost: result.data.testHost,
prevHost: result.data.prevHost,
serversList: result.data.list,
+ markContent: result.data.mark,
developer: result.data.fatDeveloper,
admin: result.data.fatAdmin,
tester: result.data.fatTester,
diff --git a/src/components/deploy/addDbConnector.js b/src/components/deploy/addDbConnector.js
index 89da30198b84f6b3d84f78653418f5fc015307ca..9e01c53a7ccb57859a2edd2ab08c5c14102beb31 100644
--- a/src/components/deploy/addDbConnector.js
+++ b/src/components/deploy/addDbConnector.js
@@ -8,6 +8,7 @@ import {
Col
} from 'react-bootstrap';
import $ from 'jquery';
+import queryString from 'query-string';
class AddDbConnector extends Component {
@@ -35,8 +36,13 @@ class AddDbConnector extends Component {
}
initSelectedProject(){
- if(this.state.selectedProject === -1 && Object.keys(this.props.projectList).length > 0){
- this.setState({selectedProject: parseInt(Object.keys(this.props.projectList)[0])});
+ let pid = parseInt(queryString.parse(window.location.search).pid);
+ if(this.state.selectedProject === -1){
+ if(pid > 0){
+ this.setState({selectedProject: pid});
+ }else if(Object.keys(this.props.projectList).length > 0){
+ this.setState({selectedProject: parseInt(Object.keys(this.props.projectList)[0])});
+ }
}
}
@@ -45,10 +51,10 @@ class AddDbConnector extends Component {
- 连接名:
+ 数据库标识:
-
+
@@ -85,7 +91,7 @@ class AddDbConnector extends Component {
地址:
-
+
端口
@@ -99,7 +105,7 @@ class AddDbConnector extends Component {
用户名:
-
+
@@ -112,6 +118,7 @@ class AddDbConnector extends Component {
id="password"
type={this.state.passwordFlg ? "password" : "text"}
placeholder="必填"
+ autoComplete="off"
/>
this.setState({ passwordFlg: !this.state.passwordFlg })}>
diff --git a/src/components/deploy/addhost.js b/src/components/deploy/addhost.js
index 5c11d2bf4cab45fde0f45c06c14c539166a287e1..894c7228ea5a461ebddb865fda54ed7c44b66cb9 100644
--- a/src/components/deploy/addhost.js
+++ b/src/components/deploy/addhost.js
@@ -20,10 +20,10 @@ class App extends Component {
- 服务器名:
+ 服务器标识:
-
+
{typeof this.props.projectId === "undefined" ?
@@ -48,7 +48,7 @@ class App extends Component {
地址:
-
+
端口
@@ -62,7 +62,7 @@ class App extends Component {
用户名:
-
+
@@ -74,6 +74,7 @@ class App extends Component {
this.setState({ passwordFlg: !this.state.passwordFlg })}>
@@ -83,12 +84,13 @@ class App extends Component {
- 证书:
+ 私钥路径:
+ autoComplete="off"
+ placeholder={"用来连接当前服务器使用的存储在" + this.props.deployHost + "服务器上的私钥路径"} />
diff --git a/src/components/team/install.js b/src/components/team/install.js
index fd680d9ecce47680d557e0616b3fb40eb6a8e182..8f9bed5d05b7f3e3b10e6152c10c0b050a959b3d 100644
--- a/src/components/team/install.js
+++ b/src/components/team/install.js
@@ -2,6 +2,10 @@ import React, { Component } from 'react';
import Highlight from 'react-highlight'
import 'highlight.js/styles/atelier-plateau-dark.css'
+import {
+ GITEE_DOWNLOAD_URL
+} from '../../config';
+
export default class extends Component {
render () {
return (
@@ -10,12 +14,13 @@ export default class extends Component {
-
下载jar包运行
-
点击这里下载jar包
- 依赖:确保服务器上安装JDK 8+
+ 点击这里下载jar包,下载文件名为 onlinetool_client-XXX.jar 的文件
+ 依赖:需要您服务器上安装 jdk8 以上
+ 注意:需要确保该服务器对您团队成员开放 9535 端口,如果开放其他端口,需要做好转发(如nginx)
sudo mkdir /usr/local/onlinetool
sudo chown -R [当前用户名]:[当前用户所在的组] /usr/local/onlinetool
- nohup java -jar [您刚刚下载的jar包文件名] &
+ nohup java -jar onlinetool_client-XXX.jar &
diff --git a/src/config/index.js b/src/config/index.js
index 80da48fadbe4f0b1bae34fb8a8c454d8c3d03090..c26124ba9df4a00831056553344124061b3ac3cc 100644
--- a/src/config/index.js
+++ b/src/config/index.js
@@ -7,6 +7,10 @@ export const PRODUCT_NAME = "流刀上线工具";
export const AJAX_BASE_URL = process.env.NODE_ENV === "development" ? "http://127.0.0.1:8080/" : "http://api.onlinetool.fanghailiang.cn/";
+//客户端项目地址
+export const GITEE_URL = "https://gitee.com/onlinetool/liudao";
+export const GITEE_DOWNLOAD_URL = GITEE_URL + "/releases";
+
//url地址列表
export const URL = {
"register_page": "/register",
@@ -75,6 +79,7 @@ export const API_URL = {
"setTaskTester": "chgTaskTester", //修改任务的测试人员
"setTaskAdmin": "chgTaskReviewer", //修改任务的上线人员
"setTaskDeploying": "setDeploying", //设置任务为部署中的状态
+ "setTaskFailured": "markDeployFailured", //设置任务上线失败
"closeTask": "setClosed", //关闭上线申请
"setTaskTesting": "setTesting", //设置任务为测试环境测试中状态
"setTaskPreTesting": "setPreTesting", //设置任务为预发布环境测试中状态
diff --git a/src/containers/member/addMember.js b/src/containers/member/addMember.js
index ab3ff89dd20b51f28c3e15045a2d6751b8fac0d9..e43381d24b93c452940189d7e1d01745d187e1b7 100644
--- a/src/containers/member/addMember.js
+++ b/src/containers/member/addMember.js
@@ -1,4 +1,5 @@
import React, { Component } from 'react';
+import { connect } from 'react-redux';
import {
Modal,
Form,
@@ -80,7 +81,7 @@ class AddMember extends Component {
return;
}
- function_addMemberByProject(this.props.pid, email, nickname, roleArr, result => {
+ function_addMemberByProject(this.props.pid, email, nickname, roleArr, this.props.dispatch, result => {
this.props.onSubmit(result);
});
@@ -152,4 +153,9 @@ class AddMember extends Component {
}
}
-export default AddMember;
\ No newline at end of file
+function mapStateToProps (state) {
+ return {
+ }
+}
+
+export default connect(mapStateToProps)(AddMember);
\ No newline at end of file
diff --git a/src/containers/servs/add.js b/src/containers/servs/add.js
index dddb9644da2bff8c94d1d6c29ed3ec971f024310..bdcf25f1ba56639472b2511b39d934b674620ab4 100644
--- a/src/containers/servs/add.js
+++ b/src/containers/servs/add.js
@@ -44,6 +44,7 @@ class App extends Component {
pid: parseInt(queryString.parse(this.props.location.search).pid),
sid: parseInt(queryString.parse(this.props.location.search).sid),
hasError: false,
+ isLoading: false,
errorMsg: "",
showAddHost: false,
showAddDbConnector: false,
@@ -53,6 +54,10 @@ class App extends Component {
lineHost: [],
testHost: [],
prevHost: [],
+ lineJobHost: "",
+ isTestJobDeployed: 1,
+ isPrevJobDeployed: 0,
+ deployDirectory: "",
lineDb: "",
testDb: "",
activeTab: "basic",
@@ -63,18 +68,20 @@ class App extends Component {
function_get_servs(this.state.sid, this.props.dispatch, result => {
$(this.refs.name).val(result.serviceName);
$(this.refs.git_base).val(result.reponsitoryDirectory);
- $(this.refs.deployDirectory).val(result.lineHostDirectory);
$(this.refs.commandBeforePackage).val(result.commandBeforePackage.join("\n"));
$(this.refs.packageDir).val(result.packageDir);
$(this.refs.excludeFiles).val(result.excludeFiles.join("\n"));
$(this.refs.commandBeforeDeploy).val(result.commandBeforeDeploy.join("\n"));
$(this.refs.commandAfterDeploy).val(result.commandAfterDeploy.join("\n"));
+ $(this.refs.udtGitDir).val(result.udtGitDir);
+ $(this.refs.jobType).val(result.jobType);
let targetBranch = result.targetBranch;
let lineDb = result.lineDb;
let testDb = result.testDb;
let lineHost = result.lineHost;
let testHost = result.testHost;
let prevHost = result.prevHost;
+ let lineJobHost = result.lineJobHost;
let data = [];
data.push({ id: targetBranch, text: targetBranch });
$(this.refs.master).select2({
@@ -87,26 +94,42 @@ class App extends Component {
$(this.refs.testHost).val(testHost).trigger('change');
$(this.refs.prevHost).val(prevHost).trigger('change');
this.setState({
+ isTestJobDeployed: result.isTestJobDeployed ? 1 : 0,
+ isPrevJobDeployed: result.isPrevJobDeployed ? 1 : 0,
reponsitoryDirectory: result.reponsitoryDirectory,
- lineHost: lineHost,
- testHost: testHost,
- prevHost: prevHost,
- lineDb: lineDb,
- testDb: testDb,
- targetBranch: targetBranch
+ deployDirectory: result.lineHostDirectory,
+ lineJobHost, lineHost, testHost, prevHost, lineDb, testDb, targetBranch
});
+ this.initJobServers();
});
}else{
$(this.refs.master).select2({
placeholder: "请点击右侧刷新按钮"
});
}
+ $(this.refs.onlineHost).on('change.select2', this.initJobServers.bind(this));
if(this.props.deployUrl !== ""){
this.initHosts();
this.initDbConnectors();
this.initRoles();
}
+ }
+
+ initJobServers(){
+ let onlineHostArr = [];
+ onlineHostArr.push({ id: "0", text: "线上不自动部署job" });
+ for(let onlineHost of $(this.refs.onlineHost).val()){
+ onlineHostArr.push({ id: onlineHost, text: onlineHost });
+ }
+ $(this.refs.lineJobHost).empty().select2({
+ data: onlineHostArr,
+ placeholder: "选择微服务线上job使用的服务器(非必填)"
+ });
+ $(this.refs.lineJobHost).val(this.state.lineJobHost).trigger('change');
+ }
+ setLoading(loadingFlg){
+ this.setState({isLoading: loadingFlg});
}
initHosts(){
@@ -249,16 +272,24 @@ class App extends Component {
}
handleSubmit (event) {
+ let jobType = $(this.refs.jobType).val();
+ let lineJobHost = $(this.refs.lineJobHost).val();
+ if(lineJobHost === "0"){
+ lineJobHost = "";
+ }
+ let isTestJobDeployed = this.state.isTestJobDeployed;
+ let isPrevJobDeployed = this.state.isPrevJobDeployed;
let service_name = $(this.refs.name).val();
let service_directory = $(this.refs.git_base).val();
let service_master = $(this.refs.master).val();
let service_host = this.state.lineHost;
let service_test_host = this.state.testHost;
let service_prev_host = this.state.prevHost;
- let deploy_directory = $(this.refs.deployDirectory).val();
+ let deploy_directory = this.state.deployDirectory;
let deploy_db = $(this.refs.onlineDb).val();
let deploy_test_db = $(this.refs.testDb).val();
let commandBeforePackage = $(this.refs.commandBeforePackage).val();
+ let udtGitDir = $(this.refs.udtGitDir).val();
if (commandBeforePackage.indexOf(";") !== -1) {
commandBeforePackage = commandBeforePackage.split(";");
} else {
@@ -311,9 +342,10 @@ class App extends Component {
if (form.checkValidity() === false) {
event.preventDefault();
event.stopPropagation();
+ this.setValidated(true);
+ return;
}
- this.setValidated(true);
-
+ this.setLoading(true);
if (this.props.location.pathname === URL.editserv_page) {
function_edit_servs(
this.state.pid,
@@ -333,9 +365,15 @@ class App extends Component {
excludeFiles,
commandBeforeDeploy,
commandAfterDeploy,
+ udtGitDir,
+ jobType,
+ lineJobHost,
+ isTestJobDeployed,
+ isPrevJobDeployed,
result => {
if (result.code === CODE.SUCCESS) {
this.props.history.push(URL.project_page + "?pid=" + this.state.pid);
+ this.setLoading(false);
}
}
);
@@ -357,9 +395,15 @@ class App extends Component {
excludeFiles,
commandBeforeDeploy,
commandAfterDeploy,
+ udtGitDir,
+ jobType,
+ lineJobHost,
+ isTestJobDeployed,
+ isPrevJobDeployed,
result => {
if (result.code === CODE.SUCCESS) {
this.props.history.push(URL.project_page + "?pid=" + this.state.pid);
+ this.setLoading(false);
}
}
);
@@ -497,6 +541,26 @@ class App extends Component {
+
+
+ job管理工具
+
+
+
+
+
+
+
+
+
+ 线上job服务器
+
+
+
+
+
部署目录
@@ -504,7 +568,9 @@ class App extends Component {
+ ref="deployDirectory"
+ value={this.state.deployDirectory}
+ onChange={event=>this.setState({deployDirectory: $(event.target).val()})} />
请填写微服务代码经过编译后,在线上服务器部署的路径
@@ -591,6 +657,20 @@ class App extends Component {
+
+
+ 环境服务器git目录
+
+
+
+
+ 请填写环境服务器git目录的路径
+
+
+
测试环境服务器
@@ -633,6 +713,15 @@ class App extends Component {
+
+
+ 测试环境job相关
+
+
+ this.setState({isTestJobDeployed: 1})} />
+ this.setState({isTestJobDeployed: 0})} />
+
+
预发布环境服务器
@@ -654,17 +743,28 @@ class App extends Component {
+
+
+ 预发布环境job相关
+
+
+ this.setState({isPrevJobDeployed: 1})} />
+ this.setState({isPrevJobDeployed: 0})} />
+
+
- - 测试环境服务器
+ - 环境服务器git目录
-
- - 要求同一个项目的所有微服务部署在同一台测试服务器上,并且微服务部署目录同线上环境一致
- - 配置多个测试环境服务器是为了允许多个测试人员同时进行多个功能在测试环境的并行部署测试
- - 由开发人员或测试人员决定使用哪一台服务器进行部署测试
-
+ 为加快发布速度,要求在测试/预发布环境的服务器上需要有对应微服务的一个git文件夹。发布时将从该服务器上的git文件夹进行分支切换和源码编译部署
+ - 测试环境服务器
+
+ - 要求同一个项目的所有微服务部署在同一台测试服务器上,并且微服务部署目录同线上环境一致
+ - 配置多个测试环境服务器是为了允许多个测试人员同时进行多个功能在测试环境的并行部署测试
+ - 由开发人员或测试人员决定使用哪一台服务器进行部署测试
+
@@ -672,8 +772,8 @@ class App extends Component {
{this.props.location.pathname === URL.addserv_page ?
- :
-
+ :
+
}
diff --git a/src/containers/task/add.js b/src/containers/task/add.js
index f50da261071374559410bdf31441adf489b8dada..beb33ceec4b20aa8fa321b46adcbc74b444d0693 100644
--- a/src/containers/task/add.js
+++ b/src/containers/task/add.js
@@ -8,7 +8,9 @@ import {
Row,
Col,
Spinner,
- Button
+ Button,
+ InputGroup,
+ FormControl,
} from 'react-bootstrap';
import queryString from 'query-string';
import $ from 'jquery';
@@ -38,12 +40,14 @@ class App extends Component {
state = {
pid: parseInt(queryString.parse(this.props.location.search).pid),
tid: parseInt(queryString.parse(this.props.location.search).tid),
+ markContent: "",
hasError: false,
errorMsg: "",
validated: false,
selectedServs: [], //需要上线的微服务
ServsBranchSt: {}, //该微服务获取分支的状态
- servsArr: {}
+ servsArr: {},
+ servsJobSt: {}
}
setValidated (validated) {
@@ -63,24 +67,51 @@ class App extends Component {
}
getTask(){
- function_get_task(this.state.pid, this.state.tid, this.props.dispatch, ()=>{
+ function_get_task(this.state.pid, this.state.tid, this.props.dispatch, (data)=>{
+ let servsJobSt = {};
let servsArr = [];
let servsArr2 = {};
for(let item of this.props.taskServs){
- servsArr.push(item.servsId);
- servsArr2[item.servsId] = item;
+ let servsId = item.servsId;
+ servsJobSt[servsId] = [];
+ let jobArr = item.jobsCommand;
+ for(let jobRow of jobArr){
+ servsJobSt[servsId].push({
+ type: jobRow.operateType,
+ name: jobRow.name,
+ script: jobRow.script == null ? "" : jobRow.script,
+ args: jobRow.args == null ? "" : jobRow.args,
+ interpreter: jobRow.interpreter == null ? "" : jobRow.interpreter,
+ });
+ }
+ servsArr.push(servsId);
+ servsArr2[servsId] = item;
}
$(this.refs.servsId).val(servsArr).trigger('change');
- $(this.refs.admin).val(this.props.admin.uid).trigger('change');
- $(this.refs.tester).val(this.props.tester.uid).trigger('change');
- this.setState({ selectedServs: servsArr, servsArr: servsArr2 });
+ this.props.admin !== null && $(this.refs.admin).val(this.props.admin.uid).trigger('change');
+ this.props.tester !== null && $(this.refs.tester).val(this.props.tester.uid).trigger('change');
+ this.setState({
+ selectedServs: servsArr,
+ servsArr: servsArr2,
+ servsJobSt
+ });
});
}
getBranches(){
let servsArr = $(this.refs.servsId).val();
+ let servsJobSt = this.state.servsJobSt;
let ServsBranchSt = {};
for (let servsId of servsArr) {
+ if(!(servsId in servsJobSt)){
+ servsJobSt[servsId] = [{
+ type: 0,
+ name: "",
+ script: "",
+ args: "",
+ interpreter: "",
+ }];
+ }
if (this.props.servsList[servsId].list.length === 0) {
ServsBranchSt[servsId] = false;
function_get_branches_by_servsid(this.props.deployUrl, servsId, this.props.dispatch, (list) => {
@@ -93,7 +124,11 @@ class App extends Component {
this.initBranchList(servsId, this.props.servsList[servsId].list);
}
}
- this.setState({ selectedServs: servsArr, ServsBranchSt: ServsBranchSt });
+ this.setState({
+ selectedServs: servsArr,
+ ServsBranchSt: ServsBranchSt,
+ servsJobSt: servsJobSt
+ });
}
listServs(cb){
@@ -116,18 +151,34 @@ class App extends Component {
for (let item of adminArr) {
data.push({ id: item.uid, text: item.nickname });
}
- $(this.refs.admin).select2({
- placeholder: "选择上线人员",
- data
- });
+ if(data.length === 0){
+ this.setState({
+ hasError: true,
+ errorMsg: "因项目未设置上线人员,无法提交测试"
+ });
+ return;
+ }else{
+ $(this.refs.admin).select2({
+ placeholder: "选择上线人员",
+ data
+ });
+ }
data = [];
for (let item of testerArr) {
data.push({ id: item.uid, text: item.nickname });
}
- $(this.refs.tester).select2({
- placeholder: "选择测试人员",
- data
- });
+ if(data.length === 0){
+ this.setState({
+ hasError: true,
+ errorMsg: "因项目未设置测试人员,无法提交测试"
+ });
+ return;
+ }else{
+ $(this.refs.tester).select2({
+ placeholder: "选择测试人员",
+ data
+ });
+ }
});
}
@@ -167,9 +218,50 @@ class App extends Component {
let realServsArr = [""];
let realBranchArr = [""];
let realSqlsArr = [""];
+ let realJobsArr = [""];
for (let servsId of servsIdArr) {
let branch = $(this.refs["servs" + servsId + "branch"]).val();
if (branch !== null && branch !== "") {
+ let jobArr = this.state.servsJobSt[servsId];
+ let realJobsRow = "";
+ for(let job of jobArr){
+ //创建job
+ if(job.type === 1){
+ if(job.name === ""){
+ this.setState({
+ hasError: true,
+ errorMsg: this.props.servsList[servsId].name + "创建job,脚本名称必填"
+ });
+ return;
+ }
+ if(job.script === ""){
+ this.setState({
+ hasError: true,
+ errorMsg: this.props.servsList[servsId].name + "创建job,脚本路径必填"
+ });
+ return;
+ }
+ if(job.interpreter === ""){
+ this.setState({
+ hasError: true,
+ errorMsg: this.props.servsList[servsId].name + "创建job,脚本解释器路径必填"
+ });
+ return;
+ }
+ }else if(job.type === 2){
+ if(job.name === ""){
+ this.setState({
+ hasError: true,
+ errorMsg: this.props.servsList[servsId].name + "重启job,脚本名称必填"
+ });
+ return;
+ }
+ }else{
+ continue;
+ }
+ realJobsRow += job.type + "|" + job.name + "|" + job.script + "|" + job.args + "|" + job.interpreter + "@@";
+ }
+ realJobsArr.push(realJobsRow);
realServsArr.push(servsId);
realBranchArr.push(branch);
let sqlInput = $(this.refs["servs" + servsId + "sqls"]);
@@ -204,14 +296,17 @@ class App extends Component {
hasError: false,
errorMsg: ""
});
+ let markContent = $(this.refs.markContent).val();
if(this.state.tid>0){
function_save_task_from_trash(
this.state.tid,
this.state.pid,
$(this.refs.title).val(),
+ markContent,
realServsArr,
realBranchArr,
realSqlsArr,
+ realJobsArr,
admin,
tester,
this.props.dispatch,
@@ -223,9 +318,11 @@ class App extends Component {
function_save_task(
this.state.pid,
$(this.refs.title).val(),
+ markContent,
realServsArr,
realBranchArr,
realSqlsArr,
+ realJobsArr,
admin,
tester,
this.props.dispatch,
@@ -250,6 +347,7 @@ class App extends Component {
let realServsArr = [""];
let realBranchArr = [""];
let realSqlsArr = [""];
+ let realJobsArr = [""];
for (let servsId of servsIdArr) {
let branch = $(this.refs["servs" + servsId + "branch"]).val();
if(this.props.servsList[servsId].targetBranch === branch){
@@ -262,6 +360,54 @@ class App extends Component {
return;
}
if (branch !== null && branch !== "") {
+ let jobArr = this.state.servsJobSt[servsId];
+ let realJobsRow = "";
+ for(let job of jobArr){
+ //创建job
+ if(job.type === 1){
+ if(job.name === ""){
+ this.setState({
+ hasError: true,
+ errorMsg: this.props.servsList[servsId].name + "创建job,脚本名称必填"
+ });
+ event.preventDefault();
+ event.stopPropagation();
+ return;
+ }
+ if(job.script === ""){
+ this.setState({
+ hasError: true,
+ errorMsg: this.props.servsList[servsId].name + "创建job,脚本路径必填"
+ });
+ event.preventDefault();
+ event.stopPropagation();
+ return;
+ }
+ if(job.interpreter === ""){
+ this.setState({
+ hasError: true,
+ errorMsg: this.props.servsList[servsId].name + "创建job,脚本解释器路径必填"
+ });
+ event.preventDefault();
+ event.stopPropagation();
+ return;
+ }
+ }else if(job.type === 2){
+ if(job.name === ""){
+ this.setState({
+ hasError: true,
+ errorMsg: this.props.servsList[servsId].name + "重启job,脚本名称必填"
+ });
+ event.preventDefault();
+ event.stopPropagation();
+ return;
+ }
+ }else{
+ continue;
+ }
+ realJobsRow += job.type + "|" + job.name + "|" + job.script + "|" + job.args + "|" + job.interpreter + "@@";
+ }
+ realJobsArr.push(realJobsRow);
realServsArr.push(servsId);
realBranchArr.push(branch);
let sqlInput = $(this.refs["servs" + servsId + "sqls"]);
@@ -317,14 +463,17 @@ class App extends Component {
event.stopPropagation();
}
this.setValidated(true);
+ let markContent = $(this.refs.markContent).val();
if(this.state.tid>0){
function_add_task_from_trash(
this.state.tid,
this.state.pid,
$(this.refs.title).val(),
+ markContent,
realServsArr,
realBranchArr,
realSqlsArr,
+ realJobsArr,
admin,
tester,
this.props.dispatch,
@@ -336,9 +485,11 @@ class App extends Component {
function_add_task(
this.state.pid,
$(this.refs.title).val(),
+ markContent,
realServsArr,
realBranchArr,
realSqlsArr,
+ realJobsArr,
admin,
tester,
this.props.dispatch,
@@ -396,12 +547,11 @@ class App extends Component {
-
{this.state.selectedServs.map(servsId => {
let item = this.props.servsList[servsId];
let config = servsId in this.state.servsArr ? this.state.servsArr[servsId] : false;
return (
-