diff --git a/dashboard/src/components/AppInstallDialog.vue b/dashboard/src/components/AppInstallDialog.vue index d47113e3f..2b78c24a5 100644 --- a/dashboard/src/components/AppInstallDialog.vue +++ b/dashboard/src/components/AppInstallDialog.vue @@ -7,8 +7,6 @@ import { prettyDate, prettyBinarySize } from '@cloudron/pankow/utils'; import AccessControl from './AccessControl.vue'; import PortBindings from './PortBindings.vue'; import AppsModel from '../models/AppsModel.js'; -import CommunityModel from '../models/CommunityModel.js'; -import AppstoreModel from '../models/AppstoreModel.js'; import DomainsModel from '../models/DomainsModel.js'; import UsersModel from '../models/UsersModel.js'; import GroupsModel from '../models/GroupsModel.js'; @@ -20,9 +18,7 @@ const STEP = Object.freeze({ INSTALL: Symbol('install'), }); -const appstoreModel = AppstoreModel.create(); const appsModel = AppsModel.create(); -const communityModel = CommunityModel.create(); const domainsModel = DomainsModel.create(); const usersModel = UsersModel.create(); const groupsModel = GroupsModel.create(); @@ -33,7 +29,7 @@ const dashboardDomain = inject('dashboardDomain'); // reactive const busy = ref(false); const formError = ref({}); -const appData = ref({}); +const packageData = ref({}); const manifest = ref({}); const step = ref(STEP.DETAILS); const dialog = useTemplateRef('dialogHandle'); @@ -159,7 +155,7 @@ async function onSubmit(overwriteDns) { if (manifest.value.id === PROXY_APP_ID) config.upstreamUri = upstreamUri.value; - const [error, result] = await appsModel.install(appData.value, config); + const [error, result] = await appsModel.install(packageData.value, config); if (!error) { dialog.value.close(); @@ -213,36 +209,14 @@ function onScreenshotNext() { } defineExpose({ - open: async function(upstreamRef, appCountExceeded, domainList) { + open: async function(pd, appCountExceeded, domainList) { busy.value = false; step.value = STEP.LOADING; formError.value = {}; - // give it some time to fetch before showing loading - const openTimer = setTimeout(dialog.value.open, 200); - - if (upstreamRef.appStoreId) { - const [id, version] = upstreamRef.appStoreId.split('@'); - const [error, result] = await appstoreModel.get(id, version); - if (error) { - clearTimeout(openTimer); - dialog.value.close(); - throw new Error('App not found'); - } - appData.value = { ...result, ...upstreamRef }; - } else if (upstreamRef.versionsUrl) { - const [url, version] = upstreamRef.versionsUrl.split('@'); - const [error, result] = await communityModel.getApp(url, version); - if (error) { - clearTimeout(openTimer); - dialog.value.close(); - throw new Error(error.body?.message || 'Failed to fetch community app'); - } - appData.value = { ...result, ...upstreamRef }; - } - + packageData.value = pd; appMaxCountExceeded.value = appCountExceeded; - manifest.value = appData.value.manifest; + manifest.value = packageData.value.manifest; location.value = ''; accessRestrictionOption.value = ACL_OPTIONS.ANY; accessRestrictionAcl.value = { users: [], groups: [] }; @@ -281,6 +255,7 @@ defineExpose({ currentScreenshotPos = 0; step.value = STEP.DETAILS; + dialog.value.open(); }, close() { dialog.value.close(); @@ -296,13 +271,13 @@ defineExpose({