This commit is contained in:
root
2026-01-22 22:06:08 +05:00
parent cfd306866b
commit be26158603
@@ -217,15 +217,14 @@
<div class="flex gap-1 mt-auto">
<Button label="Копировать" icon="pi pi-copy" size="small" severity="secondary" class="flex-1 text-xs" @click="handleCopyPost(post)" />
<Button
v-if="post.taskId"
label="Запустить"
icon="pi pi-play"
label="Опубликовать"
icon="pi pi-send"
size="small"
severity="success"
class="flex-1 text-xs"
:loading="isTaskExecuting(post.taskId)"
:disabled="isTaskExecuting(post.taskId)"
@click="handleExecuteTask(post.taskId, post)"
:loading="post.taskId ? isTaskExecuting(post.taskId) : false"
:disabled="!post.taskId || isTaskExecuting(post.taskId)"
@click="handlePublishPost(post)"
/>
</div>
</div>
@@ -308,14 +307,14 @@
<Button label="Копировать" icon="pi pi-copy" size="small" severity="secondary" class="flex-1 text-xs" @click="handleCopyPost(post)" />
<Button
v-if="post.taskId"
label="Запустить"
icon="pi pi-play"
label="Опубликовать"
icon="pi pi-send"
size="small"
severity="success"
class="flex-1 text-xs"
:loading="isTaskExecuting(post.taskId)"
:disabled="isTaskExecuting(post.taskId)"
@click="handleExecuteTask(post.taskId, post)"
@click="handlePublishPost(post)"
/>
</div>
</div>
@@ -688,6 +687,21 @@ const handleExecuteTask = async (taskId, post) => {
}
};
// Handle publish post
const handlePublishPost = async (post) => {
if (!post.taskId) {
toast.add({
severity: 'warn',
summary: 'Ошибка',
detail: 'Задача публикации не создана. Сначала запустите стратегию.',
life: 3000
});
return;
}
await handleExecuteTask(post.taskId, post);
};
// Check if task is executing
const isTaskExecuting = (taskId) => {
return taskId ? executingTasks.value.has(taskId) : false;