-
Notifications
You must be signed in to change notification settings - Fork 805
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: create application button on empty screen, selecting service in …
…edit form
- Loading branch information
Showing
7 changed files
with
249 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
keep-ui/app/topology/ui/applications/application-modal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { CreateOrUpdateApplicationForm } from "@/app/topology/ui/applications/create-or-update-application-form"; | ||
import Modal from "@/components/ui/Modal"; | ||
import { TopologyApplication } from "@/app/topology/model"; | ||
|
||
type BaseProps = { | ||
isOpen: boolean; | ||
onClose: () => void; | ||
}; | ||
|
||
type ApplicationModalCreateProps = BaseProps & { | ||
actionType: "create"; | ||
application?: Partial<TopologyApplication>; | ||
onSubmit: (application: Omit<TopologyApplication, "id">) => Promise<void>; | ||
onDelete?: undefined; | ||
}; | ||
|
||
type ApplicationModalEditProps = BaseProps & { | ||
actionType: "edit"; | ||
application: TopologyApplication; | ||
onSubmit: (application: TopologyApplication) => Promise<void>; | ||
onDelete: () => void; | ||
}; | ||
|
||
export function ApplicationModal({ | ||
actionType, | ||
isOpen, | ||
application, | ||
onDelete, | ||
onClose, | ||
onSubmit, | ||
}: ApplicationModalCreateProps | ApplicationModalEditProps) { | ||
const title = | ||
actionType === "create" ? "Create application" : "Edit application"; | ||
|
||
return ( | ||
<Modal isOpen={isOpen} onClose={onClose} title={title}> | ||
{actionType === "create" ? ( | ||
<CreateOrUpdateApplicationForm | ||
action="create" | ||
application={application} | ||
onSubmit={onSubmit} | ||
onCancel={onClose} | ||
/> | ||
) : ( | ||
<CreateOrUpdateApplicationForm | ||
action={actionType} | ||
application={application} | ||
onSubmit={onSubmit} | ||
onCancel={onClose} | ||
onDelete={onDelete} | ||
/> | ||
)} | ||
</Modal> | ||
); | ||
} |
Oops, something went wrong.