From e63b63aa6037c2b5406f6d96ec78ad3ba35fe745 Mon Sep 17 00:00:00 2001
From: mustafa
Date: Sat, 15 Feb 2020 09:58:52 +0800
Subject: [PATCH 1/2] test
---
docker/Dockerfile | 3 -
docker/client.onlinetool.fanghailiang.cn.conf | 11 ---
docker/push.sh | 10 ---
package-lock.json | 76 ++++++++++++++-----
src/actions/deploy.js | 12 ++-
src/actions/member.js | 11 ++-
src/actions/project.js | 2 +
src/actions/task.js | 1 +
src/components/deploy/addDbConnector.js | 19 +++--
src/components/deploy/addhost.js | 14 ++--
src/components/team/install.js | 11 ++-
src/config/index.js | 4 +
src/containers/member/addMember.js | 10 ++-
src/containers/servs/add.js | 15 +++-
src/containers/task/add.js | 70 +++++++++++++----
src/containers/task/detail.js | 13 +++-
src/containers/team/databases.js | 5 +-
src/containers/team/download.js | 64 ++++++----------
src/containers/team/hosts.js | 6 +-
src/containers/team/setting.js | 2 +-
src/reducers/tasks.js | 2 +
21 files changed, 225 insertions(+), 136 deletions(-)
delete mode 100644 docker/Dockerfile
delete mode 100644 docker/client.onlinetool.fanghailiang.cn.conf
delete mode 100755 docker/push.sh
diff --git a/docker/Dockerfile b/docker/Dockerfile
deleted file mode 100644
index d201ad6..0000000
--- 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 fbccb9e..0000000
--- 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 309bcc4..0000000
--- 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 a21d4fc..0191488 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 88a54b9..267aa3d 100644
--- a/src/actions/deploy.js
+++ b/src/actions/deploy.js
@@ -321,10 +321,11 @@ 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, admin, tester, dispatch, cb) {
MyAjax(API_URL.saveMergeRequest, {
projectId,
title,
+ mark,
servsId,
branch,
sqls,
@@ -337,10 +338,11 @@ 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, admin, tester, dispatch, cb) {
MyAjax(API_URL.addMergeRequest, {
projectId,
title,
+ mark,
servsId,
branch,
sqls,
@@ -353,11 +355,12 @@ 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, admin, tester, dispatch, cb) {
MyAjax(API_URL.saveMergeRequestFromTrash, {
taskId,
projectId,
title,
+ mark,
servsId,
branch,
sqls,
@@ -370,11 +373,12 @@ 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, admin, tester, dispatch, cb) {
MyAjax(API_URL.addMergeRequestFromTrash, {
taskId,
projectId,
title,
+ mark,
servsId,
branch,
sqls,
diff --git a/src/actions/member.js b/src/actions/member.js
index 1253ef0..efca5db 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 d976fc1..152b214 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/task.js b/src/actions/task.js
index d9cfd84..aa5ac7b 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 89da301..9e01c53 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 5c11d2b..894c722 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 fd680d9..8f9bed5 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 80da48f..5b4db8f 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",
diff --git a/src/containers/member/addMember.js b/src/containers/member/addMember.js
index ab3ff89..e43381d 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 dddb964..ea9ad19 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,
@@ -106,7 +107,10 @@ class App extends Component {
this.initDbConnectors();
this.initRoles();
}
+ }
+ setLoading(loadingFlg){
+ this.setState({isLoading: loadingFlg});
}
initHosts(){
@@ -311,9 +315,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,
@@ -336,6 +341,7 @@ class App extends Component {
result => {
if (result.code === CODE.SUCCESS) {
this.props.history.push(URL.project_page + "?pid=" + this.state.pid);
+ this.setLoading(false);
}
}
);
@@ -360,6 +366,7 @@ class App extends Component {
result => {
if (result.code === CODE.SUCCESS) {
this.props.history.push(URL.project_page + "?pid=" + this.state.pid);
+ this.setLoading(false);
}
}
);
@@ -672,8 +679,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 f50da26..f68dc2a 100644
--- a/src/containers/task/add.js
+++ b/src/containers/task/add.js
@@ -38,6 +38,7 @@ 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,
@@ -63,7 +64,7 @@ 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 servsArr = [];
let servsArr2 = {};
for(let item of this.props.taskServs){
@@ -71,9 +72,9 @@ class App extends Component {
servsArr2[item.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});
});
}
@@ -116,18 +117,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
+ });
+ }
});
}
@@ -204,11 +221,13 @@ 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,
@@ -223,6 +242,7 @@ class App extends Component {
function_save_task(
this.state.pid,
$(this.refs.title).val(),
+ markContent,
realServsArr,
realBranchArr,
realSqlsArr,
@@ -317,11 +337,13 @@ 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,
@@ -336,6 +358,7 @@ class App extends Component {
function_add_task(
this.state.pid,
$(this.refs.title).val(),
+ markContent,
realServsArr,
realBranchArr,
realSqlsArr,
@@ -413,7 +436,6 @@ class App extends Component {
: }
- {item.lineDb !== "" ?
需要执行的sql语句
@@ -426,12 +448,29 @@ class App extends Component {
rows="5"
className="textarea-code"
defaultValue={config ? config.sqls.join(";\n") :""} />
+ { item.lineDb === "" ?
+
+ 由于项目管理员未配置该微服务的线上数据库,上线时需提醒上线人员手动执行以上sql语句
+
+ : null }
- : null}
)
})}
+
+
+ 备注信息
+
+
+
+
+
测试人员
@@ -456,7 +495,7 @@ class App extends Component {
:
-
+ {!this.state.hasError ? : null}
)
:null}
@@ -488,6 +527,7 @@ function mapStateToProps (state) {
return {
myuid: state.account.uid,
taskName: state.tasks.taskName,
+ markContent: state.tasks.markContent,
deployStatus: state.tasks.deployStatus,
admin: state.tasks.admin,
tester: state.tasks.tester,
diff --git a/src/containers/task/detail.js b/src/containers/task/detail.js
index de19cd3..f28fba3 100644
--- a/src/containers/task/detail.js
+++ b/src/containers/task/detail.js
@@ -267,6 +267,10 @@ class App extends Component {
所属项目
{this.state.projectName}
+
+ 备注信息
+ {this.props.markContent}
+
{this.props.taskServs.map(item =>
@@ -366,10 +370,10 @@ class App extends Component {
{this.props.deployStatus === TaskStatus.DEPLOY_SUCCESS ? 上线成功
: null}
- {this.props.deployStatus === TaskStatus.WAIT_FOR_TEST && this.props.taskServs[0].servsObject.testHost.length === 0 ?
+ {this.props.deployStatus === TaskStatus.WAIT_FOR_TEST && (this.props.taskServs[0].servsObject.testHost == null || this.props.taskServs[0].servsObject.testHost.length === 0) ?
: null}
- {this.props.deployStatus === TaskStatus.TEST_FAILED && this.props.taskServs[0].servsObject.testHost.length === 0 ?
+ {this.props.deployStatus === TaskStatus.TEST_FAILED && (this.props.taskServs[0].servsObject.testHost == null || this.props.taskServs[0].servsObject.testHost.length === 0) ?
: null}
{this.props.deployStatus === TaskStatus.WAIT_FOR_DEPLOY || this.props.deployStatus === TaskStatus.PRE_TESTING_SUCCESS ?
@@ -384,7 +388,7 @@ class App extends Component {
- {(this.props.deployStatus === TaskStatus.WAIT_FOR_TEST || this.props.deployStatus === TaskStatus.TESTING || this.props.deployStatus === TaskStatus.TEST_FAILED) && this.props.taskServs[0].servsObject.testHost.length > 0 ?
+ {(this.props.deployStatus === TaskStatus.WAIT_FOR_TEST || this.props.deployStatus === TaskStatus.TESTING || this.props.deployStatus === TaskStatus.TEST_FAILED) && this.props.taskServs[0].servsObject.testHost != null && this.props.taskServs[0].servsObject.testHost.length > 0 ?
@@ -424,7 +428,7 @@ class App extends Component {
: null}
: null}
- {(this.props.deployStatus === TaskStatus.WAIT_FOR_DEPLOY || this.props.deployStatus === TaskStatus.PRE_TESTING || this.props.deployStatus === TaskStatus.PRE_TESTING_FAIL) && this.props.taskServs[0].servsObject.prevHost.length > 0 ?
+ {(this.props.deployStatus === TaskStatus.WAIT_FOR_DEPLOY || this.props.deployStatus === TaskStatus.PRE_TESTING || this.props.deployStatus === TaskStatus.PRE_TESTING_FAIL) && this.props.taskServs[0].servsObject.prevHost != null && this.props.taskServs[0].servsObject.prevHost.length > 0 ?
@@ -486,6 +490,7 @@ function mapStateToProps (state) {
return {
deployUrl: state.deploy.deployUrl,
taskName: state.tasks.taskName,
+ markContent: state.tasks.markContent,
deployStatus: state.tasks.deployStatus,
taskServs: state.tasks.serversList,
admin: state.tasks.admin,
diff --git a/src/containers/team/databases.js b/src/containers/team/databases.js
index 9582c9b..8042dc4 100644
--- a/src/containers/team/databases.js
+++ b/src/containers/team/databases.js
@@ -172,8 +172,8 @@ class App extends Component {
:
-
- 重要:务必确保从{this.props.deployHost}服务器上能够连接到或通过ssh通道连接到该数据库
+
+ { "注意:数据库连接信息保存在 "+this.props.deployHost+" 服务器上的 /usr/local/onlinetool/config 文件中,部署时将从该服务器连接到您配置的数据库" }
}
@@ -236,6 +236,7 @@ class App extends Component {
function mapStateToProps (state) {
return {
deployUrl: state.deploy.deployUrl,
+ deployHost: state.deploy.deployHost,
canDeployConnect: state.deploy.canDeployConnect,
projectList: state.project,
dbconnectors: state.deploy.dbconnectors,
diff --git a/src/containers/team/download.js b/src/containers/team/download.js
index 8714820..d4d3b55 100644
--- a/src/containers/team/download.js
+++ b/src/containers/team/download.js
@@ -3,7 +3,10 @@ import { connect } from 'react-redux';
import { Form, Button } from 'react-bootstrap';
import $ from 'jquery';
-import { PRODUCT_NAME, URL } from '../../config';
+import {
+ PRODUCT_NAME,
+ GITEE_URL
+} from '../../config';
import { function_set_deploy_url } from '../../actions/deploy';
import InstallClient from '../../components/team/install';
@@ -20,9 +23,13 @@ class App extends Component {
handleSubmit () {
let ip = $(this.refs.ip).val();
- function_set_deploy_url(ip, this.state.port, this.props.dispatch, function () {
- this.props.history.push(URL.main_page);
- }.bind(this));
+ if(ip === ""){
+ alert("设置失败");
+ return;
+ }
+ function_set_deploy_url(ip, this.state.port, this.props.dispatch, () => {
+ alert("设置成功");
+ });
}
render () {
@@ -62,65 +69,40 @@ class App extends Component {
不会在预发布环境添加定时任务也不会在预发布环境上线任何与job相关的内容
关于您团队项目相关的敏感信息
- 流刀上线工具需要的隐私信息包括如下:
+ 流刀上线工具为完成上线流程需要的隐私信息包括如下:
-
测试环境/预发布环境/线上环境的服务器连接
-
由于需要将您上线单中的相关微服务部署到测试/预发布/线上环境,因而需要您这些环境的服务器连接信息是必不可少的您提供的用于服务器连接的账号最低权限如下:
-
- -
-
在运行上线工具的服务器上,需要对各微服务git仓库所在目录有读写权限,对项目所有微服务git的主分支有合并分支的权限
-
- -
-
在测试环境/预发布环境/线上环境的服务器上,需要有相关微服务所在目录的读写权限
-
-
+ 该服务器连接需要的最低权限为对使用该连接的微服务在部署目录、git目录有读写权限
-
测试环境/线上环境的数据库连接(非必须)
-
若您需要使用上线工具自动帮您在测试环境和线上环境建表,则必须提供测试环境/线上环境的数据库连接信息,该连接账号需要的最低权限如下:
-
- -
-
创建数据库
-
- -
-
创建表
-
- -
-
修改表字段
-
-
+ 最低权限为对使用该数据库连接的微服务,其使用的数据库有表结构相关的修改权限
- 我们不会上传这些敏感信息!!!
- 我们不会上传这些敏感信息!!!
- 我们不会上传这些敏感信息!!!
- 我们需要在您集群的某台服务器上,运行我们的客户端工具,将这些敏感信息保存在该服务器上
- 我们会使用该客户端工具完成各个环境的项目部署流程,我们不需要访问您的客户端工具,但要求您的项目组成员能够访问该客户端工具
- 无法通过客户端工具获得这些敏感信息!!!
- 无法通过客户端工具获得这些敏感信息!!!
- 无法通过客户端工具获得这些敏感信息!!!
+ 服务器连接信息和数据库连接信息保存在您自己内网的服务器上,我们不会也无法读取您的这些敏感信息。但我们需要您在您内网的服务器上安装我们的客户端工具,由它来辅助我们完成上线流程。
+
在这里填写团队成员可访问的该服务器ip或域名
+ 填写 您团队成员 访问该服务器ip或域名,如做了端口转发,需要填写您给客户端工具开放的端口号。
-
+
this.setState({ port: event.target.value })} ref="port" />
项目gitee地址:码云
+ >传送门
如果觉得好,不要吝啬给个star哦,如果有任何问题,可以提
- issues,
- 当然,也欢迎您提交merge request
+ issues,
+ 当然,也欢迎您提交merge request
)
}
diff --git a/src/containers/team/hosts.js b/src/containers/team/hosts.js
index 22a1dcb..89f7137 100644
--- a/src/containers/team/hosts.js
+++ b/src/containers/team/hosts.js
@@ -169,9 +169,9 @@ class App extends Component {
:
-
- 重要:务必确保从{this.props.deployHost}服务器上能够连接到该服务器
-
+
+ { "注意:服务器连接信息保存在 "+this.props.deployHost+" 服务器上的 /usr/local/onlinetool/config 文件中,部署时将从该服务器连接到您配置的服务器" }
+
}
diff --git a/src/containers/team/setting.js b/src/containers/team/setting.js
index abb0733..fe555e3 100644
--- a/src/containers/team/setting.js
+++ b/src/containers/team/setting.js
@@ -123,7 +123,7 @@ class App extends Component {
如何迁移服务器?
- 将原服务器上的/usr/local/onlinetool文件夹打包迁移到另一台服务器对应文件下,在按下面的方式安装客户端工具,安装完成后在行修改客户端地址即可
+ 将原服务器上的 /usr/local/onlinetool 文件夹打包迁移到另一台服务器对应文件下(最好删除/usr/local/onlinetool/reponsitory/下的内容,在新服务器上重新clone各个微服务的代码),按下面的方式在新服务器上安装客户端工具,安装完成后修改上面的客户端地址
diff --git a/src/reducers/tasks.js b/src/reducers/tasks.js
index a149776..d40b25f 100644
--- a/src/reducers/tasks.js
+++ b/src/reducers/tasks.js
@@ -13,6 +13,7 @@ function tasks (state = {
taskId: 0,
projectName: "",
taskName: "",
+ markContent: "",
testHost: null,
prevHost: null,
admin: {},
@@ -32,6 +33,7 @@ function tasks (state = {
testHost: action.testHost,
prevHost: action.prevHost,
serversList: action.serversList,
+ markContent: action.markContent,
admin: action.admin,
tester: action.tester,
developer: action.developer
--
Gitee
From 82f62cd61786c688dc77bc95c099be4b398af851 Mon Sep 17 00:00:00 2001
From: mustafa
Date: Mon, 17 Feb 2020 12:25:15 +0800
Subject: [PATCH 2/2] 200213
---
src/actions/deploy.js | 25 ++-
src/actions/servs.js | 24 ++-
src/config/index.js | 1 +
src/containers/servs/add.js | 123 +++++++++++--
src/containers/task/add.js | 259 ++++++++++++++++++++++++++-
src/containers/task/detail.js | 24 ++-
src/containers/task/less/add.css | 3 +
src/containers/task/less/add.less | 3 +
src/containers/task/less/detail.css | 3 +
src/containers/task/less/detail.less | 1 +
10 files changed, 436 insertions(+), 30 deletions(-)
diff --git a/src/actions/deploy.js b/src/actions/deploy.js
index 267aa3d..e866a1f 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,7 +334,7 @@ export function function_get_branches_by_servsid (deployUrl, servsid, dispatch,
});
}
-export function function_save_task (projectId, title, mark, 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,
@@ -329,6 +342,7 @@ export function function_save_task (projectId, title, mark, servsId, branch, sql
servsId,
branch,
sqls,
+ jobs,
admin,
tester
}, function (result) {
@@ -338,7 +352,7 @@ export function function_save_task (projectId, title, mark, servsId, branch, sql
})
}
-export function function_add_task (projectId, title, mark, 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,
@@ -346,6 +360,7 @@ export function function_add_task (projectId, title, mark, servsId, branch, sqls
servsId,
branch,
sqls,
+ jobs,
admin,
tester
}, function (result) {
@@ -355,7 +370,7 @@ export function function_add_task (projectId, title, mark, servsId, branch, sqls
})
}
-export function function_save_task_from_trash (taskId, projectId, title, mark, 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,
@@ -364,6 +379,7 @@ export function function_save_task_from_trash (taskId, projectId, title, mark, s
servsId,
branch,
sqls,
+ jobs,
admin,
tester
}, function (result) {
@@ -373,7 +389,7 @@ export function function_save_task_from_trash (taskId, projectId, title, mark, s
})
}
-export function function_add_task_from_trash (taskId, projectId, title, mark, 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,
@@ -382,6 +398,7 @@ export function function_add_task_from_trash (taskId, projectId, title, mark, se
servsId,
branch,
sqls,
+ jobs,
admin,
tester
}, function (result) {
diff --git a/src/actions/servs.js b/src/actions/servs.js
index 5e6bd2c..62e62c4 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/config/index.js b/src/config/index.js
index 5b4db8f..c26124b 100644
--- a/src/config/index.js
+++ b/src/config/index.js
@@ -79,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/servs/add.js b/src/containers/servs/add.js
index ea9ad19..bdcf25f 100644
--- a/src/containers/servs/add.js
+++ b/src/containers/servs/add.js
@@ -54,6 +54,10 @@ class App extends Component {
lineHost: [],
testHost: [],
prevHost: [],
+ lineJobHost: "",
+ isTestJobDeployed: 1,
+ isPrevJobDeployed: 0,
+ deployDirectory: "",
lineDb: "",
testDb: "",
activeTab: "basic",
@@ -64,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({
@@ -88,20 +94,20 @@ 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();
@@ -109,6 +115,19 @@ class App extends Component {
}
}
+ 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});
}
@@ -253,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 {
@@ -338,6 +365,11 @@ 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);
@@ -363,6 +395,11 @@ 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);
@@ -504,6 +541,26 @@ class App extends Component {
+
+
+ job管理工具
+
+
+
+
+
+
+
+
+
+ 线上job服务器
+
+
+
+
+
部署目录
@@ -511,7 +568,9 @@ class App extends Component {
+ ref="deployDirectory"
+ value={this.state.deployDirectory}
+ onChange={event=>this.setState({deployDirectory: $(event.target).val()})} />
请填写微服务代码经过编译后,在线上服务器部署的路径
@@ -598,6 +657,20 @@ class App extends Component {
+
+
+ 环境服务器git目录
+
+
+
+
+ 请填写环境服务器git目录的路径
+
+
+
测试环境服务器
@@ -640,6 +713,15 @@ class App extends Component {
+
+
+ 测试环境job相关
+
+
+ this.setState({isTestJobDeployed: 1})} />
+ this.setState({isTestJobDeployed: 0})} />
+
+
预发布环境服务器
@@ -661,17 +743,28 @@ class App extends Component {
+
+
+ 预发布环境job相关
+
+
+ this.setState({isPrevJobDeployed: 1})} />
+ this.setState({isPrevJobDeployed: 0})} />
+
+
- - 测试环境服务器
+ - 环境服务器git目录
-
- - 要求同一个项目的所有微服务部署在同一台测试服务器上,并且微服务部署目录同线上环境一致
- - 配置多个测试环境服务器是为了允许多个测试人员同时进行多个功能在测试环境的并行部署测试
- - 由开发人员或测试人员决定使用哪一台服务器进行部署测试
-
+ 为加快发布速度,要求在测试/预发布环境的服务器上需要有对应微服务的一个git文件夹。发布时将从该服务器上的git文件夹进行分支切换和源码编译部署
+ 测试环境服务器
+
+ - 要求同一个项目的所有微服务部署在同一台测试服务器上,并且微服务部署目录同线上环境一致
+ - 配置多个测试环境服务器是为了允许多个测试人员同时进行多个功能在测试环境的并行部署测试
+ - 由开发人员或测试人员决定使用哪一台服务器进行部署测试
+
diff --git a/src/containers/task/add.js b/src/containers/task/add.js
index f68dc2a..beb33ce 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';
@@ -44,7 +46,8 @@ class App extends Component {
validated: false,
selectedServs: [], //需要上线的微服务
ServsBranchSt: {}, //该微服务获取分支的状态
- servsArr: {}
+ servsArr: {},
+ servsJobSt: {}
}
setValidated (validated) {
@@ -65,23 +68,50 @@ class App extends Component {
getTask(){
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.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});
+ 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) => {
@@ -94,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){
@@ -184,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"]);
@@ -231,6 +306,7 @@ class App extends Component {
realServsArr,
realBranchArr,
realSqlsArr,
+ realJobsArr,
admin,
tester,
this.props.dispatch,
@@ -246,6 +322,7 @@ class App extends Component {
realServsArr,
realBranchArr,
realSqlsArr,
+ realJobsArr,
admin,
tester,
this.props.dispatch,
@@ -270,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){
@@ -282,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"]);
@@ -347,6 +473,7 @@ class App extends Component {
realServsArr,
realBranchArr,
realSqlsArr,
+ realJobsArr,
admin,
tester,
this.props.dispatch,
@@ -362,6 +489,7 @@ class App extends Component {
realServsArr,
realBranchArr,
realSqlsArr,
+ realJobsArr,
admin,
tester,
this.props.dispatch,
@@ -419,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 (
-