show the friendly region name

This commit is contained in:
Girish Ramakrishnan
2025-09-26 10:17:03 +02:00
parent 1f78253b38
commit defcf7d220
3 changed files with 31 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
import { prettyBinarySize } from '@cloudron/pankow/utils';
import { ISTATES } from './constants.js';
import { ISTATES, STORAGE_PROVIDERS } from './constants.js';
// https://stackoverflow.com/questions/3665115/how-to-create-a-file-in-memory-for-user-to-download-but-not-through-server#18197341
function download(filename, text) {
@@ -29,6 +29,15 @@ function s3like(provider) {
|| provider === 'contabo-objectstorage';
}
function regionName(provider, endpoint) {
const storageProvider = STORAGE_PROVIDERS.find(sp => sp.value === provider);
const regions = storageProvider.regions;
if (!regions) return endpoint;
const region = regions.find(r => r.value === endpoint);
if (!region) return endpoint;
return region.name;
}
function eventlogDetails(eventLog, app = null, appIdContext = '') {
const ACTION_ACTIVATE = 'cloudron.activate';
const ACTION_PROVISION = 'cloudron.provision';
@@ -610,6 +619,7 @@ export {
download,
mountlike,
s3like,
regionName,
eventlogDetails,
eventlogSource,
taskNameFromInstallationState,
@@ -623,6 +633,7 @@ export default {
download,
mountlike,
s3like,
regionName,
eventlogDetails,
eventlogSource,
taskNameFromInstallationState,