From 928acec39cb94dc28d378e58a8bd2bcaa0d69fb2 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Wed, 19 Aug 2020 22:06:56 +0500 Subject: [PATCH] finish structure for applications manager page --- .../manageServices/images/elastic-search.png | Bin 0 -> 913 bytes .../static/manageServices/manageServices.js | 6 + .../manageServices/applications.html | 133 +++++++----------- manageServices/views.py | 17 ++- .../manageServices/images/elastic-search.png | Bin 0 -> 913 bytes static/manageServices/manageServices.js | 74 +++++++++- 6 files changed, 139 insertions(+), 91 deletions(-) create mode 100644 manageServices/static/manageServices/images/elastic-search.png create mode 100644 static/manageServices/images/elastic-search.png diff --git a/manageServices/static/manageServices/images/elastic-search.png b/manageServices/static/manageServices/images/elastic-search.png new file mode 100644 index 0000000000000000000000000000000000000000..436db5d27108f2fb9fe449d7c08766c15cbb1326 GIT binary patch literal 913 zcmV;C18)3@P)H$k?3PEWNKQ&OALb|jS2;GbaO%Q)#*v{-Ub>6jUcfOgo@4YF95Q4&uLr~Dcc#Ow* zjK_G4$9M%3TH;UGSqAAX%FIA!1^{65&E7}63v@QFxC+eYpsbO^!#Pqjrz}By0>vkO zsQwum9?Cm7u^X?G08f@+WdyAZgS@Ha>%5Dr>IL4Fm%P>cX!(vp*w0aUk+a_djWKU{ zvV_7{VdDk1ozn1J%@CM7@_?5Kp&2)ZL;HPwj(bpfi7JnnZ7)$BLzMa+X&V5nf$F^Y_`VT@P#nI%IsJ+|gwoO?OXz(I z*|aRSa`xMl8bc<8Ft)f~)}-OV=)y9caqNFi#w(cnUMiIihd*Oqhag&xhys0HU^>`) z<0grn7DY?@1AfBb}A za)u+MdFgZ}5D3!YrPCP|4)7DEP0Z82hpR~(m{;RCt^%*N)(%4~ogZ^ZT^91g_WA{DAE1dh@ z_gLKCTH5|fXiZ0TrPaC;n!IFow>|id+^$#aN<4zC$7(lei|CXVZ)EoFmj$A!WzuTL z>YVNhfdVg?-E~gAUfS6r{r(I(8hWgDwM&ahTQu2tN`>;^jm-LDQMGvh;MDVDbxkS= z2cruVcmUuLY@~%vWxT(+m0I5;Dr_^F{mre4>nFCM%%5C$ho&Ssi_z9&wGTQP@@3{s zW_R78saMiQ?muPJXnplLwFFWlwLiJ;nF}gz7)FiOYdhx6xuKK2G5BK9$wcgFV(kF4 zSaFF*w0Q&@u8EBJg=lemYcdh@ClkTc=HJe<&1iNSjP44d-BgZ!0jl2j{K@tGgJmhk ngJRcN#$!CjV?4(D?|I(VV literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..436db5d27108f2fb9fe449d7c08766c15cbb1326 GIT binary patch literal 913 zcmV;C18)3@P)H$k?3PEWNKQ&OALb|jS2;GbaO%Q)#*v{-Ub>6jUcfOgo@4YF95Q4&uLr~Dcc#Ow* zjK_G4$9M%3TH;UGSqAAX%FIA!1^{65&E7}63v@QFxC+eYpsbO^!#Pqjrz}By0>vkO zsQwum9?Cm7u^X?G08f@+WdyAZgS@Ha>%5Dr>IL4Fm%P>cX!(vp*w0aUk+a_djWKU{ zvV_7{VdDk1ozn1J%@CM7@_?5Kp&2)ZL;HPwj(bpfi7JnnZ7)$BLzMa+X&V5nf$F^Y_`VT@P#nI%IsJ+|gwoO?OXz(I z*|aRSa`xMl8bc<8Ft)f~)}-OV=)y9caqNFi#w(cnUMiIihd*Oqhag&xhys0HU^>`) z<0grn7DY?@1AfBb}A za)u+MdFgZ}5D3!YrPCP|4)7DEP0Z82hpR~(m{;RCt^%*N)(%4~ogZ^ZT^91g_WA{DAE1dh@ z_gLKCTH5|fXiZ0TrPaC;n!IFow>|id+^$#aN<4zC$7(lei|CXVZ)EoFmj$A!WzuTL z>YVNhfdVg?-E~gAUfS6r{r(I(8hWgDwM&ahTQu2tN`>;^jm-LDQMGvh;MDVDbxkS= z2cruVcmUuLY@~%vWxT(+m0I5;Dr_^F{mre4>nFCM%%5C$ho&Ssi_z9&wGTQP@@3{s zW_R78saMiQ?muPJXnplLwFFWlwLiJ;nF}gz7)FiOYdhx6xuKK2G5BK9$wcgFV(kF4 zSaFF*w0Q&@u8EBJg=lemYcdh@ClkTc=HJe<&1iNSjP44d-BgZ!0jl2j{K@tGgJmhk ngJRcN#$!CjV?4(D?|I(VV literal 0 HcmV?d00001 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