set trend for avg

This commit is contained in:
Qiuxia Fan 2022-04-14 12:39:59 +08:00
parent de90ae6d9b
commit ebef339cdf
5 changed files with 53 additions and 25 deletions

View File

@ -13,6 +13,5 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. --> limitations under the License. -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<title>timeline</title>
<path d="M23.016 8.016q0 0.797-0.609 1.383t-1.406 0.586h-0.047q-0.328 0-0.469-0.047l-3.563 3.563q0.094 0.281 0.094 0.516 0 0.797-0.609 1.383t-1.406 0.586-1.406-0.586-0.609-1.383q0-0.234 0.094-0.516l-2.578-2.578q-0.281 0.094-0.516 0.094t-0.516-0.094l-4.547 4.547q0.094 0.281 0.094 0.516 0 0.797-0.609 1.406t-1.406 0.609-1.406-0.609-0.609-1.406 0.609-1.383 1.406-0.586q0.375 0 0.516 0.047l4.547-4.547q-0.047-0.141-0.047-0.516 0-0.797 0.586-1.406t1.383-0.609 1.406 0.609 0.609 1.406q0 0.375-0.047 0.516l2.531 2.531q0.141-0.047 0.516-0.047t0.516 0.047l3.563-3.516q-0.094-0.281-0.094-0.516 0-0.797 0.609-1.406t1.406-0.609 1.406 0.609 0.609 1.406z"></path> <path d="M23.016 8.016q0 0.797-0.609 1.383t-1.406 0.586h-0.047q-0.328 0-0.469-0.047l-3.563 3.563q0.094 0.281 0.094 0.516 0 0.797-0.609 1.383t-1.406 0.586-1.406-0.586-0.609-1.383q0-0.234 0.094-0.516l-2.578-2.578q-0.281 0.094-0.516 0.094t-0.516-0.094l-4.547 4.547q0.094 0.281 0.094 0.516 0 0.797-0.609 1.406t-1.406 0.609-1.406-0.609-0.609-1.406 0.609-1.383 1.406-0.586q0.375 0 0.516 0.047l4.547-4.547q-0.047-0.141-0.047-0.516 0-0.797 0.586-1.406t1.383-0.609 1.406 0.609 0.609 1.406q0 0.375-0.047 0.516l2.531 2.531q0.141-0.047 0.516-0.047t0.516 0.047l3.563-3.516q-0.094-0.281-0.094-0.516 0-0.797 0.609-1.406t1.406-0.609 1.406 0.609 0.609 1.406z"></path>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -26,7 +26,6 @@ export function useListConfig(config: any, index: number) {
const isAvg = const isAvg =
config.metricTypes[index] === MetricQueryTypes.ReadMetricsValues && config.metricTypes[index] === MetricQueryTypes.ReadMetricsValues &&
calculation === Calculations.Average; calculation === Calculations.Average;
return { return {
isLinear: line, isLinear: line,
isAvg, isAvg,

View File

@ -73,6 +73,7 @@ export interface LineConfig extends AreaConfig {
showXAxis?: boolean; showXAxis?: boolean;
showYAxis?: boolean; showYAxis?: boolean;
smallTips?: boolean; smallTips?: boolean;
showlabels?: boolean;
} }
export interface AreaConfig { export interface AreaConfig {

View File

@ -76,35 +76,44 @@ limitations under the License. -->
showlabels: false, showlabels: false,
}" }"
/> />
<el-popover <span
class="item flex-h"
v-else-if="useListConfig(config, index).isAvg" v-else-if="useListConfig(config, index).isAvg"
placement="left"
:width="400"
trigger="click"
> >
<template #reference> <el-popover placement="left" :width="400" trigger="click">
<template #reference>
<span class="trend">
<Icon
iconName="timeline"
size="middle"
style="color: #409eff"
/>
</span>
</template>
<div class="view-line">
<Line
:data="{
[metric]: scope.row[metric] && scope.row[metric].values,
}"
:intervalTime="intervalTime"
:config="{
showXAxis: true,
showYAxis: true,
smallTips: false,
showlabels: true,
}"
/>
</div>
</el-popover>
<span class="value">
<Card <Card
:data="{ :data="{
[metric]: scope.row[metric] && scope.row[metric].avg, [metric]: scope.row[metric] && scope.row[metric].avg,
}" }"
:config="{ textAlign: 'left' }" :config="{ textAlign: 'left' }"
/> />
</template> </span>
<div class="view-line"> </span>
<Line
:data="{
[metric]: scope.row[metric] && scope.row[metric].values,
}"
:intervalTime="intervalTime"
:config="{
showXAxis: false,
showYAxis: false,
smallTips: true,
showlabels: false,
}"
/>
</div>
</el-popover>
<Card <Card
v-else v-else
:data="{ [metric]: scope.row[metric] }" :data="{ [metric]: scope.row[metric] }"
@ -272,7 +281,7 @@ async function queryServiceMetrics(currentServices: Service[]) {
}); });
return; return;
} }
console.log(services.value);
services.value = currentServices; services.value = currentServices;
} }
function objectSpanMethod(param: any): any { function objectSpanMethod(param: any): any {
@ -360,7 +369,26 @@ watch(
} }
.view-line { .view-line {
width: 300px; width: 380px;
height: 200px; height: 200px;
} }
.item {
display: inline-block;
width: 100%;
height: 100%;
}
.trend {
width: 30px;
display: inline-block;
height: 100%;
cursor: pointer;
}
.value {
display: inline-block;
width: calc(100% - 30px);
height: 100%;
}
</style> </style>

View File

@ -66,6 +66,7 @@ export default defineComponent({
selectorStore.setCurrentService(null); selectorStore.setCurrentService(null);
selectorStore.setCurrentPod(null); selectorStore.setCurrentPod(null);
dashboardStore.setEntity(""); dashboardStore.setEntity("");
dashboardStore.setConfigPanel(false);
}); });
return { return {
dashboardStore, dashboardStore,