Skip to content
Snippets Groups Projects
Verified Commit 981c64ac authored by Daniel Göbel's avatar Daniel Göbel
Browse files

Update API Client and deactivate closing modal with js

#5
parent a55e8cf0
No related branches found
No related tags found
1 merge request!4Display buckets and their objects
This commit is part of merge request !4. Comments created here will be created in the context of that merge request.
......@@ -19,7 +19,7 @@ export type OpenAPIConfig = {
};
export const OpenAPI: OpenAPIConfig = {
BASE: import.meta.env.VITE_API_BASE_URL != null ? import.meta.env.VITE_API_BASE_URL : 'http://localhost:9999/api',
BASE: '/api',
VERSION: '1.0.0',
WITH_CREDENTIALS: false,
CREDENTIALS: 'include',
......
......@@ -19,7 +19,7 @@ export type BucketOut = {
*/
created_at: string;
/**
* Username of the owner
* UID of the owner
*/
owner: string;
};
......
......@@ -25,9 +25,9 @@ export type BucketPermission = {
*/
permission?: (PermissionEnum | string);
/**
* Name of User
* UID of the grantee
*/
username: string;
uid: string;
/**
* Name of Bucket
*/
......
......@@ -7,7 +7,7 @@
*/
export type S3Key = {
/**
* Username of the user of that access key
* UID of the user of that access key
*/
user: string;
/**
......
......@@ -10,10 +10,6 @@ export type User = {
* ID of the user
*/
uid: string;
/**
* Username of the user
*/
username: string;
/**
* Full Name of the user
*/
......
......@@ -17,20 +17,20 @@ export class BucketPermissionsService {
* The owner of the bucket and the grantee of the permission can view it.
*
* @param bucketName Name of bucket
* @param username Username of a user
* @param uid UID of a user
* @returns BucketPermission Successful Response
* @throws ApiError
*/
public static bucketPermissionsGetPermissionForBucket(
bucketName: string,
username: string,
uid: string,
): CancelablePromise<BucketPermission> {
return __request(OpenAPI, {
method: 'GET',
url: '/permissions/bucket/{bucket_name}/user/{username}',
url: '/permissions/bucket/{bucket_name}/user/{uid}',
path: {
'bucket_name': bucketName,
'username': username,
'uid': uid,
},
errors: {
400: `Error decoding JWT Token`,
......@@ -45,22 +45,22 @@ export class BucketPermissionsService {
* Update a bucket permission
* Update a permission for a bucket and user.
*
* @param username Username of a user
* @param uid UID of a user
* @param bucketName Name of bucket
* @param requestBody
* @returns BucketPermission Successful Response
* @throws ApiError
*/
public static bucketPermissionsUpdatePermission(
username: string,
uid: string,
bucketName: string,
requestBody: BucketPermissionParameters,
): CancelablePromise<BucketPermission> {
return __request(OpenAPI, {
method: 'PUT',
url: '/permissions/bucket/{bucket_name}/user/{username}',
url: '/permissions/bucket/{bucket_name}/user/{uid}',
path: {
'username': username,
'uid': uid,
'bucket_name': bucketName,
},
body: requestBody,
......@@ -81,20 +81,20 @@ export class BucketPermissionsService {
* The owner of the bucket and the grantee of the permission can delete it.
*
* @param bucketName Name of bucket
* @param username Username of a user
* @param uid UID of a user
* @returns void
* @throws ApiError
*/
public static bucketPermissionsDeletePermissionForBucket(
bucketName: string,
username: string,
uid: string,
): CancelablePromise<void> {
return __request(OpenAPI, {
method: 'DELETE',
url: '/permissions/bucket/{bucket_name}/user/{username}',
url: '/permissions/bucket/{bucket_name}/user/{uid}',
path: {
'bucket_name': bucketName,
'username': username,
'uid': uid,
},
errors: {
400: `Error decoding JWT Token`,
......@@ -135,18 +135,18 @@ export class BucketPermissionsService {
* Get all permissions for a user.
* List all the bucket permissions for the given user.
*
* @param username Username of a user
* @param uid UID of a user
* @returns BucketPermission Successful Response
* @throws ApiError
*/
public static bucketPermissionsListPermissionsPerUser(
username: string,
uid: string,
): CancelablePromise<Array<BucketPermission>> {
return __request(OpenAPI, {
method: 'GET',
url: '/permissions/user/{username}',
url: '/permissions/user/{uid}',
path: {
'username': username,
'uid': uid,
},
errors: {
400: `Error decoding JWT Token`,
......
......@@ -13,18 +13,18 @@ export class KeyService {
* Get the S3 Access keys from a user
* Get all the S3 Access keys for a specific user.
*
* @param username Username of a user
* @param uid UID of a user
* @returns S3Key Successful Response
* @throws ApiError
*/
public static keyGetUserKeys(
username: string,
uid: string,
): CancelablePromise<Array<S3Key>> {
return __request(OpenAPI, {
method: 'GET',
url: '/users/{username}/keys',
url: '/users/{uid}/keys',
path: {
'username': username,
'uid': uid,
},
errors: {
400: `Error decoding JWT Token`,
......@@ -39,18 +39,18 @@ export class KeyService {
* Create a Access key for a user
* Create a S3 Access key for a specific user.
*
* @param username Username of a user
* @param uid UID of a user
* @returns S3Key Successful Response
* @throws ApiError
*/
public static keyCreateUserKey(
username: string,
uid: string,
): CancelablePromise<S3Key> {
return __request(OpenAPI, {
method: 'POST',
url: '/users/{username}/keys',
url: '/users/{uid}/keys',
path: {
'username': username,
'uid': uid,
},
errors: {
400: `Error decoding JWT Token`,
......@@ -66,20 +66,20 @@ export class KeyService {
* Get a specific S3 Access Key for a specific user.
*
* @param accessId ID of the S3 access key
* @param username Username of a user
* @param uid UID of a user
* @returns S3Key Successful Response
* @throws ApiError
*/
public static keyGetUserKey(
accessId: string,
username: string,
uid: string,
): CancelablePromise<S3Key> {
return __request(OpenAPI, {
method: 'GET',
url: '/users/{username}/keys/{access_id}',
url: '/users/{uid}/keys/{access_id}',
path: {
'access_id': accessId,
'username': username,
'uid': uid,
},
errors: {
400: `Error decoding JWT Token`,
......@@ -95,20 +95,20 @@ export class KeyService {
* Delete a specific S3 Access key for a specific user.
*
* @param accessId ID of the S3 access key
* @param username Username of a user
* @param uid UID of a user
* @returns void
* @throws ApiError
*/
public static keyDeleteUserKey(
accessId: string,
username: string,
uid: string,
): CancelablePromise<void> {
return __request(OpenAPI, {
method: 'DELETE',
url: '/users/{username}/keys/{access_id}',
url: '/users/{uid}/keys/{access_id}',
path: {
'access_id': accessId,
'username': username,
'uid': uid,
},
errors: {
400: `Error decoding JWT Token`,
......
......@@ -30,21 +30,21 @@ export class UserService {
}
/**
* Get a user by its username
* Return the user with the specific username. A user can only view himself.
* Get a user by its uid
* Return the user with the specific uid. A user can only view himself.
*
* @param username Username of a user
* @param uid UID of a user
* @returns User Successful Response
* @throws ApiError
*/
public static userGetUser(
username: string,
uid: string,
): CancelablePromise<User> {
return __request(OpenAPI, {
method: 'GET',
url: '/users/{username}',
url: '/users/{uid}',
path: {
'username': username,
'uid': uid,
},
errors: {
400: `Error decoding JWT Token`,
......@@ -59,18 +59,18 @@ export class UserService {
* Get the S3 Access keys from a user
* Get all the S3 Access keys for a specific user.
*
* @param username Username of a user
* @param uid UID of a user
* @returns S3Key Successful Response
* @throws ApiError
*/
public static keyGetUserKeys(
username: string,
uid: string,
): CancelablePromise<Array<S3Key>> {
return __request(OpenAPI, {
method: 'GET',
url: '/users/{username}/keys',
url: '/users/{uid}/keys',
path: {
'username': username,
'uid': uid,
},
errors: {
400: `Error decoding JWT Token`,
......@@ -85,18 +85,18 @@ export class UserService {
* Create a Access key for a user
* Create a S3 Access key for a specific user.
*
* @param username Username of a user
* @param uid UID of a user
* @returns S3Key Successful Response
* @throws ApiError
*/
public static keyCreateUserKey(
username: string,
uid: string,
): CancelablePromise<S3Key> {
return __request(OpenAPI, {
method: 'POST',
url: '/users/{username}/keys',
url: '/users/{uid}/keys',
path: {
'username': username,
'uid': uid,
},
errors: {
400: `Error decoding JWT Token`,
......@@ -112,20 +112,20 @@ export class UserService {
* Get a specific S3 Access Key for a specific user.
*
* @param accessId ID of the S3 access key
* @param username Username of a user
* @param uid UID of a user
* @returns S3Key Successful Response
* @throws ApiError
*/
public static keyGetUserKey(
accessId: string,
username: string,
uid: string,
): CancelablePromise<S3Key> {
return __request(OpenAPI, {
method: 'GET',
url: '/users/{username}/keys/{access_id}',
url: '/users/{uid}/keys/{access_id}',
path: {
'access_id': accessId,
'username': username,
'uid': uid,
},
errors: {
400: `Error decoding JWT Token`,
......@@ -141,20 +141,20 @@ export class UserService {
* Delete a specific S3 Access key for a specific user.
*
* @param accessId ID of the S3 access key
* @param username Username of a user
* @param uid UID of a user
* @returns void
* @throws ApiError
*/
public static keyDeleteUserKey(
accessId: string,
username: string,
uid: string,
): CancelablePromise<void> {
return __request(OpenAPI, {
method: 'DELETE',
url: '/users/{username}/keys/{access_id}',
url: '/users/{uid}/keys/{access_id}',
path: {
'access_id': accessId,
'username': username,
'uid': uid,
},
errors: {
400: `Error decoding JWT Token`,
......
<script setup lang="ts">
import { BucketService } from "@/client";
import type { BucketIn } from "@/client";
import { reactive, ref } from "vue";
import { reactive } from "vue";
/*
import { onMounted } from "vue";
import { Modal } from "bootstrap";
*/
const emit = defineEmits(["bucketCreated"]);
const bucket = reactive({ name: "", description: "" } as BucketIn);
......@@ -16,18 +18,21 @@ const formState = reactive({
bucketNameTaken: boolean;
loading: boolean;
});
let theModal: Modal | null = null;
const modal = ref(null as Element | null);
defineProps<{
modalid: string;
modallabel: string;
}>();
/*
let theModal: Modal | null = null;
const modal = ref(null as Element | null);
onMounted(() => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
theModal = Modal.getOrCreateInstance(modal.value!);
});
*/
function createBucket() {
formState.validated = true;
......@@ -39,7 +44,7 @@ function createBucket() {
BucketService.bucketCreateBucket(bucket)
.then((createdBucket) => {
emit("bucketCreated", createdBucket);
console.log(theModal);
//console.log(theModal);
//theModal?.hide();
bucket.name = "";
bucket.description = "";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment