Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just In Time folder structure loading #15

Merged
merged 1 commit into from
Jul 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
"Chunked" mode speed optimization.
This loads the side folder structures as needed, and not all at once on application load
  • Loading branch information
jcrowthe committed Jul 25, 2017
commit 5ed0b5d5653ccce2ffe6c99955d2c3ed2c2f919d
58 changes: 36 additions & 22 deletions app/elements/folder-structure.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,36 +66,42 @@
}
</style>
<template>
<paper-menu attr-for-selected="data-route" selected="{{route}}" class="menu-content">
<a data-route="create{{indent}}" href="{{baseUrl}}create" class="noselect" create-location="{{createLocation}}" style="padding-left: {{indent}}px" on-tap="_setLocation">
<iron-icon class="iconsize" icon="add"></iron-icon>
<span style="white-space: nowrap;">New</span>
</a>
<template is="dom-repeat" items="{{secrets}}" filter="_filterFolders" sort="_sort">
<paper-submenu attr-for-selected="data-route" selected="{{route}}">
<a data-route="{{item.type}}/{{item.location}}" href="{{baseUrl}}folder/{{item.location}}" class="noselect menu-trigger" style="padding-left: {{indent}}px">
<iron-icon class="iconsize" icon="folder-open"></iron-icon>
<span style="white-space: nowrap;">{{item.parsedname}}</span>
</a>
<paper-menu class="menu-content">
<folder-structure secrets="[[secrets]]" route="{{route}}" base-url="{{baseUrl}}" base-folder="{{item.location}}" indent="{{spacing}}" create-location="{{createLocation}}"></folder-structure>
</paper-menu>
</paper-submenu>
</template>
<template is="dom-repeat" items="{{secrets}}" filter="_filterSecrets" sort="_sort">
<a data-route="{{item.type}}/{{item.location}}" href="{{baseUrl}}secret/{{item.location}}" class="noselect" style="padding-left: {{indent}}px">
<iron-icon class="iconsize" icon="communication:vpn-key"></iron-icon>
<span style="white-space: nowrap;">{{item.parsedname}}</span>
<template is="dom-if" if="{{print}}">
<paper-menu attr-for-selected="data-route" selected="{{route}}" class="menu-content">
<a data-route="create{{indent}}" href="{{baseUrl}}create" class="noselect" create-location="{{createLocation}}" style="padding-left: {{indent}}px" on-tap="_setLocation">
<iron-icon class="iconsize" icon="add"></iron-icon>
<span style="white-space: nowrap;">New</span>
</a>
</template>
</paper-menu>
<template is="dom-repeat" items="{{secrets}}" filter="_filterFolders" sort="_sort">
<paper-submenu attr-for-selected="data-route" selected="{{route}}">
<a data-route="{{item.type}}/{{item.location}}" href="{{baseUrl}}folder/{{item.location}}" class="noselect menu-trigger" style="padding-left: {{indent}}px">
<iron-icon class="iconsize" icon="folder-open"></iron-icon>
<span style="white-space: nowrap;">{{item.parsedname}}</span>
</a>
<paper-menu class="menu-content">
<folder-structure secrets="[[secrets]]" route="{{route}}" folder-route="{{folderRoute}}" base-url="{{baseUrl}}" base-folder="{{item.location}}" indent="{{spacing}}" create-location="{{createLocation}}"></folder-structure>
</paper-menu>
</paper-submenu>
</template>
<template is="dom-repeat" items="{{secrets}}" filter="_filterSecrets" sort="_sort">
<a data-route="{{item.type}}/{{item.location}}" href="{{baseUrl}}secret/{{item.location}}" class="noselect" style="padding-left: {{indent}}px">
<iron-icon class="iconsize" icon="communication:vpn-key"></iron-icon>
<span style="white-space: nowrap;">{{item.parsedname}}</span>
</a>
</template>
</paper-menu>
</template>
</template>

<script>
Polymer({
is: "folder-structure",
properties: {
route: String,
folderRoute: {
type: String,
observer: '_watchFolderRoute'
},
baseURL: String,
secrets: Array,
baseFolder: String,
Expand All @@ -108,8 +114,16 @@
createLocation: {
value: '',
notify: true
},
print: {
type: Boolean,
value: false,
notify: true
}
},
_watchFolderRoute: function(){
if (this.baseFolder == this.folderRoute) this.print = true;
},
_watchIndent: function(){
this.spacing = this.indent + 20;
},
Expand Down
2 changes: 1 addition & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</paper-menu>

<span id="drawerMenuText" class="noselect">SECRETS</span>
<folder-structure secrets="[[secrets]]" route="{{route}}" base-url="{{baseUrl}}" base-folder="secret" indent="20" create-location="{{createLocation}}"></folder-structure>
<folder-structure secrets="[[secrets]]" route="{{route}}" folder-route="{{folderRoute}}" base-url="{{baseUrl}}" base-folder="secret" indent="20" create-location="{{createLocation}}" print></folder-structure>
</div>

<div class="bottom-corner" style="color: #737373;">
Expand Down