NEZ-2232 module & endpoint 配置页面 log支持k8s配置
This commit is contained in:
@@ -100,6 +100,8 @@
|
||||
<!-- title="ChartSearch"-->
|
||||
<!-- ></v-selectpage>-->
|
||||
<!-- </el-form-item>-->
|
||||
|
||||
<!-- Metrics -->
|
||||
<div class="endpoint-title">
|
||||
<span class="endpoint-title-content">
|
||||
<i class="nz-icon nz-icon-arrow-down" :class="metricsShow?'':'is-active'" @click="metricsShow = !metricsShow"></i>
|
||||
@@ -112,7 +114,7 @@
|
||||
<el-tab-pane :label="$t('project.endpoint.basic')" name="Basic">
|
||||
<!--type-->
|
||||
<el-form-item :label='$t("webshell.protocol")' class="half-form-item" prop="type">
|
||||
<el-select id="module-box-input-type" v-model="editEndpoint.configs[0].config.protocol" :disabled="!!editEndpoint.id && editEndpoint.configs[0].config.protocol === 'snmp'" class="right-box__select" placeholder="" popper-class="right-box-select-top prevent-clickoutside" size="small" value-key="id">
|
||||
<el-select id="module-box-input-type" v-model="editEndpoint.configs[0].config.protocol" :disabled="!!editEndpoint.id && editEndpoint.configs[0].config.protocol === 'snmp'" class="right-box__select" placeholder="" popper-class="right-box-select-top prevent-clickoutside" size="small" value-key="id" @change="changeBasicType">
|
||||
<el-option v-for="item in typeList" :id="'module-type-'+item.id" :key="item.value" :label="item.name" :value="item.value" :disabled="item.disabled && !!editEndpoint.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -126,42 +128,42 @@
|
||||
</el-form-item>
|
||||
<!--port-->
|
||||
<el-form-item :label='$t("asset.port")' class="half-form-item" prop="configs.0.config.port" :rules="[
|
||||
{ validator: port, trigger: 'blur' },
|
||||
{ required: true, message: $t('validate.required'), trigger: 'blur' }
|
||||
]">
|
||||
{ validator: port, trigger: 'blur' },
|
||||
{ required: true, message: $t('validate.required'), trigger: 'blur' }
|
||||
]">
|
||||
<el-input id="module-box-input-port" v-model.number="editEndpoint.configs[0].config.port" placeholder="" size="small"></el-input>
|
||||
</el-form-item>
|
||||
<!-- snmp表单 -->
|
||||
<div v-if="editEndpoint.configs[0].config.protocol && editEndpoint.configs[0].config.protocol == 'snmp'">
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<div class="sub-label sub-label-required" style="padding-left: 0">{{$t('project.module.walk')}}</div>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item prop="configs.0.config.walk" :rules="[{ required: true, message: $t('validate.required'), trigger: 'blur' }]">
|
||||
<select-walk ref="selectWalk" :currentWalk="editEndpoint.configs[0].config.walk" :expandedWalk="expandedWalkData" :placement="'bottom-start'" :walkData="walkData" @selectWalk="selectWalk" :disabled="true">
|
||||
<template v-slot:trigger>
|
||||
<div class="el-cascader" style="position: relative;">
|
||||
<div class="el-input">
|
||||
<input aria-expanded="false" autocomplete="off" class="el-input__inner" readonly="readonly" type="text">
|
||||
</div>
|
||||
<div class="el-cascader__tags">
|
||||
<div ref="walkScrollbar" style="height: 100%; overflow: auto;">
|
||||
<span v-for="(item, index) in editEndpoint.configs[0].config.walk" :key="index" class="el-tag el-tag--info el-tag--small el-tag--light">
|
||||
<span v-html="mibName(item)"></span>
|
||||
<div class="walk-close-box" @click.stop="removeWalk(item)" :title="$t('overall.close')">
|
||||
<i class="el-tag__close nz-icon nz-icon-close walk-close"></i>
|
||||
</div>
|
||||
</span>
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<div class="sub-label sub-label-required" style="padding-left: 0">{{$t('project.module.walk')}}</div>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item prop="configs.0.config.walk" :rules="[{ required: true, message: $t('validate.required'), trigger: 'blur' }]">
|
||||
<select-walk ref="selectWalk" :currentWalk="editEndpoint.configs[0].config.walk" :expandedWalk="expandedWalkData" :placement="'bottom-start'" :walkData="walkData" @selectWalk="selectWalk" :disabled="true">
|
||||
<template v-slot:trigger>
|
||||
<div class="el-cascader" style="position: relative;">
|
||||
<div class="el-input">
|
||||
<input aria-expanded="false" autocomplete="off" class="el-input__inner" readonly="readonly" type="text">
|
||||
</div>
|
||||
<div class="el-cascader__tags">
|
||||
<div ref="walkScrollbar" style="height: 100%; overflow: auto;">
|
||||
<span v-for="(item, index) in editEndpoint.configs[0].config.walk" :key="index" class="el-tag el-tag--info el-tag--small el-tag--light">
|
||||
<span v-html="mibName(item)"></span>
|
||||
<div class="walk-close-box" @click.stop="removeWalk(item)" :title="$t('overall.close')">
|
||||
<i class="el-tag__close nz-icon nz-icon-close walk-close"></i>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div style="position: absolute;width: 100%;height: 100%;left: 0;top: 0;background: rgba(245,247,250,0.5)"></div>
|
||||
</div>
|
||||
<div style="position: absolute;width: 100%;height: 100%;left: 0;top: 0;background: rgba(245,247,250,0.5)"></div>
|
||||
</div>
|
||||
</template>
|
||||
</select-walk>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</select-walk>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!--credentials-->
|
||||
<el-form-item :label='$t("project.endpoint.credentials")' prop="credentials">
|
||||
<el-select id="module-box-input-credentials" v-model="editEndpoint.configs[0].config.snmpCredentialsId" class="right-box__select" placeholder="" popper-class="right-box-select-top prevent-clickoutside" size="small" value-key="id" disabled>
|
||||
@@ -169,6 +171,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<!-- more option-->
|
||||
<transition name="el-zoom-in-top">
|
||||
<div v-show="showAllBasicOption" >
|
||||
<!--scrape_interval-->
|
||||
@@ -193,6 +196,7 @@
|
||||
</span>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<!-- Parameter -->
|
||||
<el-tab-pane :label="$t('config.assetLabel.params')" name="Parameter" class="el-tab-pane-height">
|
||||
<div id="module-box-params" ref="labelBoxScrollbar" style="height: 100%; overflow: auto;">
|
||||
<div v-for="(item, index) in editEndpoint.paramObj" :key="index" class="param-box-row">
|
||||
@@ -213,11 +217,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: center">
|
||||
<span id="module-add-param" class="right-box-form-add module-add-label" type="button" @click="addParam">
|
||||
<span :title="$t('tip.add')"><i class="nz-icon nz-icon-plus" style="font-size: 16px;"></i></span>
|
||||
</span>
|
||||
<span id="module-add-param" class="right-box-form-add module-add-label" type="button" @click="addParam">
|
||||
<span :title="$t('tip.add')"><i class="nz-icon nz-icon-plus" style="font-size: 16px;"></i></span>
|
||||
</span>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<!-- Labels -->
|
||||
<el-tab-pane :label="$t('project.endpoint.labels2')" name="Labels">
|
||||
<div id="module-box-labels" ref="labelBoxScrollbar" style="height: 100%; overflow: auto;">
|
||||
<div v-for="(item, index) in editEndpoint.labelModule" :key="index" class="param-box-row">
|
||||
@@ -232,19 +237,20 @@
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: center">
|
||||
<span id="module-add-label" class="right-box-form-add module-add-label" type="button" @click="addLabel">
|
||||
<span :title="$t('tip.add')"><i class="nz-icon nz-icon-plus" style="font-size: 16px;"></i></span>
|
||||
</span>
|
||||
<span id="module-add-label" class="right-box-form-add module-add-label" type="button" @click="addLabel">
|
||||
<span :title="$t('tip.add')"><i class="nz-icon nz-icon-plus" style="font-size: 16px;"></i></span>
|
||||
</span>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<!-- Relabel -->
|
||||
<el-tab-pane :label="$t('project.endpoint.relabel')" name="Relabel">
|
||||
<div id="module-box-relabel" ref="labelBoxScrollbar" style="height: 100%; overflow: hidden;">
|
||||
<div v-for="(item, index) in this.editEndpoint.configs[0].config.relabel_config" :key="index" class="">
|
||||
<div class="pipeline-box">
|
||||
<span class="pipeline-title">{{$t('project.endpoint.item') + index}}</span>
|
||||
<span class="pipeline-option" :title="$t('overall.delete')">
|
||||
<i class="nz-icon nz-icon-shanchu1" @click="removeRelabel(index)"></i>
|
||||
</span>
|
||||
<span class="pipeline-option" :title="$t('overall.delete')">
|
||||
<i class="nz-icon nz-icon-shanchu1" @click="removeRelabel(index)"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<el-form-item :prop="'configs.0.config.relabel_config.' + index + '.action'" class="" :label="$t('project.endpoint.action')" :rules="[{ required: true, message: $t('validate.required'), trigger: 'change' }]">
|
||||
@@ -256,9 +262,9 @@
|
||||
:prop="'configs.0.config.relabel_config.' + index + '.source_labels'"
|
||||
class="half-form-item" :label="$t('overall.sourceLabels')"
|
||||
:rules="[
|
||||
{ required: item.action === 'replace' || item.action === 'keep' || item.action === 'drop', message: $t('validate.required'), trigger: 'change' },
|
||||
{ validator: item.action === 'replace' || item.action === 'keep' || item.action === 'drop'? arrLength : requirdRelabel, trigger: 'change' }
|
||||
]">
|
||||
{ required: item.action === 'replace' || item.action === 'keep' || item.action === 'drop', message: $t('validate.required'), trigger: 'change' },
|
||||
{ validator: item.action === 'replace' || item.action === 'keep' || item.action === 'drop'? arrLength : requirdRelabel, trigger: 'change' }
|
||||
]">
|
||||
<vue-tags-input
|
||||
v-model="item.tags"
|
||||
:maxlength="32"
|
||||
@@ -275,13 +281,13 @@
|
||||
:prop="'configs.0.config.relabel_config.' + index + '.target_label'"
|
||||
class="half-form-item" :label="$t('overall.targetLabel')"
|
||||
:rules="[
|
||||
{ required: item.action === 'replace', message: $t('validate.required'), trigger: 'blur' },
|
||||
{ pattern: /[a-zA-Z_][a-zA-Z0-9_]*/, message: $t('overall.ASCIIKey') ,trigger: 'blur'}]"
|
||||
>
|
||||
{ required: item.action === 'replace', message: $t('validate.required'), trigger: 'blur' },
|
||||
{ pattern: /[a-zA-Z_][a-zA-Z0-9_]*/, message: $t('overall.ASCIIKey') ,trigger: 'blur'}]"
|
||||
>
|
||||
<el-input id="module-box-input-target_label" v-model="item.target_label" placeholder='' size="small"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<!-- <span :id="'moduel-remove-label-'+index" class="param-box-row-symbol" @click="removeRelabel(index)" :title="$t('overall.delete')"><i class="nz-icon nz-icon-shanchu1" style="color:#666;"></i></span>-->
|
||||
<!-- more option-->
|
||||
<transition name="el-zoom-in-top">
|
||||
<div v-show="item.showAllRelabelOption" >
|
||||
<!--Regex-->
|
||||
@@ -303,10 +309,10 @@
|
||||
</div>
|
||||
</transition>
|
||||
<div style="text-align: center">
|
||||
<span class="nz-btn nz-btn-size-normal nz-btn-style-light" style="border: none" @click="item.showAllRelabelOption=!item.showAllRelabelOption">
|
||||
{{$t('overall.moreOption')}}
|
||||
<i :class="item.showAllRelabelOption?'is-active':''" class="nz-icon nz-icon-arrow-down need-rotate" ></i>
|
||||
</span>
|
||||
<span class="nz-btn nz-btn-size-normal nz-btn-style-light" style="border: none" @click="item.showAllRelabelOption=!item.showAllRelabelOption">
|
||||
{{$t('overall.moreOption')}}
|
||||
<i :class="item.showAllRelabelOption?'is-active':''" class="nz-icon nz-icon-arrow-down need-rotate" ></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -316,6 +322,7 @@
|
||||
</span>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<!-- Authentication -->
|
||||
<el-tab-pane v-if="editEndpoint.configs[0].config.protocol !== 'snmp'" :label="$t('config.mib.credential.auth')" name="Auth">
|
||||
<!--authtype-->
|
||||
<el-form-item :label='$t("overall.type")' prop="authtype">
|
||||
@@ -325,25 +332,27 @@
|
||||
</el-form-item>
|
||||
|
||||
<!--authtype 1-->
|
||||
<el-form-item v-if="authType === 1" :label='$t("profile.username")' class="half-form-item" prop="configs.0.config.basic_auth.username" :rules="[{ required: true, message: $t('validate.required'), trigger: 'blur' }]">
|
||||
<el-form-item v-if="authType === 1" :label='$t("profile.username")' class="half-form-item" prop="configs.0.config.basic_auth.username" :rules="[{ required: true, message: $t('validate.required'), trigger: 'blur' }]" key="username">
|
||||
<el-input id="module-box-input-uername" v-model="editEndpoint.configs[0].config.basic_auth.username" placeholder='' size="small"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="authType === 1" :label='$t("login.pin")' class="half-form-item" prop="configs.0.config.basic_auth.password" :rules="[{ required: true, message: $t('validate.required'), trigger: 'blur' }]">
|
||||
<el-form-item v-if="authType === 1" :label='$t("login.pin")' class="half-form-item" prop="configs.0.config.basic_auth.password" :rules="[{ required: true, message: $t('validate.required'), trigger: 'blur' }]" key="password">
|
||||
<el-input id="module-box-input-password" v-model="editEndpoint.configs[0].config.basic_auth.password" type="password" autocomplete="new-password" placeholder='' size="small"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<!--authtype 2-->
|
||||
<el-form-item v-if="authType === 2" :label='$t("project.endpoint.authTypeToken")' prop="configs.0.config.bearer_token" :rules="[{ required: true, message: $t('validate.required'), trigger: 'blur' }]">
|
||||
<el-form-item v-if="authType === 2" :label='$t("project.endpoint.authTypeToken")' prop="configs.0.config.bearer_token" :rules="[{ required: true, message: $t('validate.required'), trigger: 'blur' }]" key="bearer_token">
|
||||
<el-input id="module-box-input-bearer_token" v-model="editEndpoint.configs[0].config.bearer_token" placeholder='' size="small"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</transition>
|
||||
|
||||
<!-- Log -->
|
||||
<div class="endpoint-title" style="margin-top: 10px">
|
||||
<span class="endpoint-title-content">
|
||||
<i class="nz-icon nz-icon-arrow-down" :class="logsShow?'':'is-active'" @click="logsShow = !logsShow"></i>
|
||||
<i class="nz-icon nz-icon-arrow-down" :class="logsShow?'':'is-active'" @click="logsShow = !logsShow"></i>
|
||||
{{$t('overall.logs')}}
|
||||
</span>
|
||||
<el-switch v-model="editEndpoint.configs[1].enable" size="small" :active-value="1" :inactive-value="0"></el-switch>
|
||||
@@ -352,13 +361,15 @@
|
||||
<div v-show="logsShow" v-if="editEndpoint.configs[1].enable">
|
||||
<div v-for="(item, index) in editEndpoint.configs[1].config" :key="index" style="position: relative">
|
||||
<el-tabs v-model="activeNameLogs[index]" class="special-tabs" @tab-click="()=>{tabClick(index)}">
|
||||
<!-- Basic -->
|
||||
<el-tab-pane :label="$t('project.endpoint.basic')" name="Basic">
|
||||
<!--type-->
|
||||
<el-form-item :label='$t("overall.type")' class="half-form-item">
|
||||
<el-select id="module-box-input-type" v-model="item.type" class="right-box__select" placeholder="" popper-class="right-box-select-top prevent-clickoutside" size="small" @change="logsBasicTypeChange(index)">
|
||||
<el-option v-for="item in logsBasicList" :id="'module-type-'+item.id" :key="item.value" :label="item.name" :value="item.value"></el-option>
|
||||
<el-select id="module-box-input-type" v-model="item.type" class="right-box__select" placeholder="" popper-class="right-box-select-top prevent-clickoutside" size="small" @change="logsBasicTypeChange(item,$event)">
|
||||
<el-option v-for="item in logsBasicList" :key="item.value" :label="item.name" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- fileName -->
|
||||
<el-form-item
|
||||
v-if='item.type === "file"'
|
||||
:label='item.type === "file" ? $t("config.terminallog.path"):( item.type === "journal" ? $t("dashboard.panel.chartForm.unit") : $t("project.endpoint.basicTypeSyslog"))' class="half-form-item"
|
||||
@@ -367,6 +378,7 @@
|
||||
>
|
||||
<el-input v-if='item.type === "file"' v-model="item.fileName" :id="'module-box-basic-value' +index" placeholder='' size="small"></el-input>
|
||||
</el-form-item>
|
||||
<!-- unit -->
|
||||
<el-form-item
|
||||
v-if='item.type === "journal"'
|
||||
:label='item.type === "file" ? $t("config.terminallog.path"):( item.type === "journal" ? $t("dashboard.panel.chartForm.unit") : $t("project.endpoint.basicTypeSyslog"))' class="half-form-item"
|
||||
@@ -375,6 +387,7 @@
|
||||
>
|
||||
<el-input v-if='item.type === "journal"' v-model="item.unit" :id="'module-box-basic-value' +index" placeholder='' size="small"></el-input>
|
||||
</el-form-item>
|
||||
<!-- listenAddress -->
|
||||
<el-form-item
|
||||
v-if='item.type === "syslog"'
|
||||
:label='item.type === "file" ? $t("config.terminallog.path"):( item.type === "journal" ? $t("dashboard.panel.chartForm.unit") : $t("project.endpoint.basicTypeSyslog"))' class="half-form-item"
|
||||
@@ -383,6 +396,7 @@
|
||||
>
|
||||
<el-input v-if='item.type === "syslog"' v-model="item.listenAddress" :id="'module-box-basic-value' +index" placeholder='' size="small"></el-input>
|
||||
</el-form-item>
|
||||
<!-- appName -->
|
||||
<el-form-item
|
||||
v-if="item.type === 'syslog'"
|
||||
:label=' $t("project.endpoint.basicAppName")'
|
||||
@@ -392,7 +406,126 @@
|
||||
>
|
||||
<el-input v-model="item.appName" :id="'module-box-basic-appName' +index" placeholder='' size="small"></el-input>
|
||||
</el-form-item>
|
||||
<!-- apiServer -->
|
||||
<el-form-item
|
||||
v-if="item.type === 'kubernetes'"
|
||||
:label='$t("project.endpoint.apiServer")'
|
||||
class="half-form-item"
|
||||
:prop="'configs.1.config.'+ index +'.apiServer'"
|
||||
key="apiServer"
|
||||
>
|
||||
<el-input v-model="item.apiServer" :id="'module-box-basic-apiServer' +index" placeholder='' size="small"></el-input>
|
||||
</el-form-item>
|
||||
<!-- role -->
|
||||
<el-form-item
|
||||
v-if='item.type === "kubernetes"'
|
||||
:label='$t("profile.role")'
|
||||
class="half-form-item"
|
||||
:prop="'configs.1.config.'+ index +'.role'"
|
||||
key="role"
|
||||
>
|
||||
<el-select v-model="item.role" class="right-box__select" placeholder="" popper-class="right-box-select-top prevent-clickoutside" size="small">
|
||||
<el-option v-for="item in logsRoleList" :key="item.value" :label="item.name" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- namespaces -->
|
||||
<el-form-item
|
||||
v-if="item.type === 'kubernetes'"
|
||||
:label=' $t("project.endpoint.namespaces")'
|
||||
class="half-form-item"
|
||||
:prop="'configs.1.config.'+ index +'.namespaces.names'"
|
||||
key="namespaces"
|
||||
>
|
||||
<vue-tags-input
|
||||
v-model="item.namespaces.tags"
|
||||
:maxlength="32"
|
||||
:placeholder="$t('overall.addParameter')"
|
||||
:tags="item.namespaces.names"
|
||||
@tags-changed="(newTags)=>{logsTagsChange(newTags,item)}"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-tab-pane>
|
||||
<!-- Relabel -->
|
||||
<el-tab-pane :label="$t('project.endpoint.logRelabel')" name="Relabel">
|
||||
<div id="module-box-relabel" ref="labelBoxScrollbar" style="height: 100%; overflow: hidden;">
|
||||
<div v-for="(subItem, subIndex) in editEndpoint.configs[1].config[index].relabel_config" :key="subIndex" class="">
|
||||
<div class="pipeline-box">
|
||||
<span class="pipeline-title">{{$t('project.endpoint.item') + subIndex}}</span>
|
||||
<span class="pipeline-option" :title="$t('overall.delete')">
|
||||
<i class="nz-icon nz-icon-shanchu1" @click="logsRemoveRelabel(index,subIndex)"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<el-form-item :prop="'configs.1.config.' + index + '.relabel_config.' + subIndex + '.action'" class="" :label="'Action'" :rules="[{ required: true, message: $t('validate.required'), trigger: 'change' }]">
|
||||
<el-select v-model="subItem.action" :id="'action' + subIndex " class="right-box__select " placeholder="" popper-class="right-box-select-top prevent-clickoutside" size="small" @change="logsActionChange(index,subIndex)" :rules="[{ required: true, message: $t('validate.required'), trigger: 'change' }]">
|
||||
<el-option v-for="item2 in actionList" :id="'module-action-'+item2.label" :key="item2.label" :label="item2.label" :value="item2.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:prop="'configs.1.config.' + index + '.relabel_config.' + subIndex + '.source_labels'"
|
||||
class="half-form-item" :label="'Source labels'"
|
||||
:rules="[
|
||||
{ required: subItem.action === 'replace' || subItem.action === 'keep' || subItem.action === 'drop', message: $t('validate.required'), trigger: 'change' },
|
||||
{ validator: subItem.action === 'replace' || subItem.action === 'keep' || subItem.action === 'drop'? arrLength : requirdRelabel, trigger: 'change' }
|
||||
]">
|
||||
<vue-tags-input
|
||||
v-model="subItem.tags"
|
||||
:maxlength="32"
|
||||
:ref="'logsRelabelTag'+index+subIndex"
|
||||
tabindex="9999"
|
||||
:placeholder="$t('overall.addParameter')"
|
||||
:tags="subItem.source_labels"
|
||||
@before-adding-tag="beforeAddingTag"
|
||||
@blur="logsRelabelTabBlur(index,subIndex)"
|
||||
@tags-changed="(newTags)=>{logsTagsChangeRelabel(newTags, index,subIndex)}"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:prop="'configs.1.config.' + index + '.relabel_config.' + subIndex + '.target_label'"
|
||||
class="half-form-item" :label="'Target label'"
|
||||
:rules="[
|
||||
{ required: subItem.action === 'replace', message: $t('validate.required'), trigger: 'blur' },
|
||||
{ pattern: /[a-zA-Z_:][a-zA-Z0-9_:]*/, message: $t('overall.ASCIIKey') ,trigger: 'blur'}]"
|
||||
>
|
||||
<el-input id="module-box-input-target_label" v-model="subItem.target_label" placeholder='' size="small"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<!-- more option-->
|
||||
<transition name="el-zoom-in-top">
|
||||
<div v-show="subItem.showAllRelabelOption" >
|
||||
<!--Regex-->
|
||||
<el-form-item
|
||||
:label='"Regex"'
|
||||
class="half-form-item"
|
||||
:prop="'configs.1.config.' + index + '.relabel_config.' + subIndex + '.regex'"
|
||||
:rules="[{ required: true, message: $t('validate.required'), trigger: 'change' }]">
|
||||
<el-input id="module-box-input-regex" v-model="subItem.regex" :placeholder="$t('overall.relabelConfigRegex')" size="small"></el-input>
|
||||
</el-form-item>
|
||||
<!--replacement-->
|
||||
<el-form-item
|
||||
:label='"Replacement"'
|
||||
class="half-form-item"
|
||||
:prop="'configs.1.config.' + index + '.relabel_config.' + subIndex + '.replacement'"
|
||||
:rules="[{ required: subItem.action === 'replace' || subItem.action === 'labelmap', message: $t('validate.required'), trigger: 'change' }]">
|
||||
<el-input id="module-box-input-replacement" v-model="subItem.replacement" :placeholder="$t('overall.relabelConfigReplacement')" size="small"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</transition>
|
||||
<div style="text-align: center">
|
||||
<span class="nz-btn nz-btn-size-normal nz-btn-style-light" style="border: none" @click="subItem.showAllRelabelOption=!subItem.showAllRelabelOption">
|
||||
{{$t('overall.moreOption')}}
|
||||
<i :class="subItem.showAllRelabelOption?'is-active':''" class="nz-icon nz-icon-arrow-down need-rotate" ></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: center">
|
||||
<span id="module-add-relabel" class="right-box-form-add module-add-label margin-t-10" type="button" @click="logsAddRelabel(index)">
|
||||
<span :title="$t('tip.add')"><i class="nz-icon nz-icon-plus" style="font-size: 16px;"></i></span>
|
||||
</span>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<!-- Labels -->
|
||||
<el-tab-pane :label="$t('project.endpoint.labels2')" name="Labels">
|
||||
<div id="module-box-logs-labels" ref="labelBoxScrollbar" style="height: 100%; overflow: auto;">
|
||||
<div v-for="(item1, i) in item.labelModule" :key="i" class="param-box-row">
|
||||
@@ -407,11 +540,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: center">
|
||||
<span id="module-add-logs-label" class="right-box-form-add module-add-label" type="button" @click="addLogsLabel(index)">
|
||||
<span :title="$t('tip.add')"><i class="nz-icon nz-icon-plus" style="font-size: 16px;"></i></span>
|
||||
</span>
|
||||
<span id="module-add-logs-label" class="right-box-form-add module-add-label" type="button" @click="addLogsLabel(index)">
|
||||
<span :title="$t('tip.add')"><i class="nz-icon nz-icon-plus" style="font-size: 16px;"></i></span>
|
||||
</span>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<!-- Pipeline -->
|
||||
<el-tab-pane :label="$t('project.endpoint.pipeline')" name="Pipeline">
|
||||
<div v-for="(item2, index2) in item.pipeline" :key="index2">
|
||||
<div class="pipeline-box">
|
||||
@@ -495,7 +629,7 @@
|
||||
:prop="'configs.1.config.'+ index +'.pipeline.' + index2 + '.format'"
|
||||
:rules="[{ required: true, message: $t('validate.required'), trigger: 'blur' }]"
|
||||
>
|
||||
<!-- <el-input v-model="item2.format" placeholder="key" size="mini"></el-input>-->
|
||||
<!-- <el-input v-model="item2.format" placeholder="key" size="mini"></el-input> -->
|
||||
<el-select v-model="item2.format" :id="'timestamp' + index +'-' + index2" class="right-box__select" placeholder="" popper-class="right-box-select-top prevent-clickoutside" size="small">
|
||||
<el-option v-for="item in timestampList" :id="'module-timestamp-'+item" :key="item" :label="item" :value="item"></el-option>
|
||||
</el-select>
|
||||
@@ -545,12 +679,36 @@
|
||||
<!-- <pre style="overflow-y: auto;height:100%;width: 97%;">{{logsCopyValue[index]}}</pre>-->
|
||||
<!-- </div>-->
|
||||
<!-- </el-tab-pane>-->
|
||||
|
||||
<!-- Authentication -->
|
||||
<el-tab-pane v-if="item.type==='kubernetes'" :label="$t('config.mib.credential.auth')" name="Auth">
|
||||
<!--authtype-->
|
||||
<el-form-item :label='$t("overall.type")' prop="authtype">
|
||||
<el-select id="module-box-input-auth-type" v-model="logsAuthType[index]" class="right-box__select" placeholder="" popper-class="right-box-select-top prevent-clickoutside" size="small" value-key="id" @change="logsAuthTypeChange(item)">
|
||||
<el-option v-for="item in authTypeList" :id="'module-type-'+item.id" :key="item.value" :label="item.name" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<!--authtype 1-->
|
||||
<el-form-item v-if="logsAuthType[index] === 1" :label='$t("profile.username")' class="half-form-item" :prop="'configs.1.config.'+index+'.basic_auth.username'" :rules="[{ required: true, message: $t('validate.required'), trigger: 'blur' }]" key="username">
|
||||
<el-input id="module-box-input-uername" v-model="item.basic_auth.username" placeholder='' size="small"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="logsAuthType[index] === 1" :label='$t("login.pin")' class="half-form-item" :prop="'configs.1.config.'+index+'.basic_auth.password'" :rules="[{ required: true, message: $t('validate.required'), trigger: 'blur' }]" key="password">
|
||||
<el-input id="module-box-input-password" v-model="item.basic_auth.password" type="password" autocomplete="new-password" placeholder='' size="small"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<!--authtype 2-->
|
||||
<el-form-item v-if="logsAuthType[index] === 2" :label='$t("project.endpoint.authTypeToken")' :prop="'configs.1.config.'+index+'.bearer_token'" :rules="[{ required: true, message: $t('validate.required'), trigger: 'blur' }]" key="bearer_token">
|
||||
<el-input id="module-box-input-bearer_token" v-model="item.bearer_token" placeholder='' size="small"></el-input>
|
||||
</el-form-item>
|
||||
</el-tab-pane>
|
||||
|
||||
</el-tabs>
|
||||
<span class="nz-icon-minus-medium" :title="$t('overall.delete')">
|
||||
<i class="nz-icon nz-icon-minus" @click="removeLogsArr(index)"></i>
|
||||
</span>
|
||||
<i class="nz-icon nz-icon-minus" @click="removeLogsArr(index)"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div class="value-mapping-add" style="text-align: center;margin: 10px 144px 10px 144px;" @click="logsLogsArrAdd()" :title="$t('tip.add')">
|
||||
<div class="value-mapping-add" style="text-align: center;margin: 10px 144px 10px 144px;" @click="logsArrAdd()" :title="$t('tip.add')">
|
||||
<i class="nz-icon nz-icon-plus"></i>
|
||||
</div>
|
||||
</div>
|
||||
@@ -706,7 +864,12 @@ export default {
|
||||
{
|
||||
value: 'syslog',
|
||||
name: 'Syslog'
|
||||
},
|
||||
{
|
||||
value: 'kubernetes',
|
||||
name: 'Kubernetes'
|
||||
}
|
||||
|
||||
],
|
||||
authType: 0,
|
||||
authTypeList: [
|
||||
@@ -714,6 +877,8 @@ export default {
|
||||
{ name: this.$t('project.endpoint.authTypeWord'), value: 1 },
|
||||
{ name: this.$t('project.endpoint.authTypeToken'), value: 2 }
|
||||
],
|
||||
|
||||
logsAuthType: [0],
|
||||
endpointStateList: [
|
||||
{ name: this.$t('overall.enabled'), value: 1 },
|
||||
{ name: this.$t('profile.close'), value: 0 }
|
||||
@@ -810,7 +975,30 @@ export default {
|
||||
label: 'Labelkeep'
|
||||
}],
|
||||
metricsShow: true,
|
||||
logsShow: true
|
||||
logsShow: true,
|
||||
|
||||
logsRoleList: [
|
||||
{
|
||||
value: 'endpoints',
|
||||
label: 'endpoints'
|
||||
},
|
||||
{
|
||||
value: 'service',
|
||||
label: 'service'
|
||||
},
|
||||
{
|
||||
value: 'pod',
|
||||
label: 'pod'
|
||||
},
|
||||
{
|
||||
value: 'node',
|
||||
label: 'node'
|
||||
},
|
||||
{
|
||||
value: 'ingress',
|
||||
label: 'ingress'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -957,18 +1145,11 @@ export default {
|
||||
pipeline.expressions = this.labelsToJson(pipeline.expressions)
|
||||
}
|
||||
})
|
||||
if (item.type === 'file') {
|
||||
delete item.unit
|
||||
delete item.appName
|
||||
delete item.listenAddress
|
||||
} else if (item.type === 'journal') {
|
||||
delete item.fileName
|
||||
delete item.appName
|
||||
delete item.listenAddress
|
||||
} else if (item.type === 'syslog') {
|
||||
delete item.fileName
|
||||
delete item.unit
|
||||
}
|
||||
item.namespaces && delete item.namespaces.tags
|
||||
item.relabel_config && item.relabel_config.forEach(subItem => {
|
||||
delete subItem.tags
|
||||
delete subItem.showAllRelabelOption
|
||||
})
|
||||
})
|
||||
params.configs[0].config.relabel_config && params.configs[0].config.relabel_config.forEach(item => {
|
||||
delete item.tags
|
||||
@@ -998,8 +1179,11 @@ export default {
|
||||
this.activeNameLogs[keyArr[3]] = 'Labels'
|
||||
} else if (str === 'pipeline') {
|
||||
this.activeNameLogs[keyArr[3]] = 'Pipeline'
|
||||
} else if (str === 'relabel_config') {
|
||||
this.activeNameLogs[keyArr[3]] = 'Relabel'
|
||||
} else if (str === 'basic_auth' || str === 'bearer_token') {
|
||||
this.activeNameLogs[keyArr[3]] = 'Auth'
|
||||
}
|
||||
|
||||
this.activeNameLogs = [...this.activeNameLogs]
|
||||
}
|
||||
}
|
||||
@@ -1069,31 +1253,64 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
logsLogsArrAdd () {
|
||||
logsArrAdd () {
|
||||
this.activeNameLogs.push('Basic')
|
||||
this.logsCopyValue.push('')
|
||||
this.logsAuthType.push(0)
|
||||
this.editEndpoint.configs[1].config.push({
|
||||
type: 'file',
|
||||
fileName: '',
|
||||
unit: '',
|
||||
appName: '',
|
||||
listenAddress: '',
|
||||
apiServer: '',
|
||||
role: '',
|
||||
namespaces: {
|
||||
tags: '',
|
||||
names: []
|
||||
},
|
||||
labels: '',
|
||||
labelModule: [{ key: '', value: '' }],
|
||||
pipeline: []
|
||||
pipeline: [],
|
||||
basic_auth: {
|
||||
username: '',
|
||||
password: ''
|
||||
},
|
||||
bearer_token: '',
|
||||
relabel_config: []
|
||||
})
|
||||
},
|
||||
removeLogsArr (index) {
|
||||
if (this.editEndpoint.configs[1].config.length !== 1) {
|
||||
this.activeNameLogs.splice(index, 1)
|
||||
this.logsCopyValue.splice(index, 1)
|
||||
this.logsAuthType.splice(index, 1)
|
||||
this.editEndpoint.configs[1].config.splice(index, 1)
|
||||
}
|
||||
},
|
||||
logsBasicTypeChange (i) {
|
||||
this.editEndpoint.configs[1].config[i].fileName = ''
|
||||
this.editEndpoint.configs[1].config[i].unit = ''
|
||||
this.editEndpoint.configs[1].config[i].appName = ''
|
||||
this.editEndpoint.configs[1].config[i].listenAddress = ''
|
||||
logsBasicTypeChange (item, val) {
|
||||
item.fileName = ''
|
||||
item.unit = ''
|
||||
item.appName = ''
|
||||
item.listenAddress = ''
|
||||
item.apiServer = ''
|
||||
item.role = ''
|
||||
this.$set(item, 'namespaces', {
|
||||
tags: '',
|
||||
names: []
|
||||
})
|
||||
if (val === 'kubernetes') {
|
||||
item.apiServer = '127.0.0.1'
|
||||
item.role = 'pod'
|
||||
} else {
|
||||
item.bearer_token = ''
|
||||
item.basic_auth = {
|
||||
username: '',
|
||||
password: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/* 获取project列表 */
|
||||
getProjectList () {
|
||||
this.$get('monitor/project', { pageSize: -1, pageNo: 1 }).then(response => {
|
||||
@@ -1159,22 +1376,6 @@ export default {
|
||||
}
|
||||
this.editEndpoint.labelModule.splice(index, 1)
|
||||
},
|
||||
tagsChange (newTags, index) {
|
||||
this.editEndpoint.paramObj[index].value = newTags.map(item => item.text)
|
||||
},
|
||||
beforeAddingTag (tag) {
|
||||
const regx = /[a-zA-Z_][a-zA-Z0-9_]*/
|
||||
if (regx.test(tag.tag.text)) {
|
||||
tag.addTag()
|
||||
} else {
|
||||
this.$message.error(this.$t('tip.tagError'))
|
||||
}
|
||||
},
|
||||
relabelTabBlur (tag) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.relabelTag[0].newTag = ''
|
||||
})
|
||||
},
|
||||
// 将param转为json字符串格式
|
||||
paramToJson (param) {
|
||||
const tempParam = {}
|
||||
@@ -1209,13 +1410,33 @@ export default {
|
||||
return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
|
||||
}
|
||||
},
|
||||
|
||||
changeBasicType () {
|
||||
if (this.editEndpoint.configs[0].config.protocol === 'snmp') {
|
||||
this.editEndpoint.configs[0].config.metrics_path = ''
|
||||
this.editEndpoint.configs[0].config.bearer_token = ''
|
||||
this.editEndpoint.configs[0].config.basic_auth = {
|
||||
username: '',
|
||||
password: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
changeAuthType () {
|
||||
this.editEndpoint.configs.bearer_token = ''
|
||||
this.editEndpoint.configs.basic_auth = {
|
||||
this.editEndpoint.configs[0].config.bearer_token = ''
|
||||
this.editEndpoint.configs[0].config.basic_auth = {
|
||||
username: '',
|
||||
password: ''
|
||||
}
|
||||
},
|
||||
|
||||
logsAuthTypeChange (item) {
|
||||
this.$set(item, 'bearer_token', '')
|
||||
this.$set(item, 'basic_auth', {
|
||||
username: '',
|
||||
password: ''
|
||||
})
|
||||
},
|
||||
|
||||
copyValue () {
|
||||
const domUrl = document.createElement('input')
|
||||
domUrl.value = this.configsCopyValue
|
||||
@@ -1373,6 +1594,23 @@ export default {
|
||||
this.$post('/monitor/endpoint/render', { moduleIds: this.editEndpoint.moduleId, assetIds: this.editEndpoint.assetId }).then(res => {
|
||||
this.editEndpoint.configs = JSON.parse(res.data.list[0].configs)
|
||||
this.activeNameLogs = this.editEndpoint.configs[1].config.map(() => 'Basic')
|
||||
if (this.editEndpoint.configs[0].config.bearer_token) {
|
||||
this.authType = 2
|
||||
} else if (this.editEndpoint.configs[0].config.basic_auth.username) {
|
||||
this.authType = 1
|
||||
} else {
|
||||
this.authType = 0
|
||||
}
|
||||
|
||||
this.editEndpoint.configs[1].config.forEach((item, index) => {
|
||||
if (item.bearer_token) {
|
||||
this.logsAuthType[index] = 2
|
||||
} else if (item.basic_auth && item.basic_auth.username) {
|
||||
this.logsAuthType[index] = 1
|
||||
} else {
|
||||
this.logsAuthType[index] = 0
|
||||
}
|
||||
})
|
||||
this.editEndpoint.configs[1].config.forEach(item => {
|
||||
item.labelModule = []
|
||||
if (JSON.stringify(item.labels) !== '{}' && item.labels) {
|
||||
@@ -1406,24 +1644,19 @@ export default {
|
||||
pipeline.expressions = expressionsArr
|
||||
}
|
||||
})
|
||||
if (item.type === 'file') {
|
||||
item.unit = ''
|
||||
item.appName = ''
|
||||
item.listenAddress = ''
|
||||
} else if (item.type === 'journal') {
|
||||
item.fileName = ''
|
||||
item.appName = ''
|
||||
item.listenAddress = ''
|
||||
} else if (item.type === 'syslog') {
|
||||
item.fileName = ''
|
||||
item.unit = ''
|
||||
if (!item.relabel_config) {
|
||||
this.$set(item, 'relabel_config', [])
|
||||
}
|
||||
item.relabel_config && item.relabel_config.forEach(item => {
|
||||
this.$set(item, 'showAllRelabelOption', false)
|
||||
this.$set(item, 'tags', '')
|
||||
})
|
||||
})
|
||||
this.editEndpoint.paramObj = []
|
||||
this.editEndpoint.labelModule = []
|
||||
this.editEndpoint.configs[0].config.relabel_config && this.editEndpoint.configs[0].config.relabel_config.forEach(item => {
|
||||
item.showAllRelabelOption = false
|
||||
item.tags = ''
|
||||
this.$set(item, 'showAllRelabelOption', false)
|
||||
this.$set(item, 'tags', '')
|
||||
})
|
||||
if (JSON.stringify(this.editEndpoint.configs[0].config.labels) !== '{}' && this.editEndpoint.configs[0].config.labels) {
|
||||
Object.keys(this.editEndpoint.configs[0].config.labels).forEach(key => {
|
||||
@@ -1446,6 +1679,30 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
actionChange (index) {
|
||||
this.$refs.moduleForm.clearValidate('configs.0.config.relabel_config.' + index + '.target_label')
|
||||
this.$refs.moduleForm.clearValidate('configs.0.config.relabel_config.' + index + '.source_labels')
|
||||
this.$refs.moduleForm.clearValidate('configs.0.config.relabel_config.' + index + '.regex')
|
||||
this.$refs.moduleForm.clearValidate('configs.0.config.relabel_config.' + index + '.replacement')
|
||||
},
|
||||
logsActionChange (index, subIndex) {
|
||||
this.$refs.moduleForm.clearValidate('configs.1.config.' + index + '.relabel_config.' + subIndex + '.target_label')
|
||||
this.$refs.moduleForm.clearValidate('configs.1.config.' + index + '.relabel_config.' + subIndex + '.source_labels')
|
||||
this.$refs.moduleForm.clearValidate('configs.1.config.' + index + '.relabel_config.' + subIndex + '.regex')
|
||||
this.$refs.moduleForm.clearValidate('configs.1.config.' + index + '.relabel_config.' + subIndex + '.replacement')
|
||||
},
|
||||
|
||||
addRelabel () {
|
||||
this.editEndpoint.configs[0].config.relabel_config.push({
|
||||
source_labels: [],
|
||||
target_label: '',
|
||||
action: 'replace',
|
||||
regex: '(.*)',
|
||||
replacement: '$1',
|
||||
showAllRelabelOption: false
|
||||
})
|
||||
},
|
||||
removeRelabel (index) {
|
||||
// if (this.editEndpoint.configs[0].config.relabel_config.length === 1) {
|
||||
// this.editEndpoint.configs[0].config.relabel_config = [{
|
||||
@@ -1461,24 +1718,54 @@ export default {
|
||||
this.editEndpoint.configs[0].config.relabel_config.splice(index, 1)
|
||||
this.$refs.moduleForm.clearValidate()
|
||||
},
|
||||
|
||||
logsAddRelabel (index) {
|
||||
this.editEndpoint.configs[1].config[index].relabel_config.push({
|
||||
source_labels: [],
|
||||
target_label: '',
|
||||
action: '',
|
||||
regex: '(.*)',
|
||||
replacement: '$1',
|
||||
showAllRelabelOption: false
|
||||
})
|
||||
},
|
||||
logsRemoveRelabel (index, subIndex) {
|
||||
this.editEndpoint.configs[1].config[index].relabel_config.splice(subIndex, 1)
|
||||
this.$refs.moduleForm.clearValidate()
|
||||
},
|
||||
|
||||
tagsChange (newTags, index) {
|
||||
this.editEndpoint.paramObj[index].value = newTags.map(item => item.text)
|
||||
},
|
||||
logsTagsChange (newTags, item) {
|
||||
this.$set(item.namespaces, 'names', newTags.map(item => item.text))
|
||||
},
|
||||
|
||||
beforeAddingTag (tag) {
|
||||
const regx = /[a-zA-Z_][a-zA-Z0-9_]*/
|
||||
if (regx.test(tag.tag.text)) {
|
||||
tag.addTag()
|
||||
} else {
|
||||
this.$message.error(this.$t('tip.tagError'))
|
||||
}
|
||||
},
|
||||
tagsChangeRelabel (newTags, index) {
|
||||
this.editEndpoint.configs[0].config.relabel_config[index].source_labels = newTags.map(item => item.text)
|
||||
this.$refs.moduleForm.clearValidate('configs.0.config.relabel_config.' + index + '.source_labels')
|
||||
},
|
||||
actionChange (index) {
|
||||
this.$refs.moduleForm.clearValidate('configs.0.config.relabel_config.' + index + '.target_label')
|
||||
this.$refs.moduleForm.clearValidate('configs.0.config.relabel_config.' + index + '.source_labels')
|
||||
this.$refs.moduleForm.clearValidate('configs.0.config.relabel_config.' + index + '.regex')
|
||||
this.$refs.moduleForm.clearValidate('configs.0.config.relabel_config.' + index + '.replacement')
|
||||
relabelTabBlur (tag) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.relabelTag[0].newTag = ''
|
||||
})
|
||||
},
|
||||
addRelabel () {
|
||||
this.editEndpoint.configs[0].config.relabel_config.push({
|
||||
source_labels: [],
|
||||
target_label: '',
|
||||
action: 'replace',
|
||||
regex: '(.*)',
|
||||
replacement: '$1',
|
||||
showAllRelabelOption: false
|
||||
|
||||
logsTagsChangeRelabel (newTags, index, subIndex) {
|
||||
this.editEndpoint.configs[1].config[index].relabel_config[subIndex].source_labels = newTags.map(item => item.text)
|
||||
this.$refs.moduleForm.clearValidate('configs.1.config.' + index + '.relabel_config.' + subIndex + '.source_labels')
|
||||
},
|
||||
logsRelabelTabBlur (index, subIndex) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs['logsRelabelTag' + index + subIndex][0].newTag = ''
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -1532,6 +1819,16 @@ export default {
|
||||
this.expandedWalkData.push(this.editEndpoint.configs[0].config.walk[i].substring(0, this.editEndpoint.configs[0].config.walk[i].lastIndexOf('.')))
|
||||
}
|
||||
}
|
||||
|
||||
this.editEndpoint.configs[1].config.forEach((item, index) => {
|
||||
if (item.bearer_token) {
|
||||
this.logsAuthType[index] = 2
|
||||
} else if (item.basic_auth && item.basic_auth.username) {
|
||||
this.logsAuthType[index] = 1
|
||||
} else {
|
||||
this.logsAuthType[index] = 0
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
editEndpoint: {
|
||||
@@ -1546,7 +1843,7 @@ export default {
|
||||
if (!params[0].config[key]) {
|
||||
delete params[0].config[key]
|
||||
}
|
||||
if (Array.isArray(params[0].config[key]) && !params[0].config[key].length) {
|
||||
if ((Array.isArray(params[0].config[key]) && !params[0].config[key].length) || (JSON.stringify(params[0].config[key]) == '{}')) {
|
||||
delete params[0].config[key]
|
||||
}
|
||||
})
|
||||
@@ -1566,6 +1863,7 @@ export default {
|
||||
delete item.tags
|
||||
delete item.showAllRelabelOption
|
||||
})
|
||||
|
||||
params[1].config.forEach(item => {
|
||||
if (item.labelModule) {
|
||||
item.labels = this.labelsToJson(item.labelModule)
|
||||
@@ -1579,18 +1877,32 @@ export default {
|
||||
pipeline.expressions = this.labelsToJson(pipeline.expressions)
|
||||
}
|
||||
})
|
||||
if (item.type === 'file') {
|
||||
delete item.unit
|
||||
delete item.appName
|
||||
delete item.listenAddress
|
||||
} else if (item.type === 'journal') {
|
||||
delete item.fileName
|
||||
delete item.appName
|
||||
delete item.listenAddress
|
||||
} else if (item.type === 'syslog') {
|
||||
delete item.fileName
|
||||
delete item.unit
|
||||
|
||||
if (item.namespaces) {
|
||||
delete item.namespaces.tags
|
||||
if (!item.namespaces.names.length) {
|
||||
delete item.namespaces.names
|
||||
}
|
||||
}
|
||||
Object.keys(item).forEach(key => {
|
||||
if (!item[key]) {
|
||||
delete item[key]
|
||||
}
|
||||
if ((Array.isArray(item[key]) && !item[key].length) || (JSON.stringify(item[key]) == '{}')) {
|
||||
delete item[key]
|
||||
}
|
||||
})
|
||||
if (item.basic_auth && !item.basic_auth.username) {
|
||||
delete item.basic_auth
|
||||
}
|
||||
if (item.basic_auth && !item.basic_auth.password) {
|
||||
delete item.basic_auth
|
||||
}
|
||||
|
||||
item.relabel_config && item.relabel_config.forEach(subItem => {
|
||||
delete subItem.tags
|
||||
delete subItem.showAllRelabelOption
|
||||
})
|
||||
})
|
||||
this.configsCopyValue = JSON.stringify(params, null, 2)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user