Skip to content

Commit d76a42d

Browse files
committed
Issue #34: add switch to enable/disable base64 traceId encoding
1 parent 242324f commit d76a42d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/configuration/DataLink.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export const DataLink = (props: Props) => {
3030
const { value, onChange, onDelete, suggestions, className } = props;
3131
const styles = useStyles2(getStyles);
3232
const [showInternalLink, setShowInternalLink] = useInternalLink(value.datasourceUid);
33+
const [base64TraceId, setBase64TraceId] = useState(true)
3334

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

42+
const handleBase64TraceId = (base64TraceId: boolean, config: DataLinkConfig) => {
43+
setBase64TraceId(base64TraceId)
44+
config = {...config, base64TraceId: base64TraceId };
45+
}
46+
4147
return (
4248
<div className={className}>
4349
<div className={styles.firstRow}>
@@ -131,6 +137,17 @@ export const DataLink = (props: Props) => {
131137
/>
132138
)}
133139
</div>
140+
141+
<div className={styles.row}>
142+
<InlineField label="Base64" labelWidth={12}>
143+
<InlineSwitch
144+
title="Base64 traceId"
145+
label="Base64 traceId"
146+
value={base64TraceId}
147+
onChange={() => handleBase64TraceId(!base64TraceId, value)}
148+
/>
149+
</InlineField>
150+
</div>
134151
</div>
135152
);
136153
};

0 commit comments

Comments
 (0)