Skip to content

Commit

Permalink
Fix url validation for context menu (#134) (#135)
Browse files Browse the repository at this point in the history
* Fix url validation for context menu

Signed-off-by: Joshua Li <[email protected]>

* Fix url validation

Signed-off-by: Joshua Li <[email protected]>
  • Loading branch information
joshuali925 authored Jul 28, 2021
1 parent 0bfa7db commit 076e353
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ const generateInContextReport = async (
}

let reportSource = '';
if (baseUrl.includes('dashboard')) {
if (/\/app\/dashboards/.test(baseUrl)) {
reportSource = 'Dashboard';
} else if (baseUrl.includes('visualize')) {
} else if (/\/app\/visualize/.test(baseUrl)) {
reportSource = 'Visualization';
} else if (baseUrl.includes('discover')) {
} else if (/\/app\/discover/.test(baseUrl)) {
reportSource = 'Saved search';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ export const contextMenuCreateReportDefinition = (baseURI) => {
const timeRanges = getTimeFieldsFromUrl();

// check report source
if (baseURI.includes('dashboard')) {
if (/\/app\/dashboards/.test(baseURI)) {
reportSource = 'dashboard:';
} else if (baseURI.includes('visualize')) {
} else if (/\/app\/visualize/.test(baseURI)) {
reportSource = 'visualize:';
} else if (baseURI.includes('discover')) {
} else if (/\/app\/discover/.test(baseURI)) {
reportSource = 'discover:';
}
reportSource += reportSourceId.toString();
Expand Down

0 comments on commit 076e353

Please sign in to comment.