Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove configFile URL param support #724

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Upcoming

- **Removed** URL parameter `configFile` support for the default connection
([#724](https://github.com/aws/graph-explorer/pull/724))
- **Improved** app startup UI to be more consistent
([#723](https://github.com/aws/graph-explorer/pull/723))
- **Improved** error logs in the browser console
Expand Down
1 change: 0 additions & 1 deletion packages/graph-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
"lucide-react": "^0.460.0",
"memoize-one": "^6.0.0",
"papaparse": "^5.4.1",
"query-string": "^9.1.1",
"rc-tabs": "^15.4.0",
"re-resizable": "^6.10.3",
"react": "^18.3.1",
Expand Down
72 changes: 29 additions & 43 deletions packages/graph-explorer/src/core/AppStatusLoader.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import merge from "lodash/merge";
import { PropsWithChildren, useEffect } from "react";
import { useLocation } from "react-router";
import { useRecoilState, useRecoilValue } from "recoil";
import { LoadingSpinner, PanelEmptyState } from "@/components";
import Redirect from "@/components/Redirect";
import { RawConfiguration, fetchConfiguration } from "./ConfigurationProvider";
import { RawConfiguration } from "./ConfigurationProvider";
import {
activeConfigurationAtom,
configurationAtom,
Expand Down Expand Up @@ -46,48 +45,35 @@ const AppStatusLoader = ({
// If the config file is not in the store,
// update configuration with the config file
if (!!config && !configuration.get(config.id)) {
(async () => {
let newConfig: RawConfiguration = config;
if (config.remoteConfigFile) {
logger.debug(
"Config not in store, loading from file",
config.remoteConfigFile
);
const remoteConfig = await fetchConfiguration(
config.remoteConfigFile
);
newConfig = merge({}, config, remoteConfig);
}
newConfig.__fileBase = true;
let activeConfigId = config.id;
logger.debug("Adding new config to store", newConfig);
setConfiguration(prevConfigMap => {
const updatedConfig = new Map(prevConfigMap);
if (newConfig.connection?.queryEngine) {
updatedConfig.set(config.id, newConfig);
}
//Set a configuration for each connection if queryEngine is not set
if (!newConfig.connection?.queryEngine) {
CONNECTIONS_OP.forEach(connection => {
const connectionConfig = {
...newConfig,
id: `${newConfig.id}-${connection.value}`,
connection: {
...newConfig.connection,
url: newConfig.connection?.url || "",
queryEngine: connection.value,
},
};
updatedConfig.set(connectionConfig.id, connectionConfig);
});
activeConfigId = `${newConfig.id}-${CONNECTIONS_OP[0].value}`;
}
return updatedConfig;
});
setActiveConfig(activeConfigId);
})();
const newConfig: RawConfiguration = config;
newConfig.__fileBase = true;
let activeConfigId = config.id;

return;
logger.debug("Adding new config to store", newConfig);
setConfiguration(prevConfigMap => {
const updatedConfig = new Map(prevConfigMap);
if (newConfig.connection?.queryEngine) {
updatedConfig.set(config.id, newConfig);
}
//Set a configuration for each connection if queryEngine is not set
if (!newConfig.connection?.queryEngine) {
CONNECTIONS_OP.forEach(connection => {
const connectionConfig = {
...newConfig,
id: `${newConfig.id}-${connection.value}`,
connection: {
...newConfig.connection,
url: newConfig.connection?.url || "",
queryEngine: connection.value,
},
};
updatedConfig.set(connectionConfig.id, connectionConfig);
});
activeConfigId = `${newConfig.id}-${CONNECTIONS_OP[0].value}`;
}
return updatedConfig;
});
setActiveConfig(activeConfigId);
}

// If the config file is stored,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from "./types";
export { default as useConfiguration } from "./useConfiguration";
export * from "./useConfiguration";
export { default as fetchConfiguration } from "./fetchConfiguration";
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,6 @@ export type RawConfiguration = {
*/
id: string;
displayLabel?: string;
/**
* Allow to fetch the configuration from a given URL.
* This will be merged with the rest of configuration with
* a higher priority.
*/
remoteConfigFile?: string;
/**
* Connection configuration
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ export function mergeConfiguration(
return {
id: currentConfig.id,
displayLabel: currentConfig.displayLabel,
remoteConfigFile: currentConfig.remoteConfigFile,
__fileBase: currentConfig.__fileBase,
connection: {
...(currentConfig.connection || {}),
Expand Down
13 changes: 0 additions & 13 deletions packages/graph-explorer/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import queryString from "query-string";
import React, { useEffect, useState } from "react";
import { createRoot } from "react-dom/client";
import { HashRouter as Router } from "react-router";
Expand All @@ -16,18 +15,6 @@ const grabConfig = async (): Promise<RawConfiguration | undefined> => {
const sagemakerConnectionPath = `${location.origin}/proxy/9250/defaultConnection`;
let defaultConnectionFile;

const params = queryString.parse(location.search) as {
configFile?: string;
};

if (params.configFile) {
logger.debug("Found config file in URL params", params.configFile);
return {
id: params.configFile,
remoteConfigFile: params.configFile,
};
}

try {
logger.debug(
"Attempting to find default connection file at",
Expand Down
31 changes: 0 additions & 31 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading