Skip to content

Commit

Permalink
- set versions to 1.0.17
Browse files Browse the repository at this point in the history
- file browser complete implementation for hard disk plug in
  • Loading branch information
lamarios committed May 7, 2017
1 parent 38eadd3 commit 2bcde3c
Show file tree
Hide file tree
Showing 26 changed files with 297 additions and 52 deletions.
2 changes: 1 addition & 1 deletion models/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.ftpix.homedash</groupId>
<artifactId>homedash</artifactId>
<version>1.0.16</version>
<version>1.0.17</version>
</parent>

<artifactId>models</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion notifications/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>homedash</artifactId>
<groupId>com.ftpix.homedash</groupId>
<version>1.0.16</version>
<version>1.0.17</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion plugins/couchpotato/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.ftpix.homedash.plugins</groupId>
<artifactId>plugins</artifactId>
<version>1.0.16</version>
<version>1.0.17</version>
</parent>

<artifactId>couchpotato</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugins/docker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.ftpix.homedash.plugins</groupId>
<artifactId>plugins</artifactId>
<version>1.0.16</version>
<version>1.0.17</version>
</parent>

<artifactId>docker</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugins/dockercompose/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>plugins</artifactId>
<groupId>com.ftpix.homedash.plugins</groupId>
<version>1.0.16</version>
<version>1.0.17</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion plugins/dynamicdns/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.ftpix.homedash.plugins</groupId>
<artifactId>plugins</artifactId>
<version>1.0.16</version>
<version>1.0.17</version>
</parent>

<artifactId>dynamicdns</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugins/googlepubliccalendar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.ftpix.homedash.plugins</groupId>
<artifactId>plugins</artifactId>
<version>1.0.16</version> </parent>
<version>1.0.17</version> </parent>

<artifactId>googlepubliccalendar</artifactId>
<name>googlepubliccalendar</name>
Expand Down
2 changes: 1 addition & 1 deletion plugins/harddisk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.ftpix.homedash.plugins</groupId>
<artifactId>plugins</artifactId>
<version>1.0.16</version>
<version>1.0.17</version>
</parent>

<artifactId>harddisk</artifactId>
Expand Down
80 changes: 76 additions & 4 deletions plugins/harddisk/src/main/java/assets/js/harddisk.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,52 @@ function harddisk(moduleId) {

sendMessage(self.moduleId, 'browse', self.path.join('/'));
});


$('.files').on('click', '.add-clipboard', function () {
var path = self.path.join('/') + '/' + $(this).attr('data-name');
self.clipBoardHtml(path);
});


$('.files').on('click', '.delete', function () {
var path = self.path.join('/') + '/' + $(this).attr('data-name');
if (confirm('Delete ' + path + '?')) {
sendMessage(self.moduleId, 'delete', path);
}
});

$('.files').on('click', '.rename', function () {
var newName = prompt('File new name');
if (newName !== undefined && $.trim(newName) !== '') {
var data = {
source: self.path.join('/') + '/' + $(this).attr('data-name'),
destination: self.path.join('/') + '/' + newName
}

sendMessage(self.moduleId, 'rename', JSON.stringify(data));
}
});

$('body').on('click', '.action-copy', function () {
var data = {
'source': $(this).attr('data-path'),
'destination': self.path.join('/')
};

sendMessage(self.moduleId, 'copy', JSON.stringify(data));
$('.clipboard').html('<p>Operation in progress...</p>');
});

$('body').on('click', '.action-move', function () {
var data = {
'source': $(this).attr('data-path'),
'destination': self.path.join('/')
};

sendMessage(self.moduleId, 'move', JSON.stringify(data));
$('.clipboard').html('<p>Operation in progress...</p>');
});
}
};

Expand All @@ -53,6 +99,10 @@ function harddisk(moduleId) {
} else if (command === 'browse') {
$('.current-path').html(this.path.join('/'));
$('.files tbody').html(this.files2html(message));
} else if (command === 'success' || command === 'error') {
sendMessage(this.moduleId, 'browse', this.path.join('/'));
$('.clipboard').html('');
this.showClipboard();
}

}
Expand All @@ -74,6 +124,28 @@ function harddisk(moduleId) {
root.find('.hdd-container').html(this.generateSVG(percentage, diskSpace.usage));
};

