7
7
fixed-header
8
8
>
9
9
<tbody class="sechub-primary-color">
10
- <tr><th>{{ $t('REPORT_DESCRIPTION_NAME')}}</th>
10
+ <tr>
11
11
<th>{{ $t('REPORT_DESCRIPTION_LOCATION')}}</th>
12
12
<th>{{ $t('REPORT_DESCRIPTION_ATTACK_VECTOR')}}</th>
13
13
<th>{{ $t('REPORT_DESCRIPTION_EVIDENCE')}}</th>
16
16
17
17
<tbody>
18
18
<tr>
19
- <td>{{ item.name }}</td>
20
19
<td>{{ webItem.request?.target }}</td>
21
20
<td>{{ webItem.attack?.vector }}</td>
22
21
<td>{{ webItem.attack?.evidence?.snippet }}</td>
93
92
<tr>
94
93
<td> {{ $t('REPORT_DETAILS_WEBSCAN_BODY') }}</td>
95
94
<td>
96
- {{ webItem.request?.body }}
95
+ <pre>
96
+ {{ formatJson(webItem.request?.body?.text || '{}') }}
97
+ </pre>
97
98
</td>
98
99
</tr>
99
100
</tbody>
125
126
</td>
126
127
</tr>
127
128
</tbody>
129
+
130
+ <tbody v-if="isExpanded.reportDetails">
131
+ <tr>
132
+ <td> {{ $t('REPORT_DETAILS_WEBSCAN_HEADERS') }}</td>
133
+ <td>
134
+ <v-list lines="two"
135
+ class="background-color">
136
+ <v-list-item
137
+ class="background-color ma-0 pa-0"
138
+ v-for="(header, i) in webItem.response?.headers">
139
+ <spa>{{ i }}</spa>: <span>{{ header }}</span>
140
+
141
+ </v-list-item>
142
+ </v-list>
143
+ </td>
144
+ </tr>
145
+ </tbody>
146
+
147
+ <tbody v-if="isExpanded.reportDetails"
148
+ class="background-color-light ">
149
+ <tr>
150
+ <td> {{ $t('REPORT_DETAILS_WEBSCAN_BODY') }}</td>
151
+ <td>
152
+ <pre>
153
+ {{ formatJson(webItem.response?.body?.text || '{}') }}
154
+ </pre>
155
+ </td>
156
+ </tr>
157
+ </tbody>
128
158
</v-table>
129
159
</div>
130
160
161
+ <!-- Description Table -->
162
+ <div>
163
+ <v-table
164
+ class="background-color sechub-report-expandable-element"
165
+ fixed-header
166
+ >
167
+ <tbody class="sechub-primary-color">
168
+ <tr>
169
+ <v-btn
170
+ :append-icon="isExpanded.description ? 'mdi-chevron-up' : 'mdi-chevron-down'"
171
+ :text="isExpanded.description ? $t('REPORT_DESCRIPTION_HIDE') : $t('REPORT_DESCRIPTION_SHOW')"
172
+ class="text-none background-color ma-2"
173
+ color="primary"
174
+ variant="text"
175
+ @click="toggleExpand('description')">
176
+ </v-btn>
177
+ </tr>
178
+ </tbody>
179
+ <tbody v-if="isExpanded.description">
180
+ <tr>
181
+ <td> {{ item.description }} </td>
182
+ </tr>
183
+ </tbody>
184
+ </v-table>
185
+ </div>
186
+
131
187
<!-- Solution Table -->
132
188
<div>
133
189
<v-table
162
218
import { getTrafficLightClass } from '@/utils/projectUtils'
163
219
import { SecHubFinding, SecHubReportWeb } from '@/generated-sources/openapi'
164
220
import '@/styles/sechub.scss'
165
- import { it } from 'vuetify/locale'
166
221
167
222
interface Props {
168
223
item: SecHubFinding
@@ -171,7 +226,7 @@ interface Props {
171
226
interface ExpandedState {
172
227
reportDetails: boolean;
173
228
solution: boolean;
174
- table3 : boolean;
229
+ description : boolean;
175
230
}
176
231
177
232
export default defineComponent({
@@ -191,19 +246,41 @@ export default defineComponent({
191
246
const isExpanded = ref<ExpandedState>({
192
247
reportDetails: false,
193
248
solution: false,
194
- table3 : false,
249
+ description : false,
195
250
})
196
251
197
252
const toggleExpand = (table: keyof ExpandedState) => {
198
253
isExpanded.value[table] = !isExpanded.value[table]
199
254
}
255
+
256
+ function formatJson(jsonString: string) {
257
+ console.log(jsonString)
258
+ try {
259
+ const jsonObj = JSON.parse(jsonString)
260
+ return JSON.stringify(jsonObj, null, 2)
261
+ } catch (error) {
262
+ return jsonString
263
+ }
264
+ }
265
+
200
266
return {
201
267
getTrafficLightClass,
202
268
toggleExpand,
269
+ formatJson,
203
270
item,
204
271
webItem,
205
272
isExpanded,
206
273
}
207
274
},
208
275
})
209
- </script>
276
+ </script>
277
+ <style scoped>
278
+ pre {
279
+ word-wrap: break-word;
280
+ width: 100%;
281
+ margin: 0;
282
+ display: inline;
283
+ text-align: left;
284
+ white-space: pre-line;
285
+ }
286
+ </style>
0 commit comments