General updates

This commit is contained in:
2019-05-23 20:23:32 +05:30
parent 13b8670e62
commit d1e0f2a907
5 changed files with 94 additions and 11 deletions

75
package-lock.json generated
View File

@@ -18,6 +18,11 @@
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
}, },
"axo": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/axo/-/axo-0.0.2.tgz",
"integrity": "sha1-STVfu+qzhEm8ppahqsxGml7p/Uc="
},
"body-parser": { "body-parser": {
"version": "1.19.0", "version": "1.19.0",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
@@ -101,6 +106,11 @@
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
}, },
"eventemitter3": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-2.0.3.tgz",
"integrity": "sha1-teEHm1n7XhuidxwKmTvgYKWMmbo="
},
"express": { "express": {
"version": "4.17.0", "version": "4.17.0",
"resolved": "https://registry.npmjs.org/express/-/express-4.17.0.tgz", "resolved": "https://registry.npmjs.org/express/-/express-4.17.0.tgz",
@@ -138,6 +148,16 @@
"vary": "~1.1.2" "vary": "~1.1.2"
} }
}, },
"extendible": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/extendible/-/extendible-0.1.1.tgz",
"integrity": "sha1-4qN+2HEp+0+VM+io11BiMKU5yQU="
},
"failure": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/failure/-/failure-1.1.1.tgz",
"integrity": "sha1-qOg9OxYC0kaL/2rU2QceAQO4Goc="
},
"finalhandler": { "finalhandler": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
@@ -162,6 +182,11 @@
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
}, },
"hang": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/hang/-/hang-1.0.0.tgz",
"integrity": "sha1-ZwUIeYRENeAq4ECcT0VTxkOOHXE="
},
"http-errors": { "http-errors": {
"version": "1.7.2", "version": "1.7.2",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
@@ -197,6 +222,17 @@
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz",
"integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==" "integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw=="
}, },
"loads": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/loads/-/loads-0.0.4.tgz",
"integrity": "sha1-l/MBY5fnDd/0gLgexjjO6iKgqZw=",
"requires": {
"failure": "1.1.x",
"one-time": "0.0.x",
"xhr-response": "1.0.x",
"xhr-status": "1.0.x"
}
},
"media-typer": { "media-typer": {
"version": "0.3.0", "version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
@@ -240,6 +276,11 @@
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
}, },
"node-http-xhr": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/node-http-xhr/-/node-http-xhr-1.3.4.tgz",
"integrity": "sha512-0bA08/2RKWxw6pMkOVd3KP+0F5+ifQLMMTDxrCgxlgkoU1N8DhCbCSAYEqpgaVYM2smvbVVewiXjW+8AyoLfxQ=="
},
"on-finished": { "on-finished": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
@@ -248,6 +289,11 @@
"ee-first": "1.1.1" "ee-first": "1.1.1"
} }
}, },
"one-time": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/one-time/-/one-time-0.0.4.tgz",
"integrity": "sha1-+M33eISCb+Tf+T46nMN7HkSAdC4="
},
"parseurl": { "parseurl": {
"version": "1.3.3", "version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
@@ -288,6 +334,20 @@
"unpipe": "1.0.0" "unpipe": "1.0.0"
} }
}, },
"requests": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/requests/-/requests-0.2.2.tgz",
"integrity": "sha1-Dl7Af9hrSVvbS+2oabIVfsqJO00=",
"requires": {
"axo": "0.0.x",
"eventemitter3": "~2.0.2",
"extendible": "0.1.x",
"hang": "1.0.x",
"loads": "0.0.x",
"node-http-xhr": "~1.3.0",
"xhr-send": "1.0.x"
}
},
"safe-buffer": { "safe-buffer": {
"version": "5.1.2", "version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
@@ -374,6 +434,21 @@
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
},
"xhr-response": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/xhr-response/-/xhr-response-1.0.1.tgz",
"integrity": "sha1-r/46CFRLpyGG5NxSzQImZx2Gc/4="
},
"xhr-send": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/xhr-send/-/xhr-send-1.0.0.tgz",
"integrity": "sha1-GkDHPl2yAo7gj+kPXD1tx/eWqFQ="
},
"xhr-status": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/xhr-status/-/xhr-status-1.0.1.tgz",
"integrity": "sha512-VF0WSqtmkf56OmF26LCWsWvRb1a+WYGdHDoQnPPCVUQTM8CVUAOBcUDsm7nP7SQcgEEdrvF4DmhEADuXdGieyw=="
} }
} }
} }