this.clipBoardHtml = function (filePath) {

var html = [];

html.push('<p>');
html.push(filePath);
html.push('<button data-path="', filePath, '"class="btn btn-primary action-copy" >Copy here</button>');
html.push('<button data-path="', filePath, '"class="btn btn-primary action-move" >Move here</button>');
html.push('</p>');

$('.clipboard').html(html.join(''));
this.showClipboard();
}

this.showClipboard = function () {
if ($('.clipboard p').length > 0) {
$('.clipboard').addClass('active');
} else {
$('.clipboard').removeClass('active');
}
}

this.generateSVG = function (percentage, usePercentage) {
console.log('percentage', usePercentage);
var html = [];
Expand Down Expand Up @@ -135,10 +207,10 @@ function harddisk(moduleId) {
html.push('<button class="btn btn-primary btn-sm" id="dLabel" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">');
html.push('<i class="fa fa-ellipsis-v" aria-hidden="true"></i>');
html.push('</button>');
html.push('<ul class="dropdown-menu" aria-labelledby="dLabel">');
html.push('<li><a data-name="',value.name,'" class="add-clipboard">Add to clipboard</a></li>');
html.push('<li><a data-name="',value.name,'" class="rename">Rename</a></li>');
html.push('<li><a data-name="',value.name,'" class="delete">Delete</a></li>');
html.push('<ul class="dropdown-menu pull-right" aria-labelledby="dLabel">');
html.push('<li><a data-name="', value.name, '" class="add-clipboard">Add to clipboard</a></li>');
html.push('<li><a data-name="', value.name, '" class="rename">Rename</a></li>');
html.push('<li><a data-name="', value.name, '" class="delete">Delete</a></li>');
html.push('</ul>');
html.push('</div></td>')
html.push('</tr>');
Expand Down
73 changes: 64 additions & 9 deletions plugins/harddisk/src/main/java/assets/less/harddisk.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
background-size: auto 150%;

h4 {
margin-left: 5px;
margin-top: 10px;
margin-bottom: 20px;
position: absolute;
left:0;
bottom:0;
right:0;
text-align: center;
font-size: 15px;
margin-bottom: 2px;
}

p {
Expand All @@ -25,6 +29,7 @@
left: 20px;
width: 60px;
bottom: 5px;
top:20px;

polygon {
fill: #57CCC1;
Expand Down Expand Up @@ -65,14 +70,16 @@

.harddisk.size-2x1 {
h4 {
margin-left: 5px;
margin-top: 10px;
margin-bottom: 25px;
text-align: left;
left:5px;
}

p {
text-align: right;
font-size: 15px;
position: absolute;
right: 2px;
top: 45px;
}

svg.hdd-svg {
Expand All @@ -84,11 +91,59 @@

}

.harddisk.size-full-screen {

.harddisk.size-full-screen{

.files tr.folder{
.files tr.folder {
cursor: pointer;
}

.files tr td:nth-of-type(2){
width: 60px;
}

.dropdown {
.delete {
color: red;
}

a{
cursor: pointer;
}
}

.clipboard {

@backgroundColor: #e67e22;
background-color: darken(@backgroundColor, 20%);

opacity: 0;
position: fixed;
left: 0;
right: 0;
bottom: -60px;
margin: 0;
height: 60px;
text-align: center;

@transitionSpeed: 0.25s;

-webkit-transition: all @transitionSpeed;
-moz-transition: all @transitionSpeed;
-ms-transition: all @transitionSpeed;
-o-transition: all @transitionSpeed;
transition: all @transitionSpeed;

p {
margin: 0;
color: white;
font-size: 20px;
padding-top: 8px;
}
}

.clipboard.active {
opacity: 1;
bottom: 0;
}
}

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.storage-icon
.hdd-container
h4.path
.hdd-container
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.storage-icon
h4.path
p.data
.hdd-container
.hdd-container
h4.path
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ p.current-path
table.files.table.table-striped.table-hover
tbody

.clipboard
table.clipboard.table.table-condensed
tbody
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,21 @@
* Created by gz on 5/6/17.
*/
public class FileOperation {
public String source, destination;
private String source, destination;

public String getSource() {
return source;
}

public void setSource(String source) {
this.source = source;
}

public String getDestination() {
return destination;
}

public void setDestination(String destination) {
this.destination = destination;
}
}
Loading

0 comments on commit 2bcde3c

Please sign in to comment.