mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-02 17:04:48 +00:00
feat: create image, intstance list, endpoint list
This commit is contained in:
parent
5ac55b5e09
commit
51932ca877
12
package.json
12
package.json
@ -76,9 +76,15 @@
|
|||||||
"ecmaVersion": 2020
|
"ecmaVersion": 2020
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"@typescript-eslint/no-explicit-any": [
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
"off"
|
"vue/attributes-order": "off",
|
||||||
]
|
"vue/one-component-per-file": "off",
|
||||||
|
"vue/html-closing-bracket-newline": "off",
|
||||||
|
"vue/max-attributes-per-line": "off",
|
||||||
|
"vue/multiline-html-element-content-newline": "off",
|
||||||
|
"vue/singleline-html-element-content-newline": "off",
|
||||||
|
"vue/attribute-hyphenation": "off",
|
||||||
|
"vue/require-default-prop": "off"
|
||||||
},
|
},
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ import {
|
|||||||
} from "vue";
|
} from "vue";
|
||||||
import type { PropType } from "vue";
|
import type { PropType } from "vue";
|
||||||
import * as echarts from "echarts";
|
import * as echarts from "echarts";
|
||||||
// eslint-disable-next-line no-undef
|
/*global Nullable*/
|
||||||
const dom = ref<Nullable<HTMLElement>>(null);
|
const dom = ref<Nullable<HTMLElement>>(null);
|
||||||
const state = reactive<{ instanceChart: any }>({
|
const state = reactive<{ instanceChart: any }>({
|
||||||
instanceChart: null,
|
instanceChart: null,
|
||||||
|
@ -30,3 +30,26 @@ export const Layers = {
|
|||||||
layers: listLayers
|
layers: listLayers
|
||||||
`,
|
`,
|
||||||
};
|
};
|
||||||
|
export const Instances = {
|
||||||
|
variable: "$serviceId: ID!, $duration: Duration!",
|
||||||
|
query: `
|
||||||
|
getServiceInstances(duration: $duration, serviceId: $serviceId) {
|
||||||
|
key: id
|
||||||
|
label: name
|
||||||
|
language
|
||||||
|
attributes {
|
||||||
|
name
|
||||||
|
value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
};
|
||||||
|
export const Endpoints = {
|
||||||
|
variable: "$serviceId: ID!, $keyword: String!",
|
||||||
|
query: `
|
||||||
|
getEndpoints: searchEndpoint(serviceId: $serviceId, keyword: $keyword, limit: 100) {
|
||||||
|
key: id
|
||||||
|
label: name
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
};
|
||||||
|
@ -14,7 +14,10 @@
|
|||||||
* 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.
|
||||||
*/
|
*/
|
||||||
import { Services, Layers } from "../fragments/selector";
|
import { Services, Layers, Endpoints, Instances } from "../fragments/selector";
|
||||||
|
|
||||||
export const queryServices = `query queryServices(${Services.variable}) {${Services.query}}`;
|
export const queryServices = `query queryServices(${Services.variable}) {${Services.query}}`;
|
||||||
export const queryLayers = `query ${Layers.query}`;
|
export const queryLayers = `query ${Layers.query}`;
|
||||||
|
export const queryEndpoints = `query queryEndpoints(${Endpoints.variable}) {${Endpoints.query}}`;
|
||||||
|
|
||||||
|
export const queryInstances = `query queryInstances(${Instances.variable}) {${Instances.query}}`;
|
||||||
|
@ -20,7 +20,7 @@ import { Duration, DurationTime } from "@/types/app";
|
|||||||
import getLocalTime from "@/utils/localtime";
|
import getLocalTime from "@/utils/localtime";
|
||||||
import getDurationRow from "@/utils/dateTime";
|
import getDurationRow from "@/utils/dateTime";
|
||||||
import dateFormatStep, { dateFormatTime } from "@/utils/dateFormat";
|
import dateFormatStep, { dateFormatTime } from "@/utils/dateFormat";
|
||||||
|
/*global Nullable*/
|
||||||
interface AppState {
|
interface AppState {
|
||||||
durationRow: any;
|
durationRow: any;
|
||||||
utc: string;
|
utc: string;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { Option } from "@/types/app";
|
import { Option, Duration } from "@/types/app";
|
||||||
import { store } from "@/store";
|
import { store } from "@/store";
|
||||||
import graph from "@/graph";
|
import graph from "@/graph";
|
||||||
import { AxiosResponse } from "axios";
|
import { AxiosResponse } from "axios";
|
||||||
@ -45,6 +45,27 @@ export const selectorStore = defineStore({
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
|
async getServiceInstances(params: {
|
||||||
|
serviceId: string;
|
||||||
|
duration: Duration;
|
||||||
|
}): Promise<AxiosResponse> {
|
||||||
|
const res: AxiosResponse = await graph
|
||||||
|
.query("queryInstances")
|
||||||
|
.params(params);
|
||||||
|
return res;
|
||||||
|
},
|
||||||
|
async getEndpoints(params: {
|
||||||
|
keyword: string;
|
||||||
|
serviceId: string;
|
||||||
|
}): Promise<AxiosResponse> {
|
||||||
|
if (!params.keyword) {
|
||||||
|
params.keyword = "";
|
||||||
|
}
|
||||||
|
const res: AxiosResponse = await graph
|
||||||
|
.query("queryEndpoints")
|
||||||
|
.params(params);
|
||||||
|
return res;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
35
src/views/dashboard/controls/Image.vue
Normal file
35
src/views/dashboard/controls/Image.vue
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<!-- Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
|
this work for additional information regarding copyright ownership.
|
||||||
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
(the "License"); you may not use this file except in compliance with
|
||||||
|
the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License. -->
|
||||||
|
<template>
|
||||||
|
<input v-show="!imgUrl" type="file" @change="fileChange" accept="image/*" />
|
||||||
|
<img v-if="imgUrl" :src="imgUrl" alt="" />
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref } from "vue";
|
||||||
|
const imgUrl = ref<string>("");
|
||||||
|
const fileChange = (e: any) => {
|
||||||
|
const fileList = e.target.files;
|
||||||
|
if (fileList.length === 0) {
|
||||||
|
imgUrl.value = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const file = fileList[0];
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.onload = (event: any) => {
|
||||||
|
imgUrl.value = event.target.result;
|
||||||
|
};
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
};
|
||||||
|
</script>
|
14
src/views/dashboard/controls/Tab.vue
Normal file
14
src/views/dashboard/controls/Tab.vue
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<!-- Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
|
this work for additional information regarding copyright ownership.
|
||||||
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
(the "License"); you may not use this file except in compliance with
|
||||||
|
the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License. -->
|
@ -23,9 +23,9 @@ export const ChartTypes = [
|
|||||||
{ label: "Card", value: "card" },
|
{ label: "Card", value: "card" },
|
||||||
{ label: "Progress Bar", value: "progressBar" },
|
{ label: "Progress Bar", value: "progressBar" },
|
||||||
{ label: "Table", value: "table" },
|
{ label: "Table", value: "table" },
|
||||||
{ label: "Image", value: "image" },
|
|
||||||
{ label: "Endpoint List", value: "endpointList" },
|
{ label: "Endpoint List", value: "endpointList" },
|
||||||
{ label: "Instance List", value: "instanceList" },
|
{ label: "Instance List", value: "instanceList" },
|
||||||
|
{ label: "Image", value: "image" },
|
||||||
{ label: "Tab", value: "tab" },
|
{ label: "Tab", value: "tab" },
|
||||||
];
|
];
|
||||||
export enum MetricQueryTypes {
|
export enum MetricQueryTypes {
|
||||||
|
55
src/views/dashboard/graphs/EndpointList.vue
Normal file
55
src/views/dashboard/graphs/EndpointList.vue
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<!-- Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
|
this work for additional information regarding copyright ownership.
|
||||||
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
(the "License"); you may not use this file except in compliance with
|
||||||
|
the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License. -->
|
||||||
|
<template>
|
||||||
|
<el-table :data="tableData" style="width: 100%">
|
||||||
|
<el-table-column prop="date" label="Date" width="180" />
|
||||||
|
<el-table-column prop="name" label="Name" width="180" />
|
||||||
|
</el-table>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ElTable, ElTableColumn } from "element-plus";
|
||||||
|
import { defineProps } from "vue";
|
||||||
|
import type { PropType } from "vue";
|
||||||
|
|
||||||
|
defineProps({
|
||||||
|
data: {
|
||||||
|
type: Array as PropType<{ label: string; value: string }[]>,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
theme: { type: String, default: "" },
|
||||||
|
});
|
||||||
|
const tableData = [
|
||||||
|
{
|
||||||
|
date: "2016-05-03",
|
||||||
|
name: "Tom",
|
||||||
|
address: "No. 189, Grove St, Los Angeles",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
date: "2016-05-02",
|
||||||
|
name: "Tom",
|
||||||
|
address: "No. 189, Grove St, Los Angeles",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
date: "2016-05-04",
|
||||||
|
name: "Tom",
|
||||||
|
address: "No. 189, Grove St, Los Angeles",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
date: "2016-05-01",
|
||||||
|
name: "Tom",
|
||||||
|
address: "No. 189, Grove St, Los Angeles",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
</script>
|
55
src/views/dashboard/graphs/InstanceList.vue
Normal file
55
src/views/dashboard/graphs/InstanceList.vue
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<!-- Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
|
this work for additional information regarding copyright ownership.
|
||||||
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
(the "License"); you may not use this file except in compliance with
|
||||||
|
the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License. -->
|
||||||
|
<template>
|
||||||
|
<el-table :data="tableData" style="width: 100%">
|
||||||
|
<el-table-column prop="date" label="Date" width="180" />
|
||||||
|
<el-table-column prop="name" label="Name" width="180" />
|
||||||
|
</el-table>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ElTable, ElTableColumn } from "element-plus";
|
||||||
|
import { defineProps } from "vue";
|
||||||
|
import type { PropType } from "vue";
|
||||||
|
|
||||||
|
defineProps({
|
||||||
|
data: {
|
||||||
|
type: Array as PropType<{ label: string; value: string }[]>,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
theme: { type: String, default: "" },
|
||||||
|
});
|
||||||
|
const tableData = [
|
||||||
|
{
|
||||||
|
date: "2016-05-03",
|
||||||
|
name: "Tom",
|
||||||
|
address: "No. 189, Grove St, Los Angeles",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
date: "2016-05-02",
|
||||||
|
name: "Tom",
|
||||||
|
address: "No. 189, Grove St, Los Angeles",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
date: "2016-05-04",
|
||||||
|
name: "Tom",
|
||||||
|
address: "No. 189, Grove St, Los Angeles",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
date: "2016-05-01",
|
||||||
|
name: "Tom",
|
||||||
|
address: "No. 189, Grove St, Los Angeles",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
</script>
|
@ -60,10 +60,11 @@ const props = defineProps({
|
|||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const chartTable = ref<any>(null);
|
/*global Nullable*/
|
||||||
|
const chartTable = ref<Nullable<HTMLElement>>(null);
|
||||||
const initWidth = ref<number>(0);
|
const initWidth = ref<number>(0);
|
||||||
const nameWidth = ref<number>(0);
|
const nameWidth = ref<number>(0);
|
||||||
const draggerName = ref<any>(0);
|
const draggerName = ref<Nullable<HTMLElement>>(null);
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (!chartTable.value) {
|
if (!chartTable.value) {
|
||||||
return;
|
return;
|
||||||
|
36
src/views/dashboard/graphs/index.ts
Normal file
36
src/views/dashboard/graphs/index.ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
* (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import ChartArea from "./Area.vue";
|
||||||
|
import ChartLine from "./Line.vue";
|
||||||
|
import ChartBar from "./Bar.vue";
|
||||||
|
import ChartHeatmap from "./Heatmap.vue";
|
||||||
|
import ProgressBar from "./ProgressBar.vue";
|
||||||
|
import ChartTable from "./Table.vue";
|
||||||
|
import ChartPie from "./Pie.vue";
|
||||||
|
import ChartCard from "./Card.vue";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
ChartLine,
|
||||||
|
ChartBar,
|
||||||
|
ChartHeatmap,
|
||||||
|
ProgressBar,
|
||||||
|
ChartArea,
|
||||||
|
ChartTable,
|
||||||
|
ChartPie,
|
||||||
|
ChartCard,
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user