mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Merge pull request #351 from YunoHost/simpler_custom_app_install
Simplify custom app install with new /apps/manifest route
This commit is contained in:
commit
9dddd4f5dc
4 changed files with 15 additions and 39 deletions
|
@ -54,6 +54,7 @@
|
|||
"app_info_change_url_disabled_tooltip": "This feature hasn't been implemented in this app yet",
|
||||
"app_info_uninstall_desc": "Remove this application.",
|
||||
"app_install_custom_no_manifest": "No manifest.json file",
|
||||
"app_install_parameters": "Install settings",
|
||||
"app_manage_label_and_tiles": "Manage label and tiles",
|
||||
"app_make_default": "Make default",
|
||||
"app_no_actions": "This application doesn't have any actions",
|
||||
|
@ -115,7 +116,6 @@
|
|||
"connection": "Connection",
|
||||
"created_at": "Created at",
|
||||
"custom_app_install": "Install custom app",
|
||||
"custom_app_url_only_github": "Currently only from GitHub",
|
||||
"day_validity": " Expired | 1 day | {count} days",
|
||||
"dead": "Inactive",
|
||||
"delete": "Delete",
|
||||
|
@ -266,7 +266,7 @@
|
|||
"migrations_no_done": "No previous migrations",
|
||||
"migrations_disclaimer_check_message": "I read and understood this disclaimer",
|
||||
"migrations_disclaimer_not_checked": "This migration require you to acknowledge its disclaimer before running it.",
|
||||
"multi_instance": "Multi instance",
|
||||
"multi_instance": "Can be installed several times",
|
||||
"myserver": "myserver",
|
||||
"next": "Next",
|
||||
"no": "No",
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
"app_info_default_desc": "Redirige la racine du domaine vers cette application ({domain}).",
|
||||
"app_info_uninstall_desc": "Supprimer cette application.",
|
||||
"app_install_custom_no_manifest": "Aucun fichier manifest.json",
|
||||
"app_install_parameters": "Paramètres d'installation",
|
||||
"app_make_default": "Définir par défaut",
|
||||
"app_state_inprogress": "ne fonctionne pas encore",
|
||||
"app_state_notworking": "Non fonctionnelle",
|
||||
|
@ -89,7 +90,7 @@
|
|||
"manage_apps": "Gérer les applications",
|
||||
"manage_domains": "Gérer les domaines",
|
||||
"manage_users": "Gérer les utilisateurs",
|
||||
"multi_instance": "Instance multiple",
|
||||
"multi_instance": "Peut être installée plusieurs fois",
|
||||
"myserver": "monserveur",
|
||||
"next": "Suivant",
|
||||
"no": "Non",
|
||||
|
|
|
@ -193,10 +193,9 @@ export default {
|
|||
customInstall: {
|
||||
field: {
|
||||
label: this.$i18n.t('url'),
|
||||
description: this.$i18n.t('custom_app_url_only_github'),
|
||||
props: {
|
||||
id: 'custom-install',
|
||||
placeholder: 'https://github.com/USER/REPOSITORY'
|
||||
placeholder: 'https://some.git.forge.tld/USER/REPOSITORY'
|
||||
}
|
||||
},
|
||||
url: ''
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<template>
|
||||
<view-base :loading="loading">
|
||||
<view-base :queries="queries" @queries-response="onQueriesResponse">
|
||||
<template v-if="infos">
|
||||
<!-- BASIC INFOS -->
|
||||
<card :title="`${$t('infos')} — ${name}`" icon="info-circle">
|
||||
<card :title="name" icon="download">
|
||||
<b-row
|
||||
v-for="(info, key) in infos" :key="key"
|
||||
no-gutters class="row-line"
|
||||
|
@ -19,7 +19,7 @@
|
|||
|
||||
<!-- INSTALL FORM -->
|
||||
<card-form
|
||||
:title="$t('operations')" icon="wrench" :submit-text="$t('install')"
|
||||
:title="$t('app_install_parameters')" icon="cog" :submit-text="$t('install')"
|
||||
:validation="$v" :server-error="serverError"
|
||||
@submit.prevent="performInstall"
|
||||
>
|
||||
|
@ -63,7 +63,12 @@ export default {
|
|||
|
||||
data () {
|
||||
return {
|
||||
loading: true,
|
||||
queries: [
|
||||
['GET', 'apps/manifest?app=' + this.id],
|
||||
['GET', { uri: 'domains' }],
|
||||
['GET', { uri: 'domains/main', storeKey: 'main_domain' }],
|
||||
['GET', { uri: 'users' }]
|
||||
],
|
||||
name: undefined,
|
||||
infos: undefined,
|
||||
formDisclaimer: null,
|
||||
|
@ -79,23 +84,7 @@ export default {
|
|||
},
|
||||
|
||||
methods: {
|
||||
getExternalManifest () {
|
||||
const url = this.id.replace('github.com', 'raw.githubusercontent.com') + 'master/manifest.json'
|
||||
return fetch(url).then(response => {
|
||||
if (response.ok) return response.json()
|
||||
else {
|
||||
throw Error('No manifest found at ' + url)
|
||||
}
|
||||
}).catch(() => {
|
||||
this.infos = null
|
||||
})
|
||||
},
|
||||
|
||||
getApiManifest () {
|
||||
return api.get('apps/catalog?full').then(response => response.apps[this.id].manifest)
|
||||
},
|
||||
|
||||
formatManifestData (manifest) {
|
||||
onQueriesResponse (manifest) {
|
||||
this.name = manifest.name
|
||||
const infosKeys = ['id', 'description', 'license', 'version', 'multi_instance']
|
||||
if (manifest.license === undefined || manifest.license === 'free') {
|
||||
|
@ -114,7 +103,6 @@ export default {
|
|||
this.fields = fields
|
||||
this.form = form
|
||||
this.validations = { form: validations }
|
||||
this.loading = false
|
||||
},
|
||||
|
||||
async performInstall () {
|
||||
|
@ -135,18 +123,6 @@ export default {
|
|||
this.serverError = err.message
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
const isCustom = this.$route.name === 'app-install-custom'
|
||||
Promise.all([
|
||||
isCustom ? this.getExternalManifest() : this.getApiManifest(),
|
||||
api.fetchAll([
|
||||
['GET', { uri: 'domains' }],
|
||||
['GET', { uri: 'domains/main', storeKey: 'main_domain' }],
|
||||
['GET', { uri: 'users' }]
|
||||
])
|
||||
]).then((responses) => this.formatManifestData(responses[0]))
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue