mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 06:16:08 +01:00
lunch container done
This commit is contained in:
@@ -1177,18 +1177,33 @@ class ContainerManager(multi.Thread):
|
||||
|
||||
|
||||
name = data['name']
|
||||
WPusername = data['WPusername']
|
||||
WPemail = data['WPemail']
|
||||
WPpasswd = data['WPpasswd']
|
||||
|
||||
dockersite = DockerSites.objects.get(SiteName=name)
|
||||
#-------------------------delete or create docker site wala function call krna hai dekh kr kya kya data pass ho ga
|
||||
# passdata = {}
|
||||
# passdata["JobID"] = None
|
||||
# passdata['name'] = name
|
||||
# passdata['numberOfLines'] = 50
|
||||
# da = Docker_Sites(None, passdata)
|
||||
# retdata = da.ContainerLogs()
|
||||
|
||||
passdata ={}
|
||||
data['JobID'] = ''
|
||||
data['Domain'] = dockersite.admin.domain
|
||||
data['domain'] = dockersite.admin.domain
|
||||
data['WPemal'] = WPemail
|
||||
data['Owner'] = dockersite.admin.admin.userName
|
||||
data['userID'] = userID
|
||||
data['MysqlCPU'] = dockersite.CPUsMySQL
|
||||
data['MYsqlRam'] = dockersite.MemoryMySQL
|
||||
data['SiteCPU'] = dockersite.CPUsSite
|
||||
data['SiteRam'] = dockersite.MemorySite
|
||||
data['sitename'] = dockersite.SiteName
|
||||
data['WPusername'] = WPusername
|
||||
data['WPpasswd'] = WPpasswd
|
||||
data['externalApp'] = dockersite.admin.externalApp
|
||||
|
||||
da = Docker_Sites(None, passdata)
|
||||
da.RebuildApp()
|
||||
|
||||
|
||||
data_ret = {'status': 1, 'error_message': 'None', 'data':"retdata"}
|
||||
data_ret = {'status': 1, 'error_message': 'None',}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
@@ -10534,6 +10534,7 @@ app.controller('listDockersite', function ($scope, $http) {
|
||||
|
||||
app.controller('ListDockersitecontainer', function ($scope, $http) {
|
||||
$scope.conatinerview = true
|
||||
$scope.cyberPanelLoading = true;
|
||||
$scope.getcontainer = function () {
|
||||
url = "/docker/getDockersiteList";
|
||||
|
||||
@@ -10575,7 +10576,7 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
|
||||
|
||||
$scope.getcontainer()
|
||||
|
||||
$scope.Lunchcontainer = function (containerid){
|
||||
$scope.Lunchcontainer = function (containerid) {
|
||||
// $scope.listcontainerview = true
|
||||
var url = "/docker/getContainerAppinfo";
|
||||
|
||||
@@ -10602,7 +10603,7 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
|
||||
$scope.cid = response.data.data[1].id
|
||||
$scope.appcpuUsage = 5
|
||||
$scope.appmemoryUsage = 9
|
||||
$scope.name = response.data.data[1].name
|
||||
$scope.cName = response.data.data[1].name
|
||||
$scope.port = response.data.data[1].name
|
||||
$scope.getcontainerlog(containerid)
|
||||
} else {
|
||||
@@ -10626,7 +10627,7 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
|
||||
}
|
||||
|
||||
|
||||
$scope.getcontainerlog = function (containerid){
|
||||
$scope.getcontainerlog = function (containerid) {
|
||||
// $scope.listcontainerview = true
|
||||
|
||||
var url = "/docker/getContainerApplog";
|
||||
@@ -10677,11 +10678,15 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
|
||||
}
|
||||
|
||||
|
||||
$scope.recreateappcontainer = function (){
|
||||
$scope.recreateappcontainer = function () {
|
||||
$scope.cyberPanelLoading = false;
|
||||
var url = "/docker/recreateappcontainer";
|
||||
|
||||
var data = {
|
||||
'name': $('#sitename').html(),
|
||||
'WPusername': $scope.WPUsername,
|
||||
'WPemail': $scope.adminEmail,
|
||||
'WPpasswd': $scope.WPPassword,
|
||||
};
|
||||
|
||||
var config = {
|
||||
@@ -10695,13 +10700,15 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
|
||||
|
||||
function ListInitialData(response) {
|
||||
$scope.conatinerview = false
|
||||
$scope.logs = response.data.data[1];
|
||||
$scope.cyberPanelLoading = true;
|
||||
|
||||
$scope.getcontainer()
|
||||
|
||||
|
||||
if (response.data.status === 1) {
|
||||
new PNotify({
|
||||
title: 'Success!',
|
||||
text: 'Container info fetched.',
|
||||
text: 'Container recreated',
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
@@ -10716,6 +10723,8 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
|
||||
}
|
||||
|
||||
function cantLoadInitialData(response) {
|
||||
$scope.cyberPanelLoading = true;
|
||||
|
||||
new PNotify({
|
||||
title: 'Operation Failed!',
|
||||
text: 'Connect disrupted, refresh the page.',
|
||||
@@ -10723,4 +10732,141 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$scope.refreshStatus = function () {
|
||||
url = "/docker/getContainerStatus";
|
||||
var data = {name: $scope.cName};
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
|
||||
function ListInitialData(response) {
|
||||
if (response.data.containerStatus === 1) {
|
||||
console.log(response.data.status);
|
||||
$scope.status = response.data.status;
|
||||
}
|
||||
else {
|
||||
new PNotify({
|
||||
title: 'Unable to complete request',
|
||||
text: response.data.error_message,
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function cantLoadInitialData(response) {
|
||||
PNotify.error({
|
||||
title: 'Unable to complete request',
|
||||
text: "Problem in connecting to server"
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
$scope.cAction = function (action) {
|
||||
$('#actionLoading').show();
|
||||
url = "/docker/doContainerAction";
|
||||
var data = {name: $scope.cName, action: action};
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
|
||||
|
||||
|
||||
function ListInitialData(response) {
|
||||
console.log(response);
|
||||
|
||||
if (response.data.containerActionStatus === 1) {
|
||||
new PNotify({
|
||||
title: 'Success!',
|
||||
text: 'Action completed',
|
||||
type: 'success'
|
||||
});
|
||||
$scope.status = response.data.status;
|
||||
$scope.refreshStatus()
|
||||
}
|
||||
else {
|
||||
new PNotify({
|
||||
title: 'Unable to complete request',
|
||||
text: response.data.error_message,
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
}
|
||||
$('#actionLoading').hide();
|
||||
}
|
||||
|
||||
function cantLoadInitialData(response) {
|
||||
PNotify.error({
|
||||
title: 'Unable to complete request',
|
||||
text: "Problem in connecting to server"
|
||||
});
|
||||
$('#actionLoading').hide();
|
||||
}
|
||||
|
||||
};
|
||||
$scope.cRemove = function () {
|
||||
(new PNotify({
|
||||
title: 'Confirmation Needed',
|
||||
text: 'Are you sure?',
|
||||
icon: 'fa fa-question-circle',
|
||||
hide: false,
|
||||
confirm: {
|
||||
confirm: true
|
||||
},
|
||||
buttons: {
|
||||
closer: false,
|
||||
sticker: false
|
||||
},
|
||||
history: {
|
||||
history: false
|
||||
}
|
||||
})).get().on('pnotify.confirm', function () {
|
||||
$('#actionLoading').show();
|
||||
|
||||
url = "/docker/delContainer";
|
||||
var data = {name: $scope.cName, unlisted: false};
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
|
||||
function ListInitialData(response) {
|
||||
if (response.data.delContainerStatus === 1) {
|
||||
new PNotify({
|
||||
title: 'Container deleted!',
|
||||
text: 'Redirecting...',
|
||||
type: 'success'
|
||||
});
|
||||
window.location.href = '/docker/listContainers';
|
||||
}
|
||||
else {
|
||||
new PNotify({
|
||||
title: 'Unable to complete request',
|
||||
text: response.data.error_message,
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
$('#actionLoading').hide();
|
||||
}
|
||||
|
||||
function cantLoadInitialData(response) {
|
||||
PNotify.error({
|
||||
title: 'Unable to complete request',
|
||||
text: "Problem in connecting to server"
|
||||
});
|
||||
$('#actionLoading').hide();
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
})
|
||||
@@ -39,9 +39,9 @@
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Launch</th>
|
||||
{# <th>Owner</th>#}
|
||||
{# <th>Image</th>#}
|
||||
{# <th>Tag</th>#}
|
||||
{# <th>Owner</th>#}
|
||||
{# <th>Image</th>#}
|
||||
{# <th>Tag</th>#}
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -52,14 +52,14 @@
|
||||
<td ng-click="Lunchcontainer(web.id)"><img width="30px" height="30" class=""
|
||||
src="{% static 'baseTemplate/assets/image-resources/webPanel.png' %}">
|
||||
</td>
|
||||
{# <td ng-bind="web.admin"></td>#}
|
||||
{# <td ng-bind="web.image"></td>#}
|
||||
{# <td ng-bind="web.tag"></td>#}
|
||||
{# <td ng-bind="web.admin"></td>#}
|
||||
{# <td ng-bind="web.image"></td>#}
|
||||
{# <td ng-bind="web.tag"></td>#}
|
||||
<td>
|
||||
<button class="btn btn-primary" ng-click="delContainer(web.name)"><i
|
||||
class="fa fa-trash btn-icon"></i></button>
|
||||
{# <button class="btn btn-primary" ng-click="showLog(web.name)"><i#}
|
||||
{# class="fa fa-file btn-icon"></i></button>#}
|
||||
{# <button class="btn btn-primary" ng-click="showLog(web.name)"><i#}
|
||||
{# class="fa fa-file btn-icon"></i></button>#}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -195,12 +195,20 @@
|
||||
</div>
|
||||
</div>
|
||||
<div ng-hide="conatinerview">
|
||||
<div >
|
||||
<div class="container">
|
||||
<div>
|
||||
|
||||
|
||||
<div id="page-title">
|
||||
<h2 id="domainNamePage">{% trans "Currently managing: " %} {$ cName $}
|
||||
<button class="btn btn-warning pull-right" data-toggle="modal"
|
||||
data-target="#Recreatedockerapp"><i
|
||||
class="fa fa-refresh btn-icon"></i> Recreate
|
||||
</button>
|
||||
</h2>
|
||||
<p>
|
||||
{% trans "Container ID" %}: {$ cid $}
|
||||
</p>
|
||||
|
||||
<div id="page-title" ng-init="cName='{{ name }}'">
|
||||
{# <h2 id="domainNamePage">{% trans "Manage Container" %}</h2>#}
|
||||
<p>{% trans "Currently managing: " %} {$ name $}</p>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -251,58 +259,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
<div class="example-box-wrapper">
|
||||
{% trans "Container ID" %}: {$ cid $}
|
||||
<br>
|
||||
{% trans "Image" %}: {{ image }}
|
||||
<span ng-show="'{{ image }}' == 'unknown:unknown'"
|
||||
title="Actions involving container recreation cannot be executed">
|
||||
<i class="fa fa-warning btn-icon"></i>
|
||||
</span>
|
||||
<br>
|
||||
{% if ports %}
|
||||
{% trans "Ports" %}: <br>
|
||||
{% for iport, eport in ports.items %}
|
||||
{{ iport }} {% trans "to" %} {{ eport }}<br>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
{# <button class="btn btn-warning" data-toggle="modal"#}
|
||||
{# data-target="#settings"><i#}
|
||||
{# class="fa fa-gear btn-icon"></i> Settings#}
|
||||
{# </button>#}
|
||||
<button class="btn btn-warning" ng-click="recreateappcontainer()"><i
|
||||
class="fa fa-refresh btn-icon"></i> Recreate
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
<div class="panel panel-body">
|
||||
|
||||
<h3 class="content-box-header">
|
||||
{% trans "Actions" %}
|
||||
</h3>
|
||||
|
||||
|
||||
<div class="content-box-wrapper">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
@@ -314,7 +270,8 @@
|
||||
<b>Status:</b> <span ng-bind="status"></span>
|
||||
<span ng-click='refreshStatus()' style="cursor:pointer;"
|
||||
class="pull-right"
|
||||
title="Refresh status"><i class="fa fa-refresh btn-icon"></i></span>
|
||||
title="Refresh status"><i
|
||||
class="fa fa-refresh btn-icon"></i></span>
|
||||
<hr>
|
||||
<button ng-disabled="status=='running'" class="btn btn-primary"
|
||||
ng-click="cAction('start')"><i
|
||||
@@ -336,33 +293,76 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
<div class="example-box-wrapper">
|
||||
<h3 class="title-hero" ng-init="rPolicy='{{ restartPolicy }}'">Other
|
||||
Actions</h3>
|
||||
<b>Restart on system reboot:</b> <span ng-bind="rPolicy"></span>
|
||||
<hr>
|
||||
<a href="/docker/exportContainer/?name={{ name }}"
|
||||
class="btn btn-primary">Export
|
||||
file</a>
|
||||
<button class="btn btn-primary" ng-disabled="loadingTop"
|
||||
ng-click="showTop()">
|
||||
View Process
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="Recreatedockerapp" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close"
|
||||
data-dismiss="modal">×
|
||||
</button>
|
||||
<h4 class="modal-title">{% trans "Backup logs" %} <img
|
||||
ng-hide="cyberPanelLoading"
|
||||
src="{% static 'images/loading.gif' %}">
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form name="websiteCreationForm" action="/"
|
||||
id="createPackages"
|
||||
class="form-horizontal bordered-row panel-body">
|
||||
<div ng-hide="installationDetailsForm"
|
||||
class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Username" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="Username" type="text"
|
||||
class="form-control"
|
||||
ng-model="WPUsername"
|
||||
required>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-hide="installationDetailsForm"
|
||||
class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Email" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="email" name="email"
|
||||
class="form-control"
|
||||
ng-model="adminEmail" required>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-hide="installationDetailsForm"
|
||||
class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Password" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="password" type="password"
|
||||
class="form-control"
|
||||
ng-model="WPPassword"
|
||||
required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-warning"
|
||||
ng-click="recreateappcontainer()"> Recreate
|
||||
</button>
|
||||
<button class="btn btn-default"
|
||||
data-dismiss="modal"> Close
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
|
||||
@@ -109,6 +109,29 @@
|
||||
class="form-horizontal bordered-row panel-body">
|
||||
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select Package" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-model="packageForWebsite" class="form-control">
|
||||
{% for items in packageList %}
|
||||
<option>{{ items }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select Owner" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-model="websiteOwner" class="form-control">
|
||||
{% for items in owernList %}
|
||||
<option>{{ items }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>
|
||||
<div class="col-sm-6">
|
||||
@@ -158,7 +181,9 @@
|
||||
OpenLiteSpeed + Apache (Backend) (For Ubuntu 22 and AlmaLinux 8)
|
||||
{% else %}
|
||||
<input ng-model="apacheBackend" type="checkbox" value="" disabled>
|
||||
OpenLiteSpeed + Apache (Backend) (For Ubuntu 22 and AlmaLinux 8) - <strong><a href="https://go.cyberpanel.net/ApacheRev">Premium Feature</a> <i class="p fa fa-external-link btn-icon"> </i></strong>
|
||||
OpenLiteSpeed + Apache (Backend) (For Ubuntu 22 and AlmaLinux 8) -
|
||||
<strong><a href="https://go.cyberpanel.net/ApacheRev">Premium Feature</a> <i
|
||||
class="p fa fa-external-link btn-icon"> </i></strong>
|
||||
{% endif %}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user