Skip to content

Commit

Permalink
type cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ciyer committed Sep 12, 2024
1 parent 5e2c504 commit ee4ca4f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { Button, Modal, ModalBody, ModalFooter, ModalHeader } from "reactstrap";
import { RtkOrNotebooksError } from "../../../components/errors/RtkErrorAlert";
import { usePostStoragesV2ByStorageIdSecretsMutation } from "../../projectsV2/api/projectV2.enhanced-api";
import {
CloudStorageGetRead,
CloudStorageGetV2Read,
CloudStoragePatch,
PostStoragesV2ApiArg,
Expand All @@ -49,7 +48,6 @@ import {
import {
AddCloudStorageForProjectParams,
AddCloudStorageState,
CloudStorage,
CloudStorageDetails,
CloudStorageDetailsOptions,
CredentialSaveStatus,
Expand All @@ -74,11 +72,7 @@ import styles from "../../project/components/cloudStorage/CloudStorage.module.sc
import DataConnectorModalBody from "./DataConnectorModalBody";

interface DataConnectorModalProps {
currentStorage?:
| CloudStorage
| CloudStorageGetRead
| CloudStorageGetV2Read
| null;
currentStorage?: CloudStorageGetV2Read | null;
isOpen: boolean;
toggle: () => void;
projectId: string;
Expand Down Expand Up @@ -256,7 +250,6 @@ export default function DataConnectorModal({
const addOrEditStorage = useCallback(() => {
const storageParameters:
| AddCloudStorageForProjectParams
| CloudStorage
| CloudStoragePatch = {
name: storageDetails.name as string,
readonly: storageDetails.readOnly ?? true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ interface AddOrEditCloudStoragePropsV2 extends AddOrEditCloudStorageProps {
validationSucceeded: boolean;
}

interface DataConnectorModalBodyProps extends AddCloudStorageBodyContentProps {
storageSecrets: CloudStorageSecretGet[];
}

export default function DataConnectorModalBody({
addResultStorageName,
credentialSaveStatus,
Expand All @@ -68,7 +72,7 @@ export default function DataConnectorModalBody({
storageSecrets,
success,
validationSucceeded,
}: AddCloudStorageBodyContentProps) {
}: DataConnectorModalBodyProps) {
if (redraw) return <Loader />;
if (success) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ import { ArrowCounterclockwise } from "react-bootstrap-icons";
import { Button, Modal, ModalBody, ModalFooter, ModalHeader } from "reactstrap";

import { RtkOrNotebooksError } from "../../../../components/errors/RtkErrorAlert";
import {
CloudStorageGetRead,
CloudStorageGetV2Read,
CloudStoragePatch,
} from "../../../projectsV2/api/storagesV2.api";

import {
findSensitive,
Expand Down Expand Up @@ -70,11 +65,7 @@ import {
import styles from "./CloudStorage.module.scss";

interface CloudStorageModalProps {
currentStorage?:
| CloudStorage
| CloudStorageGetRead
| CloudStorageGetV2Read
| null;
currentStorage?: CloudStorage | null;
isOpen: boolean;
toggle: () => void;
projectId: string;
Expand Down Expand Up @@ -247,10 +238,7 @@ export default function CloudStorageModal({
}, [storageDetails, validateCloudStorageConnection]);

const addOrEditStorage = useCallback(() => {
const storageParameters:
| AddCloudStorageForProjectParams
| CloudStorage
| CloudStoragePatch = {
const storageParameters: AddCloudStorageForProjectParams | CloudStorage = {
name: storageDetails.name as string,
readonly: storageDetails.readOnly ?? true,
project_id: `${projectId}`,
Expand Down Expand Up @@ -382,12 +370,6 @@ export default function CloudStorageModal({
: "Please go back and select a provider";
const isResultLoading = isAddResultLoading || isModifyResultLoading;

const storageSecrets =
currentStorage != null && "secrets" in currentStorage
? currentStorage.secrets ?? []
: [];
const hasStoredCredentialsInConfig = storageSecrets.length > 0;

return (
<Modal
backdrop="static"
Expand Down Expand Up @@ -419,7 +401,6 @@ export default function CloudStorageModal({
setStorageDetailsSafe={setStorageDetailsSafe}
state={state}
storageDetails={storageDetails}
storageSecrets={storageSecrets}
storageId={storageId}
success={success}
validationSucceeded={validationSucceeded}
Expand Down Expand Up @@ -463,7 +444,7 @@ export default function CloudStorageModal({
addOrEditStorage={addOrEditStorage}
disableAddButton={disableAddButton}
disableContinueButton={disableContinueButton}
hasStoredCredentialsInConfig={hasStoredCredentialsInConfig}
hasStoredCredentialsInConfig={false}
isResultLoading={isResultLoading}
setStateSafe={setStateSafe}
setValidationSucceeded={setValidationSucceeded}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import {
CloudStorageSchema,
CredentialSaveStatus,
} from "./projectCloudStorage.types";
import type { CloudStorageSecretGet } from "../../../../features/projectsV2/api/storagesV2.api";

import { SerializedError } from "@reduxjs/toolkit";

Expand Down Expand Up @@ -107,7 +106,6 @@ export interface AddCloudStorageBodyContentProps
) => void;
state: AddCloudStorageState;
storageDetails: CloudStorageDetails;
storageSecrets: CloudStorageSecretGet[];
success: boolean;
validationSucceeded: boolean;
}
Expand Down

0 comments on commit ee4ca4f

Please sign in to comment.