Skip to content

Commit

Permalink
Implement #67
Browse files Browse the repository at this point in the history
(cherry picked from commit c96cb6dc7856b018baff1c524b2d731ac83eceb6)
  • Loading branch information
ylvion committed Apr 9, 2022
1 parent d6836fe commit 033a64e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public RedirectView editAnalysis(@RequestParam("flow") UUID analysisId,
public ModelAndView getUserAcknowledgement(HttpServletRequest request) {
Map<String, ?> inputFlashMap = RequestContextUtils.getInputFlashMap(request);

return this.prepareAcknowledge((Mode) inputFlashMap.get("mode"),
ModelAndView mav = this.prepareAcknowledge((Mode) inputFlashMap.get("mode"),
Optional.ofNullable((UUID) inputFlashMap.get("flow")),
(String) inputFlashMap.get("name"),
(String) inputFlashMap.get("queryContent"),
Expand All @@ -231,6 +231,8 @@ public ModelAndView getUserAcknowledgement(HttpServletRequest request) {
(String) inputFlashMap.get("graphName"),
(List<String>) inputFlashMap.get("messages"),
(List<String>) inputFlashMap.get("hints"));
mav.addObject("referer", request.getHeader("Referer"));
return mav;
}

/**
Expand Down
23 changes: 21 additions & 2 deletions src/main/resources/static/js/toolkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,16 @@ function triggerQuerySelect(element) {
}

function triggerQueryShow(element) {
if ($('#queryIdInput')[0].value === '') return;
const qIdInpElem = $('#queryIdInput')[0];
if (qIdInpElem.value === '') {
// Try lookup by Name
const qName = $('#queryNameInput')[0].value;
$('#querySelectBase>ul>li>a').each(function () {
if (this.innerText === qName) qIdInpElem.value = this.dataset.qid;
});
}
// Not found
if (qIdInpElem.value === '') return;
$('.xapi-query-content').each(function () {
setInvisible(this);
setNonReqiured(this);
Expand Down Expand Up @@ -134,7 +143,16 @@ function triggerGraphSelect(element) {
}

function triggerGraphShow(element) {
if ($('#graphIdInput')[0].value === '') return;
const gIdInpElem = $('#graphIdInput')[0];
if (gIdInpElem.value === '') {
// Try lookup by Name
const gName = $('#graphNameInput')[0].value;
$('#graphSelectBase>ul>li>a').each(function () {
if (this.innerText === gName) gIdInpElem.value = this.dataset.gid;
});
}
// Not found
if (gIdInpElem.value === '') return;
$('.xapi-graph-content').each(function () {
setInvisible(this);
setNonReqiured(this);
Expand Down Expand Up @@ -248,6 +266,7 @@ $(document).ready(function () {
$('#queryIdInput').each(function () {
triggerQueryShow(this);
});

$('#graphIdInput').each(function () {
triggerGraphShow(this);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ <h5 class="card-title mb-3">Acknowledgement needed</h5>
<div class="card-footer">
<div class="row mb-2">
<div class="col d-flex">
<button class="btn btn-outline-danger flex-fill" type="button" onclick="history.go(-1);">Go Back</button>
<a th:if="${flow}" class="flex-fill d-flex text-decoration-none" th:href="${referer}">
<button class="btn btn-outline-danger flex-fill" type="button">Go Back</button>
</a>
<button th:unless="${flow}" class="btn btn-outline-danger flex-fill" onclick="history.go(-1);">Go Back</button>
</div>
<div class="col">
<form method="POST" class="flex-fill d-flex">
Expand Down

0 comments on commit 033a64e

Please sign in to comment.