diff --git a/manageServices/static/manageServices/images/elastic-search.png b/manageServices/static/manageServices/images/elastic-search.png new file mode 100644 index 000000000..436db5d27 Binary files /dev/null and b/manageServices/static/manageServices/images/elastic-search.png differ diff --git a/manageServices/static/manageServices/manageServices.js b/manageServices/static/manageServices/manageServices.js index 767039a5e..35c1ec8a0 100755 --- a/manageServices/static/manageServices/manageServices.js +++ b/manageServices/static/manageServices/manageServices.js @@ -483,6 +483,12 @@ app.controller('manageApplications', function ($scope, $http, $timeout, $window) }; + $scope.removeInstall = function (appName, status) { + $scope.status = status; + $scope.appName = appName; + + }; + }); /* Java script code */ \ No newline at end of file diff --git a/manageServices/templates/manageServices/applications.html b/manageServices/templates/manageServices/applications.html index ad7147985..ba62b9645 100755 --- a/manageServices/templates/manageServices/applications.html +++ b/manageServices/templates/manageServices/applications.html @@ -26,106 +26,69 @@
- +
- - - - - - + + - - - - - - - - - + {% for service in services %} + + + + - + + + + {% endfor %}
{% trans "Username" %}{% trans "Websites Limit" %}{% trans "Disk Usage" %}{% trans "ACL" %}{% trans "Owner" %}{% trans "State" %}{% trans "Application" %}{% trans "Status" %} {% trans "Actions" %}
- {% trans 'Suspend' %} - {% trans 'Activate' %} - {% trans 'Edit' %} - {% trans 'Delete' %} +
+

{{ service.name }}

{{ service.installed }} + {% if service.installed == 'Installed' %} + {% trans 'Remove' %} + {% else %} + {% trans 'Install' %} + {% endif %} - -
diff --git a/manageServices/views.py b/manageServices/views.py index e02d776c4..23e071590 100755 --- a/manageServices/views.py +++ b/manageServices/views.py @@ -309,8 +309,23 @@ def manageApplications(request): pass else: return ACLManager.loadError() + + services = [] + + ## ElasticSearch + + esPath = '/home/cyberpanel/elasticsearch' + + if os.path.exists(esPath): + installed = 'Installed' + else: + installed = 'Not-Installed' + + elasticSearch = {'image': '/static/manageServices/images/elastic-search.png', 'name': 'Elastic Search', 'installed': installed} + services.append(elasticSearch) + try: - return render(request, 'manageServices/applications.html', {}) + return render(request, 'manageServices/applications.html', {'services': services}) except BaseException as msg: logging.CyberCPLogFileWriter.writeToFile(str(msg)) return HttpResponse("See CyberCP main log file.") diff --git a/static/manageServices/images/elastic-search.png b/static/manageServices/images/elastic-search.png new file mode 100644 index 000000000..436db5d27 Binary files /dev/null and b/static/manageServices/images/elastic-search.png differ diff --git a/static/manageServices/manageServices.js b/static/manageServices/manageServices.js index b9244c85b..35c1ec8a0 100644 --- a/static/manageServices/manageServices.js +++ b/static/manageServices/manageServices.js @@ -2,7 +2,6 @@ * Created by usman on 6/22/18. */ - /* Java script code */ app.controller('powerDNS', function ($scope, $http, $timeout, $window) { @@ -163,11 +162,8 @@ app.controller('powerDNS', function ($scope, $http, $timeout, $window) { }); - /* Java script code */ - - /* Java script code */ app.controller('postfix', function ($scope, $http, $timeout, $window) { @@ -298,7 +294,6 @@ app.controller('postfix', function ($scope, $http, $timeout, $window) { /* Java script code */ - /* Java script code */ app.controller('pureFTPD', function ($scope, $http, $timeout, $window) { @@ -427,4 +422,73 @@ app.controller('pureFTPD', function ($scope, $http, $timeout, $window) { }); +/* Java script code */ + +/* Java script code */ + +app.controller('manageApplications', function ($scope, $http, $timeout, $window) { + + + $scope.cyberpanelLoading = true; + + $scope.saveStatus = function (service) { + + $scope.cyberpanelLoading = false; + + + url = "/manageservices/saveStatus"; + + var data = { + status: serviceStatus, + service: service + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + $scope.cyberpanelLoading = true; + + if (response.data.status === 1) { + + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = false; + + } + else { + $scope.errorMessage = response.data.error_message; + + $scope.failedToFetch = false; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + } + + } + + function cantLoadInitialDatas(response) { + $scope.serviceLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = false; + $scope.changesApplied = true; + } + + + }; + + $scope.removeInstall = function (appName, status) { + $scope.status = status; + $scope.appName = appName; + + }; + +}); + /* Java script code */ \ No newline at end of file