Skip to content

Commit

Permalink
Merge pull request #2630 from scott-ray-wilson/incorrect-import-value…
Browse files Browse the repository at this point in the history
…-display-fix

Fix: Correct Secret Value Override Display on Overview Table
  • Loading branch information
maidul98 authored Oct 21, 2024
2 parents 0a38374 + 14e92f8 commit 614e493
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
12 changes: 7 additions & 5 deletions frontend/src/hooks/api/secrets/queries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const fetchProjectSecrets = async ({
};

export const mergePersonalSecrets = (rawSecrets: SecretV3Raw[]) => {
const personalSecrets: Record<string, { id: string; value?: string }> = {};
const personalSecrets: Record<string, { id: string; value?: string; env: string }> = {};
const secrets: SecretV3RawSanitized[] = [];
rawSecrets.forEach((el) => {
const decryptedSecret: SecretV3RawSanitized = {
Expand All @@ -69,17 +69,19 @@ export const mergePersonalSecrets = (rawSecrets: SecretV3Raw[]) => {
if (el.type === SecretType.Personal) {
personalSecrets[decryptedSecret.key] = {
id: el.id,
value: el.secretValue
value: el.secretValue,
env: el.environment
};
} else {
secrets.push(decryptedSecret);
}
});

secrets.forEach((sec) => {
if (personalSecrets?.[sec.key]) {
sec.idOverride = personalSecrets[sec.key].id;
sec.valueOverride = personalSecrets[sec.key].value;
const personalSecret = personalSecrets?.[sec.key];
if (personalSecret && personalSecret.env === sec.env) {
sec.idOverride = personalSecret.id;
sec.valueOverride = personalSecret.value;
sec.overrideAction = "modified";
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,12 @@ export const OrgGroupsTable = ({ handlePopUpOpen }: Props) => {
})}
</TBody>
</Table>
{groups?.length === 0 && <EmptyState title="No groups found" icon={faUsers} />}
{filteredGroups?.length === 0 && (
<EmptyState
title={groups?.length === 0 ? "No groups found" : "No groups match search"}
icon={faUsers}
/>
)}
</TableContainer>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,14 @@ export const OrgMembersTable = ({ handlePopUpOpen, setCompleteInviteLinks }: Pro
</TBody>
</Table>
{!isLoading && filterdUser?.length === 0 && (
<EmptyState title="No organization members found" icon={faUsers} />
<EmptyState
title={
members?.length === 0
? "No organization members found"
: "No organization members match search"
}
icon={faUsers}
/>
)}
</TableContainer>
</div>
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/views/SecretOverviewPage/SecretOverviewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,8 @@ export const SecretOverviewPage = () => {
);

const allRowsSelectedOnPage = useMemo(() => {
if (!secrets?.length && !folders?.length) return { isChecked: false, isIndeterminate: false };

if (
(!secrets?.length ||
secrets?.every((secret) => selectedEntries[EntryType.SECRET][secret.key])) &&
Expand Down

0 comments on commit 614e493

Please sign in to comment.