From 9de1ac02813095ec7b14025fd68dfeb4a80228ae Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 29 Oct 2023 15:13:51 +0100 Subject: [PATCH] appgenerator: rework the main form structure to have something matching the manifest structure: GeneralInfos, UpstreamInfos, IntegrationInfos, InstallQuestions, Resources --- tools/app_generator/app_generator.py | 358 ++++++++++------------- tools/app_generator/templates/index.html | 188 +++++++----- 2 files changed, 259 insertions(+), 287 deletions(-) diff --git a/tools/app_generator/app_generator.py b/tools/app_generator/app_generator.py index 5ed5d6a2..98325aec 100644 --- a/tools/app_generator/app_generator.py +++ b/tools/app_generator/app_generator.py @@ -40,10 +40,6 @@ from flask_cors import CORS from urllib import parse from secrets import token_urlsafe -#### GLOBAL VARIABLES -YOLOGEN_VERSION = "0.7.5" -GENERATOR_DICT = {"GENERATOR_VERSION": YOLOGEN_VERSION} - #### Create FLASK and Jinja Environments app = Flask(__name__) app.config["SECRET_KEY"] = token_urlsafe(16) # Necessary for the form CORS @@ -175,56 +171,32 @@ class Form_Python(FlaskForm): }, ) +class GeneralInfos(FlaskForm): -## Manifest form -# Dependencies form -class DependenciesForm(FlaskForm): - auto_update = BooleanField( - "Activer le robot de mise à jour automatiques  :", - default=False, + app_id = StringField( + Markup( + """Identifiant (id) de l'application (en minuscule et sans espaces) :""" + ), + validators=[DataRequired(), Regexp("[a-z_1-9]+.*(?(en minuscule et sans espaces) :""" - ), - validators=[DataRequired(), Regexp("[a-z_1-9]+.*(?En mode tutoriel, l'application générée contiendra des commentaires additionnels pour faciliter la compréhension. En version épurée, l'application générée ne contiendra que le minimum nécessaire. -

L'application à empaquetter dans Yunohost

-

Cette partie sert à indiquer comment le logiciel est intégré à Yunohost.

+ +
+ + + +

Informations générales

+ +
{{ main_form.app_name.label }} {{ main_form.app_name()}}
- {{ main_form.app_id.label}} {{ main_form.app_id() }} _ynh + {{ main_form.app_id.label}} {{ main_form.app_id() }}
@@ -264,13 +270,39 @@ height: 2.5em;min-height: 1em; max-height: 4em;flex-grow: 1;box-sizing: border-box;")}}
+ + + + +
+ + +

Informations sur l'upstream

+ +
+

Le terme upstream désigne le projet original qui maintient l'app

+ {{ main_form.license.label}} {{ main_form.license()}}
- -

Intégration

-

Cette partie sert à indiquer comment le logiciel est intégré à Yunohost.

+ {{ main_form.website.label}} {{ main_form.website()}}
+ {{ main_form.demo.label}} {{ main_form.demo()}} +
+ {{ main_form.admindoc.label}} {{ main_form.admindoc()}} +
+ {{ main_form.userdoc.label}} {{ main_form.userdoc()}} +
+ {{ main_form.code.label}} {{ main_form.code()}} +
+ + +
+ + +

Informations sur le paquet et l'intégration dans YunoHost

+ +
{{ main_form.version.label}} {{ main_form.version()}}
{{ main_form.maintainers.label}} {{ main_form.maintainers(style="width: 60%;")}} @@ -285,58 +317,83 @@
{{ main_form.sso.label}} {{ main_form.sso()}}
- -

Informations sur le logiciel

-

Cette partie donne des informations génériques sur le logiciel.

-
- {{ main_form.license.label}} {{ main_form.license()}} -
- {{ main_form.website.label}} {{ main_form.website()}} -
- {{ main_form.demo.label}} {{ main_form.demo()}} -
- {{ main_form.admindoc.label}} {{ main_form.admindoc()}} -
- {{ main_form.userdoc.label}} {{ main_form.userdoc()}} -
- {{ main_form.code.label}} {{ main_form.code()}} +
-

Paramétrage de l'application

-

Cette partie sert à indiquer comment configurer l'application côté Yunohost.

+
-
- Dossier des données - {{ main_form.data_dir.label}} {{ main_form.data_dir()}} + +

Questions à poser pendant l'installation

+ +
+

+ Cette partie sert à indiquer les questions qui devront être posées.
- {{ main_form.data_subdirs.label}} {{ main_form.data_subdirs()}} -
-

+ NB: seules des questions standard sont proposées ici, il faudra éventuellement compléter à la main en + suivant le modèle des autres questions. +

+ + {{ main_form.domain_and_path.label}} {{ main_form.domain_and_path()}} +
+ + {{ main_form.init_main_permission.label}} {{ main_form.init_main_permission()}} +
+ + {{ main_form.init_admin_permission.label}} {{ main_form.init_admin_permission()}} +
+ + {{ main_form.language.label}} {{ main_form.language()}} + + + +
+ + +

Ressources à initialiser

+ +
+

+ Il s'agit d'éléments techniques configurés avant que le "vrai" script d'install de l'app ne soit lancé. Typiquement : créer un user système, télécharger les sources de l'app, initialiser le dossier d'install et de données, installer des dépendances avec apt, créer une base de donnée SQL, ... +

+ + Sources du logiciel +
+ {{ main_form.source_url.label}} {{ main_form.source_url()}} +
+ {{ main_form.sha256sum.label}} {{ main_form.sha256sum()}} +
+ {{ main_form.auto_update.label}} {{ main_form.auto_update()}} +
+
+ + + {{ main_form.system_user.label}} {{ main_form.system_user()}} +
+ + {{ main_form.install_dir.label}} {{ main_form.install_dir()}} +
+ + {{ main_form.data_dir.label}} {{ main_form.data_dir()}} +
+ + {{ main_form.apt_dependencies.label}} {{ main_form.apt_dependencies(style="width:40%;")}} +
+ + {{ main_form.ports.label}} {{ main_form.ports()}} +
+ + {{ main_form.database.label }} {{ main_form.database() }} +
+ +
+ + +

Technologies spécifiques (to be reworked)

+ {{ main_form.supports_change_url.label}} {{ main_form.supports_change_url()}}
- -
- Paramètres de langue -
-
- {{ main_form.language.label}} {{ main_form.language()}} -
-
- {{ main_form.default_language.label}} {{ - main_form.default_language()}} - -
- -
-
- -
- - - {{ main_form.visibility.label}} {{ main_form.visibility()}} -
{{ main_form.use_logrotate.label}} {{ main_form.use_logrotate()}}
@@ -444,33 +501,6 @@ --> -

Questions à poser pendant l'installation

-

Cette partie sert à indiquer les questions qui devront être posées. -
- NB: seules des questions standard sont proposées ici, il faudra éventuellement compléter à la main en - suivant le modèle des autres questions. -

- - {{ main_form.use_whole_domain.label}} {{ main_form.use_whole_domain()}} -
- - -

Source du logiciel et dépendances

- - {{ main_form.source_url.label}} {{ main_form.source_url()}} -
- {{ main_form.sha256sum.label}} {{ main_form.sha256sum()}} -
- {{ main_form.auto_update.label}} {{ main_form.auto_update()}} -
- {{ main_form.dependencies.label}} {{ main_form.dependencies(style="width:40%;")}} -

- - - {{ main_form.use_db.label }} {{ main_form.use_db() }} -
- -

Utilisation de PHP

{{ main_form.use_php.label}} {{ main_form.use_php(onchange="showForm(this, 'PHP')") }}