+
+
diff --git a/Frontend/static/css/components.css b/Frontend/static/css/components.css
index bd9d43d..9efc636 100644
--- a/Frontend/static/css/components.css
+++ b/Frontend/static/css/components.css
@@ -15,7 +15,6 @@ body {
main {
flex: 1 1 auto;
- overflow-y: scroll;
}
footer {
@@ -34,18 +33,27 @@ header {
background-color: #404040;
color: #ffffff;
display: grid;
- grid-gap: 5%;
- grid-template-columns: 25% 40% 25%;
+ grid-template-columns: auto min-content;
height: auto;
max-height: 100px;
padding: 10px;
}
.title {
+ grid-column: 1;
margin: 5px;
font-size: 2em;
}
+.logout {
+ grid-column: 2;
+ width: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: right;
+ cursor: pointer;
+}
+
.box {
padding: 5px;
height: 100%;
@@ -55,6 +63,138 @@ button {
cursor: pointer;
}
+.arrow-pointer {
+ display: inline-block;
+ height: 2em;
+ background: #404040;
+ position: relative;
+ color: #ffffff;
+ margin-left: 1em;
+ margin-bottom: 10px;
+ cursor: pointer;
+}
+
+.arrow-pointer:first-child {
+ margin-left: 0;
+}
+
+.arrow-pointer span {
+ padding-left: 1.5em;
+ padding-right: 0.5em;
+ line-height: 2em;
+}
+
+.arrow-pointer:after {
+ content: '';
+ position: absolute;
+ left: 0;
+ bottom: 0;
+ width: 0;
+ height: 0;
+ border-left: 1em solid #212121;
+ border-top: 1em solid #404040;
+ border-bottom: 1em solid #404040;
+}
+
+.arrow-pointer:before {
+ content: '';
+ position: absolute;
+ right: -1em;
+ bottom: 0;
+ width: 0;
+ height: 0;
+ border-left: 1em solid #404040;
+ border-top: 1em solid #212121;
+ border-bottom: 1em solid #212121;
+}
+
+#path .arrow-pointer:first-child:after {
+ border-left: 1em solid #404040;
+ border-top: 1em solid #404040;
+ border-bottom: 1em solid #404040;
+}
+
+#path .arrow-pointer:first-child span {
+ padding-left: 1em;
+}
+
+.modal {
+ display: none;
+ position: fixed;
+ z-index: 100000;
+ padding-top: 100px;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ overflow: auto;
+ background-color: rgba(0,0,0, 0.8);
+}
+
+#content {
+ background-color: #fefefe;
+ margin: auto;
+ padding: 20px;
+ border: 1px solid #888;
+ width: 90%;
+ height: 80%;
+}
+
+.modal-header {
+ display: grid;
+ grid-template-columns: 90% 10%;
+}
+
+.modal-header #file_title {
+ grid-column: 1;
+ margin: 0;
+}
+
+.modal-header span {
+ grid-column: 2;
+ display: flex;
+ justify-content: flex-end;
+ align-items: center;
+}
+
+.modal-header span i {
+ cursor: pointer;
+}
+
+.modal-content {
+ background-color: #fefefe;
+ width: 100%;
+ height: calc(100% - 16px - 2em);
+}
+
+.error {
+ display: grid;
+ grid-template-columns: auto min-content;
+ background: #db2d2d;
+ border: solid 2px #b61111;
+ border-radius: 5px;
+ width: 90%;
+ height: 3em;
+ margin-left: auto;
+ margin-right: auto;
+ color: #ffffff;
+}
+
+.error .text {
+ grid-column: 1;
+ line-height: 3em;
+ padding-left: 10px;
+
+}
+
+.error span:nth-child(2) {
+ grid-column: 2;
+ display: flex;
+ align-items: center;
+ cursor: pointer;
+ line-height: 3em;
+}
+
.material-icon {
font-family: Material Icons, sans-serif !important;
font-weight: 400;
diff --git a/Frontend/static/css/index.css b/Frontend/static/css/index.css
index 421d122..2ed31df 100644
--- a/Frontend/static/css/index.css
+++ b/Frontend/static/css/index.css
@@ -1,74 +1,35 @@
#wrapper {
color: white;
padding: 5px;
+ width: calc(100% - 10px);
+ height: 100%;
+ display: flex;
+ flex-direction: row;
}
-#wrapper1 {
+#error_wrapper {
+ padding: 5px;
width: 100%;
- height: 100%;
- display: grid;
- grid-template-columns: 30% 70%;
}
#tree {
- grid-column: 1;
margin: 5px;
+ height: 100%;
+ width: 30%;
+ max-width: 400px;
+ border-right: #404040 2px solid;
+}
+
+#files {
+ margin: 5px;
+ height: 100%;
+ width: 70%;
}
#path {
padding-bottom: 10px;
}
-.arrow-pointer {
- display: inline-block;
- height: 2em;
- background: #404040;
- position: relative;
- color: #ffffff;
- margin-left: 1em;
-}
-
-.arrow-pointer:first-child {
- margin-left: 0;
-}
-
-.arrow-pointer span {
- padding-left: 1.5em;
- padding-right: 0.5em;
- padding-top: 0.5em;
-
-}
-
-.arrow-pointer:after {
- content: '';
- position: absolute;
- left: 0;
- bottom: 0;
- width: 0;
- height: 0;
- border-left: 1em solid #212121;
- border-top: 1em solid #404040;
- border-bottom: 1em solid #404040;
-}
-
-.arrow-pointer:before {
- content: '';
- position: absolute;
- right: -1em;
- bottom: 0;
- width: 0;
- height: 0;
- border-left: 1em solid #404040;
- border-top: 1em solid #212121;
- border-bottom: 1em solid #212121;
-}
-
-
-#files {
- grid-column: 2;
- margin: 5px;
-}
-
table {
width: 100%;
border-collapse: collapse;
@@ -80,9 +41,69 @@ tr {
th, td {
border-bottom: 1px solid #ccc;
+ padding: 10px;
}
thead tr {
text-align: left;
background: #0062ff;
+}
+
+#tree ul, #tree #tree_ul {
+ list-style-type: none;
+ padding-left: 0;
+}
+
+#tree #tree_ul {
+ margin: 0;
+ padding: 0;
+}
+
+#tree .folder {
+ cursor: pointer;
+ user-select: none;
+}
+
+#tree .folder::before {
+ font-family: Material Icons, sans-serif !important;
+ content: "\e2c7";
+ display: inline-block;
+ margin-right: 6px;
+ font-size: 2em;
+ vertical-align: -25%;
+}
+
+#tree .folder-open::before {
+ font-family: Material Icons, sans-serif !important;
+ content: "\e2c8";
+ display: inline-block;
+ margin-right: 6px;
+ font-size: 2em;
+ vertical-align: -25%;
+}
+
+#tree .nested {
+ display: none;
+}
+
+#tree .active {
+ display: block;
+ margin-left: 15px;
+}
+
+
+@media (max-width: 700px) {
+ #wrapper {
+ flex-direction: column-reverse;
+ }
+
+ #tree {
+ width: 100%;
+ border-top: #404040 2px solid;
+ border-right: none;
+ }
+
+ #files {
+ width: 100%;
+ }
}
\ No newline at end of file
diff --git a/Frontend/static/css/login.css b/Frontend/static/css/login.css
index 14d21da..4f90196 100644
--- a/Frontend/static/css/login.css
+++ b/Frontend/static/css/login.css
@@ -33,6 +33,6 @@
}
#login button {
- background-color: #003100;
+ background-color: #0062ff;
color: #ffffff;
}
\ No newline at end of file
diff --git a/Frontend/static/js/index.js b/Frontend/static/js/index.js
index e3c98b5..513695c 100644
--- a/Frontend/static/js/index.js
+++ b/Frontend/static/js/index.js
@@ -1,11 +1,12 @@
-tree = [];
+file_path = [];
+tree = {};
window.addEventListener('load', function () {
- console.log('All assets are loaded');
-
if (sessionStorage.getItem("authorization") !== null) {
console.log('Logged in');
+ create_logout_view();
url_listener();
+ create_tree_view_data('');
} else {
console.log('Not logged in');
create_login_view();
@@ -20,7 +21,11 @@ function url_listener() {
let curr_dir = findGetParameter('path');
if (curr_dir !== null) {
- httpGetAsync('http://localhost:8080' + curr_dir, null, show_files);
+ if(curr_dir.startsWith('/') || curr_dir === '') {
+ httpGetAsync('http://localhost:8080' + curr_dir, null, show_files);
+ } else {
+ create_error_view('directory does not exist');
+ }
} else {
httpGetAsync('http://localhost:8080', null, show_files);
}
@@ -37,7 +42,9 @@ function login() {
console.log(username + ':' + JSON.parse(xmlHttp.responseText)['token'])
sessionStorage.setItem("authorization", btoa(username + ':' + JSON.parse(xmlHttp.responseText)['token']));
- httpGetAsync('http://localhost:8080', null, show_files);
+ create_logout_view();
+
+ url_listener();
}
}
}
@@ -48,21 +55,22 @@ function login() {
}
function show_files(response, code) {
- document.getElementById("wrapper").innerHTML = '';
if (code === 200) {
// OK
- console.log(code);
- console.log(JSON.parse(response));
create_file_view(JSON.parse(response));
} else if (code === 401) {
// Not logged in
sessionStorage.removeItem('authorization');
- // location.reload();
+ create_login_view();
} else {
// Error
console.error(code);
console.error(JSON.parse(response));
- sessionStorage.removeItem('authorization');
+
+ response = JSON.parse(response);
+ create_error_view(response['error']);
+
+ // sessionStorage.removeItem('authorization');
// location.reload();
}
}
@@ -70,35 +78,21 @@ function show_files(response, code) {
function one_dir_back() {
let curr_dir = findGetParameter('path');
- let dir = curr_dir.split('/');
- dir = dir.slice(0, dir.length - 1);
- curr_dir = dir.join('/');
+ if(curr_dir !== null) {
+ let dir = curr_dir.split('/');
+ dir = dir.slice(0, dir.length - 1);
+ curr_dir = dir.join('/');
- return curr_dir;
+ return curr_dir;
+ }
+
+ return '';
}
-// function change_dir(name) {
-// let curr_dir = findGetParameter('path');
-//
-// if(curr_dir === null) {
-// curr_dir = '';
-// }
-//
-// if (name === '..') {
-// let dir = curr_dir.split('/');
-// dir = dir.slice(0, dir.length - 1);
-// curr_dir = dir.join('/');
-//
-// httpGetAsync('http://localhost:8080' + curr_dir, null, show_files);
-// window.history.pushState('index', 'Filemanager', 'index.html?path=' + curr_dir);
-// } else {
-// httpGetAsync('http://localhost:8080' + curr_dir + '/' + name, null, show_files);
-// window.history.pushState('index', 'Filemanager', 'index.html?path=' + curr_dir + '/' + name);
-// }
-// }
-
-function load_file(name) {
+function load_file(name, type) {
let curr_dir = findGetParameter('path');
- console.log(curr_dir + '/' + name);
+ if (curr_dir === null) curr_dir = '';
+
+ show_file_view(curr_dir + '/' + name, type);
}
\ No newline at end of file
diff --git a/Frontend/static/js/tools.js b/Frontend/static/js/tools.js
index de4f73e..475feba 100644
--- a/Frontend/static/js/tools.js
+++ b/Frontend/static/js/tools.js
@@ -6,7 +6,6 @@ function httpGetAsync(url, data, callback) { // data includes auth
}
}
- console.log(url)
xmlHttp.open("GET", url, true);
xmlHttp.setRequestHeader('Authorization', 'Basic ' + sessionStorage.getItem('authorization'));
xmlHttp.send(null);
diff --git a/Frontend/static/js/views.js b/Frontend/static/js/views.js
index 2de8329..e6cd93a 100644
--- a/Frontend/static/js/views.js
+++ b/Frontend/static/js/views.js
@@ -16,101 +16,276 @@ function create_login_view() {