@scalar/api-client
Version:
the open source API testing client
116 lines (115 loc) • 4.68 kB
JavaScript
import { defineComponent as w, createElementBlock as s, openBlock as r, Fragment as u, createElementVNode as t, createVNode as n, withCtx as d, unref as o, createTextVNode as i, toDisplayString as h } from "vue";
import { useModal as v, ScalarToggle as D, ScalarIcon as f, ScalarButton as y, ScalarModal as k } from "@scalar/components";
import M from "../../../components/Sidebar/Actions/DeleteSidebarListElement.vue.js";
import g from "./components/Section.vue.js";
const U = { class: "flex flex-col gap-12" }, C = { class: "bg-b-2 rounded-lg border text-sm" }, N = { class: "bg-b-1 flex items-center justify-between gap-4 rounded-t-lg p-3" }, S = { class: "text-c-1 flex items-center overflow-x-auto border-t py-1.5 whitespace-nowrap" }, B = { class: "flex items-center" }, V = ["href"], T = { class: "flex items-center justify-between rounded-lg border p-3 text-sm" }, L = /* @__PURE__ */ w({
__name: "DocumentSettings",
props: {
documentUrl: {},
watchMode: { type: Boolean },
title: {},
isDraftDocument: { type: Boolean, default: !1 }
},
emits: ["delete:document", "update:watchMode"],
setup(l, { emit: b }) {
const c = b, a = v(), p = () => {
l.isDraftDocument || a.show();
}, x = () => {
c("delete:document"), a.hide();
};
return ($, e) => (r(), s(u, null, [
t("div", U, [
n(g, null, {
title: d(() => [...e[2] || (e[2] = [
i("Features", -1)
])]),
default: d(() => [
t("div", C, [
t("div", N, [
e[3] || (e[3] = t("div", null, [
t("h4", null, "Watch Mode"),
t("p", { class: "text-c-2 mt-1" }, " When enabled, the OpenAPI document will be polled for changes. The collection will be updated automatically. ")
], -1)),
n(o(D), {
class: "w-4",
disabled: !l.documentUrl,
modelValue: l.watchMode ?? !1,
"onUpdate:modelValue": e[0] || (e[0] = (m) => c("update:watchMode", m))
}, null, 8, ["disabled", "modelValue"])
]),
t("div", S, [
t("div", B, [
l.documentUrl ? (r(), s(u, { key: 0 }, [
e[4] || (e[4] = t("span", { class: "bg-b-2 sticky left-0 pr-2 pl-3" }, "Source", -1)),
t("a", {
class: "text-c-2 group rounded pr-3 no-underline hover:underline",
href: l.documentUrl,
target: "_blank"
}, [
i(h(l.documentUrl) + " ", 1),
n(o(f), {
class: "ml-1 hidden w-2.5 group-hover:inline",
icon: "ExternalLink"
})
], 8, V)
], 64)) : (r(), s(u, { key: 1 }, [
n(o(f), {
class: "text-c-2 mr-2 ml-3 w-4",
icon: "NotAllowed",
size: "sm"
}),
e[5] || (e[5] = t("span", { class: "text-c-2 pr-3" }, " No URL configured. Try importing an OpenAPI document from an URL. ", -1))
], 64))
])
])
])
]),
_: 1
}),
n(g, null, {
title: d(() => [...e[6] || (e[6] = [
i("Danger Zone", -1)
])]),
default: d(() => [
t("div", T, [
e[8] || (e[8] = t("div", null, [
t("h4", null, "Delete Collection"),
t("p", { class: "text-c-2 mt-1" }, " Be careful, my friend. Once deleted, there is no way to recover the collection. ")
], -1)),
n(o(y), {
disabled: l.isDraftDocument,
size: "sm",
variant: "danger",
onClick: p
}, {
default: d(() => [...e[7] || (e[7] = [
i(" Delete Collection ", -1)
])]),
_: 1
}, 8, ["disabled"])
])
]),
_: 1
})
]),
n(o(k), {
size: "xxs",
state: o(a),
title: `Delete ${l.title}`
}, {
default: d(() => [
n(M, {
variableName: l.title ?? "",
warningMessage: "This action cannot be undone.",
onClose: e[1] || (e[1] = (m) => o(a).hide()),
onDelete: x
}, null, 8, ["variableName"])
]),
_: 1
}, 8, ["state", "title"])
], 64));
}
});
export {
L as default
};