Browse Source

Merge remote-tracking branch 'upstream/dev' into dev

20190409
pull/1/MERGE
qiaozhanwei 6 years ago
parent
commit
a0665a4954
  1. 2
      escheduler-api/src/main/java/cn/escheduler/api/controller/ProcessDefinitionController.java
  2. 7
      escheduler-api/src/main/java/cn/escheduler/api/service/ProcessDefinitionService.java
  3. 2
      escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java
  4. 2
      escheduler-server/src/main/java/cn/escheduler/server/zk/ZKMasterClient.java
  5. 2
      escheduler-ui/.env
  6. 161
      escheduler-ui/install(线上环境).sh
  7. 23
      escheduler-ui/src/font/demo_index.html
  8. 16
      escheduler-ui/src/font/iconfont.css
  9. BIN
      escheduler-ui/src/font/iconfont.eot
  10. 2
      escheduler-ui/src/font/iconfont.js
  11. 3
      escheduler-ui/src/font/iconfont.svg
  12. BIN
      escheduler-ui/src/font/iconfont.ttf
  13. BIN
      escheduler-ui/src/font/iconfont.woff
  14. BIN
      escheduler-ui/src/font/iconfont.woff2
  15. 11
      escheduler-ui/src/js/conf/home/pages/dag/_source/dag.scss
  16. 12
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue
  17. 6
      escheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/jsPlumbHandle.js
  18. 42
      escheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/util.js

2
escheduler-api/src/main/java/cn/escheduler/api/controller/ProcessDefinitionController.java

