Support for file copying
This commit is contained in:
parent
5356ee379e
commit
1d747ec647
3 changed files with 71 additions and 1 deletions
15
CHANGELOG.md
15
CHANGELOG.md
|
@ -3,7 +3,20 @@ This file is a running track of new features and fixes to each version of the pa
|
||||||
|
|
||||||
This project follows [Semantic Versioning](http://semver.org) guidelines.
|
This project follows [Semantic Versioning](http://semver.org) guidelines.
|
||||||
|
|
||||||
## v0.5.0 (Bodacious Boreopterus) [Unreleased]
|
## v0.5.0-pre.2 (Bodacious Boreopterus)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
* Adds support for file copying through the file manager. [#127](https://github.com/Pterodactyl/Panel/issues/127)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
* Support for sub-folders within the `getJavascript()` route for servers.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* File manager would do multiple up-down-up-down loading actions if you escaped renaming a file. Fixed the binding issue. [#122](https://github.com/Pterodactyl/Panel/issues/122)
|
||||||
|
* File manager actions would not trigger properly if text in a row was used to right-click from.
|
||||||
|
* File manager rename field would not disappear when pressing the escape key in chrome. [#121](https://github.com/Pterodactyl/Panel/issues/121)
|
||||||
|
|
||||||
|
## v0.5.0-pre.1 (Bodacious Boreopterus)
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
* Support for creating server without having to assign a node and allocation manually. Simply select the checkbox or pass `auto_deploy=true` to the API to auto-select a node and allocation given a location.
|
* Support for creating server without having to assign a node and allocation manually. Simply select the checkbox or pass `auto_deploy=true` to the API to auto-select a node and allocation given a location.
|
||||||
|
|
|
@ -76,6 +76,57 @@ class ActionsClass {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copy() {
|
||||||
|
const nameBlock = $(this.element).find('td[data-identifier="name"]');
|
||||||
|
const currentName = decodeURIComponent(nameBlock.attr('data-name'));
|
||||||
|
const currentPath = decodeURIComponent(nameBlock.data('path'));
|
||||||
|
|
||||||
|
swal({
|
||||||
|
type: 'input',
|
||||||
|
title: 'Copy File',
|
||||||
|
text: 'Please enter the new path for the copied file below.',
|
||||||
|
showCancelButton: true,
|
||||||
|
showConfirmButton: true,
|
||||||
|
closeOnConfirm: false,
|
||||||
|
showLoaderOnConfirm: true,
|
||||||
|
inputValue: `${currentPath}${currentName}`,
|
||||||
|
}, (val) => {
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
headers: {
|
||||||
|
'X-Access-Token': '{{ $server->daemonSecret }}',
|
||||||
|
'X-Access-Server': '{{ $server->uuid }}'
|
||||||
|
},
|
||||||
|
contentType: 'application/json; charset=utf-8',
|
||||||
|
url: '{{ $node->scheme }}://{{ $node->fqdn }}:{{ $node->daemonListen }}/server/file/copy',
|
||||||
|
timeout: 10000,
|
||||||
|
data: JSON.stringify({
|
||||||
|
from: `${currentPath}${currentName}`,
|
||||||
|
to: `${val}`,
|
||||||
|
}),
|
||||||
|
}).done(data => {
|
||||||
|
swal({
|
||||||
|
type: 'success',
|
||||||
|
title: '',
|
||||||
|
text: 'File successfully copied.'
|
||||||
|
});
|
||||||
|
Files.list();
|
||||||
|
}).fail(jqXHR => {
|
||||||
|
console.error(jqXHR);
|
||||||
|
var error = 'An error occured while trying to process this request.';
|
||||||
|
if (typeof jqXHR.responseJSON !== 'undefined' && typeof jqXHR.responseJSON.error !== 'undefined') {
|
||||||
|
error = jqXHR.responseJSON.error;
|
||||||
|
}
|
||||||
|
swal({
|
||||||
|
type: 'error',
|
||||||
|
title: '',
|
||||||
|
text: error,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
download() {
|
download() {
|
||||||
const nameBlock = $(this.element).find('td[data-identifier="name"]');
|
const nameBlock = $(this.element).find('td[data-identifier="name"]');
|
||||||
const fileName = decodeURIComponent(nameBlock.attr('data-name'));
|
const fileName = decodeURIComponent(nameBlock.attr('data-name'));
|
||||||
|
|
|
@ -34,6 +34,7 @@ class ContextMenuClass {
|
||||||
if (!_.isNull(this.activeLine)) this.activeLine.removeClass('active');
|
if (!_.isNull(this.activeLine)) this.activeLine.removeClass('active');
|
||||||
return '<ul id="fileOptionMenu" class="dropdown-menu" role="menu" style="display:none" > \
|
return '<ul id="fileOptionMenu" class="dropdown-menu" role="menu" style="display:none" > \
|
||||||
<li data-action="move"><a tabindex="-1" href="#"><i class="fa fa-arrow-right"></i> Move</a></li> \
|
<li data-action="move"><a tabindex="-1" href="#"><i class="fa fa-arrow-right"></i> Move</a></li> \
|
||||||
|
<li data-action="copy"><a tabindex="-1" href="#"><i class="fa fa-clone"></i> Copy</a></li> \
|
||||||
<li data-action="rename"><a tabindex="-1" href="#"><i class="fa fa-pencil-square-o"></i> Rename</a></li> \
|
<li data-action="rename"><a tabindex="-1" href="#"><i class="fa fa-pencil-square-o"></i> Rename</a></li> \
|
||||||
<li data-action="compress" class="hidden"><a tabindex="-1" href="#"><i class="fa fa-file-archive-o"></i> Compress</a></li> \
|
<li data-action="compress" class="hidden"><a tabindex="-1" href="#"><i class="fa fa-file-archive-o"></i> Compress</a></li> \
|
||||||
<li data-action="decompress" class="hidden"><a tabindex="-1" href="#"><i class="fa fa-expand"></i> Decompress</a></li> \
|
<li data-action="decompress" class="hidden"><a tabindex="-1" href="#"><i class="fa fa-expand"></i> Decompress</a></li> \
|
||||||
|
@ -81,6 +82,11 @@ class ContextMenuClass {
|
||||||
Actions.move();
|
Actions.move();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(menu).find('li[data-action="copy"]').unbind().on('click', e => {
|
||||||
|
e.preventDefault();
|
||||||
|
Actions.copy();
|
||||||
|
});
|
||||||
|
|
||||||
$(menu).find('li[data-action="rename"]').unbind().on('click', e => {
|
$(menu).find('li[data-action="rename"]').unbind().on('click', e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
Actions.rename();
|
Actions.rename();
|
||||||
|
|
Loading…
Reference in a new issue