Fix layout init issue (#245)

This commit is contained in:
Germey authored and GitHub committed 2025-08-04 01:51:18 +08:00
1 parent 901d39a502
commit bc19c78444
12 files changed
+170 -132

No files matched your search

@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix layout init issue",
"packageName": "@acedatacloud/nexior",
"email": "cqc@cuiqingcai.com",
"dependentChangeType": "patch"
}
+13 -5
View File
@@ -17,7 +17,7 @@
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { computed, defineComponent } from 'vue';
import Navigator from '@/components/common/Navigator.vue';
import ApplicationStatus from '@/components/application/Status.vue';
import { IApplicationScope, IApplicationType, Status } from '@/models';
@@ -35,8 +35,14 @@ export default defineComponent({
ApplicationStatus,
ApplicationConfirm
},
provide() {
return {
initialized: computed(() => this.initialized)
};
},
data() {
return {
initialized: false,
applying: false,
mobile: window.innerWidth < 768
};
@@ -66,19 +72,20 @@ export default defineComponent({
},
watch: {
appName() {
this.onInitialize();
this.initialize();
}
},
mounted() {
// Fetch applications when the component is mounted
this.onInitialize();
this.initialize();
// Update mobile state on resize
window.addEventListener('resize', () => {
this.mobile = window.innerWidth < 768;
});
},
methods: {
async onInitialize() {
async initialize() {
this.initialized = false;
console.debug('Fetching all individual and global applications for', this.appName);
Promise.all([
this.$store.dispatch('getApplications'),
@@ -99,6 +106,7 @@ export default defineComponent({
console.debug('set final application', finalApplication, finalApplication?.type);
this.$store.dispatch(`${this.appName}/setApplication`, finalApplication);
}
this.initialized = true;
});
},
onApply() {
@@ -111,7 +119,7 @@ export default defineComponent({
})
.then(() => {
ElMessage.success(this.$t('application.message.applySuccessfully'));
this.onInitialize();
this.initialize();
this.applying = false;
})
.catch((error) => {
+15 -13
View File
@@ -25,7 +25,6 @@ const CALLBACK_URL = 'https://webhook.acedata.cloud/flux';
interface IData {
task: IFluxTask | undefined;
job: number;
timer: any;
}
export default defineComponent({
@@ -35,12 +34,11 @@ export default defineComponent({
Layout,
RecentPanel
},
inject: ['initialized'],
data(): IData {
return {
task: undefined,
job: 0,
// @ts-ignore
timer: undefined
job: 0
};
},
computed: {
@@ -70,22 +68,26 @@ export default defineComponent({
}
},
deep: true
},
initialized: {
async handler(newValue) {
if (newValue) {
console.debug('layout initialized');
await this.onGetTasks();
await this.onScrollDown();
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
}
},
immediate: true
}
},
async mounted() {
await this.onGetService();
await this.onGetApplication();
await this.onScrollDown();
await this.onGetTasks();
await this.onScrollDown();
// @ts-ignore
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
},
async unmounted() {
clearInterval(this.job);
clearInterval(this.timer);
},
methods: {
async onReachTop() {
+14 -10
View File
@@ -25,7 +25,6 @@ const CALLBACK_URL = 'https://webhook.acedata.cloud/hailuo';
interface IData {
task: IHailuoTask | undefined;
job: number;
timer: any;
}
export default defineComponent({
@@ -35,6 +34,7 @@ export default defineComponent({
Layout,
RecentPanel
},
inject: ['initialized'],
data(): IData {
return {
task: undefined,
@@ -70,22 +70,26 @@ export default defineComponent({
}
},
deep: true
},
initialized: {
async handler(newValue) {
if (newValue) {
console.debug('layout initialized');
await this.onGetTasks();
await this.onScrollDown();
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
}
},
immediate: true
}
},
async mounted() {
await this.onGetService();
await this.onGetApplication();
await this.onScrollDown();
await this.onGetTasks();
await this.onScrollDown();
// @ts-ignore
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
},
async unmounted() {
clearInterval(this.job);
clearInterval(this.timer);
},
methods: {
async onReachTop() {
+15 -13
View File
@@ -37,7 +37,6 @@ const CALLBACK_URL = 'https://webhook.acedata.cloud/headshots';
interface IData {
task: IHeadshotsTask | undefined;
job: number;
timer: any;
}
export default defineComponent({
@@ -48,12 +47,11 @@ export default defineComponent({
ApplicationStatus,
RecentPanel
},
inject: ['initialized'],
data(): IData {
return {
task: undefined,
job: 0,
// @ts-ignore
timer: undefined
job: 0
};
},
computed: {
@@ -95,22 +93,26 @@ export default defineComponent({
}
},
deep: true
},
initialized: {
async handler(newValue) {
if (newValue) {
console.debug('layout initialized');
await this.onGetTasks();
await this.onScrollDown();
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
}
},
immediate: true
}
},
async mounted() {
await this.onGetService();
await this.onGetApplication();
await this.onScrollDown();
await this.onGetTasks();
// await this.onScrollDown();
// @ts-ignore
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
},
async unmounted() {
clearInterval(this.job);
clearInterval(this.timer);
},
methods: {
async onReachTop() {
+15 -13
View File
@@ -25,7 +25,6 @@ const CALLBACK_URL = 'https://webhook.acedata.cloud/kling';
interface IData {
task: IKlingTask | undefined;
job: number;
timer: any;
}
export default defineComponent({
@@ -35,12 +34,11 @@ export default defineComponent({
Layout,
RecentPanel
},
inject: ['initialized'],
data(): IData {
return {
task: undefined,
job: 0,
// @ts-ignore
timer: undefined
job: 0
};
},
computed: {
@@ -67,22 +65,26 @@ export default defineComponent({
}
},
deep: true
},
initialized: {
async handler(newValue) {
if (newValue) {
console.debug('layout initialized');
await this.onGetTasks();
await this.onScrollDown();
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
}
},
immediate: true
}
},
async mounted() {
await this.onGetService();
await this.onGetApplication();
await this.onScrollDown();
await this.onGetTasks();
// await this.onScrollDown();
// @ts-ignore
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
},
async unmounted() {
clearInterval(this.job);
clearInterval(this.timer);
},
methods: {
async onReachTop() {
+16 -13
View File
@@ -25,7 +25,6 @@ const CALLBACK_URL = 'https://webhook.acedata.cloud/luma';
interface IData {
task: ILumaTask | undefined;
job: number;
timer: any;
}
export default defineComponent({
@@ -35,12 +34,11 @@ export default defineComponent({
Layout,
RecentPanel
},
inject: ['initialized'],
data(): IData {
return {
task: undefined,
job: 0,
// @ts-ignore
timer: undefined
job: 0
};
},
computed: {
@@ -70,22 +68,26 @@ export default defineComponent({
}
},
deep: true
},
initialized: {
async handler(newValue) {
if (newValue) {
console.debug('layout initialized');
await this.onGetTasks();
await this.onScrollDown();
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
}
},
immediate: true
}
},
async mounted() {
await this.onGetService();
await this.onGetApplication();
await this.onScrollDown();
await this.onGetTasks();
// await this.onScrollDown();
// @ts-ignore
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
},
async unmounted() {
clearInterval(this.job);
clearInterval(this.timer);
},
methods: {
async onReachTop() {
@@ -106,6 +108,7 @@ export default defineComponent({
await this.onGetTasks();
},
async onScrollDown() {
console.debug('scrolling down');
setTimeout(() => {
const el = document.querySelector('.tasks');
if (el) {
+15 -13
View File
@@ -31,7 +31,6 @@ import {
interface IData {
operating: boolean;
job: number;
timer: any;
}
const CALLBACK_URL = 'https://webhook.acedata.cloud/midjourney';
@@ -43,12 +42,11 @@ export default defineComponent({
TaskList,
Layout
},
inject: ['initialized'],
data(): IData {
return {
operating: false,
job: 0,
// @ts-ignore
timer: undefined
job: 0
};
},
computed: {
@@ -150,22 +148,26 @@ export default defineComponent({
}
},
deep: true
},
initialized: {
async handler(newValue) {
if (newValue) {
console.debug('layout initialized');
await this.onGetTasks();
await this.onScrollDown();
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
}
},
immediate: true
}
},
async mounted() {
await this.onGetService();
await this.onGetApplication();
await this.onScrollDown();
await this.onGetTasks();
// await this.onScrollDown();
// @ts-ignore
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
},
async unmounted() {
clearInterval(this.job);
clearInterval(this.timer);
},
methods: {
async onReachTop() {
+15 -13
View File
@@ -25,7 +25,6 @@ const CALLBACK_URL = 'https://webhook.acedata.cloud/pika';
interface IData {
task: IPikaTask | undefined;
job: number;
timer: any;
}
export default defineComponent({
@@ -35,12 +34,11 @@ export default defineComponent({
Layout,
RecentPanel
},
inject: ['initialized'],
data(): IData {
return {
task: undefined,
job: 0,
// @ts-ignore
timer: undefined
job: 0
};
},
computed: {
@@ -82,22 +80,26 @@ export default defineComponent({
}
},
deep: true
},
initialized: {
async handler(newValue) {
if (newValue) {
console.debug('layout initialized');
await this.onGetTasks();
await this.onScrollDown();
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
}
},
immediate: true
}
},
async mounted() {
await this.onGetService();
await this.onGetApplication();
await this.onScrollDown();
await this.onGetTasks();
// await this.onScrollDown();
// @ts-ignore
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
},
async unmounted() {
clearInterval(this.job);
clearInterval(this.timer);
},
methods: {
async onReachTop() {
+15 -13
View File
@@ -25,7 +25,6 @@ const CALLBACK_URL = 'https://webhook.acedata.cloud/pixverse';
interface IData {
task: IPixverseTask | undefined;
job: number;
timer: any;
}
export default defineComponent({
@@ -35,12 +34,11 @@ export default defineComponent({
Layout,
RecentPanel
},
inject: ['initialized'],
data(): IData {
return {
task: undefined,
job: 0,
// @ts-ignore
timer: undefined
job: 0
};
},
computed: {
@@ -67,22 +65,26 @@ export default defineComponent({
}
},
deep: true
},
initialized: {
async handler(newValue) {
if (newValue) {
console.debug('layout initialized');
await this.onGetTasks();
await this.onScrollDown();
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
}
},
immediate: true
}
},
async mounted() {
await this.onGetService();
await this.onGetApplication();
await this.onScrollDown();
await this.onGetTasks();
// await this.onScrollDown();
// @ts-ignore
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
},
async unmounted() {
clearInterval(this.job);
clearInterval(this.timer);
},
methods: {
async onReachTop() {
+15 -13
View File
@@ -36,7 +36,6 @@ const CALLBACK_URL = 'https://webhook.acedata.cloud/qrart';
interface IData {
task: IQrartTask | undefined;
job: number;
timer: any;
}
export default defineComponent({
@@ -47,12 +46,11 @@ export default defineComponent({
ApplicationStatus,
RecentPanel
},
inject: ['initialized'],
data(): IData {
return {
task: undefined,
job: 0,
// @ts-ignore
timer: undefined
job: 0
};
},
computed: {
@@ -94,22 +92,26 @@ export default defineComponent({
}
},
deep: true
},
initialized: {
async handler(newValue) {
if (newValue) {
console.debug('layout initialized');
await this.onGetTasks();
await this.onScrollDown();
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
}
},
immediate: true
}
},
async mounted() {
await this.onGetService();
await this.onGetApplication();
await this.onScrollDown();
await this.onGetTasks();
// await this.onScrollDown();
// @ts-ignore
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
},
async unmounted() {
clearInterval(this.job);
clearInterval(this.timer);
},
methods: {
async onReachTop() {
+15 -13
View File
@@ -29,7 +29,6 @@ const CALLBACK_URL = 'https://webhook.acedata.cloud/suno';
interface IData {
task: ISunoTask | undefined;
job: number;
timer: any;
}
export default defineComponent({
@@ -40,12 +39,11 @@ export default defineComponent({
RecentPanel,
PreviewPanel
},
inject: ['initialized'],
data(): IData {
return {
task: undefined,
job: 0,
// @ts-ignore
timer: undefined
job: 0
};
},
computed: {
@@ -87,22 +85,26 @@ export default defineComponent({
}
},
deep: true
},
initialized: {
async handler(newValue) {
if (newValue) {
console.debug('layout initialized');
await this.onGetTasks();
await this.onScrollDown();
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
}
},
immediate: true
}
},
async mounted() {
await this.onGetService();
await this.onGetApplication();
await this.onScrollDown();
await this.onGetTasks();
// await this.onScrollDown();
// @ts-ignore
this.job = setInterval(() => {
this.onGetTasks();
}, 5000);
},
async unmounted() {
clearInterval(this.job);
clearInterval(this.timer);
},
methods: {
async onReachTop() {