From d5979ed2cf48489b235002b1343c35caa598f2c2 Mon Sep 17 00:00:00 2001 From: Caroline Desprat Date: Fri, 15 Nov 2024 17:55:30 +0000 Subject: [PATCH] feat: add action cell in tasks and add info on top of task list feat: add action cell in tasks and add info on top of task list --- components.d.ts | 5 +++ src/components/AppSidebar/AppSidebar.vue | 2 ++ src/components/Task/TaskList.vue | 34 +++++++----------- src/enums/taskNames.js | 35 +++++++++++-------- src/lang/en.json | 17 +++++---- .../BatchDownload/TaskBatchDownloadList.vue | 11 +++--- .../Task/BatchSearch/TaskBatchSearchList.vue | 7 ++-- .../Task/Documents/TaskDocumentsList.vue | 33 +++++++++++++++-- src/views/Task/Entities/TaskEntitiesList.vue | 15 ++++---- src/views/Task/Task.vue | 17 +++------ src/views/Task/TasksListSettings.vue | 8 +---- src/views/Task/task-header.js | 3 +- src/views/Task/task-properties.js | 15 +++++--- 13 files changed, 116 insertions(+), 86 deletions(-) diff --git a/components.d.ts b/components.d.ts index 3de9531097..be335e32e4 100644 --- a/components.d.ts +++ b/components.d.ts @@ -59,9 +59,11 @@ declare module 'vue' { BDropdown: typeof import('bootstrap-vue-next')['BDropdown'] BDropdownDivider: typeof import('bootstrap-vue-next')['BDropdownDivider'] BDropdownItem: typeof import('bootstrap-vue-next')['BDropdownItem'] + BDropdownItemButton: typeof import('bootstrap-vue-next')['BDropdownItemButton'] BForm: typeof import('bootstrap-vue-next')['BForm'] BFormCheckbox: typeof import('bootstrap-vue-next')['BFormCheckbox'] BFormCheckboxGroup: typeof import('bootstrap-vue-next')['BFormCheckboxGroup'] + BFormFile: typeof import('bootstrap-vue-next')['BFormFile'] BFormGroup: typeof import('bootstrap-vue-next')['BFormGroup'] BFormInput: typeof import('bootstrap-vue-next')['BFormInput'] BFormInvalidFeedback: typeof import('bootstrap-vue-next')['BFormInvalidFeedback'] @@ -119,6 +121,7 @@ declare module 'vue' { DisplayDatetimeRange: typeof import('./src/components/Display/DisplayDatetimeRange.vue')['default'] DisplayDatetimeShort: typeof import('./src/components/Display/DisplayDatetimeShort.vue')['default'] DisplayExtractionLevel: typeof import('./src/components/Display/DisplayExtractionLevel.vue')['default'] + DisplayHighlights: typeof import('./src/components/Display/DisplayHighlights.vue')['default'] DisplayLanguage: typeof import('./src/components/Display/DisplayLanguage.vue')['default'] DisplayNumber: typeof import('./src/components/Display/DisplayNumber.vue')['default'] DisplayNumberHuman: typeof import('./src/components/Display/DisplayNumberHuman.vue')['default'] @@ -168,6 +171,7 @@ declare module 'vue' { DocumentEntriesTable: typeof import('./src/components/Document/DocumentEntries/DocumentEntriesTable.vue')['default'] DocumentEntriesTableBody: typeof import('./src/components/Document/DocumentEntries/DocumentEntriesTableBody.vue')['default'] DocumentEntriesTableHead: typeof import('./src/components/Document/DocumentEntries/DocumentEntriesTableHead.vue')['default'] + DocumentFloating: typeof import('./src/components/Document/DocumentFloating.vue')['default'] DocumentGlobalSearchTerms: typeof import('./src/components/Document/DocumentGlobalSearchTerms/DocumentGlobalSearchTerms.vue')['default'] DocumentGlobalSearchTermsEntry: typeof import('./src/components/Document/DocumentGlobalSearchTerms/DocumentGlobalSearchTermsEntry.vue')['default'] DocumentInModal: typeof import('./src/components/DocumentInModal.vue')['default'] @@ -475,6 +479,7 @@ declare module 'vue' { } export interface ComponentCustomProperties { vBModal: typeof import('bootstrap-vue-next')['vBModal'] + vBToggle: typeof import('bootstrap-vue-next')['vBToggle'] vBTooltip: typeof import('bootstrap-vue-next')['vBTooltip'] } } diff --git a/src/components/AppSidebar/AppSidebar.vue b/src/components/AppSidebar/AppSidebar.vue index 6a98cef5ea..49ed21badf 100644 --- a/src/components/AppSidebar/AppSidebar.vue +++ b/src/components/AppSidebar/AppSidebar.vue @@ -147,6 +147,7 @@ const noAnalysis = computed(() => { icon="files" :to="{ name: 'task.documents.list' }" :action-to="{ name: 'task.documents.new' }" + :action-title="t('task.documents.new.title')" > {{ t('appSidebar.documents') }} @@ -155,6 +156,7 @@ const noAnalysis = computed(() => { icon="users-three" :to="{ name: 'task.entities.list' }" :action-to="{ name: 'task.entities.new' }" + :action-title="t('task.entities.new.title')" > {{ t('appSidebar.entities') }} diff --git a/src/components/Task/TaskList.vue b/src/components/Task/TaskList.vue index 7fbf7121d5..49bbc6d057 100644 --- a/src/components/Task/TaskList.vue +++ b/src/components/Task/TaskList.vue @@ -1,5 +1,5 @@ - --> @@ -87,6 +71,12 @@ import { sortBy } from 'lodash' import { computed } from 'vue' import { useStore } from 'vuex' +import { getHumanTaskName } from '@/enums/taskNames' +import DisplayDatetimeLong from '@/components/Display/DisplayDatetimeLong' +import DisplayProgress from '@/components/Display/DisplayProgress' +import DisplayStatus from '@/components/Display/DisplayStatus' +import PageTable from '@/components/PageTable/PageTable' + defineOptions({ name: 'TaskList' }) defineProps({ /** @@ -107,6 +97,8 @@ defineProps({ } }) const store = useStore() +const sort = defineModel('sort', { type: String, default: null }) +const order = defineModel('order', { type: String, default: 'desc' }) const sortedTasks = computed(() => { // Move running tasks on top const states = ['RUNNING'] diff --git a/src/enums/taskNames.js b/src/enums/taskNames.js index 0a084306db..a83508ed20 100644 --- a/src/enums/taskNames.js +++ b/src/enums/taskNames.js @@ -1,28 +1,35 @@ +import { startCase } from 'lodash' + const BATCH_SEARCH = 'BatchSearchRunner' const BATCH_DOWNLOAD = 'BatchDownloadRunner' const SCAN = 'ScanTask' const INDEX = 'IndexTask' const EXTRACT_NLP = 'ExtractNlpTask' -export const TASK_NAMES = Object.freeze({ +const ENQUEUE_FROM_INDEX = 'EnqueueFromIndexTask' +export const TASK_NAME = Object.freeze({ BATCH_SEARCH, BATCH_DOWNLOAD, SCAN, INDEX, - EXTRACT_NLP + EXTRACT_NLP, + ENQUEUE_FROM_INDEX +}) +export const HUMAN_TASK_NAME = Object.freeze({ + [BATCH_SEARCH]: 'Batch search', + [BATCH_DOWNLOAD]: 'Batch download', + [SCAN]: 'Scan', + [INDEX]: 'Index', + [EXTRACT_NLP]: 'Extract entities', + [ENQUEUE_FROM_INDEX]: 'Enqueue from index' }) -export const taskNameValidator = (v) => TASK_NAMES.includes(v) +export const TASK_NAME_LIST = Object.values(TASK_NAME) + +export const taskNameValidator = (v) => TASK_NAME_LIST.includes(v) export function getTaskName(longName) { - const taskName = longName.split('.').pop() - if (taskNameValidator(taskName)) { - return taskName - } - throw new Error(`Wrong task name ${longName}`) + return longName.split('.').pop() } - -export function getLongTaskName(shortName) { - if (taskNameValidator(shortName)) { - return `org.icij.datashare.tasks.${shortName}` - } - throw new Error(`Wrong task name ${shortName}`) +export function getHumanTaskName(longName) { + const taskName = getTaskName(longName) + return taskNameValidator(taskName) ? HUMAN_TASK_NAME[taskName] : startCase(taskName) } diff --git a/src/lang/en.json b/src/lang/en.json index 551df9ebcd..474d7b057d 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -900,9 +900,10 @@ "entities": { "title": "Entities", "list": { - "title":"All tasks", + "info":"Entity recognitions are tasks that you run in order to recognize and to list the entities in your documents.", "searchPlaceholder": "Search task", - "empty": "You have not yet started any tasks. Read more." + "empty": "You have not yet started any tasks. Read more.", + "noResults": "No search results. Try adjusting the query or filters." }, "new": { "title":"Find entities" @@ -940,9 +941,10 @@ "documents": { "title": "Documents", "list": { - "title":"All tasks", + "info": "Document additions are tasks that you run to ask Datashare to add new documents.", ",searchPlaceholder": "Search task", "searchPlaceholder": "Search task", - "empty": "You have not yet started any tasks. Read more." + "empty": "You have not yet started any tasks. Read more.", + "noResults": "No search results. Try adjusting the query or filters." }, "new": { "title":"Add documents" @@ -969,7 +971,7 @@ "batch-download": { "title": "Batch downloads", "list": { - "title":"All tasks", + "info": "Batch downloads are password-protected zip files containing all the documents from one of your specific search.", "searchPlaceholder": "Search task", "empty": "You have not yet started any tasks. Read more." } @@ -977,9 +979,10 @@ "batch-search": { "title": "Batch searches", "list": { - "title":"All tasks", + "info": "Batch searches allow to get the results of each query of a list, but all at once.", "searchPlaceholder": "Search task", - "empty": "You have not yet started any tasks. Read more." + "empty": "You have not yet started any tasks. Read more.", + "noResults": "No search results. Try adjusting the query or filters." }, "new": { "title":"Run a new batch search" diff --git a/src/views/Task/BatchDownload/TaskBatchDownloadList.vue b/src/views/Task/BatchDownload/TaskBatchDownloadList.vue index 5254486d37..2c98a72b05 100644 --- a/src/views/Task/BatchDownload/TaskBatchDownloadList.vue +++ b/src/views/Task/BatchDownload/TaskBatchDownloadList.vue @@ -4,14 +4,13 @@ import TaskList from '@/components/Task/TaskList' import DisplayStatus from '@/components/Display/DisplayStatus' import DisplayDatetimeFromNow from '@/components/Display/DisplayDatetimeFromNow' import DisplayProgress from '@/components/Display/DisplayProgress' +import { useTaskProperties } from '@/views/Task/task-properties' +const settingName = 'task' +const { propertiesModelValueOptions } = useTaskProperties(settingName)