Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions frontend/src/utils/runtime-app-resource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const resolveRuntimeAppResource = (isOffline: boolean, customAppStatus?: string) => {
return isOffline || customAppStatus?.toLowerCase() === 'enable' ? 'custom' : 'remote';
};
24 changes: 19 additions & 5 deletions frontend/src/views/website/runtime/app/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@

<script setup lang="ts">
import { App } from '@/api/interface/app';
import { getAppByKey, getAppDetail, searchApp } from '@/api/modules/app';
import { getAppByKey, getAppDetail, getCurrentNodeCustomAppConfig, searchApp } from '@/api/modules/app';
import { useVModel } from '@vueuse/core';
import { useGlobalStore } from '@/composables/useGlobalStore';
const { isOffline } = useGlobalStore();
import { resolveRuntimeAppResource } from '@/utils/runtime-app-resource';
const { isOffline, isXpackOrEE } = useGlobalStore();

const props = defineProps({
mode: {
Expand Down Expand Up @@ -91,11 +92,24 @@ const getApp = async (appkey: string, mode: string) => {
} catch (error) {}
};

const loadRuntimeAppResource = async () => {
if (isOffline.value) {
return 'custom';
}
if (!isXpackOrEE.value) {
return 'remote';
}
try {
const res = await getCurrentNodeCustomAppConfig();
return resolveRuntimeAppResource(isOffline.value, res.data?.status);
} catch (error) {
return 'remote';
}
};

const searchAppList = async (appID: number) => {
try {
if (isOffline.value) {
appReq.resource = 'custom';
}
appReq.resource = await loadRuntimeAppResource();
Comment thread
zhengkunwang223 marked this conversation as resolved.
const res = await searchApp(appReq);
apps.value = res.data.items || [];
if (res.data && res.data.items && res.data.items.length > 0) {
Expand Down
24 changes: 21 additions & 3 deletions frontend/src/views/website/runtime/php/create/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
<script lang="ts" setup>
import { App } from '@/api/interface/app';
import { Runtime } from '@/api/interface/runtime';
import { getAppByKey, getAppDetail, searchApp } from '@/api/modules/app';
import { getAppByKey, getAppDetail, getCurrentNodeCustomAppConfig, searchApp } from '@/api/modules/app';
import { CreateRuntime, GetRuntime, ListPHPExtensions, UpdateRuntime } from '@/api/modules/runtime';
import { Rules } from '@/global/form-rules';
import i18n from '@/lang';
Expand All @@ -215,7 +215,8 @@ import { FormInstance } from 'element-plus';
import { reactive, ref } from 'vue';
import { getLabel } from '@/utils/app-store';
import { useGlobalStore } from '@/composables/useGlobalStore';
const { docsUrl, isFxplay, isIntl, isOffline } = useGlobalStore();
import { resolveRuntimeAppResource } from '@/utils/runtime-app-resource';
const { docsUrl, isFxplay, isIntl, isOffline, isXpackOrEE } = useGlobalStore();

interface OperateRrops {
id?: number;
Expand All @@ -237,6 +238,7 @@ const appReq = reactive({
type: 'php',
page: 1,
pageSize: 20,
resource: 'remote',
});
const phpSources = isIntl.value
? [
Expand Down Expand Up @@ -335,7 +337,23 @@ const changeResource = (resource: string) => {
}
};

const searchAppList = (appId: number) => {
const loadRuntimeAppResource = async () => {
if (isOffline.value) {
return 'custom';
}
if (!isXpackOrEE.value) {
return 'remote';
}
try {
const res = await getCurrentNodeCustomAppConfig();
return resolveRuntimeAppResource(isOffline.value, res.data?.status);
} catch (error) {
return 'remote';
}
};

const searchAppList = async (appId: number) => {
appReq.resource = await loadRuntimeAppResource();
searchApp(appReq).then((res) => {
apps.value = res.data.items || [];
if (res.data && res.data.items && res.data.items.length > 0) {
Expand Down
Loading