mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-18 05:19:19 +08:00
feat: Support managing application upgrades for all nodes on a single page (#11325)
This commit is contained in:
parent
6f9a8d5afe
commit
956a64c692
15 changed files with 59 additions and 9 deletions
|
|
@ -169,6 +169,7 @@ var WebUrlMap = map[string]struct{}{
|
||||||
"/xpack/simple-node": {},
|
"/xpack/simple-node": {},
|
||||||
"/xpack/exchange/file": {},
|
"/xpack/exchange/file": {},
|
||||||
"/xpack/app": {},
|
"/xpack/app": {},
|
||||||
|
"/xpack/app-upgrade": {},
|
||||||
|
|
||||||
"/xpack/cluster/mysql": {},
|
"/xpack/cluster/mysql": {},
|
||||||
"/xpack/cluster/postgres": {},
|
"/xpack/cluster/postgres": {},
|
||||||
|
|
|
||||||
|
|
@ -287,4 +287,9 @@ export namespace Setting {
|
||||||
smsUsed: number;
|
smsUsed: number;
|
||||||
smsTotal: number;
|
smsTotal: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface NodeAppItem {
|
||||||
|
name: string;
|
||||||
|
updateCount: number;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,9 @@ export const changePort = (params: App.ChangePort) => {
|
||||||
return http.post<any>('apps/installed/port/change', params);
|
return http.post<any>('apps/installed/port/change', params);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const searchAppInstalled = (search: App.AppInstallSearch) => {
|
export const searchAppInstalled = (search: App.AppInstallSearch, node?: string) => {
|
||||||
return http.post<ResPage<App.AppInstallDto>>('apps/installed/search', search);
|
const params = node ? `?operateNode=${node}` : '';
|
||||||
|
return http.post<ResPage<App.AppInstallDto>>(`apps/installed/search${params}`, search);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const listAppInstalled = () => {
|
export const listAppInstalled = () => {
|
||||||
|
|
@ -89,8 +90,9 @@ export const getAppService = (key: string | undefined, node?: string) => {
|
||||||
return http.get<App.AppService[]>(`apps/services/${key}${params}`);
|
return http.get<App.AppService[]>(`apps/services/${key}${params}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAppUpdateVersions = (req: App.AppUpdateVersionReq) => {
|
export const getAppUpdateVersions = (req: App.AppUpdateVersionReq, node?: string) => {
|
||||||
return http.post<any>(`apps/installed/update/versions`, req);
|
const params = node ? `?operateNode=${node}` : '';
|
||||||
|
return http.post<any>(`apps/installed/update/versions${params}`, req);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAppDefaultConfig = (key: string, name: string) => {
|
export const getAppDefaultConfig = (key: string, name: string) => {
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,10 @@ export const getLicenseSmsInfo = () => {
|
||||||
return http.get<Setting.SmsInfo>(`/core/licenses/sms/info`);
|
return http.get<Setting.SmsInfo>(`/core/licenses/sms/info`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const listAppNodes = () => {
|
||||||
|
return http.get<Array<Setting.NodeAppItem>>(`/core/xpack/nodes/apps/update`);
|
||||||
|
};
|
||||||
|
|
||||||
// agent
|
// agent
|
||||||
export const loadBaseDir = () => {
|
export const loadBaseDir = () => {
|
||||||
return http.get<string>(`/settings/basedir`);
|
return http.get<string>(`/settings/basedir`);
|
||||||
|
|
|
||||||
|
|
@ -3817,6 +3817,9 @@ const message = {
|
||||||
offline: 'Offline mode',
|
offline: 'Offline mode',
|
||||||
freeCount: 'Free quota [{0}]',
|
freeCount: 'Free quota [{0}]',
|
||||||
offlineHelper: 'Used when the node is in an offline environment',
|
offlineHelper: 'Used when the node is in an offline environment',
|
||||||
|
|
||||||
|
appUpgrade: 'App Upgrade',
|
||||||
|
appUpgradeHelper: 'There are {0} apps that need to be upgraded',
|
||||||
},
|
},
|
||||||
customApp: {
|
customApp: {
|
||||||
name: 'Custom App Repository',
|
name: 'Custom App Repository',
|
||||||
|
|
|
||||||
|
|
@ -3771,6 +3771,9 @@ const message = {
|
||||||
offline: 'Modo Offline',
|
offline: 'Modo Offline',
|
||||||
freeCount: 'Cuota gratuita [{0}]',
|
freeCount: 'Cuota gratuita [{0}]',
|
||||||
offlineHelper: 'Usado cuando el nodo está en un entorno sin conexión',
|
offlineHelper: 'Usado cuando el nodo está en un entorno sin conexión',
|
||||||
|
|
||||||
|
appUpgrade: 'Actualización de la aplicación',
|
||||||
|
appUpgradeHelper: 'Hay {0} aplicaciones que necesitan ser actualizadas',
|
||||||
},
|
},
|
||||||
customApp: {
|
customApp: {
|
||||||
name: 'Repositorio de Apps Personalizadas',
|
name: 'Repositorio de Apps Personalizadas',
|
||||||
|
|
|
||||||
|
|
@ -3705,6 +3705,9 @@ const message = {
|
||||||
offline: 'オフラインモード',
|
offline: 'オフラインモード',
|
||||||
freeCount: '無料枠 [{0}]',
|
freeCount: '無料枠 [{0}]',
|
||||||
offlineHelper: 'ノードがオフライン環境にある場合に使用',
|
offlineHelper: 'ノードがオフライン環境にある場合に使用',
|
||||||
|
|
||||||
|
appUpgrade: 'アプリのアップグレード',
|
||||||
|
appUpgradeHelper: 'アップグレードが必要なアプリが {0} 個あります',
|
||||||
},
|
},
|
||||||
customApp: {
|
customApp: {
|
||||||
name: 'カスタムアプリリポジトリ',
|
name: 'カスタムアプリリポジトリ',
|
||||||
|
|
|
||||||
|
|
@ -3636,6 +3636,9 @@ const message = {
|
||||||
offline: '오프라인 모드',
|
offline: '오프라인 모드',
|
||||||
freeCount: '무료 할당량 [{0}]',
|
freeCount: '무료 할당량 [{0}]',
|
||||||
offlineHelper: '노드가 오프라인 환경일 때 사용',
|
offlineHelper: '노드가 오프라인 환경일 때 사용',
|
||||||
|
|
||||||
|
appUpgrade: '앱 업그레이드',
|
||||||
|
appUpgradeHelper: '업그레이드가 필요한 앱이 {0}개 있습니다',
|
||||||
},
|
},
|
||||||
customApp: {
|
customApp: {
|
||||||
name: '사용자 정의 앱 저장소',
|
name: '사용자 정의 앱 저장소',
|
||||||
|
|
|
||||||
|
|
@ -3774,6 +3774,9 @@ const message = {
|
||||||
offline: 'Mod luar talian',
|
offline: 'Mod luar talian',
|
||||||
freeCount: 'Had percuma [{0}]',
|
freeCount: 'Had percuma [{0}]',
|
||||||
offlineHelper: 'Digunakan apabila nod berada dalam persekitaran luar talian',
|
offlineHelper: 'Digunakan apabila nod berada dalam persekitaran luar talian',
|
||||||
|
|
||||||
|
appUpgrade: 'Naik Taraf Apl',
|
||||||
|
appUpgradeHelper: 'Terdapat {0} apl yang perlu dinaik taraf',
|
||||||
},
|
},
|
||||||
customApp: {
|
customApp: {
|
||||||
name: 'Repositori Aplikasi Khusus',
|
name: 'Repositori Aplikasi Khusus',
|
||||||
|
|
|
||||||
|
|
@ -3793,6 +3793,9 @@ const message = {
|
||||||
offline: 'Modo offline',
|
offline: 'Modo offline',
|
||||||
freeCount: 'Cota gratuita [{0}]',
|
freeCount: 'Cota gratuita [{0}]',
|
||||||
offlineHelper: 'Usado quando o nó está em ambiente offline',
|
offlineHelper: 'Usado quando o nó está em ambiente offline',
|
||||||
|
|
||||||
|
appUpgrade: 'Atualização do Aplicativo',
|
||||||
|
appUpgradeHelper: 'Existem {0} aplicativos que precisam ser atualizados',
|
||||||
},
|
},
|
||||||
customApp: {
|
customApp: {
|
||||||
name: 'Repositório de Aplicativos Personalizados',
|
name: 'Repositório de Aplicativos Personalizados',
|
||||||
|
|
|
||||||
|
|
@ -3781,6 +3781,9 @@ const message = {
|
||||||
offline: 'Автономный режим',
|
offline: 'Автономный режим',
|
||||||
freeCount: 'Бесплатная квота [{0}]',
|
freeCount: 'Бесплатная квота [{0}]',
|
||||||
offlineHelper: 'Используется, когда узел находится в автономной среде',
|
offlineHelper: 'Используется, когда узел находится в автономной среде',
|
||||||
|
|
||||||
|
appUpgrade: 'Обновление приложения',
|
||||||
|
appUpgradeHelper: 'Есть {0} приложений, которые необходимо обновить',
|
||||||
},
|
},
|
||||||
customApp: {
|
customApp: {
|
||||||
name: 'Пользовательское хранилище приложений',
|
name: 'Пользовательское хранилище приложений',
|
||||||
|
|
|
||||||
|
|
@ -3856,6 +3856,9 @@ const message = {
|
||||||
offline: 'Çevrimdışı mod',
|
offline: 'Çevrimdışı mod',
|
||||||
freeCount: 'Ücretsiz kota [{0}]',
|
freeCount: 'Ücretsiz kota [{0}]',
|
||||||
offlineHelper: 'Düğüm çevrimdışı bir ortamda olduğunda kullanılır',
|
offlineHelper: 'Düğüm çevrimdışı bir ortamda olduğunda kullanılır',
|
||||||
|
|
||||||
|
appUpgrade: 'Uygulama Yükseltme',
|
||||||
|
appUpgradeHelper: 'Yükseltilmesi gereken {0} uygulama var',
|
||||||
},
|
},
|
||||||
customApp: {
|
customApp: {
|
||||||
name: 'Özel Uygulama Deposu',
|
name: 'Özel Uygulama Deposu',
|
||||||
|
|
|
||||||
|
|
@ -3519,6 +3519,9 @@ const message = {
|
||||||
offline: '離線模式',
|
offline: '離線模式',
|
||||||
freeCount: '免費額度 [{0}]',
|
freeCount: '免費額度 [{0}]',
|
||||||
offlineHelper: '當節點處於離線環境時使用',
|
offlineHelper: '當節點處於離線環境時使用',
|
||||||
|
|
||||||
|
appUpgrade: '應用程式升級',
|
||||||
|
appUpgradeHelper: '有 {0} 個應用程式需要升級',
|
||||||
},
|
},
|
||||||
customApp: {
|
customApp: {
|
||||||
name: '自訂應用倉庫',
|
name: '自訂應用倉庫',
|
||||||
|
|
|
||||||
|
|
@ -3513,6 +3513,9 @@ const message = {
|
||||||
offline: '离线模式',
|
offline: '离线模式',
|
||||||
freeCount: '免费额度 [{0}] ',
|
freeCount: '免费额度 [{0}] ',
|
||||||
offlineHelper: '节点为离线环境时使用',
|
offlineHelper: '节点为离线环境时使用',
|
||||||
|
|
||||||
|
appUpgrade: '应用升级',
|
||||||
|
appUpgradeHelper: '有 {0} 个应用需要升级',
|
||||||
},
|
},
|
||||||
customApp: {
|
customApp: {
|
||||||
name: '自定义仓库',
|
name: '自定义仓库',
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,8 @@ import { MsgSuccess } from '@/utils/message';
|
||||||
import { Rules } from '@/global/form-rules';
|
import { Rules } from '@/global/form-rules';
|
||||||
import bus from '@/global/bus';
|
import bus from '@/global/bus';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
import { useGlobalStore } from '@/composables/useGlobalStore';
|
||||||
|
const { currentNode } = useGlobalStore();
|
||||||
|
|
||||||
const composeDiffRef = ref();
|
const composeDiffRef = ref();
|
||||||
const updateRef = ref<FormInstance>();
|
const updateRef = ref<FormInstance>();
|
||||||
|
|
@ -132,6 +134,7 @@ const ignoreAppReq = reactive({
|
||||||
scope: 'app',
|
scope: 'app',
|
||||||
});
|
});
|
||||||
const isEdit = ref(false);
|
const isEdit = ref(false);
|
||||||
|
const node = ref('');
|
||||||
|
|
||||||
const toLink = (link: string) => {
|
const toLink = (link: string) => {
|
||||||
window.open(link, '_blank');
|
window.open(link, '_blank');
|
||||||
|
|
@ -155,7 +158,7 @@ const getNewCompose = (compose: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const initData = async () => {
|
const initData = async () => {
|
||||||
const config = await getAppStoreConfig();
|
const config = await getAppStoreConfig(node.value);
|
||||||
newCompose.value = '';
|
newCompose.value = '';
|
||||||
useNewCompose.value = false;
|
useNewCompose.value = false;
|
||||||
operateReq.backup = config.data.upgradeBackup == 'Enable';
|
operateReq.backup = config.data.upgradeBackup == 'Enable';
|
||||||
|
|
@ -163,8 +166,13 @@ const initData = async () => {
|
||||||
operateReq.dockerCompose = '';
|
operateReq.dockerCompose = '';
|
||||||
};
|
};
|
||||||
|
|
||||||
const acceptParams = (appInstall: App.AppInstallDto, op: string) => {
|
const acceptParams = (appInstall: App.AppInstallDto, op: string, opNode?: string) => {
|
||||||
initData();
|
initData();
|
||||||
|
if (opNode) {
|
||||||
|
node.value = opNode;
|
||||||
|
} else {
|
||||||
|
node.value = currentNode.value;
|
||||||
|
}
|
||||||
isEdit.value = appInstall.isEdit;
|
isEdit.value = appInstall.isEdit;
|
||||||
operateReq.installId = appInstall.id;
|
operateReq.installId = appInstall.id;
|
||||||
operateReq.operate = op;
|
operateReq.operate = op;
|
||||||
|
|
@ -188,7 +196,7 @@ const getVersions = async (version: string) => {
|
||||||
req['updateVersion'] = version;
|
req['updateVersion'] = version;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const res = await getAppUpdateVersions(req);
|
const res = await getAppUpdateVersions(req, node.value);
|
||||||
versions.value = res.data || [];
|
versions.value = res.data || [];
|
||||||
if (res.data != null && res.data.length > 0) {
|
if (res.data != null && res.data.length > 0) {
|
||||||
let item = res.data[0];
|
let item = res.data[0];
|
||||||
|
|
@ -205,7 +213,7 @@ const getVersions = async (version: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const openTaskLog = (taskID: string) => {
|
const openTaskLog = (taskID: string) => {
|
||||||
taskLogRef.value.openWithTaskID(taskID);
|
taskLogRef.value.openWithTaskID(taskID, true, node.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
const operate = async () => {
|
const operate = async () => {
|
||||||
|
|
@ -216,7 +224,7 @@ const operate = async () => {
|
||||||
}
|
}
|
||||||
const taskID = uuidv4();
|
const taskID = uuidv4();
|
||||||
operateReq.taskID = taskID;
|
operateReq.taskID = taskID;
|
||||||
await installedOp(operateReq)
|
await installedOp(operateReq, node.value)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
bus.emit('upgrade', true);
|
bus.emit('upgrade', true);
|
||||||
handleClose();
|
handleClose();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue