GuidedSetupStart.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { useRouter } from 'vue-router'
  4. import MutationHandler from '#shared/server/apollo/handler/MutationHandler.ts'
  5. import {
  6. EnumSystemSetupInfoStatus,
  7. EnumSystemSetupInfoType,
  8. } from '#shared/graphql/types.ts'
  9. import LayoutPublicPage from '#desktop/components/layout/LayoutPublicPage/LayoutPublicPage.vue'
  10. import CommonButton from '#desktop/components/CommonButton/CommonButton.vue'
  11. import { useSystemSetupLockMutation } from '../graphql/mutations/systemSetupLock.api.ts'
  12. import { useSystemSetupInfoStore } from '../stores/systemSetupInfo.ts'
  13. const router = useRouter()
  14. const systemSetupInfoStore = useSystemSetupInfoStore()
  15. const startSetup = (type: EnumSystemSetupInfoType) => {
  16. const lockMutation = new MutationHandler(useSystemSetupLockMutation())
  17. lockMutation
  18. .send()
  19. .then((data) => {
  20. systemSetupInfoStore.systemSetupInfo = {
  21. lockValue: data?.systemSetupLock?.value || '',
  22. type,
  23. status: EnumSystemSetupInfoStatus.InProgress,
  24. }
  25. router.push(`/guided-setup/${type}`)
  26. })
  27. .catch(() => {})
  28. }
  29. </script>
  30. <template>
  31. <LayoutPublicPage box-size="medium" :title="__('Welcome!')" show-logo>
  32. <CommonAlert
  33. v-if="systemSetupInfoStore.systemSetupAlreadyStarted"
  34. variant="warning"
  35. >{{
  36. $t(
  37. 'The setup has already been started. Please wait until it is finished.',
  38. )
  39. }}</CommonAlert
  40. >
  41. <template v-if="!systemSetupInfoStore.systemSetupAlreadyStarted">
  42. <div class="text-center mb-14 mt-10">
  43. <CommonButton
  44. type="submit"
  45. variant="primary"
  46. size="large"
  47. @click="startSetup(EnumSystemSetupInfoType.Manual)"
  48. >
  49. {{ $t('Set up a new system') }}
  50. </CommonButton>
  51. </div>
  52. <div class="text-center">
  53. <CommonButton
  54. type="submit"
  55. variant="secondary"
  56. size="large"
  57. @click="startSetup(EnumSystemSetupInfoType.Import)"
  58. >
  59. {{ $t('Or migrate from another system') }}
  60. </CommonButton>
  61. </div>
  62. </template>
  63. </LayoutPublicPage>
  64. </template>