2020-02-06 12:04:41 +08:00
|
|
|
|
<style lang="scss">
|
2020-02-07 20:14:00 +08:00
|
|
|
|
@import '../../charts/line-chart-block';
|
2020-03-17 17:14:07 +08:00
|
|
|
|
.project-calendar .el-input__inner {
|
|
|
|
|
|
height: 24px;
|
|
|
|
|
|
}
|
2020-02-17 16:32:40 +08:00
|
|
|
|
.top-tools .el-input__inner {
|
|
|
|
|
|
height: 25px !important;
|
|
|
|
|
|
border-color: #d8d8d8;
|
|
|
|
|
|
}
|
|
|
|
|
|
.change-time-height {
|
|
|
|
|
|
height: 23px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.date-pick-group {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
}
|
|
|
|
|
|
.date-pick-group button:first-of-type {
|
|
|
|
|
|
margin-right: 4px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.date-pick-group button:last-of-type {
|
|
|
|
|
|
margin-left: 4px;
|
|
|
|
|
|
}
|
2020-03-16 15:38:03 +08:00
|
|
|
|
|
|
|
|
|
|
.main-list {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
transition: .4s height, .4s transform;
|
|
|
|
|
|
}
|
|
|
|
|
|
.main-list.main-list-with-sub {
|
|
|
|
|
|
transform: translate3d(0,0,0);
|
2020-03-17 17:14:07 +08:00
|
|
|
|
height: calc(50% - 4px);
|
2020-03-16 15:38:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
.sub-list {
|
2020-03-17 17:14:07 +08:00
|
|
|
|
height: calc(50% - 4px);
|
2020-03-16 15:38:03 +08:00
|
|
|
|
transition: .4s height;
|
|
|
|
|
|
}
|
2020-03-17 17:14:07 +08:00
|
|
|
|
.sub-list-resize {
|
|
|
|
|
|
margin: 0 -6px;
|
|
|
|
|
|
border-top: 1px solid #aaa;
|
|
|
|
|
|
background-color: #eaeaea;
|
|
|
|
|
|
height: 9px;
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
user-select: none;
|
|
|
|
|
|
color: #5f6368;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
padding-top: 3px;
|
|
|
|
|
|
cursor: ns-resize;
|
|
|
|
|
|
}
|
|
|
|
|
|
.sub-list-window-control {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
margin-left: 14px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.window-control-btn {
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
width: 29px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
.window-control-btn:last-of-type {
|
|
|
|
|
|
margin-right: 4px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.window-control-btn>i {
|
|
|
|
|
|
color: #909399;
|
|
|
|
|
|
font-size: 17px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.window-control-btn>i:hover {
|
|
|
|
|
|
color: $global-text-color-active;
|
|
|
|
|
|
}
|
2020-02-10 16:50:34 +08:00
|
|
|
|
</style>
|
|
|
|
|
|
<style scope>
|
|
|
|
|
|
.chart-bottom {
|
|
|
|
|
|
text-align: center;
|
2020-03-06 20:54:44 +08:00
|
|
|
|
margin-top: 16px;
|
2020-02-10 16:50:34 +08:00
|
|
|
|
}
|
2020-02-06 12:04:41 +08:00
|
|
|
|
</style>
|
2019-11-29 15:00:26 +08:00
|
|
|
|
<template>
|
2019-12-10 17:00:28 +08:00
|
|
|
|
<div class="project">
|
2020-03-09 18:05:43 +08:00
|
|
|
|
|
2019-12-10 17:00:28 +08:00
|
|
|
|
<div class="content-left">
|
2020-03-09 18:05:43 +08:00
|
|
|
|
<el-scrollbar ref="leftScrollbar" style="height: 100%">
|
|
|
|
|
|
<div class="sidebar-title too-long-split">{{$t('project.project.project')}}:{{currentProject.name}}</div>
|
|
|
|
|
|
<div class="sidebar-info">
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-for="item in moduleList"
|
|
|
|
|
|
class="sidebar-info-item"
|
|
|
|
|
|
:class="{'sidebar-info-item-active': item.id == currentModule.id}"
|
|
|
|
|
|
@click="changeModule(item)"
|
|
|
|
|
|
:id="'project-module-'+item.id"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div class="sidebar-info-item-txt">
|
|
|
|
|
|
<el-popover v-if="item.name.length > 16" trigger="hover" placement="top-start" :content="item.name" >
|
|
|
|
|
|
<span slot="reference">{{item.name}}</span>
|
|
|
|
|
|
</el-popover>
|
|
|
|
|
|
<span v-else>{{item.name}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="hid-div side-bar-menu-edit " @click.stop="toEditModule(item)" :id="'project-module-edit-'+item.id" ><i class="nz-icon nz-icon-edit"></i></div>
|
2020-01-19 18:31:18 +08:00
|
|
|
|
</div>
|
2019-12-12 17:15:33 +08:00
|
|
|
|
</div>
|
2020-03-09 18:05:43 +08:00
|
|
|
|
</el-scrollbar>
|
2019-12-10 17:00:28 +08:00
|
|
|
|
</div>
|
2019-12-25 20:33:58 +08:00
|
|
|
|
|
2019-12-13 17:08:35 +08:00
|
|
|
|
<!--endpoint-->
|
2020-03-16 15:38:03 +08:00
|
|
|
|
<div class="content-right">
|
|
|
|
|
|
<!-- 主列表 -->
|
|
|
|
|
|
<div class="main-list" :class="{'main-list-with-sub': tableShow == 3}">
|
2020-03-17 17:14:07 +08:00
|
|
|
|
<div class="top-tools" v-show="mainResizeShow">
|
2020-03-16 15:38:03 +08:00
|
|
|
|
<div class="nz-tab">
|
|
|
|
|
|
<!-- <div class="nz-tab-item-box">-->
|
|
|
|
|
|
<!-- <div class="nz-tab-item nz-tab-item-active">{{$t('project.endpoint.endpoint')}}</div>-->
|
|
|
|
|
|
<!-- </div>-->
|
|
|
|
|
|
<!-- <div class="nz-tab-item-box" @click="tableShow = 2">-->
|
|
|
|
|
|
<!-- <div class="nz-tab-item">{{$t('project.metrics.metrics')}}</div>-->
|
|
|
|
|
|
<!-- </div>-->
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<export-excel
|
|
|
|
|
|
export-file-name="endpoint"
|
|
|
|
|
|
export-url="/endpoint/export"
|
|
|
|
|
|
:params="endpointSearchLabel"
|
|
|
|
|
|
@afterImport="getEndpointTableData"
|
|
|
|
|
|
class="float-right">
|
|
|
|
|
|
<template slot="optionZone">
|
|
|
|
|
|
<i class="nz-icon nz-icon-create-square" @click.stop="toCreateEndpoint" :title="$t('overall.createProject')" ></i>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</export-excel>
|
|
|
|
|
|
<!-- <button @click="toCreateEndpoint" :title="$t('overall.createProject')" class="nz-btn nz-btn-size-normal nz-btn-style-light float-right " id="project-add-ep">-->
|
|
|
|
|
|
<!-- <i class="nz-icon-create-square nz-icon"></i>-->
|
|
|
|
|
|
<!-- </button>-->
|
|
|
|
|
|
<div class="top-tool-search float-right margin-r-20"><search-input :searchMsg="endpointSearchMsg" @search="endpointSearch" ref="projectSearch"></search-input></div>
|
|
|
|
|
|
</div>
|
2019-12-25 20:33:58 +08:00
|
|
|
|
</div>
|
2020-03-16 15:38:03 +08:00
|
|
|
|
<el-table
|
|
|
|
|
|
:data="endpointTableData"
|
|
|
|
|
|
border
|
|
|
|
|
|
class="nz-table endpoint-table"
|
|
|
|
|
|
:height="$tableHeight.normal"
|
|
|
|
|
|
v-scrollBar:el-table
|
|
|
|
|
|
ref="endpointTable"
|
|
|
|
|
|
style="width: 100%;">
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
:resizable="false"
|
|
|
|
|
|
v-for="(item, index) in tablelable"
|
|
|
|
|
|
v-if="item.show"
|
|
|
|
|
|
:width="item.width"
|
|
|
|
|
|
:key="`col-${index}`"
|
|
|
|
|
|
:label="item.label"
|
|
|
|
|
|
min-width="110px"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template slot-scope="scope" :column="item">
|
|
|
|
|
|
<span v-if="item.prop == 'asset' && scope.row[item.prop]" class="link" @click="viewAsset(scope.row[item.prop].id)">{{scope.row[item.prop].host}}</span>
|
|
|
|
|
|
<span v-else-if="item.prop == 'param'">
|
|
|
|
|
|
<template v-if="scope.row.paramObj">
|
|
|
|
|
|
<span v-for="(p,i) in scope.row.paramObj">{{p.key}}={{p.value}}<span v-if="i < scope.row.paramObj.length-1">,</span></span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else>-</template>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<div v-else-if="item.prop == 'option'" class="content-right-options">
|
|
|
|
|
|
<span :title="$t('overall.query')" @click="showEndpoint(scope.row)" class="content-right-option" :id="'edp-query-'+scope.row.id"><i class="el-icon-search"></i></span>
|
|
|
|
|
|
|
|
|
|
|
|
<span :title="$t('overall.view')" @click="endpointDetail(scope.row)" class="content-right-option" :id="'edp-detail-'+scope.row.id"><i class="nz-icon nz-icon-view"></i></span>
|
|
|
|
|
|
|
|
|
|
|
|
<span :title="$t('overall.edit')" @click="toEditEndpoint(scope.row)" class="content-right-option" :id="'edp-edit-'+scope.row.id"><i class="nz-icon nz-icon-edit"></i></span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<span v-else-if="item.prop == 'lastUpdate'">{{dateFormat(scope.row.lastUpdate)}}</span>
|
|
|
|
|
|
<span v-else-if="item.prop == 'state'" >
|
|
|
|
|
|
<el-popover placement="right" width="50" trigger="hover" :content="getStateContent(scope.row)">
|
|
|
|
|
|
<div slot="reference" style="width: 20px">
|
|
|
|
|
|
<div :class="{'active-icon green':scope.row.state == '1','active-icon red':scope.row.state == '0'}"></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-popover>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</span>
|
|
|
|
|
|
<template v-else>-</template>
|
2020-02-26 15:38:56 +08:00
|
|
|
|
</template>
|
2020-03-16 15:38:03 +08:00
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column width="28">
|
|
|
|
|
|
<template slot="header" slot-scope="scope">
|
|
|
|
|
|
<span @click.stop="elementsetShow('shezhi',$event)" class="nz-table-gear">
|
|
|
|
|
|
<i class="nz-icon nz-icon-gear"></i>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</el-table>
|
2020-03-17 17:14:07 +08:00
|
|
|
|
<Pagination v-show="mainResizeShow" :tableId="tableId" v-cloak :pageObj="endpointPageObj" @pageNo='endpointPageNo' @pageSize='endpointPageSize' ref="endpointPagination"></Pagination>
|
2020-03-17 19:13:02 +08:00
|
|
|
|
<button class="to-top" v-show="showTopBtn1" @click="toTop('ps', 0)"><i class="nz-icon nz-icon-top"></i></button>
|
2019-12-10 17:00:28 +08:00
|
|
|
|
</div>
|
2020-03-16 15:38:03 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 副列表 endpoint query-->
|
2020-03-17 17:14:07 +08:00
|
|
|
|
<div @mousedown="listResize" class="sub-list-resize" v-show="tableShow == 3">一</div>
|
|
|
|
|
|
<div class="sub-list" v-show="tableShow == 3">
|
|
|
|
|
|
<div class="sub-top-tools" v-show="subResizeShow">
|
2020-03-17 18:37:05 +08:00
|
|
|
|
<div class="sub-list-tabs margin-l-20" style="width: calc(100% - 780px);">
|
|
|
|
|
|
<div class="sub-list-tab">{{$t("overall.query")}}</div>
|
2020-03-16 15:38:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<!--时间选择器-->
|
|
|
|
|
|
<div class="top-tool-right">
|
|
|
|
|
|
<div class="top-tool-search relative-position margin-r-20">
|
|
|
|
|
|
<el-input ref="elementQuery" @clear="clearInput" id="elementQuery" @focus="focusInput" @blur="blurInput" v-model="queryExpression" class="query-input-inactive" size="mini" clearable :placeholder="$t('project.endpoint.promExpr')" >
|
|
|
|
|
|
<i slot="suffix" class="el-input__icon el-icon-search" style="float:right" @click="focusInput"></i>
|
|
|
|
|
|
</el-input>
|
|
|
|
|
|
</div>
|
2020-03-17 17:14:07 +08:00
|
|
|
|
<div class="margin-r-20 nz-btn-group nz-btn-group-size-normal nz-btn-group-light">
|
|
|
|
|
|
<button @click="changeTime(-10)" class="nz-btn nz-btn-size-normal nz-btn-style-light change-time-height nz-input-group-prepend"><i class="el-icon-d-arrow-left"></i></button><el-date-picker
|
2020-03-16 15:38:03 +08:00
|
|
|
|
v-model="formatTime"
|
|
|
|
|
|
type="datetime"
|
|
|
|
|
|
size="mini"
|
2020-03-17 17:14:07 +08:00
|
|
|
|
class="project-calendar nz-input-group-middle"
|
2020-03-16 15:38:03 +08:00
|
|
|
|
clearable
|
|
|
|
|
|
:time-arrow-control="true"
|
|
|
|
|
|
placeholder="Moment"
|
|
|
|
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
|
|
|
@change="pickTime"
|
|
|
|
|
|
>
|
2020-03-17 17:14:07 +08:00
|
|
|
|
</el-date-picker><button @click="changeTime(10)" class="nz-btn nz-btn-size-normal nz-btn-style-light change-time-height nz-input-group-append"><i class="el-icon-d-arrow-right"></i></button>
|
2020-03-16 15:38:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<el-dropdown split-button type="primary" size="mini" class="dropdownBtn" @click="viewGraph">
|
|
|
|
|
|
<i class="nz-icon nz-icon-chart" :class="{'control-icon-unchecked':selectedEndpoints.length<1,'control-icon-checked':selectedEndpoints.length>0}"></i>
|
|
|
|
|
|
<el-dropdown-menu slot="dropdown" style="padding:10px 4px 10px 10px;">
|
|
|
|
|
|
<el-row>
|
|
|
|
|
|
<el-col :span="16" style="padding-top: 4px;padding-left: 1px"><span style="padding-top: 2px">{{$t('project.endpoint.hideSameLabels')}}</span></el-col>
|
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
|
<el-dropdown-item class="dropdown-content" >
|
|
|
|
|
|
<el-switch v-model="hideSameLabels" active-color="#ee9d3f" size="small"></el-switch>
|
|
|
|
|
|
</el-dropdown-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
2019-12-10 17:00:28 +08:00
|
|
|
|
|
2020-03-16 15:38:03 +08:00
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
|
</el-dropdown>
|
2020-03-17 17:14:07 +08:00
|
|
|
|
<div class="sub-list-window-control">
|
|
|
|
|
|
<!--半屏-->
|
|
|
|
|
|
<div class="window-control-btn" @click="halfScreen"><i class="el-icon-minus"></i></div>
|
|
|
|
|
|
<!--全屏-->
|
|
|
|
|
|
<div class="window-control-btn" @click="fullScreen"><i class="el-icon-full-screen"></i></div>
|
|
|
|
|
|
<!--关闭-->
|
|
|
|
|
|
<div class="window-control-btn" @click="backToEdpTab"><i class="el-icon-close"></i></div>
|
|
|
|
|
|
</div>
|
2020-02-04 18:52:09 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2020-03-16 15:38:03 +08:00
|
|
|
|
<div class="table-header-inner" @click="clearSelectedMetrics"><span><i style="font-size: 12px;margin-left: 2px;" class="nz-icon nz-icon-close " :class="{'control-icon-unchecked':selectedEndpoints.length<1,'control-icon-checked':selectedEndpoints.length>0}"></i></span></div>
|
|
|
|
|
|
<el-table
|
|
|
|
|
|
:data="showTableData"
|
|
|
|
|
|
v-loading="queryEdpLoading"
|
|
|
|
|
|
element-loading-background="rgba(0, 0, 0, 0)"
|
|
|
|
|
|
border
|
|
|
|
|
|
v-scrollBar:el-table
|
|
|
|
|
|
class="nz-table endpoint-query-table"
|
|
|
|
|
|
:header-cell-class-name="cellClass"
|
|
|
|
|
|
:height="$tableHeight.endpointQuery"
|
|
|
|
|
|
@selection-change="selectChange"
|
|
|
|
|
|
ref="metricInfoTab"
|
2020-03-17 17:14:07 +08:00
|
|
|
|
style="width: 100%; margin-top: 5px;">
|
2020-03-16 15:38:03 +08:00
|
|
|
|
<el-table-column
|
|
|
|
|
|
type="selection"
|
|
|
|
|
|
width="38"
|
|
|
|
|
|
align="center"
|
|
|
|
|
|
:selectable="selectable"
|
|
|
|
|
|
>
|
|
|
|
|
|
</el-table-column>
|
2020-02-13 12:33:22 +08:00
|
|
|
|
|
2020-03-16 15:38:03 +08:00
|
|
|
|
<el-table-column
|
|
|
|
|
|
prop="element"
|
|
|
|
|
|
:label="$t('project.endpoint.element')">
|
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
|
<el-popover trigger="hover" placement="right" v-if="typeof scope.row.metricTip != 'undefined' && scope.row.metricTip != null">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<ul>
|
|
|
|
|
|
<li><span class="metirc-tip-list">metric : </span><span>{{scope.row.metricTip.metric?scope.row.metricTip.metric:'--'}}</span></li>
|
|
|
|
|
|
<li><span class="metirc-tip-list">type : </span><span>{{scope.row.metricTip.type?scope.row.metricTip.type:'unknown'}}</span></li>
|
|
|
|
|
|
<li><span class="metirc-tip-list">help : </span><span>{{scope.row.metricTip.help?scope.row.metricTip.help:'--'}}</span></li>
|
|
|
|
|
|
<li><span class="metirc-tip-list">unit : </span><span>{{scope.row.metricTip.unit?scope.row.metricTip.unit:'--'}}</span></li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<span slot="reference"><i class="nz-icon nz-icon-info-normal metric-tip-icon"></i></span>
|
|
|
|
|
|
</el-popover>
|
|
|
|
|
|
<span v-html="hideSameLabels?scope.row.colorSimpleElement: scope.row.colorElement"></span>
|
|
|
|
|
|
<!-- <span>{{hideSameLabels?scope.row.simpleElement: scope.row.element}}</span>-->
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
prop="value"
|
|
|
|
|
|
:label="$t('project.endpoint.value')"
|
|
|
|
|
|
width="180">
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</el-table>
|
2020-03-17 19:13:02 +08:00
|
|
|
|
<button class="to-top" v-show="showTopBtn2" @click="toTop('ps', 1)"><i class="nz-icon nz-icon-top"></i></button>
|
2020-02-04 18:52:09 +08:00
|
|
|
|
</div>
|
2020-03-11 18:48:05 +08:00
|
|
|
|
</div>
|
2020-03-16 15:38:03 +08:00
|
|
|
|
|
2020-01-08 22:19:46 +08:00
|
|
|
|
<element-set
|
|
|
|
|
|
v-clickoutside="elementsetHide"
|
2020-01-16 15:48:49 +08:00
|
|
|
|
:table-title="endpointTableTitle"
|
2020-01-08 22:19:46 +08:00
|
|
|
|
:dropCol="dropCol"
|
|
|
|
|
|
@tablelable="tablelabelEmit"
|
|
|
|
|
|
ref="elementset"
|
|
|
|
|
|
></element-set>
|
2020-02-06 12:04:41 +08:00
|
|
|
|
|
2020-02-20 18:17:36 +08:00
|
|
|
|
<el-dialog class="line-chart-block-modal nz-dialog"
|
2020-02-06 12:04:41 +08:00
|
|
|
|
:title="$t('project.endpoint.dialogTitle')"
|
|
|
|
|
|
:visible.sync="graphShow"
|
|
|
|
|
|
width="90%"
|
2020-02-20 18:17:36 +08:00
|
|
|
|
id="viewGraphDialog"
|
2020-02-06 12:04:41 +08:00
|
|
|
|
@close="dialogClose"
|
|
|
|
|
|
@opened="initDialog">
|
|
|
|
|
|
<div slot="title">
|
|
|
|
|
|
{{$t("project.endpoint.dialogTitle")}}
|
|
|
|
|
|
<div class="float-right panel-calendar dialog-tool">
|
|
|
|
|
|
<el-date-picker ref="calendar" prefix-icon=" " size="mini" class="nz-dashboard-picker"
|
|
|
|
|
|
@change="dateChange"
|
|
|
|
|
|
v-model="searchTime"
|
|
|
|
|
|
type="datetimerange"
|
|
|
|
|
|
:picker-options="pickerOptions"
|
|
|
|
|
|
:range-separator="$t('dashboard.panel.to')"
|
|
|
|
|
|
:start-placeholder="$t('dashboard.panel.startTime')"
|
|
|
|
|
|
:end-placeholder="$t('dashboard.panel.endTime')"
|
|
|
|
|
|
value-format="yyyy-MM-dd hh:mm:ss"
|
|
|
|
|
|
align="right">
|
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
|
<!--<button @click="refreshChart" type="button" class="nz-btn nz-btn-size-normal nz-btn-style-light"><i style="font-size: 14px;" class="el-icon-refresh-right"></i></button>-->
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2020-03-06 20:54:44 +08:00
|
|
|
|
<div class="line-area" ref="viewGraphChart" id="viewGraphChart"></div>
|
2020-02-20 18:17:36 +08:00
|
|
|
|
<div class="legend-container" id="legendArea" ref="legendArea">
|
2020-03-06 20:54:44 +08:00
|
|
|
|
<el-scrollbar style="height: 100%" ref="chartScrollbar">
|
|
|
|
|
|
<div v-for="(item, index) in legend" :title="hideSameLabels&&item.alias?item.alias:item.name" @click="clickLegend(item.name,index)" class="legend-item" :class="{'ft-gr':isGrey[index]}" :key="'legend_' + item.name+'_'+index">
|
|
|
|
|
|
<span class="legend-shape" :style="{background:(isGrey[index]?'#D3D3D3':bgColorList[index])}"></span>{{hideSameLabels&&item.alias?item.alias:item.name}}
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-scrollbar>
|
2020-02-20 18:17:36 +08:00
|
|
|
|
</div>
|
2020-03-06 20:54:44 +08:00
|
|
|
|
<div class="line-100 margin-t-10"></div>
|
2020-02-10 16:50:34 +08:00
|
|
|
|
<div class="chart-bottom">
|
|
|
|
|
|
<button class="nz-btn nz-btn-size-large nz-btn-style-normal nz-btn-min-width-82" @click="saveChart">{{$t('dashboard.metric.saveChart')}}</button>
|
|
|
|
|
|
</div>
|
2020-03-11 18:48:05 +08:00
|
|
|
|
<loading ref="graphLoading"></loading>
|
2020-02-06 12:04:41 +08:00
|
|
|
|
</el-dialog>
|
2020-02-10 16:50:34 +08:00
|
|
|
|
|
|
|
|
|
|
<module-box :currentProject="currentProject" :module="editModule" @reload="getModuleList" ref="moduleBox"></module-box>
|
|
|
|
|
|
<edit-endpoint-box :currentProject="currentProject" :currentModule="currentModule" :endpoint="editEndpoint" @reload="getEndpointTableData" ref="editEndpointBox"></edit-endpoint-box>
|
|
|
|
|
|
<add-endpoint-box :currentProject="currentProject" :currentModule="currentModule" @reload="getEndpointTableData" ref="addEndpointBox"></add-endpoint-box>
|
2020-03-17 17:14:07 +08:00
|
|
|
|
<asset-box :edit-unit-show='viewAssetState' @refreshData="getEndpointTableData" @sendStateData="tabControl"
|
|
|
|
|
|
ref="assetEditUnit"></asset-box>
|
2020-02-12 16:15:21 +08:00
|
|
|
|
<chart-box ref="addChartModal" :panel-data="panelData" @on-create-success="createSuccess" @reloadOnlyPanel="getPanelData" @reload="getPanelData"></chart-box>
|
2019-12-10 17:00:28 +08:00
|
|
|
|
</div>
|
2019-11-29 15:00:26 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2020-02-06 12:04:41 +08:00
|
|
|
|
import echarts from 'echarts';
|
2020-02-10 16:50:34 +08:00
|
|
|
|
import chartBox from "../dashboard/chartBox";
|
2020-02-11 11:30:56 +08:00
|
|
|
|
import bus from "../../../libs/bus";
|
2020-02-19 10:43:58 +08:00
|
|
|
|
import axios from 'axios';
|
2020-02-26 15:38:56 +08:00
|
|
|
|
import exportXLSX from "../../common/exportXLSX";
|
2020-03-11 18:48:05 +08:00
|
|
|
|
import loading from "../../common/loading";
|
2020-03-13 13:12:47 +08:00
|
|
|
|
import chartDataFormat from "../../charts/chartDataFormat";
|
2019-12-25 20:33:58 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
name: "project2",
|
2020-02-10 16:50:34 +08:00
|
|
|
|
components: {
|
2020-02-11 19:55:20 +08:00
|
|
|
|
'chart-box': chartBox,
|
2020-03-11 18:48:05 +08:00
|
|
|
|
'export-excel':exportXLSX,
|
|
|
|
|
|
'loading': loading,
|
2020-02-10 16:50:34 +08:00
|
|
|
|
},
|
2019-12-25 20:33:58 +08:00
|
|
|
|
data() {
|
2020-02-07 20:14:00 +08:00
|
|
|
|
let temp=this;
|
2019-12-25 20:33:58 +08:00
|
|
|
|
return {
|
2020-03-13 12:20:02 +08:00
|
|
|
|
tableId: 'projectTable', //需要分页的table的id,用于记录每页数量
|
2020-03-17 17:14:07 +08:00
|
|
|
|
mainResizeShow: true, //dom高度改变时部分内容是否展示
|
|
|
|
|
|
subResizeShow: true,
|
2019-12-25 20:33:58 +08:00
|
|
|
|
tableShow: 1, // 1.endpoint; 2.metrics
|
2020-03-05 21:30:45 +08:00
|
|
|
|
showTopBtn1: false,
|
|
|
|
|
|
showTopBtn2: false,
|
2019-12-25 20:33:58 +08:00
|
|
|
|
editEndpoint: {id: '', host: '', port: '', param: '', path: '', asset: {}, project: {}, module: {}, moduleId: '', assetId: '', paramObj: []},
|
|
|
|
|
|
endpointTableTitle: [
|
|
|
|
|
|
{
|
|
|
|
|
|
label: this.$t("project.endpoint.endpointId"),
|
|
|
|
|
|
prop: 'id',
|
2020-01-19 18:31:18 +08:00
|
|
|
|
show: true,
|
|
|
|
|
|
width: 150
|
2020-01-08 22:19:46 +08:00
|
|
|
|
},{
|
|
|
|
|
|
label: this.$t("project.endpoint.asset"),
|
|
|
|
|
|
prop: 'asset',
|
2019-12-25 20:33:58 +08:00
|
|
|
|
show: true,
|
|
|
|
|
|
},{
|
|
|
|
|
|
label: this.$t("project.endpoint.host"),
|
|
|
|
|
|
prop: 'host',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
},{
|
|
|
|
|
|
label: this.$t("project.endpoint.port"),
|
|
|
|
|
|
prop: 'port',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
},{
|
|
|
|
|
|
label: this.$t("project.endpoint.param"),
|
|
|
|
|
|
prop: 'param',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
},{
|
|
|
|
|
|
label: this.$t("project.endpoint.path"),
|
|
|
|
|
|
prop: 'path',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
},{
|
|
|
|
|
|
label: this.$t("alert.list.state"),
|
|
|
|
|
|
prop: 'state',
|
|
|
|
|
|
show: true,
|
2020-03-09 08:41:21 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2019-12-25 20:33:58 +08:00
|
|
|
|
label: this.$t("project.endpoint.lastUpdate"),
|
|
|
|
|
|
prop: 'lastUpdate',
|
2020-03-09 08:41:21 +08:00
|
|
|
|
show: true,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2020-01-08 22:19:46 +08:00
|
|
|
|
label: this.$t('config.account.option'),
|
|
|
|
|
|
prop: 'option',
|
2020-01-19 18:31:18 +08:00
|
|
|
|
show: true,
|
2020-02-18 11:05:57 +08:00
|
|
|
|
width: 120
|
2019-12-25 20:33:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
endpointTableData: [],
|
|
|
|
|
|
endpointPageObj: {
|
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
|
pageSize: 20,
|
|
|
|
|
|
total:0
|
2019-12-10 17:00:28 +08:00
|
|
|
|
},
|
2019-12-25 20:33:58 +08:00
|
|
|
|
metricsTableTitle: [
|
|
|
|
|
|
{
|
|
|
|
|
|
label: this.$t("project.metrics.name"),
|
|
|
|
|
|
prop: 'metric',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: this.$t("project.metrics.type"),
|
|
|
|
|
|
prop: 'type',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: this.$t("project.metrics.description"),
|
|
|
|
|
|
prop: 'help',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
},
|
|
|
|
|
|
],
|
|
|
|
|
|
metricsTableData: [],
|
|
|
|
|
|
metricPageObj: {
|
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
|
pageSize: 20,
|
|
|
|
|
|
total: 0
|
2019-12-10 17:00:28 +08:00
|
|
|
|
},
|
2020-01-08 22:19:46 +08:00
|
|
|
|
tablelable: [],
|
|
|
|
|
|
dropCol: [],
|
2019-12-25 20:33:58 +08:00
|
|
|
|
moduleList: [],
|
|
|
|
|
|
projectList: [],
|
|
|
|
|
|
currentProject: {id: '', name: '', remark: ''}, //endpoint弹框、module列表用来回显project
|
|
|
|
|
|
editModule: {id: '', name: '', project: {}, port: '', path: '', param: '', paramObj: []}, //编辑的module
|
|
|
|
|
|
currentModule: {id: '', name: '', project: {}, port: '', path: '', param: '', paramObj: []}, //endpoint弹框用来回显module
|
|
|
|
|
|
endpointSearchLabel: {moduleId: ''}, //endpoint搜索参数
|
|
|
|
|
|
metricSearchLabel: {moduleId: ''}, //metrics搜索参数
|
|
|
|
|
|
endpointSearchMsg: { //给搜索框子组件传递的信息
|
|
|
|
|
|
zheze_none: true,
|
|
|
|
|
|
searchLabelList: [{
|
|
|
|
|
|
id: 1,
|
|
|
|
|
|
name: "ID",
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'id',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}, {
|
|
|
|
|
|
id: 11,
|
|
|
|
|
|
name: this.$t('asset.asset'),
|
|
|
|
|
|
type: 'asset',
|
|
|
|
|
|
label: 'asset',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}],
|
2019-12-13 17:08:35 +08:00
|
|
|
|
},
|
2019-12-25 20:33:58 +08:00
|
|
|
|
metricSearchMsg: { //给搜索框子组件传递的信息
|
|
|
|
|
|
zheze_none: true,
|
|
|
|
|
|
searchLabelList: [{
|
|
|
|
|
|
id: 12,
|
|
|
|
|
|
name: 'Metric',
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'metric',
|
|
|
|
|
|
disabled: false
|
|
|
|
|
|
}],
|
2019-12-13 17:08:35 +08:00
|
|
|
|
},
|
2020-01-06 19:03:38 +08:00
|
|
|
|
viewAssetState:false,
|
2020-02-04 18:52:09 +08:00
|
|
|
|
curEndpoint:null,
|
|
|
|
|
|
endpointQueryTabData:[],//endpoint 查询列表数据
|
2020-02-11 19:55:20 +08:00
|
|
|
|
showTableData:[],
|
2020-02-13 12:33:22 +08:00
|
|
|
|
showTableDataCopy:'',
|
2020-02-04 18:52:09 +08:00
|
|
|
|
queryExpression:'',
|
|
|
|
|
|
metricList: [], // metric列表
|
2020-02-17 18:41:38 +08:00
|
|
|
|
elementMetricDatas:[],//element 列提示信息列表
|
2020-02-06 12:04:41 +08:00
|
|
|
|
formatTime:'',//查询endpoint的时间,
|
|
|
|
|
|
selectedEndpoints:[],//选中的metric{label='value'}
|
|
|
|
|
|
chartDatas:[],//从query_range查询到的数据
|
2020-02-20 18:17:36 +08:00
|
|
|
|
legend:[],//echart legend
|
2020-02-06 12:04:41 +08:00
|
|
|
|
graphChart:null,//图标对象
|
|
|
|
|
|
graphShow:false,
|
|
|
|
|
|
searchTime:[],
|
2020-02-07 20:14:00 +08:00
|
|
|
|
queryEdpLoading:false,
|
2020-02-06 12:04:41 +08:00
|
|
|
|
pickerOptions: {
|
|
|
|
|
|
shortcuts: [
|
|
|
|
|
|
{
|
|
|
|
|
|
text: this.$t("dashboard.panel.recOne"),
|
|
|
|
|
|
onClick(picker) {
|
|
|
|
|
|
const end = new Date();
|
|
|
|
|
|
const start = new Date();
|
|
|
|
|
|
start.setHours(start.getHours() - 1);
|
|
|
|
|
|
picker.$emit('pick', [start, end]);
|
|
|
|
|
|
}
|
|
|
|
|
|
},{
|
|
|
|
|
|
text: this.$t("dashboard.panel.recFour"),
|
|
|
|
|
|
onClick(picker) {
|
|
|
|
|
|
const end = new Date();
|
|
|
|
|
|
const start = new Date();
|
|
|
|
|
|
start.setHours(start.getHours() - 4);
|
|
|
|
|
|
picker.$emit('pick', [start, end]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}, {
|
|
|
|
|
|
text: this.$t("dashboard.panel.recOneDay"),
|
|
|
|
|
|
onClick(picker) {
|
|
|
|
|
|
const end = new Date();
|
|
|
|
|
|
const start = new Date();
|
|
|
|
|
|
start.setDate(start.getDate() - 1);
|
|
|
|
|
|
picker.$emit('pick', [start, end]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}, {
|
|
|
|
|
|
text: this.$t("dashboard.panel.yesterday"),
|
|
|
|
|
|
onClick(picker) {
|
|
|
|
|
|
const start = new Date();
|
|
|
|
|
|
const end = new Date();
|
|
|
|
|
|
start.setDate(start.getDate() - 1);
|
|
|
|
|
|
start.setHours(0);
|
|
|
|
|
|
start.setMinutes(0);
|
|
|
|
|
|
start.setSeconds(0);
|
|
|
|
|
|
end.setDate(end.getDate() - 1);
|
|
|
|
|
|
end.setHours(23);
|
|
|
|
|
|
end.setMinutes(59);
|
|
|
|
|
|
end.setSeconds(59);
|
|
|
|
|
|
picker.$emit('pick', [start, end]);
|
|
|
|
|
|
}
|
|
|
|
|
|
},{
|
|
|
|
|
|
text: this.$t("dashboard.panel.recSevenDay"),
|
|
|
|
|
|
onClick(picker) {
|
|
|
|
|
|
const end = new Date();
|
|
|
|
|
|
const start = new Date();
|
|
|
|
|
|
start.setDate(start.getDate() - 7);
|
|
|
|
|
|
picker.$emit('pick', [start, end]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}, {
|
|
|
|
|
|
text: this.$t("dashboard.panel.recOneMonth"),
|
|
|
|
|
|
onClick(picker) {
|
|
|
|
|
|
const end = new Date();
|
|
|
|
|
|
const start = new Date();
|
|
|
|
|
|
start.setDate(start.getDate() - 30);
|
|
|
|
|
|
picker.$emit('pick', [start, end]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}, {
|
|
|
|
|
|
text: this.$t("dashboard.panel.curMonth"),
|
|
|
|
|
|
onClick(picker) {
|
|
|
|
|
|
const end = new Date();
|
|
|
|
|
|
const start = new Date();
|
|
|
|
|
|
start.setDate(1);
|
|
|
|
|
|
start.setHours(0);
|
|
|
|
|
|
start.setMinutes(0);
|
|
|
|
|
|
picker.$emit('pick', [start, end]);
|
|
|
|
|
|
}
|
|
|
|
|
|
},{
|
|
|
|
|
|
text: this.$t("dashboard.panel.lastMonth"),
|
|
|
|
|
|
onClick(picker) {
|
|
|
|
|
|
const end = new Date();
|
|
|
|
|
|
const start = new Date();
|
|
|
|
|
|
start.setDate(1);
|
|
|
|
|
|
start.setMonth(start.getMonth() - 1);
|
|
|
|
|
|
end.setDate(0);
|
|
|
|
|
|
start.setStart();
|
|
|
|
|
|
end.setEnd();
|
|
|
|
|
|
picker.$emit('pick', [start, end]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}]
|
|
|
|
|
|
},
|
|
|
|
|
|
chartOptions:{
|
2020-03-06 09:29:53 +08:00
|
|
|
|
color: temp.bgColorList,
|
2020-02-06 12:04:41 +08:00
|
|
|
|
title: {
|
|
|
|
|
|
text: ""
|
|
|
|
|
|
},
|
|
|
|
|
|
tooltip: {
|
|
|
|
|
|
trigger: 'axis',
|
2020-03-06 09:29:53 +08:00
|
|
|
|
confine:false,
|
|
|
|
|
|
extraCssText:'z-index:1000;',
|
|
|
|
|
|
/*enterable:true, 导致tooltip不消失,显示多个tooltip*/
|
|
|
|
|
|
position:function(point,params,dom,rect,size){
|
|
|
|
|
|
dom.style.transform = "translateZ(0)";
|
|
|
|
|
|
//提示框位置
|
|
|
|
|
|
var x=0;
|
|
|
|
|
|
var y=0;
|
|
|
|
|
|
//当前鼠标位置
|
|
|
|
|
|
var pointX = point[0];
|
|
|
|
|
|
var pointY = point[1];
|
|
|
|
|
|
//外层div大小
|
|
|
|
|
|
var viewWidth = size.viewSize[0];
|
|
|
|
|
|
var viewHeight = size.viewSize[1];
|
|
|
|
|
|
//提示框大小
|
|
|
|
|
|
var boxWidth = size.contentSize[0];
|
|
|
|
|
|
var boxHeight = size.contentSize[1];
|
|
|
|
|
|
if(pointX<(viewWidth/2)){//说明鼠标在左边放不下提示框
|
|
|
|
|
|
x=pointX+10;
|
|
|
|
|
|
}else{
|
|
|
|
|
|
x = pointX - boxWidth;
|
|
|
|
|
|
}
|
|
|
|
|
|
if(pointY<(viewHeight/2)){//说明鼠标上面放不下提示框
|
|
|
|
|
|
y = pointY+10;
|
|
|
|
|
|
}else {
|
|
|
|
|
|
y = pointY-boxHeight;
|
|
|
|
|
|
}
|
|
|
|
|
|
return [x,y];
|
|
|
|
|
|
},
|
|
|
|
|
|
formatter:function(params){
|
|
|
|
|
|
//display:inline-block;white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis;
|
2020-03-13 13:12:47 +08:00
|
|
|
|
let str = `<div >`;
|
2020-03-06 09:29:53 +08:00
|
|
|
|
params.forEach((item, i) => {
|
|
|
|
|
|
let tip=temp.legend.find((element)=>{
|
|
|
|
|
|
return element.name == item.seriesName;
|
|
|
|
|
|
})
|
|
|
|
|
|
if(i===0){
|
|
|
|
|
|
let t_date = new Date(item.data[0]);
|
|
|
|
|
|
str += [t_date.getFullYear(), t_date.getMonth() + 1, t_date.getDate()].join('-') + " "
|
|
|
|
|
|
+ [t_date.getHours(), t_date.getMinutes(),t_date.getSeconds()].join(':');
|
2020-03-13 18:32:47 +08:00
|
|
|
|
str +=`<br/>`;
|
2020-03-06 09:29:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
let val = parseFloat(Number(item.data[1]).toFixed(2));
|
|
|
|
|
|
if(val===0){
|
|
|
|
|
|
val = Number(item.data[1]);
|
|
|
|
|
|
}
|
2020-03-13 13:12:47 +08:00
|
|
|
|
str += `<div style="white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis;display: flex; justify-content: space-between; min-width: 150px; max-width: 600px; line-height: 18px; font-size: 12px;">`;
|
|
|
|
|
|
str += `<div style="max-width: 500px;white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis;"><span style='display:inline-block;margin-right:5px;border-radius:10px;width:15px;height:5px;background-color: ${item.color};}'></span>${tip?(tip.alias?tip.alias:tip.name):item.seriesName}: </div>`;
|
|
|
|
|
|
str += `<div style="padding-left: 10px;">`;
|
|
|
|
|
|
str += chartDataFormat.short(val,null,2);
|
|
|
|
|
|
str += `</div>`;
|
|
|
|
|
|
str += `</div>`;
|
2020-03-06 09:29:53 +08:00
|
|
|
|
});
|
|
|
|
|
|
str +=`</div>`;
|
|
|
|
|
|
return str;
|
|
|
|
|
|
},
|
2020-02-06 12:04:41 +08:00
|
|
|
|
},
|
|
|
|
|
|
legend: {
|
2020-02-20 18:17:36 +08:00
|
|
|
|
show:false,
|
2020-02-06 12:04:41 +08:00
|
|
|
|
type:'scroll',
|
|
|
|
|
|
height:80,
|
|
|
|
|
|
icon:"roundRect",
|
|
|
|
|
|
itemHeight:5,
|
|
|
|
|
|
itemWidth:15,
|
|
|
|
|
|
data:[],
|
|
|
|
|
|
orient:'vertical',
|
2020-02-07 20:14:00 +08:00
|
|
|
|
formatter:function(name){
|
|
|
|
|
|
if(!name){
|
|
|
|
|
|
return '';
|
|
|
|
|
|
}
|
|
|
|
|
|
//计算宽度
|
|
|
|
|
|
let chartWidth=temp.$refs.viewGraphChart.clientWidth;
|
|
|
|
|
|
var span = document.createElement("span");
|
|
|
|
|
|
var result = {};
|
|
|
|
|
|
result.width = span.offsetWidth;
|
|
|
|
|
|
result.height = span.offsetHeight;
|
|
|
|
|
|
span.style.visibility = "hidden";
|
|
|
|
|
|
span.style.fontSize = 14;
|
|
|
|
|
|
span.style.fontFamily = "Arial";
|
|
|
|
|
|
span.style.display = "inline-block";
|
|
|
|
|
|
document.body.appendChild(span);
|
|
|
|
|
|
if(typeof span.textContent != "undefined"){
|
|
|
|
|
|
span.textContent = name;
|
|
|
|
|
|
}else{
|
|
|
|
|
|
span.innerText = name;
|
|
|
|
|
|
}
|
|
|
|
|
|
var txtWidth = parseFloat(window.getComputedStyle(span).width) - result.width;
|
|
|
|
|
|
document.body.removeChild(span);
|
|
|
|
|
|
|
|
|
|
|
|
if(txtWidth < chartWidth){
|
|
|
|
|
|
return name;
|
|
|
|
|
|
}else {
|
|
|
|
|
|
var charNum = `${(chartWidth-100)/(txtWidth/name.length)}`;
|
|
|
|
|
|
return name.slice(0,charNum)+'...';
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
tooltip:{
|
|
|
|
|
|
show:true,
|
|
|
|
|
|
formatter:function(params){
|
2020-02-11 11:30:56 +08:00
|
|
|
|
//console.log("params")
|
|
|
|
|
|
//console.log(params);
|
2020-02-07 20:14:00 +08:00
|
|
|
|
return `<div style='width:100%;display:block;word-break:break-all;word-wrap:break-word;white-space:normal'> ${params.name}</div>`;
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
orient:'vertical',
|
|
|
|
|
|
x:'center',
|
|
|
|
|
|
y:'bottom',
|
2020-02-06 12:04:41 +08:00
|
|
|
|
},
|
|
|
|
|
|
grid: {
|
2020-03-06 20:54:44 +08:00
|
|
|
|
top: 13,
|
|
|
|
|
|
left: 0,
|
|
|
|
|
|
right: 30,
|
|
|
|
|
|
containLabel: true,
|
|
|
|
|
|
bottom:35,//156
|
2020-02-06 12:04:41 +08:00
|
|
|
|
},
|
|
|
|
|
|
dataZoom: [{
|
|
|
|
|
|
type: 'slider',
|
|
|
|
|
|
show:true,
|
|
|
|
|
|
xAxisIndex: [0],
|
|
|
|
|
|
start: 0,
|
|
|
|
|
|
end: 100,
|
|
|
|
|
|
height:25,
|
2020-02-20 18:17:36 +08:00
|
|
|
|
bottom:10//96
|
2020-02-06 12:04:41 +08:00
|
|
|
|
}],
|
2020-02-07 20:14:00 +08:00
|
|
|
|
|
2020-02-06 12:04:41 +08:00
|
|
|
|
xAxis: {
|
|
|
|
|
|
type: 'time',
|
|
|
|
|
|
axisLabel: {
|
|
|
|
|
|
intervale: 0,
|
|
|
|
|
|
rotate: 0,
|
|
|
|
|
|
formatter: function (value) {
|
|
|
|
|
|
var t_date = new Date(value);
|
|
|
|
|
|
return [t_date.getFullYear(), t_date.getMonth() + 1, t_date.getDate()].join('-') + "\n"
|
|
|
|
|
|
+ [t_date.getHours(), t_date.getMinutes()].join(':');
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
axisPointer: {//y轴上显示指针对应的值
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
},
|
|
|
|
|
|
splitLine:{
|
|
|
|
|
|
show:false
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
yAxis: {
|
|
|
|
|
|
type: 'value',
|
|
|
|
|
|
splitLine:{
|
|
|
|
|
|
show:true
|
|
|
|
|
|
},
|
2020-02-07 20:14:00 +08:00
|
|
|
|
axisLabel: {
|
|
|
|
|
|
formatter: function(num,index) {
|
2020-03-13 13:12:47 +08:00
|
|
|
|
return chartDataFormat.short(num,index)
|
2020-02-07 20:14:00 +08:00
|
|
|
|
},
|
|
|
|
|
|
},
|
2020-02-06 12:04:41 +08:00
|
|
|
|
},
|
2020-02-07 20:14:00 +08:00
|
|
|
|
useUTC: false,//使用本地时间
|
2020-02-06 12:04:41 +08:00
|
|
|
|
series: []
|
2020-02-10 16:50:34 +08:00
|
|
|
|
},
|
2020-02-20 18:17:36 +08:00
|
|
|
|
legendList:[],
|
|
|
|
|
|
screenLegendList:[],
|
|
|
|
|
|
isGrey:[],
|
|
|
|
|
|
isGreyScreen:[],
|
|
|
|
|
|
bgColorList: ['#7bbfea', '#b3424a', '#f05b72', '#596032', '#bd6758',
|
|
|
|
|
|
'#cd9a5b', '#918597', '#70a19f', '#005344', '#FF00FF',
|
|
|
|
|
|
'#f7acbc', '#5f5d46', '#66ffff', '#ccFF66', '#f47920',
|
|
|
|
|
|
'#769149', '#1d953f', '#abc88b', '#7f7522', '#9b95c9',
|
|
|
|
|
|
'#f3715c', '#ea66a6', '#d1c7b7', '#9d9087', '#77787b',
|
|
|
|
|
|
'#f58220', '#c37e00', '#00ae9d', '#f26522', '#76becc',
|
|
|
|
|
|
'#76624c', '#d71345', '#2468a2', '#ca8687', '#1b315e',
|
|
|
|
|
|
],
|
2020-03-06 09:29:53 +08:00
|
|
|
|
panelData: [], //chart-box的panel下拉框数据,
|
|
|
|
|
|
hideSameLabels:true,
|
|
|
|
|
|
sameLabels:['instance','module','project','asset','job','dc'],
|
2019-12-25 20:33:58 +08:00
|
|
|
|
}
|
2019-12-11 17:15:23 +08:00
|
|
|
|
},
|
2019-12-25 20:33:58 +08:00
|
|
|
|
methods: {
|
2020-03-17 17:14:07 +08:00
|
|
|
|
// 鼠标拖动二级列表
|
|
|
|
|
|
listResize(e) {
|
|
|
|
|
|
let mainListDom = document.querySelector(".main-list-with-sub"); //主列表
|
|
|
|
|
|
let subListDom = document.querySelector(".sub-list"); //副列表
|
|
|
|
|
|
let contentRightDom = document.querySelector(".content-right"); //右侧内容区
|
|
|
|
|
|
let contentRightHeight = contentRightDom.offsetHeight;//可视高度
|
|
|
|
|
|
//得到点击时俩dom的初始高度:
|
|
|
|
|
|
let mainInitialHeight = mainListDom.offsetHeight;
|
|
|
|
|
|
let subInitialHeight = subListDom.offsetHeight;
|
|
|
|
|
|
//点击时鼠标的Y轴位置
|
|
|
|
|
|
let mouseInitialY = e.clientY;
|
|
|
|
|
|
|
|
|
|
|
|
let _this = this;
|
|
|
|
|
|
|
|
|
|
|
|
document.onmousemove = (e) => {
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
//得到鼠标拖动的距离
|
|
|
|
|
|
let mouseMoveY = Math.abs(e.clientY - mouseInitialY);
|
|
|
|
|
|
|
|
|
|
|
|
//往上方拖动:
|
|
|
|
|
|
if (e.clientY < mouseInitialY) {
|
|
|
|
|
|
mainListDom.style.height = mainInitialHeight-mouseMoveY+'px';
|
|
|
|
|
|
subListDom.style.height = subInitialHeight+mouseMoveY+'px';
|
|
|
|
|
|
}
|
|
|
|
|
|
//往下方拖动:
|
|
|
|
|
|
if (e.clientY > mouseInitialY) {
|
|
|
|
|
|
mainListDom.style.height = mainInitialHeight+mouseMoveY+'px';
|
|
|
|
|
|
subListDom.style.height = subInitialHeight-mouseMoveY+'px';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 主、副列表最小高度限制为15px
|
|
|
|
|
|
if(parseInt(mainListDom.style.height) >= contentRightHeight-15){
|
|
|
|
|
|
mainListDom.style.height = contentRightHeight-15+'px';
|
|
|
|
|
|
}
|
|
|
|
|
|
if(parseInt(mainListDom.style.height) <= 15){
|
|
|
|
|
|
mainListDom.style.height = 15+'px';
|
|
|
|
|
|
}
|
|
|
|
|
|
if(parseInt(subListDom.style.height) >= contentRightHeight-15){
|
|
|
|
|
|
subListDom.style.height = contentRightHeight-15+'px';
|
|
|
|
|
|
}
|
|
|
|
|
|
if(parseInt(subListDom.style.height) <= 15){
|
|
|
|
|
|
subListDom.style.height = 15+'px';
|
|
|
|
|
|
}
|
|
|
|
|
|
//当主副列表可视区域小于一定值时,不展示内容
|
|
|
|
|
|
if(parseInt(mainListDom.style.height) <= 100){
|
|
|
|
|
|
if (_this.mainResizeShow) {
|
|
|
|
|
|
_this.mainResizeShow = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (!_this.mainResizeShow) {
|
|
|
|
|
|
_this.mainResizeShow = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if(parseInt(subListDom.style.height) <= 150){
|
|
|
|
|
|
if (_this.subResizeShow) {
|
|
|
|
|
|
_this.subResizeShow = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (!_this.subResizeShow) {
|
|
|
|
|
|
_this.subResizeShow = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
document.onmouseup = () => {
|
|
|
|
|
|
document.onmousemove = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
halfScreen() {
|
|
|
|
|
|
let contentRightDom = document.querySelector(".content-right"); //右侧内容区
|
|
|
|
|
|
let contentRightHeight = contentRightDom.offsetHeight;//可视高度
|
|
|
|
|
|
//主列表
|
|
|
|
|
|
document.querySelector(".main-list-with-sub").style.height = 'calc(50% - 4px)';
|
|
|
|
|
|
this.mainResizeShow = true;
|
|
|
|
|
|
//副列表
|
|
|
|
|
|
document.querySelector(".sub-list").style.height = 'calc(50% - 4px)';
|
|
|
|
|
|
this.subResizeShow = true;
|
|
|
|
|
|
},
|
|
|
|
|
|
fullScreen() {
|
|
|
|
|
|
let contentRightDom = document.querySelector(".content-right"); //右侧内容区
|
|
|
|
|
|
let contentRightHeight = contentRightDom.offsetHeight;//可视高度
|
|
|
|
|
|
//主列表
|
|
|
|
|
|
document.querySelector(".main-list-with-sub").style.height = '15px';
|
|
|
|
|
|
this.mainResizeShow = false;
|
|
|
|
|
|
//副列表
|
|
|
|
|
|
document.querySelector(".sub-list").style.height = contentRightHeight-24 + 'px';
|
|
|
|
|
|
},
|
2020-02-20 18:17:36 +08:00
|
|
|
|
clickLegend(legendName,index){
|
2020-03-06 09:29:53 +08:00
|
|
|
|
//点击图表某一个legend,图表只显示当前点击的曲线或柱状图,其它隐藏,再次点击已选中的legend ,显示全部
|
|
|
|
|
|
let curIsGrey=this.isGrey[index];
|
|
|
|
|
|
if(this.graphChart){
|
|
|
|
|
|
this.legend.forEach((item,i)=>{
|
|
|
|
|
|
let isGrey = this.isGrey[i];
|
|
|
|
|
|
if(index != i){
|
|
|
|
|
|
if(!curIsGrey && !isGrey){
|
|
|
|
|
|
this.graphChart.dispatchAction({
|
|
|
|
|
|
type: 'legendUnSelect',
|
|
|
|
|
|
name: item.name
|
|
|
|
|
|
});
|
|
|
|
|
|
}else if(!curIsGrey && isGrey){
|
|
|
|
|
|
this.graphChart.dispatchAction({
|
|
|
|
|
|
type: 'legendSelect',
|
|
|
|
|
|
name: item.name
|
|
|
|
|
|
});
|
|
|
|
|
|
}else{
|
|
|
|
|
|
this.graphChart.dispatchAction({
|
|
|
|
|
|
type: 'legendUnSelect',
|
|
|
|
|
|
name: item.name
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}else {
|
|
|
|
|
|
this.graphChart.dispatchAction({
|
|
|
|
|
|
type: 'legendSelect',
|
|
|
|
|
|
name: item.name
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.isGrey.forEach((item,i)=>{
|
|
|
|
|
|
if(index != i){
|
|
|
|
|
|
if(!curIsGrey && !item){
|
|
|
|
|
|
this.$set(this.isGrey, i, true);
|
|
|
|
|
|
}else if(!curIsGrey && item){
|
|
|
|
|
|
this.$set(this.isGrey, i, false);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
this.$set(this.isGrey, i, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
|
|
|
if(item === true){
|
|
|
|
|
|
this.$set(this.isGrey, i, false);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2020-02-20 18:17:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
formatLegend(name,chartWidth){
|
|
|
|
|
|
if(!name){
|
|
|
|
|
|
return '';
|
|
|
|
|
|
}
|
|
|
|
|
|
if(!chartWidth){
|
|
|
|
|
|
this.$refs.viewGraphChart.clientWidth;
|
|
|
|
|
|
}
|
|
|
|
|
|
//计算宽度
|
|
|
|
|
|
var span = document.createElement("span");
|
|
|
|
|
|
var result = {};
|
|
|
|
|
|
result.width = span.offsetWidth;
|
|
|
|
|
|
result.height = span.offsetHeight;
|
|
|
|
|
|
span.style.visibility = "hidden";
|
|
|
|
|
|
span.style.fontSize = 14;
|
|
|
|
|
|
span.style.fontFamily = "Arial";
|
|
|
|
|
|
span.style.display = "inline-block";
|
|
|
|
|
|
document.body.appendChild(span);
|
|
|
|
|
|
if(typeof span.textContent != "undefined"){
|
|
|
|
|
|
span.textContent = name;
|
|
|
|
|
|
}else{
|
|
|
|
|
|
span.innerText = name;
|
|
|
|
|
|
}
|
|
|
|
|
|
var txtWidth = parseFloat(window.getComputedStyle(span).width) - result.width;
|
|
|
|
|
|
document.body.removeChild(span);
|
|
|
|
|
|
|
|
|
|
|
|
if(txtWidth < chartWidth){
|
|
|
|
|
|
return name;
|
|
|
|
|
|
}else {
|
|
|
|
|
|
var charNum = `${(chartWidth-100)/(txtWidth/name.length)}`;
|
|
|
|
|
|
return name.slice(0,charNum)+'...';
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2020-02-10 16:50:34 +08:00
|
|
|
|
saveChart() { //新增chart
|
|
|
|
|
|
this.$refs.addChartModal.setTitle(this.$t("dashboard.panel.createChartTitle"));
|
|
|
|
|
|
this.$refs.addChartModal.show(true);
|
|
|
|
|
|
let metricInfo = {};
|
|
|
|
|
|
metricInfo.elements = [];
|
2020-02-11 11:30:56 +08:00
|
|
|
|
//console.info("aaa", this.selectedEndpoints)
|
2020-02-10 16:50:34 +08:00
|
|
|
|
for(let i = 0; i < this.selectedEndpoints.length; i++) {
|
|
|
|
|
|
let type = '';
|
|
|
|
|
|
if (this.selectedEndpoints[i].type == '1') {
|
|
|
|
|
|
type = 'expert';
|
|
|
|
|
|
} else if (this.selectedEndpoints[i].type == '2') {
|
|
|
|
|
|
type = 'normal';
|
|
|
|
|
|
}
|
|
|
|
|
|
metricInfo.elements.push({expression: this.selectedEndpoints[i].element, type: type});
|
|
|
|
|
|
}
|
|
|
|
|
|
this.$refs.addChartModal.createData(-1, metricInfo);
|
|
|
|
|
|
},
|
|
|
|
|
|
createSuccess(type, response, param, panel) {
|
|
|
|
|
|
this.$confirm(this.$t("dashboard.metric.goPanelTip"),this.$t("tip.saveSuccess"), {
|
|
|
|
|
|
confirmButtonText: this.$t("tip.yes"),
|
|
|
|
|
|
cancelButtonText: this.$t("tip.no"),
|
|
|
|
|
|
type: 'success'
|
|
|
|
|
|
}).then(() => {
|
2020-02-11 11:30:56 +08:00
|
|
|
|
bus.$emit("menu-change", 'panel');
|
2020-02-10 16:50:34 +08:00
|
|
|
|
this.$store.state.showPanel.id = panel.id;
|
|
|
|
|
|
this.$store.state.showPanel.name = panel.name;
|
|
|
|
|
|
this.$router.push({
|
|
|
|
|
|
path: "/panel",
|
|
|
|
|
|
query: {
|
|
|
|
|
|
t: +new Date()
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
2020-01-08 22:19:46 +08:00
|
|
|
|
elementsetShow(s, e) {
|
|
|
|
|
|
var eventfixed = {
|
|
|
|
|
|
shezhi: 0,
|
|
|
|
|
|
screen: 0
|
|
|
|
|
|
};
|
|
|
|
|
|
eventfixed[s] = 1;
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
this.$store.commit('setHeaderTable', this.tablelable);
|
|
|
|
|
|
this.$store.commit('setEventfixed', eventfixed);
|
|
|
|
|
|
const h = document.documentElement.clientHeight;
|
|
|
|
|
|
const w = document.documentElement.clientWidth;
|
|
|
|
|
|
const dw = this.$refs.elementset.$el.offsetWidth;
|
|
|
|
|
|
const dh = this.$refs.elementset.$el.offsetHeight;
|
|
|
|
|
|
let positionx =
|
2020-02-18 11:05:57 +08:00
|
|
|
|
e.clientX + dw <= w - 10 ? e.clientX + 14 : e.clientX + 14 - dw;
|
2020-01-08 22:19:46 +08:00
|
|
|
|
let positiony =
|
|
|
|
|
|
e.clientY + dh <= h - 10
|
2020-02-18 11:05:57 +08:00
|
|
|
|
? e.clientY + 20
|
|
|
|
|
|
: e.clientY + 20 - (e.clientY + dh - h);
|
2020-01-08 22:19:46 +08:00
|
|
|
|
this.$store.commit('setPosition', { positionx, positiony });
|
|
|
|
|
|
},
|
|
|
|
|
|
elementsetHide() {
|
|
|
|
|
|
//悬浮点击空白隐藏
|
|
|
|
|
|
this.$refs.elementset.elementsetHide();
|
|
|
|
|
|
},
|
|
|
|
|
|
tablelabelEmit(data) {
|
|
|
|
|
|
//获取子组件传过来的参数
|
|
|
|
|
|
this.$store.commit('setHeaderTable', data);
|
|
|
|
|
|
this.tablelable = data;
|
|
|
|
|
|
},
|
2019-12-25 20:33:58 +08:00
|
|
|
|
getEndpointTableData() {
|
|
|
|
|
|
this.endpointSearchLabel.moduleId = this.currentModule.id;
|
|
|
|
|
|
this.$set(this.endpointSearchLabel, 'pageNo', this.endpointPageObj.pageNo);
|
|
|
|
|
|
this.$set(this.endpointSearchLabel, 'pageSize', this.endpointPageObj.pageSize);
|
|
|
|
|
|
this.$get('endpoint', this.endpointSearchLabel).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
for (let i = 0; i < response.data.list.length; i++) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
let tempObj = JSON.parse(response.data.list[i].param);
|
|
|
|
|
|
response.data.list[i].paramObj = [];
|
|
|
|
|
|
for (let k in tempObj) {
|
|
|
|
|
|
response.data.list[i].paramObj.push({key: k, value: tempObj[k]})
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (err) {
|
2020-03-05 21:30:45 +08:00
|
|
|
|
//console.error(response.data.list[i], err);
|
2019-12-25 20:33:58 +08:00
|
|
|
|
}
|
2019-12-11 17:15:23 +08:00
|
|
|
|
}
|
2019-12-25 20:33:58 +08:00
|
|
|
|
this.endpointTableData = response.data.list;
|
|
|
|
|
|
this.endpointPageObj.total = response.data.total;
|
2019-12-11 17:15:23 +08:00
|
|
|
|
}
|
2019-12-25 20:33:58 +08:00
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
getMetricsTableData() {
|
2020-03-10 22:40:45 +08:00
|
|
|
|
// this.metricSearchLabel.moduleId = this.currentModule.id;
|
|
|
|
|
|
// this.$set(this.metricSearchLabel, 'pageNo', this.metricPageObj.pageNo);
|
|
|
|
|
|
// this.$set(this.metricSearchLabel, 'pageSize', this.metricPageObj.pageSize);
|
|
|
|
|
|
// this.$get('metric', this.metricSearchLabel).then(response => {
|
|
|
|
|
|
// if (response.code === 200) {
|
|
|
|
|
|
// this.metricsTableData = response.data.list;
|
|
|
|
|
|
// this.metricPageObj.total = response.data.total;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
2019-12-25 20:33:58 +08:00
|
|
|
|
},
|
|
|
|
|
|
endpointPageNo(val) {
|
|
|
|
|
|
this.endpointPageObj.pageNo = val;
|
|
|
|
|
|
this.getEndpointTableData();
|
|
|
|
|
|
},
|
|
|
|
|
|
endpointPageSize(val) {
|
|
|
|
|
|
this.endpointPageObj.pageSize = val;
|
2020-03-13 12:20:02 +08:00
|
|
|
|
localStorage.setItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId, val);
|
2019-12-25 20:33:58 +08:00
|
|
|
|
this.getEndpointTableData();
|
2020-03-09 18:26:02 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.gutterHandler(".endpoint-table");
|
|
|
|
|
|
});
|
2019-12-25 20:33:58 +08:00
|
|
|
|
},
|
|
|
|
|
|
metricsPageNo(val) {
|
|
|
|
|
|
this.metricPageObj.pageNo = val;
|
|
|
|
|
|
this.getMetricsTableData();
|
|
|
|
|
|
},
|
|
|
|
|
|
metricsPageSize(val) {
|
|
|
|
|
|
this.metricPageObj.pageSize = val;
|
|
|
|
|
|
this.getMetricsTableData();
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 获取左侧module列表数据
|
|
|
|
|
|
getModuleList() {
|
|
|
|
|
|
//若currentProject不存在(如页面刷新了),默认取project列表的第一个
|
|
|
|
|
|
if (this.currentProject && this.currentProject.id) {
|
|
|
|
|
|
this.$get('module', {projectId: this.currentProject.id, pageSize: 999, pageNo: 1}).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.moduleList = response.data.list;
|
|
|
|
|
|
for (let i = 0; i < this.moduleList.length; i++) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
let tempObj = JSON.parse(this.moduleList[i].param);
|
|
|
|
|
|
this.$set(this.moduleList[i], 'paramObj', []);
|
|
|
|
|
|
for (let k in tempObj) {
|
|
|
|
|
|
this.moduleList[i].paramObj.push({key: k, value: tempObj[k]});
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (err) {
|
2020-03-05 21:30:45 +08:00
|
|
|
|
//console.error(response.data.list[i], err);
|
2019-12-25 20:33:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.moduleList.length > 0) {
|
|
|
|
|
|
this.currentModule = this.moduleList[0];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.currentModule = {id: '', name: '', project: {}, port: '', path: '', param: '', paramObj: []};
|
2019-12-13 20:41:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2019-12-25 20:33:58 +08:00
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (this.projectList && this.projectList.length > 0) {
|
|
|
|
|
|
this.$store.commit('setProject', this.projectList[0]);
|
2019-12-13 20:41:32 +08:00
|
|
|
|
} else {
|
2019-12-25 20:33:58 +08:00
|
|
|
|
this.$get('project', {pageSize: 999, pageNo: 1}).then(response => {
|
|
|
|
|
|
if (response.code == 200) {
|
|
|
|
|
|
this.projectList = response.data.list;
|
|
|
|
|
|
if (this.projectList.length > 0) {
|
|
|
|
|
|
this.getModuleList();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2019-12-13 20:41:32 +08:00
|
|
|
|
}
|
2019-12-10 17:00:28 +08:00
|
|
|
|
}
|
2019-12-25 20:33:58 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//左侧module列表选中切换
|
|
|
|
|
|
changeModule(module) {
|
|
|
|
|
|
this.currentModule = module;
|
2019-12-27 17:53:17 +08:00
|
|
|
|
this.endpointSearchLabel = {moduleId: ''};
|
|
|
|
|
|
this.metricSearchLabel = {moduleId: ''};
|
|
|
|
|
|
this.$refs.projectSearch.clearSearch();
|
2020-02-04 18:52:09 +08:00
|
|
|
|
this.tableShow=1;
|
2020-02-06 12:49:18 +08:00
|
|
|
|
this.selectedEndpoints=[];
|
2019-12-25 20:33:58 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//弹出endpoint编辑页
|
|
|
|
|
|
toEditEndpoint(endpoint) {
|
2020-01-08 22:19:46 +08:00
|
|
|
|
this.editEndpoint = JSON.parse(JSON.stringify(endpoint));
|
2019-12-25 20:33:58 +08:00
|
|
|
|
this.rightBoxHandler(3);
|
2020-03-02 20:23:27 +08:00
|
|
|
|
this.$refs.editEndpointBox.toEdit(true, this.editEndpoint.id);
|
2019-12-25 20:33:58 +08:00
|
|
|
|
if (!this.editEndpoint.paramObj) {
|
|
|
|
|
|
this.$set(this.editEndpoint, 'paramObj', []);
|
2019-12-12 17:15:33 +08:00
|
|
|
|
}
|
2019-12-25 20:33:58 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
toCreateEndpoint() {
|
|
|
|
|
|
this.$refs.addEndpointBox.show(true);
|
|
|
|
|
|
this.$refs.addEndpointBox.clearEndpoints();
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//查看endpoint详情
|
|
|
|
|
|
endpointDetail(endpoint) {
|
|
|
|
|
|
this.editEndpoint = JSON.parse(JSON.stringify(endpoint));
|
|
|
|
|
|
if (!this.editEndpoint.paramObj) {
|
|
|
|
|
|
this.$set(this.editEndpoint, 'paramObj', []);
|
2019-12-11 17:15:23 +08:00
|
|
|
|
}
|
2019-12-25 20:33:58 +08:00
|
|
|
|
this.rightBoxHandler(3);
|
2020-03-02 20:23:27 +08:00
|
|
|
|
this.$refs.editEndpointBox.toEdit(false, this.editEndpoint.id);
|
2019-12-25 20:33:58 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//弹出module编辑页
|
|
|
|
|
|
toEditModule(module) {
|
|
|
|
|
|
this.currentModule = JSON.parse(JSON.stringify(module));
|
|
|
|
|
|
if (!this.currentModule.paramObj) {
|
|
|
|
|
|
this.$set(this.currentModule, 'paramObj', []);
|
2019-12-12 17:15:33 +08:00
|
|
|
|
}
|
2019-12-25 20:33:58 +08:00
|
|
|
|
this.editModule = JSON.parse(JSON.stringify(module));
|
|
|
|
|
|
if (!this.editModule.paramObj) {
|
|
|
|
|
|
this.$set(this.editModule, 'paramObj', []);
|
2019-12-12 17:15:33 +08:00
|
|
|
|
}
|
2019-12-25 20:33:58 +08:00
|
|
|
|
this.rightBoxHandler(2);
|
|
|
|
|
|
},
|
2019-12-12 17:15:33 +08:00
|
|
|
|
|
2020-01-08 10:17:31 +08:00
|
|
|
|
//asset弹框控制
|
|
|
|
|
|
tabControl(data) {
|
|
|
|
|
|
if (data === 'close') {
|
|
|
|
|
|
this.viewAssetState = false
|
|
|
|
|
|
this.$refs['assetEditUnit'].tabView = false
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2019-12-25 20:33:58 +08:00
|
|
|
|
//搜索
|
|
|
|
|
|
endpointSearch: function(searchObj) {
|
|
|
|
|
|
this.endpointSearchLabel = {};
|
2020-01-09 14:57:44 +08:00
|
|
|
|
this.endpointPageObj.pageNo = 1;
|
2019-12-25 20:33:58 +08:00
|
|
|
|
for (let item in searchObj) {
|
|
|
|
|
|
if (searchObj[item]) {
|
|
|
|
|
|
this.$set(this.endpointSearchLabel, item, searchObj[item]);
|
2019-12-13 17:08:35 +08:00
|
|
|
|
}
|
2019-12-25 20:33:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
this.getEndpointTableData();
|
|
|
|
|
|
},
|
|
|
|
|
|
//搜索
|
|
|
|
|
|
metricSearch: function(searchObj) {
|
|
|
|
|
|
this.metricSearchLabel = {};
|
2020-01-09 14:57:44 +08:00
|
|
|
|
this.metricPageObj.pageNo = 1;
|
2019-12-25 20:33:58 +08:00
|
|
|
|
for (let item in searchObj) {
|
|
|
|
|
|
if (searchObj[item]) {
|
|
|
|
|
|
this.$set(this.metricSearchLabel, item, searchObj[item]);
|
2019-12-13 17:08:35 +08:00
|
|
|
|
}
|
2019-12-25 20:33:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
this.getMetricsTableData();
|
|
|
|
|
|
},
|
2019-12-13 20:41:32 +08:00
|
|
|
|
|
2019-12-25 20:33:58 +08:00
|
|
|
|
//控制弹框状态 type 1:project; 2:module; 3:editEndponit; 4:addEndpoint;
|
|
|
|
|
|
rightBoxHandler(type) {
|
|
|
|
|
|
if (type == 1) {
|
|
|
|
|
|
this.$refs.projectBox.show(true);
|
2019-12-13 20:41:32 +08:00
|
|
|
|
|
2019-12-25 20:33:58 +08:00
|
|
|
|
if (this.$refs.moduleBox) {
|
|
|
|
|
|
this.$refs.moduleBox.show(false);
|
2019-12-13 20:41:32 +08:00
|
|
|
|
}
|
2019-12-25 20:33:58 +08:00
|
|
|
|
if (this.$refs.editEndpointBox) {
|
|
|
|
|
|
this.$refs.editEndpointBox.show(false);
|
2019-12-13 20:41:32 +08:00
|
|
|
|
}
|
2019-12-25 20:33:58 +08:00
|
|
|
|
//this.$refs.addEndpointBox.show(false);
|
|
|
|
|
|
} else if (type == 2) {
|
2020-01-06 19:09:40 +08:00
|
|
|
|
this.$refs.moduleBox.show(true,true);
|
2019-12-25 20:33:58 +08:00
|
|
|
|
|
|
|
|
|
|
if (this.$refs.projectBox) {
|
|
|
|
|
|
this.$refs.projectBox.show(false);
|
2019-12-13 20:41:32 +08:00
|
|
|
|
}
|
2019-12-25 20:33:58 +08:00
|
|
|
|
if (this.$refs.editEndpointBox) {
|
|
|
|
|
|
this.$refs.editEndpointBox.show(false);
|
2019-12-13 20:41:32 +08:00
|
|
|
|
}
|
2019-12-25 20:33:58 +08:00
|
|
|
|
//this.$refs.addEndpointBox.show(false);
|
|
|
|
|
|
} else if (type == 3) {
|
|
|
|
|
|
this.$refs.editEndpointBox.show(true);
|
|
|
|
|
|
if (this.$refs.projectBox) {
|
|
|
|
|
|
this.$refs.projectBox.show(false);
|
2019-12-13 17:08:35 +08:00
|
|
|
|
}
|
2019-12-25 20:33:58 +08:00
|
|
|
|
if (this.$refs.moduleBox) {
|
|
|
|
|
|
this.$refs.moduleBox.show(false);
|
2019-12-13 17:08:35 +08:00
|
|
|
|
}
|
2019-12-25 20:33:58 +08:00
|
|
|
|
//this.$refs.addEndpointBox.show(false);
|
|
|
|
|
|
} else if (type == 4) {
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
dateFormat(time) {
|
|
|
|
|
|
if (!time) {
|
|
|
|
|
|
return;
|
2019-12-18 17:00:44 +08:00
|
|
|
|
}
|
2020-01-06 19:03:38 +08:00
|
|
|
|
let date = new Date(time * 1000);
|
2019-12-25 20:33:58 +08:00
|
|
|
|
let year = date.getFullYear();
|
|
|
|
|
|
let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
|
|
|
|
|
let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
|
|
|
|
|
let hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
|
|
|
|
|
|
let minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
|
|
|
|
|
|
let seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
|
|
|
|
|
|
|
|
|
|
|
|
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
2020-01-06 19:03:38 +08:00
|
|
|
|
},
|
|
|
|
|
|
viewAsset:function(id){
|
|
|
|
|
|
this.viewAssetState=true;
|
|
|
|
|
|
this.$refs.assetEditUnit.getAssetData(id);
|
|
|
|
|
|
this.$refs.assetEditUnit.tabView=true;
|
2020-02-04 18:52:09 +08:00
|
|
|
|
},
|
|
|
|
|
|
showEndpoint:function(endpoint){
|
2020-03-11 18:48:05 +08:00
|
|
|
|
this.tableShow=3;
|
2020-03-12 14:10:37 +08:00
|
|
|
|
this.queryEdpLoading=true;
|
2020-03-16 15:38:03 +08:00
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
if(endpoint){
|
|
|
|
|
|
this.curEndpoint=endpoint;
|
|
|
|
|
|
this.formatTime='';
|
|
|
|
|
|
}
|
|
|
|
|
|
this.queryElementTips();
|
|
|
|
|
|
this.endpointQueryTabData=[];
|
|
|
|
|
|
this.showTableData=[];
|
|
|
|
|
|
this.showTableDataCopy='';
|
|
|
|
|
|
this.$get("/prom/api/v1/query?query={job='ed_"+this.curEndpoint.id+"'}&time="+this.formatTime).then(response=>{
|
|
|
|
|
|
if(response.status==="success"){
|
|
|
|
|
|
let results=response.data.result;
|
|
|
|
|
|
this.endpointQueryTabData=JSON.parse(JSON.stringify(results));
|
|
|
|
|
|
for (let result of results){
|
|
|
|
|
|
// {"metric":{"instance":"192.168.40.126:9100","__name__":"scrape_duration_seconds","module":"node_exporter","project":"kafka","asset":"192.168.40.126","job":"ed_1","dc":"dc5"},"value":[1580782176.522,"0.000560761"]}
|
|
|
|
|
|
let metricName=result.metric.__name__;
|
|
|
|
|
|
let temp=metricName;
|
|
|
|
|
|
let simpleTemp=metricName;//显示简略信息:隐藏same labels后的结果
|
|
|
|
|
|
let metricColor="";
|
|
|
|
|
|
let bracketsColor="#eb7b18";//#eb7b18
|
|
|
|
|
|
let labelColor="#65bbd1";//#66d9ef
|
|
|
|
|
|
let valueColor="#61c261";//#74e680
|
|
|
|
|
|
let colorTemp=`<span style="${metricColor}">${metricName}</span>`;
|
|
|
|
|
|
let colorSimpleTemp=`<span>${metricName}</span>`;
|
|
|
|
|
|
let metricTip={};
|
|
|
|
|
|
let queryInfos=(this.elementMetricDatas.filter((item)=>{
|
|
|
|
|
|
return item.metric===temp;
|
|
|
|
|
|
}));
|
|
|
|
|
|
if(queryInfos&&queryInfos.length>0){
|
|
|
|
|
|
metricTip=queryInfos[0];
|
|
|
|
|
|
}else{
|
|
|
|
|
|
metricTip.metric=temp;
|
2020-03-06 09:29:53 +08:00
|
|
|
|
}
|
2020-03-16 15:38:03 +08:00
|
|
|
|
delete result.metric.__name__;
|
|
|
|
|
|
temp+="{";
|
|
|
|
|
|
simpleTemp+="{";
|
|
|
|
|
|
colorTemp+=`<span style="color: ${bracketsColor}">{</span>`;
|
|
|
|
|
|
colorSimpleTemp+=`<span style="color: ${bracketsColor}">{</span>`;
|
|
|
|
|
|
let keys=Object.keys(result.metric);
|
|
|
|
|
|
for (let index in keys){
|
|
|
|
|
|
let key=keys[index];
|
|
|
|
|
|
temp+=key +"='"+result.metric[key]+"',";
|
|
|
|
|
|
colorTemp +=`<span style="color: ${labelColor}">${key}</span>=<span style="color: ${valueColor}">'${result.metric[key]}'</span>,`;
|
|
|
|
|
|
if(!this.sameLabels.some((i)=>{return i == key})){
|
|
|
|
|
|
simpleTemp+=key +"='"+result.metric[key]+"',";
|
|
|
|
|
|
colorSimpleTemp+=`<span style="color: ${labelColor}">${key}</span>=<span style="color: ${valueColor}">'${result.metric[key]}'</span>,`;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-03-16 18:33:54 +08:00
|
|
|
|
if(temp.indexOf(',') != -1){
|
|
|
|
|
|
temp=temp.substr(0,temp.length-1);
|
|
|
|
|
|
}
|
|
|
|
|
|
if(simpleTemp.indexOf(',') != -1){
|
|
|
|
|
|
simpleTemp=simpleTemp.substr(0,simpleTemp.length-1);
|
|
|
|
|
|
}
|
|
|
|
|
|
if(colorTemp.indexOf(',') != -1){
|
|
|
|
|
|
colorTemp=colorTemp.substr(0,colorTemp.length-1);
|
|
|
|
|
|
}
|
|
|
|
|
|
if(colorSimpleTemp.indexOf(',') != -1){
|
|
|
|
|
|
colorSimpleTemp=colorSimpleTemp.substr(0,colorSimpleTemp.length-1);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-03-09 08:41:21 +08:00
|
|
|
|
|
2020-03-16 15:38:03 +08:00
|
|
|
|
temp+="}";
|
|
|
|
|
|
simpleTemp+="}";
|
|
|
|
|
|
colorTemp+=`<span style="color: ${bracketsColor}">}</span>`;
|
|
|
|
|
|
colorSimpleTemp+=`<span style="color: ${bracketsColor}">}</span>`;
|
|
|
|
|
|
if(!/.+\{.+\}/.test(simpleTemp)){
|
|
|
|
|
|
simpleTemp=simpleTemp.substr(0,simpleTemp.length-2);
|
|
|
|
|
|
}
|
2020-03-09 08:41:21 +08:00
|
|
|
|
|
2020-03-16 15:38:03 +08:00
|
|
|
|
if(!/.+\{<\/span><span.+?>.+?\}/.test(colorSimpleTemp)){
|
|
|
|
|
|
let metricReg=new RegExp("<span.*?>"+metricName+"<\/span>")
|
|
|
|
|
|
colorSimpleTemp=metricReg.exec(colorSimpleTemp)[0];
|
|
|
|
|
|
}
|
2020-03-09 08:41:21 +08:00
|
|
|
|
|
2020-03-16 15:38:03 +08:00
|
|
|
|
let edpQueryData={element:temp,simpleElement:simpleTemp,colorElement:colorTemp,colorSimpleElement:colorSimpleTemp, value:result.value[1],type:(result.metric.type?result.metric.type:'2'),metricTip:metricTip};
|
|
|
|
|
|
this.showTableData.push(edpQueryData);
|
2020-03-05 21:30:45 +08:00
|
|
|
|
}
|
2020-03-16 15:38:03 +08:00
|
|
|
|
this.showTableDataCopy=JSON.stringify(this.showTableData);
|
|
|
|
|
|
this.queryEdpLoading=false;
|
|
|
|
|
|
this.gutterHandler(".endpoint-query-table"); //控制table右边距
|
|
|
|
|
|
this.showTopBtn2 = false;
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
//绑定滚动条事件,控制top按钮
|
|
|
|
|
|
let el = this.$refs.metricInfoTab.$el.querySelector(".el-table__body-wrapper");
|
|
|
|
|
|
if (el._ps_) {
|
|
|
|
|
|
el.addEventListener("ps-scroll-y", () => {
|
|
|
|
|
|
if (el._ps_.scrollbarYTop > 20) {
|
|
|
|
|
|
this.showTopBtn2 = true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.showTopBtn2 = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.gutterHandler(".endpoint-table");
|
|
|
|
|
|
});
|
|
|
|
|
|
}, 400);
|
2020-02-04 18:52:09 +08:00
|
|
|
|
},
|
2020-02-06 12:04:41 +08:00
|
|
|
|
backToEdpTab:function(){
|
|
|
|
|
|
this.tableShow=1;
|
|
|
|
|
|
this.selectedEndpoints=[];
|
2020-03-16 15:38:03 +08:00
|
|
|
|
this.showTableData = [];
|
2020-03-05 21:30:45 +08:00
|
|
|
|
this.showTopBtn1 = false;
|
2020-03-17 17:14:07 +08:00
|
|
|
|
// 主列表恢复全屏
|
|
|
|
|
|
this.mainResizeShow = this.subResizeShow = true;
|
|
|
|
|
|
document.querySelector('.main-list').style.height = "";
|
|
|
|
|
|
|
2020-03-09 18:26:02 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.gutterHandler(".endpoint-table");
|
|
|
|
|
|
});
|
2020-02-06 12:04:41 +08:00
|
|
|
|
},
|
2020-02-04 18:52:09 +08:00
|
|
|
|
changeTime:function(size,unit){
|
|
|
|
|
|
let time=this.getTime(size,unit);
|
|
|
|
|
|
this.formatTime=time;
|
|
|
|
|
|
this.showEndpoint();
|
|
|
|
|
|
},
|
|
|
|
|
|
pickTime:function(){
|
2020-02-11 11:30:56 +08:00
|
|
|
|
//console.log(this.formatTime)
|
2020-02-04 18:52:09 +08:00
|
|
|
|
this.showEndpoint();
|
|
|
|
|
|
},
|
|
|
|
|
|
getTime:function(size,unit){//计算时间
|
|
|
|
|
|
let now=!this.formatTime? new Date():new Date(this.formatTime);
|
|
|
|
|
|
if(unit){
|
|
|
|
|
|
switch (unit) {
|
|
|
|
|
|
case 'y':
|
|
|
|
|
|
now.setFullYear(now.getFullYear()+size);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'M':
|
|
|
|
|
|
now.setMonth(now.getMonth()+size);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'd':
|
|
|
|
|
|
now.setDate(now.getDate()+size);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'h':
|
|
|
|
|
|
now.setHours(now.getHours()+size);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'm':
|
|
|
|
|
|
now.setMinutes(now.getMinutes()+size);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 's':
|
|
|
|
|
|
now.setSeconds(now.getSeconds()+size);
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
console.error('unit error');
|
|
|
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
|
|
|
now.setSeconds(now.getSeconds()+size);
|
|
|
|
|
|
}
|
|
|
|
|
|
let year=now.getFullYear();
|
|
|
|
|
|
let month=now.getMonth()+1;
|
|
|
|
|
|
month=month<10?"0"+month:month;
|
|
|
|
|
|
let day=now.getDate();
|
|
|
|
|
|
day=day<10?"0"+day:day;
|
|
|
|
|
|
let hour=now.getHours();
|
|
|
|
|
|
hour=hour<10?"0"+hour:hour;
|
|
|
|
|
|
let minute=now.getMinutes();
|
|
|
|
|
|
minute=minute<10?"0"+minute:minute;
|
|
|
|
|
|
let second=now.getSeconds();
|
|
|
|
|
|
second=second<10?"0"+second:second;
|
|
|
|
|
|
let current=year+"-"+month+"-"+day+" "+hour+":"+minute+":"+second;
|
|
|
|
|
|
return current;
|
|
|
|
|
|
},
|
2020-02-20 18:17:36 +08:00
|
|
|
|
selectChange:function(selection){//selection 选中的row的数组
|
2020-02-06 12:04:41 +08:00
|
|
|
|
this.selectedEndpoints=selection;
|
2020-02-04 18:52:09 +08:00
|
|
|
|
},
|
2020-02-06 12:04:41 +08:00
|
|
|
|
selectable:function(row,index){
|
|
|
|
|
|
if(this.selectedEndpoints.length>=20 && !this.selectedEndpoints.includes(row)){
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}else{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
2020-02-04 18:52:09 +08:00
|
|
|
|
},
|
2020-02-20 18:17:36 +08:00
|
|
|
|
clearSelectedMetrics:function(){
|
|
|
|
|
|
this.$refs.metricInfoTab.clearSelection();
|
|
|
|
|
|
},
|
2020-02-06 12:04:41 +08:00
|
|
|
|
viewGraph:function(){
|
2020-02-20 18:17:36 +08:00
|
|
|
|
if(this.selectedEndpoints.length<1){
|
|
|
|
|
|
return ;
|
|
|
|
|
|
}
|
2020-02-06 12:04:41 +08:00
|
|
|
|
if(this.graphChart){
|
|
|
|
|
|
this.graphChart.clear();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.chartDatas=[];
|
2020-02-20 18:17:36 +08:00
|
|
|
|
this.legend=[];
|
2020-02-06 12:04:41 +08:00
|
|
|
|
this.graphShow=true;
|
2020-03-12 14:10:37 +08:00
|
|
|
|
setTimeout(()=>{this.$refs.graphLoading.startLoading();this.queryChartDate();},10)
|
2020-02-06 12:04:41 +08:00
|
|
|
|
|
2020-02-04 18:52:09 +08:00
|
|
|
|
},
|
2020-02-06 12:04:41 +08:00
|
|
|
|
dialogClose:function(){
|
|
|
|
|
|
this.graphShow=false;
|
|
|
|
|
|
this.graphChart.clear();
|
|
|
|
|
|
},
|
|
|
|
|
|
queryChartDate:function(){
|
|
|
|
|
|
let start=this.searchTime[0]?this.searchTime[0]:this.getTime(-1,'h');
|
|
|
|
|
|
let end=this.searchTime[1]?this.searchTime[1]:this.getTime(0,'h')
|
|
|
|
|
|
this.searchTime=[start,end];
|
|
|
|
|
|
let timeDiff=(new Date(end).getTime()-new Date(start).getTime())/1000/(24*60*60);
|
|
|
|
|
|
// end - start < 1 day : 15s
|
|
|
|
|
|
// end - start < 7 day : 5m
|
|
|
|
|
|
// end - start < 30 day : 10m
|
|
|
|
|
|
// end - start > 30 day : 30m
|
|
|
|
|
|
let step='15s';
|
|
|
|
|
|
if(timeDiff< 1){
|
|
|
|
|
|
step='15s';
|
|
|
|
|
|
}else if(timeDiff < 7){
|
|
|
|
|
|
step='5m';
|
|
|
|
|
|
}else if(timeDiff<30){
|
|
|
|
|
|
step='10m';
|
|
|
|
|
|
}else{
|
|
|
|
|
|
step='30m';
|
|
|
|
|
|
}
|
2020-03-06 09:29:53 +08:00
|
|
|
|
let axiosArr=[];
|
2020-02-06 12:04:41 +08:00
|
|
|
|
for(let endpoint of this.selectedEndpoints){
|
2020-03-06 09:29:53 +08:00
|
|
|
|
axiosArr.push(axios.get("/prom/api/v1/query_range?query="+endpoint.element+"&start="+start+"&end="+end+"&step="+step));
|
|
|
|
|
|
}
|
|
|
|
|
|
this.legend=[];
|
|
|
|
|
|
this.isGrey=[];
|
|
|
|
|
|
axios.all(axiosArr).then(res =>{
|
|
|
|
|
|
res.forEach((response,promIndex)=>{
|
|
|
|
|
|
if (response.status == 200) {
|
2020-03-09 08:41:21 +08:00
|
|
|
|
if(response.data.status == 'success'){
|
|
|
|
|
|
let queryData=response.data.data.result[0];
|
|
|
|
|
|
if(queryData){
|
|
|
|
|
|
let chartData={
|
|
|
|
|
|
type:"line",
|
|
|
|
|
|
symbol:'none', //去掉点
|
|
|
|
|
|
smooth:true, //曲线变平滑
|
|
|
|
|
|
};
|
|
|
|
|
|
chartData.name=queryData.metric.__name__;
|
|
|
|
|
|
let alias=queryData.metric.__name__;
|
|
|
|
|
|
delete queryData.metric.__name__;
|
|
|
|
|
|
chartData.name+="{";
|
|
|
|
|
|
alias+="{";
|
|
|
|
|
|
Object.keys(queryData.metric).forEach((item,index)=>{
|
|
|
|
|
|
let label=item;
|
|
|
|
|
|
let value=queryData.metric[label];
|
|
|
|
|
|
chartData.name+=label +"='"+value+"',";
|
|
|
|
|
|
if(!this.sameLabels.some((i)=>{return i == label})){
|
|
|
|
|
|
alias+=label +"='"+value+"',";
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
chartData.name=chartData.name.charAt(chartData.name.length-1) == ","?chartData.name.substr(0,chartData.name.length-1):chartData.name;
|
|
|
|
|
|
alias=alias.charAt(alias.length-1) == ","?alias.substr(0,alias.length-1):alias;
|
|
|
|
|
|
chartData.name+="}";
|
|
|
|
|
|
alias+="}";
|
|
|
|
|
|
if(!/.+\{.+\}/.test(alias)){
|
|
|
|
|
|
alias=alias.substr(0,alias.length-2);
|
2020-03-06 09:29:53 +08:00
|
|
|
|
}
|
2020-03-09 08:41:21 +08:00
|
|
|
|
let legend={
|
|
|
|
|
|
name:chartData.name,
|
|
|
|
|
|
alias:alias,
|
|
|
|
|
|
showText:this.formatLegend(chartData.name)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.legend.push(legend);
|
|
|
|
|
|
this.isGrey.push(false);
|
|
|
|
|
|
chartData.data=queryData.values.map((dpsItem, dpsIndex) => {
|
|
|
|
|
|
return [dpsItem[0] * 1000, Number(dpsItem[1])];
|
|
|
|
|
|
});
|
|
|
|
|
|
this.chartDatas.push(chartData);
|
2020-02-20 18:17:36 +08:00
|
|
|
|
}
|
2020-03-09 08:41:21 +08:00
|
|
|
|
}else{
|
|
|
|
|
|
this.$message.error(response.data.error)
|
|
|
|
|
|
console.error(response.data)
|
2020-02-06 12:04:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2020-03-06 09:29:53 +08:00
|
|
|
|
this.$nextTick(()=>{
|
2020-03-09 08:41:21 +08:00
|
|
|
|
if(this.graphChart){
|
|
|
|
|
|
this.graphChart.clear();
|
|
|
|
|
|
this.chartOptions.color=this.bgColorList;
|
|
|
|
|
|
this.chartOptions.series=this.chartDatas;
|
|
|
|
|
|
this.graphChart.setOption(this.chartOptions);//创建图表
|
|
|
|
|
|
this.$refs.chartScrollbar.update();
|
2020-03-12 14:10:37 +08:00
|
|
|
|
this.$refs.graphLoading.endLoading();
|
2020-03-09 08:41:21 +08:00
|
|
|
|
}
|
2020-03-06 09:29:53 +08:00
|
|
|
|
});
|
2020-03-12 14:10:37 +08:00
|
|
|
|
|
2020-03-06 09:29:53 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2020-02-06 12:04:41 +08:00
|
|
|
|
dateChange:function(){
|
|
|
|
|
|
if(this.graphChart){
|
|
|
|
|
|
this.graphChart.clear();
|
2020-03-06 09:29:53 +08:00
|
|
|
|
this.queryChartDate();
|
2020-02-06 12:04:41 +08:00
|
|
|
|
}
|
2020-03-06 09:29:53 +08:00
|
|
|
|
|
2020-02-06 12:04:41 +08:00
|
|
|
|
},
|
|
|
|
|
|
initDialog:function(){
|
|
|
|
|
|
this.graphChart = echarts.init(document.getElementById('viewGraphChart'));
|
2020-03-06 09:29:53 +08:00
|
|
|
|
// this.queryChartDate();
|
2020-02-20 18:17:36 +08:00
|
|
|
|
// this.chartOptions.legend.data=this.legend;
|
2020-03-06 09:29:53 +08:00
|
|
|
|
// this.chartOptions.series=this.chartDatas;
|
|
|
|
|
|
// this.graphChart.setOption(this.chartOptions);//创建图表
|
|
|
|
|
|
// console.log(this.chartOptions)
|
2020-02-20 18:17:36 +08:00
|
|
|
|
// let legendHeight = this.$refs.legendArea.offsetHeight;
|
|
|
|
|
|
// let dialogDom=document.getElementById('viewGraphDialog');
|
|
|
|
|
|
// let dialogWidth=dialogDom.offsetWidth
|
|
|
|
|
|
// let dialogHeight=dialogDom.offsetHeight
|
|
|
|
|
|
// console.log(legendHeight+":"+dialogWidth+":"+dialogHeight)
|
|
|
|
|
|
// let chartWidth=dialogWidth-130;
|
|
|
|
|
|
// let chartHeight=dialogHeight-58-legendHeight-60;
|
|
|
|
|
|
// console.log(chartWidth + ":"+chartHeight)
|
|
|
|
|
|
// this.graphChart.resize({height:300,width:chartWidth})
|
2020-02-06 12:04:41 +08:00
|
|
|
|
},
|
|
|
|
|
|
cellClass(row){ //给复选框那一列添加 类名为 ‘disabledCheck’
|
|
|
|
|
|
if (row.columnIndex === 0) {
|
|
|
|
|
|
return 'disabledCheck'
|
|
|
|
|
|
}
|
2020-02-04 18:52:09 +08:00
|
|
|
|
},
|
2020-02-10 16:50:34 +08:00
|
|
|
|
getPanelData() { //获取panel数据
|
|
|
|
|
|
this.$get('panel?pageNo=1&pageSize=-1').then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.panelData = response.data.list;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
2020-02-13 12:33:22 +08:00
|
|
|
|
tableFilter:function(){
|
2020-03-06 09:29:53 +08:00
|
|
|
|
let temp=this;
|
2020-02-13 12:33:22 +08:00
|
|
|
|
let tableDatas=JSON.parse(this.showTableDataCopy);
|
|
|
|
|
|
this.showTableData=tableDatas.filter((item)=>{
|
2020-03-06 09:29:53 +08:00
|
|
|
|
let element=temp.hideSameLabels?item.simpleElement: item.element;
|
2020-02-13 12:33:22 +08:00
|
|
|
|
return element.indexOf(this.queryExpression) != -1;
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
tableFilterHistory:function(expression){
|
2020-02-11 19:55:20 +08:00
|
|
|
|
let metric='';
|
|
|
|
|
|
let labels=[];
|
|
|
|
|
|
if(/\w*\{.*\}.*/i.test(expression)){
|
|
|
|
|
|
metric=expression.substr(0,expression.indexOf('{'));
|
|
|
|
|
|
let labelStr=expression.substr(expression.indexOf('{')+1,expression.indexOf('}')-expression.indexOf('{')-1);
|
|
|
|
|
|
let labelArr=labelStr.split(',');
|
2020-02-13 09:34:47 +08:00
|
|
|
|
|
|
|
|
|
|
if(labelArr.length>0){
|
|
|
|
|
|
labels=labelArr.map((item,index)=>{
|
|
|
|
|
|
let temp=item.split('=');
|
|
|
|
|
|
let label=temp[0]&&temp[0]!=''?temp[0]:null;
|
|
|
|
|
|
let value=temp[1]&&temp[1]!=''?temp[1]:null;
|
|
|
|
|
|
return label?{label:label,value:value}:null;
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-11 19:55:20 +08:00
|
|
|
|
}else{
|
|
|
|
|
|
metric=expression;
|
|
|
|
|
|
}
|
|
|
|
|
|
this.showTableData=[];
|
|
|
|
|
|
let sourceData=JSON.parse(JSON.stringify(this.endpointQueryTabData))
|
|
|
|
|
|
sourceData=sourceData.filter((item)=>{
|
|
|
|
|
|
let metricName=item.metric.__name__;
|
|
|
|
|
|
if(metricName.indexOf(metric)==-1){
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2020-02-13 09:34:47 +08:00
|
|
|
|
|
|
|
|
|
|
if(labels.length>0){
|
|
|
|
|
|
for(let i in labels){
|
|
|
|
|
|
let label=labels[i];
|
|
|
|
|
|
if(label&&label.label){
|
|
|
|
|
|
let value=item.metric[label.label];
|
|
|
|
|
|
let queryVal=label.value;
|
|
|
|
|
|
debugger
|
|
|
|
|
|
if(/^'.+'$/.test(queryVal)){
|
|
|
|
|
|
queryVal=queryVal.substr(1,queryVal.length-2);
|
|
|
|
|
|
}
|
|
|
|
|
|
if(!value || value != queryVal){
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
2020-02-11 19:55:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-02-13 09:34:47 +08:00
|
|
|
|
|
2020-02-11 19:55:20 +08:00
|
|
|
|
return true;
|
|
|
|
|
|
})
|
|
|
|
|
|
for(let i in sourceData){
|
|
|
|
|
|
let item=sourceData[i];
|
|
|
|
|
|
// {"metric":{"instance":"192.168.40.126:9100","__name__":"scrape_duration_seconds","module":"node_exporter","project":"kafka","asset":"192.168.40.126","job":"ed_1","dc":"dc5"},"value":[1580782176.522,"0.000560761"]}
|
|
|
|
|
|
let metricName=item.metric.__name__;
|
|
|
|
|
|
let temp=metricName;
|
|
|
|
|
|
delete item.metric.__name__;
|
|
|
|
|
|
temp+="{";
|
|
|
|
|
|
let hasLabel=true;
|
|
|
|
|
|
for (let key in item.metric){
|
|
|
|
|
|
let label=key;
|
|
|
|
|
|
let value=item.metric[label];
|
|
|
|
|
|
temp+=label +"='"+value+"',";
|
|
|
|
|
|
}
|
|
|
|
|
|
temp=temp.charAt(temp.length-1) == ","?temp.substr(0,temp.length-1):temp;
|
|
|
|
|
|
temp+="}";
|
|
|
|
|
|
if(hasLabel){
|
|
|
|
|
|
let edpQueryData={element:temp,value:item.value[1],type:(item.metric.type?item.metric.type:'2')};
|
|
|
|
|
|
this.showTableData.push(edpQueryData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2020-02-13 13:10:42 +08:00
|
|
|
|
},
|
|
|
|
|
|
focusInput:function(){
|
2020-02-14 18:07:21 +08:00
|
|
|
|
let classVal=document.getElementById('elementQuery').parentElement.getAttribute("class");
|
2020-02-17 16:32:40 +08:00
|
|
|
|
classVal=classVal.replace('query-input-inactive','query-input-active');
|
2020-02-14 18:07:21 +08:00
|
|
|
|
document.getElementById('elementQuery').parentElement.setAttribute("class",classVal );
|
|
|
|
|
|
this.$refs.elementQuery.focus();
|
2020-02-13 13:10:42 +08:00
|
|
|
|
},
|
|
|
|
|
|
blurInput:function(){
|
|
|
|
|
|
if(!this.queryExpression || this.queryExpression == ''){
|
2020-02-14 18:07:21 +08:00
|
|
|
|
setTimeout(function(){
|
|
|
|
|
|
let classVal=document.getElementById('elementQuery').parentElement.getAttribute("class");
|
2020-02-17 16:32:40 +08:00
|
|
|
|
classVal=classVal.replace('query-input-active','query-input-inactive');
|
2020-02-14 18:07:21 +08:00
|
|
|
|
document.getElementById('elementQuery').parentElement.setAttribute("class",classVal );
|
|
|
|
|
|
},100)
|
2020-02-13 13:10:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
clearInput:function(){
|
2020-03-06 09:29:53 +08:00
|
|
|
|
|
|
|
|
|
|
this.$refs.elementQuery.focus();
|
2020-02-17 18:41:38 +08:00
|
|
|
|
},
|
2020-02-19 10:43:58 +08:00
|
|
|
|
queryElementTips:async function(){
|
2020-02-17 18:41:38 +08:00
|
|
|
|
this.elementMetricDatas=[];
|
2020-02-19 10:43:58 +08:00
|
|
|
|
// this.$get("/metric/metadata?endpointId="+this.curEndpoint.id).then(response=> {
|
|
|
|
|
|
// if (response.status === "success") {
|
|
|
|
|
|
// this.elementMetricDatas=response.data.list;
|
|
|
|
|
|
// console.log('metric tips')
|
|
|
|
|
|
// console.log(this.elementMetricDatas)
|
|
|
|
|
|
// }
|
|
|
|
|
|
// })
|
|
|
|
|
|
let response= await axios.get("/metric/metadata?endpointId="+this.curEndpoint.id);
|
|
|
|
|
|
if(response&&response.status === 200){
|
|
|
|
|
|
if(response.data.msg==='success'){
|
|
|
|
|
|
this.elementMetricDatas=response.data.data.list;
|
2020-02-17 18:41:38 +08:00
|
|
|
|
}
|
2020-02-19 10:43:58 +08:00
|
|
|
|
}
|
2020-03-05 21:30:45 +08:00
|
|
|
|
},
|
2020-03-10 22:40:45 +08:00
|
|
|
|
getStateContent:function(row){
|
|
|
|
|
|
if(row){
|
|
|
|
|
|
if(row.state == 1){
|
|
|
|
|
|
|
|
|
|
|
|
return 'up'+'['+this.formatUpdateTime(row.lastUpdate)+']';
|
|
|
|
|
|
}else{
|
|
|
|
|
|
return 'down'+'['+this.getStateErrorMsg(row)+']';
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
formatUpdateTime:function(date){
|
|
|
|
|
|
let time=new Date(date);
|
|
|
|
|
|
let hours=time.getHours()>9?time.getHours():'0'+time.getHours();
|
|
|
|
|
|
let minutes=time.getMinutes()>9?time.getMinutes():'0'+time.getMinutes();
|
|
|
|
|
|
|
|
|
|
|
|
return hours+':'+minutes;
|
|
|
|
|
|
},
|
|
|
|
|
|
getStateErrorMsg:function(row){
|
|
|
|
|
|
let errCodes=[230009,230010,230011];
|
|
|
|
|
|
if(row){
|
|
|
|
|
|
if(row.state == 0){
|
|
|
|
|
|
if(errCodes.find((item)=>{return row.stateInfo.code == item})){
|
|
|
|
|
|
return this.$t('project.endpoint.stateInfo_'+row.stateInfo.code)
|
|
|
|
|
|
}else{
|
|
|
|
|
|
return row.stateInfo.msg;
|
|
|
|
|
|
this.$message.error('state code error');
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2019-12-12 17:15:33 +08:00
|
|
|
|
},
|
2019-12-25 20:33:58 +08:00
|
|
|
|
created() {
|
|
|
|
|
|
this.currentProject = this.$store.state.currentProject;
|
|
|
|
|
|
this.getModuleList();
|
|
|
|
|
|
this.getMetricsTableData();
|
2019-12-13 20:41:32 +08:00
|
|
|
|
},
|
2019-12-25 20:33:58 +08:00
|
|
|
|
mounted() {
|
2020-03-13 12:20:02 +08:00
|
|
|
|
//是否存在分页缓存
|
|
|
|
|
|
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
|
|
|
|
|
|
if (pageSize) {
|
|
|
|
|
|
this.endpointPageObj.pageSize = pageSize
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-10 16:50:34 +08:00
|
|
|
|
this.getPanelData();
|
2019-12-25 20:33:58 +08:00
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
|
this.getEndpointTableData();
|
|
|
|
|
|
}, 200);
|
2020-03-05 21:30:45 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.gutterHandler(".endpoint-table");
|
|
|
|
|
|
//绑定滚动条事件,控制top按钮
|
|
|
|
|
|
let el = this.$refs.endpointTable.$el.querySelector(".el-table__body-wrapper");
|
|
|
|
|
|
if (el._ps_) {
|
|
|
|
|
|
el.addEventListener("ps-scroll-y", () => {
|
2020-03-06 17:53:36 +08:00
|
|
|
|
if (el._ps_.scrollbarYTop > 50) {
|
2020-03-05 21:30:45 +08:00
|
|
|
|
this.showTopBtn1 = true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.showTopBtn1 = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2020-03-09 18:05:43 +08:00
|
|
|
|
//resize时刷新左侧列表滚动条
|
|
|
|
|
|
let _this = this;
|
|
|
|
|
|
window.onresize = function() {
|
|
|
|
|
|
_this.$refs.leftScrollbar.update();
|
|
|
|
|
|
}
|
2020-03-05 21:30:45 +08:00
|
|
|
|
|
2020-01-08 22:19:46 +08:00
|
|
|
|
this.tablelable = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)
|
|
|
|
|
|
? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path))
|
|
|
|
|
|
: this.endpointTableTitle;
|
|
|
|
|
|
this.dropCol = localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path)
|
|
|
|
|
|
? JSON.parse(localStorage.getItem("nz-tableTitle-" + localStorage.getItem("nz-username") + "-" + this.$route.path))
|
|
|
|
|
|
: this.endpointTableTitle;
|
2020-02-20 18:17:36 +08:00
|
|
|
|
|
2019-12-13 20:41:32 +08:00
|
|
|
|
},
|
2019-12-25 20:33:58 +08:00
|
|
|
|
computed: {
|
|
|
|
|
|
currentProjectChange() {
|
|
|
|
|
|
return this.$store.state.currentProject;
|
2019-12-31 19:02:58 +08:00
|
|
|
|
},
|
|
|
|
|
|
moduleListReloadWatch() {
|
|
|
|
|
|
return this.$store.state.moduleListChange;
|
|
|
|
|
|
},
|
2019-12-13 20:41:32 +08:00
|
|
|
|
},
|
2019-12-25 20:33:58 +08:00
|
|
|
|
watch: {
|
|
|
|
|
|
currentProjectChange(n, o) {
|
|
|
|
|
|
this.currentProject = Object.assign({}, n);
|
|
|
|
|
|
},
|
|
|
|
|
|
currentProject(n, o) {
|
|
|
|
|
|
this.getModuleList();
|
|
|
|
|
|
},
|
|
|
|
|
|
currentModule(n, o) {
|
|
|
|
|
|
this.metricPageObj.pageNo = 1;
|
|
|
|
|
|
this.endpointPageObj.pageNo = 1;
|
|
|
|
|
|
if (n && n.id) {
|
|
|
|
|
|
this.getEndpointTableData();
|
|
|
|
|
|
this.getMetricsTableData();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.endpointTableData = [];
|
|
|
|
|
|
this.metricsTableData = [];
|
|
|
|
|
|
}
|
2019-12-31 19:02:58 +08:00
|
|
|
|
},
|
|
|
|
|
|
moduleListReloadWatch(n, o) {
|
|
|
|
|
|
this.getModuleList(this.currentProject.id);
|
2020-02-06 12:04:41 +08:00
|
|
|
|
},
|
|
|
|
|
|
curEndpoint:function(n,o){
|
2020-02-07 20:14:00 +08:00
|
|
|
|
// this.chartOptions.title.text=n.host+ " tsg disk"
|
2020-02-13 12:33:22 +08:00
|
|
|
|
},
|
|
|
|
|
|
queryExpression:function(n,o){
|
|
|
|
|
|
let temp=this;
|
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
|
temp.tableFilter();
|
2020-03-16 18:33:54 +08:00
|
|
|
|
},500)
|
2020-02-13 12:33:22 +08:00
|
|
|
|
},
|
2020-03-09 18:05:43 +08:00
|
|
|
|
},
|
|
|
|
|
|
destroyed() {
|
|
|
|
|
|
window.onresize = null;
|
2019-12-12 17:15:33 +08:00
|
|
|
|
}
|
2019-11-29 15:00:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
</script>
|
2019-12-25 20:33:58 +08:00
|
|
|
|
|
2020-01-02 17:57:40 +08:00
|
|
|
|
<style scoped lang="scss">
|
2019-12-25 20:33:58 +08:00
|
|
|
|
.project {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
.content-right-option {
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
margin-right: 6px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.content-right-option .el-icon-delete {
|
|
|
|
|
|
color: #F98D9A;
|
|
|
|
|
|
}
|
|
|
|
|
|
.content-right-option .el-icon-delete:hover {
|
|
|
|
|
|
color: #D96D7A;
|
|
|
|
|
|
}
|
|
|
|
|
|
.content-right-option .el-icon-view {
|
|
|
|
|
|
color: #60BEFF;
|
|
|
|
|
|
}
|
|
|
|
|
|
.content-right-option .el-icon-view:hover {
|
|
|
|
|
|
color: #409EFF;
|
|
|
|
|
|
}
|
|
|
|
|
|
/* start--param*/
|
|
|
|
|
|
.param-btn {
|
|
|
|
|
|
float: right;
|
|
|
|
|
|
height: 27px;
|
|
|
|
|
|
margin-top: -3px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.param-btn-active {
|
|
|
|
|
|
background-color: #656565;
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
border: 1px solid #656565;
|
|
|
|
|
|
}
|
|
|
|
|
|
.param-btn-active:hover, .param-btn-active:focus {
|
|
|
|
|
|
background-color: #656565;
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
}
|
|
|
|
|
|
.param-btn-clear {
|
|
|
|
|
|
background-color: #D4D4D4;
|
|
|
|
|
|
border: 1px solid #D4D4D4;
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
}
|
|
|
|
|
|
.param-btn-clear:hover, .param-btn-clear:focus {
|
|
|
|
|
|
background-color: #D4D4D4;
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.param-box {
|
|
|
|
|
|
border: 1px solid #DCDFE6;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
padding: 0 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.param-box-endpoint {
|
|
|
|
|
|
height: 325px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.param-box-module {
|
|
|
|
|
|
height: 227px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.param-box-row {
|
|
|
|
|
|
padding: 7px 0 0 0;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
}
|
|
|
|
|
|
.param-box-row:last-of-type {
|
|
|
|
|
|
padding-bottom: 7px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.param-box-row-key, .param-box-row-value {
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
width: 41.5%;
|
|
|
|
|
|
}
|
|
|
|
|
|
.param-box-row-eq {
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
width: 22px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
height: 32px;
|
|
|
|
|
|
line-height: 32px;
|
|
|
|
|
|
color: #c4c7cF;
|
|
|
|
|
|
}
|
|
|
|
|
|
.param-box-row-symbol {
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
color: #c4c7cF;
|
|
|
|
|
|
border: 1px solid #c4c7cF;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
height: 12px;
|
|
|
|
|
|
width: 14px;
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 17px;
|
|
|
|
|
|
right: 25px;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
}
|
|
|
|
|
|
.param-box-row-symbol>i {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 1px;
|
|
|
|
|
|
right: 1px;
|
|
|
|
|
|
}
|
|
|
|
|
|
/* end--param*/
|
|
|
|
|
|
|
|
|
|
|
|
/* begin--子弹框*/
|
|
|
|
|
|
.right-sub-box {
|
|
|
|
|
|
width: 380px;
|
|
|
|
|
|
height: 520px;
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 380px;
|
|
|
|
|
|
right: 100px;
|
|
|
|
|
|
z-index: 2;
|
|
|
|
|
|
padding: 0 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.right-sub-box .el-input-group {
|
|
|
|
|
|
width: 227px;
|
|
|
|
|
|
float: right;
|
|
|
|
|
|
margin: 7px 0 0 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
/* begin--搜索框*/
|
|
|
|
|
|
.endpoint-asset-prepend {
|
|
|
|
|
|
border-radius: 4px 0 0 4px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.endpoint-asset-label {
|
|
|
|
|
|
line-height: 26px;
|
|
|
|
|
|
height: 26px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.endpoint-asset-dropdown {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 27px;
|
|
|
|
|
|
background-color: #656565;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
width: 52px;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
.endpoint-asset-dropdown-item {
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
line-height: 22px;
|
|
|
|
|
|
height: 22px;
|
|
|
|
|
|
cursor: default;
|
|
|
|
|
|
}
|
|
|
|
|
|
.endpoint-asset-label-txt {
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
width: 19px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
.endpoint-asset-dropdown-item:first-of-type {
|
|
|
|
|
|
border-radius: 4px 4px 0 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
.endpoint-asset-dropdown-item:last-of-type {
|
|
|
|
|
|
border-radius: 0 0 4px 4px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.endpoint-asset-dropdown-item:hover {
|
|
|
|
|
|
background-color: #3a8ee6;
|
|
|
|
|
|
}
|
|
|
|
|
|
/* end--搜索框*/
|
|
|
|
|
|
/* begin--table*/
|
|
|
|
|
|
.endpoint-sub-table {
|
|
|
|
|
|
margin-top: 25px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.line-100 {
|
|
|
|
|
|
margin-bottom: 3px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.endpoint-sub-table-head {
|
|
|
|
|
|
line-height: 28px;
|
|
|
|
|
|
height: 30px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.endpoint-sub-table-row {
|
|
|
|
|
|
line-height: 28px;
|
|
|
|
|
|
height: 30px;
|
|
|
|
|
|
color: #656565;
|
|
|
|
|
|
}
|
|
|
|
|
|
.endpoint-sub-table-row-active {
|
|
|
|
|
|
background-color: #dadada;
|
|
|
|
|
|
}
|
|
|
|
|
|
.endpoint-sub-table-col {
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
width: 45%;
|
|
|
|
|
|
padding-left: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.endpoint-sub-table-paginate-all {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
left: 10px;
|
|
|
|
|
|
bottom: 17px;
|
|
|
|
|
|
color: #5a5a5a;
|
|
|
|
|
|
}
|
|
|
|
|
|
.endpoint-sub-table-body {
|
|
|
|
|
|
font-size: 15px;
|
|
|
|
|
|
}
|
|
|
|
|
|
/* end--table*/
|
|
|
|
|
|
|
|
|
|
|
|
/* end--子弹框*/
|
|
|
|
|
|
</style>
|
|
|
|
|
|
<style>
|
|
|
|
|
|
/* begin--覆盖分页组件样式*/
|
|
|
|
|
|
.right-sub-box .el-pagination.is-background .btn-next, .right-sub-box .el-pagination.is-background .btn-prev, .right-sub-box .el-pagination.is-background .el-pager li {
|
|
|
|
|
|
margin: 0 3px;
|
|
|
|
|
|
min-width: 25px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.right-sub-box .el-pagination button, .right-sub-box .el-pagination span:not([class*=suffix]) {
|
|
|
|
|
|
margin: 0 3px;
|
|
|
|
|
|
height: 25px;
|
|
|
|
|
|
line-height: 25px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.right-sub-box .el-pager li {
|
|
|
|
|
|
height: 25px;
|
|
|
|
|
|
line-height: 25px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.right-sub-box .el-pagination.is-background .el-pager li:not(.disabled).active {
|
|
|
|
|
|
background-color: #656565;
|
|
|
|
|
|
border: 1px solid #656565;
|
|
|
|
|
|
}
|
|
|
|
|
|
.right-sub-box .el-pagination.is-background .btn-next, .right-sub-box .el-pagination.is-background .btn-prev, .right-sub-box .el-pagination.is-background .el-pager li {
|
|
|
|
|
|
background-color: white;
|
|
|
|
|
|
}
|
|
|
|
|
|
.right-sub-box .el-pagination button, .right-sub-box .el-pager li {
|
|
|
|
|
|
border: 1px solid #DADADA;
|
|
|
|
|
|
}
|
|
|
|
|
|
.right-sub-box .el-pager li.active+li {
|
|
|
|
|
|
border: 1px solid #DADADA;
|
|
|
|
|
|
}
|
|
|
|
|
|
.right-sub-box .el-pagination.is-background .el-pager li:not(.disabled):hover {
|
|
|
|
|
|
color: black;
|
|
|
|
|
|
}
|
|
|
|
|
|
.right-sub-box .el-pagination.is-background .el-pager li.active:hover {
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
}
|
|
|
|
|
|
.endpoint-sub-table-paginate .el-pagination {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
right: 10px;
|
|
|
|
|
|
bottom: 13px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.el-input-group__append>i {
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
}
|
2020-02-06 12:04:41 +08:00
|
|
|
|
.el-table .disabledCheck .cell .el-checkbox__inner{
|
|
|
|
|
|
display: none !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
.el-table .disabledCheck .cell::before{
|
2020-02-20 18:17:36 +08:00
|
|
|
|
/*content: '\e627';*/
|
|
|
|
|
|
/*font-family: 'nz-icon';*/
|
2020-02-06 12:04:41 +08:00
|
|
|
|
text-align: center;
|
|
|
|
|
|
line-height: 37px;
|
|
|
|
|
|
}
|
2019-12-25 20:33:58 +08:00
|
|
|
|
/* end--覆盖分页组件样式*/
|
2020-02-14 18:07:21 +08:00
|
|
|
|
|
2020-02-17 18:41:38 +08:00
|
|
|
|
/* 列表搜索框 样式重写*/
|
|
|
|
|
|
.relative-position{
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
}
|
|
|
|
|
|
.query-input-inactive{
|
|
|
|
|
|
left:213px;
|
|
|
|
|
|
width: 18%;
|
|
|
|
|
|
}
|
|
|
|
|
|
.query-input-inactive .el-input__inner{
|
|
|
|
|
|
height: 26px;
|
|
|
|
|
|
line-height: 26px;
|
|
|
|
|
|
}
|
|
|
|
|
|
/* 左侧列表dc 编辑按钮影藏样式*/
|
|
|
|
|
|
.hid-div{
|
|
|
|
|
|
visibility: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
.sidebar-info-item:hover .hid-div{
|
|
|
|
|
|
visibility: visible;
|
|
|
|
|
|
}
|
2020-02-19 10:43:58 +08:00
|
|
|
|
.metric-tip-icon{
|
|
|
|
|
|
vertical-align: middle;
|
|
|
|
|
|
/*color: #3971BA;*/
|
|
|
|
|
|
-webkit-transform:scale(0.6);
|
|
|
|
|
|
/*-webkit-transform-origin: left top;*/
|
|
|
|
|
|
display:inline-block;
|
|
|
|
|
|
}
|
|
|
|
|
|
.metirc-tip-list{
|
|
|
|
|
|
line-height: 26px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
}
|
2020-02-20 18:17:36 +08:00
|
|
|
|
.table-header-inner{
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
z-index: 1;
|
|
|
|
|
|
top: 60px;
|
2020-03-16 15:38:03 +08:00
|
|
|
|
left: 10px;
|
2020-02-20 18:17:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
.control-icon-unchecked{
|
2020-03-13 13:12:47 +08:00
|
|
|
|
color: #d1d1d1;
|
2020-02-20 18:17:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
.control-icon-checked{
|
|
|
|
|
|
color:#666;
|
|
|
|
|
|
}
|
2020-03-10 22:40:45 +08:00
|
|
|
|
.dropdownBtn .el-dropdown__caret-button{
|
|
|
|
|
|
top:0px !important;
|
2020-03-13 17:55:56 +08:00
|
|
|
|
left: -1px;
|
2020-03-10 22:40:45 +08:00
|
|
|
|
}
|
2020-03-12 14:10:37 +08:00
|
|
|
|
.endpoint-query-table .el-loading-spinner .circular{
|
|
|
|
|
|
width: 42px;
|
|
|
|
|
|
height: 42px;
|
|
|
|
|
|
animation: loading-rotate 2s linear infinite;
|
|
|
|
|
|
display: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
.endpoint-query-table .el-loading-spinner{
|
|
|
|
|
|
background: url(../../../assets/img/loading.gif) no-repeat;
|
|
|
|
|
|
background-size: 48px 48px;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
top: 50%;
|
|
|
|
|
|
left: 48.5%;
|
|
|
|
|
|
}
|
2019-12-25 20:33:58 +08:00
|
|
|
|
</style>
|