1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-23 09:32:29 +01:00

Merge pull request #329 from Pterodactyl/feature/new-theme

Some more changes to the new theme
This commit is contained in:
Dane Everitt 2017-03-03 17:33:40 -05:00 committed by GitHub
commit 500cf7fdb3
22 changed files with 10923 additions and 528 deletions

10
.gitignore vendored
View File

@ -1,4 +1,14 @@
/vendor
*.DS_Store*
.env
.vagrant/*
composer.lock
Homestead.yaml
Vagrantfile
Vagrantfile
node_modules
yarn.lock
node_modules

View File

@ -17,9 +17,9 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
$(window).load(function () {
$(document).ready(function () {
Socket.on('console', function (data) {
if (data.line.indexOf('You need to agree to the EULA in order to run the server') > -1) {
if (~data.line.indexOf('You need to agree to the EULA in order to run the server')) {
swal({
title: 'EULA Acceptance',
text: 'By pressing \'I Accept\' below you are indicating your agreement to the <a href="https://account.mojang.com/documents/minecraft_eula" target="_blank">Mojang EULA</a>.',

View File

@ -132,3 +132,24 @@ td.has-progress {
.no-margin {
margin: 0 !important;
}
.position-relative {
position: relative;
}
.terminal-notify {
position: absolute;
right: 10px;
bottom: 10px;
/* Browsers usually have a 17px scrollbar which is visible in the terminal */
padding: 7px 24px 7px 7px;
border-top-left-radius: 3px;
background: white;
color: black;
opacity: .5;
cursor: pointer;
}
.terminal-notify:hover {
opacity: .9;
}

View File

@ -17,6 +17,10 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
var TwoFactorModal = (function () {
function bindListeners() {
$(document).ready(function () {
$('#close_reload').click(function () {
location.reload();
@ -74,3 +78,14 @@ $(document).ready(function () {
});
});
});
}
return {
init: function () {
bindListeners();
}
}
});
TwoFactorModal.init();

View File

