fix: Fix the issue where runtime environments cannot be created when using a custom app repository. (#12887)

This commit is contained in:
CityFun
2026-05-28 11:54:02 +08:00
committed by GitHub
parent 68f8d8d221
commit a332dfd3b3
3 changed files with 43 additions and 8 deletions
@@ -0,0 +1,3 @@
export const resolveRuntimeAppResource = (isOffline: boolean, customAppStatus?: string) => {
return isOffline || customAppStatus?.toLowerCase() === 'enable' ? 'custom' : 'remote';
};
@@ -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: {
@@ -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();
const res = await searchApp(appReq);
apps.value = res.data.items || [];
if (res.data && res.data.items && res.data.items.length > 0) {
@@ -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';
@@ -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;
@@ -237,6 +238,7 @@ const appReq = reactive({
type: 'php',
page: 1,
pageSize: 20,
resource: 'remote',
});
const phpSources = isIntl.value
? [
@@ -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) {