mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-02 17:44:46 +00:00
feat: add event stack
This commit is contained in:
parent
b0f6194f0c
commit
f4c1c81c09
@ -26,6 +26,8 @@ interface AppState {
|
|||||||
utc: string;
|
utc: string;
|
||||||
utcHour: number;
|
utcHour: number;
|
||||||
utcMin: number;
|
utcMin: number;
|
||||||
|
eventStack: (() => unknown)[];
|
||||||
|
timer: ReturnType<typeof setInterval> | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const appStore = defineStore({
|
export const appStore = defineStore({
|
||||||
@ -35,6 +37,8 @@ export const appStore = defineStore({
|
|||||||
utc: "",
|
utc: "",
|
||||||
utcHour: 0,
|
utcHour: 0,
|
||||||
utcMin: 0,
|
utcMin: 0,
|
||||||
|
eventStack: [],
|
||||||
|
timer: null,
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
duration(): Duration {
|
duration(): Duration {
|
||||||
@ -92,15 +96,38 @@ export const appStore = defineStore({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
setDuration(data: Duration) {
|
setDuration(data: Duration): void {
|
||||||
this.durationRow = data;
|
this.durationRow = data;
|
||||||
|
if ((window as any).axiosCancel.length !== 0) {
|
||||||
|
for (const event of (window as any).axiosCancel) {
|
||||||
|
setTimeout(event(), 0);
|
||||||
|
}
|
||||||
|
(window as any).axiosCancel = [];
|
||||||
|
}
|
||||||
|
this.runEventStack();
|
||||||
},
|
},
|
||||||
setUTC(utcHour: number, utcMin: number) {
|
setUTC(utcHour: number, utcMin: number): void {
|
||||||
|
this.runEventStack();
|
||||||
this.utcMin = utcMin;
|
this.utcMin = utcMin;
|
||||||
this.utcHour = utcHour;
|
this.utcHour = utcHour;
|
||||||
this.utc = `${utcHour}:${utcMin}`;
|
this.utc = `${utcHour}:${utcMin}`;
|
||||||
localStorage.setItem("utc", this.utc);
|
localStorage.setItem("utc", this.utc);
|
||||||
},
|
},
|
||||||
|
setEventStack(funcs: (() => void)[]): void {
|
||||||
|
this.eventStack = funcs;
|
||||||
|
},
|
||||||
|
runEventStack() {
|
||||||
|
if (this.timer) {
|
||||||
|
clearTimeout(this.timer);
|
||||||
|
}
|
||||||
|
this.timer = setTimeout(
|
||||||
|
() =>
|
||||||
|
this.eventStack.forEach((event: any) => {
|
||||||
|
setTimeout(event(), 0);
|
||||||
|
}),
|
||||||
|
500
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
export function useAppStoreWithOut(): any {
|
export function useAppStoreWithOut(): any {
|
||||||
|
@ -44,10 +44,6 @@ export const SelectOpt = [
|
|||||||
value: "efficiency",
|
value: "efficiency",
|
||||||
label: "Efficiency",
|
label: "Efficiency",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
value: "controllability",
|
|
||||||
label: "Controllability",
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -66,230 +62,6 @@ export const SelectOpt = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
value: "component",
|
|
||||||
label: "Component",
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
value: "basic",
|
|
||||||
label: "Basic",
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
value: "layout",
|
|
||||||
label: "Layout",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "color",
|
|
||||||
label: "Color",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "typography",
|
|
||||||
label: "Typography",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "icon",
|
|
||||||
label: "Icon",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "button",
|
|
||||||
label: "Button",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "form",
|
|
||||||
label: "Form",
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
value: "radio",
|
|
||||||
label: "Radio",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "checkbox",
|
|
||||||
label: "Checkbox",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "input",
|
|
||||||
label: "Input",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "input-number",
|
|
||||||
label: "InputNumber",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "select",
|
|
||||||
label: "Select",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "cascader",
|
|
||||||
label: "Cascader",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "switch",
|
|
||||||
label: "Switch",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "slider",
|
|
||||||
label: "Slider",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "time-picker",
|
|
||||||
label: "TimePicker",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "date-picker",
|
|
||||||
label: "DatePicker",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "datetime-picker",
|
|
||||||
label: "DateTimePicker",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "upload",
|
|
||||||
label: "Upload",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "rate",
|
|
||||||
label: "Rate",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "form",
|
|
||||||
label: "Form",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "data",
|
|
||||||
label: "Data",
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
value: "table",
|
|
||||||
label: "Table",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "tag",
|
|
||||||
label: "Tag",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "progress",
|
|
||||||
label: "Progress",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "tree",
|
|
||||||
label: "Tree",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "pagination",
|
|
||||||
label: "Pagination",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "badge",
|
|
||||||
label: "Badge",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "notice",
|
|
||||||
label: "Notice",
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
value: "alert",
|
|
||||||
label: "Alert",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "loading",
|
|
||||||
label: "Loading",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "message",
|
|
||||||
label: "Message",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "message-box",
|
|
||||||
label: "MessageBox",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "notification",
|
|
||||||
label: "Notification",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "navigation",
|
|
||||||
label: "Navigation",
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
value: "menu",
|
|
||||||
label: "Menu",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "tabs",
|
|
||||||
label: "Tabs",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "breadcrumb",
|
|
||||||
label: "Breadcrumb",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "dropdown",
|
|
||||||
label: "Dropdown",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "steps",
|
|
||||||
label: "Steps",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "others",
|
|
||||||
label: "Others",
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
value: "dialog",
|
|
||||||
label: "Dialog",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "tooltip",
|
|
||||||
label: "Tooltip",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "popover",
|
|
||||||
label: "Popover",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "card",
|
|
||||||
label: "Card",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "carousel",
|
|
||||||
label: "Carousel",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "collapse",
|
|
||||||
label: "Collapse",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "resource",
|
|
||||||
label: "Resource",
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
value: "axure",
|
|
||||||
label: "Axure Components",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "sketch",
|
|
||||||
label: "Sketch Templates",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "docs",
|
|
||||||
label: "Design Documentation",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
export const Options = [
|
export const Options = [
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user