moved tool addition for remote file to render time

This commit is contained in:
dcore94 2023-10-27 15:37:53 +02:00
parent b891562705
commit 1d6fe0beb8
1 changed files with 7 additions and 13 deletions

View File

@ -509,20 +509,8 @@ window.customElements.define('d4s-ccp-input-file', CCPFileInputWidgetController)
class CCPRemoteFileInputWidgetController extends CCPBaseInputWidgetController{
#iss = null;
#addresses = {
"https://accounts.dev.d4science.org/auth/realms/d4science" : "https://workspace-repository.dev.d4science.org/storagehub/workspace",
"https://accounts.pre.d4science.org/auth/realms/d4science" : "https://pre.d4science.org/workspace",
"https://accounts.d4science.org/auth/realms/d4science" : "https://api.d4science.org/workspace"
};
constructor(){
super()
this.#iss = document.querySelector("d4s-boot-2").loginToken.iss
}
get baseurl(){
return this.#addresses[this.#iss]
}
connectedCallback(){
@ -535,6 +523,12 @@ class CCPRemoteFileInputWidgetController extends CCPBaseInputWidgetController{
}
addToolContent(){
const iss = document.querySelector("d4s-boot-2").loginToken.iss;
const addresses = {
"https://accounts.dev.d4science.org/auth/realms/d4science" : "https://workspace-repository.dev.d4science.org/storagehub/workspace",
"https://accounts.pre.d4science.org/auth/realms/d4science" : "https://pre.d4science.org/workspace",
"https://accounts.d4science.org/auth/realms/d4science" : "https://api.d4science.org/workspace"
};
this.rootdoc.querySelector("div[name=tools]").innerHTML += `
<svg name="trigger" style="width:24;height:24;fill:#007bff; cursor:pointer" viewBox="0 -960 960 960">
<path d="M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640H447l-80-80H160v480l96-320h684L837-217q-8 26-29.5 41.5T760-160H160Zm84-80h516l72-240H316l-72 240Zm0 0 72-240-72 240Zm-84-400v-80 80Z"/>
@ -545,7 +539,7 @@ class CCPRemoteFileInputWidgetController extends CCPBaseInputWidgetController{
<span class="btn text-danger p-0" style="font-weight:bold" name="closebtn">x</span>
</div>
<d4s-storage-tree
base-url="${this.baseurl}"
base-url="${addresses[iss]}"
file-download-enabled="true"
show-files="true"
allow-drag="true"/>