Skip to content

Commit

Permalink
feat(misc-section): add copy button to json fields
Browse files Browse the repository at this point in the history
Part of #782
Closes #786
  • Loading branch information
murilx committed Jan 21, 2025
1 parent 61e92d7 commit 3a2902e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dashboard/src/components/Section/MiscSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ export const getMiscSection = ({
const miscInfos: SubsectionLink[] = Object.entries(misc).map(
([fieldKey, fieldValue]) => {
let stringField = fieldValue.toString();
let isObjectField = false;
if (typeof fieldValue === 'object') {
stringField = JSON.stringify(fieldValue);
isObjectField = true;
}
const isUrlResult = isUrl(stringField);

Expand All @@ -39,6 +41,7 @@ export const getMiscSection = ({
<TruncatedValueTooltip value={stringField} isUrl={isUrlResult} />
),
link: isUrlResult ? stringField : undefined,
copyValue: isObjectField ? stringField : undefined,
};
},
);
Expand Down

0 comments on commit 3a2902e

Please sign in to comment.