Add luma pagination (#187)
This commit is contained in:
1 parent
f701ae05b1
commit
f837700d02
9 files changed
+105
-29
No files matched your search
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="panel recent">
|
||||
<div ref="panel" class="panel recent" @scroll="onHandleScroll">
|
||||
<div v-if="tasks?.items === undefined" class="tasks">
|
||||
<div v-for="_ in 3" :key="_" class="task placeholder">
|
||||
<div class="left">
|
||||
@@ -40,6 +40,7 @@ export default defineComponent({
|
||||
ElSkeleton,
|
||||
ElSkeletonItem
|
||||
},
|
||||
emits: ['reach-top'],
|
||||
data() {
|
||||
return {
|
||||
job: 0
|
||||
@@ -50,9 +51,18 @@ export default defineComponent({
|
||||
// reverse the order of the tasks.items
|
||||
return {
|
||||
...this.$store.state.luma?.tasks,
|
||||
items: this.$store.state.luma?.tasks?.items?.slice().reverse()
|
||||
items: this.$store.state.luma?.tasks?.items?.slice()
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onHandleScroll() {
|
||||
const el = this.$refs.panel as HTMLElement;
|
||||
console.log('reach-top reach-top reach-top');
|
||||
if (el.scrollTop === 0) {
|
||||
this.$emit('reach-top');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
type="textarea"
|
||||
class="prompt"
|
||||
:placeholder="$t('luma.placeholder.prompt')"
|
||||
:maxlength="300"
|
||||
:maxlength="2000"
|
||||
show-word-limit
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -14,13 +14,7 @@
|
||||
<p v-if="modelValue?.request?.prompt" class="prompt mt-2">
|
||||
{{ modelValue?.request?.prompt }}
|
||||
<span v-if="!modelValue?.response"> - ({{ $t('luma.status.pending') }}) </span>
|
||||
<span
|
||||
v-if="
|
||||
modelValue?.response?.data?.state === 'processing' ||
|
||||
modelValue?.response?.data?.state === 'pending' ||
|
||||
modelValue?.response?.data?.state === 'completed'
|
||||
"
|
||||
>
|
||||
<span v-if="modelValue?.response?.state === 'processing' || modelValue?.response?.state === 'pending'">
|
||||
- ({{ $t('luma.status.processing') }})
|
||||
</span>
|
||||
</p>
|
||||
@@ -57,7 +51,10 @@
|
||||
</el-alert>
|
||||
</div>
|
||||
<!-- Display error message -->
|
||||
<div v-if="modelValue?.response?.success === false" :class="{ content: true }">
|
||||
<div
|
||||
v-if="modelValue?.response?.state === 'failed' || modelValue?.response?.success === false"
|
||||
:class="{ content: true }"
|
||||
>
|
||||
<el-alert :closable="false" class="failure">
|
||||
<template #template>
|
||||
<font-awesome-icon icon="fa-solid fa-exclamation-triangle" class="mr-1" />
|
||||
@@ -78,7 +75,7 @@
|
||||
<p class="description">
|
||||
<font-awesome-icon icon="fa-solid fa-hashtag" class="mr-1" />
|
||||
{{ $t('luma.name.traceId') }}:
|
||||
{{ modelValue?.response?.trace_id }}
|
||||
{{ modelValue?.trace_id }}
|
||||
<copy-to-clipboard :content="modelValue?.response?.trace_id" class="btn-copy" />
|
||||
</p>
|
||||
</el-alert>
|
||||
|
||||
Reference in new issue
Block a user