Removed delete flow button for non managers
This commit is contained in:
parent
d20f8ab70c
commit
927f406fa7
1 changed files with 16 additions and 3 deletions
|
|
@ -20,6 +20,7 @@ import {
|
|||
import { CheckCircleOutlined, CloseCircleOutlined } from '@ant-design/icons-vue'
|
||||
import { apiClient, API, isAxiosError } from '../router/api'
|
||||
import { useOnboardingAgentStore } from '../stores/onboardingAgentStore'
|
||||
import { useUserStore } from '../stores/userStore'
|
||||
import type {
|
||||
OnboardingFlow,
|
||||
OnboardingPage,
|
||||
|
|
@ -34,6 +35,7 @@ const marked = new Marked()
|
|||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const agentStore = useOnboardingAgentStore()
|
||||
const userStore = useUserStore()
|
||||
|
||||
const roleId = computed(() => route.params.roleId as string)
|
||||
const flowDetails = ref<OnboardingFlow | null>(null)
|
||||
|
|
@ -73,6 +75,7 @@ const currentPage = computed<OnboardingPage | null>(
|
|||
const hasNext = computed(() => currentPageIndex.value < pages.value.length - 1)
|
||||
const hasPrev = computed(() => currentPageIndex.value > 0)
|
||||
const isError = computed(() => agentStore.executionStatus === 'failed')
|
||||
const canDeleteFlow = computed(() => Boolean(userStore.isGeneralManager))
|
||||
|
||||
const completedModules = computed<string[]>(() => {
|
||||
const state = (session.value as unknown as { state?: Record<string, unknown> } | null)?.state
|
||||
|
|
@ -240,6 +243,10 @@ const retryGeneration = async () => {
|
|||
|
||||
const resetCurrentFlow = async () => {
|
||||
if (!flowDetails.value || deletingFlow.value) return
|
||||
if (!canDeleteFlow.value) {
|
||||
message.error('Only managers can delete onboarding flows.')
|
||||
return
|
||||
}
|
||||
|
||||
deletingFlow.value = true
|
||||
try {
|
||||
|
|
@ -641,7 +648,7 @@ watch(
|
|||
</Typography.Title>
|
||||
<Typography.Paragraph class="white-text" style="opacity: 0.8">
|
||||
You have already completed this onboarding flow. You can return to your
|
||||
organization page, or delete this flow to regenerate a new one.
|
||||
organization page and wait for your manager to review your onboarding results.
|
||||
</Typography.Paragraph>
|
||||
|
||||
<div class="completed-actions">
|
||||
|
|
@ -649,12 +656,15 @@ watch(
|
|||
Return to Organization
|
||||
</Button>
|
||||
<Popconfirm
|
||||
v-if="canDeleteFlow"
|
||||
title="Delete this onboarding flow and regenerate it?"
|
||||
ok-text="Delete"
|
||||
cancel-text="Cancel"
|
||||
@confirm="resetCurrentFlow"
|
||||
>
|
||||
<Button danger :loading="deletingFlow">Delete Flow</Button>
|
||||
<Button danger :loading="deletingFlow">
|
||||
Delete Flow
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -694,12 +704,15 @@ watch(
|
|||
{{ flowDetails.title }}
|
||||
</Typography.Title>
|
||||
<Popconfirm
|
||||
v-if="canDeleteFlow"
|
||||
title="Delete this onboarding flow and regenerate it?"
|
||||
ok-text="Delete"
|
||||
cancel-text="Cancel"
|
||||
@confirm="resetCurrentFlow"
|
||||
>
|
||||
<Button danger :loading="deletingFlow">Delete Flow</Button>
|
||||
<Button danger :loading="deletingFlow">
|
||||
Delete Flow
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</div>
|
||||
<Typography.Paragraph class="white-text" style="opacity: 0.8">
|
||||
|
|
|
|||
Loading…
Reference in a new issue