-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
13 changed files
with
116 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,49 @@ | ||
<script setup> | ||
import { useStore } from 'vuex' | ||
import Task from '@/views/Task/Task' | ||
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' | ||
import { getHumanTaskName } from '@/enums/taskNames' | ||
import ButtonIcon from '@/components/Button/ButtonIcon' | ||
const settingName = 'task' | ||
const { propertiesModelValueOptions } = useTaskProperties(settingName) | ||
const store = useStore() | ||
async function stopTask(name) { | ||
await store.dispatch('indexing/stopTask', name) | ||
await store.dispatch('indexing/getTasks') | ||
} | ||
</script> | ||
<template> | ||
<task | ||
v-slot="{ tasks, columns }" | ||
v-slot="{ tasks, sortBy }" | ||
:task-filter="['org.icij.datashare.tasks.EnqueueFromIndexTask', 'org.icij.datashare.tasks.ScanTask']" | ||
page-name="documents" | ||
show-add | ||
> | ||
<task-list :tasks="tasks" :columns="columns" :stoppable="true"> | ||
<task-list | ||
v-model:sort="sortBy.modelValue[0]" | ||
v-model:order="sortBy.modelValue[1]" | ||
:tasks="tasks" | ||
:columns="propertiesModelValueOptions" | ||
> | ||
<template #cell(state)="{ item }"><display-status :value="item.state" /></template> | ||
<template #cell(createdAt)="{ item }"><display-datetime-from-now :value="item.createdAt" /></template> | ||
<template #cell(progress)="{ item }"><display-progress :value="item.progress" /></template> | ||
<template #cell(name)="{ item }">{{ item.name }}</template> | ||
<template #cell(name)="{ item }">{{ getHumanTaskName(item.name) }}</template> | ||
<template #cell(action)="{ item }"> | ||
<button-icon | ||
variant="outline-secondary" | ||
square | ||
hide-label | ||
size="sm" | ||
icon-left="trash" | ||
class="border-0" | ||
@click="stopTask(item.id)" | ||
/></template> | ||
</task-list> | ||
</task> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
<script setup> | ||
import { getHumanTaskName } from '@/enums/taskNames' | ||
import Task from '@/views/Task/Task' | ||
import TaskList from '@/components/Task/TaskList' | ||
import DisplayStatus from '@/components/Display/DisplayStatus' | ||
import DisplayProgress from '@/components/Display/DisplayProgress' | ||
import DisplayDatetimeLong from '@/components/Display/DisplayDatetimeLong' | ||
import { useTaskProperties } from '@/views/Task/task-properties' | ||
const settingName = 'task' | ||
const { propertiesModelValueOptions } = useTaskProperties(settingName) | ||
</script> | ||
<template> | ||
<task | ||
v-slot="{ tasks, columns }" | ||
:task-filter="['org.icij.datashare.tasks.ExtractNlpTask']" | ||
page-name="entities" | ||
show-add | ||
> | ||
<task-list :tasks="tasks" :columns="columns" :stoppable="true"> | ||
<task v-slot="{ tasks }" :task-filter="['org.icij.datashare.tasks.ExtractNlpTask']" page-name="entities" show-add> | ||
<task-list :tasks="tasks" :columns="propertiesModelValueOptions" :stoppable="true"> | ||
<template #cell(state)="{ item }"><display-status :value="item.state" /></template> | ||
<template #cell(createdAt)="{ item }"><display-datetime-long :value="item.createdAt" /></template> | ||
<template #cell(progress)="{ item }"><display-progress :value="item.progress" /></template> | ||
<template #cell(name)="{ item }">{{ item.name }}</template> | ||
<template #cell(name)="{ item }">{{ getHumanTaskName(item.name) }}</template> | ||
</task-list> | ||
</task> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.