misc: addressed comments

This commit is contained in:
Sheen Capadngan
2025-10-17 21:30:55 +08:00
parent a95cb63682
commit ee2ab9f4ba
7 changed files with 78 additions and 48 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ export enum ExternalMigrationProviders {
export enum VaultImportStatus {
Imported = "imported",
ApprovalRequired = "approval_required"
ApprovalRequired = "approval-required"
}
export type TVaultExternalMigrationConfig = {
@@ -1,6 +1,7 @@
import { useState } from "react";
import { faEdit, faPlus, faTrash } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Link } from "@tanstack/react-router";
import { createNotification } from "@app/components/notifications";
import {
@@ -162,7 +163,14 @@ export const VaultConnectionSection = () => {
<p className="mt-4 text-xs text-mineshaft-400">
Configure namespace-specific connections to enable in-platform migration features. Manage
connections in the App Connections section.
connections in the{" "}
<Link
to="/organization/app-connections"
className="text-primary underline hover:text-primary-300"
>
App Connections
</Link>{" "}
section.
</p>
<VaultNamespaceConfigModal
@@ -21,7 +21,9 @@ import {
import { TVaultExternalMigrationConfig } from "@app/hooks/api/migration/types";
const schema = z.object({
namespace: z.string().min(1, "Namespace is required"),
namespace: z
.string()
.min(1, "Namespace is required. If you intend to use the root namespace, use root or /."),
connectionId: z.string().min(1, "Connection is required")
});
@@ -94,38 +94,25 @@ const Content = ({ onClose }: ContentProps) => {
}
// Apply the parsed permissions to the form
Object.entries(parsedPermissions).forEach(([subject, value]) => {
(Object.keys(parsedPermissions) as ProjectPermissionSub[]).forEach((subjectKey) => {
const value = parsedPermissions[subjectKey];
if (!value) return;
const subjectKey = subject as ProjectPermissionSub;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const existingValue = rootForm.getValues(`permissions.${subjectKey}`) as any;
const existingValue = rootForm.getValues(`permissions.${subjectKey}`) as unknown[];
if (Array.isArray(existingValue) && existingValue.length > 0) {
// Merge with existing permissions
rootForm.setValue(
`permissions.${subjectKey}`,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore-error
[...existingValue, ...value],
{
shouldDirty: true,
shouldTouch: true,
shouldValidate: true
}
);
rootForm.setValue(`permissions.${subjectKey}`, [...existingValue, ...value] as never, {
shouldDirty: true,
shouldTouch: true,
shouldValidate: true
});
} else {
rootForm.setValue(
`permissions.${subjectKey}`,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore-error
value,
{
shouldDirty: true,
shouldTouch: true,
shouldValidate: true
}
);
rootForm.setValue(`permissions.${subjectKey}`, value as never, {
shouldDirty: true,
shouldTouch: true,
shouldValidate: true
});
}
});