diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index afff695a..1b1f7bc6 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -10,6 +10,7 @@ api/funding.service.ts api/iNSEService.service.ts api/institutions.service.ts api/news.service.ts +api/organization.service.ts api/patents.service.ts api/personNetwork.service.ts api/persons.service.ts @@ -56,6 +57,7 @@ model/cordisEuProject.ts model/cordisEuProjectPage.ts model/costUsd.ts model/createAccountRequest.ts +model/createOrganizationRequest.ts model/customAuthor.ts model/customAuthorsListResponse.ts model/dehydratedAuthor.ts @@ -77,6 +79,8 @@ model/fwci.ts model/groupByResult.ts model/hTTPValidationError.ts model/idToken.ts +model/inseAccountManagementModelOrganizationProfile.ts +model/inseOrganizationManagementModelOrganizationProfile.ts model/institution.ts model/institutionFunderSummary.ts model/institutionGeo.ts @@ -99,7 +103,7 @@ model/newsArticle.ts model/newsArticleDetail.ts model/newsPage.ts model/openAccess.ts -model/organizationProfile.ts +model/organizationPage.ts model/patentEntry.ts model/patentsByAuthorResponse.ts model/personBio.ts @@ -127,6 +131,7 @@ model/topicsListResponse.ts model/universityRanking.ts model/universityTopicData.ts model/updateAccountRequest.ts +model/updateOrganizationRequest.ts model/userRole.ts model/validationError.ts model/validationErrorLocInner.ts diff --git a/webapp/src/app/api/api/api.ts b/webapp/src/app/api/api/api.ts index a7107b6c..62bac5d0 100644 --- a/webapp/src/app/api/api/api.ts +++ b/webapp/src/app/api/api/api.ts @@ -10,6 +10,8 @@ export * from './institutions.service'; import { InstitutionsService } from './institutions.service'; export * from './news.service'; import { NewsService } from './news.service'; +export * from './organization.service'; +import { OrganizationService } from './organization.service'; export * from './patents.service'; import { PatentsService } from './patents.service'; export * from './personNetwork.service'; @@ -22,4 +24,4 @@ export * from './topics.service'; import { TopicsService } from './topics.service'; export * from './works.service'; import { WorksService } from './works.service'; -export const APIS = [AuthService, CompanyConnectionsService, FundingService, INSEServiceService, InstitutionsService, NewsService, PatentsService, PersonNetworkService, PersonsService, ProjectsService, TopicsService, WorksService]; +export const APIS = [AuthService, CompanyConnectionsService, FundingService, INSEServiceService, InstitutionsService, NewsService, OrganizationService, PatentsService, PersonNetworkService, PersonsService, ProjectsService, TopicsService, WorksService]; diff --git a/webapp/src/app/api/api/auth.service.ts b/webapp/src/app/api/api/auth.service.ts index a927c77c..6beb60cc 100644 --- a/webapp/src/app/api/api/auth.service.ts +++ b/webapp/src/app/api/api/auth.service.ts @@ -37,9 +37,9 @@ import { CreateAccountRequest } from '../model/createAccountRequest'; // @ts-ignore import { HTTPValidationError } from '../model/hTTPValidationError'; // @ts-ignore -import { LoginResponse } from '../model/loginResponse'; +import { InseAccountManagementModelOrganizationProfile } from '../model/inseAccountManagementModelOrganizationProfile'; // @ts-ignore -import { OrganizationProfile } from '../model/organizationProfile'; +import { LoginResponse } from '../model/loginResponse'; // @ts-ignore import { UpdateAccountRequest } from '../model/updateAccountRequest'; @@ -434,9 +434,9 @@ export class AuthService extends BaseService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public listAccountOrganizations(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public listAccountOrganizations(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; - public listAccountOrganizations(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public listAccountOrganizations(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listAccountOrganizations(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public listAccountOrganizations(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; public listAccountOrganizations(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { let localVarHeaders = this.defaultHeaders; @@ -469,7 +469,7 @@ export class AuthService extends BaseService { let localVarPath = `/api/accounts/organizations`; const { basePath, withCredentials } = this.configuration; - return this.httpClient.request>('get', `${basePath}${localVarPath}`, + return this.httpClient.request>('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, diff --git a/webapp/src/app/api/api/organization.service.ts b/webapp/src/app/api/api/organization.service.ts new file mode 100644 index 00000000..2af0ed8b --- /dev/null +++ b/webapp/src/app/api/api/organization.service.ts @@ -0,0 +1,310 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +/* tslint:disable:no-unused-variable member-ordering */ + +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; + +// @ts-ignore +import { CreateOrganizationRequest } from '../model/createOrganizationRequest'; +// @ts-ignore +import { HTTPValidationError } from '../model/hTTPValidationError'; +// @ts-ignore +import { InseOrganizationManagementModelOrganizationProfile } from '../model/inseOrganizationManagementModelOrganizationProfile'; +// @ts-ignore +import { OrganizationPage } from '../model/organizationPage'; +// @ts-ignore +import { UpdateOrganizationRequest } from '../model/updateOrganizationRequest'; + +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; +import { BaseService } from '../api.base.service'; + + + +@Injectable({ + providedIn: 'root' +}) +export class OrganizationService extends BaseService { + + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); + } + + /** + * Create Organization + * @endpoint post /api/organizations + * @param createOrganizationRequest + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (createOrganizationRequest === null || createOrganizationRequest === undefined) { + throw new Error('Required parameter createOrganizationRequest was null or undefined when calling createOrganisation.'); + } + + let localVarHeaders = this.defaultHeaders; + + // authentication (HTTPBearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/organizations`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: createOrganizationRequest, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Delete Organization + * @endpoint delete /api/organizations/{organization_id} + * @param organizationId + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public deleteOrganisation(organizationId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public deleteOrganisation(organizationId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteOrganisation(organizationId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteOrganisation(organizationId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (organizationId === null || organizationId === undefined) { + throw new Error('Required parameter organizationId was null or undefined when calling deleteOrganisation.'); + } + + let localVarHeaders = this.defaultHeaders; + + // authentication (HTTPBearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/organizations/${this.configuration.encodeParam({name: "organizationId", value: organizationId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: "uuid"})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get Organizations + * @endpoint get /api/organizations + * @param page + * @param pageSize + * @param offset + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getOrganisations(page?: number, pageSize?: number, offset?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getOrganisations(page?: number, pageSize?: number, offset?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getOrganisations(page?: number, pageSize?: number, offset?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getOrganisations(page?: number, pageSize?: number, offset?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'page_size'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + offset, 'offset'); + + let localVarHeaders = this.defaultHeaders; + + // authentication (HTTPBearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/organizations`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Update Organization + * @endpoint put /api/organizations/{organization_id} + * @param organizationId + * @param updateOrganizationRequest + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (organizationId === null || organizationId === undefined) { + throw new Error('Required parameter organizationId was null or undefined when calling updateOrganisation.'); + } + if (updateOrganizationRequest === null || updateOrganizationRequest === undefined) { + throw new Error('Required parameter updateOrganizationRequest was null or undefined when calling updateOrganisation.'); + } + + let localVarHeaders = this.defaultHeaders; + + // authentication (HTTPBearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/organizations/${this.configuration.encodeParam({name: "organizationId", value: organizationId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: "uuid"})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: updateOrganizationRequest, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + +} diff --git a/webapp/src/app/api/model/createOrganizationRequest.ts b/webapp/src/app/api/model/createOrganizationRequest.ts new file mode 100644 index 00000000..fffb5457 --- /dev/null +++ b/webapp/src/app/api/model/createOrganizationRequest.ts @@ -0,0 +1,16 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface CreateOrganizationRequest { + name: string; + other_inst_id?: string | null; +} + diff --git a/webapp/src/app/api/model/organizationProfile.ts b/webapp/src/app/api/model/inseAccountManagementModelOrganizationProfile.ts similarity index 81% rename from webapp/src/app/api/model/organizationProfile.ts rename to webapp/src/app/api/model/inseAccountManagementModelOrganizationProfile.ts index 939671ba..c67acc71 100644 --- a/webapp/src/app/api/model/organizationProfile.ts +++ b/webapp/src/app/api/model/inseAccountManagementModelOrganizationProfile.ts @@ -9,7 +9,7 @@ */ -export interface OrganizationProfile { +export interface InseAccountManagementModelOrganizationProfile { id: string; name: string; openalex_institution_id?: string | null; diff --git a/webapp/src/app/api/model/inseOrganizationManagementModelOrganizationProfile.ts b/webapp/src/app/api/model/inseOrganizationManagementModelOrganizationProfile.ts new file mode 100644 index 00000000..404df0f9 --- /dev/null +++ b/webapp/src/app/api/model/inseOrganizationManagementModelOrganizationProfile.ts @@ -0,0 +1,19 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface InseOrganizationManagementModelOrganizationProfile { + id: string; + name: string; + other_inst_id?: string | null; + deleted: boolean; + member_count: number; +} + diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index 9f8dbc31..3e2afd5c 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -34,6 +34,7 @@ export * from './cordisEuProject'; export * from './cordisEuProjectPage'; export * from './costUsd'; export * from './createAccountRequest'; +export * from './createOrganizationRequest'; export * from './customAuthor'; export * from './customAuthorsListResponse'; export * from './dehydratedAuthor'; @@ -55,6 +56,8 @@ export * from './fwci'; export * from './groupByResult'; export * from './hTTPValidationError'; export * from './idToken'; +export * from './inseAccountManagementModelOrganizationProfile'; +export * from './inseOrganizationManagementModelOrganizationProfile'; export * from './institution'; export * from './institutionFunderSummary'; export * from './institutionGeo'; @@ -76,7 +79,7 @@ export * from './newsArticle'; export * from './newsArticleDetail'; export * from './newsPage'; export * from './openAccess'; -export * from './organizationProfile'; +export * from './organizationPage'; export * from './patentEntry'; export * from './patentsByAuthorResponse'; export * from './personBio'; @@ -104,6 +107,7 @@ export * from './topicsListResponse'; export * from './universityRanking'; export * from './universityTopicData'; export * from './updateAccountRequest'; +export * from './updateOrganizationRequest'; export * from './userRole'; export * from './validationError'; export * from './validationErrorLocInner'; diff --git a/webapp/src/app/api/model/organizationPage.ts b/webapp/src/app/api/model/organizationPage.ts new file mode 100644 index 00000000..5b8294b1 --- /dev/null +++ b/webapp/src/app/api/model/organizationPage.ts @@ -0,0 +1,19 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { InseOrganizationManagementModelOrganizationProfile } from './inseOrganizationManagementModelOrganizationProfile'; + + +export interface OrganizationPage { + items: Array; + total: number; + page: number; + page_size: number; +} + diff --git a/webapp/src/app/api/model/updateOrganizationRequest.ts b/webapp/src/app/api/model/updateOrganizationRequest.ts new file mode 100644 index 00000000..e12063b6 --- /dev/null +++ b/webapp/src/app/api/model/updateOrganizationRequest.ts @@ -0,0 +1,17 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface UpdateOrganizationRequest { + name?: string | null; + other_inst_id?: string | null; + deleted?: boolean | null; +} + diff --git a/webapp/src/app/app.config.ts b/webapp/src/app/app.config.ts index 1c579be1..3b700752 100644 --- a/webapp/src/app/app.config.ts +++ b/webapp/src/app/app.config.ts @@ -19,7 +19,7 @@ import { registerLocaleData } from '@angular/common'; import { authenticationInterceptor } from './shared/interceptors/authentication.interceptor'; import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field'; import { MatPaginatorIntl } from '@angular/material/paginator'; -import { PaginatorIntl } from './shared/utils/paginatorIntl'; +import { PaginatorIntl } from './resolvers/utils/paginatorIntl'; import { provideEchartsCore } from 'ngx-echarts'; import { ErrorService } from './shared/services/error.service'; import { provideApi } from './api/provide-api'; diff --git a/webapp/src/app/app.routes.ts b/webapp/src/app/app.routes.ts index 5fcca07d..88a90229 100644 --- a/webapp/src/app/app.routes.ts +++ b/webapp/src/app/app.routes.ts @@ -18,6 +18,7 @@ import { cordisEuProjectPageResolver } from './resolvers/cordis-eu-project-page. import { cordisEuProjectsFundingResolver } from './resolvers/cordis-eu-projects-funding.resolver'; import { fundingProjectPageResolver } from './resolvers/funding-project-page.resolver'; import { personCordisEuProjectPageResolver } from './resolvers/person-cordis-eu-project-page.resolver'; +import { accountResolver } from './resolvers/account.resolver'; export const routes: Routes = [ { @@ -92,6 +93,17 @@ export const routes: Routes = [ loadComponent: () => import('./modules/news/news.component').then((mod) => mod.NewsComponent), }, + { + path: 'account', + canActivate: [userGuard], + loadComponent: () => + import('./modules/account/account.component').then( + (mod) => mod.AccountComponent, + ), + resolve: { + accountProfile: accountResolver, + }, + }, { path: 'accounts', canActivate: [adminGuard], diff --git a/webapp/src/app/modules/account/account.component.html b/webapp/src/app/modules/account/account.component.html new file mode 100644 index 00000000..7590acb3 --- /dev/null +++ b/webapp/src/app/modules/account/account.component.html @@ -0,0 +1,20 @@ +
+ +
+ + + + + + diff --git a/webapp/src/app/modules/account/account.component.scss b/webapp/src/app/modules/account/account.component.scss new file mode 100644 index 00000000..25c46861 --- /dev/null +++ b/webapp/src/app/modules/account/account.component.scss @@ -0,0 +1,44 @@ +.content { + max-width: 100%; +} + +.account-profile-information { + display: flex; + flex-direction: column; + gap: 0.5rem; + justify-content: center; + align-items: center; + padding: 1rem; +} + +.personal-information { + display: flex; + flex-direction: column; + align-items: center; +} + +.role-chip { + font-size: 10px; + font-weight: 600; + color: var(--sg-text-muted); + background: var(--sg-surface-muted); + border-radius: var(--sg-radius-sm); +} + +.name { + font-size: 16px; + font-weight: 600; + color: var(--sg-text-primary); +} + +.mail { + font-size: 12px; + font-weight: 600; + color: var(--sg-text-muted); +} + +.organization { + font-size: 12px; + font-weight: 600; + color: var(--sg-text-muted); +} diff --git a/webapp/src/app/modules/account/account.component.ts b/webapp/src/app/modules/account/account.component.ts new file mode 100644 index 00000000..7a953dee --- /dev/null +++ b/webapp/src/app/modules/account/account.component.ts @@ -0,0 +1,24 @@ +import { Component, effect, input } from '@angular/core'; +import { AccountProfile, UserRole } from '../../api'; +import { RolePipe } from '../../shared/pipes/role.pipe'; +import { MatChipsModule } from '@angular/material/chips'; +import { MatTabsModule } from '@angular/material/tabs'; +import { MatDividerModule } from '@angular/material/divider'; + +@Component({ + selector: 'app-account', + imports: [RolePipe, MatChipsModule, MatTabsModule, MatDividerModule], + templateUrl: './account.component.html', + styleUrl: './account.component.scss', +}) +export class AccountComponent { + readonly accountProfile = input.required(); + + roles: UserRole[] = []; + + constructor() { + effect(() => { + this.roles = [this.accountProfile().role]; + }); + } +} diff --git a/webapp/src/app/modules/accounts/accounts.component.html b/webapp/src/app/modules/accounts/accounts.component.html index 8137c2f2..6a5fdb83 100644 --- a/webapp/src/app/modules/accounts/accounts.component.html +++ b/webapp/src/app/modules/accounts/accounts.component.html @@ -79,7 +79,7 @@ {{ account.email }} {{ account.organization_name }} - {{ account.role }} + {{ account.role | role }} diff --git a/webapp/src/app/modules/accounts/accounts.component.ts b/webapp/src/app/modules/accounts/accounts.component.ts index 845f0990..f02fa6da 100644 --- a/webapp/src/app/modules/accounts/accounts.component.ts +++ b/webapp/src/app/modules/accounts/accounts.component.ts @@ -21,6 +21,7 @@ import type { AccountDialogComponent, AccountDialogResult, } from './account-dialog.component'; +import { RolePipe } from '../../shared/pipes/role.pipe'; @Component({ selector: 'app-accounts', @@ -34,6 +35,7 @@ import type { MatSelectModule, MatSnackBarModule, MatDialogModule, + RolePipe, ], templateUrl: './accounts.component.html', styleUrl: './accounts.component.scss', @@ -164,8 +166,7 @@ export class AccountsComponent implements OnInit { data: { ...data, organizations: this.organizations, - canSelectOrganization: - this.credentialService.isEffectiveSuperAdmin(), + canSelectOrganization: this.credentialService.isEffectiveSuperAdmin(), roles: this.availableRoles, }, }); diff --git a/webapp/src/app/modules/person-interesting/person-interesting.component.ts b/webapp/src/app/modules/person-interesting/person-interesting.component.ts index d8d496aa..5555f149 100644 --- a/webapp/src/app/modules/person-interesting/person-interesting.component.ts +++ b/webapp/src/app/modules/person-interesting/person-interesting.component.ts @@ -16,7 +16,7 @@ import { ActivatedRoute, Router } from '@angular/router'; import { TopicCount } from '../../api'; import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component'; -import { topicHierarchyColor } from '../../shared/utils/topic-colors'; +import { topicHierarchyColor } from '../../resolvers/utils/topic-colors'; interface InterestTag { id: string; diff --git a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts index fa29012f..12f223ce 100644 --- a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts @@ -14,8 +14,8 @@ import { ViewChild, } from '@angular/core'; import { TopicChipComponent } from '../../../../shared/ui/topic-chip/topic-chip.component'; -import { topicHierarchyColor } from '../../../../shared/utils/topic-colors'; -import { buildTopicHierarchyTooltip } from '../../../../shared/utils/topic-tooltip'; +import { topicHierarchyColor } from '../../../../resolvers/utils/topic-colors'; +import { buildTopicHierarchyTooltip } from '../../../../resolvers/utils/topic-tooltip'; export interface TopicTimelineTopic { id?: string; diff --git a/webapp/src/app/modules/person-publications/person-publications.component.ts b/webapp/src/app/modules/person-publications/person-publications.component.ts index 8ab1923f..183f3caf 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.ts +++ b/webapp/src/app/modules/person-publications/person-publications.component.ts @@ -39,7 +39,7 @@ import { import { Work, WorksService } from '../../api'; import { PaginationService } from '../../shared/services/pagination.service'; -import { createLoadError } from '../../shared/utils/errorHandler'; +import { createLoadError } from '../../resolvers/utils/errorHandler'; import { ChipComponent } from '../../shared/ui/chip/chip.component'; interface InstitutionAutocompleteOption { diff --git a/webapp/src/app/resolvers/account.resolver.ts b/webapp/src/app/resolvers/account.resolver.ts new file mode 100644 index 00000000..9a2b7936 --- /dev/null +++ b/webapp/src/app/resolvers/account.resolver.ts @@ -0,0 +1,8 @@ +import { ResolveFn } from '@angular/router'; +import { AccountProfile } from '../api'; +import { inject } from '@angular/core'; +import { AccountManagementService } from '../shared/services/account-management.service'; + +export const accountResolver: ResolveFn = (route, state) => { + return inject(AccountManagementService).getCurrentAccount(); +}; diff --git a/webapp/src/app/shared/utils/errorHandler.ts b/webapp/src/app/resolvers/utils/errorHandler.ts similarity index 100% rename from webapp/src/app/shared/utils/errorHandler.ts rename to webapp/src/app/resolvers/utils/errorHandler.ts diff --git a/webapp/src/app/shared/utils/filters.ts b/webapp/src/app/resolvers/utils/filters.ts similarity index 100% rename from webapp/src/app/shared/utils/filters.ts rename to webapp/src/app/resolvers/utils/filters.ts diff --git a/webapp/src/app/shared/utils/paginatorIntl.ts b/webapp/src/app/resolvers/utils/paginatorIntl.ts similarity index 100% rename from webapp/src/app/shared/utils/paginatorIntl.ts rename to webapp/src/app/resolvers/utils/paginatorIntl.ts diff --git a/webapp/src/app/shared/utils/topic-colors.ts b/webapp/src/app/resolvers/utils/topic-colors.ts similarity index 100% rename from webapp/src/app/shared/utils/topic-colors.ts rename to webapp/src/app/resolvers/utils/topic-colors.ts diff --git a/webapp/src/app/shared/utils/topic-tooltip.ts b/webapp/src/app/resolvers/utils/topic-tooltip.ts similarity index 100% rename from webapp/src/app/shared/utils/topic-tooltip.ts rename to webapp/src/app/resolvers/utils/topic-tooltip.ts diff --git a/webapp/src/app/shared/pipes/role.pipe.ts b/webapp/src/app/shared/pipes/role.pipe.ts new file mode 100644 index 00000000..0a20871b --- /dev/null +++ b/webapp/src/app/shared/pipes/role.pipe.ts @@ -0,0 +1,22 @@ +import { Pipe, PipeTransform } from '@angular/core'; +import { UserRole } from '../../api'; + +@Pipe({ + name: 'role', +}) +export class RolePipe implements PipeTransform { + transform(value: UserRole, ...args: unknown[]): string { + switch (value) { + case UserRole.SuperAdmin: + return 'Super Admin'; + case UserRole.Admin: + return 'Admin'; + case UserRole.Manager: + return 'Manager'; + case UserRole.User: + return 'Benutzer'; + default: + return 'Unknown'; + } + } +} diff --git a/webapp/src/app/shared/services/account-management.service.ts b/webapp/src/app/shared/services/account-management.service.ts index bc64586f..2791c921 100644 --- a/webapp/src/app/shared/services/account-management.service.ts +++ b/webapp/src/app/shared/services/account-management.service.ts @@ -56,7 +56,9 @@ export class AccountManagementService { private readonly apiConfiguration = inject(Configuration, { optional: true }); getCurrentAccount(): Observable { - return this.httpClient.get(`${this.apiBasePath}/api/accounts/me`); + return this.httpClient.get( + `${this.apiBasePath}/api/accounts/me`, + ); } listAccounts(options: { @@ -77,9 +79,12 @@ export class AccountManagementService { params = params.set('organization_id', options.organizationId); } - return this.httpClient.get(`${this.apiBasePath}/api/accounts`, { - params, - }); + return this.httpClient.get( + `${this.apiBasePath}/api/accounts`, + { + params, + }, + ); } createAccount(payload: CreateAccountPayload): Observable { diff --git a/webapp/src/app/shared/ui/app-menu/app-menu.component.html b/webapp/src/app/shared/ui/app-menu/app-menu.component.html index d946b5aa..b80e7271 100644 --- a/webapp/src/app/shared/ui/app-menu/app-menu.component.html +++ b/webapp/src/app/shared/ui/app-menu/app-menu.component.html @@ -111,17 +111,20 @@ } @else { -