Browse Source

Enable to reset assignment

pull/2261/head
Hironsan 1 year ago
parent
commit
277ee7bdef
5 changed files with 45 additions and 3 deletions
  1. 8
      frontend/components/example/ActionMenu.vue
  2. 1
      frontend/components/example/FormAssignment.vue
  3. 19
      frontend/components/example/FormResetAssignment.vue
  4. 15
      frontend/pages/projects/_id/dataset/index.vue
  5. 5
      frontend/repositories/example/apiAssignmentRepository.ts

8
frontend/components/example/ActionMenu.vue

@ -6,12 +6,13 @@
@upload="$emit('upload')" @upload="$emit('upload')"
@download="$emit('download')" @download="$emit('download')"
@assign="$emit('assign')" @assign="$emit('assign')"
@reset="$emit('reset')"
/> />
</template> </template>
<script lang="ts"> <script lang="ts">
import Vue from 'vue' import Vue from 'vue'
import { mdiAccountCheck, mdiUpload, mdiDownload } from '@mdi/js'
import { mdiAccountCheck, mdiUpload, mdiDownload, mdiUpdate } from '@mdi/js'
import ActionMenu from '~/components/utils/ActionMenu.vue' import ActionMenu from '~/components/utils/ActionMenu.vue'
export default Vue.extend({ export default Vue.extend({
@ -36,6 +37,11 @@ export default Vue.extend({
title: 'Assign to member', title: 'Assign to member',
icon: mdiAccountCheck, icon: mdiAccountCheck,
event: 'assign' event: 'assign'
},
{
title: 'Reset Assignment',
icon: mdiUpdate,
event: 'reset'
} }
] ]
} }

1
frontend/components/example/FormAssignment.vue

@ -117,7 +117,6 @@ export default Vue.extend({
weight, weight,
member_id: this.members[i].id member_id: this.members[i].id
})) }))
console.log(workloads)
this.$repositories.assignment.bulkAssign(this.projectId, { this.$repositories.assignment.bulkAssign(this.projectId, {
strategy_name: this.selectedStrategy, strategy_name: this.selectedStrategy,
workloads workloads

19
frontend/components/example/FormResetAssignment.vue

@ -0,0 +1,19 @@
<template>
<confirm-form
title="Reset assignment"
message="Are you sure you want to reset all the assignments?"
@ok="$emit('reset')"
@cancel="$emit('cancel')"
/>
</template>
<script lang="ts">
import Vue from 'vue'
import ConfirmForm from '@/components/utils/ConfirmForm.vue'
export default Vue.extend({
components: {
ConfirmForm
}
})
</script>

15
frontend/pages/projects/_id/dataset/index.vue

@ -5,6 +5,7 @@
@upload="$router.push('dataset/import')" @upload="$router.push('dataset/import')"
@download="$router.push('dataset/export')" @download="$router.push('dataset/export')"
@assign="dialogAssignment = true" @assign="dialogAssignment = true"
@reset="dialogReset = true"
/> />
<v-btn <v-btn
class="text-capitalize ms-2" class="text-capitalize ms-2"
@ -37,6 +38,9 @@
<v-dialog v-model="dialogAssignment"> <v-dialog v-model="dialogAssignment">
<form-assignment @assigned="assigned" @cancel="dialogAssignment = false" /> <form-assignment @assigned="assigned" @cancel="dialogAssignment = false" />
</v-dialog> </v-dialog>
<v-dialog v-model="dialogReset">
<form-reset-assignment @cancel="dialogReset = false" @reset="resetAssignment" />
</v-dialog>
</v-card-title> </v-card-title>
<image-list <image-list
v-if="project.isImageProject" v-if="project.isImageProject"
@ -90,6 +94,7 @@ import DocumentList from '@/components/example/DocumentList.vue'
import FormAssignment from '~/components/example/FormAssignment.vue' import FormAssignment from '~/components/example/FormAssignment.vue'
import FormDelete from '@/components/example/FormDelete.vue' import FormDelete from '@/components/example/FormDelete.vue'
import FormDeleteBulk from '@/components/example/FormDeleteBulk.vue' import FormDeleteBulk from '@/components/example/FormDeleteBulk.vue'
import FormResetAssignment from '~/components/example/FormResetAssignment.vue'
import ActionMenu from '~/components/example/ActionMenu.vue' import ActionMenu from '~/components/example/ActionMenu.vue'
import AudioList from '~/components/example/AudioList.vue' import AudioList from '~/components/example/AudioList.vue'
import ImageList from '~/components/example/ImageList.vue' import ImageList from '~/components/example/ImageList.vue'
@ -105,7 +110,8 @@ export default Vue.extend({
ImageList, ImageList,
FormAssignment, FormAssignment,
FormDelete, FormDelete,
FormDeleteBulk
FormDeleteBulk,
FormResetAssignment
}, },
layout: 'project', layout: 'project',
@ -121,6 +127,7 @@ export default Vue.extend({
dialogDelete: false, dialogDelete: false,
dialogDeleteAll: false, dialogDeleteAll: false,
dialogAssignment: false, dialogAssignment: false,
dialogReset: false,
item: {} as ExampleListDTO, item: {} as ExampleListDTO,
selected: [] as ExampleDTO[], selected: [] as ExampleDTO[],
members: [] as MemberItem[], members: [] as MemberItem[],
@ -216,6 +223,12 @@ export default Vue.extend({
async assigned() { async assigned() {
this.dialogAssignment = false this.dialogAssignment = false
this.item = await this.$services.example.list(this.projectId, this.$route.query) this.item = await this.$services.example.list(this.projectId, this.$route.query)
},
async resetAssignment() {
this.dialogReset = false
await this.$repositories.assignment.reset(this.projectId)
this.item = await this.$services.example.list(this.projectId, this.$route.query)
} }
} }
}) })

5
frontend/repositories/example/apiAssignmentRepository.ts

@ -20,4 +20,9 @@ export class APIAssignmentRepository {
const url = `/projects/${projectId}/assignments/bulk_assign` const url = `/projects/${projectId}/assignments/bulk_assign`
await this.request.post(url, workloadAllocation) await this.request.post(url, workloadAllocation)
} }
async reset(projectId: string): Promise<void> {
const url = `/projects/${projectId}/assignments/reset`
await this.request.delete(url)
}
} }
Loading…
Cancel
Save