Commit 9b710f39 authored by baoliang's avatar baoliang
Browse files

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

parents c2f8e8ef 0c42d076
Loading
Loading
Loading
Loading
+60 −0
Original line number Diff line number Diff line
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cn.escheduler.api.dto;

import cn.escheduler.common.enums.ExecutionStatus;

/**
 * command state count
 */
public class CommandStateCount {

    private int errorCount;
    private int normalCount;
    private ExecutionStatus commandState;

    public CommandStateCount(){}
    public CommandStateCount(int errorCount, int normalCount, ExecutionStatus commandState) {
        this.errorCount = errorCount;
        this.normalCount = normalCount;
        this.commandState = commandState;
    }

    public int getErrorCount() {
        return errorCount;
    }

    public void setErrorCount(int errorCount) {
        this.errorCount = errorCount;
    }

    public int getNormalCount() {
        return normalCount;
    }

    public void setNormalCount(int normalCount) {
        this.normalCount = normalCount;
    }

    public ExecutionStatus getCommandState() {
        return commandState;
    }

    public void setCommandState(ExecutionStatus commandState) {
        this.commandState = commandState;
    }
}
+23 −7
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package cn.escheduler.api.service;


import cn.escheduler.api.dto.CommandStateCount;
import cn.escheduler.api.dto.DefineUserDto;
import cn.escheduler.api.dto.TaskCountDto;
import cn.escheduler.api.enums.Status;
@@ -38,10 +39,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.MessageFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;

