forked from opensearch-project/dashboards-query-workbench
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving Query Workbench to Dev Tools (opensearch-project#349)
* Migrate to devTools Signed-off-by: Adam Tackett <[email protected]> * MDS working changed how ID passed Signed-off-by: Adam Tackett <[email protected]> * Chagned name to dataSourceMDSId Signed-off-by: Adam Tackett <[email protected]> * remove console log Signed-off-by: Adam Tackett <[email protected]> * add support for backward URLs Signed-off-by: Shenoy Pratik <[email protected]> * update nav coditionally and set breadcrumbs Signed-off-by: Shenoy Pratik <[email protected]> * fix lint error Signed-off-by: Shenoy Pratik <[email protected]> * update breadcrumb only when nav is enabled Signed-off-by: Shenoy Pratik <[email protected]> * fix URL for new nav is disabled Signed-off-by: Shenoy Pratik <[email protected]> --------- Signed-off-by: Adam Tackett <[email protected]> Signed-off-by: Shenoy Pratik <[email protected]> Co-authored-by: Adam Tackett <[email protected]> Co-authored-by: Shenoy Pratik <[email protected]> (cherry picked from commit 7aba1fd)
- Loading branch information
Showing
6 changed files
with
137 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export const convertLegacyWorkbenchUrl = (location: Location) => { | ||
// Update pathname to new structure | ||
let pathname = location.pathname.replace( | ||
'app/opensearch-query-workbench', | ||
'app/dev_tools#/opensearch-query-workbench' | ||
); | ||
|
||
// If the pathname ends with '/', remove it before appending the hash | ||
if (pathname.endsWith('/')) { | ||
pathname = pathname.slice(0, -1); | ||
} | ||
|
||
// Adjust the hash part of the URL | ||
let hash = location.hash.replace('#/', '/'); | ||
|
||
// If hash contains "accelerate" or any random text, handle it properly | ||
if (hash.includes('accelerate/')) { | ||
hash = hash.replace('#/', '/'); | ||
} else if (hash.startsWith('#/')) { | ||
hash = hash.replace('#/', '/'); | ||
} | ||
|
||
const finalUrl = `${pathname}${hash}`; | ||
|
||
return finalUrl; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.