fixed filename according to language
This commit is contained in:
parent
7c6f460cc9
commit
844eee3d1c
|
@ -106,8 +106,8 @@ class CCPExecutionHistory extends HTMLElement {
|
||||||
</ul>
|
</ul>
|
||||||
<div class="d-flex float-right" style="gap: 3px;">
|
<div class="d-flex float-right" style="gap: 3px;">
|
||||||
<select name="language-selector" class="form-control" style="height:inherit;padding:2px">
|
<select name="language-selector" class="form-control" style="height:inherit;padding:2px">
|
||||||
<option value="text/python" title="Generate plain Python3">Python 3</option>
|
<option value="text/python" data-ext="py" title="Generate plain Python3">Python 3</option>
|
||||||
<option value="application/vnd.jupyter+python" title="Generate Jupyter notebook with Python 3 cells">Jupyter Python3</option>
|
<option value="application/vnd.jupyter+python" data-ext="ipynb" title="Generate Jupyter notebook with Python 3 cells">Jupyter Python3</option>
|
||||||
</select>
|
</select>
|
||||||
<button data-index="0" name="codegen" title="Generate code" class="btn btn-primary ccp-toolbar-button ccp-toolbar-button-small">
|
<button data-index="0" name="codegen" title="Generate code" class="btn btn-primary ccp-toolbar-button ccp-toolbar-button-small">
|
||||||
<svg viewBox="0 96 960 960">
|
<svg viewBox="0 96 960 960">
|
||||||
|
@ -313,7 +313,7 @@ class CCPExecutionHistory extends HTMLElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
generateCode(id, mime){
|
generateCode(id, mime, filename){
|
||||||
this.#boot.secureFetch(`${this.#serviceurl}/executions/${id}/code`,
|
this.#boot.secureFetch(`${this.#serviceurl}/executions/${id}/code`,
|
||||||
{ method: "GET", headers : { "Accept" : mime} }).then(reply =>{
|
{ method: "GET", headers : { "Accept" : mime} }).then(reply =>{
|
||||||
if (reply.status !== 200) {
|
if (reply.status !== 200) {
|
||||||
|
@ -519,8 +519,10 @@ class CCPExecutionHistory extends HTMLElement {
|
||||||
apply : (e,d)=>e.setAttribute("data-index", d.id),
|
apply : (e,d)=>e.setAttribute("data-index", d.id),
|
||||||
on_click: (ev)=>{
|
on_click: (ev)=>{
|
||||||
const id = ev.target.getAttribute("data-index")
|
const id = ev.target.getAttribute("data-index")
|
||||||
const lang = ev.target.parentElement.querySelector("select[name=language-selector]").value
|
const langsel = ev.target.parentElement.querySelector("select[name=language-selector]")
|
||||||
this.generateCode(id, lang)
|
const lang = langsel.value
|
||||||
|
const ext = langsel.getAttribute("data-ext")
|
||||||
|
this.generateCode(id, lang, `${id}.${ext}`)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue