File list + Rest API

This commit is contained in:
mauriziovitale84
2016-04-07 18:32:40 +01:00
parent 6fb2323a02
commit 75911f8d9c
14 changed files with 681 additions and 3 deletions

View File

@@ -0,0 +1,165 @@
<link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="import" href="../../../bower_components/iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../../../bower_components/iron-ajax/iron-ajax.html">
<link rel="import" href="../../../bower_components/iron-list/iron-list.html">
<link rel="import" href="../../../bower_components/paper-styles/color.html">
<link rel="import" href="../../../bower_components/paper-styles/typography.html">
<link rel="import" href="../../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../../bower_components/iron-icon/iron-icon.html">
<link rel="import" href="../../../bower_components/paper-badge/paper-badge.html">
<style>
.pad {
@apply(--layout-flex);
@apply(--layout-vertical);
padding: 0 16px;
}
.dim {
color: gray;
}
paper-badge {
-webkit-transition: all 0.1s;
transition: all 0.1s;
opacity: 1;
margin-top: 5px;
}
paper-badge[label="0"] {
opacity: 0;
}
paper-item {
white-space: nowrap;
cursor: pointer;
position: relative;
}
paper-item:hover::after {
content: "";
width: 16px;
height: 16px;
display: block;
border-radius: 50% 50%;
background-color: var(--google-red-300);
margin-left: 10px;
line-height: 16px;
text-align: center;
color: white;
font-weight: bold;
text-decoration: none;
position: absolute;
right: 15px;
top: calc(50% - 8px);
}
ul { list-style-type: none; overflow: hidden; width:800px; margin:10px}
ul li div.text{ float:left; width: 400px;text-align: left;height: 55px }
ul li div.folder-container{ float:left; width: 70px;text-align: left ;height: 55px}
ul li:hover { background: #eeeeee; height: 55px}
.folder {
height: 52px;
box-sizing: border-box;
}
.primary {
font-size: 16px;
line-height: 20px;
font-family: sans-serif;
}
.secondary {
font-size: 12px;
line-height: 20px;
color: gray;
font-family: sans-serif;
}
paper-dropdown-menu.custom {
overflow: visible;
--paper-input-container-label: {
color: white;
background-color: var(--paper-pink-500);
font-style: italic;
text-align: center;
font-weight: bold;
};
--paper-input-container-input: {
color: var(--paper-indigo-500);
font-style: normal;
font-family: serif;
text-transform: uppercase;
}
/* no underline */
--paper-input-container-underline: {
display: none;
};
}
</style>
<dom-module id="alfresco-file-list">
<template>
<!-- Main List for the items -->
<iron-list id="itemsList" items="{{data}}" selected-items="{{selectedItems}}" selection-enabled multi-selection>
<template>
<div>
<ul tabindex$="[[tabIndex]]" aria-label$="Select/Deselect [[item.name]]" class$="[[_computedClass(selected)]]">
<li>
<div class="folder-container"><img class="folder" src="img/folder.svg"></div>
<div class="text">
<div class="pad">
<div class="primary">
[[item.displayName]]
</div>
<div class="secondary dim">
[[item.node.description]]
</div>
<div class="secondary dim">
Modified [[item.modifiedOn]] by [[item.modifiedBy]]
</div>
</div>
</div>
<div lass="dropdowm menu">
<paper-dropdown-menu class="custom" label="Actions" no-label-float>
<paper-listbox class="dropdown-content">
<paper-item>Download as Zip</paper-item>
<paper-item>View Details</paper-item>
<paper-item>Edit Properties</paper-item>
<paper-item>Copy To...</paper-item>
<paper-item>Move To...</paper-item>
</paper-listbox>
</paper-dropdown-menu>
</div>
</li>
</ul>
<div class="border"></div>
</div>
</template>
</iron-list>
</template>
<script>
Polymer({
is: "alfresco-file-list",
ready: function() {
this.url ="http://192.168.99.100:8080/alfresco/service/slingshot/doclib/doclist/all/site/swsdp/documentLibrary";
function error () {
console.log("error");
}
var xhr = new XMLHttpRequest();
xhr.addEventListener("load", (XMLHttpRequestProgressEvent)=>{
this.data =JSON.parse(XMLHttpRequestProgressEvent.currentTarget.response).items;
});
xhr.addEventListener("error", error);
xhr.open("GET", this.url);
xhr.withCredentials = true;
xhr.setRequestHeader("Authorization", 'Basic ' + btoa('admin:admin'));
xhr.send();
}
});
</script>
</dom-module>

View File

@@ -0,0 +1,283 @@
{
"totalRecords": 4,
"startIndex": 0,
"metadata": {
"repositoryId": "302393f7-5fad-4c61-ab75-05e990bd86d6",
"container": "workspace://SpacesStore/8f2105b4-daaf-4874-9e8a-2152569d109b",
"parent": {
"nodeRef": "workspace://SpacesStore/8f2105b4-daaf-4874-9e8a-2152569d109b",
"permissions": {
"userAccess": {
"create": true,
"edit": true,
"delete": true,
"cancel-checkout": false,
"permissions": true
}
}
},
"onlineEditing": false,
"itemCounts": {
"folders": 4,
"documents": 0
}
},
"items": [
{
"nodeRef": "workspace://SpacesStore/8bb36efb-c26d-4d2b-9199-ab6922f53c28",
"nodeType": "cm:folder",
"type": "folder",
"mimetype": "",
"isFolder": true,
"isLink": false,
"fileName": "Agency Files",
"displayName": "Agency Files",
"status": "",
"title": "Agency related files",
"description": "This folder holds the agency related files for the project",
"author": "",
"createdOn": "2011-02-15T20:47:03.951Z",
"createdBy": "Mike Jackson",
"createdByUser": "mjackson",
"modifiedOn": "2011-02-15T21:00:43.616Z",
"modifiedBy": "Mike Jackson",
"modifiedByUser": "mjackson",
"lockedBy": "",
"lockedByUser": "",
"size": "0",
"version": "1.0",
"contentUrl": "api/node/content/workspace/SpacesStore/8bb36efb-c26d-4d2b-9199-ab6922f53c28/Agency%20Files",
"webdavUrl": "/webdav/Sites/swsdp/documentLibrary/Agency%20Files",
"actionSet": "folder",
"tags": [],
"activeWorkflows": "",
"likes": {
"isLiked": false,
"totalLikes": 0
},
"location": {
"repositoryId": "302393f7-5fad-4c61-ab75-05e990bd86d6",
"site": "swsdp",
"siteTitle": "Sample: Web Site Design Project",
"container": "documentLibrary",
"path": "/",
"file": "Agency Files",
"parent": {
"nodeRef": "workspace://SpacesStore/8f2105b4-daaf-4874-9e8a-2152569d109b"
}
},
"permissions": {
"inherited": true,
"roles": [
"ALLOWED;GROUP_site_swsdp_SiteCollaborator;SiteCollaborator;INHERITED",
"ALLOWED;GROUP_EVERYONE;SiteConsumer;INHERITED",
"ALLOWED;GROUP_EVERYONE;ReadPermissions;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteContributor;SiteContributor;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteConsumer;SiteConsumer;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteManager;SiteManager;INHERITED"
],
"userAccess": {
"create": true,
"edit": true,
"delete": true,
"cancel-checkout": false,
"permissions": true
}
},
"custom": {},
"actionLabels": {}
},
{
"nodeRef": "workspace://SpacesStore/8ab12916-4897-47fb-94eb-1ab699822ecb",
"nodeType": "cm:folder",
"type": "folder",
"mimetype": "",
"isFolder": true,
"isLink": false,
"fileName": "Budget Files",
"displayName": "Budget Files",
"status": "",
"title": "Project finance files",
"description": "This folder holds the project budget and invoices",
"author": "",
"createdOn": "2011-02-15T20:50:25.839Z",
"createdBy": "Mike Jackson",
"createdByUser": "mjackson",
"modifiedOn": "2011-02-15T21:08:20.590Z",
"modifiedBy": "Mike Jackson",
"modifiedByUser": "mjackson",
"lockedBy": "",
"lockedByUser": "",
"size": "0",
"version": "1.0",
"contentUrl": "api/node/content/workspace/SpacesStore/8ab12916-4897-47fb-94eb-1ab699822ecb/Budget%20Files",
"webdavUrl": "/webdav/Sites/swsdp/documentLibrary/Budget%20Files",
"actionSet": "folder",
"tags": [],
"activeWorkflows": "",
"likes": {
"isLiked": false,
"totalLikes": 0
},
"location": {
"repositoryId": "302393f7-5fad-4c61-ab75-05e990bd86d6",
"site": "swsdp",
"siteTitle": "Sample: Web Site Design Project",
"container": "documentLibrary",
"path": "/",
"file": "Budget Files",
"parent": {
"nodeRef": "workspace://SpacesStore/8f2105b4-daaf-4874-9e8a-2152569d109b"
}
},
"permissions": {
"inherited": true,
"roles": [
"ALLOWED;GROUP_site_swsdp_SiteCollaborator;SiteCollaborator;INHERITED",
"ALLOWED;GROUP_EVERYONE;SiteConsumer;INHERITED",
"ALLOWED;GROUP_EVERYONE;ReadPermissions;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteContributor;SiteContributor;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteConsumer;SiteConsumer;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteManager;SiteManager;INHERITED"
],
"userAccess": {
"create": true,
"edit": true,
"delete": true,
"cancel-checkout": false,
"permissions": true
}
},
"custom": {},
"actionLabels": {}
},
{
"nodeRef": "workspace://SpacesStore/a211774d-ba6d-4a35-b97f-dacfaac7bde3",
"nodeType": "cm:folder",
"type": "folder",
"mimetype": "",
"isFolder": true,
"isLink": false,
"fileName": "Meeting Notes",
"displayName": "Meeting Notes",
"status": "",
"title": "Project meeting notes",
"description": "This folder holds notes from the project review meetings",
"author": "",
"createdOn": "2011-02-15T21:16:26.500Z",
"createdBy": "Mike Jackson",
"createdByUser": "mjackson",
"modifiedOn": "2011-02-15T21:16:26.500Z",
"modifiedBy": "Mike Jackson",
"modifiedByUser": "mjackson",
"lockedBy": "",
"lockedByUser": "",
"size": "0",
"version": "1.0",
"contentUrl": "api/node/content/workspace/SpacesStore/a211774d-ba6d-4a35-b97f-dacfaac7bde3/Meeting%20Notes",
"webdavUrl": "/webdav/Sites/swsdp/documentLibrary/Meeting%20Notes",
"actionSet": "folder",
"tags": [],
"activeWorkflows": "",
"likes": {
"isLiked": false,
"totalLikes": 0
},
"location": {
"repositoryId": "302393f7-5fad-4c61-ab75-05e990bd86d6",
"site": "swsdp",
"siteTitle": "Sample: Web Site Design Project",
"container": "documentLibrary",
"path": "/",
"file": "Meeting Notes",
"parent": {
"nodeRef": "workspace://SpacesStore/8f2105b4-daaf-4874-9e8a-2152569d109b"
}
},
"permissions": {
"inherited": true,
"roles": [
"ALLOWED;GROUP_site_swsdp_SiteCollaborator;SiteCollaborator;INHERITED",
"ALLOWED;GROUP_EVERYONE;SiteConsumer;INHERITED",
"ALLOWED;GROUP_EVERYONE;ReadPermissions;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteContributor;SiteContributor;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteConsumer;SiteConsumer;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteManager;SiteManager;INHERITED"
],
"userAccess": {
"create": true,
"edit": true,
"delete": true,
"cancel-checkout": false,
"permissions": true
}
},
"custom": {},
"actionLabels": {}
},
{
"nodeRef": "workspace://SpacesStore/38745585-816a-403f-8005-0a55c0aec813",
"nodeType": "cm:folder",
"type": "folder",
"mimetype": "",
"isFolder": true,
"isLink": false,
"fileName": "Presentations",
"displayName": "Presentations",
"status": "",
"title": "Project presentations",
"description": "This folder holds presentations from the project",
"author": "",
"createdOn": "2011-02-15T21:18:38.144Z",
"createdBy": "Mike Jackson",
"createdByUser": "mjackson",
"modifiedOn": "2011-02-15T21:18:38.144Z",
"modifiedBy": "Mike Jackson",
"modifiedByUser": "mjackson",
"lockedBy": "",
"lockedByUser": "",
"size": "0",
"version": "1.0",
"contentUrl": "api/node/content/workspace/SpacesStore/38745585-816a-403f-8005-0a55c0aec813/Presentations",
"webdavUrl": "/webdav/Sites/swsdp/documentLibrary/Presentations",
"actionSet": "folder",
"tags": [],
"activeWorkflows": "",
"likes": {
"isLiked": false,
"totalLikes": 0
},
"location": {
"repositoryId": "302393f7-5fad-4c61-ab75-05e990bd86d6",
"site": "swsdp",
"siteTitle": "Sample: Web Site Design Project",
"container": "documentLibrary",
"path": "/",
"file": "Presentations",
"parent": {
"nodeRef": "workspace://SpacesStore/8f2105b4-daaf-4874-9e8a-2152569d109b"
}
},
"permissions": {
"inherited": true,
"roles": [
"ALLOWED;GROUP_site_swsdp_SiteCollaborator;SiteCollaborator;INHERITED",
"ALLOWED;GROUP_EVERYONE;SiteConsumer;INHERITED",
"ALLOWED;GROUP_EVERYONE;ReadPermissions;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteContributor;SiteContributor;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteConsumer;SiteConsumer;INHERITED",
"ALLOWED;GROUP_site_swsdp_SiteManager;SiteManager;INHERITED"
],
"userAccess": {
"create": true,
"edit": true,
"delete": true,
"cancel-checkout": false,
"permissions": true
}
},
"custom": {},
"actionLabels": {}
}
]
}

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 64 64" width="64" height="64" style="enable-background:new 0 0 64 64;" xml:space="preserve">
<style type="text/css">
.st0{fill:#0C79BF;}
</style>
<g>
<path class="st0" d="M0,27.9v29.9c0,1.4,1.1,2.5,2.5,2.5h59.1c1.4,0,2.5-1.1,2.5-2.5V27.9H0z"/>
<path class="st0" d="M0,23.7h64V13.5c0-1.4-1.1-2.5-2.5-2.5H30l-6.2-6.5C23.3,4,22.7,3.7,22,3.7H0V23.7z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 639 B