/**
 * data analysis service
@@ -298,7 +296,16 @@ public class DataAnalysisService {
            dataMap.put(errorExecutionStatus.getExecutionStatus(),errorCommandStateCountsMap);
        }

        result.put(Constants.DATA_LIST, dataMap);
        List<CommandStateCount> list = new ArrayList<>();
        Iterator<Map.Entry<ExecutionStatus, Map<String, Integer>>> iterator = dataMap.entrySet().iterator();
        while (iterator.hasNext()){
            Map.Entry<ExecutionStatus, Map<String, Integer>> next = iterator.next();
            CommandStateCount commandStateCount = new CommandStateCount(next.getValue().get("errorCommandState"),
                    next.getValue().get("commandState"),next.getKey());
            list.add(commandStateCount);
        }

        result.put(Constants.DATA_LIST, list);
        putMsg(result, Status.SUCCESS);
        return  result;
    }
@@ -356,9 +363,18 @@ public class DataAnalysisService {
                }
            }
        }
        Integer taskQueueCount = 0;
        Integer taskKillCount = 0;

        if (tasksQueueIds.length != 0){
            taskQueueCount = taskInstanceMapper.countTask(loginUser.getId(),loginUser.getUserType(),projectId, tasksQueueIds);
        }

        if (tasksQueueIds.length != 0){
            taskKillCount = taskInstanceMapper.countTask(loginUser.getId(),loginUser.getUserType(),projectId, tasksQueueIds);
        }


        Integer taskQueueCount = taskInstanceMapper.countTask(loginUser.getId(),loginUser.getUserType(),projectId, tasksQueueIds);
        Integer taskKillCount = taskInstanceMapper.countTask(loginUser.getId(),loginUser.getUserType(),projectId, tasksQueueIds);

        dataMap.put("taskQueue",taskQueueCount);
        dataMap.put("taskKill",taskKillCount);
+36 −2
Original line number Diff line number Diff line
@@ -27,6 +27,20 @@
        </div>
      </div>
    </m-list-box>
    <template v-if="!sqlType && showType.length">
      <m-list-box>
        <div slot="text">收件人</div>
        <div slot="content">
          <m-email v-model="receivers" :repeat-data="receiversCc"></m-email>
        </div>
      </m-list-box>
      <m-list-box>
        <div slot="text">抄送人</div>
        <div slot="content">
          <m-email v-model="receiversCc" :repeat-data="receivers"></m-email>
        </div>
      </m-list-box>
    </template>
    <m-list-box v-show="type === 'HIVE'">
      <div slot="text">{{$t('SQL Parameter')}}</div>
      <div slot="content">
@@ -83,6 +97,7 @@
  import mDatasource from './_source/datasource'
  import mLocalParams from './_source/localParams'
  import disabledState from '@/module/mixin/disabledState'
  import mEmail from '@/conf/home/pages/projects/pages/definition/pages/list/_source/email'
  import codemirror from '@/conf/home/pages/resource/pages/file/pages/_source/codemirror'

  let editor
@@ -108,7 +123,11 @@
        // Form/attachment
        showType: ['TABLE'],
        // Sql parameter
        connParams: ''
        connParams: '',
        // recipients
        receivers: [],
        // copy to
        receiversCc: []
      }
    },
    mixins: [disabledState],
@@ -174,6 +193,8 @@
          sql: editor.getValue(),
          udfs: this.udfs,
          sqlType: this.sqlType,
          receivers: this.receivers.join(','),
          receiversCc: this.receiversCc.join(','),
          showType: (() => {
            /**
             * Special processing return order TABLE,ATTACHMENT
@@ -223,12 +244,23 @@
        if (val) {
          this.showType = []
        }
        if (val !== 0) {
          this.receivers = []
          this.receiversCc = []
        }
      },
      // Listening data source
      type (val) {
        if (val !== 'HIVE') {
          this.connParams = ''
        }
      },
      //
      showType (val) {
        if (!val.length) {
          this.receivers = []
          this.receiversCc = []
        }
      }
    },
    created () {
@@ -245,6 +277,8 @@
        this.connParams = o.params.connParams || ''
        this.localParams = o.params.localParams || []
        this.showType = o.params.showType.split(',') || []
        this.receivers = o.params.receivers && o.params.receivers.split(',') || []
        this.receiversCc = o.params.receiversCc && o.params.receiversCc.split(',') || []
      }
    },
    mounted () {
@@ -262,6 +296,6 @@
      }
    },
    computed: {},
    components: { mListBox, mDatasource, mLocalParams, mUdfs, mSqlType }
    components: { mListBox, mDatasource, mLocalParams, mUdfs, mSqlType, mEmail }
  }
</script>
+121 −0
Original line number Diff line number Diff line
export default {
  series: [
    {
      type: 'gauge',
      center: ['50%', '45%'], // 仪表位置
      radius: '80%', // 仪表大小
      startAngle: 200, // 开始角度
      endAngle: -20, // 结束角度
      axisLine: {
        show: false,
        lineStyle: { // 属性lineStyle控制线条样式
          color: [
            [ 0.5, new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ // eslint-disable-line
              offset: 1,
              color: '#E75F25' // 50% 处的颜色
            }, {
              offset: 0.8,
              color: '#D9452C' // 40% 处的颜色
            }], false) ], // 100% 处的颜色
            [ 0.7, new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ // eslint-disable-line
              offset: 1,
              color: '#FFC539' // 70% 处的颜色
            }, {
              offset: 0.8,
              color: '#FE951E' // 66% 处的颜色
            }, {
              offset: 0,
              color: '#E75F25' // 50% 处的颜色
            }], false) ],
            [ 0.9, new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ // eslint-disable-line
              offset: 1,
              color: '#C7DD6B' // 90% 处的颜色
            }, {
              offset: 0.8,
              color: '#FEEC49' // 86% 处的颜色
            }, {
              offset: 0,
              color: '#FFC539' // 70% 处的颜色
            }], false) ],
            [1, new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { // eslint-disable-line
              offset: 0.2,
              color: '#1CAD52' // 92% 处的颜色
            }, {
              offset: 0,
              color: '#C7DD6B' // 90% 处的颜色
            }], false) ]
          ],
          width: 10
        }
      },
      splitLine: {
        show: false
      },
      axisTick: {
        show: false
      },
      axisLabel: {
        show: false
      },
      pointer: { // 指针样式
        length: '45%'
      },
      detail: {
        show: false
      }
    },
    {
      type: 'gauge',
      center: ['50%', '45%'], // 默认全局居中
      radius: '70%',
      startAngle: 200,
      endAngle: -20,
      axisLine: {
        show: true,
        lineStyle: { // 属性lineStyle控制线条样式
          color: [ // 表盘颜色
            [ 0.5, '#DA462C' ], // 0-50%处的颜色
            [ 0.7, '#FF9618' ], // 51%-70%处的颜色
            [ 0.9, '#FFED44' ], // 70%-90%处的颜色
            [ 1, '#20AE51' ]// 90%-100%处的颜色
          ],
          width: 30// 表盘宽度
        }
      },
      splitLine: { // 分割线样式(及10、20等长线样式)
        length: 30,
        lineStyle: { // 属性lineStyle控制线条样式
          width: 2
        }
      },
      axisTick: { // 刻度线样式(及短线样式)
        length: 20
      },
      axisLabel: { // 文字样式(及“10”、“20”等文字样式)
        color: 'black',
        distance: 5 // 文字离表盘的距离
      },
      detail: {
        formatter: '{score|{value}%}',
        offsetCenter: [0, '50%'],
        backgroundColor: '#2D8BF0',
        height: 30,
        rich: {
          score: {
            color: 'white',
            fontFamily: '微软雅黑',
            fontSize: 32
          }
        }
      },
      data: [{
        value: 70,
        label: {
          textStyle: {
            fontSize: 12
          }
        }
      }]
    }
  ]
}
+20 −17
Original line number Diff line number Diff line
@@ -7,25 +7,28 @@
            <span>{{$t('#')}}</span>
          </th>
          <th>
            <span>{{$t('IP')}}</span>
            <span>node</span>
          </th>
          <th>
            <span>{{$t('Process Pid')}}</span>
            <span>ip</span>
          </th>
          <th>
            <span>{{$t('zk registration directory')}}</span>
            <span>模式</span>
          </th>
          <th>
            <span>{{$t('cpuUsage')}}</span>
            <span>连接数</span>
          </th>
          <th>
            <span>{{$t('memoryUsage')}}</span>
            <span>watch数</span>
          </th>
          <th>
            <span>{{$t('Create Time')}}</span>
            <span>数据量</span>
          </th>
          <th>
            <span>{{$t('Last heartbeat time')}}</span>
            <span>Sent/Received</span>
          </th>
          <th>
            <span>节点自检状态</span>
          </th>
        </tr>
        <tr v-for="(item, $index) in list" :key="$index">
@@ -34,22 +37,25 @@
          </td>
          <td>
            <span>
              <a href="javascript:" class="links">{{item.host}}</a>
              <a href="javascript:" class="links">task1</a>
            </span>
          </td>
          <td><span>{{item.port}}</span></td>
          <td><span>192.11.1.1</span></td>
          <td>
            <span>{{item.zkDirectory}}</span>
            <span>2222</span>
          </td>
          <td>
            <span>{{_rtResInfo(JSON.parse(item.resInfo)['cpuUsage'])}}</span>
            <span>3333</span>
          </td>
          <td>
            <span>{{_rtResInfo(JSON.parse(item.resInfo)['memoryUsage'])}}</span>
            <span>4444</span>
          </td>
          <td><span>{{item.createTime | formatDate}}</span></td>
          <td><span>5555</span></td>
          <td>
            <span>{{item.lastHeartbeatTime | formatDate}}</span>
            <span>6666</span>
          </td>
          <td>
            <span>7777</span>
          </td>
        </tr>
      </table>
@@ -70,9 +76,6 @@
      list: Array
    },
    methods: {
      _rtResInfo (val) {
        return (val * 100).toFixed(2) + ' %'
      }
    }
  }
</script>
Loading