added derivation button

This commit is contained in:
dcore94 2023-11-16 13:45:24 +01:00
parent 5476851d1f
commit 7f76178458
1 changed files with 11 additions and 2 deletions

View File

@ -286,10 +286,11 @@ class CCPMethodEditorController extends HTMLElement{
}
}
cloneMethod(method){
cloneMethod(method, derivation){
if(this.#locked) return;
this.lockRender()
this.#boot.secureFetch(this.#serviceurl + "/methods/" + method + "/clone").then(
const op = derivation ? "derive" : "clone"
this.#boot.secureFetch(this.#serviceurl + "/methods/" + method + "/derive").then(
(resp)=>{
if(resp.status === 200){
return resp.json()
@ -373,6 +374,7 @@ class CCPMethodEditorController extends HTMLElement{
<div class="modal-footer">
<button name="clone" type="button" class="btn btn-info">Clone</button>
<button name="edit" type="button" class="btn btn-primary">Edit</button>
<button name="derive" type="button" class="btn btn-secondary">Derive</button>
</div>
</div>
</div>
@ -510,6 +512,13 @@ class CCPMethodEditorController extends HTMLElement{
this.#dragging_method = null
})
this.#rootdoc.querySelector("#cloneornew button[name=derive]").addEventListener("click", ev=>{
this.#cloneornew_dialog.classList.remove("show")
this.#cloneornew_dialog.style.display = "none"
this.cloneMethod(this.#dragging_method, true)
this.#dragging_method = null
})
this.#rootdoc.querySelector("#cloneornew button[name=edit]").addEventListener("click", ev=>{
this.#cloneornew_dialog.classList.remove("show")
this.#cloneornew_dialog.style.display = "none"