feat: fetch folder and secrets

This commit is contained in:
Salman
2024-03-14 09:39:57 +05:30
parent 126e385046
commit 1fc9e60254
11 changed files with 205 additions and 63 deletions
@@ -105,6 +105,8 @@ export const CreateSecretForm = ({
>
<SecretInput
{...field}
environment={environment}
secretPath={secretPath}
containerClassName="text-bunker-300 hover:border-primary-400/50 border border-mineshaft-600 bg-mineshaft-900 px-2 py-1.5"
/>
</FormControl>
@@ -172,7 +172,12 @@ export const SecretImportItem = ({
{key}
</td>
<td className="h-10" style={{ padding: "0.25rem 1rem" }}>
<SecretInput value={value} isReadOnly />
<SecretInput
value={value}
isReadOnly
environment={overriden?.env}
secretPath={overriden?.secretPath}
/>
</td>
<td className="h-10" style={{ padding: "0.25rem 1rem" }}>
<EnvFolderIcon env={overriden?.env} secretPath={overriden?.secretPath} />
@@ -206,6 +206,8 @@ export const SecretDetailSidebar = ({
<FormControl label="Value">
<SecretInput
isReadOnly={isReadOnly}
environment={environment}
secretPath={secretPath}
key="secret-value"
isDisabled={isOverridden || !isAllowed}
containerClassName="text-bunker-300 hover:border-primary-400/50 border border-mineshaft-600 bg-bunker-800 px-2 py-1.5"
@@ -242,6 +244,8 @@ export const SecretDetailSidebar = ({
<FormControl label="Value Override">
<SecretInput
isReadOnly={isReadOnly}
environment={environment}
secretPath={secretPath}
containerClassName="text-bunker-300 hover:border-primary-400/50 border border-mineshaft-600 bg-bunker-800 px-2 py-1.5"
{...field}
/>
@@ -267,6 +267,8 @@ export const SecretItem = memo(
key="value-overriden"
isVisible={isVisible}
isReadOnly={isReadOnly}
environment={environment}
secretPath={secretPath}
{...field}
containerClassName="py-1.5 rounded-md transition-all group-hover:mr-2"
/>
@@ -282,6 +284,8 @@ export const SecretItem = memo(
isReadOnly={isReadOnly}
key="secret-value"
isVisible={isVisible}
environment={environment}
secretPath={secretPath}
{...field}
containerClassName="py-1.5 rounded-md transition-all group-hover:mr-2"
/>
@@ -120,7 +120,9 @@ export const SecretItem = ({ mode, preSecret, postSecret }: Props) => {
<Td className="border-r border-mineshaft-600">Value</Td>
{isModified && (
<Td className="border-r border-mineshaft-600">
<SecretInput value={preSecret?.value} />
<SecretInput
value={preSecret?.value}
/>
</Td>
)}
<Td>
@@ -93,7 +93,7 @@ export const SecretEditRow = ({
control={control}
name="value"
render={({ field }) => (
<SecretInput {...field} value={field.value as string} isVisible={isVisible} />
<SecretInput {...field} value={field.value as string} isVisible={isVisible} secretPath={secretPath} environment={environment} />
)}
/>
</div>
@@ -102,7 +102,8 @@ export const CreateRotationForm = ({
))}
</Stepper>
<AnimatePresence exitBeforeEnter>
{wizardStep === 0 && (
{/* TODO: Check this before merge */}
{wizardStep === 0 && wizardData.current.output && (
<motion.div
key="input-step"
transition={{ duration: 0.1 }}
@@ -117,6 +118,8 @@ export const CreateRotationForm = ({
setWizardStep((state) => state + 1);
}}
inputSchema={provider.template?.inputs || {}}
secretPath={wizardData.current.output.secretPath}
environment={wizardData.current.output.environment}
/>
</motion.div>
)}
@@ -13,11 +13,13 @@ type Props = {
properties: Record<string, { type: string; desc?: string; default?: string }>;
required: string[];
};
secretPath: string;
environment: string;
};
const formSchema = z.record(z.string().trim().optional());
export const RotationInputForm = ({ onSubmit, onCancel, inputSchema }: Props) => {
export const RotationInputForm = ({ onSubmit, onCancel, inputSchema, secretPath, environment }: Props) => {
const {
control,
handleSubmit,
@@ -60,6 +62,7 @@ export const RotationInputForm = ({ onSubmit, onCancel, inputSchema }: Props) =>
{...field}
containerClassName="normal-case text-bunker-300 hover:border-primary-400/50 border border-mineshaft-600 bg-bunker-800 px-2 py-1.5"
required={inputSchema.required.includes(inputName)}
secretPath={secretPath} environment={environment}
/>
</FormControl>
)}