@ -17,12 +17,25 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
var Console = (function () {
var CONSOLE_PUSH_COUNT = 50;
var CONSOLE_PUSH_FREQ = 200;
(function initConsole() {
window.TerminalQueue = [];
window.Terminal = $('#terminal').terminal(function (command, term) {
var terminalQueue;
var terminal;
var cpuChart;
var cpuData;
var memoryChart;
var memoryData;
var timeLabels;
var $terminalNotify;
function initConsole() {
terminalQueue = [];
terminal = $('#terminal').terminal(function (command, term) {
Socket.emit('send command', command);
}, {
greetings: '',
@ -37,40 +50,24 @@ var CONSOLE_PUSH_FREQ = 200;
}
});
Socket.on('initial status', function (data) {
Terminal.clear();
if (data.status === 1 || data.status === 2) {
Socket.emit('send server log');
}
});
})();
$terminalNotify = $('#terminalNotify');
$terminalNotify.on('click', function () {
terminal.scroll_to_bottom();
$terminalNotify.addClass('hidden');
})
(function pushOutputQueue() {
if (TerminalQueue.length > CONSOLE_PUSH_COUNT) {
// console throttled warning show
terminal.on('scroll', function () {
if (terminal.is_bottom()) {
$terminalNotify.addClass('hidden');
}
})
}
if (TerminalQueue.length > 0) {
for (var i = 0; i < CONSOLE_PUSH_COUNT && TerminalQueue.length > 0; i++) {
Terminal.echo(TerminalQueue[0]);
TerminalQueue.shift();
}
}
window.setTimeout(pushOutputQueue, CONSOLE_PUSH_FREQ);
})();
$(document).ready(function () {
$('[data-attr="power"]').click(function (event) {
if (! $(this).hasClass('disabled')) {
Socket.emit('set status', $(this).data('action'));
}
});
function initGraphs() {
var ctc = $('#chart_cpu');
var timeLabels = [];
var cpuData = [];
var CPUChart = new Chart(ctc, {
timeLabels = [];
cpuData = [];
cpuChart = new Chart(ctc, {
type: 'line',
data: {
labels: timeLabels,
@ -79,17 +76,17 @@ $(document).ready(function () {
label: "Percent Use",
fill: false,
lineTension: 0.03,
backgroundColor: "#00A1CB",
borderColor: "#00A1CB",
backgroundColor: "#3c8dbc",
borderColor: "#3c8dbc",
borderCapStyle: 'butt',
borderDash: [],
borderDashOffset: 0.0,
borderJoinStyle: 'miter',
pointBorderColor: "rgba(75,192,192,1)",
pointBorderColor: "#3c8dbc",
pointBackgroundColor: "#fff",
pointBorderWidth: 1,
pointHoverRadius: 5,
pointHoverBackgroundColor: "rgba(75,192,192,1)",
pointHoverBackgroundColor: "#3c8dbc",
pointHoverBorderColor: "rgba(220,220,220,1)",
pointHoverBorderWidth: 2,
pointRadius: 1,
@ -114,8 +111,8 @@ $(document).ready(function () {
});
var ctm = $('#chart_memory');
var memoryData = [];
var MemoryChart = new Chart(ctm, {
memoryData = [];
memoryChart = new Chart(ctm, {
type: 'line',
data: {
labels: timeLabels,
@ -124,17 +121,17 @@ $(document).ready(function () {
label: "Memory Use",
fill: false,
lineTension: 0.03,
backgroundColor: "#01A4A4",
borderColor: "#01A4A4",
backgroundColor: "#3c8dbc",
borderColor: "#3c8dbc",
borderCapStyle: 'butt',
borderDash: [],
borderDashOffset: 0.0,
borderJoinStyle: 'miter',
pointBorderColor: "rgba(75,192,192,1)",
pointBorderColor: "#3c8dbc",
pointBackgroundColor: "#fff",
pointBorderWidth: 1,
pointHoverRadius: 5,
pointHoverBackgroundColor: "rgba(75,192,192,1)",
pointHoverBackgroundColor: "#3c8dbc",
pointHoverBorderColor: "rgba(220,220,220,1)",
pointHoverBorderWidth: 2,
pointRadius: 1,
@ -157,6 +154,28 @@ $(document).ready(function () {
}
}
});
}
function addSocketListeners() {
// Update Listings on Initial Status
Socket.on('initial status', function (data) {
updateServerPowerControls(data.status);
terminal.clear();
if (data.status === 1 || data.status === 2) {
Socket.emit('send server log');
}
});
// Update Listings on Status
Socket.on('status', function (data) {
updateServerPowerControls(data.status);
});
Socket.on('console', function (data) {
terminalQueue.push(data.line);
});
Socket.on('proc', function (proc) {
if (cpuData.length > 10) {
cpuData.shift();
@ -171,19 +190,30 @@ $(document).ready(function () {
var m = new Date();
timeLabels.push($.format.date(new Date(), 'HH:mm:ss'));
CPUChart.update();
MemoryChart.update();
cpuChart.update();
memoryChart.update();
});
}
// Update Listings on Initial Status
Socket.on('initial status', function (data) {
updateServerPowerControls(data.status);
});
function pushOutputQueue() {
if (terminalQueue.length > CONSOLE_PUSH_COUNT) {
// console throttled warning show
}
// Update Listings on Status
Socket.on('status', function (data) {
updateServerPowerControls(data.status);
});
if (terminalQueue.length > 0) {
for (var i = 0; i < CONSOLE_PUSH_COUNT && terminalQueue.length > 0; i++) {
terminal.echo(terminalQueue[0]);
terminalQueue.shift();
}
// Show
if (!terminal.is_bottom()) {
$terminalNotify.removeClass('hidden');
}
}
window.setTimeout(pushOutputQueue, CONSOLE_PUSH_FREQ);
}
function updateServerPowerControls (data) {
// Server is On or Starting
@ -203,4 +233,33 @@ $(document).ready(function () {
$('[data-attr="power"][data-action="kill"]').addClass('disabled');
}
}
return {
init: function () {
initConsole();
pushOutputQueue();
initGraphs();
addSocketListeners();
$('[data-attr="power"]').click(function (event) {
if (! $(this).hasClass('disabled')) {
Socket.emit('set status', $(this).data('action'));
}
});
},
getTerminal: function () {
return terminal
},
getTerminalQueue: function () {
return terminalQueue
},
}
})();
$(document).ready(function () {
Console.init();
});

View File

@ -29,15 +29,22 @@ class ActionsClass {
this.element = undefined;
}
folder() {
folder(path) {
let inputValue
if (path) {
inputValue = path
} else {
const nameBlock = $(this.element).find('td[data-identifier="name"]');
const currentName = decodeURIComponent(nameBlock.attr('data-name'));
const currentName = decodeURIComponent(nameBlock.data('name'));
const currentPath = decodeURIComponent(nameBlock.data('path'));
let inputValue = `${currentPath}${currentName}/`;
if ($(this.element).data('type') === 'file') {
inputValue = currentPath;
} else {
inputValue = `${currentPath}${currentName}/`;
}
}
swal({
type: 'input',
title: 'Create Folder',

View File

@ -33,7 +33,7 @@ class ContextMenuClass {
$(document).find('#fileOptionMenu').remove();
if (!_.isNull(this.activeLine)) this.activeLine.removeClass('active');
let newFilePath = $('#headerTableRow').attr('data-currentDir');
let newFilePath = $('#file_listing').data('current-dir');
if (parent.data('type') === 'folder') {
const nameBlock = parent.find('td[data-identifier="name"]');
const currentName = decodeURIComponent(nameBlock.attr('data-name'));

View File

@ -44,6 +44,7 @@ class FileManager {
$('#load_files').slideUp(10).html(data).slideDown(10, () => {
ContextMenu.run();
this.reloadFilesButton();
this.addFolderButton();
if (_.isFunction(next)) {
return next();
}
@ -82,6 +83,12 @@ class FileManager {
});
}
addFolderButton() {
$('i[data-action="add-folder"]').unbind().on('click', () => {
new ActionsClass().folder($('#file_listing').data('current-dir') || '/');
})
}
decodeHash() {
return decodeURIComponent(window.location.hash.substring(1));
}

View File

@ -84,7 +84,7 @@
window.onbeforeunload = function () {
return 'A file upload in in progress, are you sure you want to continue?';
};
event.file.meta.path = $('#headerTableRow').attr('data-currentdir');
event.file.meta.path = $('#file_listing').data('current-dir');
event.file.meta.identifier = Math.random().toString(36).slice(2);
$('#append_files_to').append('<tr id="file-upload-' + event.file.meta.identifier +'"> \

View File

@ -17,7 +17,10 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
(function initSocket() {
var Server = (function () {
function initSocket() {
if (typeof $.notifyDefaults !== 'function') {
console.error('Notify does not appear to be loaded.');
return;
@ -73,11 +76,7 @@
Socket.on('status', function (data) {
setStatusIcon(data.status);
});
Socket.on('console', function (data) {
TerminalQueue.push(data.line);
});
})();
}
function setStatusIcon(status) {
switch (status) {
@ -97,3 +96,15 @@ function setStatusIcon(status) {
break;
}
}
return {
init: function () {
initSocket();
},
setStatusIcon: setStatusIcon,
}
})();
Server.init();

View File

@ -17,6 +17,9 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
var ServerList = (function () {
var Status = {
0: 'Offline',
1: 'Online',
@ -24,7 +27,6 @@ var Status = {
3: 'Stopping'
};
(function updateServerStatus () {
$('.dynamic-update').each(function (index, data) {
var element = $(this);
var serverShortUUID = $(this).data('server');
@ -62,6 +64,12 @@ var Status = {
break;
}
if (data.status > 0 && data.status < 4) {
var cpuMax = element.find('[data-action="cpu"]').data('cpumax');
var currentCpu = data.proc.cpu.total;
if (cpuMax !== 0) {
currentCpu = parseFloat(((data.proc.cpu.total / cpuMax) * 100).toFixed(2).toString());
}
if (data.status !== 0) {
var cpuMax = element.find('[data-action="cpu"]').data('cpumax');
var currentCpu = data.proc.cpu.total;
if (cpuMax !== 0) {
@ -79,4 +87,14 @@ var Status = {
});
});
setTimeout(updateServerStatus, 10000);
}
return {
init: function () {
updateServerStatus();
}
};
})();
ServerList.init();

View File

@ -17,7 +17,10 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
(function initTaskFunctions() {
var Tasks = (function () {
function initTaskFunctions() {
$('[data-action="delete-task"]').click(function (event) {
var self = $(this);
swal({
@ -99,4 +102,14 @@
});
});
});
}
return {
init: function () {
initTaskFunctions();
}
}
})();
Tasks.init();

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -212,6 +212,7 @@ return [
'size' => 'Size',
'last_modified' => 'Last Modified',
'add_new' => 'Add New File',
'add_folder' => 'Add New Folder',
'edit' => [
'header' => 'Edit File',
'header_sub' => 'Make modifications to a file from the web.',

View File

@ -47,7 +47,7 @@
Copyright &copy; 2015 - {{ date('Y') }} <a href="https://pterodactyl.io/" target="_blank">Pterodactyl Software</a>.<br />
</p>
</div>
{!! Theme::js('js/vendor/jquery/jquery.min.js') !!}
{!! Theme::js('vendor/jquery/jquery.min.js') !!}
{!! Theme::js('vendor/bootstrap/bootstrap.min.js') !!}
@if(config('app.phrase_in_context')) {!! Theme::js('js/phraseapp.js') !!} @endif

View File

@ -65,7 +65,7 @@
</div>
@section('footer-scripts')
{!! Theme::js('js/laroute.js') !!}
{!! Theme::js('js/vendor/jquery/jquery.min.js') !!}
{!! Theme::js('vendor/jquery/jquery.min.js') !!}
{!! Theme::js('vendor/bootstrap/bootstrap.min.js') !!}
{!! Theme::js('vendor/slimscroll/jquery.slimscroll.min.js') !!}
{!! Theme::js('vendor/adminlte/app.min.js') !!}

View File

@ -266,7 +266,7 @@
</div>
@section('footer-scripts')
{!! Theme::js('js/laroute.js') !!}
{!! Theme::js('js/vendor/jquery/jquery.min.js') !!}
{!! Theme::js('vendor/jquery/jquery.min.js') !!}
{!! Theme::js('vendor/sweetalert/sweetalert.min.js') !!}
{!! Theme::js('vendor/bootstrap/bootstrap.min.js') !!}
{!! Theme::js('vendor/slimscroll/jquery.slimscroll.min.js') !!}

View File

@ -38,9 +38,11 @@
<div class="col-xs-12">
<div class="box box-primary">
<div class="overlay file-overlay"><i class="fa fa-refresh fa-spin"></i></div>
<div class="box-body table-responsive no-padding" id="load_files">
<div id="load_files">
<div class="box-body table-responsive no-padding">
<div class="callout callout-info" style="margin:10px;">@lang('server.files.loading')</div>
</div>
</div>
<div class="box-footer with-border">
<p class="text-muted small" style="margin: 0 0 2px;">@lang('server.files.path', ['path' => '<code>/home/container</code>', 'size' => '<code>' . $node->upload_size . ' MB</code>'])</p>
</div>

View File

@ -17,49 +17,51 @@
{{-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --}}
{{-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --}}
{{-- SOFTWARE. --}}
<table class="table table-hover" id="file_listing">
<div class="box-header">
<i class="fa fa-refresh muted muted-hover use-pointer" data-action="reload-files"></i>
<code class="box-title">/home/container{{ $directory['header'] }}</code>
<a class="text-muted">
<i class="fa fa-plus" data-action="add-folder" data-toggle="tooltip" data-placement="top" title="@lang('server.files.add_folder')"></i>
</a>
<div class="box-tools pull-right">
<a class="btn btn-primary btn-sm" href="/server/{{ $server->uuidShort }}/files/add/@if($directory['header'] !== '')?dir={{ $directory['header'] }}@endif">
<i class="fa fa-file"></i> Create File
</a>
<a class="btn btn-primary btn-sm btn-icon btn-file">
<i class="fa fa-upload"></i> Upload <input type="file" id="files_touch_target" style="display: none;">
</a>
</div>
</div>
<div class="box-body table-responsive no-padding">
<table class="table table-hover" id="file_listing" data-current-dir="{{ $directory['header'] }}">
<thead>
<tr>
<th style="width:2%;text-align:center;" class="middle"><i class="fa fa-refresh muted muted-hover use-pointer" data-action="reload-files"></i></th>
<th style="width:2%;" class="middle"></th>
<th style="width:55%">@lang('server.files.file_name')</th>
<th style="width:15%">@lang('server.files.size')</th>
<th style="width:20%">@lang('server.files.last_modified')</th>
<th style="width:8%">
<label class="btn btn-primary btn-xs btn-file">
Upload <input type="file" id="files_touch_target" style="display: none;"/>
</label>
</th>
</tr>
<tr id="headerTableRow" data-currentdir="{{ $directory['header'] }}">
<th class="middle"><i class="fa fa-folder-open"></i></th>
<th colspan="4" class="middle">
<code>/home/container{{ $directory['header'] }}</code>
<small>
<a href="/server/{{ $server->uuidShort }}/files/add/@if($directory['header'] !== '')?dir={{ $directory['header'] }}@endif" class="text-muted">
<i class="fa fa-plus" data-toggle="tooltip" data-placement="top" title="@lang('server.files.add_new')"></i>
</a>
</small>
</th>
<th style="width:15%" class="hidden-xs">@lang('server.files.size')</th>
<th style="width:20%" class="hidden-xs">@lang('server.files.last_modified')</th>
<th style="width:8%"></th>
</tr>
</thead>
<tbody id="append_files_to">
@if (isset($directory['first']) && $directory['first'] === true)
<tr data-type="disabled">
<td class="middle"><i class="fa fa-folder" style="margin-left: 0.859px;"></i></td>
<td><a href="/server/{{ $server->uuidShort }}/files" data-action="directory-view">&larr;</a></td>
<td></td>
<td></td>
<td><i class="fa fa-folder" style="margin-left: 0.859px;"></i></td>
<td><a href="/server/{{ $server->uuidShort }}/files" data-action="directory-view">&larr;</a></a></td>
<td class="hidden-xs"></td>
<td class="hidden-xs"></td>
<td></td>
</tr>
@endif
@if (isset($directory['show']) && $directory['show'] === true)
<tr data-type="disabled">
<td class="middle"><i class="fa fa-folder" style="margin-left: 0.859px;"></i></td>
<td><i class="fa fa-folder" style="margin-left: 0.859px;"></i></td>
<td data-name="{{ rawurlencode($directory['link']) }}">
<a href="/server/{{ $server->uuidShort }}/files" data-action="directory-view">&larr; {{ $directory['link_show'] }}</a>
</td>
<td></td>
<td></td>
<td class="hidden-xs"></td>
<td class="hidden-xs"></td>
<td></td>
</tr>
@endif
@ -69,8 +71,8 @@
<td data-identifier="name" data-name="{{ rawurlencode($folder['entry']) }}" data-path="@if($folder['directory'] !== ''){{ rawurlencode($folder['directory']) }}@endif/">
<a href="/server/{{ $server->uuidShort }}/files" data-action="directory-view">{{ $folder['entry'] }}</a>
</td>
<td data-identifier="size">{{ $folder['size'] }}</td>
<td data-identifier="modified">
<td data-identifier="size" class="hidden-xs">{{ $folder['size'] }}</td>
<td data-identifier="modified" class="hidden-xs">
<?php $carbon = Carbon::createFromTimestamp($folder['date'])->timezone(env('APP_TIMEZONE', 'America/New_York')); ?>
@if($carbon->diffInMinutes(Carbon::now()) > 60)
{{ $carbon->format('m/d/y H:i:s') }}
@ -146,8 +148,8 @@
{{ $file['entry'] }}
@endif
</td>
<td data-identifier="size">{{ $file['size'] }}</td>
<td data-identifier="modified">
<td data-identifier="size" class="hidden-xs">{{ $file['size'] }}</td>
<td data-identifier="modified" class="hidden-xs">
<?php $carbon = Carbon::createFromTimestamp($file['date'])->timezone(env('APP_TIMEZONE', 'America/New_York')); ?>
@if($carbon->diffInMinutes(Carbon::now()) > 60)
{{ $carbon->format('m/d/y H:i:s') }}
@ -162,3 +164,4 @@
@endforeach
</tbody>
</table>
</div>

View File

@ -40,8 +40,11 @@
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-body">
<div class="box-body position-relative">
<div id="terminal" style="width:100%;"></div>
<div id="terminalNotify" class="terminal-notify hidden">
<i class="fa fa-bell"></i>
</div>
</div>
<div class="box-footer text-center">
@can('power-start', $server)<button class="btn btn-success disabled" data-attr="power" data-action="start">Start</button>@endcan