2022-07-06 06:31:42 +00:00
|
|
|
<script lang="ts" setup>
|
2023-01-30 06:52:11 +00:00
|
|
|
import {
|
|
|
|
IconRefreshLine,
|
|
|
|
Toast,
|
|
|
|
VButton,
|
|
|
|
VModal,
|
|
|
|
VSpace,
|
|
|
|
} from "@halo-dev/components";
|
2024-03-14 05:04:07 +00:00
|
|
|
import { computed, nextTick, ref, toRaw, watch } from "vue";
|
2022-11-10 16:24:10 +00:00
|
|
|
import type { Post } from "@halo-dev/api-client";
|
2023-12-28 09:13:38 +00:00
|
|
|
import { cloneDeep } from "lodash-es";
|
2022-09-22 08:46:32 +00:00
|
|
|
import { apiClient } from "@/utils/api-client";
|
2023-11-09 06:56:06 +00:00
|
|
|
import { useThemeCustomTemplates } from "@console/modules/interface/themes/composables/use-theme";
|
2022-11-10 16:24:10 +00:00
|
|
|
import { postLabels } from "@/constants/labels";
|
2022-11-18 06:00:23 +00:00
|
|
|
import { randomUUID } from "@/utils/id";
|
2022-11-28 15:32:18 +00:00
|
|
|
import { toDatetimeLocal, toISOString } from "@/utils/date";
|
2022-12-26 14:08:32 +00:00
|
|
|
import AnnotationsForm from "@/components/form/AnnotationsForm.vue";
|
2022-12-24 04:14:30 +00:00
|
|
|
import { submitForm } from "@formkit/core";
|
2023-11-09 06:56:06 +00:00
|
|
|
import useSlugify from "@console/composables/use-slugify";
|
2023-03-23 08:54:33 +00:00
|
|
|
import { useI18n } from "vue-i18n";
|
2023-07-18 08:16:02 +00:00
|
|
|
import { usePostUpdateMutate } from "../composables/use-post-update-mutate";
|
2023-09-10 14:08:13 +00:00
|
|
|
import { FormType } from "@/types/slug";
|
2022-08-23 04:08:10 +00:00
|
|
|
|
2022-11-10 16:24:10 +00:00
|
|
|
const initialFormState: Post = {
|
|
|
|
spec: {
|
|
|
|
title: "",
|
|
|
|
slug: "",
|
|
|
|
template: "",
|
|
|
|
cover: "",
|
|
|
|
deleted: false,
|
|
|
|
publish: false,
|
2023-04-03 03:12:14 +00:00
|
|
|
publishTime: undefined,
|
2022-11-10 16:24:10 +00:00
|
|
|
pinned: false,
|
|
|
|
allowComment: true,
|
|
|
|
visible: "PUBLIC",
|
|
|
|
priority: 0,
|
|
|
|
excerpt: {
|
|
|
|
autoGenerate: true,
|
|
|
|
raw: "",
|
2022-08-23 04:08:10 +00:00
|
|
|
},
|
2022-11-10 16:24:10 +00:00
|
|
|
categories: [],
|
|
|
|
tags: [],
|
|
|
|
htmlMetas: [],
|
2022-08-23 04:08:10 +00:00
|
|
|
},
|
2022-11-10 16:24:10 +00:00
|
|
|
apiVersion: "content.halo.run/v1alpha1",
|
|
|
|
kind: "Post",
|
|
|
|
metadata: {
|
2022-11-18 06:00:23 +00:00
|
|
|
name: randomUUID(),
|
2022-08-23 04:08:10 +00:00
|
|
|
},
|
|
|
|
};
|
2022-07-06 06:31:42 +00:00
|
|
|
|
2022-08-15 09:56:13 +00:00
|
|
|
const props = withDefaults(
|
|
|
|
defineProps<{
|
|
|
|
visible: boolean;
|
2022-11-10 16:24:10 +00:00
|
|
|
post?: Post;
|
|
|
|
publishSupport?: boolean;
|
|
|
|
onlyEmit?: boolean;
|
2022-08-15 09:56:13 +00:00
|
|
|
}>(),
|
|
|
|
{
|
|
|
|
visible: false,
|
2022-11-10 16:24:10 +00:00
|
|
|
post: undefined,
|
|
|
|
publishSupport: true,
|
|
|
|
onlyEmit: false,
|
2022-08-15 09:56:13 +00:00
|
|
|
}
|
|
|
|
);
|
2022-07-06 06:31:42 +00:00
|
|
|
|
2022-08-15 12:31:51 +00:00
|
|
|
const emit = defineEmits<{
|
|
|
|
(event: "update:visible", visible: boolean): void;
|
|
|
|
(event: "close"): void;
|
2022-11-10 16:24:10 +00:00
|
|
|
(event: "saved", post: Post): void;
|
|
|
|
(event: "published", post: Post): void;
|
2022-08-15 12:31:51 +00:00
|
|
|
}>();
|
2022-07-06 06:31:42 +00:00
|
|
|
|
2023-03-23 08:54:33 +00:00
|
|
|
const { t } = useI18n();
|
|
|
|
|
2022-11-10 16:24:10 +00:00
|
|
|
const formState = ref<Post>(cloneDeep(initialFormState));
|
2022-08-23 04:08:10 +00:00
|
|
|
const saving = ref(false);
|
|
|
|
const publishing = ref(false);
|
|
|
|
const publishCanceling = ref(false);
|
2022-12-24 04:14:30 +00:00
|
|
|
const submitType = ref<"publish" | "save">();
|
2024-03-14 05:04:07 +00:00
|
|
|
const publishTime = ref<string | undefined>(undefined);
|
2022-08-23 04:08:10 +00:00
|
|
|
|
|
|
|
const isUpdateMode = computed(() => {
|
2022-11-10 16:24:10 +00:00
|
|
|
return !!formState.value.metadata.creationTimestamp;
|
2022-07-06 06:31:42 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
const handleVisibleChange = (visible: boolean) => {
|
|
|
|
emit("update:visible", visible);
|
|
|
|
if (!visible) {
|
|
|
|
emit("close");
|
|
|
|
}
|
|
|
|
};
|
2022-08-23 04:08:10 +00:00
|
|
|
|
2022-12-24 04:14:30 +00:00
|
|
|
const handleSubmit = () => {
|
|
|
|
if (submitType.value === "publish") {
|
|
|
|
handlePublish();
|
|
|
|
}
|
|
|
|
if (submitType.value === "save") {
|
|
|
|
handleSave();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const handleSaveClick = () => {
|
|
|
|
submitType.value = "save";
|
|
|
|
|
|
|
|
nextTick(() => {
|
|
|
|
submitForm("post-setting-form");
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
const handlePublishClick = () => {
|
|
|
|
submitType.value = "publish";
|
|
|
|
|
|
|
|
nextTick(() => {
|
|
|
|
submitForm("post-setting-form");
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2023-03-12 10:42:15 +00:00
|
|
|
// Fix me:
|
|
|
|
// Force update post settings,
|
|
|
|
// because currently there may be errors caused by changes in version due to asynchronous processing.
|
2023-07-18 08:16:02 +00:00
|
|
|
const { mutateAsync: postUpdateMutate } = usePostUpdateMutate();
|
2023-03-12 10:42:15 +00:00
|
|
|
|
2022-08-23 09:10:00 +00:00
|
|
|
const handleSave = async () => {
|
2022-12-26 14:08:32 +00:00
|
|
|
annotationsFormRef.value?.handleSubmit();
|
|
|
|
await nextTick();
|
|
|
|
|
|
|
|
const { customAnnotations, annotations, customFormInvalid, specFormInvalid } =
|
|
|
|
annotationsFormRef.value || {};
|
|
|
|
|
|
|
|
if (customFormInvalid || specFormInvalid) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
formState.value.metadata.annotations = {
|
|
|
|
...annotations,
|
|
|
|
...customAnnotations,
|
|
|
|
};
|
|
|
|
|
2022-11-10 16:24:10 +00:00
|
|
|
if (props.onlyEmit) {
|
|
|
|
emit("saved", formState.value);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-08-23 04:08:10 +00:00
|
|
|
try {
|
|
|
|
saving.value = true;
|
2022-09-04 09:17:37 +00:00
|
|
|
|
2022-11-10 16:24:10 +00:00
|
|
|
const { data } = isUpdateMode.value
|
2023-03-12 10:42:15 +00:00
|
|
|
? await postUpdateMutate(formState.value)
|
2022-11-10 16:24:10 +00:00
|
|
|
: await apiClient.extension.post.createcontentHaloRunV1alpha1Post({
|
|
|
|
post: formState.value,
|
|
|
|
});
|
2022-09-04 09:17:37 +00:00
|
|
|
|
2022-11-10 16:24:10 +00:00
|
|
|
formState.value = data;
|
|
|
|
emit("saved", data);
|
|
|
|
|
|
|
|
handleVisibleChange(false);
|
2022-12-20 11:04:29 +00:00
|
|
|
|
2023-03-23 08:54:33 +00:00
|
|
|
Toast.success(t("core.common.toast.save_success"));
|
2022-08-23 04:08:10 +00:00
|
|
|
} catch (e) {
|
|
|
|
console.error("Failed to save post", e);
|
|
|
|
} finally {
|
|
|
|
saving.value = false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-11-11 16:10:12 +00:00
|
|
|
const handlePublish = async () => {
|
2022-11-10 16:24:10 +00:00
|
|
|
if (props.onlyEmit) {
|
|
|
|
emit("published", formState.value);
|
|
|
|
return;
|
2022-08-23 04:08:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2022-11-11 16:10:12 +00:00
|
|
|
publishing.value = true;
|
2022-08-23 09:10:00 +00:00
|
|
|
|
2022-11-11 16:10:12 +00:00
|
|
|
const { data } = await apiClient.post.publishPost({
|
|
|
|
name: formState.value.metadata.name,
|
|
|
|
});
|
2022-08-23 09:10:00 +00:00
|
|
|
|
2022-11-10 16:24:10 +00:00
|
|
|
formState.value = data;
|
|
|
|
|
2022-11-11 16:10:12 +00:00
|
|
|
emit("published", data);
|
2022-11-10 16:24:10 +00:00
|
|
|
|
|
|
|
handleVisibleChange(false);
|
2022-12-20 11:04:29 +00:00
|
|
|
|
2023-03-23 08:54:33 +00:00
|
|
|
Toast.success(t("core.common.toast.publish_success"));
|
2022-08-23 04:08:10 +00:00
|
|
|
} catch (e) {
|
2022-11-10 16:24:10 +00:00
|
|
|
console.error("Failed to publish post", e);
|
2022-08-23 04:08:10 +00:00
|
|
|
} finally {
|
2022-11-10 16:24:10 +00:00
|
|
|
publishing.value = false;
|
2022-11-11 16:10:12 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const handleUnpublish = async () => {
|
|
|
|
try {
|
|
|
|
publishCanceling.value = true;
|
|
|
|
|
|
|
|
await apiClient.post.unpublishPost({
|
|
|
|
name: formState.value.metadata.name,
|
|
|
|
});
|
|
|
|
|
|
|
|
handleVisibleChange(false);
|
2022-12-20 11:04:29 +00:00
|
|
|
|
2023-03-23 08:54:33 +00:00
|
|
|
Toast.success(t("core.common.toast.cancel_publish_success"));
|
2022-11-11 16:10:12 +00:00
|
|
|
} catch (e) {
|
|
|
|
console.error("Failed to publish post", e);
|
|
|
|
} finally {
|
2022-08-23 04:08:10 +00:00
|
|
|
publishCanceling.value = false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2024-03-14 05:04:07 +00:00
|
|
|
watch(
|
|
|
|
() => props.post,
|
|
|
|
(value) => {
|
|
|
|
if (value) {
|
|
|
|
formState.value = toRaw(value);
|
|
|
|
publishTime.value = toDatetimeLocal(formState.value.spec.publishTime);
|
|
|
|
}
|
2024-03-18 04:38:07 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
immediate: true,
|
2022-08-23 04:08:10 +00:00
|
|
|
}
|
2024-03-14 05:04:07 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
watch(
|
|
|
|
() => publishTime.value,
|
|
|
|
(value) => {
|
|
|
|
formState.value.spec.publishTime = value ? toISOString(value) : undefined;
|
|
|
|
}
|
|
|
|
);
|
2022-11-02 06:40:16 +00:00
|
|
|
|
|
|
|
// custom templates
|
|
|
|
const { templates } = useThemeCustomTemplates("post");
|
2022-11-28 15:32:18 +00:00
|
|
|
|
2022-12-26 14:08:32 +00:00
|
|
|
const annotationsFormRef = ref<InstanceType<typeof AnnotationsForm>>();
|
2023-01-30 06:52:11 +00:00
|
|
|
|
|
|
|
// slug
|
|
|
|
const { handleGenerateSlug } = useSlugify(
|
|
|
|
computed(() => formState.value.spec.title),
|
|
|
|
computed({
|
|
|
|
get() {
|
|
|
|
return formState.value.spec.slug;
|
|
|
|
},
|
|
|
|
set(value) {
|
|
|
|
formState.value.spec.slug = value;
|
|
|
|
},
|
|
|
|
}),
|
2023-09-10 14:08:13 +00:00
|
|
|
computed(() => !isUpdateMode.value),
|
|
|
|
FormType.POST
|
2023-01-30 06:52:11 +00:00
|
|
|
);
|
2022-07-06 06:31:42 +00:00
|
|
|
</script>
|
|
|
|
<template>
|
|
|
|
<VModal
|
|
|
|
:visible="visible"
|
2022-08-23 04:08:10 +00:00
|
|
|
:width="700"
|
2023-03-23 08:54:33 +00:00
|
|
|
:title="$t('core.post.settings.title')"
|
2022-09-28 07:02:44 +00:00
|
|
|
:centered="false"
|
2022-07-06 06:31:42 +00:00
|
|
|
@update:visible="handleVisibleChange"
|
|
|
|
>
|
|
|
|
<template #actions>
|
2022-08-23 04:08:10 +00:00
|
|
|
<slot name="actions"></slot>
|
2022-07-06 06:31:42 +00:00
|
|
|
</template>
|
|
|
|
|
2022-12-24 04:14:30 +00:00
|
|
|
<FormKit
|
|
|
|
id="post-setting-form"
|
|
|
|
type="form"
|
|
|
|
name="post-setting-form"
|
|
|
|
:config="{ validationVisibility: 'submit' }"
|
|
|
|
@submit="handleSubmit"
|
|
|
|
>
|
|
|
|
<div>
|
|
|
|
<div class="md:grid md:grid-cols-4 md:gap-6">
|
|
|
|
<div class="md:col-span-1">
|
|
|
|
<div class="sticky top-0">
|
|
|
|
<span class="text-base font-medium text-gray-900">
|
2023-03-23 08:54:33 +00:00
|
|
|
{{ $t("core.post.settings.groups.general") }}
|
2022-12-24 04:14:30 +00:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="mt-5 divide-y divide-gray-100 md:col-span-3 md:mt-0">
|
|
|
|
<FormKit
|
|
|
|
v-model="formState.spec.title"
|
2023-03-23 08:54:33 +00:00
|
|
|
:label="$t('core.post.settings.fields.title.label')"
|
2022-12-24 04:14:30 +00:00
|
|
|
type="text"
|
|
|
|
name="title"
|
|
|
|
validation="required|length:0,100"
|
|
|
|
></FormKit>
|
|
|
|
<FormKit
|
|
|
|
v-model="formState.spec.slug"
|
2023-03-23 08:54:33 +00:00
|
|
|
:label="$t('core.post.settings.fields.slug.label')"
|
2022-12-24 04:14:30 +00:00
|
|
|
name="slug"
|
|
|
|
type="text"
|
|
|
|
validation="required|length:0,100"
|
2023-03-23 08:54:33 +00:00
|
|
|
:help="$t('core.post.settings.fields.slug.help')"
|
2023-01-30 06:52:11 +00:00
|
|
|
>
|
|
|
|
<template #suffix>
|
|
|
|
<div
|
2023-03-23 08:54:33 +00:00
|
|
|
v-tooltip="
|
|
|
|
$t('core.post.settings.fields.slug.refresh_message')
|
|
|
|
"
|
2023-01-30 06:52:11 +00:00
|
|
|
class="group flex h-full cursor-pointer items-center border-l px-3 transition-all hover:bg-gray-100"
|
2023-09-10 14:08:13 +00:00
|
|
|
@click="handleGenerateSlug(true, FormType.POST)"
|
2023-01-30 06:52:11 +00:00
|
|
|
>
|
|
|
|
<IconRefreshLine
|
|
|
|
class="h-4 w-4 text-gray-500 group-hover:text-gray-700"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</FormKit>
|
2022-12-24 04:14:30 +00:00
|
|
|
<FormKit
|
|
|
|
v-model="formState.spec.categories"
|
2023-03-23 08:54:33 +00:00
|
|
|
:label="$t('core.post.settings.fields.categories.label')"
|
2022-12-24 04:14:30 +00:00
|
|
|
name="categories"
|
2023-01-16 08:02:13 +00:00
|
|
|
type="categorySelect"
|
|
|
|
:multiple="true"
|
2022-12-24 04:14:30 +00:00
|
|
|
/>
|
|
|
|
<FormKit
|
|
|
|
v-model="formState.spec.tags"
|
2023-03-23 08:54:33 +00:00
|
|
|
:label="$t('core.post.settings.fields.tags.label')"
|
2022-12-24 04:14:30 +00:00
|
|
|
name="tags"
|
2023-01-16 02:58:13 +00:00
|
|
|
type="tagSelect"
|
|
|
|
:multiple="true"
|
2022-12-24 04:14:30 +00:00
|
|
|
/>
|
|
|
|
<FormKit
|
|
|
|
v-model="formState.spec.excerpt.autoGenerate"
|
|
|
|
:options="[
|
2023-03-23 08:54:33 +00:00
|
|
|
{ label: $t('core.common.radio.yes'), value: true },
|
|
|
|
{ label: $t('core.common.radio.no'), value: false },
|
2022-12-24 04:14:30 +00:00
|
|
|
]"
|
|
|
|
name="autoGenerate"
|
2023-03-23 08:54:33 +00:00
|
|
|
:label="
|
|
|
|
$t('core.post.settings.fields.auto_generate_excerpt.label')
|
|
|
|
"
|
2022-12-24 04:14:30 +00:00
|
|
|
type="radio"
|
|
|
|
>
|
|
|
|
</FormKit>
|
|
|
|
<FormKit
|
|
|
|
v-if="!formState.spec.excerpt.autoGenerate"
|
|
|
|
v-model="formState.spec.excerpt.raw"
|
2023-03-23 08:54:33 +00:00
|
|
|
:label="$t('core.post.settings.fields.raw_excerpt.label')"
|
2022-12-24 04:14:30 +00:00
|
|
|
name="raw"
|
|
|
|
type="textarea"
|
|
|
|
:rows="5"
|
|
|
|
validation="length:0,1024"
|
|
|
|
></FormKit>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="py-5">
|
|
|
|
<div class="border-t border-gray-200"></div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="md:grid md:grid-cols-4 md:gap-6">
|
|
|
|
<div class="md:col-span-1">
|
|
|
|
<div class="sticky top-0">
|
|
|
|
<span class="text-base font-medium text-gray-900">
|
2023-03-23 08:54:33 +00:00
|
|
|
{{ $t("core.post.settings.groups.advanced") }}
|
2022-12-24 04:14:30 +00:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="mt-5 divide-y divide-gray-100 md:col-span-3 md:mt-0">
|
|
|
|
<FormKit
|
|
|
|
v-model="formState.spec.allowComment"
|
|
|
|
:options="[
|
2023-03-23 08:54:33 +00:00
|
|
|
{ label: $t('core.common.radio.yes'), value: true },
|
|
|
|
{ label: $t('core.common.radio.no'), value: false },
|
2022-12-24 04:14:30 +00:00
|
|
|
]"
|
2023-03-23 08:54:33 +00:00
|
|
|
:label="$t('core.post.settings.fields.allow_comment.label')"
|
2022-12-24 04:14:30 +00:00
|
|
|
type="radio"
|
|
|
|
></FormKit>
|
|
|
|
<FormKit
|
|
|
|
v-model="formState.spec.pinned"
|
|
|
|
:options="[
|
2023-03-23 08:54:33 +00:00
|
|
|
{ label: $t('core.common.radio.yes'), value: true },
|
|
|
|
{ label: $t('core.common.radio.no'), value: false },
|
2022-12-24 04:14:30 +00:00
|
|
|
]"
|
2023-03-23 08:54:33 +00:00
|
|
|
:label="$t('core.post.settings.fields.pinned.label')"
|
2022-12-24 04:14:30 +00:00
|
|
|
name="pinned"
|
|
|
|
type="radio"
|
|
|
|
></FormKit>
|
|
|
|
<FormKit
|
|
|
|
v-model="formState.spec.visible"
|
|
|
|
:options="[
|
2023-03-23 08:54:33 +00:00
|
|
|
{ label: $t('core.common.select.public'), value: 'PUBLIC' },
|
|
|
|
{
|
|
|
|
label: $t('core.common.select.private'),
|
|
|
|
value: 'PRIVATE',
|
|
|
|
},
|
2022-12-24 04:14:30 +00:00
|
|
|
]"
|
2023-03-23 08:54:33 +00:00
|
|
|
:label="$t('core.post.settings.fields.visible.label')"
|
2022-12-24 04:14:30 +00:00
|
|
|
name="visible"
|
|
|
|
type="select"
|
|
|
|
></FormKit>
|
|
|
|
<FormKit
|
2023-04-03 03:12:14 +00:00
|
|
|
v-model="publishTime"
|
2023-03-23 08:54:33 +00:00
|
|
|
:label="$t('core.post.settings.fields.publish_time.label')"
|
2022-12-24 04:14:30 +00:00
|
|
|
type="datetime-local"
|
2024-04-12 11:28:09 +00:00
|
|
|
min="0000-01-01T00:00"
|
|
|
|
max="9999-12-31T23:59"
|
2022-12-24 04:14:30 +00:00
|
|
|
></FormKit>
|
|
|
|
<FormKit
|
|
|
|
v-model="formState.spec.template"
|
|
|
|
:options="templates"
|
2023-03-23 08:54:33 +00:00
|
|
|
:label="$t('core.post.settings.fields.template.label')"
|
2022-12-24 04:14:30 +00:00
|
|
|
name="template"
|
|
|
|
type="select"
|
|
|
|
></FormKit>
|
|
|
|
<FormKit
|
|
|
|
v-model="formState.spec.cover"
|
|
|
|
name="cover"
|
2023-03-23 08:54:33 +00:00
|
|
|
:label="$t('core.post.settings.fields.cover.label')"
|
2022-12-24 04:14:30 +00:00
|
|
|
type="attachment"
|
2023-04-24 07:45:44 +00:00
|
|
|
:accepts="['image/*']"
|
2022-12-24 04:14:30 +00:00
|
|
|
validation="length:0,1024"
|
|
|
|
></FormKit>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</FormKit>
|
2022-07-06 06:31:42 +00:00
|
|
|
|
2022-12-26 14:08:32 +00:00
|
|
|
<div class="py-5">
|
|
|
|
<div class="border-t border-gray-200"></div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="md:grid md:grid-cols-4 md:gap-6">
|
|
|
|
<div class="md:col-span-1">
|
|
|
|
<div class="sticky top-0">
|
2023-03-23 08:54:33 +00:00
|
|
|
<span class="text-base font-medium text-gray-900">
|
|
|
|
{{ $t("core.post.settings.groups.annotations") }}
|
|
|
|
</span>
|
2022-12-26 14:08:32 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="mt-5 divide-y divide-gray-100 md:col-span-3 md:mt-0">
|
|
|
|
<AnnotationsForm
|
|
|
|
:key="formState.metadata.name"
|
|
|
|
ref="annotationsFormRef"
|
|
|
|
:value="formState.metadata.annotations"
|
|
|
|
kind="Post"
|
|
|
|
group="content.halo.run"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-07-06 06:31:42 +00:00
|
|
|
<template #footer>
|
|
|
|
<VSpace>
|
2022-11-10 16:24:10 +00:00
|
|
|
<template v-if="publishSupport">
|
|
|
|
<VButton
|
|
|
|
v-if="formState.metadata.labels?.[postLabels.PUBLISHED] !== 'true'"
|
|
|
|
:loading="publishing"
|
|
|
|
type="secondary"
|
2022-12-24 04:14:30 +00:00
|
|
|
@click="handlePublishClick()"
|
2022-11-10 16:24:10 +00:00
|
|
|
>
|
2023-03-23 08:54:33 +00:00
|
|
|
{{ $t("core.common.buttons.publish") }}
|
2022-11-10 16:24:10 +00:00
|
|
|
</VButton>
|
|
|
|
<VButton
|
|
|
|
v-else
|
|
|
|
:loading="publishCanceling"
|
|
|
|
type="danger"
|
2022-11-11 16:10:12 +00:00
|
|
|
@click="handleUnpublish()"
|
2022-11-10 16:24:10 +00:00
|
|
|
>
|
2023-03-23 08:54:33 +00:00
|
|
|
{{ $t("core.common.buttons.cancel_publish") }}
|
2022-11-10 16:24:10 +00:00
|
|
|
</VButton>
|
|
|
|
</template>
|
2022-12-24 04:14:30 +00:00
|
|
|
<VButton :loading="saving" type="secondary" @click="handleSaveClick()">
|
2023-03-23 08:54:33 +00:00
|
|
|
{{ $t("core.common.buttons.save") }}
|
2022-09-04 09:17:37 +00:00
|
|
|
</VButton>
|
2022-11-10 16:24:10 +00:00
|
|
|
<VButton type="default" @click="handleVisibleChange(false)">
|
2023-03-23 08:54:33 +00:00
|
|
|
{{ $t("core.common.buttons.close") }}
|
2022-07-06 06:31:42 +00:00
|
|
|
</VButton>
|
|
|
|
</VSpace>
|
|
|
|
</template>
|
|
|
|
</VModal>
|
|
|
|
</template>
|