Commit d2686946 authored by Martin Urban's avatar Martin Urban
Browse files

File: React on failed ajax request and on "permission denied"

parent 75268a61
.file-content{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;user-select:none;position:absolute;height:100%;bottom:0;right:0;top:0;left:0;overflow:hidden}.fileselector{height:300px}.actionmenu{position:absolute;display:none}.file-menu{height:0;overflow:auto;visibility:hidden}.table-info-dialog>tbody>tr>td{border:none;border:0;border-top:0}.table-info-dialog-width{width:114px}.table-info-dialog{overflow:hidden;table-layout:fixed;word-wrap:break-word}.file-info-dialog-header{margin-bottom:20px}.filterField{bottom:5px;right:5px;position:absolute;visibility:hidden;width:300px;z-index:99}@font-face{font-family:'file_icons';src:url('../../fonts/file_icons.eot');src:url('../../fonts/file_icons.eot') format('embedded-opentype'),url('../../fonts/file_icons.woff') format('woff'),url('../../fonts/file_icons.ttf') format('truetype'),url('../../fonts/file_icons.svg#file_icons') format('svg');font-weight:normal;font-style:normal}[class^="icon-"],[class*=" icon-"]{font-family:'file_icons';color:#444;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-bmp:before{content:"\e600"}.icon-c:before{content:"\e601"}.icon-cc:before{content:"\e602"}.icon-conf:before{content:"\e603"}.icon-cpp:before{content:"\e604"}.icon-csh:before{content:"\e605"}.icon-css:before{content:"\e606"}.icon-default:before{content:"\e607"}.icon-default-alt:before{content:"\e608"}.icon-default-symlink:before{content:"\e609"}.icon-eps:before{content:"\e60a"}.icon-f:before{content:"\e60b"}.icon-f03:before{content:"\e60c"}.icon-f90:before{content:"\e60d"}.icon-f95:before{content:"\e60e"}.icon-F:before{content:"\e60f"}.icon-F03:before{content:"\e610"}.icon-F90:before{content:"\e611"}.icon-F95:before{content:"\e612"}.icon-folder:before{content:"\e613"}.icon-folder-open:before{content:"\e614"}.icon-folder-symlink:before{content:"\e615"}.icon-gif:before{content:"\e616"}.icon-h:before{content:"\e617"}.icon-html:before{content:"\e618"}.icon-ico:before{content:"\e619"}.icon-ini:before{content:"\e61a"}.icon-jade:before{content:"\e61b"}.icon-jpeg:before{content:"\e61c"}.icon-jpg:before{content:"\e61d"}.icon-js:before{content:"\e61e"}.icon-less:before{content:"\e61f"}.icon-lnk:before{content:"\e620"}.icon-log:before{content:"\e621"}.icon-mako:before{content:"\e622"}.icon-pdf:before{content:"\e623"}.icon-png:before{content:"\e624"}.icon-ps:before{content:"\e625"}.icon-pxlio:before{content:"\e626"}.icon-py:before{content:"\e627"}.icon-pyc:before{content:"\e628"}.icon-rar:before{content:"\e629"}.icon-raw:before{content:"\e62a"}.icon-root:before{content:"\e62b"}.icon-sh:before{content:"\e62c"}.icon-svg:before{content:"\e62d"}.icon-tar:before{content:"\e62e"}.icon-targz:before{content:"\e62f"}.icon-tex:before{content:"\e630"}.icon-tif:before{content:"\e631"}.icon-tiff:before{content:"\e632"}.icon-txt:before{content:"\e633"}.icon-xml:before{content:"\e634"}.icon-yaml:before{content:"\e635"}.icon-yml:before{content:"\e636"}.icon-zip:before{content:"\e637"}.icon-bmp,.icon-gif,.icon-ico,.icon-jpeg,.icon-jpg,.icon-png,.icon-raw,.icon-svg,.icon-tif,.icon-tiff{color:#003b0b}.icon-c,.icon-cc,.icon-cpp,.icon-h{color:#3a539b}.icon-f,.icon-f03,.icon-f90,.icon-f95,.icon-F,.icon-F03,.icon-F90,.icon-F95{color:#3a539b}.icon-sh,.icon-csh{color:#3a539b}.icon-css,.icon-html,.icon-jade,.icon-js,.icon-less,.icon-mako{color:#913d88}.icon-tex,.icon-xml,.icon-yaml,.icon-yml{color:#913d88}.icon-py,.icon-pyc{color:#d99305}.icon-pxlio{color:#59abe3}.icon-root{color:#008a1a}.icon-eps,.icon-pdf,.icon-ps{color:#96281b}.icon-rar,.icon-tar,.icon-targz,.icon-zip{color:#4a1402}
\ No newline at end of file
/* main template */
.file-content {
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
-o-user-select: none;
user-select: none;
position: absolute;
height: 100%;
bottom: 0px;
right: 0px;
top: 0px;
left: 0px;
overflow: hidden;
}
.file-content > .alert {
position: absolute;
top: 40px;
width: 100%;
}
/* file selector */
.fileselector {
height: 300px;
}
.fileselector > .file-content > .alert {
top: 55px;
}
/* right click menu */
.actionmenu {
position: absolute;
display: none;
}
.file-menu {
height: 0px;
overflow: auto;
visibility: hidden;
}
/* info dialog - temporary: this leaves, when template of table view is used */
.table-info-dialog > tbody > tr > td {
border: none;
border: 0px;
border-top: 0px;
}
.table-info-dialog-width {
width: 114px;
}
.table-info-dialog {
overflow: hidden;
table-layout: fixed;
word-wrap: break-word;
}
.file-info-dialog-header {
margin-bottom: 20px;
}
.filterField {
bottom: 5px;
right: 5px;
position: absolute;
visibility: hidden;
width: 300px;
z-index: 99;
}
/* font for file icons */
@font-face {
font-family: 'file_icons';
src: url('../../fonts/file_icons.eot');
src: url('../../fonts/file_icons.eot') format('embedded-opentype'), url('../../fonts/file_icons.woff') format('woff'), url('../../fonts/file_icons.ttf') format('truetype'), url('../../fonts/file_icons.svg#file_icons') format('svg');
font-weight: normal;
font-style: normal;
}
[class^="icon-"],
[class*=" icon-"] {
font-family: 'file_icons';
color: #444;
/* Better Font Rendering */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-bmp:before {
content: "\e600";
}
.icon-c:before {
content: "\e601";
}
.icon-cc:before {
content: "\e602";
}
.icon-conf:before {
content: "\e603";
}
.icon-cpp:before {
content: "\e604";
}
.icon-csh:before {
content: "\e605";
}
.icon-css:before {
content: "\e606";
}
.icon-default:before {
content: "\e607";
}
.icon-default-alt:before {
content: "\e608";
}
.icon-default-symlink:before {
content: "\e609";
}
.icon-eps:before {
content: "\e60a";
}
.icon-f:before {
content: "\e60b";
}
.icon-f03:before {
content: "\e60c";
}
.icon-f90:before {
content: "\e60d";
}
.icon-f95:before {
content: "\e60e";
}
.icon-F:before {
content: "\e60f";
}
.icon-F03:before {
content: "\e610";
}
.icon-F90:before {
content: "\e611";
}
.icon-F95:before {
content: "\e612";
}
.icon-folder:before {
content: "\e613";
}
.icon-folder-open:before {
content: "\e614";
}
.icon-folder-symlink:before {
content: "\e615";
}
.icon-gif:before {
content: "\e616";
}
.icon-h:before {
content: "\e617";
}
.icon-html:before {
content: "\e618";
}
.icon-ico:before {
content: "\e619";
}
.icon-ini:before {
content: "\e61a";
}
.icon-jade:before {
content: "\e61b";
}
.icon-jpeg:before {
content: "\e61c";
}
.icon-jpg:before {
content: "\e61d";
}
.icon-js:before {
content: "\e61e";
}
.icon-less:before {
content: "\e61f";
}
.icon-lnk:before {
content: "\e620";
}
.icon-log:before {
content: "\e621";
}
.icon-mako:before {
content: "\e622";
}
.icon-pdf:before {
content: "\e623";
}
.icon-png:before {
content: "\e624";
}
.icon-ps:before {
content: "\e625";
}
.icon-pxlio:before {
content: "\e626";
}
.icon-py:before {
content: "\e627";
}
.icon-pyc:before {
content: "\e628";
}
.icon-rar:before {
content: "\e629";
}
.icon-raw:before {
content: "\e62a";
}
.icon-root:before {
content: "\e62b";
}
.icon-sh:before {
content: "\e62c";
}
.icon-svg:before {
content: "\e62d";
}
.icon-tar:before {
content: "\e62e";
}
.icon-targz:before {
content: "\e62f";
}
.icon-tex:before {
content: "\e630";
}
.icon-tif:before {
content: "\e631";
}
.icon-tiff:before {
content: "\e632";
}
.icon-txt:before {
content: "\e633";
}
.icon-xml:before {
content: "\e634";
}
.icon-yaml:before {
content: "\e635";
}
.icon-yml:before {
content: "\e636";
}
.icon-zip:before {
content: "\e637";
}
.icon-bmp,
.icon-gif,
.icon-ico,
.icon-jpeg,
.icon-jpg,
.icon-png,
.icon-raw,
.icon-svg,
.icon-tif,
.icon-tiff {
color: #003b0b;
}
.icon-c,
.icon-cc,
.icon-cpp,
.icon-h {
color: #3a539b;
}
.icon-f,
.icon-f03,
.icon-f90,
.icon-f95,
.icon-F,
.icon-F03,
.icon-F90,
.icon-F95 {
color: #3a539b;
}
.icon-sh,
.icon-csh {
color: #3a539b;
}
.icon-css,
.icon-html,
.icon-jade,
.icon-js,
.icon-less,
.icon-mako {
color: #913d88;
}
.icon-tex,
.icon-xml,
.icon-yaml,
.icon-yml {
color: #913d88;
}
.icon-py,
.icon-pyc {
color: #d99305;
}
.icon-pxlio {
color: #59abe3;
}
.icon-root {
color: #008a1a;
}
.icon-eps,
.icon-pdf,
.icon-ps {
color: #96281b;
}
.icon-rar,
.icon-tar,
.icon-targz,
.icon-zip {
color: #4a1402;
}
......@@ -36,11 +36,19 @@
top: 0px;
left: 0px;
overflow: hidden;
> .alert {
position: absolute;
top: 40px;
width: 100%;
}
}
/* file selector */
.fileselector {
height: 300px;
> .file-content > .alert {
top: 55px;
}
}
/* right click menu */
......
......@@ -2,23 +2,14 @@
position: absolute;
top: 40px;
left: 0;
display: inline-flex;
display: -webkit-flex;
bottom: 0;
overflow: auto;
-webkit-user-select: none;
user-select: none;
-webkit-align-items: flex-start;
align-items: flex-start;
-webkit-justify-content: flex-start;
justify-content: flex-start;
float: left;
/* Or do it all in one line with flex flow */
-webkit-flex-flow: row wrap;
flex-flow: row wrap;
/* tweak the where items line up on the row */
/* valid values are: flex-start, flex-end, space-between, space-around, stretch */
-webkit-align-content: flex-start;
align-content: flex-start;
}
.file-view-symbol.icon-tiny .file-node {
margin: 5px;
......
......@@ -67,26 +67,27 @@
position: absolute;
top: 40px;
left: 0;
display: inline-flex;
display: -webkit-flex;
// display: inline-flex;
// display: -webkit-flex;
// max-height: 92%;
bottom: 0;
overflow: auto;
-webkit-user-select: none;
user-select: none;
-webkit-align-items: flex-start;
align-items: flex-start;
-webkit-justify-content: flex-start;
justify-content: flex-start;
float: left;
// -webkit-align-items: flex-start;
// align-items: flex-start;
// -webkit-justify-content: flex-start;
// justify-content: flex-start;
// flex-wrap: wrap;
// -webkit-flex-wrap: wrap;
/* Or do it all in one line with flex flow */
-webkit-flex-flow: row wrap;
flex-flow: row wrap;
// -webkit-flex-flow: row wrap;
// flex-flow: row wrap;
/* tweak the where items line up on the row */
/* valid values are: flex-start, flex-end, space-between, space-around, stretch */
-webkit-align-content: flex-start;
align-content: flex-start;
// -webkit-align-content: flex-start;
// align-content: flex-start;
&.icon-tiny {
.file-node {
margin: 5px;
......
<div role="alert" class="alert alert-danger">You don't have the permission to read this directory</div>
.alert.alert-danger(role="alert") You don't have the permission to read this directory
\ No newline at end of file
var FileBase = Class.extend({
init: function(instance) {
init: function (instance) {
var self = this;
this.instance = instance;
......@@ -17,7 +17,7 @@ var FileBase = Class.extend({
// the workflow object may be extended
this.workflow = {
path: this.instance.path,
parentpath: "",
parentpath: "/",
currentView: null,
data: null,
selectmode: false,
......@@ -34,7 +34,7 @@ var FileBase = Class.extend({
this.workflow.currentView = viewstring == "Symbol" ? Symbolview : Tableview;
// buffered refresh events
window.setInterval(function() {
window.setInterval(function () {
if (self.workflow.updateState == -2 || (self.workflow.updateState > 0 &&
($.now() - self.workflow.updateState) > (self.workflow.lazyUpdate ? 2000 : 0))) {
// 200ms since "move from/to" upon rename have a 160ms gap (idk why)
......@@ -45,12 +45,12 @@ var FileBase = Class.extend({
},
setContent: function(node) {
setContent: function (node) {
this.pathBar.setup(node);
this.view.setMainContainer(node);
},
changeView: function(viewConstructor) {
changeView: function (viewConstructor) {
var newView = new viewConstructor(this);
if (this.workflow.currentView !== null && newView.type == this.workflow.currentView.type)
......@@ -65,11 +65,11 @@ var FileBase = Class.extend({
this.workflow.currentView.render();
},
updateView: function(additionalDelay) {
updateView: function (additionalDelay) {
if (this.workflow.updateState >= 0) {
if (additionalDelay !== undefined) { // events may want to wait for more events
this.workflow.updateState =
Math.max(this.workflow.updateState, $.now() + additionalDelay);
Math.max(this.workflow.updateState, $.now() + additionalDelay);
} else { // everyone else wants a fast update
this.workflow.updateState = 1;
}
......@@ -78,7 +78,7 @@ var FileBase = Class.extend({
}
},
_updateView: function() {
_updateView: function () {
var self = this;
// remove the links needed for the preview lightbox
......@@ -86,8 +86,18 @@ var FileBase = Class.extend({
this.instance.GET("/ajax/fs/filecount", {
path: this.workflow.path,
watch_id: "0"
}).done(function(res) {
}).done(function (res) {
if (res.count < 0) {
self.instance.setLoading(true);
self.instance.getTemplate("html/alert.html",
function (err, tmpl) {
self.view.fileContentContainer.empty();
self.view.fileContentContainer.append(tmpl);
});
self.workflow.updateState++;
self.instance.setLoading(false);
return;
}
self.instance.setLoading(true, res.count > 50 ? 0 : null);
// Check if last request is less than one second away
......@@ -101,23 +111,25 @@ var FileBase = Class.extend({
self.view.fileContentContainer.empty();
}
promise.done(function(content) {
promise.done(function (content) {
if (Object.keys(content.filelist).length == 1 && content.filelist[0].warning !==
undefined) {
undefined) {
self.instance.alert(content.filelist[0].warning);
vispa.messenger.error(content.filelist[0].warning);
content.filelist = [];
}
self.refresh(content);
self.workflow.updateState++;
}).fail(function() {
}).fail(function () {
self.instance.setLoading(false);
self.workflow.updateState++;
});
}).fail(function (err) {
self.instance.close();
});
},
refresh: function(content, sort, reverse, filter) {
refresh: function (content, sort, reverse, filter) {
if (!content) {
return;
}
......
......@@ -10,7 +10,7 @@ var Symbolview = Class.extend({
render: function () {
var self = this;
this.instance.getTemplate("html/symbol.html", function (error, template) {
self.fileContentContainer.append(template);
//self.fileContentContainer.append(template);
self.template = template;
if (self.FileBase.workflow.data === null) {
self.FileBase.updateView();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment