@live-change/task-frontend 0.8.120 → 0.8.122
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/front/src/ShelterProgress.vue +1 -0
- package/front/src/components/Task.vue +35 -20
- package/front/src/components/TaskModal.vue +100 -0
- package/index.js +2 -1
- package/package.json +38 -38
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import { usePath, live } from '@live-change/vue3-ssr'
|
|
15
15
|
import BuildShelterResult from './components/BuildShelterResult.vue'
|
|
16
16
|
import MakePlanksResult from './components/MakePlanksResult.vue'
|
|
17
|
+
import Task from './components/Task.vue'
|
|
17
18
|
|
|
18
19
|
const props = defineProps({
|
|
19
20
|
action: {
|
|
@@ -6,23 +6,23 @@
|
|
|
6
6
|
<div :class="['ml-2']">{{ label }}</div>
|
|
7
7
|
</div>
|
|
8
8
|
<div v-if="task?.progress && task?.state !== 'done'" class="w-8rem mr-3 flex-grow-1" style="max-width: 50vw">
|
|
9
|
-
<ProgressBar :value="Math.floor((100 *
|
|
9
|
+
<ProgressBar :value="Math.floor((100 * taskData.progress.current / taskData.progress.total))" />
|
|
10
10
|
</div>
|
|
11
|
-
<div v-if="task?.retries?.length &&
|
|
11
|
+
<div v-if="task?.retries?.length && taskData.retries.length < taskData.maxRetries" class="mr-3">
|
|
12
12
|
<i class="pi pi-replay" />
|
|
13
|
-
{{
|
|
13
|
+
{{ taskData.retries.length }} / {{ taskData.maxRetries }}
|
|
14
14
|
</div>
|
|
15
15
|
<div>{{ task?.state !== 'done' ? (task?.progress?.action || task?.state) : 'done' }}</div>
|
|
16
16
|
</div>
|
|
17
17
|
<div v-for="retry in task?.retries" class="ml-4 flex flex-row justify-content-between text-red-800">
|
|
18
18
|
{{ retry.error }} at {{ d(retry.failedAt, 'shortestTime')}}
|
|
19
19
|
</div>
|
|
20
|
-
<!-- <pre>{{
|
|
21
|
-
<div v-if="taskResultComponent &&
|
|
22
|
-
<component :is="taskResultComponent" :task="task" :result="
|
|
20
|
+
<!-- <pre>{{ taskData.progress }}</pre>-->
|
|
21
|
+
<div v-if="taskResultComponent && taskData.result" class="m-2">
|
|
22
|
+
<component :is="taskResultComponent" :task="task" :result="taskData.result" :taskType="taskType" />
|
|
23
23
|
</div>
|
|
24
24
|
<div class="ml-4">
|
|
25
|
-
<Task v-for="task in childTasks" :key="
|
|
25
|
+
<Task v-for="task in childTasks" :key="taskData.id" :task="task" :tasks="allTasks" :taskTypes="taskTypes" />
|
|
26
26
|
</div>
|
|
27
27
|
</div>
|
|
28
28
|
</template>
|
|
@@ -30,14 +30,12 @@
|
|
|
30
30
|
|
|
31
31
|
<script setup>
|
|
32
32
|
|
|
33
|
-
import
|
|
33
|
+
import ProgressBar from "primevue/progressbar"
|
|
34
34
|
|
|
35
|
-
import {
|
|
36
|
-
const toast = useToast()
|
|
37
|
-
import { useConfirm } from 'primevue/useconfirm'
|
|
38
|
-
const confirm = useConfirm()
|
|
35
|
+
import { ref, onMounted, defineProps, toRefs, computed } from "vue"
|
|
39
36
|
|
|
40
37
|
import { useActions, usePath, live } from '@live-change/vue3-ssr'
|
|
38
|
+
const path = usePath()
|
|
41
39
|
const actions = useActions()
|
|
42
40
|
|
|
43
41
|
import { useI18n } from 'vue-i18n'
|
|
@@ -50,7 +48,7 @@
|
|
|
50
48
|
},
|
|
51
49
|
tasks: {
|
|
52
50
|
type: Array,
|
|
53
|
-
|
|
51
|
+
default: undefined
|
|
54
52
|
},
|
|
55
53
|
taskTypes: {
|
|
56
54
|
type: Object,
|
|
@@ -59,25 +57,41 @@
|
|
|
59
57
|
})
|
|
60
58
|
const { task, tasks, taskTypes } = toRefs(props)
|
|
61
59
|
|
|
62
|
-
const taskId = computed(() => task.value
|
|
63
|
-
|
|
60
|
+
const taskId = computed(() => task.value?.to || task.value?.id || task.value)
|
|
61
|
+
|
|
62
|
+
const loadedTasksPath = computed(() => tasks.value ? null : (taskId.value ? path.task.tasksByRoot({
|
|
63
|
+
root: taskId.value,
|
|
64
|
+
rootType: 'task_Task'
|
|
65
|
+
}) : null))
|
|
66
|
+
|
|
67
|
+
const [ loadedTasks ] = await Promise.all([
|
|
68
|
+
live(loadedTasksPath)
|
|
69
|
+
])
|
|
70
|
+
|
|
71
|
+
const allTasks = computed(() => tasks.value || loadedTasks.value)
|
|
72
|
+
|
|
73
|
+
const taskData = computed(() => allTasks.value && allTasks.value.find(m => (m.to ?? m.id) === taskId.value))
|
|
74
|
+
|
|
75
|
+
const taskType = computed(() => taskTypes.value[taskData.value?.type || taskData.value?.name] || {})
|
|
64
76
|
|
|
65
77
|
const taskResultComponent = computed(() => taskType.value.resultComponent)
|
|
66
78
|
|
|
67
79
|
const label = computed(() => {
|
|
68
80
|
if(taskType.value.label) {
|
|
69
|
-
if(typeof taskType.value.label == 'function') return taskType.value.label(
|
|
81
|
+
if(typeof taskType.value.label == 'function') return taskType.value.label(taskData.value)
|
|
70
82
|
return taskType.value.label
|
|
71
83
|
}
|
|
72
|
-
return
|
|
84
|
+
return taskData.value?.name || taskData.value?.type
|
|
73
85
|
})
|
|
74
86
|
|
|
75
87
|
const childTasks = computed(
|
|
76
|
-
() =>
|
|
88
|
+
() => allTasks.value
|
|
89
|
+
? allTasks.value.filter(m => m.causeType === "task_Task" && m.cause === taskId.value)
|
|
90
|
+
: []
|
|
77
91
|
)
|
|
78
92
|
|
|
79
93
|
const icon = computed(() => {
|
|
80
|
-
switch(
|
|
94
|
+
switch(taskData.value?.state) {
|
|
81
95
|
case 'created': return 'pi-sparkles'
|
|
82
96
|
case 'waiting': return 'pi-hourglass pi-spin'
|
|
83
97
|
case 'running': return 'pi-play'
|
|
@@ -90,7 +104,8 @@
|
|
|
90
104
|
})
|
|
91
105
|
|
|
92
106
|
const taskColor = computed(() => {
|
|
93
|
-
|
|
107
|
+
console.log("TD", taskData.value, "AT", allTasks.value)
|
|
108
|
+
switch(taskData.value?.state) {
|
|
94
109
|
case 'failed': return 'text-red-600'
|
|
95
110
|
default: {}
|
|
96
111
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Dialog v-model:visible="visible" modal>
|
|
3
|
+
<template #container="{ closeCallback }">
|
|
4
|
+
<div class="surface-card border-round shadow-3 p-3 overflow-y-auto" style="max-height: 70vh">
|
|
5
|
+
|
|
6
|
+
<div class="text-xl mb-2">
|
|
7
|
+
Task <strong>{{ taskData?.name }}</strong> {{ taskData?.state }}
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<div class="my-3">
|
|
11
|
+
<Button icon="pi pi-times" label="Close" class="w-full" @click="close" />
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<Task :task="taskData" :tasks="allTasks" :taskTypes="taskTypes" />
|
|
15
|
+
|
|
16
|
+
<pre>{{ taskData }}</pre>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
</Dialog>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup>
|
|
23
|
+
|
|
24
|
+
import Task from './Task.vue'
|
|
25
|
+
import Button from "primevue/button";
|
|
26
|
+
|
|
27
|
+
import { ref, onMounted, defineProps, defineModel, toRefs, computed, watchEffect } from "vue"
|
|
28
|
+
|
|
29
|
+
import { useToast } from 'primevue/usetoast'
|
|
30
|
+
const toast = useToast()
|
|
31
|
+
import { useConfirm } from 'primevue/useconfirm'
|
|
32
|
+
const confirm = useConfirm()
|
|
33
|
+
|
|
34
|
+
import { useActions, usePath, live } from '@live-change/vue3-ssr'
|
|
35
|
+
const path = usePath()
|
|
36
|
+
const actions = useActions()
|
|
37
|
+
|
|
38
|
+
import { useI18n } from 'vue-i18n'
|
|
39
|
+
const { t, tm, rt, n, d } = useI18n()
|
|
40
|
+
|
|
41
|
+
const props = defineProps({
|
|
42
|
+
task: {
|
|
43
|
+
type: Object,
|
|
44
|
+
required: true
|
|
45
|
+
},
|
|
46
|
+
tasks: {
|
|
47
|
+
type: Array,
|
|
48
|
+
default: undefined
|
|
49
|
+
},
|
|
50
|
+
taskTypes: {
|
|
51
|
+
type: Object,
|
|
52
|
+
default: () => ({})
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
const { task, tasks, taskTypes } = toRefs(props)
|
|
56
|
+
|
|
57
|
+
const taskId = computed(() => task.value?.to || task.value?.id || task.value)
|
|
58
|
+
|
|
59
|
+
const loadedTasksPath = computed(() => tasks.value ? null : (taskId.value ? path.task.tasksByRoot({
|
|
60
|
+
root: taskId.value,
|
|
61
|
+
rootType: 'task_Task'
|
|
62
|
+
}) : null))
|
|
63
|
+
|
|
64
|
+
const [ loadedTasks ] = await Promise.all([
|
|
65
|
+
live(loadedTasksPath)
|
|
66
|
+
])
|
|
67
|
+
|
|
68
|
+
const allTasks = computed(() => tasks.value || loadedTasks.value)
|
|
69
|
+
|
|
70
|
+
const taskData = computed(() => allTasks.value && allTasks.value.find(m => (m.to ?? m.id) === taskId.value))
|
|
71
|
+
|
|
72
|
+
const visible = defineModel('visible', {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: false
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
const closeable = computed(() => taskData.value?.state === 'failed' || taskData.value?.state === 'done')
|
|
79
|
+
|
|
80
|
+
function close() {
|
|
81
|
+
visible.value = false
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
watchEffect(() => {
|
|
85
|
+
if(!visible.value) return
|
|
86
|
+
if(taskData.value?.state === 'failed') {
|
|
87
|
+
toast.add({ severity: 'error', summary: 'Task failed', detail: taskData.value?.error })
|
|
88
|
+
}
|
|
89
|
+
if(taskData.value?.state === 'done') {
|
|
90
|
+
toast.add({ severity: 'success', summary: 'Task done', life: 1500 })
|
|
91
|
+
close()
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
</script>
|
|
97
|
+
|
|
98
|
+
<style scoped>
|
|
99
|
+
|
|
100
|
+
</style>
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/task-frontend",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.122",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"memDev": "node server/start.js memDev --enableSessions --initScript ./init.js --dbAccess",
|
|
6
6
|
"localDevInit": "rm tmp.db; node server/start.js localDev --enableSessions --initScript ./init.js",
|
|
@@ -35,41 +35,41 @@
|
|
|
35
35
|
"@codemirror/language": "6.10.1",
|
|
36
36
|
"@dotenvx/dotenvx": "0.27.0",
|
|
37
37
|
"@fortawesome/fontawesome-free": "^6.5.2",
|
|
38
|
-
"@live-change/access-control-frontend": "^0.8.
|
|
39
|
-
"@live-change/access-control-service": "^0.8.
|
|
40
|
-
"@live-change/backup-service": "^0.8.
|
|
41
|
-
"@live-change/blog-frontend": "^0.8.
|
|
42
|
-
"@live-change/blog-service": "^0.8.
|
|
43
|
-
"@live-change/cli": "^0.8.
|
|
44
|
-
"@live-change/content-frontend": "^0.8.
|
|
45
|
-
"@live-change/content-service": "^0.8.
|
|
46
|
-
"@live-change/dao": "^0.8.
|
|
47
|
-
"@live-change/dao-vue3": "^0.8.
|
|
48
|
-
"@live-change/dao-websocket": "^0.8.
|
|
49
|
-
"@live-change/db-client": "^0.8.
|
|
50
|
-
"@live-change/email-service": "^0.8.
|
|
51
|
-
"@live-change/framework": "^0.8.
|
|
52
|
-
"@live-change/frontend-auto-form": "^0.8.
|
|
53
|
-
"@live-change/frontend-base": "^0.8.
|
|
54
|
-
"@live-change/geoip-service": "^0.8.
|
|
55
|
-
"@live-change/image-frontend": "^0.8.
|
|
56
|
-
"@live-change/locale-settings-service": "^0.8.
|
|
57
|
-
"@live-change/password-authentication-service": "^0.8.
|
|
58
|
-
"@live-change/prosemirror-service": "^0.8.
|
|
59
|
-
"@live-change/secret-code-service": "^0.8.
|
|
60
|
-
"@live-change/secret-link-service": "^0.8.
|
|
61
|
-
"@live-change/session-service": "^0.8.
|
|
62
|
-
"@live-change/task-service": "^0.8.
|
|
63
|
-
"@live-change/upload-frontend": "^0.8.
|
|
64
|
-
"@live-change/url-frontend": "^0.8.
|
|
65
|
-
"@live-change/url-service": "^0.8.
|
|
66
|
-
"@live-change/user-frontend": "^0.8.
|
|
67
|
-
"@live-change/user-identification-service": "^0.8.
|
|
68
|
-
"@live-change/user-service": "^0.8.
|
|
69
|
-
"@live-change/vote-service": "^0.8.
|
|
70
|
-
"@live-change/vue3-components": "^0.8.
|
|
71
|
-
"@live-change/vue3-ssr": "^0.8.
|
|
72
|
-
"@live-change/wysiwyg-frontend": "^0.8.
|
|
38
|
+
"@live-change/access-control-frontend": "^0.8.122",
|
|
39
|
+
"@live-change/access-control-service": "^0.8.122",
|
|
40
|
+
"@live-change/backup-service": "^0.8.122",
|
|
41
|
+
"@live-change/blog-frontend": "^0.8.122",
|
|
42
|
+
"@live-change/blog-service": "^0.8.122",
|
|
43
|
+
"@live-change/cli": "^0.8.122",
|
|
44
|
+
"@live-change/content-frontend": "^0.8.122",
|
|
45
|
+
"@live-change/content-service": "^0.8.122",
|
|
46
|
+
"@live-change/dao": "^0.8.122",
|
|
47
|
+
"@live-change/dao-vue3": "^0.8.122",
|
|
48
|
+
"@live-change/dao-websocket": "^0.8.122",
|
|
49
|
+
"@live-change/db-client": "^0.8.122",
|
|
50
|
+
"@live-change/email-service": "^0.8.122",
|
|
51
|
+
"@live-change/framework": "^0.8.122",
|
|
52
|
+
"@live-change/frontend-auto-form": "^0.8.122",
|
|
53
|
+
"@live-change/frontend-base": "^0.8.122",
|
|
54
|
+
"@live-change/geoip-service": "^0.8.122",
|
|
55
|
+
"@live-change/image-frontend": "^0.8.122",
|
|
56
|
+
"@live-change/locale-settings-service": "^0.8.122",
|
|
57
|
+
"@live-change/password-authentication-service": "^0.8.122",
|
|
58
|
+
"@live-change/prosemirror-service": "^0.8.122",
|
|
59
|
+
"@live-change/secret-code-service": "^0.8.122",
|
|
60
|
+
"@live-change/secret-link-service": "^0.8.122",
|
|
61
|
+
"@live-change/session-service": "^0.8.122",
|
|
62
|
+
"@live-change/task-service": "^0.8.122",
|
|
63
|
+
"@live-change/upload-frontend": "^0.8.122",
|
|
64
|
+
"@live-change/url-frontend": "^0.8.122",
|
|
65
|
+
"@live-change/url-service": "^0.8.122",
|
|
66
|
+
"@live-change/user-frontend": "^0.8.122",
|
|
67
|
+
"@live-change/user-identification-service": "^0.8.122",
|
|
68
|
+
"@live-change/user-service": "^0.8.122",
|
|
69
|
+
"@live-change/vote-service": "^0.8.122",
|
|
70
|
+
"@live-change/vue3-components": "^0.8.122",
|
|
71
|
+
"@live-change/vue3-ssr": "^0.8.122",
|
|
72
|
+
"@live-change/wysiwyg-frontend": "^0.8.122",
|
|
73
73
|
"@vueuse/core": "^10.11.0",
|
|
74
74
|
"codeceptjs-assert": "^0.0.5",
|
|
75
75
|
"compression": "^1.7.4",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"vue3-scroll-border": "0.1.6"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
|
-
"@live-change/codeceptjs-helper": "^0.8.
|
|
94
|
+
"@live-change/codeceptjs-helper": "^0.8.122",
|
|
95
95
|
"codeceptjs": "^3.6.5",
|
|
96
96
|
"generate-password": "1.7.1",
|
|
97
97
|
"playwright": "^1.41.2",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"author": "Michał Łaszczewski <michal@laszczewski.pl>",
|
|
103
103
|
"license": "ISC",
|
|
104
104
|
"description": "",
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "3d1935bdc16579c96f009d49f1e9aa70a7697c71"
|
|
106
106
|
}
|