Skip to content

Commit 35194fe

Browse files
Merge pull request #567 from ansforge/feature/json-tree-toggle
feat(lrm): ajout du toggle pour l’arborescence JSON
2 parents f208a04 + e4c1811 commit 35194fe

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

web/lrm/client/components/ReceivedMessage.vue

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,36 @@
105105
: 'mdi-magnify-minus-outline'
106106
}}</v-icon>
107107
</v-btn>
108+
<v-btn
109+
icon
110+
variant="text"
111+
size="x-small"
112+
color="primary"
113+
@click="expandAll"
114+
>
115+
<v-icon size="24">mdi-unfold-more-vertical</v-icon>
116+
</v-btn>
117+
<v-btn
118+
icon
119+
variant="text"
120+
size="x-small"
121+
color="primary"
122+
@click="collapseAll"
123+
>
124+
<v-icon size="24">mdi-unfold-less-vertical</v-icon>
125+
</v-btn>
108126
</span>
109127
</v-row>
110128

111129
<json-viewer
112130
v-if="!dense"
131+
:key="jsonViewerKey"
113132
:value="
114133
showFullMessage
115134
? body
116135
: body.content[0].jsonContent.embeddedJsonContent.message
117136
"
118-
:expand-depth="jsonDepth"
137+
:expand-depth="jsonDepthLocal"
119138
:copyable="{ copyText: 'Copier', copiedText: 'Copié !', timeout: 1000 }"
120139
expanded
121140
theme="json-theme"
@@ -247,6 +266,19 @@ const sendAck = (refused = false) => {
247266
}
248267
};
249268
269+
const jsonViewerKey = ref(0);
270+
const jsonDepthLocal = ref(props.jsonDepth);
271+
272+
const expandAll = () => {
273+
jsonDepthLocal.value = 99;
274+
jsonViewerKey.value++;
275+
};
276+
277+
const collapseAll = () => {
278+
jsonDepthLocal.value = 1;
279+
jsonViewerKey.value++;
280+
};
281+
250282
//on mounted, send ack if autoAckConfig is enabled
251283
onMounted(() => {
252284
if (autoAckConfig.value) {

0 commit comments

Comments
 (0)