mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-02 15:14:46 +00:00
feat: add visualization
This commit is contained in:
parent
9ae1f26d84
commit
834cde9562
@ -39,6 +39,16 @@ limitations under the License. -->
|
|||||||
</div>
|
</div>
|
||||||
<div class="visualization item">
|
<div class="visualization item">
|
||||||
<label>Select you visualization</label>
|
<label>Select you visualization</label>
|
||||||
|
<div class="chart-types">
|
||||||
|
<span
|
||||||
|
v-for="type in ChartTypes"
|
||||||
|
:key="type.value"
|
||||||
|
@click="changeChartType(type)"
|
||||||
|
:class="{ active: type.value === states.chartType }"
|
||||||
|
>
|
||||||
|
{{ type.label }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="graph-styles item">
|
<div class="graph-styles item">
|
||||||
<label>Graph styles</label>
|
<label>Graph styles</label>
|
||||||
@ -56,7 +66,7 @@ import { reactive } from "vue";
|
|||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import { ValuesTypes, MetricQueryTypes } from "../data";
|
import { ValuesTypes, MetricQueryTypes, ChartTypes } from "../data";
|
||||||
import { Option } from "@/types/app";
|
import { Option } from "@/types/app";
|
||||||
import Loading from "@/utils/loading";
|
import Loading from "@/utils/loading";
|
||||||
|
|
||||||
@ -65,11 +75,13 @@ const states = reactive<{
|
|||||||
valueTypes: Option[];
|
valueTypes: Option[];
|
||||||
valueType: string;
|
valueType: string;
|
||||||
metricQueryType: string;
|
metricQueryType: string;
|
||||||
|
chartType: string;
|
||||||
}>({
|
}>({
|
||||||
metrics: "",
|
metrics: "",
|
||||||
valueTypes: [],
|
valueTypes: [],
|
||||||
valueType: "",
|
valueType: "",
|
||||||
metricQueryType: "",
|
metricQueryType: "",
|
||||||
|
chartType: "",
|
||||||
});
|
});
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
@ -95,6 +107,9 @@ function changeValueType(val: Option[]) {
|
|||||||
states.valueType = String(val[0].value);
|
states.valueType = String(val[0].value);
|
||||||
states.metricQueryType = (MetricQueryTypes as any)[states.valueType];
|
states.metricQueryType = (MetricQueryTypes as any)[states.valueType];
|
||||||
}
|
}
|
||||||
|
function changeChartType(item: Option) {
|
||||||
|
states.chartType = String(item.value);
|
||||||
|
}
|
||||||
const metricOpts = [
|
const metricOpts = [
|
||||||
{ value: "service_apdex", label: "service_apdex" },
|
{ value: "service_apdex", label: "service_apdex" },
|
||||||
{ value: "service_sla", label: "service_sla" },
|
{ value: "service_sla", label: "service_sla" },
|
||||||
@ -113,6 +128,7 @@ const metricOpts = [
|
|||||||
.graph {
|
.graph {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 350px;
|
height: 350px;
|
||||||
|
min-width: 1280px;
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
label {
|
||||||
@ -131,4 +147,27 @@ label {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.config {
|
||||||
|
min-width: 1280px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-types {
|
||||||
|
span {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 5px 10px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
background-color: #fff;
|
||||||
|
border-right: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
span:nth-last-child(1) {
|
||||||
|
border-right: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
span.active {
|
||||||
|
background-color: #eee;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -14,6 +14,20 @@
|
|||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
export const ChartTypes = [
|
||||||
|
{ label: "Bar", value: "bar" },
|
||||||
|
{ label: "Line", value: "line" },
|
||||||
|
{ label: "Area", value: "area" },
|
||||||
|
{ label: "Heat Map", value: "heatMap" },
|
||||||
|
{ label: "Pie", value: "pie" },
|
||||||
|
{ label: "Sankey", value: "sankey" },
|
||||||
|
{ label: "Gauge", value: "gauge" },
|
||||||
|
{ label: "Card", value: "card" },
|
||||||
|
{ label: "Table", value: "table" },
|
||||||
|
{ label: "Progress Bar", value: "progressBar" },
|
||||||
|
{ label: "Endpoint List", value: "endpointList" },
|
||||||
|
{ label: "Instance List", value: "instanceList" },
|
||||||
|
];
|
||||||
export enum MetricQueryTypes {
|
export enum MetricQueryTypes {
|
||||||
ReadMetricsValue = "readMetricsValue",
|
ReadMetricsValue = "readMetricsValue",
|
||||||
ReadMetricsValues = "readMetricsValues",
|
ReadMetricsValues = "readMetricsValues",
|
||||||
|
Loading…
Reference in New Issue
Block a user