Skip to content

Commit

Permalink
Remove logic that disables fields on default connection (#801)
Browse files Browse the repository at this point in the history
* Remove logic that disables fields on default conn

* Update changelog
  • Loading branch information
kmcginnes authored Feb 21, 2025
1 parent 3cde1e0 commit f834f21
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 19 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 Release

- **Changed** to allow editing and deleting default connections
([#801](https://github.com/aws/graph-explorer/pull/801))
- **Fixed** issue where nodes and edges without any labels were causing the app
to crash ([#799](https://github.com/aws/graph-explorer/pull/799))

Expand Down
1 change: 0 additions & 1 deletion packages/graph-explorer/src/core/AppStatusLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const AppStatusLoader = ({ children }: PropsWithChildren) => {
!configuration.get(defaultConnectionConfig.id)
) {
const newConfig: RawConfiguration = cloneDeep(defaultConnectionConfig);
newConfig.__fileBase = true;
let activeConfigId = defaultConnectionConfig.id;

logger.debug("Adding new config to store", newConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ export type RawConfiguration = {
* Database schema: types, names, labels, icons, ...
*/
schema?: Schema;
/**
* Mark as created from a file
*/
__fileBase?: boolean;
};

export type ConfigurationContextProps = RawConfiguration & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ export function mergeConfiguration(
return {
id: currentConfig.id,
displayLabel: currentConfig.displayLabel,
__fileBase: currentConfig.__fileBase,
connection: {
...(currentConfig.connection || {}),
// Remove trailing slash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ const ConnectionDetail = ({ isSync, onSyncChange }: ConnectionDetailProps) => {

const lastSyncUpdate = config?.schema?.lastUpdate;
const lastSyncFail = config?.schema?.lastSyncFail === true;
const isFileBased = config.__fileBase === true;

return (
<Panel className={cn(styleWithTheme(defaultStyles))}>
Expand Down Expand Up @@ -126,10 +125,10 @@ const ConnectionDetail = ({ isSync, onSyncChange }: ConnectionDetailProps) => {
onActionClick={() => setEdit(true)}
/>
<PanelHeaderActionButton
label={isFileBased ? "File (read-only)" : "Delete connection"}
label="Delete connection"
icon={<DeleteIcon />}
color="error"
isDisabled={isFileBased || isSync}
isDisabled={isSync}
onActionClick={onConfigDelete}
/>
</PanelHeaderActions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ const CreateConnection = ({
const styleWithTheme = useWithTheme();

const configId = existingConfig?.id;
const disabledFields: (keyof ConnectionForm)[] = existingConfig?.__fileBase
? ["queryEngine", "url", "serviceType"]
: [];
const initialData: ConnectionForm | undefined = existingConfig
? {
...(existingConfig.connection || {}),
Expand Down Expand Up @@ -239,17 +236,13 @@ const CreateConnection = ({
onChange={onFormChange("name")}
errorMessage="Name is required"
validationState={hasError && !form.name ? "invalid" : "valid"}
isDisabled={disabledFields.includes("name")}
/>
<Select
label="Graph Type"
options={CONNECTIONS_OP}
value={form.queryEngine}
onChange={onFormChange("queryEngine")}
isDisabled={
disabledFields.includes("queryEngine") ||
form.serviceType === "neptune-graph"
}
isDisabled={form.serviceType === "neptune-graph"}
/>
<div className="input-url">
<TextArea
Expand All @@ -270,7 +263,6 @@ const CreateConnection = ({
errorMessage="URL is required"
placeholder="https://example.com"
validationState={hasError && !form.url ? "invalid" : "valid"}
isDisabled={disabledFields.includes("url")}
/>
</div>
<div className="input-url">
Expand Down Expand Up @@ -338,7 +330,6 @@ const CreateConnection = ({
]}
value={form.serviceType}
onChange={onFormChange("serviceType")}
isDisabled={disabledFields.includes("serviceType")}
/>
</div>
</>
Expand Down

0 comments on commit f834f21

Please sign in to comment.