Add proxy app and app link creation in appstore view
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
<template>
|
||||
<div class="content">
|
||||
<AppInstallDialog ref="appInstallDialog" @close="onAppInstallDialogClose"/>
|
||||
<ApplinkDialog ref="applinkDialog" @success="onApplinkDialogSuccess()"/>
|
||||
|
||||
<div class="filter-bar">
|
||||
<div></div>
|
||||
<TextInput ref="searchInput" v-model="search" :placeholder="$t('appstore.searchPlaceholder')" style="max-width: 100%; width: 500px;"/>
|
||||
<ButtonGroup>
|
||||
<Button outline icon="fas fa-exchange-alt">{{ $t('apps.addAppproxyAction') }}</Button>
|
||||
<Button outline icon="fas fa-link">{{ $t('apps.addApplinkAction') }}</Button>
|
||||
<Button outline icon="fas fa-exchange-alt" @click="onInstall(proxyApp)">{{ $t('apps.addAppproxyAction') }}</Button>
|
||||
<Button outline icon="fas fa-link" @click="onApplinkDialogOpen()">{{ $t('apps.addApplinkAction') }}</Button>
|
||||
</ButtonGroup>
|
||||
</div>
|
||||
|
||||
@@ -55,12 +56,15 @@ import { ref, computed, useTemplateRef, onMounted } from 'vue';
|
||||
import { Button, ButtonGroup, TextInput } from 'pankow';
|
||||
import AppstoreModel from '../models/AppstoreModel.js';
|
||||
import AppInstallDialog from './AppInstallDialog.vue';
|
||||
import ApplinkDialog from './ApplinkDialog.vue';
|
||||
import { PROXY_APP_ID } from '../constants.js';
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
const appstoreModel = AppstoreModel.create(API_ORIGIN, localStorage.token);
|
||||
|
||||
const ready = ref(false);
|
||||
const proxyApp = ref();
|
||||
const apps = ref([]);
|
||||
const search = ref('');
|
||||
const filteredApps = computed(() => {
|
||||
@@ -83,13 +87,22 @@ const filteredPopularApps = computed(() => {
|
||||
});
|
||||
const appInstallDialog = useTemplateRef('appInstallDialog');
|
||||
const searchInput = useTemplateRef('searchInput');
|
||||
const applinkDialog = useTemplateRef('applinkDialog');
|
||||
|
||||
function onAppInstallDialogClose() {
|
||||
window.location.href = '/#/appstore';
|
||||
window.location.href = '#/appstore';
|
||||
}
|
||||
|
||||
function onApplinkDialogOpen() {
|
||||
applinkDialog.value.open();
|
||||
}
|
||||
|
||||
function onApplinkDialogSuccess() {
|
||||
window.location.href = '#/apps';
|
||||
}
|
||||
|
||||
function onInstall(app) {
|
||||
window.location.href = `/#/appstore/${app.manifest.id}?version=${app.manifest.version}`;
|
||||
window.location.href = `#/appstore/${app.manifest.id}?version=${app.manifest.version}`;
|
||||
appInstallDialog.value.open(app);
|
||||
}
|
||||
|
||||
@@ -102,8 +115,6 @@ onMounted(async () => {
|
||||
const appId = query.split('?')[0];
|
||||
const version = query.slice(query.indexOf('version=')+'version='.length);
|
||||
|
||||
console.log(appId, version)
|
||||
|
||||
const app = await appstoreModel.get(appId, version);
|
||||
if (app) {
|
||||
appInstallDialog.value.open(app);
|
||||
@@ -113,6 +124,8 @@ onMounted(async () => {
|
||||
} else {
|
||||
searchInput.value.$el.focus();
|
||||
}
|
||||
|
||||
proxyApp.value = await appstoreModel.get(PROXY_APP_ID);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user