mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 13:27:22 +00:00
lint & a few fixes
This commit is contained in:
Vendored
+5
-5
@@ -597,16 +597,16 @@ import {
|
|||||||
TWorkflowIntegrationsInsert,
|
TWorkflowIntegrationsInsert,
|
||||||
TWorkflowIntegrationsUpdate
|
TWorkflowIntegrationsUpdate
|
||||||
} from "@app/db/schemas";
|
} from "@app/db/schemas";
|
||||||
import {
|
|
||||||
TCertificateRequests,
|
|
||||||
TCertificateRequestsInsert,
|
|
||||||
TCertificateRequestsUpdate
|
|
||||||
} from "@app/db/schemas/certificate-requests";
|
|
||||||
import {
|
import {
|
||||||
TAccessApprovalPoliciesEnvironments,
|
TAccessApprovalPoliciesEnvironments,
|
||||||
TAccessApprovalPoliciesEnvironmentsInsert,
|
TAccessApprovalPoliciesEnvironmentsInsert,
|
||||||
TAccessApprovalPoliciesEnvironmentsUpdate
|
TAccessApprovalPoliciesEnvironmentsUpdate
|
||||||
} from "@app/db/schemas/access-approval-policies-environments";
|
} from "@app/db/schemas/access-approval-policies-environments";
|
||||||
|
import {
|
||||||
|
TCertificateRequests,
|
||||||
|
TCertificateRequestsInsert,
|
||||||
|
TCertificateRequestsUpdate
|
||||||
|
} from "@app/db/schemas/certificate-requests";
|
||||||
import {
|
import {
|
||||||
TIdentityAuthTemplates,
|
TIdentityAuthTemplates,
|
||||||
TIdentityAuthTemplatesInsert,
|
TIdentityAuthTemplatesInsert,
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import { registerDynamicSecretLeaseRouter } from "./dynamic-secret-lease-router"
|
|||||||
import { registerKubernetesDynamicSecretLeaseRouter } from "./dynamic-secret-lease-routers/kubernetes-lease-router";
|
import { registerKubernetesDynamicSecretLeaseRouter } from "./dynamic-secret-lease-routers/kubernetes-lease-router";
|
||||||
import { registerDynamicSecretRouter } from "./dynamic-secret-router";
|
import { registerDynamicSecretRouter } from "./dynamic-secret-router";
|
||||||
import { registerExternalKmsRouter } from "./external-kms-router";
|
import { registerExternalKmsRouter } from "./external-kms-router";
|
||||||
|
|
||||||
import { EXTERNAL_KMS_REGISTER_ROUTER_MAP } from "./external-kms-routers";
|
import { EXTERNAL_KMS_REGISTER_ROUTER_MAP } from "./external-kms-routers";
|
||||||
import { registerGatewayRouter } from "./gateway-router";
|
import { registerGatewayRouter } from "./gateway-router";
|
||||||
import { registerGithubOrgSyncRouter } from "./github-org-sync-router";
|
import { registerGithubOrgSyncRouter } from "./github-org-sync-router";
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ export const approvalRequestDALFactory = (db: TDbClient) => {
|
|||||||
.whereIn("requestId", requestIds)
|
.whereIn("requestId", requestIds)
|
||||||
.orderBy("stepNumber", "asc");
|
.orderBy("stepNumber", "asc");
|
||||||
|
|
||||||
const stepsByRequestId: Record<string, any[]> = {};
|
const stepsByRequestId: Record<string, ApprovalPolicyStep[]> = {};
|
||||||
|
|
||||||
if (steps.length) {
|
if (steps.length) {
|
||||||
const stepIds = steps.map((step) => step.id);
|
const stepIds = steps.map((step) => step.id);
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import {
|
|||||||
ApprovalRequestsSchema,
|
ApprovalRequestsSchema,
|
||||||
ApprovalRequestStepsSchema
|
ApprovalRequestStepsSchema
|
||||||
} from "@app/db/schemas";
|
} from "@app/db/schemas";
|
||||||
|
import { ms } from "@app/lib/ms";
|
||||||
|
|
||||||
import { ApproverType } from "./approval-policy-enums";
|
import { ApproverType } from "./approval-policy-enums";
|
||||||
import { ms } from "@app/lib/ms";
|
|
||||||
|
|
||||||
const ApprovalPolicyStepSchema = z.object({
|
const ApprovalPolicyStepSchema = z.object({
|
||||||
name: z.string().min(1).max(128).nullable().optional(),
|
name: z.string().min(1).max(128).nullable().optional(),
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { ActionProjectType, ProjectMembershipRole, TApprovalPolicies, TApprovalR
|
|||||||
import { TUserGroupMembershipDALFactory } from "@app/ee/services/group/user-group-membership-dal";
|
import { TUserGroupMembershipDALFactory } from "@app/ee/services/group/user-group-membership-dal";
|
||||||
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service-types";
|
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service-types";
|
||||||
import { BadRequestError, ForbiddenRequestError } from "@app/lib/errors";
|
import { BadRequestError, ForbiddenRequestError } from "@app/lib/errors";
|
||||||
|
import { ms } from "@app/lib/ms";
|
||||||
import { OrgServiceActor } from "@app/lib/types";
|
import { OrgServiceActor } from "@app/lib/types";
|
||||||
import { TNotificationServiceFactory } from "@app/services/notification/notification-service";
|
import { TNotificationServiceFactory } from "@app/services/notification/notification-service";
|
||||||
import { NotificationType } from "@app/services/notification/notification-types";
|
import { NotificationType } from "@app/services/notification/notification-types";
|
||||||
@@ -31,7 +32,6 @@ import {
|
|||||||
TCreateRequestDTO,
|
TCreateRequestDTO,
|
||||||
TUpdatePolicyDTO
|
TUpdatePolicyDTO
|
||||||
} from "./approval-policy-types";
|
} from "./approval-policy-types";
|
||||||
import { ms } from "@app/lib/ms";
|
|
||||||
|
|
||||||
type TApprovalPolicyServiceFactoryDep = {
|
type TApprovalPolicyServiceFactoryDep = {
|
||||||
approvalPolicyDAL: TApprovalPolicyDALFactory;
|
approvalPolicyDAL: TApprovalPolicyDALFactory;
|
||||||
@@ -66,7 +66,7 @@ export const approvalPolicyServiceFactory = ({
|
|||||||
|
|
||||||
const userIdsToNotify = new Set<string>();
|
const userIdsToNotify = new Set<string>();
|
||||||
|
|
||||||
for (const approver of step.approvers) {
|
for await (const approver of step.approvers) {
|
||||||
if (approver.type === ApproverType.User) {
|
if (approver.type === ApproverType.User) {
|
||||||
userIdsToNotify.add(approver.id);
|
userIdsToNotify.add(approver.id);
|
||||||
} else if (approver.type === ApproverType.Group) {
|
} else if (approver.type === ApproverType.Group) {
|
||||||
@@ -519,7 +519,7 @@ export const approvalPolicyServiceFactory = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { updatedRequest, nextStepToNotify } = await approvalRequestDAL.transaction(async (tx) => {
|
const { updatedRequest, nextStepToNotify } = await approvalRequestDAL.transaction(async (tx) => {
|
||||||
let nextStepToNotify = null;
|
let nextStepToNotifyInner = null;
|
||||||
|
|
||||||
// Create approval
|
// Create approval
|
||||||
await approvalRequestApprovalsDAL.create(
|
await approvalRequestApprovalsDAL.create(
|
||||||
@@ -565,7 +565,7 @@ export const approvalPolicyServiceFactory = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (nextStep.notifyApprovers) {
|
if (nextStep.notifyApprovers) {
|
||||||
nextStepToNotify = nextStep;
|
nextStepToNotifyInner = nextStep;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// All steps completed
|
// All steps completed
|
||||||
@@ -581,7 +581,7 @@ export const approvalPolicyServiceFactory = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { updatedRequest: request, nextStepToNotify };
|
return { updatedRequest: request, nextStepToNotify: nextStepToNotifyInner };
|
||||||
});
|
});
|
||||||
|
|
||||||
if (nextStepToNotify) {
|
if (nextStepToNotify) {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import picomatch from "picomatch";
|
import picomatch from "picomatch";
|
||||||
|
|
||||||
|
import { ms } from "@app/lib/ms";
|
||||||
|
|
||||||
import { ApprovalRequestGrantStatus } from "../approval-policy-enums";
|
import { ApprovalRequestGrantStatus } from "../approval-policy-enums";
|
||||||
import {
|
import {
|
||||||
TApprovalRequestFactoryCanAccess,
|
TApprovalRequestFactoryCanAccess,
|
||||||
@@ -9,7 +11,6 @@ import {
|
|||||||
TApprovalResourceFactory
|
TApprovalResourceFactory
|
||||||
} from "../approval-policy-types";
|
} from "../approval-policy-types";
|
||||||
import { TPamAccessPolicy, TPamAccessPolicyInputs, TPamAccessRequestData } from "./pam-access-policy-types";
|
import { TPamAccessPolicy, TPamAccessPolicyInputs, TPamAccessRequestData } from "./pam-access-policy-types";
|
||||||
import { ms } from "@app/lib/ms";
|
|
||||||
|
|
||||||
export const pamAccessPolicyFactory: TApprovalResourceFactory<
|
export const pamAccessPolicyFactory: TApprovalResourceFactory<
|
||||||
TPamAccessPolicyInputs,
|
TPamAccessPolicyInputs,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import { ms } from "@app/lib/ms";
|
import { ms } from "@app/lib/ms";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ import {
|
|||||||
CertExtendedKeyUsageType,
|
CertExtendedKeyUsageType,
|
||||||
CertIncludeType,
|
CertIncludeType,
|
||||||
CertKeyUsageType,
|
CertKeyUsageType,
|
||||||
CertSubjectAttributeType,
|
CertSubjectAlternativeNameType,
|
||||||
CertSubjectAlternativeNameType
|
CertSubjectAttributeType
|
||||||
} from "@app/services/certificate-common/certificate-constants";
|
} from "@app/services/certificate-common/certificate-constants";
|
||||||
import { TCertificateProfileDALFactory } from "@app/services/certificate-profile/certificate-profile-dal";
|
import { TCertificateProfileDALFactory } from "@app/services/certificate-profile/certificate-profile-dal";
|
||||||
import { EnrollmentType, IssuerType } from "@app/services/certificate-profile/certificate-profile-types";
|
import { EnrollmentType, IssuerType } from "@app/services/certificate-profile/certificate-profile-types";
|
||||||
|
|||||||
@@ -68,12 +68,6 @@ export const ROUTE_PATHS = Object.freeze({
|
|||||||
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking"
|
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking"
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
Pam: {
|
|
||||||
ApprovalRequestDetailPage: setRoute(
|
|
||||||
"/organizations/$orgId/projects/pam/$projectId/approval-requests/$approvalRequestId",
|
|
||||||
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approval-requests/$approvalRequestId"
|
|
||||||
)
|
|
||||||
},
|
|
||||||
SecretManager: {
|
SecretManager: {
|
||||||
ApprovalPage: setRoute(
|
ApprovalPage: setRoute(
|
||||||
"/organizations/$orgId/projects/secret-management/$projectId/approval",
|
"/organizations/$orgId/projects/secret-management/$projectId/approval",
|
||||||
@@ -368,6 +362,10 @@ export const ROUTE_PATHS = Object.freeze({
|
|||||||
PamSessionByIDPage: setRoute(
|
PamSessionByIDPage: setRoute(
|
||||||
"/organizations/$orgId/projects/pam/$projectId/sessions/$sessionId",
|
"/organizations/$orgId/projects/pam/$projectId/sessions/$sessionId",
|
||||||
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/$sessionId"
|
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/$sessionId"
|
||||||
|
),
|
||||||
|
ApprovalRequestDetailPage: setRoute(
|
||||||
|
"/organizations/$orgId/projects/pam/$projectId/approval-requests/$approvalRequestId",
|
||||||
|
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approval-requests/$approvalRequestId"
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
Public: {
|
Public: {
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ export {
|
|||||||
} from "./mutations";
|
} from "./mutations";
|
||||||
export { approvalPolicyQuery } from "./queries";
|
export { approvalPolicyQuery } from "./queries";
|
||||||
export {
|
export {
|
||||||
|
type ApprovalPolicyStep,
|
||||||
ApprovalPolicyType,
|
ApprovalPolicyType,
|
||||||
ApproverType,
|
ApproverType,
|
||||||
type ApprovalPolicyStep,
|
|
||||||
type PamAccessPolicyConditions,
|
type PamAccessPolicyConditions,
|
||||||
type PamAccessPolicyConstraints,
|
type PamAccessPolicyConstraints,
|
||||||
type TApprovalPolicy,
|
type TApprovalPolicy,
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ export {
|
|||||||
} from "./mutations";
|
} from "./mutations";
|
||||||
export { approvalRequestQuery } from "./queries";
|
export { approvalRequestQuery } from "./queries";
|
||||||
export {
|
export {
|
||||||
ApprovalRequestStatus,
|
|
||||||
ApprovalRequestStepStatus,
|
|
||||||
type ApprovalRequestApproval,
|
type ApprovalRequestApproval,
|
||||||
|
ApprovalRequestStatus,
|
||||||
type ApprovalRequestStep,
|
type ApprovalRequestStep,
|
||||||
|
ApprovalRequestStepStatus,
|
||||||
type PamAccessRequestData,
|
type PamAccessRequestData,
|
||||||
type TApprovalRequest,
|
type TApprovalRequest,
|
||||||
type TApproveApprovalRequestDTO,
|
type TApproveApprovalRequestDTO,
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import { Helmet } from "react-helmet";
|
import { Helmet } from "react-helmet";
|
||||||
|
import { useNavigate, useSearch } from "@tanstack/react-router";
|
||||||
|
|
||||||
import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
|
import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
|
||||||
import { useOrganization, useProject } from "@app/context";
|
import { useOrganization, useProject } from "@app/context";
|
||||||
import { ApprovalControlTabs } from "@app/types/project";
|
import { ApprovalControlTabs } from "@app/types/project";
|
||||||
import { useNavigate, useSearch } from "@tanstack/react-router";
|
|
||||||
import { PolicyTab } from "./components/PolicyTab";
|
|
||||||
import { ApprovalRequestTab } from "./components/ApprovalRequestTab";
|
import { ApprovalRequestTab } from "./components/ApprovalRequestTab";
|
||||||
|
import { PolicyTab } from "./components/PolicyTab";
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|||||||
+8
-5
@@ -9,8 +9,8 @@ import {
|
|||||||
faSearch
|
faSearch
|
||||||
} from "@fortawesome/free-solid-svg-icons";
|
} from "@fortawesome/free-solid-svg-icons";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
import { useNavigate } from "@tanstack/react-router";
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
import { formatDistance } from "date-fns";
|
import { formatDistance } from "date-fns";
|
||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
|
|
||||||
@@ -39,14 +39,13 @@ import {
|
|||||||
import { Badge } from "@app/components/v3";
|
import { Badge } from "@app/components/v3";
|
||||||
import { useOrganization, useProject, useUser } from "@app/context";
|
import { useOrganization, useProject, useUser } from "@app/context";
|
||||||
import { usePagination } from "@app/hooks";
|
import { usePagination } from "@app/hooks";
|
||||||
import { ApprovalPolicyType } from "@app/hooks/api/approvalPolicies";
|
import { ApprovalPolicyType, ApproverType } from "@app/hooks/api/approvalPolicies";
|
||||||
import {
|
import {
|
||||||
approvalRequestQuery,
|
approvalRequestQuery,
|
||||||
ApprovalRequestStatus,
|
ApprovalRequestStatus,
|
||||||
ApprovalRequestStepStatus,
|
ApprovalRequestStepStatus,
|
||||||
TApprovalRequest
|
TApprovalRequest
|
||||||
} from "@app/hooks/api/approvalRequests";
|
} from "@app/hooks/api/approvalRequests";
|
||||||
import { ApproverType } from "@app/hooks/api/approvalPolicies";
|
|
||||||
|
|
||||||
type Filter = {
|
type Filter = {
|
||||||
status: "open" | "closed";
|
status: "open" | "closed";
|
||||||
@@ -119,7 +118,9 @@ export const RequestsTable = () => {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
const { page, perPage, setPage, setPerPage, offset } = usePagination();
|
const { page, perPage, setPage, setPerPage, offset } = usePagination("", {
|
||||||
|
initPerPage: 10
|
||||||
|
});
|
||||||
|
|
||||||
const filteredRequests = useMemo(() => {
|
const filteredRequests = useMemo(() => {
|
||||||
let filtered = requests;
|
let filtered = requests;
|
||||||
@@ -376,7 +377,9 @@ export const RequestsTable = () => {
|
|||||||
{!isRequestsLoading && !filteredRequests?.length && (
|
{!isRequestsLoading && !filteredRequests?.length && (
|
||||||
<EmptyState
|
<EmptyState
|
||||||
title={
|
title={
|
||||||
requests.length ? "No approval requests match search..." : "No approval requests found"
|
requests.length
|
||||||
|
? "No approval requests match search..."
|
||||||
|
: "No approval requests found"
|
||||||
}
|
}
|
||||||
icon={requests.length ? faSearch : faFileCircleQuestion}
|
icon={requests.length ? faSearch : faFileCircleQuestion}
|
||||||
/>
|
/>
|
||||||
|
|||||||
+1
-1
@@ -8,6 +8,7 @@ import {
|
|||||||
faUsers
|
faUsers
|
||||||
} from "@fortawesome/free-solid-svg-icons";
|
} from "@fortawesome/free-solid-svg-icons";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -36,7 +37,6 @@ import {
|
|||||||
ApproverType
|
ApproverType
|
||||||
} from "@app/hooks/api/approvalPolicies";
|
} from "@app/hooks/api/approvalPolicies";
|
||||||
import { UsePopUpState } from "@app/hooks/usePopUp";
|
import { UsePopUpState } from "@app/hooks/usePopUp";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
handlePopUpOpen: (
|
handlePopUpOpen: (
|
||||||
|
|||||||
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
import { ApproverType } from "@app/hooks/api/approvalPolicies";
|
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
|
import { ApproverType } from "@app/hooks/api/approvalPolicies";
|
||||||
|
|
||||||
export const PolicyFormSchema = z.object({
|
export const PolicyFormSchema = z.object({
|
||||||
name: z.string().min(1, "Policy name is required").max(128),
|
name: z.string().min(1, "Policy name is required").max(128),
|
||||||
maxRequestTtlSeconds: z.number().min(3600).max(2592000).nullable().optional(),
|
maxRequestTtlSeconds: z.number().min(3600).max(2592000).nullable().optional(),
|
||||||
|
|||||||
+2
-2
@@ -5,10 +5,10 @@ import { createNotification } from "@app/components/notifications";
|
|||||||
import { Button, DeleteActionModal } from "@app/components/v2";
|
import { Button, DeleteActionModal } from "@app/components/v2";
|
||||||
import { useProject } from "@app/context";
|
import { useProject } from "@app/context";
|
||||||
import { usePopUp } from "@app/hooks";
|
import { usePopUp } from "@app/hooks";
|
||||||
import { useDeleteApprovalPolicy, ApprovalPolicyType } from "@app/hooks/api/approvalPolicies";
|
import { ApprovalPolicyType, useDeleteApprovalPolicy } from "@app/hooks/api/approvalPolicies";
|
||||||
|
|
||||||
import { PolicyModal } from "./PolicyModal";
|
|
||||||
import { PoliciesTable } from "./PoliciesTable";
|
import { PoliciesTable } from "./PoliciesTable";
|
||||||
|
import { PolicyModal } from "./PolicyModal";
|
||||||
|
|
||||||
export const PolicySection = () => {
|
export const PolicySection = () => {
|
||||||
const { currentProject } = useProject();
|
const { currentProject } = useProject();
|
||||||
|
|||||||
+18
-10
@@ -1,5 +1,6 @@
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { Controller, useFieldArray, useFormContext } from "react-hook-form";
|
import { Controller, useFieldArray, useFormContext } from "react-hook-form";
|
||||||
|
import { MultiValue } from "react-select";
|
||||||
import { faPlus, faTrash } from "@fortawesome/free-solid-svg-icons";
|
import { faPlus, faTrash } from "@fortawesome/free-solid-svg-icons";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
|
||||||
@@ -12,10 +13,7 @@ import { ApproverType } from "@app/hooks/api/approvalPolicies";
|
|||||||
import { TPolicyForm } from "../PolicySchema";
|
import { TPolicyForm } from "../PolicySchema";
|
||||||
|
|
||||||
export const PolicyApprovalSteps = () => {
|
export const PolicyApprovalSteps = () => {
|
||||||
const {
|
const { control } = useFormContext<TPolicyForm>();
|
||||||
control,
|
|
||||||
formState: { errors }
|
|
||||||
} = useFormContext<TPolicyForm>();
|
|
||||||
|
|
||||||
const { currentProject } = useProject();
|
const { currentProject } = useProject();
|
||||||
const projectId = currentProject?.id || "";
|
const projectId = currentProject?.id || "";
|
||||||
@@ -55,7 +53,7 @@ export const PolicyApprovalSteps = () => {
|
|||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div className="mb-3 flex items-center justify-between">
|
<div className="mb-3 flex items-center justify-between">
|
||||||
<div>
|
<div>
|
||||||
<label className="text-sm font-medium text-mineshaft-200">Approval Steps</label>
|
<span className="text-sm font-medium text-mineshaft-200">Approval Steps</span>
|
||||||
<p className="text-xs text-mineshaft-400">
|
<p className="text-xs text-mineshaft-400">
|
||||||
Define the approval workflow with sequential steps
|
Define the approval workflow with sequential steps
|
||||||
</p>
|
</p>
|
||||||
@@ -157,7 +155,9 @@ export const PolicyApprovalSteps = () => {
|
|||||||
label="User Approvers"
|
label="User Approvers"
|
||||||
isError={Boolean(error)}
|
isError={Boolean(error)}
|
||||||
errorText={
|
errorText={
|
||||||
error?.message && userApprovers.length === 0 && groupApprovers.length === 0
|
error?.message &&
|
||||||
|
userApprovers.length === 0 &&
|
||||||
|
groupApprovers.length === 0
|
||||||
? error?.message
|
? error?.message
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
@@ -175,7 +175,10 @@ export const PolicyApprovalSteps = () => {
|
|||||||
value={userApprovers}
|
value={userApprovers}
|
||||||
onChange={(selected) => {
|
onChange={(selected) => {
|
||||||
const newApprovers = [
|
const newApprovers = [
|
||||||
...(selected || []),
|
...((selected as MultiValue<{
|
||||||
|
type: ApproverType;
|
||||||
|
id: string;
|
||||||
|
}>) || []),
|
||||||
...groupApprovers
|
...groupApprovers
|
||||||
];
|
];
|
||||||
onChange(newApprovers);
|
onChange(newApprovers);
|
||||||
@@ -187,7 +190,9 @@ export const PolicyApprovalSteps = () => {
|
|||||||
label="Group Approvers"
|
label="Group Approvers"
|
||||||
isError={Boolean(error)}
|
isError={Boolean(error)}
|
||||||
errorText={
|
errorText={
|
||||||
error?.message && userApprovers.length === 0 && groupApprovers.length === 0
|
error?.message &&
|
||||||
|
userApprovers.length === 0 &&
|
||||||
|
groupApprovers.length === 0
|
||||||
? error?.message
|
? error?.message
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
@@ -205,7 +210,10 @@ export const PolicyApprovalSteps = () => {
|
|||||||
onChange={(selected) => {
|
onChange={(selected) => {
|
||||||
const newApprovers = [
|
const newApprovers = [
|
||||||
...userApprovers,
|
...userApprovers,
|
||||||
...(selected || [])
|
...((selected as MultiValue<{
|
||||||
|
type: ApproverType;
|
||||||
|
id: string;
|
||||||
|
}>) || [])
|
||||||
];
|
];
|
||||||
onChange(newApprovers);
|
onChange(newApprovers);
|
||||||
}}
|
}}
|
||||||
@@ -225,7 +233,7 @@ export const PolicyApprovalSteps = () => {
|
|||||||
<div className="rounded border border-dashed border-mineshaft-600 bg-mineshaft-800/50 p-8 text-center">
|
<div className="rounded border border-dashed border-mineshaft-600 bg-mineshaft-800/50 p-8 text-center">
|
||||||
<p className="text-sm text-mineshaft-400">No approval steps defined</p>
|
<p className="text-sm text-mineshaft-400">No approval steps defined</p>
|
||||||
<p className="mt-1 text-xs text-mineshaft-500">
|
<p className="mt-1 text-xs text-mineshaft-500">
|
||||||
Click "Add Step" to create your first approval step
|
Click "Add Step" to create your first approval step
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
+1
@@ -3,6 +3,7 @@ import { faPlus, faTrash } from "@fortawesome/free-solid-svg-icons";
|
|||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
|
||||||
import { Button, FormControl, IconButton, Input } from "@app/components/v2";
|
import { Button, FormControl, IconButton, Input } from "@app/components/v2";
|
||||||
|
|
||||||
import { TPolicyForm } from "../PolicySchema";
|
import { TPolicyForm } from "../PolicySchema";
|
||||||
|
|
||||||
export const PolicyConstraintsStep = () => {
|
export const PolicyConstraintsStep = () => {
|
||||||
|
|||||||
+1
@@ -1,6 +1,7 @@
|
|||||||
import { Controller, useFormContext } from "react-hook-form";
|
import { Controller, useFormContext } from "react-hook-form";
|
||||||
|
|
||||||
import { FormControl, Input } from "@app/components/v2";
|
import { FormControl, Input } from "@app/components/v2";
|
||||||
|
|
||||||
import { TPolicyForm } from "../PolicySchema";
|
import { TPolicyForm } from "../PolicySchema";
|
||||||
|
|
||||||
export const PolicyDetailsStep = () => {
|
export const PolicyDetailsStep = () => {
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
export { PolicyModal } from "./PolicyModal";
|
|
||||||
export { PoliciesTable } from "./PoliciesTable";
|
export { PoliciesTable } from "./PoliciesTable";
|
||||||
|
export { PolicyModal } from "./PolicyModal";
|
||||||
export { PolicySection } from "./PolicySection";
|
export { PolicySection } from "./PolicySection";
|
||||||
|
|||||||
Reference in New Issue
Block a user