Skip to content

Commit 49d31a6

Browse files
authored
Implement simple file-upload in web-ui (#3977)
1 parent 78f5629 commit 49d31a6

File tree

18 files changed

+143
-578
lines changed

18 files changed

+143
-578
lines changed

sechub-administration/src/main/java/com/mercedesbenz/sechub/domain/administration/user/UserTransactionService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: MIT
12
package com.mercedesbenz.sechub.domain.administration.user;
23

34
import static java.util.Objects.requireNonNull;

sechub-pds-solutions/gitleaks/env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# The base image to use
22
# uncomment to use local image
3-
# BASE_IMAGE="pds-base_pds"
3+
# BASE_IMAGE="pds-base-pds"
44
BASE_IMAGE="ghcr.io/mercedes-benz/sechub/pds-base"
55

66
# The gitleaks version to use

sechub-web-ui/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
This project is a web application that provides a user interface for the SecHub API. It is built with [Vite](https://vitejs.dev/), [Vue 3](https://v3.vuejs.org/), and [Vuetify](https://vuetifyjs.com/en/).
55

6-
## Prequisites
6+
## Prerequisites
77

88
### Installation
99

@@ -65,14 +65,14 @@ You can use the sechub-api.sh script to manage your user and project.
6565
1. Follow all steps above
6666
2. Start the integration test PDS
6767
(for the correct run configuration follow the [developer guide](https://mercedes-benz.github.io/sechub/latest/sechub-developer-quickstart-guide.html#run-integration-tests-from-ide))
68-
3. (Optional) Initial setup: execute `test-setups/setup-integration-test-server.sh`. Make sure the .env file contains the correct values for basic auth.
68+
3. (Optional) Initial setup: execute `test-setups/integrationtest-setups/setup.sh`. Make sure the .env file contains the correct values for basic auth.
6969

7070
### Running local development server with SecHub Docker Container and PDS Docker Container (Real Products)
7171
> Only useful If you want to get real scan results
7272
1. Start the SecHub Server as Docker Container (see sechub-solution/01-...)
73-
2. Start the required PDS as Docker Container (e.g. sechub-pds-solutions/gosec/05-...)
74-
3. Set up PDS in sechub-solution/setups/ e.g. setup-gosec.sh
75-
4. Make sure your user is assigned to the project you want to scan
73+
2. Start the required PDS as Docker (e.g. sechub-pds-solutions/gosec/05-...)
74+
3. (Optional) Initial setup: execute `/test-setups/docker/setup.sh` for gosec and gitleaks (Make sure PDS are running)
75+
7676

7777
Now you can test your web-ui with sechub and real scans!
7878

sechub-web-ui/public/favicon.ico

11.5 KB
Binary file not shown.
4.31 KB
Loading

sechub-web-ui/src/assets/sechub-logo.svg

Lines changed: 0 additions & 494 deletions
This file was deleted.

sechub-web-ui/src/components/AppHeader.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<router-link to="/projects">
77
<img
88
alt="Logo"
9-
class="logo ma-2 pa-1"
10-
src="@/assets/sechub-logo.svg"
9+
class="logo ma-2 pa-2"
10+
src="@/assets/sechub-logo-shield.png"
1111
>
1212
</router-link>
1313

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
<!-- SPDX-License-Identifier: MIT -->
22
<template>
3-
<v-card>
4-
<v-alert
5-
closable
6-
color="success"
7-
density="compact"
8-
:title="$t('CHANGE_USER_MAIL_SUCCESS')"
9-
variant="tonal"
10-
>
11-
</v-alert>
12-
</v-card>
3+
<v-card>
4+
<v-alert
5+
closable
6+
color="success"
7+
density="compact"
8+
:title="$t('CHANGE_USER_MAIL_SUCCESS')"
9+
variant="tonal"
10+
/>
11+
</v-card>
1312
</template>

sechub-web-ui/src/components/ScanCreate.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,15 @@
9494
<script lang="ts">
9595
import { defineComponent } from 'vue'
9696
import { useRoute } from 'vue-router'
97-
import { useI18n } from 'vue-i18n'
9897
import { SecHubConfiguration } from '@/generated-sources/openapi'
9998
import { buildSecHubConfiguration } from '@/utils/scanConfigUtils'
10099
import defaultClient from '@/services/defaultClient'
100+
import { CODE_SCAN_IDENTIFIER, SECRET_SCAN_IDENTIFER } from '@/utils/applicationConstants'
101101
102102
export default defineComponent({
103103
104104
setup () {
105105
// routing and translation methods
106-
const { t } = useI18n()
107106
const route = useRoute()
108107
const router = useRouter()
109108
const projectId = ref('')
@@ -151,7 +150,7 @@
151150
}
152151
153152
if (selectedFile.value !== null) {
154-
configuration.value = buildSecHubConfiguration(selectedScanOptions.value, selectedFile.value, selectedFileType.value, projectId.value)
153+
configuration.value = buildSecHubConfiguration(selectedScanOptions.value, selectedFileType.value, projectId.value)
155154
createScan()
156155
}
157156
}
@@ -172,7 +171,7 @@
172171
173172
return {
174173
projectId,
175-
scanOptions: [t('SCAN_CREATE_CODE_SCAN'), t('SCAN_CREATE_SECRET_SCAN')] as string[],
174+
scanOptions: [CODE_SCAN_IDENTIFIER, SECRET_SCAN_IDENTIFER] as string[],
176175
selectedScanOptions,
177176
validateScanReady,
178177
selectedFile,

sechub-web-ui/src/components/ScanFileUpload.vue

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,13 @@
2121
:label="$t('SCAN_CREATE_SOURCE_CODE')"
2222
:value="1"
2323
/>
24-
<!--
2524
<v-radio
2625
color="primary"
2726
:label="$t('SCAN_CREATE_BINARIES')"
2827
:value="2"
2928
/>
30-
-->
3129
</v-radio-group>
32-
<v-alert
33-
class="pa-2, mb-5"
34-
color="info"
35-
max-width="1000px"
36-
:title="$t('SCAN_CREATE_FILE_UPLOAD_NOTE_TITLE')"
37-
type="info"
38-
variant="tonal"
39-
>
40-
{{ $t('SCAN_CREATE_FILE_UPLOAD_NOTE_ONE') }} <br>
41-
{{ $t('SCAN_CREATE_FILE_UPLOAD_NOTE_TWO') }} <br>
42-
{{ $t('SCAN_CREATE_FILE_UPLOAD_NOTE_THREE') }}
43-
</v-alert>
30+
4431
<v-file-input
4532
v-model="file"
4633
:accept="fileAccept"
@@ -67,6 +54,7 @@
6754
<script lang="ts">
6855
import { defineComponent, ref } from 'vue'
6956
import { useI18n } from 'vue-i18n'
57+
import { FILETYPE_BINARIES, FILETYPE_SOURCES } from '@/utils/applicationConstants'
7058
7159
export default defineComponent({
7260
emits: ['onFileUpdate'],
@@ -90,15 +78,14 @@
9078
9179
switch (selectedRadio.value) {
9280
case 1:
93-
fileType = 'sources'
81+
fileType = FILETYPE_SOURCES
9482
validType = file.value?.type === 'application/zip'
9583
errorMessage = t('SCAN_CREATE_FILE_UPLOAD_INPUT_ERROR_ZIP')
9684
break
9785
case 2:
98-
// binary upload currently not needed
99-
// fileType = 'binaries'
100-
// validType = file.value?.type === 'application/x-tar'
101-
// errorMessage = t('SCAN_CREATE_FILE_UPLOAD_INPUT_ERROR_TAR')
86+
fileType = FILETYPE_BINARIES
87+
validType = file.value?.type === 'application/x-tar'
88+
errorMessage = t('SCAN_CREATE_FILE_UPLOAD_INPUT_ERROR_TAR')
10289
break
10390
}
10491

0 commit comments

Comments
 (0)