mirror of https://github.com/doccano/doccano.git
Browse Source
Merge pull request #2207 from doccano/enhancement/1804
Merge pull request #2207 from doccano/enhancement/1804
Allow project members to create label typespull/2208/head
Hiroki Nakayama
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 285 additions and 99 deletions
Split View
Diff Options
-
7backend/api/tests/utils.py
-
68backend/label_types/tests/test_views.py
-
17backend/label_types/views.py
-
36backend/projects/migrations/0008_project_allow_member_to_create_label_type_and_more.py
-
1backend/projects/models.py
-
1backend/projects/serializers.py
-
35frontend/components/label/ActionMenu.vue
-
17frontend/components/label/LabelList.vue
-
8frontend/components/layout/TheSideBar.vue
-
30frontend/components/project/FormUpdate.vue
-
37frontend/domain/models/project/project.ts
-
3frontend/layouts/project.vue
-
10frontend/middleware/isProjectAdmin.ts
-
13frontend/middleware/setCurrentProject.ts
-
3frontend/pages/projects/_id/comments/index.vue
-
2frontend/pages/projects/_id/dataset/_example_id/edit.vue
-
2frontend/pages/projects/_id/dataset/export.vue
-
2frontend/pages/projects/_id/dataset/import.vue
-
2frontend/pages/projects/_id/guideline/index.vue
-
2frontend/pages/projects/_id/labels/_label_id/edit.vue
-
2frontend/pages/projects/_id/labels/import.vue
-
35frontend/pages/projects/_id/labels/index.vue
-
3frontend/pages/projects/_id/members/index.vue
-
2frontend/pages/projects/_id/metrics/index.vue
-
3frontend/pages/projects/_id/settings/index.vue
-
19frontend/pages/projects/create.vue
-
2frontend/repositories/project/apiProjectRepository.ts
-
13frontend/services/application/project/projectApplicationService.ts
-
9frontend/store/projects.js
@ -0,0 +1,36 @@ |
|||
# Generated by Django 4.1.7 on 2023-06-07 04:57 |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
("projects", "0007_imagecaptioningproject_alter_project_project_type"), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AddField( |
|||
model_name="project", |
|||
name="allow_member_to_create_label_type", |
|||
field=models.BooleanField(default=False), |
|||
), |
|||
migrations.AlterField( |
|||
model_name="project", |
|||
name="project_type", |
|||
field=models.CharField( |
|||
choices=[ |
|||
("DocumentClassification", "Document Classification"), |
|||
("SequenceLabeling", "Sequence Labeling"), |
|||
("Seq2seq", "Seq2Seq"), |
|||
("IntentDetectionAndSlotFilling", "Intent Detection And Slot Filling"), |
|||
("Speech2text", "Speech2Text"), |
|||
("ImageClassification", "Image Classification"), |
|||
("BoundingBox", "Bounding Box"), |
|||
("Segmentation", "Segmentation"), |
|||
("ImageCaptioning", "Image Captioning"), |
|||
], |
|||
max_length=30, |
|||
), |
|||
), |
|||
] |
@ -0,0 +1,10 @@ |
|||
import { NuxtAppOptions } from '@nuxt/types' |
|||
import _ from 'lodash' |
|||
|
|||
export default _.debounce(async ({ app, route, redirect }: NuxtAppOptions) => { |
|||
const member = await app.$repositories.member.fetchMyRole(route.params.id) |
|||
|
|||
if (!member.isProjectAdmin) { |
|||
return redirect(app.localePath('/projects/' + route.params.id)) |
|||
} |
|||
}, 1000) |
@ -0,0 +1,13 @@ |
|||
import { NuxtAppOptions } from '@nuxt/types' |
|||
|
|||
export default async ({ app, route, redirect }: NuxtAppOptions) => { |
|||
const project = app.store.getters['projects/currentProject'] |
|||
const isNotSet = Object.keys(project).length === 0 && project.constructor === Object |
|||
if (isNotSet || project.id !== route.params.id) { |
|||
try { |
|||
await app.store.dispatch('projects/setCurrentProject', route.params.id) |
|||
} catch (e) { |
|||
redirect('/projects') |
|||
} |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save