Skip to content

Commit

Permalink
fix js callback && simple click after close menu
Browse files Browse the repository at this point in the history
  • Loading branch information
LesageYann committed Mar 13, 2022
1 parent f4f53fb commit 62f3384
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions src/Telescope-Cytoscape-Libraries/CYSFileLibrary.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -745,10 +745,8 @@ CYSFileLibrary >> cytoscapeTelescopeJs [
displayMenuForElement(element, visuId, position) {
const that = this
const menu = []
const visu = this.visuWithId(visuId)

function fun(name, evt) {
visu.menuIsOpen = false
that.sendCommand([
{
"id": visuId,
Expand All @@ -760,7 +758,6 @@ CYSFileLibrary >> cytoscapeTelescopeJs [
}

function subFun(name, evt) {
visu.menuIsOpen = false
const selected = evt.currentTarget
that.sendCommand([
{
Expand Down Expand Up @@ -1120,20 +1117,31 @@ CYSFileLibrary >> cytoscapeTelescopeJs [
})

this.commandsAction.set("callbackUrl", (command, visu) => {
sendCallBack(command.callbackUrl, command.openInNewTab)
function post(path, cbId, openInNewTab) {
let form = $("<form></form>", {method: "post", action: path});
if (openInNewTab) {
form.attr("target", "_blank");
}

var field = $("<input>", {type: "hidden", name: cbId, value: "refresh"});
form.append(field);

// The form needs to be a part of the document in
// order for us to be able to submit it.
$(document.body).append(form);
form.submit();
}
post(command.callbackUrl[0], command.callbackUrl[1], command.openInNewTab);
})

// Called when we execute a Seaside ajax callback interaction
this.commandsAction.set("ajax", (command, visu) => {
let script = $(command.cssQuery).load(command.callbackUrl)
const container = visu.container()
container.classList.add("ajax-fetching")
$(command.cssQuery).load(command.callbackUrl, {}, () => {
if (command.onComplete) {
Function(command.onComplete)()
}
container.classList.remove("ajax-fetching")
})
if(command.onComplete) {
$(command.cssQuery).load(command.callbackUrl,()=>{Function(command.onComplete)()})
} else {
$(command.cssQuery).load(command.callbackUrl)
}
})

this.commandsAction.set("generated", (command) => {
Expand Down Expand Up @@ -2295,7 +2303,7 @@ CYSFileLibrary >> telescopeCss [
z-index: 100000 !important;
}

.visualization.fetching::after, .visualization.ajax-fetching::after {
.visualization.fetching::after {
content: "fetching";
position: absolute;
bottom: 0px;
Expand Down

0 comments on commit 62f3384

Please sign in to comment.