-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
362 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,102 @@ | ||
<div class="text-center"> | ||
<p style="padding: 0 0 2em;"> | ||
<a href="{$serviceurl}" target="_blank" class="btn btn-default">{$LANG.GOTO_PANEL}</a> | ||
</p> | ||
<h5 class="text-center" style="padding: 0 0 1em;">{$serverIp}</h5> | ||
<h4 class="text-center" style="padding: 0 0 1em;">{$LANG.QUICK_ACTIONS_PANEL}</h4> | ||
<!-- Your HTML Buttons using Smarty variables --> | ||
<button id="startButton" | ||
onclick="if (confirm('Are you sure you want to start this server?')) sendRequest('{$starturl}')" | ||
class="btn btn-success" style="margin-bottom: 0.3em;" {if $current_state === 'online'} disabled{/if}><i | ||
class="fas fa-play"></i> {$LANG.SERVER_START_PANEL}</button> | ||
<button id="rebootButton" | ||
onclick="if (confirm('Are you sure you want to reboot this server?')) sendRequest('{$rebooturl}')" | ||
class="btn btn-warning" style="margin-bottom: 0.3em;" {if $current_state === 'offline'} disabled{/if}><i | ||
class="fas fa-sync"></i> {$LANG.SERVER_RESTART_PANEL}</button> | ||
<button id="stopButton" | ||
onclick="if (confirm('Are you sure you want to stop this server?')) sendRequest('{$stopurl}')" | ||
class="btn btn-danger" style="margin-bottom: 0.3em;" {if $current_state === 'offline'} disabled{/if}><i | ||
class="fas fa-stop"></i> {$LANG.SERVER_STOP_PANEL}</button> | ||
|
||
{if $serverFound == false} | ||
<p class="alert alert-warning">{$LANG.SERVER_NOT_FOUND}</p> | ||
{else} | ||
<p class="margin-top-bottom"> | ||
<a href="{$serviceUrl}" target="_blank" class="btn btn-default">{$LANG.GOTO_PANEL}</a> | ||
</p> | ||
<div class="row mb-3 mb-5"> | ||
<div class="col-md-6"> | ||
<label>Server ID</label> | ||
<input | ||
class="form-control text-center copy-text" | ||
aria-label="serverId" | ||
type="text" | ||
id="change-text-id" | ||
data-id="change-text-id" | ||
data-new-text="{$LANG.ID_COPIED}" | ||
data-clipboard-text="{$serverId}" | ||
value="{$serverId}" | ||
readonly> | ||
</div> | ||
<div class="col-md-6"> | ||
<label>Server IP</label> | ||
<input | ||
class="form-control text-center copy-text" | ||
id="change-text-ip" | ||
data-id="change-text-ip" | ||
data-new-text="{$LANG.IP_COPIED}" | ||
data-clipboard-text="{$serverIp}" | ||
value="{$serverIp}" readonly> | ||
</div> | ||
</div> | ||
<h2 class="mb-3">{$LANG.QUICK_ACTIONS_PANEL}</h2> | ||
<!-- Your HTML Buttons using Smarty variables --> | ||
<button id="startButton" | ||
onclick="if (confirm('Are you sure you want to start this server?')) sendRequest('{$startUrl}')" | ||
class="btn btn-success" {if $current_state === 'online'} disabled{/if}><i | ||
class="fas fa-play"></i> {$LANG.SERVER_START_PANEL}</button> | ||
<button id="rebootButton" | ||
onclick="if (confirm('Are you sure you want to reboot this server?')) sendRequest('{$rebootUrl}')" | ||
class="btn btn-warning" {if $current_state === 'offline'} disabled{/if}><i | ||
class="fas fa-sync"></i> {$LANG.SERVER_RESTART_PANEL}</button> | ||
<button id="stopButton" | ||
onclick="if (confirm('Are you sure you want to stop this server?')) sendRequest('{$stopUrl}')" | ||
class="btn btn-danger" {if $current_state === 'offline'} disabled{/if}><i | ||
class="fas fa-stop"></i> {$LANG.SERVER_STOP_PANEL}</button> | ||
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#ftpDetails"> | ||
FTP Details | ||
</button> | ||
<!-- The modal --> | ||
<div class="modal fade" id="ftpDetails" tabindex="-1" role="dialog" aria-labelledby="modalLabel" | ||
aria-hidden="true"> | ||
<div class="modal-dialog" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h4 class="modal-title" id="modalLabel"> | ||
{$LANG.SERVER_FTP_INFORMATION} | ||
</h4> | ||
</div> | ||
<div class="modal-body"> | ||
<div class="alert alert-warning" role="alert"> | ||
{$LANG.SERVER_FTP_PASSWORD_INFORMATION} | ||
</div> | ||
<!-- FTP Host + Port --> | ||
<div class="mb-3"> | ||
<label for="ftpHost" class="form-label"> | ||
{$LANG.SERVER_FTP_HOST_AND_PORT} | ||
</label> | ||
<input type="text" class="form-control copy-text" | ||
data-id="ftpHost" | ||
data-new-text="{$LANG.SERVER_FTP_HOST_COPIED}" | ||
data-clipboard-text="{$ftpDetails['username']}" | ||
id="ftpHost" | ||
value="{$ftpDetails['host']}" readonly> | ||
</div> | ||
<!-- FTP Username --> | ||
<div class="mb-3"> | ||
<label for="ftpUsername" class="form-label"> | ||
{$LANG.SERVER_FTP_USERNAME} | ||
</label> | ||
<input type="text" class="form-control copy-text" | ||
data-id="ftpUsername" | ||
data-new-text="{$LANG.SERVER_FTP_USERNAME_COPIED}" | ||
data-clipboard-text="{$ftpDetails['username']}" | ||
id="ftpUsername" | ||
value="{$ftpDetails['username']}" readonly> | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-danger" data-dismiss="modal"> | ||
{$LANG.close} | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{/if} | ||
</div> | ||
|
||
<script> | ||
let currentState = "{$current_state}"; | ||
const serverStateUrl = "{$getstateurl}" | ||
let currentState = "{$currentState}"; | ||
const serverStateUrl = "{$getStateUrl}" | ||
</script> | ||
{literal} | ||
<script> | ||
function disableButtons(state) { | ||
var startButton = $('#startButton'); | ||
var rebootButton = $('#rebootButton'); | ||
var stopButton = $('#stopButton'); | ||
currentState = state; | ||
switch (state) { | ||
case "running": | ||
startButton.prop('disabled', true); | ||
rebootButton.prop('disabled', false); | ||
stopButton.prop('disabled', false); | ||
break; | ||
case "offline": | ||
startButton.prop('disabled', false); | ||
rebootButton.prop('disabled', true); | ||
stopButton.prop('disabled', true); | ||
break; | ||
case "starting": | ||
case "stopping": | ||
startButton.prop('disabled', true); | ||
rebootButton.prop('disabled', true); | ||
stopButton.prop('disabled', true); | ||
break; | ||
default: | ||
startButton.prop('disabled', true); | ||
rebootButton.prop('disabled', true); | ||
stopButton.prop('disabled', true); | ||
break; | ||
} | ||
} | ||
|
||
|
||
function sendRequest(url) { | ||
disableButtons('request') | ||
var $button = $(event.currentTarget); | ||
var originalHtml = $button.html(); | ||
$button.html('<i class="fas fa-spinner fa-spin"></i> ' + originalHtml); | ||
$.post(url, function (data, status) { | ||
disableButtons(data.state) | ||
const interval = setInterval(function () { | ||
$.post(serverStateUrl, function (data, status) { | ||
if (data.state === 'running') { | ||
$button.html(originalHtml); // Restore original content after completion | ||
clearInterval(interval) | ||
} | ||
disableButtons(data.state) | ||
}) | ||
}, 2000); | ||
}); | ||
} | ||
|
||
$(document).ready(function () { | ||
disableButtons(currentState) | ||
}); | ||
</script> | ||
{/literal} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#divModuleSettings .module-settings .select-inline, | ||
#divModuleSettings .module-settings .select2-container--default | ||
{ | ||
width: 300px; | ||
max-width: 300px; | ||
} | ||
#divModuleSettings .module-settings .fieldarea{ | ||
width: 25%; | ||
} | ||
#divModuleSettings .module-settings textarea{ | ||
width: 327px; | ||
height: 75px; | ||
} | ||
|
||
|
||
.ptero-content{ | ||
min-width: 450px; | ||
} | ||
|
||
.mb-3{ | ||
margin-bottom: 20px; | ||
} |
Oops, something went wrong.