Skip to content

Commit

Permalink
Issue #34: add switch to enable/disable base64 traceId encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
idrissneumann committed Dec 13, 2023
1 parent 242324f commit d76a42d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/configuration/DataLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const DataLink = (props: Props) => {
const { value, onChange, onDelete, suggestions, className } = props;
const styles = useStyles2(getStyles);
const [showInternalLink, setShowInternalLink] = useInternalLink(value.datasourceUid);
const [base64TraceId, setBase64TraceId] = useState(true)

const handleChange = (field: keyof typeof value) => (event: React.ChangeEvent<HTMLInputElement>) => {
onChange({
Expand All @@ -38,6 +39,11 @@ export const DataLink = (props: Props) => {
});
};

const handleBase64TraceId = (base64TraceId: boolean, config: DataLinkConfig) => {
setBase64TraceId(base64TraceId)
config = {...config, base64TraceId: base64TraceId };
}

return (
<div className={className}>
<div className={styles.firstRow}>
Expand Down Expand Up @@ -131,6 +137,17 @@ export const DataLink = (props: Props) => {
/>
)}
</div>

<div className={styles.row}>
<InlineField label="Base64" labelWidth={12}>
<InlineSwitch
title="Base64 traceId"
label="Base64 traceId"
value={base64TraceId}
onChange={() => handleBase64TraceId(!base64TraceId, value)}
/>
</InlineField>
</div>
</div>
);
};
Expand Down

0 comments on commit d76a42d

Please sign in to comment.