Skip to content

Commit

Permalink
Remove configFile URL param support
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcginnes committed Dec 13, 2024
1 parent bf0d0e8 commit 93f2ea3
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 112 deletions.
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** error logs in the browser console
([#721](https://github.com/aws/graph-explorer/pull/721))
- **Updated** dependencies
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
65 changes: 27 additions & 38 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 @@ -54,43 +53,33 @@ 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) {
const remoteConfig = await fetchConfiguration(
config.remoteConfigFile
);
newConfig = merge({}, config, remoteConfig);
const newConfig: RawConfiguration = config;
newConfig.__fileBase = true;
let activeConfigId = config.id;
setConfiguration(prevConfigMap => {
const updatedConfig = new Map(prevConfigMap);
if (newConfig.connection?.queryEngine) {
updatedConfig.set(config.id, newConfig);
}
newConfig.__fileBase = true;
let activeConfigId = config.id;
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);
})();

return;
//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
12 changes: 0 additions & 12 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 @@ -15,17 +14,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) {
return {
id: params.configFile,
remoteConfigFile: params.configFile,
};
}

try {
defaultConnectionFile = await fetch(defaultConnectionPath);

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.

0 comments on commit 93f2ea3

Please sign in to comment.