From 655c80d34e4feb5d7ef85102b2183fee889b5185 Mon Sep 17 00:00:00 2001 From: dcore94 Date: Mon, 10 Jul 2023 15:31:34 +0200 Subject: [PATCH 1/3] distinguish shared from non shared methods --- ccp/js/methodlistcontroller.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ccp/js/methodlistcontroller.js b/ccp/js/methodlistcontroller.js index e459787..15d2c8b 100644 --- a/ccp/js/methodlistcontroller.js +++ b/ccp/js/methodlistcontroller.js @@ -332,6 +332,10 @@ class CCPMethodList extends HTMLElement{ }).catch(err=>{ alert(err)}) } + isShared(process){ + return 0 < process.metadata.filter(md=>{ return md.role === "context" && mt.title === this.#boot.context}) + } + isAuthor(m){ const href = `${this.#boot.url}/admin/realms/${this.#boot.realm}/users/${this.#boot.subject}` const found = m.metadata.filter(md=>{return md.role === "author" && md.href === href}) @@ -447,7 +451,16 @@ class CCPMethodList extends HTMLElement{ }, { target: "button[name=publish]", - apply : (e,d)=>{ e.style.display = this.isAuthor(d) ? "revert" : "none" } + apply : (e,d)=>{ + if(this.isShared(d)){ + const span = document.createElement("span") + span.classList.add("bg-warning") + span.textContent = "shared" + e.replaceWith(span) + }else if(!this.isAuthor(d)){ + e.parentElement.removeChild(e) + } + } }, { target : "span[name=author]", From 41f245d4a45beb2d3eddcecb6ab09c60b79c5ab0 Mon Sep 17 00:00:00 2001 From: dcore94 Date: Mon, 10 Jul 2023 15:41:55 +0200 Subject: [PATCH 2/3] fixed code and modified shared tooltip --- ccp/js/methodlistcontroller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ccp/js/methodlistcontroller.js b/ccp/js/methodlistcontroller.js index 15d2c8b..83fb675 100644 --- a/ccp/js/methodlistcontroller.js +++ b/ccp/js/methodlistcontroller.js @@ -83,7 +83,7 @@ class CCPMethodList extends HTMLElement{ ` : `` } - @@ -333,7 +333,7 @@ class CCPMethodList extends HTMLElement{ } isShared(process){ - return 0 < process.metadata.filter(md=>{ return md.role === "context" && mt.title === this.#boot.context}) + return 0 < process.metadata.filter(md=>{ return md.role === "context" && md.title === this.#boot.context}).length } isAuthor(m){ From 55bc837be3a768928fc397770ad4dcddf268ebbe Mon Sep 17 00:00:00 2001 From: dcore94 Date: Mon, 10 Jul 2023 15:45:07 +0200 Subject: [PATCH 3/3] fine tuining visuals --- ccp/js/methodlistcontroller.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ccp/js/methodlistcontroller.js b/ccp/js/methodlistcontroller.js index 83fb675..f287eaa 100644 --- a/ccp/js/methodlistcontroller.js +++ b/ccp/js/methodlistcontroller.js @@ -418,7 +418,7 @@ class CCPMethodList extends HTMLElement{ this.toArchive(id) } }else if(ev.target.getAttribute("name") === "publish"){ - if(confirm("Please confirm publication of method to VRE?")){ + if(confirm("Please confirm publication of method to Vlab?")){ this.publish(id) } } @@ -454,7 +454,8 @@ class CCPMethodList extends HTMLElement{ apply : (e,d)=>{ if(this.isShared(d)){ const span = document.createElement("span") - span.classList.add("bg-warning") + span.classList.add("badge") + span.classList.add("badge-warning") span.textContent = "shared" e.replaceWith(span) }else if(!this.isAuthor(d)){