Skip to content

Commit

Permalink
HPCC-31841 ECL Watch v9 redirect to intended url after login
Browse files Browse the repository at this point in the history
Captures the hash portion of the ECL Watch v9 url if present,
eg "#/workunits/W20240514-150949/metrics/sg974", redirecting to this
intended page after login.

Signed-off-by: Jeremy Clements <[email protected]>
  • Loading branch information
jeclrsg committed Jun 7, 2024
1 parent 0b8750e commit 3fc8f15
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions esp/src/Login.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@
function (ready, nlsHPCCMod) {
var nlsHPCC = nlsHPCCMod.default;
ready(function () {
if (window.location.hash) {
window.localStorage.setItem("redirectAfterLogin", window.location.hash);
}

var loginStr = document.getElementById("loginStr");
var error = document.getElementById("hidden_msg");
var disabled = document.getElementById('disabled_msg');
Expand Down
7 changes: 6 additions & 1 deletion esp/src/src/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { SMCService } from "@hpcc-js/comms";
import { scopedLogger } from "@hpcc-js/util";
import { cookieKeyValStore, sessionKeyValStore, userKeyValStore } from "src/KeyValStore";
import { singletonDebounce } from "../src-react/util/throttle";
import { parseSearch } from "../src-react/util/history";
import { parseSearch, replaceUrl } from "../src-react/util/history";
import { ModernMode } from "./BuildInfo";
import * as ESPUtil from "./ESPUtil";

Expand Down Expand Up @@ -135,6 +135,11 @@ export function formatCost(value): string {
export function initSession() {
if (sessionIsActive > -1) {

const redirectUrl = window.localStorage.getItem("redirectAfterLogin") ?? "";
if (redirectUrl) {
window.localStorage.removeItem("redirectAfterLogin");
replaceUrl(redirectUrl);
}
idleWatcher.on("active", function () {
resetESPTime();
});
Expand Down

0 comments on commit 3fc8f15

Please sign in to comment.