@ -127,7 +127,7 @@ public class ProcessDefinitionController extends BaseController{
logger.info("login user {}, update process define, project name: {}, process define name: {}, " +
"process_definition_json: {}, desc: {}, locations:{}, connects:{}",
loginUser.getUserName(), projectName, name, processDefinitionJson,desc, locations, connects);
Map<String, Object> result = processDefinitionService.updateProccessDefinition(loginUser, projectName, id, name,
Map<String, Object> result = processDefinitionService.updateProcessDefinition(loginUser, projectName, id, name,
processDefinitionJson, desc, locations, connects);
return returnDataList(result);
}catch (Exception e){

7
escheduler-api/src/main/java/cn/escheduler/api/service/ProcessDefinitionService.java

@ -247,9 +247,9 @@ public class ProcessDefinitionService extends BaseDAGService {
* @param connects
* @return
*/
public Map<String, Object> updateProccessDefinition(User loginUser, String projectName, int id, String name,
String processDefinitionJson, String desc,
String locations, String connects) throws JsonProcessingException {
public Map<String, Object> updateProcessDefinition(User loginUser, String projectName, int id, String name,
String processDefinitionJson, String desc,
String locations, String connects) {
Map<String, Object> result = new HashMap<>(5);
Project project = projectMapper.queryByName(projectName);
@ -284,7 +284,6 @@ public class ProcessDefinitionService extends BaseDAGService {
processDefine.setName(name);
processDefine.setReleaseState(ReleaseState.OFFLINE);
processDefine.setProjectId(project.getId());
processDefine.setUserId(loginUser.getId());
processDefine.setProcessDefinitionJson(processDefinitionJson);
processDefine.setDesc(desc);
processDefine.setLocations(locations);

2
escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java

@ -1272,7 +1272,7 @@ public class ProcessDao extends AbstractBaseDao {
return scheduleMapper.queryById(id);
}
public List<ProcessInstance> queryNeddFailoverProcessInstances(String host){
public List<ProcessInstance> queryNeedFailoverProcessInstances(String host){
return processInstanceMapper.queryByHostAndStatus(host, stateArray);
}

2
escheduler-server/src/main/java/cn/escheduler/server/zk/ZKMasterClient.java

@ -256,7 +256,7 @@ public class ZKMasterClient extends AbstractZKClient {
logger.info("start master failover ...");
List<ProcessInstance> needFailoverProcessInstanceList = processDao.queryNeddFailoverProcessInstances(masterHost);
List<ProcessInstance> needFailoverProcessInstanceList = processDao.queryNeedFailoverProcessInstances(masterHost);
//updateProcessInstance host is null and insert into command
for(ProcessInstance processInstance : needFailoverProcessInstanceList){

2
escheduler-ui/.env

@ -1,6 +1,6 @@
# 后端接口地址
API_BASE = http://192.168.xx.xx:12345
API_BASE = http://192.168.220.154:12345
# 本地开发如需ip访问项目把"#"号去掉
#DEV_HOST = 192.168.xx.xx

161
escheduler-ui/install(线上环境).sh

@ -0,0 +1,161 @@
#!/bin/bash
echo "escheduler-ui-install.sh"
# 配置前端访问端口
esc_proxy="8888"
# 配置代理后端接口
esc_proxy_port="http://192.168.220.154:12345"
# 当前路径
esc_basepath=$(cd `dirname $0`; pwd)
# 本机ip
esc_ipaddr='172.0.0.1'
esc_ipaddr=$(ip addr | awk '/^[0-9]+: / {}; /inet.*global/ {print gensub(/(.*)\/(.*)/, "\\1", "g", $2)}')
# 区分版本
version=`cat /etc/redhat-release|sed -r 's/.* ([0-9]+)\..*/\1/'`
echo "========================================================================配置信息======================================================================="
echo "前端访问端口:${esc_proxy}"
echo "后端代理接口地址:${esc_proxy_port}"
echo "静态文件地址:${esc_basepath}/dist"
echo "当前路径:${esc_basepath}"
echo "本机ip:${esc_ipaddr}"
echo "========================================================================配置信息======================================================================="
echo ""
# 创建文件并配置nginx
eschedulerConf(){
E_host='$host'
E_remote_addr='$remote_addr'
E_proxy_add_x_forwarded_for='$proxy_add_x_forwarded_for'
E_http_upgrade='$http_upgrade'
echo "
server {
listen $esc_proxy;# 访问端口
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root ${esc_basepath}/dist; # 静态文件目录
index index.html index.html;
}
location /escheduler {
proxy_pass ${esc_proxy_port}; # 接口地址
proxy_set_header Host $E_host;
proxy_set_header X-Real-IP $E_remote_addr;
proxy_set_header x_real_ipP $E_remote_addr;
proxy_set_header remote_addr $E_remote_addr;
proxy_set_header X-Forwarded-For $E_proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_connect_timeout 4s;
proxy_read_timeout 30s;
proxy_send_timeout 12s;
proxy_set_header Upgrade $E_http_upgrade;
proxy_set_header Connection "upgrade";
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
" >> /etc/nginx/conf.d/escheduler.conf
}
centos7(){
# nginx是否安装
sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
sudo yum install -y nginx
echo "nginx 安装成功"
# 配置nginx
eschedulerConf
# 解决 0.0.0.0:8888 问题
yum -y install policycoreutils-python
semanage port -a -t http_port_t -p tcp $esc_proxy
# 开放前端访问端口
firewall-cmd --zone=public --add-port=$esc_proxy/tcp --permanent
# 重启防火墙
firewall-cmd --reload
# 启动nginx
systemctl start nginx
# 调整SELinux的参数
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
# 临时生效
setenforce 0
}
centos6(){
# yum
E_basearch='$basearch'
E_releasever='$releasever'
echo "
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$E_releasever/$E_basearch/
gpgcheck=0
enabled=1
" >> /etc/yum.repos.d/nginx.repo
# install nginx
yum install nginx -y
# 配置nginx
eschedulerConf
# 防火墙
E_iptables=`lsof -i:$esc_proxy | wc -l`
if [ "$E_iptables" -gt "0" ];then
# 已开启端口防火墙重启
service iptables restart
else
# 未开启防火墙添加端口再重启
iptables -I INPUT 5 -i eth0 -p tcp --dport $esc_proxy -m state --state NEW,ESTABLISHED -j ACCEPT
service iptables save
service iptables restart
fi
# start
/etc/init.d/nginx start
# 调整SELinux的参数
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
# 临时生效
setenforce 0
}
# centos 6
if [[ $version -eq 6 ]]; then
centos6
fi
# centos 7
if [[ $version -eq 7 ]]; then
centos7
fi
echo "请浏览器访问:http://${esc_ipaddr}:${esc_proxy}"

23
escheduler-ui/src/font/demo_index.html

@ -252,6 +252,12 @@
<div class="code-name">&amp;#xe60c;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe63e;</span>
<div class="name">icon_禁止</div>
<div class="code-name">&amp;#xe63e;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6af;</span>
<div class="name">1116加载中</div>
@ -881,6 +887,15 @@
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-icon_jinzhi"></span>
<div class="name">
icon_禁止
</div>
<div class="code-name">.icon-icon_jinzhi
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-jiazaizhong"></span>
<div class="name">
@ -1575,6 +1590,14 @@
<div class="code-name">#icon-tuichufffpx</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-icon_jinzhi"></use>
</svg>
<div class="name">icon_禁止</div>
<div class="code-name">#icon-icon_jinzhi</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-jiazaizhong"></use>

16
escheduler-ui/src/font/iconfont.css

File diff suppressed because one or more lines are too long

BIN
escheduler-ui/src/font/iconfont.eot

Binary file not shown.

2
escheduler-ui/src/font/iconfont.js

File diff suppressed because one or more lines are too long

3
escheduler-ui/src/font/iconfont.svg

@ -131,6 +131,9 @@ Created by iconfont
<glyph glyph-name="tuichufffpx" unicode="&#58892;" d="M693.23046875 14.5078125zM145.3203125 14.5078125zM870.68164063 777.75zM493.98242187-9.75C301.4140625-9.75 145.3203125 146.34375 145.3203125 338.91210937000005c0 145.72265625 89.47265625 270.61523438 216.38671875 322.64648438v-0.08789063c3.77929688 1.31835938 7.82226563 2.02148438 12.04101563 2.02148438 19.86328125 0 36.12304688-16.171875 36.12304687-36.03515625 0-15.64453125-10.01953125-29.09179688-24.08203125-34.01367188-98.87695313-42.09960938-168.31054688-140.18554688-168.31054688-254.53124999 0-152.75390625 123.75-276.50390625 276.50390626-276.50390626S770.48632813 186.24609375 770.48632813 338.91210937000005c0 114.2578125-69.34570313 212.43164063-168.31054688 254.53125001-14.0625 4.921875-23.99414063 18.36914063-23.99414063 34.01367187 0 19.95117188 16.08398438 36.03515625 36.03515626 36.03515625 4.21875 0 8.17382813-0.703125 12.04101562-2.02148438v0.08789063c127.00195313-52.11914063 216.38671875-176.92382813 216.38671875-322.64648438 0-192.56835938-156.09375-348.66210938-348.66210938-348.66210937z m1e-8 372.65625c-19.86328125 0-36.03515625 16.171875-36.03515625 36.12304688V723.69726563c0 19.86328125 16.171875 36.03515625 36.03515625 36.03515624 19.95117188 0 36.03515625-16.171875 36.03515625-36.03515625V399.1171875c0-20.0390625-16.08398438-36.2109375-36.03515625-36.2109375z" horiz-adv-x="1024" />
<glyph glyph-name="icon_jinzhi" unicode="&#58942;" d="M512.26367188 777.57421875c-217.44140625 0-393.75-176.30859375-393.75000001-393.75s176.30859375-393.75 393.75000001-393.75 393.75 176.30859375 393.74999999 393.75-176.30859375 393.75-393.74999999 393.75z m-1e-8-53.96484375c84.0234375 0 161.015625-30.67382813 220.42968751-81.38671875L253.77734375 163.39453125c-50.71289063 59.4140625-81.38671875 136.40625001-81.38671875 220.4296875 0 187.3828125 152.49023438 339.78515625 339.87304688 339.78515625z m0-679.65820313c-84.0234375 0-161.015625 30.67382813-220.34179687 81.38671875l478.91601563 478.91601563c50.71289063-59.4140625 81.38671875-136.40625001 81.38671874-220.34179688-0.17578125-187.47070313-152.578125-339.9609375-339.96093749-339.9609375z" horiz-adv-x="1024" />
<glyph glyph-name="jiazaizhong" unicode="&#59055;" d="M864 416H704c-17.6 0-32-14.4-32-32s14.4-32 32-32h160c17.6 0 32 14.4 32 32s-14.4 32-32 32z m-512-32c0 17.6-14.4 32-32 32H160c-17.6 0-32-14.4-32-32s14.4-32 32-32h160c17.6 0 32 14.4 32 32z m160-160c-17.6 0-32-14.4-32-32v-160c0-17.6 14.4-32 32-32s32 14.4 32 32V192c0 17.6-14.4 32-32 32z m0 544c-17.6 0-32-14.4-32-32v-160c0-17.6 14.4-32 32-32s32 14.4 32 32V736c0 17.6-14.4 32-32 32z m138.6-304c8.8-15.4 28.4-20.6 43.8-11.8l138.6 80c15.4 8.8 20.6 28.4 11.8 43.8s-28.4 20.6-43.8 11.8l-138.6-80c-15.4-9-20.6-28.4-11.8-43.8zM373.4 304c-8.8 15.4-28.4 20.6-43.8 11.8l-138.6-80c-15.4-8.8-20.6-28.4-11.8-43.8s28.4-20.6 43.8-11.8l138.6 80c15.4 9 20.6 28.4 11.8 43.8z m262.4-70.2c-8.8 15.4-28.4 20.6-43.8 11.8s-20.6-28.4-11.8-43.8l80-138.6c8.8-15.4 28.4-20.6 43.8-11.8 15.4 8.8 20.6 28.4 11.8 43.8l-80 138.6z m-272 471c-8.8 15.4-28.4 20.6-43.8 11.8-15.4-8.8-20.6-28.4-11.8-43.8l80-138.6c8.8-15.4 28.4-20.6 43.8-11.8s20.6 28.4 11.8 43.8l-80 138.6zM592 522.6c15.4-8.8 34.8-3.6 43.8 11.8l80 138.6c8.8 15.4 3.6 34.8-11.8 43.8-15.4 8.8-34.8 3.6-43.8-11.8l-80-138.6c-8.8-15.4-3.6-35 11.8-43.8zM432 245.4c-15.4 8.8-34.8 3.6-43.8-11.8l-80-138.6c-8.8-15.4-3.6-34.8 11.8-43.8 15.4-8.8 34.8-3.6 43.8 11.8l80 138.6c8.8 15.4 3.6 35-11.8 43.8z m400.8-9.6l-138.6 80c-15.4 8.8-34.8 3.6-43.8-11.8-8.8-15.4-3.6-34.8 11.8-43.8l138.6-80c15.4-8.8 34.8-3.6 43.8 11.8 8.8 15.4 3.6 34.8-11.8 43.8zM191.2 532.2l138.6-80c15.4-8.8 34.8-3.6 43.8 11.8s3.6 34.8-11.8 43.8l-138.6 80c-15.4 8.8-34.8 3.6-43.8-11.8-8.8-15.4-3.6-34.8 11.8-43.8z" horiz-adv-x="1024" />

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 122 KiB

BIN
escheduler-ui/src/font/iconfont.ttf

Binary file not shown.

BIN
escheduler-ui/src/font/iconfont.woff

Binary file not shown.

BIN
escheduler-ui/src/font/iconfont.woff2

Binary file not shown.

11
escheduler-ui/src/js/conf/home/pages/dag/_source/dag.scss

@ -391,6 +391,17 @@ svg path:hover {
text-align: center;
margin-left: -100px;
}
.ban-p {
position: absolute;
left: -4px;
top: 36px;
z-index: 21;
i {
font-size: 18px;
color: #ff0000;
cursor: pointer;
}
}
.state-p {
width: 20px;
height: 20px;

12
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue

@ -178,7 +178,7 @@
import mShell from './tasks/shell'
import mSpark from './tasks/spark'
import mPython from './tasks/python'
import { isNameExDag } from './../plugIn/util'
import { isNameExDag,rtBantpl } from './../plugIn/util'
import JSP from './../plugIn/jsPlumbHandle'
import mProcedure from './tasks/procedure'
import mDependent from './tasks/dependent'
@ -383,7 +383,15 @@
})
}
},
watch: {},
watch: {
runFlag(val){
let dom = $(`#${this.id}`).find('.ban-p')
dom.html('')
if (val === 'FORBIDDEN') {
dom.append(rtBantpl())
}
}
},
created () {
// Unbind copy and paste events
JSP.removePaste()

6
escheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/jsPlumbHandle.js

@ -192,9 +192,13 @@ JSP.prototype.jsonHandle = function ({ largeJson, locations }) {
y: locations[v.id]['y'],
targetarr: locations[v.id]['targetarr'],
isAttachment: this.config.isAttachment,
taskType: v.type
taskType: v.type,
runFlag:v.runFlag
}))
// ban icon
console.log($(`#${v.id}`).html())
// contextmenu event
$(`#${v.id}`).on('contextmenu', e => {
this.tasksContextmenu(e)

42
escheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/util.js

@ -17,10 +17,11 @@
import _ from 'lodash'
import $ from 'jquery'
import i18n from '@/module/i18n'
import store from '@/conf/home/store'
/**
* 节点,转数组
* Node, to array
*/
const rtTargetarrArr = (id) => {
let a = $(`#${id}`).attr('data-targetarr')
@ -28,7 +29,7 @@ const rtTargetarrArr = (id) => {
}
/**
* 存储节点id到targetarr
* Store node id to targetarr
*/
const saveTargetarr = (valId, domId) => {
let $target = $(`#${domId}`)
@ -36,24 +37,34 @@ const saveTargetarr = (valId, domId) => {
$target.attr('data-targetarr', targetStr)
}
const rtBantpl = () => {
return `<i class="iconfont" data-toggle="tooltip" data-html="true" data-container="body" data-placement="left" title="${i18n.$t('禁止执行')}">&#xe63e;</i>`
}
/**
* 返回节点html
* return node html
*/
const rtTasksTpl = ({ id, name, x, y, targetarr, isAttachment, taskType }) => {
const rtTasksTpl = ({ id, name, x, y, targetarr, isAttachment, taskType,runFlag }) => {
let tpl = ``
tpl += `<div class="w jtk-draggable jtk-droppable jtk-endpoint-anchor jtk-connected ${isAttachment ? 'jtk-ep' : ''}" data-targetarr="${targetarr || ''}" data-tasks-type="${taskType}" id="${id}" style="left: ${x}px; top: ${y}px;">`
tpl += `<div>`
tpl += `<div class="state-p"></div>`
tpl += `<div class="icos icos-${taskType}"></div>`
tpl += `<span class="name-p">${name}</span>`
tpl += `<div class="state-p"></div>`
tpl += `<div class="icos icos-${taskType}"></div>`
tpl += `<span class="name-p">${name}</span>`
tpl += `</div>`
tpl += `<div class="ep"></div>`
tpl += `<div class="ban-p">`
if (runFlag === 'FORBIDDEN') {
tpl += rtBantpl()
}
tpl += `</div>`
tpl += `</div>`
return tpl
}
/**
* 获取所有tasks节点
* Get all tasks nodes
*/
const tasksAll = () => {
let a = []
@ -71,8 +82,8 @@ const tasksAll = () => {
}
/**
* 判断 name 是否在当前的dag图中
* rely dom / backfill dom元素 回填
* Determine if name is in the current dag map
* rely dom / backfill
*/
const isNameExDag = (name, rely) => {
if (rely === 'dom') {
@ -83,17 +94,17 @@ const isNameExDag = (name, rely) => {
}
/**
* 更改svg线条颜色
* Change svg line color
*/
const setSvgColor = (e, color) => {
// 遍历 清除所有颜色
// Traverse clear all colors
$('.jtk-connector').each((i, o) => {
_.map($(o)[0].childNodes, v => {
$(v).attr('fill', '#555').attr('stroke', '#555').attr('stroke-width', 2)
})
})
// 给选择的添加颜色
// Add color to the selection
_.map($(e.canvas)[0].childNodes, (v, i) => {
$(v).attr('fill', color).attr('stroke', color)
if ($(v).attr('class')) {
@ -103,7 +114,7 @@ const setSvgColor = (e, color) => {
}
/**
* 获取所有节点id
* Get all node ids
*/
const allNodesId = () => {
let idArr = []
@ -127,5 +138,6 @@ export {
tasksAll,
isNameExDag,
setSvgColor,
allNodesId
allNodesId,
rtBantpl
}

Loading…
Cancel
Save