feat: query string dynamic app config (#3391)

* feat: query string dynamic app config

* fix: bug fix and couple of very small improvements
This commit is contained in:
Ashish Narnoli authored and GitHub committed 2023-05-15 14:52:48 -04:00
1 parent f4be73b5cf
commit af8bb27575
7 files changed
+101 -21

No files matched your search

+19 -5
View File
@@ -46,13 +46,27 @@ function ViewerLayout({
const onClickReturnButton = () => {
const { pathname } = location;
const dataSourceIdx = pathname.indexOf('/', 1);
const search =
dataSourceIdx === -1
? undefined
: `datasources=${pathname.substring(dataSourceIdx + 1)}`;
// const search =
// dataSourceIdx === -1
// ? undefined
// : `datasources=${pathname.substring(dataSourceIdx + 1)}`;
// Todo: Handle parameters in a better way.
const query = new URLSearchParams(window.location.search);
const configUrl = query.get('configUrl');
const searchQuery = new URLSearchParams();
if (dataSourceIdx !== -1) {
searchQuery.append('datasources', pathname.substring(dataSourceIdx + 1));
}
if (configUrl) {
searchQuery.append('configUrl', configUrl);
}
navigate({
pathname: '/',
search,
search: decodeURIComponent(searchQuery.toString()),
});
};