Removed from d4s storage the fa dependency

This commit is contained in:
Vincenzo Cestone 2022-03-30 16:40:55 +02:00
parent 9a1a3b6c91
commit a9b018b39f
5 changed files with 21 additions and 12 deletions

View File

@ -6,8 +6,8 @@ class D4SStorageHtmlElement extends HTMLElement {
#d4s = null
#d4smissmsg = 'Required d4s-boot-2 component not found'
//#baseurl = 'https://api.dev.d4science.org'
#baseurl = 'https://storagehub.pre.d4science.net/storagehub/workspace'
#baseurl = 'https://api.d4science.org/workspace'
//#baseurl = 'https://storagehub.pre.d4science.net/storagehub/workspace'
constructor() {
super()
@ -17,11 +17,7 @@ class D4SStorageHtmlElement extends HTMLElement {
const linkElem1 = document.createElement('link')
linkElem1.setAttribute('rel', 'stylesheet')
linkElem1.setAttribute('href', 'https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css')
const linkElem2 = document.createElement('link')
linkElem2.setAttribute('rel', 'stylesheet')
linkElem2.setAttribute('href', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css')
root.appendChild(linkElem1)
root.appendChild(linkElem2)
}
get d4s() {
@ -53,7 +49,7 @@ class D4SStorageHtmlElement extends HTMLElement {
* Builds storagehub VREFolder tree
* <d4s-storage-tree
* /@filelist-id: identifier of d4s-storage-folder component
* /@baseurl: the base endpoint url [defaults to: https://storagehub.pre.d4science.net/storagehub/workspace]
* /@base-url: the base endpoint url [defaults to: https://api.d4science.org/workspace]
*/
window.customElements.define('d4s-storage-tree', class extends D4SStorageHtmlElement {
@ -233,7 +229,7 @@ window.customElements.define('d4s-storage-tree', class extends D4SStorageHtmlEle
*
* <d4s-storage-folder
* /@id: specify the id to join this component with storage tree component
* /@baseurl: the base endpoint url [defaults to: https://storagehub.pre.d4science.net/storagehub/workspace]
* /@base-url: the base endpoint url [defaults to: https://api.d4science.org/workspace]
*/
window.customElements.define('d4s-storage-folder', class extends D4SStorageHtmlElement {
@ -328,13 +324,13 @@ window.customElements.define('d4s-storage-folder', class extends D4SStorageHtmlE
}
iconTag(item) {
var i = `<i class="fa-regular fa-file fa-fw"></i>`
var i = `<img src="/storage/img/file-earmark.svg"></img>`
if (item['@class'].includes('FolderItem')) {
i = `<i class="fa-regular fa-folder fa-fw"></i>`
i = `<img src="/storage/img/folder.svg"></img>`
} else if (item['@class'].includes('ImageFile')) {
i = `<i class="fa-regular fa-image fa-fw"></i>`
i = `<img src="/storage/img/image.svg"></img>`
} else if (item['@class'].includes('PDFFileItem')) {
i = `<i class="fa-regular fa-file-pdf fa-fw"></i>`
i = `<img src="/storage/img/filetype-pdf.svg"></img>`
}
return '<span class="px-2">' + i + '</span>'
}

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-file-earmark" viewBox="0 0 16 16">
<path d="M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5L14 4.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5h-2z"/>
</svg>

After

Width:  |  Height:  |  Size: 304 B

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-filetype-pdf" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM1.6 11.85H0v3.999h.791v-1.342h.803c.287 0 .531-.057.732-.173.203-.117.358-.275.463-.474a1.42 1.42 0 0 0 .161-.677c0-.25-.053-.476-.158-.677a1.176 1.176 0 0 0-.46-.477c-.2-.12-.443-.179-.732-.179Zm.545 1.333a.795.795 0 0 1-.085.38.574.574 0 0 1-.238.241.794.794 0 0 1-.375.082H.788V12.48h.66c.218 0 .389.06.512.181.123.122.185.296.185.522Zm1.217-1.333v3.999h1.46c.401 0 .734-.08.998-.237a1.45 1.45 0 0 0 .595-.689c.13-.3.196-.662.196-1.084 0-.42-.065-.778-.196-1.075a1.426 1.426 0 0 0-.589-.68c-.264-.156-.599-.234-1.005-.234H3.362Zm.791.645h.563c.248 0 .45.05.609.152a.89.89 0 0 1 .354.454c.079.201.118.452.118.753a2.3 2.3 0 0 1-.068.592 1.14 1.14 0 0 1-.196.422.8.8 0 0 1-.334.252 1.298 1.298 0 0 1-.483.082h-.563v-2.707Zm3.743 1.763v1.591h-.79V11.85h2.548v.653H7.896v1.117h1.606v.638H7.896Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

3
storage/img/folder.svg Normal file
View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-folder" viewBox="0 0 16 16">
<path d="M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.826a2 2 0 0 1-1.991-1.819l-.637-7a1.99 1.99 0 0 1 .342-1.31zM2.19 4a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91h10.348a1 1 0 0 0 .995-.91l.637-7A1 1 0 0 0 13.81 4H2.19zm4.69-1.707A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139C1.72 3.042 1.95 3 2.19 3h5.396l-.707-.707z"/>
</svg>

After

Width:  |  Height:  |  Size: 556 B

4
storage/img/image.svg Normal file
View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-image" viewBox="0 0 16 16">
<path d="M6.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"/>
<path d="M2.002 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2h-12zm12 1a1 1 0 0 1 1 1v6.5l-3.777-1.947a.5.5 0 0 0-.577.093l-3.71 3.71-2.66-1.772a.5.5 0 0 0-.63.062L1.002 12V3a1 1 0 0 1 1-1h12z"/>
</svg>

After

Width:  |  Height:  |  Size: 410 B