+
@@ -385,7 +352,6 @@ const activatingSoraProfile = ref(false)
const deletingSoraProfile = ref(false)
const creatingSoraProfile = ref(false)
const soraProfileDrawerOpen = ref(false)
-const providerSelectOpen = ref(false)
const startingOAuth = ref(false)
const loadingGDriveQuota = ref(false)
const loadingVideoStats = ref(false)
@@ -423,7 +389,6 @@ type SoraStorageProfileForm = {
folder_id: string
// Common
cdn_url: string
- default_storage_quota_gb: number
}
const soraProfileForm = ref(newDefaultProfileForm('s3'))
@@ -536,17 +501,16 @@ async function loadVideoStats() {
}
function startCreateSoraProfile() {
- providerSelectOpen.value = true
-}
-
-function confirmProviderSelect(provider: string) {
- providerSelectOpen.value = false
creatingSoraProfile.value = true
selectedSoraProfileID.value = ''
- soraProfileForm.value = newDefaultProfileForm(provider)
+ soraProfileForm.value = newDefaultProfileForm('')
soraProfileDrawerOpen.value = true
}
+function selectProvider(provider: string) {
+ soraProfileForm.value = newDefaultProfileForm(provider)
+}
+
function editSoraProfile(profileID: string) {
selectedSoraProfileID.value = profileID
creatingSoraProfile.value = false
@@ -595,7 +559,6 @@ async function saveSoraProfile() {
savingSoraProfile.value = true
try {
- const quotaBytes = Math.round((form.default_storage_quota_gb || 0) * 1024 * 1024 * 1024)
if (creatingSoraProfile.value) {
const request: Record = {
profile_id: form.profile_id.trim(),
@@ -603,8 +566,7 @@ async function saveSoraProfile() {
set_active: form.set_active,
provider: form.provider,
enabled: form.enabled,
- cdn_url: form.cdn_url,
- default_storage_quota_bytes: quotaBytes
+ cdn_url: form.cdn_url
}
if (form.provider === 's3') {
Object.assign(request, {
@@ -635,8 +597,7 @@ async function saveSoraProfile() {
const request: Record = {
name: form.name.trim(),
enabled: form.enabled,
- cdn_url: form.cdn_url,
- default_storage_quota_bytes: quotaBytes
+ cdn_url: form.cdn_url
}
if (form.provider === 's3') {
Object.assign(request, {
@@ -683,8 +644,7 @@ async function testSoraProfileConnection() {
secret_access_key: soraProfileForm.value.secret_access_key || undefined,
prefix: soraProfileForm.value.prefix,
force_path_style: soraProfileForm.value.force_path_style,
- cdn_url: soraProfileForm.value.cdn_url,
- default_storage_quota_bytes: Math.round((soraProfileForm.value.default_storage_quota_gb || 0) * 1024 * 1024 * 1024)
+ cdn_url: soraProfileForm.value.cdn_url
})
appStore.showSuccess(result.message || t('admin.settings.soraS3.testSuccess'))
} catch (error) {
@@ -809,12 +769,6 @@ function formatDate(value?: string): string {
return date.toLocaleString()
}
-function formatStorageQuotaGB(bytes: number): string {
- if (!bytes || bytes <= 0) return '0 GB'
- const gb = bytes / (1024 * 1024 * 1024)
- return `${gb.toFixed(gb >= 10 ? 0 : 1)} GB`
-}
-
function formatBytes(bytes: number): string {
if (!bytes || bytes <= 0) return '0 B'
const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']
@@ -863,12 +817,10 @@ function newDefaultProfileForm(provider: string, profile?: SoraS3Profile): SoraS
service_account_json: '',
service_account_configured: false,
folder_id: '',
- cdn_url: '',
- default_storage_quota_gb: 0
+ cdn_url: ''
}
}
- const quotaBytes = profile.default_storage_quota_bytes || 0
return {
profile_id: profile.profile_id,
name: profile.name,
@@ -892,8 +844,7 @@ function newDefaultProfileForm(provider: string, profile?: SoraS3Profile): SoraS
service_account_json: '',
service_account_configured: Boolean(profile.service_account_configured),
folder_id: profile.folder_id || '',
- cdn_url: profile.cdn_url || '',
- default_storage_quota_gb: Number((quotaBytes / (1024 * 1024 * 1024)).toFixed(2))
+ cdn_url: profile.cdn_url || ''
}
}