enter cloneOrEdit workflow by passing whole structure

This commit is contained in:
dcore94 2023-03-17 11:41:26 +01:00
parent 234d852742
commit 37bd3a9b17
2 changed files with 3 additions and 22 deletions

View File

@ -172,19 +172,8 @@ class CCPMethodEditorController extends HTMLElement{
connectNewEditRequest(){ connectNewEditRequest(){
document.addEventListener("neweditrequest", ev=>{ document.addEventListener("neweditrequest", ev=>{
if(window.confirm("Confirm editing method?")){ this.parentElement.scrollIntoViewIfNeeded()
this.editMethod(ev.detail) this.cloneOrEditMethod(ev.detail)
this.parentElement.scrollIntoViewIfNeeded()
}
})
}
connectNewCloneRequest(){
document.addEventListener("newclonerequest", ev=>{
if(window.confirm("Confirm cloning of method?")){
this.cloneMethod(ev.detail)
this.parentElement.scrollIntoViewIfNeeded()
}
}) })
} }

View File

@ -101,11 +101,6 @@ class CCPMethodList2 extends HTMLElement{
<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"/> <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> </svg>
</button> </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>
</div> </div>
<p class="m-0 p-0 small" name="description"></p> <p class="m-0 p-0 small" name="description"></p>
@ -343,10 +338,7 @@ class CCPMethodList2 extends HTMLElement{
const event = new CustomEvent('newexecutionrequest', { detail: id }); const event = new CustomEvent('newexecutionrequest', { detail: id });
document.dispatchEvent(event) document.dispatchEvent(event)
}else if(ev.target.getAttribute("name") === "edit"){ }else if(ev.target.getAttribute("name") === "edit"){
const event = new CustomEvent('neweditrequest', { detail: id }); const event = new CustomEvent('neweditrequest', { detail: ev.currentTarget.bss_input.data });
document.dispatchEvent(event)
}else if(ev.target.getAttribute("name") === "clone"){
const event = new CustomEvent('newclonerequest', { detail: id });
document.dispatchEvent(event) document.dispatchEvent(event)
} }
}, },