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

Add create resource modal

#88
parent 1bd797d5
No related branches found
No related tags found
1 merge request!85Resolve "Add UI for viewing and managing Resources"
This commit is part of merge request !85. Comments created here will be created in the context of that merge request.
Showing
with 39 additions and 65 deletions
......@@ -51,7 +51,7 @@ export class CancelablePromise<T> implements Promise<T> {
return;
}
this.#isResolved = true;
this.#resolve?.(value);
if (this.#resolve) this.#resolve(value);
};
const onReject = (reason?: any): void => {
......@@ -59,7 +59,7 @@ export class CancelablePromise<T> implements Promise<T> {
return;
}
this.#isRejected = true;
this.#reject?.(reason);
if (this.#reject) this.#reject(reason);
};
const onCancel = (cancelHandler: () => void): void => {
......@@ -122,7 +122,7 @@ export class CancelablePromise<T> implements Promise<T> {
}
}
this.#cancelHandlers.length = 0;
this.#reject?.(new CancelError('Request aborted'));
if (this.#reject) this.#reject(new CancelError('Request aborted'));
}
public get isCancelled(): boolean {
......
......@@ -145,10 +145,13 @@ export const resolve = async <T>(options: ApiRequestOptions, resolver?: T | Reso
};
export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions, formData?: FormData): Promise<Record<string, string>> => {
const token = await resolve(options, config.TOKEN);
const username = await resolve(options, config.USERNAME);
const password = await resolve(options, config.PASSWORD);
const additionalHeaders = await resolve(options, config.HEADERS);
const [token, username, password, additionalHeaders] = await Promise.all([
resolve(options, config.TOKEN),
resolve(options, config.USERNAME),
resolve(options, config.PASSWORD),
resolve(options, config.HEADERS),
]);
const formHeaders = typeof formData?.getHeaders === 'function' && formData?.getHeaders() || {}
const headers = Object.entries({
......
......@@ -2,7 +2,6 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
/**
* Schema for a error due to a rejected request.
*/
......
......@@ -2,9 +2,7 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ValidationError } from './ValidationError';
export type HTTPValidationError = {
detail?: Array<ValidationError>;
};
......
......@@ -2,7 +2,6 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
/**
* Enumeration for the Roles in the CloWM Services.
*/
......@@ -12,4 +11,5 @@ export enum RoleEnum {
REVIEWER = 'reviewer',
DEVELOPER = 'developer',
FOREIGN_USER = 'foreign_user',
DB_MAINTAINER = 'db_maintainer',
}
......@@ -2,9 +2,7 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { RoleEnum } from './RoleEnum';
/**
* Schema for a user.
*/
......
......@@ -2,7 +2,6 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type ValidationError = {
loc: Array<(string | number)>;
msg: string;
......
......@@ -5,9 +5,7 @@
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
export class AuthService {
/**
* Redirect to LifeScience OIDC Login
* Redirect route to OIDC provider to kickstart the login process.
......@@ -23,7 +21,6 @@ export class AuthService {
},
});
}
/**
* LifeScience Login Callback
* Callback for the Life Science Identity Provider.
......@@ -48,5 +45,4 @@ export class AuthService {
},
});
}
}
......@@ -4,17 +4,14 @@
/* eslint-disable */
import type { RoleEnum } from '../models/RoleEnum';
import type { User } from '../models/User';
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
export class UserService {
/**
* Get the logged in user
* Return the user associated with the used JWT.
* Permission 'user:read' required.
* Permission `user:read` required.
* @returns User Successful Response
* @throws ApiError
*/
......@@ -29,21 +26,21 @@ export class UserService {
},
});
}
/**
* List users and search by their name
* Return the users that have a specific substring in their name.
* Permission 'user:read_any' required, except when 'name_substring' as only query parameter is set.
* Then permission 'user:search' required.
* @param nameSubstring Filter users by a substring in their name. Permission 'search' required
* @param filterRoles Filter users by their role. If multiple are selected, they are concatenating by an OR Expresssion. Permission 'read_any' required
* @param includeRoles Flag whether to include the roles of the users in the response. If True, permission 'read_any' required.
*
* Permission `user:read_any` required, except when `name_substring` as only query parameter is set,
* then permission `user:search` required.
* @param nameSubstring Filter users by a substring in their name. Permission `user:search` required
* @param filterRoles Filter users by their role. If multiple are selected, they are concatenating by an OR Expression. Permission `user:read_any` required
* @param includeRoles Flag whether to include the roles of the users in the response. If True, permission `user:read_any` required.
* @returns User Successful Response
* @throws ApiError
*/
public static userListUsers(
nameSubstring?: (string | null),
filterRoles?: (Array<RoleEnum> | null),
nameSubstring?: string,
filterRoles?: Array<RoleEnum>,
includeRoles: boolean = false,
): CancelablePromise<Array<User>> {
return __request(OpenAPI, {
......@@ -62,13 +59,13 @@ export class UserService {
},
});
}
/**
* Get a user by its uid
* Return the user with the specific uid. A user can only view himself.
* Permission 'user:read' required
* Return the user with the specific uid.
*
* Permission `user:read` required if the current user has the same uid as `uid` otherwise `user:read_any` required.
* @param uid UID of a user
* @param includeRoles Flag whether to include the roles of the users in the response. If True, permission 'read_any' required.
* @param includeRoles Flag whether to include the roles of the users in the response. If True, permission `user:read_any` required.
* @returns User Successful Response
* @throws ApiError
*/
......@@ -93,5 +90,4 @@ export class UserService {
},
});
}
}
......@@ -51,7 +51,7 @@ export class CancelablePromise<T> implements Promise<T> {
return;
}
this.#isResolved = true;
this.#resolve?.(value);
if (this.#resolve) this.#resolve(value);
};
const onReject = (reason?: any): void => {
......@@ -59,7 +59,7 @@ export class CancelablePromise<T> implements Promise<T> {
return;
}
this.#isRejected = true;
this.#reject?.(reason);
if (this.#reject) this.#reject(reason);
};
const onCancel = (cancelHandler: () => void): void => {
......@@ -122,7 +122,7 @@ export class CancelablePromise<T> implements Promise<T> {
}
}
this.#cancelHandlers.length = 0;
this.#reject?.(new CancelError('Request aborted'));
if (this.#reject) this.#reject(new CancelError('Request aborted'));
}
public get isCancelled(): boolean {
......
......@@ -145,10 +145,13 @@ export const resolve = async <T>(options: ApiRequestOptions, resolver?: T | Reso
};
export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions, formData?: FormData): Promise<Record<string, string>> => {
const token = await resolve(options, config.TOKEN);
const username = await resolve(options, config.USERNAME);
const password = await resolve(options, config.PASSWORD);
const additionalHeaders = await resolve(options, config.HEADERS);
const [token, username, password, additionalHeaders] = await Promise.all([
resolve(options, config.TOKEN),
resolve(options, config.USERNAME),
resolve(options, config.PASSWORD),
resolve(options, config.HEADERS),
]);
const formHeaders = typeof formData?.getHeaders === 'function' && formData?.getHeaders() || {}
const headers = Object.entries({
......
......@@ -2,7 +2,6 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
/**
* Schema for a error due to a rejected request.
*/
......
......@@ -2,9 +2,7 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ValidationError } from './ValidationError';
export type HTTPValidationError = {
detail?: Array<ValidationError>;
};
......
......@@ -2,7 +2,6 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type ResourceIn = {
/**
* Short tag describing the version of the resource
......
......@@ -2,9 +2,7 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ResourceVersionOut } from './ResourceVersionOut';
export type ResourceOut = {
/**
* Short Name for the resource
......
......@@ -2,7 +2,6 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type ResourceVersionIn = {
/**
* Short tag describing the version of the resource
......
......@@ -2,9 +2,7 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Status } from './Status';
export type ResourceVersionOut = {
/**
* Short tag describing the version of the resource
......
......@@ -2,7 +2,6 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
/**
* Enumeration for the possible status of a resource version.
*/
......
......@@ -2,7 +2,6 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type ValidationError = {
loc: Array<(string | number)>;
msg: string;
......
......@@ -5,13 +5,10 @@
import type { ResourceIn } from '../models/ResourceIn';
import type { ResourceOut } from '../models/ResourceOut';
import type { Status } from '../models/Status';
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
export class ResourceService {
/**
* List resources
* List all resources.
......@@ -24,9 +21,9 @@ export class ResourceService {
* @throws ApiError
*/
public static resourceListResources(
maintainerId?: (string | null),
versionStatus?: (Array<Status> | null),
nameSubstring?: (string | null),
maintainerId?: string,
versionStatus?: Array<Status>,
nameSubstring?: string,
): CancelablePromise<Array<ResourceOut>> {
return __request(OpenAPI, {
method: 'GET',
......@@ -44,7 +41,6 @@ export class ResourceService {
},
});
}
/**
* Request a new resource
* Request a new resources.
......@@ -54,7 +50,7 @@ export class ResourceService {
* @returns ResourceOut Successful Response
* @throws ApiError
*/
public static resourceRequestResource(
public static resourceCreateResource(
requestBody: ResourceIn,
): CancelablePromise<ResourceOut> {
return __request(OpenAPI, {
......@@ -70,7 +66,6 @@ export class ResourceService {
},
});
}
/**
* Get a resource
* Get a specific resource.
......@@ -83,7 +78,7 @@ export class ResourceService {
*/
public static resourceGetResource(
rid: string,
versionStatus?: (Array<Status> | null),
versionStatus?: Array<Status>,
): CancelablePromise<ResourceOut> {
return __request(OpenAPI, {
method: 'GET',
......@@ -102,7 +97,6 @@ export class ResourceService {
},
});
}
/**
* Delete a resource
* Delete a resources.
......@@ -129,5 +123,4 @@ export class ResourceService {
},
});
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment