diff --git a/ccp/js/executionhistorycontroller.js b/ccp/js/executionhistorycontroller.js
index 8acab5b..c1d3e10 100644
--- a/ccp/js/executionhistorycontroller.js
+++ b/ccp/js/executionhistorycontroller.js
@@ -114,8 +114,7 @@ class CCPExecutionHistory extends HTMLElement {
-
-
+
@@ -312,7 +311,7 @@ class CCPExecutionHistory extends HTMLElement {
appendLogs(data){
if(!data.length) return;
const exid = data[0]["attrs"]["execution"]
- const lt = this.#rootdoc.querySelector(`d4s-ccp-logterminal[index=${exid}]`)
+ const lt = this.#rootdoc.querySelector(`d4s-ccp-logterminal[index='${exid}']`)
if(!lt){
console.error("No terminal found for adding logs of " + exid)
}else{
@@ -649,9 +648,9 @@ class CCPExecutionHistory extends HTMLElement {
}
},
{
- target : "d4s-ccp-logterminal",
+ target : "div[name=logterminalcontainer]",
apply : (e,d)=>{
- e.setAttribute("index", d.id)
+ e.innerHTML = ``
}
},
{
@@ -682,4 +681,4 @@ class CCPExecutionHistory extends HTMLElement {
]
}
}
-window.customElements.define('d4s-ccp-executionhistory', CCPExecutionHistory);
\ No newline at end of file
+window.customElements.define('d4s-ccp-executionhistory', CCPExecutionHistory);
diff --git a/ccp/js/logterminalcontroller.js b/ccp/js/logterminalcontroller.js
index 0c70c8b..6e1a2e9 100644
--- a/ccp/js/logterminalcontroller.js
+++ b/ccp/js/logterminalcontroller.js
@@ -6,19 +6,27 @@ class LogTerminal extends HTMLElement {
#lines = [];
#index = null;
+ static get observedAttributes() { return ['index']; }
+
constructor(){
super()
this.#maxlines = this.getAttribute("maxlines")
this.#rootdoc = this.attachShadow({ "mode" : "open"})
this.render()
- this.#index = this.getAttribute("index")
}
connectedCallback(){
this.reloadLines()
this.refresh()
}
-
+
+ attributeChangedCallback(name, oldValue, newValue) {
+ if(name === "index"){
+ this.#index = newValue
+ this.reloadLines()
+ }
+ }
+
get lines(){
return this.#lines
}
@@ -30,8 +38,9 @@ class LogTerminal extends HTMLElement {
}
reloadLines(){
+ if(this.#index == null) return;
if(sessionStorage.getItem("logs-" + this.#index)){
- this.#lines = sessionStorage.getItem("logs-" + this.#index)
+ this.#lines = JSON.parse(sessionStorage.getItem("logs-" + this.#index))
}else{
this.#lines = []
}
@@ -41,7 +50,7 @@ class LogTerminal extends HTMLElement {
if(this.#lines.length > this.#maxstoredlines){
this.#lines.splice(0, this.#lines.length - this.#maxstoredlines)
}
- sessionStorage.setItem("logs-" + this.#index, this.#lines)
+ sessionStorage.setItem("logs-" + this.#index, JSON.stringify(this.#lines))
}
render(){
@@ -103,4 +112,4 @@ class LogTerminal extends HTMLElement {
}
}
-window.customElements.define('d4s-ccp-logterminal', LogTerminal);
\ No newline at end of file
+window.customElements.define('d4s-ccp-logterminal', LogTerminal);