Commit 5f5d1f8e authored by Benjamin Fischer's avatar Benjamin Fischer

extension/file2: limit number of shown items with various suggested actions

parent 68376353
......@@ -27,6 +27,9 @@
.file2.browser>.navigation-bar>.path>.path-edit>*{padding:1px 6px}
.file2.browser>.navigation-bar>.path>.path-edit input{-ms-flex:1 0 1px;flex:1 0 1px;border:none}
.file2.browser>.item-container{-ms-flex:1 0 1px;flex:1 0 1px}
.file2.browser>.item-container .overflow{text-align:center}
.file2.browser>.item-container .overflow>ul{display:inline-block;text-align:initial}
.file2.browser>.item-container .overflow>ul>li{cursor:pointer}
.file2.browser>.item-container.hide-actions .actions,.file2.browser>.item-container.hide-modified .modified,.file2.browser>.item-container.hide-size .size{display:none}
.file2.browser>.item-container.mini-actions .actions span{display:none}
.file2.browser>.item-container.detail{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap}
......
......@@ -143,6 +143,16 @@
}
> .item-container {
flex: 1 0 1px;
.overflow {
text-align: center;
> ul {
display: inline-block;
text-align: initial;
> li {
cursor: pointer;
}
}
}
&.hide-modified .modified,
&.hide-size .size,
&.hide-actions .actions {
......
......@@ -7,12 +7,19 @@
:path="path"
:loading="loading"
:workspace-id="workspaceId"
:path-edit.sync="pathEdit"
></navbar>
<component
:is="displayType"
:dims="dims"
:path="path"
:items="sortedItems"
:items="limitedItems"
><div class="overflow" v-if="overflow">Only showing <b>{{limit}} of {{sortedItems.length}}</b> files for performance reasons. You can:<br/><ul
><li @click="filterStart">Filter files by name ({{filterKey}}).</li
><li @click="pathEdit = true">Directly type the desired directory path.</li
><li @click="limit += limitStep">Show {{limitStep}} more files.</li
><li @click="limit = Infinity">Show all files (slow!).</li
></ul></div
></component>
<div
v-show="filterActive"
......
......@@ -44,5 +44,6 @@
:workspace-id="workspaceId"
:download-base="downloadBase"
></item>
<slot></slot>
</div>
</div>
......@@ -18,4 +18,5 @@
:download-base="downloadBase"
></item>
</div>
<slot></slot>
</div>
......@@ -3,6 +3,7 @@ define([
"./detail",
"./icons",
"./navbar",
"vispa/utils",
"vispa/vue/menu",
"vispa/filehandler2",
"text!../../html/vue/browser.html"
......@@ -11,6 +12,7 @@ define([
DetailVue,
IconsVue,
NavbarVue,
Utils,
Menu,
FileHandler2,
tBrowser
......@@ -25,6 +27,10 @@ define([
filterActive: false,
filterText: "",
filterError: "",
limit: 100,
limitBase: 100,
limitStep: 100,
pathEdit: false,
menuItems: {},
menuStyle: {},
}},
......@@ -78,6 +84,15 @@ define([
return 0;
});
},
overflow: function() {
return this.sortedItems.length > this.limit;
},
limitedItems: function() {
return this.overflow ? this.sortedItems.slice(0, this.limit) : this.sortedItems;
},
filterKey: function() {
return Utils.shortcutPP(this.view.prefs.get("keyFilter"));
},
filterNum: function() {
return this.items.length - this.filteredItems.length;
},
......@@ -189,6 +204,7 @@ define([
if (this.loadsem !== sem) return;
if (this.path !== data.path)
this.filterActive = false;
this.limit = this.limitBase;
this.path = data.path;
var items = data.filelist.map(function(d){
d.dragged = false;
......
......@@ -23,10 +23,13 @@ define([
path: String,
loading: Boolean,
workspaceId: Number,
pathEdit: {
type: Boolean,
default: false,
}
},
data: function() {return {
pathText: this.path,
pathEdit: false,
}},
computed: {
parts: function() {
......
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