diff --git a/orchestra/contrib/musician/forms.py b/orchestra/contrib/musician/forms.py
index e7e9937e..d6dfd3bd 100644
--- a/orchestra/contrib/musician/forms.py
+++ b/orchestra/contrib/musician/forms.py
@@ -9,6 +9,7 @@ from orchestra.contrib.domains.models import Domain, Record
from orchestra.contrib.mailboxes.models import Address, Mailbox
from orchestra.contrib.systemusers.models import WebappUsers, SystemUser
from orchestra.contrib.musician.validators import ValidateZoneMixin
+from orchestra.contrib.webapps.models import WebApp, WebAppOption
from . import api
@@ -201,3 +202,20 @@ class SystemUsersChangePasswordForm(ChangePasswordForm):
class Meta:
fields = ("password",)
model = SystemUser
+
+class WebappOptionCreateForm(forms.ModelForm):
+
+ class Meta:
+ model = WebAppOption
+ fields = ("name", "value")
+
+ def __init__(self, *args, **kwargs):
+ self.webapp = kwargs.pop('webapp')
+ super().__init__(*args, **kwargs)
+
+ def save(self, commit=True):
+ instance = super().save(commit=False)
+ instance.webapp = self.webapp
+ if commit:
+ super().save(commit=True)
+ return instance
\ No newline at end of file
diff --git a/orchestra/contrib/musician/templates/musician/webapp_detail.html b/orchestra/contrib/musician/templates/musician/webapp_detail.html
new file mode 100644
index 00000000..7b35c0d1
--- /dev/null
+++ b/orchestra/contrib/musician/templates/musician/webapp_detail.html
@@ -0,0 +1,42 @@
+{% extends "musician/base.html" %}
+{% load i18n %}
+
+{% block content %}
+{% trans "Go back" %}
+
+
+ {% trans "PHP settings for" %} {{ object.name }}
+
+
+
+{% trans "PHP settings page description." %}
+
+
+
+
+
+
+
+
+
+ {% trans "Type" %} |
+ {% trans "Value" %} |
+ |
+
+
+
+ {% for option in object.options.all %}
+
+ {{ option.name }} |
+ {{ option.value }} |
+
+
+
+ |
+
+ {% endfor %}
+
+
+{% trans "Add new option" %}
+
+{% endblock %}
diff --git a/orchestra/contrib/musician/templates/musician/webapp_form.html b/orchestra/contrib/musician/templates/musician/webapp_form.html
new file mode 100644
index 00000000..0e8ff78c
--- /dev/null
+++ b/orchestra/contrib/musician/templates/musician/webapp_form.html
@@ -0,0 +1,20 @@
+{% extends "musician/base.html" %}
+{% load bootstrap4 i18n %}
+
+{% block content %}
+{{ service.verbose_name }}
+
+
+{% endblock %}
diff --git a/orchestra/contrib/musician/templates/musician/webapp_list.html b/orchestra/contrib/musician/templates/musician/webapp_list.html
new file mode 100644
index 00000000..4709f7ea
--- /dev/null
+++ b/orchestra/contrib/musician/templates/musician/webapp_list.html
@@ -0,0 +1,57 @@
+{% extends "musician/base.html" %}
+{% load bootstrap4 i18n %}
+
+{% block content %}
+
+
+ Una Webapp es el diectorio donde se almacena su web,
+ mediante SFTP podras acceder a este directorio y subir/editar/eliminar los archivos
+
+
+ Cada Webapp tiene su propio usuario SFTP, este se creara automaticamente al crear la Webapp
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% trans "Name" %} |
+ {% trans "Type" %} |
+ {% trans "Version" %} |
+ {% trans "SFTP User" %} |
+ {% trans "Server" %} |
+ |
+
+
+
+ {% for webapp in object_list %}
+
+ {{ webapp.name }} |
+ {{ webapp.type }} |
+ {{ webapp.type_instance.get_detail }} |
+
+ {% if webapp.sftpuser %}
+ {{ webapp.sftpuser }}
+ {% else %}
+ {{ webapp.account.main_systemuser }}
+ {% endif %}
+ |
+ {{ webapp.target_server }} |
+
+
+
+ |
+
+ {% endfor %}
+
+ {% include "musician/components/table_paginator.html" %}
+
+
+{% endblock %}
diff --git a/orchestra/contrib/musician/templates/musician/webapp_option_form.html b/orchestra/contrib/musician/templates/musician/webapp_option_form.html
new file mode 100644
index 00000000..4ca2390c
--- /dev/null
+++ b/orchestra/contrib/musician/templates/musician/webapp_option_form.html
@@ -0,0 +1,20 @@
+{% extends "musician/base.html" %}
+{% load bootstrap4 i18n %}
+
+{% block content %}
+{% trans "Go back" %}
+
+
+ {% if form.instance.pk %}{% trans "Update record of" %}{% else %}{% trans "Add record to" %}{% endif %}
+ {{ form.webapp.name }}
+
+
+
+{% endblock %}
diff --git a/orchestra/contrib/musician/templates/musician/webappoption_check_delete.html b/orchestra/contrib/musician/templates/musician/webappoption_check_delete.html
new file mode 100644
index 00000000..9126ab78
--- /dev/null
+++ b/orchestra/contrib/musician/templates/musician/webappoption_check_delete.html
@@ -0,0 +1,13 @@
+{% extends "musician/base.html" %}
+{% load i18n %}
+
+{% block content %}
+
+{% endblock %}
diff --git a/orchestra/contrib/musician/templates/musician/website_list.html b/orchestra/contrib/musician/templates/musician/website_list.html
new file mode 100644
index 00000000..ea2f2b1e
--- /dev/null
+++ b/orchestra/contrib/musician/templates/musician/website_list.html
@@ -0,0 +1,103 @@
+{% extends "musician/base.html" %}
+{% load bootstrap4 i18n %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+
+
+
+ {% trans "Name" %} |
+ {% trans "Url" %} |
+ {% trans "Server" %} |
+ {% trans "Is active?" %} |
+ |
+
+
+
+ {% for website in object_list %}
+
+ {{ website.name }} |
+
+ {% for domain in website.domains.all %}
+ {{ website.get_protocol }}://{{ domain }}
+ {% endfor %}
+ |
+ {{ website.target_server }} |
+
+
+ {{ website.is_active|yesno }}
+ |
+
+
+
+ |
+
+
+
+
+
+
+ {% for content in website.content_set.all %}
+
+ Webapp Dir |
+ /home/{{ content.webapp.account }}/webapps/{{ content.webapp }} |
+
+
+
+ |
+
+
+ Url |
+ {% if website.domains.first %}
+
+ {{ website.get_protocol }}://{{ website.domains.first }}{{ content.path }}
+ |
+ {% else %}
+ |
+ {% endif %}
+ |
+
+
+ Type |
+ {% if content.webapp.type == "php" %}
+ PHP {{ content.webapp.type_instance.get_detail }} |
+ {% else %}
+ {{ content.webapp.type }} |
+ {% endif %}
+ |
+
+
+ {% if content.webapp.sftpuser %}
+ SFTP user |
+ {{ content.webapp.sftpuser }} |
+
+
+ {% trans "Update password" %}
+ |
+ {% else %}
+ FTP user |
+ {{ content.webapp.account.main_systemuser }} |
+
+
+ {% trans "Update password" %}
+ |
+ {% endif %}
+
+ {% endfor %}
+
+
+ |
+
+ {% endfor %}
+
+ {% include "musician/components/table_paginator.html" %}
+
+
+{% endblock %}
diff --git a/orchestra/contrib/musician/urls.py b/orchestra/contrib/musician/urls.py
index c0250880..fb626bbd 100644
--- a/orchestra/contrib/musician/urls.py
+++ b/orchestra/contrib/musician/urls.py
@@ -45,4 +45,9 @@ urlpatterns = [
path('systemusers/', views.SystemUserListView.as_view(), name='systemuser-list'),
path('systemuser//change-password/', views.SystemUserChangePasswordView.as_view(), name='systemuser-password'),
path('websites/', views.WebsiteListView.as_view(), name='website-list'),
+
+ path('webapps/', views.WebappListView.as_view(), name='webapp-list'),
+ path('webapps//', views.WebappDetailView.as_view(), name='webapp-detail'),
+ path('webapps//add-option/', views.WebappAddOptionView.as_view(), name='webapp-add-option'),
+ path('webapps//option//delete/', views.WebappDeleteOptionView.as_view(), name='webapp-delete-option'),
]
diff --git a/orchestra/contrib/musician/views.py b/orchestra/contrib/musician/views.py
index fd211128..87559aa0 100644
--- a/orchestra/contrib/musician/views.py
+++ b/orchestra/contrib/musician/views.py
@@ -34,13 +34,14 @@ from orchestra.contrib.resources.models import Resource, ResourceData
from orchestra.contrib.saas.models import SaaS
from orchestra.contrib.systemusers.models import WebappUsers, SystemUser
from orchestra.contrib.websites.models import Website
+from orchestra.contrib.webapps.models import WebApp, WebAppOption
from orchestra.utils.html import html_to_pdf
from .auth import logout as auth_logout
from .forms import (LoginForm, MailboxChangePasswordForm, MailboxCreateForm,
MailboxSearchForm, MailboxUpdateForm, MailForm,
RecordCreateForm, RecordUpdateForm, WebappUsersChangePasswordForm,
- SystemUsersChangePasswordForm)
+ SystemUsersChangePasswordForm, WebappOptionCreateForm)
from .mixins import (CustomContextMixin, ExtendedPaginationMixin,
UserTokenRequiredMixin)
from .models import Address as AddressService
@@ -658,4 +659,49 @@ class WebsiteListView(ServiceListView):
extra_context = {
# Translators: This message appears on the page title
'title': _('Websites'),
- }
\ No newline at end of file
+ }
+
+class WebappListView(ServiceListView):
+ model = WebApp
+ template_name = "musician/webapp_list.html"
+ extra_context = {
+ # Translators: This message appears on the page title
+ 'title': _('Webapps'),
+ }
+
+
+class WebappDetailView(CustomContextMixin, UserTokenRequiredMixin, DetailView):
+ template_name = "musician/webapp_detail.html"
+ extra_context = {
+ # Translators: This message appears on the page title
+ 'title': _('webapp details'),
+ }
+
+ def get_queryset(self):
+ return WebApp.objects.filter(account=self.request.user)
+
+class WebappAddOptionView(CustomContextMixin, UserTokenRequiredMixin, CreateView):
+ model = WebAppOption
+ form_class = WebappOptionCreateForm
+ template_name = "musician/webapp_option_form.html"
+
+ def get_form_kwargs(self):
+ kwargs = super().get_form_kwargs()
+ webapp = get_object_or_404(WebApp, account=self.request.user, pk=self.kwargs["pk"])
+ kwargs['webapp'] = webapp
+ return kwargs
+
+ def get_success_url(self):
+ return reverse_lazy("musician:webapp-detail", kwargs={"pk": self.kwargs["pk"]})
+
+class WebappDeleteOptionView(CustomContextMixin, UserTokenRequiredMixin, DeleteView):
+ model = WebAppOption
+ template_name = "musician/webappoption_check_delete.html"
+ pk_url_kwarg = "option_pk"
+
+ def get_queryset(self):
+ qs = WebAppOption.objects.filter(webapp__account=self.request.user, webapp=self.kwargs["pk"])
+ return qs
+
+ def get_success_url(self):
+ return reverse_lazy("musician:webapp-detail", kwargs={"pk": self.kwargs["pk"]})
\ No newline at end of file