added click action also for edit

This commit is contained in:
dcore94 2023-03-17 11:28:05 +01:00
parent f91e32bf43
commit 234d852742
2 changed files with 37 additions and 2 deletions

View File

@ -163,12 +163,31 @@ class CCPMethodEditorController extends HTMLElement{
this.#serviceurl = this.getAttribute("serviceurl")
this.initMethod()
this.fetchInfrastructures()
this.connectNewEditRequest()
}
connectedCallback(){
}
connectNewEditRequest(){
document.addEventListener("neweditrequest", ev=>{
if(window.confirm("Confirm editing method?")){
this.editMethod(ev.detail)
this.parentElement.scrollIntoViewIfNeeded()
}
})
}
connectNewCloneRequest(){
document.addEventListener("newclonerequest", ev=>{
if(window.confirm("Confirm cloning of method?")){
this.cloneMethod(ev.detail)
this.parentElement.scrollIntoViewIfNeeded()
}
})
}
isInfrastructureRegistered(infra){
return (this.#infrastructures.filter(i=>i.id === infra.id)).length > 0
}

View File

@ -94,7 +94,17 @@ class CCPMethodList2 extends HTMLElement{
</svg>
</button>
<button name="export_method" title="Export this version" class="btn btn-primary ccp-toolbar-button ccp-toolbar-button-small">
<svg viewBox="0 0 24 24"><g><rect fill="none" height="24" width="24"/></g><g><path d="M18,15v3H6v-3H4v3c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2v-3H18z M17,11l-1.41-1.41L13,12.17V4h-2v8.17L8.41,9.59L7,11l5,5 L17,11z"/></g></svg>
<svg viewBox="0 0 24 24"><g><rect fill="none"/></g><g><path d="M18,15v3H6v-3H4v3c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2v-3H18z M17,11l-1.41-1.41L13,12.17V4h-2v8.17L8.41,9.59L7,11l5,5 L17,11z"/></g></svg>
</button>
<button name="edit" title="Edit" class="btn btn-primary ccp-toolbar-button ccp-toolbar-button-small">
<svg viewBox="0 0 48 48">
<path d="M9 39h2.2l22.15-22.15-2.2-2.2L9 36.8Zm30.7-24.3-6.4-6.4 2.1-2.1q.85-.85 2.1-.85t2.1.85l2.2 2.2q.85.85.85 2.1t-.85 2.1Zm-2.1 2.1L12.4 42H6v-6.4l25.2-25.2Zm-5.35-1.05-1.1-1.1 2.2 2.2Z"/>
</svg>
</button>
<button name="clone" title="Clone" class="btn btn-primary ccp-toolbar-button ccp-toolbar-button-small">
<svg viewBox="0 0 48 48">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z"/>
</svg>
</button>
</div>
</div>
@ -332,6 +342,12 @@ class CCPMethodList2 extends HTMLElement{
}else if(ev.target.getAttribute("name") === "executable"){
const event = new CustomEvent('newexecutionrequest', { detail: id });
document.dispatchEvent(event)
}else if(ev.target.getAttribute("name") === "edit"){
const event = new CustomEvent('neweditrequest', { detail: id });
document.dispatchEvent(event)
}else if(ev.target.getAttribute("name") === "clone"){
const event = new CustomEvent('newclonerequest', { detail: id });
document.dispatchEvent(event)
}
},
on_dragstart : ev=>{