Skip to content

Commit fc6f628

Browse files
committed
Storage profile details with annotation from openapi.json (#44).
1 parent 0f61646 commit fc6f628

5 files changed

Lines changed: 58 additions & 131 deletions

File tree

.github/workflows/build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ jobs:
3232
node-version: ${{ env.NODE_VERSION }}
3333
cache: 'npm'
3434
cache-dependency-path: frontend/package-lock.json
35+
- name: Generate openapi.json
36+
working-directory: backend
37+
run: >
38+
mvn -B quarkus:build
3539
- name: Install npm dependencies
3640
working-directory: frontend
3741
run: npm install

backend/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<quarkus.jib.base-jvm-image>eclipse-temurin:17-jre</quarkus.jib.base-jvm-image> <!-- irrelevant for -Pnative -->
1717
<jwt.version>4.4.0</jwt.version>
1818
<surefire-plugin.version>3.1.2</surefire-plugin.version>
19+
<quarkus.smallrye-openapi.store-schema-directory>../frontend/src/openapi</quarkus.smallrye-openapi.store-schema-directory>
1920
</properties>
2021

2122
<dependencyManagement>

frontend/src/common/backend.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,9 @@ export type StorageProfileDto = {
236236
scheme: string;
237237
hostname: string;
238238
port: number;
239-
oauthClientId: string;
240-
oauthTokenUrl: string;
241-
oauthAuthorizationUrl: string;
242239
stsRoleArn: string;
243240
stsRoleArn2: string;
244241
stsDurationSeconds: number;
245-
oAuthTokenExchangeAudience: number;
246242
archived: boolean;
247243
// TODO https://github.com/shift7-ch/cipherduck-hub/issues/44 add bucketVersioning/bucketAcceleration/bucketEncryption
248244
}

frontend/src/components/cipherduck/StorageProfileDetails.vue

Lines changed: 51 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -17,133 +17,56 @@
1717
<p class="ml-3 text-sm text-yellow-700">{{ t('vaultDetails.warning.archived') }}</p>
1818
</div>
1919
</div>
20-
<!--
21-
22-
TODO https://github.com/shift7-ch/cipherduck-hub/issues/44
23-
- get description and default vaules and possible values from /q/openapi/openapi.json
24-
- add red start for mandatory etc.
25-
- filter for archived
26-
- fully dynamic: full list of attributes from openapi?
27-
-->
28-
29-
<div>
30-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.id') }}</h3>
31-
<div class="mt-2 flex items-center justify-between">
32-
<p class="text-sm text-gray-500">{{ storageprofile.id }}</p>
33-
</div>
34-
</div>
35-
<div>
36-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.name') }}</h3>
37-
<div class="mt-2 flex items-center justify-between">
38-
<p class="text-sm text-gray-500">{{ storageprofile.name }}</p>
39-
</div>
40-
</div>
41-
<div>
42-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.protocol') }}</h3>
43-
<div class="mt-2 flex items-center justify-between">
44-
<p class="text-sm text-gray-500">{{ storageprofile.protocol }}</p>
45-
</div>
46-
</div>
47-
<div v-if="storageprofile.protocol == 'S3STS'">
48-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.bucketPrefix') }}</h3>
49-
<div class="mt-2 flex items-center justify-between">
50-
<p class="text-sm text-gray-500">{{ storageprofile.bucketPrefix }}</p>
51-
</div>
52-
</div>
53-
<div v-if="storageprofile.protocol == 'S3STS'">
54-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.stsRoleArnClient') }}</h3>
55-
<div class="mt-2 flex items-center justify-between">
56-
<p class="text-sm text-gray-500">{{ storageprofile.stsRoleArnClient }}</p>
57-
</div>
58-
</div>
59-
<div v-if="storageprofile.protocol == 'S3STS'">
60-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.stsRoleArnHub') }}</h3>
61-
<div class="mt-2 flex items-center justify-between">
62-
<p class="text-sm text-gray-500">{{ storageprofile.stsRoleArnHub }}</p>
63-
</div>
64-
</div>
65-
<div v-if="storageprofile.protocol == 'S3STS'">
66-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.stsEndpoint') }}</h3>
67-
<div class="mt-2 flex items-center justify-between">
68-
<p class="text-sm text-gray-500">{{ storageprofile.stsEndpoint }}</p>
69-
</div>
70-
</div>
71-
<div>
72-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.withPathStyleAccessEnabled') }}</h3>
73-
<div class="mt-2 flex items-center justify-between">
74-
<p class="text-sm text-gray-500">{{ storageprofile.withPathStyleAccessEnabled }}</p>
75-
</div>
76-
</div>
77-
<div v-if="storageprofile.protocol == 'S3STS'">
78-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.region') }}</h3>
79-
<div class="mt-2 flex items-center justify-between">
80-
<p class="text-sm text-gray-500">{{ storageprofile.region }}</p>
81-
</div>
82-
</div>
83-
<div v-if="storageprofile.protocol == 'S3STS'">
84-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.regions') }}</h3>
85-
<div class="mt-2 flex items-center justify-between">
86-
<p class="text-sm text-gray-500">{{ storageprofile.regions }}</p>
87-
</div>
88-
</div>
89-
<div>
90-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.scheme') }}</h3>
91-
<div class="mt-2 flex items-center justify-between">
92-
<p class="text-sm text-gray-500">{{ storageprofile.scheme }}</p>
93-
</div>
94-
</div>
95-
<div>
96-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.hostname') }}</h3>
97-
<div class="mt-2 flex items-center justify-between">
98-
<p class="text-sm text-gray-500">{{ storageprofile.hostname }}</p>
99-
</div>
100-
</div>
101-
<div>
102-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.port') }}</h3>
103-
<div class="mt-2 flex items-center justify-between">
104-
<p class="text-sm text-gray-500">{{ storageprofile.port }}</p>
105-
</div>
106-
</div>
107-
<div>
108-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.oauthClientId') }}</h3>
109-
<div class="mt-2 flex items-center justify-between">
110-
<p class="text-sm text-gray-500">{{ storageprofile.oauthClientId }}</p>
111-
</div>
112-
</div>
113-
<div>
114-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.oauthTokenUrl') }}</h3>
115-
<div class="mt-2 flex items-center justify-between">
116-
<p class="text-sm text-gray-500">{{ storageprofile.oauthTokenUrl }}</p>
117-
</div>
118-
</div>
119-
<div>
120-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.oauthAuthorizationUrl') }}</h3>
121-
<div class="mt-2 flex items-center justify-between">
122-
<p class="text-sm text-gray-500">{{ storageprofile.oauthAuthorizationUrl }}</p>
123-
</div>
124-
</div>
125-
<div v-if="storageprofile.protocol == 'S3STS'">
126-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.stsRoleArn') }}</h3>
127-
<div class="mt-2 flex items-center justify-between">
128-
<p class="text-sm text-gray-500">{{ storageprofile.stsRoleArn }}</p>
129-
</div>
130-
</div>
131-
<div v-if="storageprofile.protocol == 'S3STS'">
132-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.stsRoleArn2') }}</h3>
133-
<div class="mt-2 flex items-center justify-between">
134-
<p class="text-sm text-gray-500">{{ storageprofile.stsRoleArn2 }}</p>
135-
</div>
136-
</div>
137-
<div v-if="storageprofile.protocol == 'S3STS'">
138-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.stsDurationSeconds') }}</h3>
139-
<div class="mt-2 flex items-center justify-between">
140-
<p class="text-sm text-gray-500">{{ storageprofile.stsDurationSeconds }}</p>
20+
<div v-if="storageprofile['protocol'] == 'S3STS'">
21+
<div v-for="(item,key) in openapi.components.schemas.StorageProfileS3STSDto.properties">
22+
<h3 class="font-medium text-gray-900"><span v-if="!item.nullable" style="color: red;">* </span>{{ key }}</h3>
23+
<div class="mt-2 flex items-center justify-between">
24+
<p class="text-sm text-gray-600">{{ storageprofile[key] }}</p>
25+
</div>
26+
<div class="mt-2 flex items-center justify-between">
27+
<p class="text-sm text-gray-400">{{ item.description }}</p>
28+
</div>
29+
<div class="mt-2 flex items-center justify-between">
30+
<p class="text-sm text-gray-400">type: {{ openapi.components.schemas.StorageProfileS3STSDto.properties[key].type }}</p>
31+
</div>
32+
<div v-if="openapi.components.schemas.StorageProfileS3STSDto.properties[key].allOf">
33+
<div class="mt-2 flex items-center justify-between">
34+
<p v-if="openapi.components.schemas[openapi.components.schemas.StorageProfileS3STSDto.properties[key].allOf[0].$ref.split('/').pop()].enum" class="text-sm text-gray-400">enum: {{ openapi.components.schemas[openapi.components.schemas.StorageProfileS3STSDto.properties[key].allOf[0].$ref.split('/').pop()].enum }}</p>
35+
</div>
36+
<div class="mt-2 flex items-center justify-between">
37+
<p v-if="openapi.components.schemas[openapi.components.schemas.StorageProfileS3STSDto.properties[key].allOf[0].$ref.split('/').pop()].pattern" class="text-sm text-gray-400">pattern: {{ openapi.components.schemas[openapi.components.schemas.StorageProfileS3STSDto.properties[key].allOf[0].$ref.split('/').pop()].pattern }}</p>
38+
</div>
39+
</div>
40+
<div class="mt-2 flex items-center justify-between" v-if="openapi.components.schemas.StorageProfileS3STSDto.properties[key].example">
41+
<p class="text-sm text-gray-400">Example: {{ openapi.components.schemas.StorageProfileS3STSDto.properties[key].example }}</p>
42+
</div>
43+
<br/>
14144
</div>
14245
</div>
143-
<div>
144-
<h3 class="font-medium text-gray-900">{{ t('storageprofile.oAuthTokenExchangeAudience') }}</h3>
145-
<div class="mt-2 flex items-center justify-between">
146-
<p class="text-sm text-gray-500">{{ storageprofile.oAuthTokenExchangeAudience }}</p>
46+
<div v-if="storageprofile['protocol'] == 'S3'">
47+
<div v-for="(item,key) in openapi.components.schemas.StorageProfileS3Dto.properties">
48+
<h3 class="font-medium text-gray-900"><span v-if="!item.nullable" style="color: red;">* </span>{{ key }}</h3>
49+
<div class="mt-2 flex items-center justify-between">
50+
<p class="text-sm text-gray-600">{{ storageprofile[key] }}</p>
51+
</div>
52+
<div class="mt-2 flex items-center justify-between">
53+
<p class="text-sm text-gray-400">{{ item.description }}</p>
54+
</div>
55+
<div class="mt-2 flex items-center justify-between">
56+
<p class="text-sm text-gray-400">type: {{ openapi.components.schemas.StorageProfileS3Dto.properties[key].type }}</p>
57+
</div>
58+
<div v-if="openapi.components.schemas.StorageProfileS3Dto.properties[key].allOf">
59+
<div class="mt-2 flex items-center justify-between">
60+
<p v-if="openapi.components.schemas[openapi.components.schemas.StorageProfileS3Dto.properties[key].allOf[0].$ref.split('/').pop()].enum" class="text-sm text-gray-400">enum: {{ openapi.components.schemas[openapi.components.schemas.StorageProfileS3Dto.properties[key].allOf[0].$ref.split('/').pop()].enum }}</p>
61+
</div>
62+
<div class="mt-2 flex items-center justify-between">
63+
<p v-if="openapi.components.schemas[openapi.components.schemas.StorageProfileS3Dto.properties[key].allOf[0].$ref.split('/').pop()].pattern" class="text-sm text-gray-400">pattern: {{ openapi.components.schemas[openapi.components.schemas.StorageProfileS3Dto.properties[key].allOf[0].$ref.split('/').pop()].pattern }}</p>
64+
</div>
65+
</div>
66+
<div class="mt-2 flex items-center justify-between" v-if="openapi.components.schemas.StorageProfileS3Dto.properties[key].example">
67+
<p class="text-sm text-gray-400">example: {{ openapi.components.schemas.StorageProfileS3Dto.properties[key].example }}</p>
68+
</div>
69+
<br/>
14770
</div>
14871
</div>
14972
</div>
@@ -153,8 +76,9 @@
15376
import { ExclamationTriangleIcon } from '@heroicons/vue/20/solid';
15477
import { computed, onMounted, ref } from 'vue';
15578
import { useI18n } from 'vue-i18n';
156-
import backend, { StorageProfileDto, NotFoundError } from '../../common/backend';
79+
import backend, { NotFoundError, StorageProfileDto as StorageProfileDto2 } from '../../common/backend';
15780
import FetchError from '../FetchError.vue';
81+
import { openapi } from '../../openapi/index';
15882
15983
16084
const { t } = useI18n({ useScope: 'global' });
@@ -167,7 +91,7 @@ const props = defineProps<{
16791
const onFetchError = ref<Error | null>();
16892
const allowRetryFetch = computed(() => onFetchError.value != null && !(onFetchError.value instanceof NotFoundError)); //fetch requests either list something, or query from th storageprofile In the latter, a 404 indicates the vault does not exists anymore.
16993
170-
const storageprofile = ref<StorageProfileDto>();
94+
const storageprofile = ref<StorageProfileDto2>();
17195
17296
onMounted(fetchData);
17397

frontend/src/openapi/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import o from './openapi.json';
2+
export const openapi = o;

0 commit comments

Comments
 (0)