Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setup(props: Record, ctx: SetupContext): Record {
const i18n = useI18n();
let locked = true;
const onDrag = (ev: DragEvent): void => {
switch (ev.type) {
case "dragend":
ctx.emit("drag-item", null);
locked = true;
break;
case "dragstart":
if (locked) {
ev.preventDefault();
} else {
ctx.emit("drag-item", props.index);
setup(): Record {
const i18n = useI18n();
const store = useStore();
const ui = useUI();
const {erred, loading, onFetchRejected} = common;
const version = ref(null);
const apiOptions = computed(() => store.state.apiOptions);
const getVersion = (): void => {
store.commit("loading", true);
api.version()
.then(response => {
version.value = response.data ?? null;
}, onFetchRejected)
setup(): Record {
const i18n = useI18n();
const store = useStore();
const {loading, prevRoute, sidebar} = common;
const routeData = computed(() => store.state.routeData);
return {
i18n,
loading,
prevRoute,
routeData,
sidebar,
};
},
};
setup(): Record {
const i18n = useI18n();
const store = useStore();
const ui = useUI();
const file = ref(null);
const apiOptions = computed(() => store.state.apiOptions);
const dump = (): void => {
location.href = `${apiPrefix}/store`;
};
const restore = async (): Promise => {
const curFile = file.value?.files?.[0];
if (file.value === null || curFile === undefined) {
throw Error("cannot get file");
}
setup(): Record {
const i18n = useI18n();
const router = useRouter();
const store = useStore();
const ui = useUI();
const {
applyRouteParams,
beforeRoute,
erred,
loading,
modifiers,
onFetchRejected,
prevRoute,
routeGuarded,
watchGuard,
unwatchGuard,
} = common;
setup(): Record {
const i18n = useI18n();
const button = ref(cloneDeep(defaultParams.button));
const message = ref(defaultParams.message);
const onShow = (params: ModalConfirmParams): void => {
button.value = merge({}, defaultParams.button, params.button);
message.value = params.message;
};
return {
button,
i18n,
message,
onShow,
};
},
setup(): Record {
const i18n = useI18n();
const ui = useUI();
const {toggleSidebar} = common;
const fullscreen = ref(false);
const fullscreenSupport = computed((): boolean => document.fullscreenEnabled);
const toggleFullscreen = (): void => {
if (document.fullscreen) {
document.exitFullscreen();
} else {
document.documentElement.requestFullscreen();
}
};
setup(): Record {
const i18n = useI18n();
let checkTimeout: number | null = null;
const edit = ref(false);
const error = ref(null);
const loadingMetrics = ref(false);
const metricsCount = ref(null);
const series = ref(cloneDeep(defaultSeries));
const axes = ref>([
{label: i18n.t("labels.charts.axes.left"), value: "left"},
{label: i18n.t("labels.charts.axes.right"), value: "right"},
]);
const checkExpr = async (value: string): Promise => {
try {
setup(props: Record): Record {
const i18n = useI18n();
const secured = computed(() => {
return Boolean(((props.settings.url ?? "") as string).startsWith("https://"));
});
return {
i18n,
secured,
};
},
};
setup(): Record {
const i18n = useI18n();
return {
i18n,
};
},
};