Skip to content

Commit

Permalink
feat(update-credentials): add explanation text for current behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
paabloLC committed Jan 9, 2025
1 parent d2f338c commit e772e58
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Alert, cn } from "@nextui-org/react";
import React from "react";

import {
Expand All @@ -14,7 +15,39 @@ export default function UpdateCredentialsPage({ searchParams }: Props) {
return (
<>
{searchParams.type === "aws" && !searchParams.via && (
<SelectViaAWS initialVia={searchParams.via} />
<>
<div className="flex flex-col gap-4">
<p className="text-sm text-default-500">
If the provider was set up with static credentials, updates must
use static credentials. If it was set up with a role, updates must
use a role.
</p>

<Alert
color="warning"
variant="faded"
classNames={{
base: cn([
"border-1 border-default-200 dark:border-default-100",
"gap-x-4",
]),
}}
description={
<>
To update provider credentials,{" "}
<strong>
you must use the same type that was originally configured.
</strong>{" "}
</>
}
/>
<p className="text-sm text-default-500">
To switch from static credentials to a role (or vice versa), you
need to delete the provider and set it up again.
</p>
<SelectViaAWS initialVia={searchParams.via} />
</div>
</>
)}

{((searchParams.type === "aws" && searchParams.via === "credentials") ||
Expand Down
4 changes: 2 additions & 2 deletions ui/components/findings/table/data-table-row-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function DataTableRowActions<FindingProps>({
description="Allows you to send the finding to Jira"
textValue="Send to Jira"
startContent={<EditDocumentBulkIcon className={iconClasses} />}
// onClick={() => setIsEditOpen(true)}
// onPress={() => setIsEditOpen(true)}
>
<span className="hidden text-sm">{findingId}</span>
Send to Jira
Expand All @@ -86,7 +86,7 @@ export function DataTableRowActions<FindingProps>({
description="Allows you to send the finding to Slack"
textValue="Send to Slack"
startContent={<EditDocumentBulkIcon className={iconClasses} />}
// onClick={() => setIsEditOpen(true)}
// onPress={() => setIsEditOpen(true)}
>
Send to Slack
</DropdownItem>
Expand Down
10 changes: 7 additions & 3 deletions ui/components/invitations/table/data-table-row-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from "@nextui-org/shared-icons";
import { Row } from "@tanstack/react-table";
import clsx from "clsx";
import { useRouter } from "next/navigation";
import { useState } from "react";

import { VerticalDotsIcon } from "@/components/icons";
Expand All @@ -33,6 +34,7 @@ export function DataTableRowActions<InvitationProps>({
row,
roles,
}: DataTableRowActionsProps<InvitationProps>) {
const router = useRouter();
const [isEditOpen, setIsEditOpen] = useState(false);
const [isDeleteOpen, setIsDeleteOpen] = useState(false);
const invitationId = (row.original as { id: string }).id;
Expand Down Expand Up @@ -82,11 +84,13 @@ export function DataTableRowActions<InvitationProps>({
>
<DropdownSection title="Actions">
<DropdownItem
href={`/invitations/check-details?id=${invitationId}`}
key="check-details"
description="View invitation details"
textValue="Check Details"
startContent={<AddNoteBulkIcon className={iconClasses} />}
onPress={() =>
router.push(`/invitations/check-details?id=${invitationId}`)
}
>
Check Details
</DropdownItem>
Expand All @@ -96,7 +100,7 @@ export function DataTableRowActions<InvitationProps>({
description="Allows you to edit the invitation"
textValue="Edit Invitation"
startContent={<EditDocumentBulkIcon className={iconClasses} />}
onClick={() => setIsEditOpen(true)}
onPress={() => setIsEditOpen(true)}
>
Edit Invitation
</DropdownItem>
Expand All @@ -113,7 +117,7 @@ export function DataTableRowActions<InvitationProps>({
className={clsx(iconClasses, "!text-danger")}
/>
}
onClick={() => setIsDeleteOpen(true)}
onPress={() => setIsDeleteOpen(true)}
>
Revoke Invitation
</DropdownItem>
Expand Down
4 changes: 2 additions & 2 deletions ui/components/manage-groups/table/data-table-row-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function DataTableRowActions<ProviderProps>({
description="Allows you to edit the provider group"
textValue="Edit Provider Group"
startContent={<EditDocumentBulkIcon className={iconClasses} />}
onClick={() => router.push(`/manage-groups?groupId=${groupId}`)}
onPress={() => router.push(`/manage-groups?groupId=${groupId}`)}
>
Edit Provider Group
</DropdownItem>
Expand All @@ -86,7 +86,7 @@ export function DataTableRowActions<ProviderProps>({
className={clsx(iconClasses, "!text-danger")}
/>
}
onClick={() => setIsDeleteOpen(true)}
onPress={() => setIsDeleteOpen(true)}
>
Delete Provider Group
</DropdownItem>
Expand Down
14 changes: 10 additions & 4 deletions ui/components/providers/table/data-table-row-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from "@nextui-org/shared-icons";
import { Row } from "@tanstack/react-table";
import clsx from "clsx";
import { useRouter } from "next/navigation";
import { useState } from "react";

import { checkConnectionProvider } from "@/actions/providers/providers";
Expand All @@ -33,6 +34,7 @@ const iconClasses =
export function DataTableRowActions<ProviderProps>({
row,
}: DataTableRowActionsProps<ProviderProps>) {
const router = useRouter();
const [isEditOpen, setIsEditOpen] = useState(false);
const [isDeleteOpen, setIsDeleteOpen] = useState(false);
const providerId = (row.original as { id: string }).id;
Expand Down Expand Up @@ -87,11 +89,15 @@ export function DataTableRowActions<ProviderProps>({
>
<DropdownSection title="Actions">
<DropdownItem
href={`/providers/update-credentials?type=${providerType}&id=${providerId}${providerSecretId ? `&secretId=${providerSecretId}` : ""}`}
key="update"
description="Update the provider credentials"
textValue="Update Credentials"
startContent={<EditDocumentBulkIcon className={iconClasses} />}
onPress={() =>
router.push(
`/providers/update-credentials?type=${providerType}&id=${providerId}${providerSecretId ? `&secretId=${providerSecretId}` : ""}`,
)
}
>
Update Credentials
</DropdownItem>
Expand All @@ -100,7 +106,7 @@ export function DataTableRowActions<ProviderProps>({
description="Check the connection to the provider"
textValue="Check Connection"
startContent={<AddNoteBulkIcon className={iconClasses} />}
onClick={handleTestConnection}
onPress={handleTestConnection}
>
Test Connection
</DropdownItem>
Expand All @@ -109,7 +115,7 @@ export function DataTableRowActions<ProviderProps>({
description="Allows you to edit the provider"
textValue="Edit Provider"
startContent={<EditDocumentBulkIcon className={iconClasses} />}
onClick={() => setIsEditOpen(true)}
onPress={() => setIsEditOpen(true)}
>
Edit Provider Alias
</DropdownItem>
Expand All @@ -126,7 +132,7 @@ export function DataTableRowActions<ProviderProps>({
className={clsx(iconClasses, "!text-danger")}
/>
}
onClick={() => setIsDeleteOpen(true)}
onPress={() => setIsDeleteOpen(true)}
>
Delete Provider
</DropdownItem>
Expand Down
8 changes: 5 additions & 3 deletions ui/components/roles/table/data-table-row-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from "@nextui-org/shared-icons";
import { Row } from "@tanstack/react-table";
import clsx from "clsx";
import { useRouter } from "next/navigation";
import { useState } from "react";

import { VerticalDotsIcon } from "@/components/icons";
Expand All @@ -29,6 +30,7 @@ const iconClasses =
export function DataTableRowActions<RoleProps>({
row,
}: DataTableRowActionsProps<RoleProps>) {
const router = useRouter();
const [isDeleteOpen, setIsDeleteOpen] = useState(false);
const roleId = (row.original as { id: string }).id;
return (
Expand Down Expand Up @@ -59,11 +61,11 @@ export function DataTableRowActions<RoleProps>({
>
<DropdownSection title="Actions">
<DropdownItem
href={`/roles/edit?roleId=${roleId}`}
key="check-details"
key="edit"
description="Edit the role details"
textValue="Edit Role"
startContent={<EditDocumentBulkIcon className={iconClasses} />}
onPress={() => router.push(`/roles/edit?roleId=${roleId}`)}
>
Edit Role
</DropdownItem>
Expand All @@ -80,7 +82,7 @@ export function DataTableRowActions<RoleProps>({
className={clsx(iconClasses, "!text-danger")}
/>
}
onClick={() => setIsDeleteOpen(true)}
onPress={() => setIsDeleteOpen(true)}
>
Delete Role
</DropdownItem>
Expand Down
2 changes: 1 addition & 1 deletion ui/components/scans/table/scans/data-table-row-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function DataTableRowActions<ScanProps>({
description="Allows you to edit the scan name"
textValue="Edit Scan Name"
startContent={<EditDocumentBulkIcon className={iconClasses} />}
onClick={() => setIsEditOpen(true)}
onPress={() => setIsEditOpen(true)}
>
Edit scan name
</DropdownItem>
Expand Down
2 changes: 1 addition & 1 deletion ui/components/ui/sidebar/sidebar-wrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export const SidebarWrap = () => {
<Tooltip content="Log Out" isDisabled={!isCompact} placement="right">
<Button
aria-label="Log Out"
onClick={() => logOut()}
onPress={() => logOut()}
className={clsx(
"justify-start text-default-500 data-[hover=true]:text-foreground",
{
Expand Down
2 changes: 1 addition & 1 deletion ui/components/ui/table/data-table-column-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const DataTableColumnHeader = <TData, TValue>({
return (
<Button
className="flex h-10 w-full items-center justify-between whitespace-nowrap bg-transparent px-0 text-left align-middle text-tiny font-semibold text-foreground-500 outline-none dark:text-slate-400"
onClick={getToggleSortingHandler}
onPress={getToggleSortingHandler}
>
<span className="block whitespace-normal break-normal">{title}</span>
{renderSortIcon()}
Expand Down
4 changes: 2 additions & 2 deletions ui/components/users/table/data-table-row-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export function DataTableRowActions<UserProps>({
description="Allows you to edit the user"
textValue="Edit User"
startContent={<EditDocumentBulkIcon className={iconClasses} />}
onClick={() => setIsEditOpen(true)}
onPress={() => setIsEditOpen(true)}
>
Edit User
</DropdownItem>
Expand All @@ -105,7 +105,7 @@ export function DataTableRowActions<UserProps>({
className={clsx(iconClasses, "!text-danger")}
/>
}
onClick={() => setIsDeleteOpen(true)}
onPress={() => setIsDeleteOpen(true)}
>
Delete User
</DropdownItem>
Expand Down

0 comments on commit e772e58

Please # to comment.