moved to method service instead of ogc, added author in editor and clone adn editable are now service calls
This commit is contained in:
parent
6ee7bda28e
commit
8132792fa0
|
@ -18,6 +18,7 @@ class CCPMethodEditorController extends HTMLElement{
|
||||||
description : "New empty method",
|
description : "New empty method",
|
||||||
version : "1.0.0",
|
version : "1.0.0",
|
||||||
jobControlOptions : "async-execute",
|
jobControlOptions : "async-execute",
|
||||||
|
metadata : [],
|
||||||
inputs : {},
|
inputs : {},
|
||||||
outputs : {},
|
outputs : {},
|
||||||
additionalParameters : {
|
additionalParameters : {
|
||||||
|
@ -143,6 +144,28 @@ class CCPMethodEditorController extends HTMLElement{
|
||||||
background-color: rgba(0,0,0,.3);
|
background-color: rgba(0,0,0,.3);
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ul.author_list{
|
||||||
|
list-style: none;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap:2px;
|
||||||
|
padding-left: 0;
|
||||||
|
font-size: small;
|
||||||
|
font-weight: 300;
|
||||||
|
}
|
||||||
|
li.author_list_item{
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0.25em 0.4em;
|
||||||
|
line-height: 1;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
vertical-align: baseline;
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
background-color: #eeffff;
|
||||||
|
color: #9900CC;
|
||||||
|
border: solid 1px #9900CC;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
`
|
`
|
||||||
#erase_icon = `
|
#erase_icon = `
|
||||||
|
@ -219,7 +242,7 @@ class CCPMethodEditorController extends HTMLElement{
|
||||||
(resp)=>{
|
(resp)=>{
|
||||||
if(resp.status === 201 || resp.status === 204){
|
if(resp.status === 201 || resp.status === 204){
|
||||||
return resp.text()
|
return resp.text()
|
||||||
}else throw "Error saving process"
|
}else throw "Error saving process: " + resp.status
|
||||||
}).then(data=>{
|
}).then(data=>{
|
||||||
if(!this.#isupdate) this.#isupdate = true;
|
if(!this.#isupdate) this.#isupdate = true;
|
||||||
this.unlockRender()
|
this.unlockRender()
|
||||||
|
@ -272,18 +295,15 @@ class CCPMethodEditorController extends HTMLElement{
|
||||||
cloneMethod(method){
|
cloneMethod(method){
|
||||||
if(this.#locked) return;
|
if(this.#locked) return;
|
||||||
this.lockRender()
|
this.lockRender()
|
||||||
this.#boot.secureFetch(this.#serviceurl + "/processes/" + method).then(
|
this.#boot.secureFetch(this.#serviceurl + "/methods/" + method + "/clone").then(
|
||||||
(resp)=>{
|
(resp)=>{
|
||||||
if(resp.status === 200){
|
if(resp.status === 200){
|
||||||
return resp.json()
|
return resp.json()
|
||||||
}else throw "Error retrieving process"
|
}else throw "Error retrieving process: " + resp.status
|
||||||
}
|
}
|
||||||
).then(data=>{
|
).then(data=>{
|
||||||
this.#current = data
|
this.#current = data
|
||||||
this.#current.id = Math.abs((Math.random() * 10e11)|0)
|
|
||||||
this.#isupdate = false
|
this.#isupdate = false
|
||||||
this.#current.title = "Clone of " + this.#current.title
|
|
||||||
this.#current.description = "[Clone of] " + this.#current.description
|
|
||||||
this.#tmp_inputs = Object.keys(this.#current.inputs).map(k=>this.#current.inputs[k])
|
this.#tmp_inputs = Object.keys(this.#current.inputs).map(k=>this.#current.inputs[k])
|
||||||
this.#tmp_outputs = Object.keys(this.#current.outputs).map(k=>this.#current.outputs[k])
|
this.#tmp_outputs = Object.keys(this.#current.outputs).map(k=>this.#current.outputs[k])
|
||||||
this.unlockRender()
|
this.unlockRender()
|
||||||
|
@ -295,11 +315,11 @@ class CCPMethodEditorController extends HTMLElement{
|
||||||
editMethod(method){
|
editMethod(method){
|
||||||
if(this.#locked) return;
|
if(this.#locked) return;
|
||||||
this.lockRender()
|
this.lockRender()
|
||||||
this.#boot.secureFetch(this.#serviceurl + "/processes/" + method).then(
|
this.#boot.secureFetch(this.#serviceurl + "/methods/" + method + "/updatable").then(
|
||||||
(resp)=>{
|
(resp)=>{
|
||||||
if(resp.status === 200){
|
if(resp.status === 200){
|
||||||
return resp.json()
|
return resp.json()
|
||||||
}else throw "Error retrieving process"
|
}else throw "Error retrieving process: " + resp.status
|
||||||
}
|
}
|
||||||
).then(data=>{
|
).then(data=>{
|
||||||
this.#current = data
|
this.#current = data
|
||||||
|
@ -370,6 +390,9 @@ class CCPMethodEditorController extends HTMLElement{
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
<div class="mb-3 row">
|
||||||
|
${this.renderAuthors()}
|
||||||
|
</div>
|
||||||
<div class="mb-3 row">
|
<div class="mb-3 row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<label class="form-label">Title</label>
|
<label class="form-label">Title</label>
|
||||||
|
@ -698,6 +721,16 @@ class CCPMethodEditorController extends HTMLElement{
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderAuthors(){
|
||||||
|
return `
|
||||||
|
<ul class="author_list">
|
||||||
|
${ this.#current.metadata.
|
||||||
|
filter(md=>md.role === "author").
|
||||||
|
map(a=>`<li class="author_list_item">${a.title}</li>`) }
|
||||||
|
</ul>
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
renderSaveButton(){
|
renderSaveButton(){
|
||||||
return `
|
return `
|
||||||
<button title="Save" name="save" class="btn btn-primary ccp-toolbar-button">
|
<button title="Save" name="save" class="btn btn-primary ccp-toolbar-button">
|
||||||
|
|
|
@ -138,7 +138,7 @@ class CCPMethodList extends HTMLElement{
|
||||||
|
|
||||||
fetchProcesses(){
|
fetchProcesses(){
|
||||||
console.log("Calling fetch processes")
|
console.log("Calling fetch processes")
|
||||||
this.#boot.secureFetch(this.#serviceurl + "/processes?limit=1000").
|
this.#boot.secureFetch(this.#serviceurl + "/methods").
|
||||||
then(resp=>{
|
then(resp=>{
|
||||||
console.log("Received resp for processes ", resp.status)
|
console.log("Received resp for processes ", resp.status)
|
||||||
return resp.json()
|
return resp.json()
|
||||||
|
@ -161,7 +161,7 @@ class CCPMethodList extends HTMLElement{
|
||||||
this.#filtered = []
|
this.#filtered = []
|
||||||
}else{
|
}else{
|
||||||
const f = filter.toLowerCase()
|
const f = filter.toLowerCase()
|
||||||
this.#filtered = this.#data["processes"].filter(d=>{
|
this.#filtered = this.#data.filter(d=>{
|
||||||
return false ||
|
return false ||
|
||||||
(d.title.toLowerCase().indexOf(f) !== -1)||
|
(d.title.toLowerCase().indexOf(f) !== -1)||
|
||||||
(d.description.indexOf(f) !== -1) ||
|
(d.description.indexOf(f) !== -1) ||
|
||||||
|
|
Loading…
Reference in New Issue