Add luma pagination (#187)

This commit is contained in:
HCode authored and GitHub committed 2025-02-22 14:47:23 +00:00
1 parent f701ae05b1
commit f837700d02
9 files changed
+105 -29

No files matched your search

+12 -2
View File
@@ -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>
+1 -1
View File
@@ -10,7 +10,7 @@
type="textarea"
class="prompt"
:placeholder="$t('luma.placeholder.prompt')"
:maxlength="300"
:maxlength="2000"
show-word-limit
/>
</div>
+6 -9
View File
@@ -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>