Browse Source

fix: use enum for project status

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/5621/head
mertmit 2 years ago
parent
commit
0307ba05db
  1. 9
      packages/nc-gui/pages/index/index/index.vue
  2. 4
      packages/nocodb-sdk/src/lib/globals.ts
  3. 3
      packages/nocodb/src/modules/jobs/export-import/duplicate.controller.ts

9
packages/nc-gui/pages/index/index/index.vue

@ -1,4 +1,5 @@
<script lang="ts" setup>
import { ProjectStatus } from 'nocodb-sdk'
import type { ProjectType } from 'nocodb-sdk'
import tinycolor from 'tinycolor2'
import { breakpointsTailwind } from '@vueuse/core'
@ -161,7 +162,7 @@ const getProjectPrimary = (project: ProjectType) => {
const customRow = (record: ProjectType) => ({
onClick: async () => {
if (record.status !== 'job') await navigateTo(`/nc/${record.id}`)
if (record.status !== ProjectStatus.JOB) await navigateTo(`/nc/${record.id}`)
$e('a:project:open')
},
@ -292,8 +293,8 @@ const copyProjectMeta = async () => {
>
<component
:is="iconMap.reload"
v-if="record.status === 'job'"
:class="{ 'animate-infinite animate-spin text-gray-500': record.status === 'job' }"
v-if="record.status === ProjectStatus.JOB"
:class="{ 'animate-infinite animate-spin text-gray-500': record.status === ProjectStatus.JOB }"
/>
{{ text }}
</div>
@ -304,7 +305,7 @@ const copyProjectMeta = async () => {
<a-table-column key="id" :title="$t('labels.actions')" data-index="id">
<template #default="{ text, record }">
<div v-if="record.status !== 'job'" class="flex items-center gap-2">
<div v-if="record.status !== ProjectStatus.JOB" class="flex items-center gap-2">
<component
:is="iconMap.edit"
v-e="['c:project:edit:rename']"

4
packages/nocodb-sdk/src/lib/globals.ts

@ -72,3 +72,7 @@ export enum ModelTypes {
TABLE = 'table',
VIEW = 'view',
}
export enum ProjectStatus {
JOB = 'job',
}

3
packages/nocodb/src/modules/jobs/export-import/duplicate.controller.ts

@ -7,6 +7,7 @@ import {
Request,
UseGuards,
} from '@nestjs/common';
import { ProjectStatus } from 'nocodb-sdk';
import { GlobalGuard } from '../../../guards/global/global.guard';
import {
Acl,
@ -62,7 +63,7 @@ export class DuplicateController {
);
const dupProject = await this.projectsService.projectCreate({
project: { title: uniqueTitle, status: 'job' },
project: { title: uniqueTitle, status: ProjectStatus.JOB },
user: { id: req.user.id },
});

Loading…
Cancel
Save