View File

@@ -4,7 +4,8 @@
"description": "Barebones file manager for a remote location", "description": "Barebones file manager for a remote location",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "node ." "start": "node .",
"test": "node test"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@@ -23,6 +24,7 @@
"dependencies": { "dependencies": {
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"express": "^4.17.0", "express": "^4.17.0",
"jquery": "^3.4.1" "jquery": "^3.4.1",
"requests": "^0.2.2"
} }
} }

View File

@@ -1,19 +1,23 @@
let currDir = {'loc':'','contents':null}; let currDir = {'loc':'','contents':null};
let currSel = {'loc':'','path':''}
function doUpdate(ele,isDir=false){
function doUpdate(ele){ //console.log(ele.attr('data-choice'));
console.log(ele.attr('data-choice'));
if(ele.hasClass('file-isDir')){ if(ele.hasClass('file-isDir')){
currDir.loc = ele.attr('data-choice'); currDir.loc = ele.attr('data-choice');
populateContents(); populateContents();
} }
if(!isDir){
$('.nav-bottom-text').html(ele.html())
}
//$() //$()
//$(this). //$(this).
} }
function updateContents(contents){ function updateContents(contents){
console.log(contents) //console.log(contents)
// Change top header contents // Change top header contents
$('#files-location').html(currDir.loc) $('#files-location').html(currDir.loc)
@@ -24,13 +28,14 @@ function updateContents(contents){
} }
else else
{ {
$('#files-table').empty(); $('#files-table').hide().empty();
contents.contents.forEach(element => { contents.contents.forEach(element => {
$('#files-table').append(`<tr class="files-row"><td onclick="doUpdate($(this))" class="file-name ${(element.isDir?'file-isDir':'file-isFile')}" data-choice="${element.path}">${element.name}</td><td class="file-handlers"></td></tr>`) $('#files-table').append(`<tr class="files-row box-shadow-1-active"><td onclick="doUpdate($(this),${element.isDir})" class="file-name ${(element.isDir?'file-isDir':'file-isFile')}" data-choice="${element.path}">${element.name}</td></tr>`)
}); });
if(contents.back!=null){ if(contents.back!=null){
$('#files-table').prepend(`<tr class="files-row"><td onclick="doUpdate($(this))" class="file-name file-isDir file-isBack" data-choice="${contents.back}">..</td><td class="file-handlers"></td></tr>`) $('#files-table').prepend(`<tr class="files-row box-shadow-1-active"><td onclick="doUpdate($(this))" class="file-name file-isDir file-isBack" data-choice="${contents.back}">..</td></tr>`)
} }
$('#files-table').fadeIn()
} }
} }

View File

@@ -21,7 +21,7 @@
<thead> <thead>
<tr> <tr>
<td>File Name</td> <td>File Name</td>
<td>Actions</td>
</tr> </tr>
</thead> </thead>
<tbody id="files-table"> <tbody id="files-table">
@@ -44,7 +44,7 @@
<button class="nav-bottom-button box-shadow-3 box-shadow-3-active">+</button> <button class="nav-bottom-button box-shadow-3 box-shadow-3-active">+</button>
</div> </div>
<div class="nav-bottom box-shadow-3"> <div class="nav-bottom box-shadow-3">
<span class="nav-bottom-text">NAV-BOTTOM</span> <span class="nav-bottom-text">Select file</span>
</div> </div>
</div> </div>
</body> </body>

1
test.js Normal file
View File

@@ -0,0 +1 @@
const requests = require('requests')