Merge remote-tracking branch 'origin/dev' into topic-colored-chips
This commit is contained in:
@@ -4,13 +4,13 @@ README.md
|
||||
api.base.service.ts
|
||||
api.module.ts
|
||||
api/api.ts
|
||||
api/auth.service.ts
|
||||
api/companyConnections.service.ts
|
||||
api/funding.service.ts
|
||||
api/iNSEAccountService.service.ts
|
||||
api/iNSEService.service.ts
|
||||
api/institutions.service.ts
|
||||
api/items.service.ts
|
||||
api/news.service.ts
|
||||
api/organization.service.ts
|
||||
api/patents.service.ts
|
||||
api/personNetwork.service.ts
|
||||
api/persons.service.ts
|
||||
@@ -21,10 +21,11 @@ configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/accessGrant.ts
|
||||
model/accessResponse.ts
|
||||
model/accessToken.ts
|
||||
model/accountPage.ts
|
||||
model/accountProfile.ts
|
||||
model/allPatentsResponse.ts
|
||||
model/authAccount.ts
|
||||
model/authScope.ts
|
||||
model/author.ts
|
||||
model/authorAffiliationsInner.ts
|
||||
model/authorCountsByYearInner.ts
|
||||
@@ -40,7 +41,10 @@ model/autocompleteResponse.ts
|
||||
model/autocompleteResponseMeta.ts
|
||||
model/autocompleteResponseResultsInner.ts
|
||||
model/award.ts
|
||||
model/bodyCreateUser.ts
|
||||
model/bodyChangePassword.ts
|
||||
model/bodyGetAccessToken.ts
|
||||
model/bodyLogin.ts
|
||||
model/bodyRequestOtk.ts
|
||||
model/bundProject.ts
|
||||
model/bundProjectDetails.ts
|
||||
model/bundProjectPage.ts
|
||||
@@ -53,6 +57,8 @@ model/companyConnectionsResponse.ts
|
||||
model/cordisEuProject.ts
|
||||
model/cordisEuProjectPage.ts
|
||||
model/costUsd.ts
|
||||
model/createAccountRequest.ts
|
||||
model/createOrganizationRequest.ts
|
||||
model/customAuthor.ts
|
||||
model/customAuthorsListResponse.ts
|
||||
model/dehydratedAuthor.ts
|
||||
@@ -103,7 +109,9 @@ model/hEUReportSummary.ts
|
||||
model/hEUTopic.ts
|
||||
model/hEUWebLink.ts
|
||||
model/hTTPValidationError.ts
|
||||
model/identityGrant.ts
|
||||
model/idToken.ts
|
||||
model/inseAccountManagementModelOrganizationProfile.ts
|
||||
model/inseOrganizationManagementModelOrganizationProfile.ts
|
||||
model/institution.ts
|
||||
model/institutionFunderSummary.ts
|
||||
model/institutionGeo.ts
|
||||
@@ -113,12 +121,10 @@ model/institutionNetworkNode.ts
|
||||
model/institutionPage.ts
|
||||
model/institutionsListResponse.ts
|
||||
model/ipcClassification.ts
|
||||
model/item.ts
|
||||
model/itemCreate.ts
|
||||
model/itemPage.ts
|
||||
model/keywords.ts
|
||||
model/latitude.ts
|
||||
model/location.ts
|
||||
model/loginResponse.ts
|
||||
model/longitude.ts
|
||||
model/matchedOfficer.ts
|
||||
model/mentionedPerson.ts
|
||||
@@ -129,6 +135,7 @@ model/newsArticle.ts
|
||||
model/newsArticleDetail.ts
|
||||
model/newsPage.ts
|
||||
model/openAccess.ts
|
||||
model/organizationPage.ts
|
||||
model/patentEntry.ts
|
||||
model/patentsByAuthorResponse.ts
|
||||
model/personBio.ts
|
||||
@@ -139,8 +146,10 @@ model/publicationDetailByFunder.ts
|
||||
model/publicationIdsByAuthorPosition.ts
|
||||
model/publicationsByAuthorResponse.ts
|
||||
model/rankingResponse.ts
|
||||
model/refreshToken.ts
|
||||
model/score.ts
|
||||
model/sortDirection.ts
|
||||
model/tokenType.ts
|
||||
model/topic.ts
|
||||
model/topicCount.ts
|
||||
model/topicDomain.ts
|
||||
@@ -153,7 +162,9 @@ model/topicsByYear.ts
|
||||
model/topicsListResponse.ts
|
||||
model/universityRanking.ts
|
||||
model/universityTopicData.ts
|
||||
model/user.ts
|
||||
model/updateAccountRequest.ts
|
||||
model/updateOrganizationRequest.ts
|
||||
model/userRole.ts
|
||||
model/validationError.ts
|
||||
model/validationErrorLocInner.ts
|
||||
model/value.ts
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
export * from './auth.service';
|
||||
import { AuthService } from './auth.service';
|
||||
export * from './companyConnections.service';
|
||||
import { CompanyConnectionsService } from './companyConnections.service';
|
||||
export * from './funding.service';
|
||||
import { FundingService } from './funding.service';
|
||||
export * from './iNSEAccountService.service';
|
||||
import { INSEAccountServiceService } from './iNSEAccountService.service';
|
||||
export * from './iNSEService.service';
|
||||
import { INSEServiceService } from './iNSEService.service';
|
||||
export * from './institutions.service';
|
||||
import { InstitutionsService } from './institutions.service';
|
||||
export * from './items.service';
|
||||
import { ItemsService } from './items.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';
|
||||
@@ -25,13 +25,13 @@ import { TopicsService } from './topics.service';
|
||||
export * from './works.service';
|
||||
import { WorksService } from './works.service';
|
||||
export const APIS = [
|
||||
AuthService,
|
||||
CompanyConnectionsService,
|
||||
FundingService,
|
||||
INSEAccountServiceService,
|
||||
INSEServiceService,
|
||||
InstitutionsService,
|
||||
ItemsService,
|
||||
NewsService,
|
||||
OrganizationService,
|
||||
PatentsService,
|
||||
PersonNetworkService,
|
||||
PersonsService,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,457 +0,0 @@
|
||||
/**
|
||||
* 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 { AccessGrant } from '../model/accessGrant';
|
||||
// @ts-ignore
|
||||
import { BodyCreateUser } from '../model/bodyCreateUser';
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||
// @ts-ignore
|
||||
import { IdentityGrant } from '../model/identityGrant';
|
||||
// @ts-ignore
|
||||
import { User } from '../model/user';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BaseService } from '../api.base.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class INSEAccountServiceService extends BaseService {
|
||||
constructor(
|
||||
protected httpClient: HttpClient,
|
||||
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
||||
@Optional() configuration?: Configuration,
|
||||
) {
|
||||
super(basePath, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create User
|
||||
* @endpoint post /inse-account/create
|
||||
* @param bodyCreateUser
|
||||
* @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 createUser(
|
||||
bodyCreateUser: BodyCreateUser,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<User>;
|
||||
public createUser(
|
||||
bodyCreateUser: BodyCreateUser,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<User>>;
|
||||
public createUser(
|
||||
bodyCreateUser: BodyCreateUser,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<User>>;
|
||||
public createUser(
|
||||
bodyCreateUser: BodyCreateUser,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (bodyCreateUser === null || bodyCreateUser === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter bodyCreateUser was null or undefined when calling createUser.',
|
||||
);
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
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 = `/inse-account/create`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<User>('post', `${basePath}${localVarPath}`, {
|
||||
context: localVarHttpContext,
|
||||
body: bodyCreateUser,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Access Grant
|
||||
* @endpoint post /inse-account/auth/access
|
||||
* @param secret
|
||||
* @param account
|
||||
* @param organization
|
||||
* @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 getAccessGrant(
|
||||
secret: string,
|
||||
account: number,
|
||||
organization: number,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<AccessGrant>;
|
||||
public getAccessGrant(
|
||||
secret: string,
|
||||
account: number,
|
||||
organization: number,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<AccessGrant>>;
|
||||
public getAccessGrant(
|
||||
secret: string,
|
||||
account: number,
|
||||
organization: number,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<AccessGrant>>;
|
||||
public getAccessGrant(
|
||||
secret: string,
|
||||
account: number,
|
||||
organization: number,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (secret === null || secret === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter secret was null or undefined when calling getAccessGrant.',
|
||||
);
|
||||
}
|
||||
if (account === null || account === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter account was null or undefined when calling getAccessGrant.',
|
||||
);
|
||||
}
|
||||
if (organization === null || organization === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter organization was null or undefined when calling getAccessGrant.',
|
||||
);
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
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/x-www-form-urlencoded'];
|
||||
|
||||
const canConsumeForm = this.canConsumeForm(consumes);
|
||||
|
||||
let localVarFormParams: { append(param: string, value: any): any };
|
||||
let localVarUseForm = false;
|
||||
let localVarConvertFormParamsToString = false;
|
||||
if (localVarUseForm) {
|
||||
localVarFormParams = new FormData();
|
||||
} else {
|
||||
localVarFormParams = new HttpParams({ encoder: this.encoder });
|
||||
}
|
||||
|
||||
if (secret !== undefined) {
|
||||
localVarFormParams =
|
||||
(localVarFormParams.append('secret', <any>secret) as any) ||
|
||||
localVarFormParams;
|
||||
}
|
||||
if (account !== undefined) {
|
||||
localVarFormParams =
|
||||
(localVarFormParams.append('account', <any>account) as any) ||
|
||||
localVarFormParams;
|
||||
}
|
||||
if (organization !== undefined) {
|
||||
localVarFormParams =
|
||||
(localVarFormParams.append('organization', <any>organization) as any) ||
|
||||
localVarFormParams;
|
||||
}
|
||||
|
||||
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 = `/inse-account/auth/access`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<AccessGrant>(
|
||||
'post',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: localVarConvertFormParamsToString
|
||||
? localVarFormParams.toString()
|
||||
: localVarFormParams,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Identity Grant
|
||||
* @endpoint post /inse-account/auth/id
|
||||
* @param username
|
||||
* @param password
|
||||
* @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 getIdentityGrant(
|
||||
username: string,
|
||||
password: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<IdentityGrant>;
|
||||
public getIdentityGrant(
|
||||
username: string,
|
||||
password: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<IdentityGrant>>;
|
||||
public getIdentityGrant(
|
||||
username: string,
|
||||
password: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<IdentityGrant>>;
|
||||
public getIdentityGrant(
|
||||
username: string,
|
||||
password: string,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (username === null || username === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter username was null or undefined when calling getIdentityGrant.',
|
||||
);
|
||||
}
|
||||
if (password === null || password === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter password was null or undefined when calling getIdentityGrant.',
|
||||
);
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
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/x-www-form-urlencoded'];
|
||||
|
||||
const canConsumeForm = this.canConsumeForm(consumes);
|
||||
|
||||
let localVarFormParams: { append(param: string, value: any): any };
|
||||
let localVarUseForm = false;
|
||||
let localVarConvertFormParamsToString = false;
|
||||
if (localVarUseForm) {
|
||||
localVarFormParams = new FormData();
|
||||
} else {
|
||||
localVarFormParams = new HttpParams({ encoder: this.encoder });
|
||||
}
|
||||
|
||||
if (username !== undefined) {
|
||||
localVarFormParams =
|
||||
(localVarFormParams.append('username', <any>username) as any) ||
|
||||
localVarFormParams;
|
||||
}
|
||||
if (password !== undefined) {
|
||||
localVarFormParams =
|
||||
(localVarFormParams.append('password', <any>password) as any) ||
|
||||
localVarFormParams;
|
||||
}
|
||||
|
||||
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 = `/inse-account/auth/id`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<IdentityGrant>(
|
||||
'post',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: localVarConvertFormParamsToString
|
||||
? localVarFormParams.toString()
|
||||
: localVarFormParams,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -24,12 +24,6 @@ import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||
// @ts-ignore
|
||||
import { Item } from '../model/item';
|
||||
// @ts-ignore
|
||||
import { ItemCreate } from '../model/itemCreate';
|
||||
// @ts-ignore
|
||||
import { ItemPage } from '../model/itemPage';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
@@ -48,124 +42,6 @@ export class INSEServiceService extends BaseService {
|
||||
super(basePath, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new item.
|
||||
* @endpoint post /api/inse-service/items
|
||||
* @param itemCreate
|
||||
* @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 addItem(
|
||||
itemCreate: ItemCreate,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<Item>;
|
||||
public addItem(
|
||||
itemCreate: ItemCreate,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<Item>>;
|
||||
public addItem(
|
||||
itemCreate: ItemCreate,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<Item>>;
|
||||
public addItem(
|
||||
itemCreate: ItemCreate,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (itemCreate === null || itemCreate === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter itemCreate was null or undefined when calling addItem.',
|
||||
);
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'bearer',
|
||||
'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/inse-service/items`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Item>('post', `${basePath}${localVarPath}`, {
|
||||
context: localVarHttpContext,
|
||||
body: itemCreate,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the topic hierarchy cache.
|
||||
* @endpoint get /api/inse-service/topics/cache
|
||||
@@ -394,344 +270,6 @@ export class INSEServiceService extends BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the item with the id.
|
||||
* @endpoint delete /api/inse-service/items/{id}
|
||||
* @param id The item id.
|
||||
* @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 deleteItem(
|
||||
id: number,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any>;
|
||||
public deleteItem(
|
||||
id: number,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<any>>;
|
||||
public deleteItem(
|
||||
id: number,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<any>>;
|
||||
public deleteItem(
|
||||
id: number,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (id === null || id === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter id was null or undefined when calling deleteItem.',
|
||||
);
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'bearer',
|
||||
'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/inse-service/items/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'number', dataFormat: undefined })}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<any>(
|
||||
'delete',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the item with the id.
|
||||
* @endpoint get /api/inse-service/items/{id}
|
||||
* @param id The item id.
|
||||
* @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 getItem(
|
||||
id: number,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<Item>;
|
||||
public getItem(
|
||||
id: number,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<Item>>;
|
||||
public getItem(
|
||||
id: number,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<Item>>;
|
||||
public getItem(
|
||||
id: number,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (id === null || id === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter id was null or undefined when calling getItem.',
|
||||
);
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'bearer',
|
||||
'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/inse-service/items/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'number', dataFormat: undefined })}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Item>('get', `${basePath}${localVarPath}`, {
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a page of items.
|
||||
* @endpoint get /api/inse-service/items
|
||||
* @param pageOffset The page offset.
|
||||
* @param pageSize The page size.
|
||||
* @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 getItems(
|
||||
pageOffset?: number,
|
||||
pageSize?: number,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<ItemPage>;
|
||||
public getItems(
|
||||
pageOffset?: number,
|
||||
pageSize?: number,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<ItemPage>>;
|
||||
public getItems(
|
||||
pageOffset?: number,
|
||||
pageSize?: number,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<ItemPage>>;
|
||||
public getItems(
|
||||
pageOffset?: number,
|
||||
pageSize?: number,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>pageOffset,
|
||||
'pageOffset',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>pageSize,
|
||||
'pageSize',
|
||||
);
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'bearer',
|
||||
'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/inse-service/items`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<ItemPage>(
|
||||
'get',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics).
|
||||
* @endpoint get /api/inse-service/topics/hierarchy
|
||||
@@ -822,132 +360,4 @@ export class INSEServiceService extends BaseService {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the item with the id.
|
||||
* @endpoint put /api/inse-service/items/{id}
|
||||
* @param id The item id.
|
||||
* @param itemCreate
|
||||
* @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 updateItem(
|
||||
id: number,
|
||||
itemCreate: ItemCreate,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<Item>;
|
||||
public updateItem(
|
||||
id: number,
|
||||
itemCreate: ItemCreate,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<Item>>;
|
||||
public updateItem(
|
||||
id: number,
|
||||
itemCreate: ItemCreate,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<Item>>;
|
||||
public updateItem(
|
||||
id: number,
|
||||
itemCreate: ItemCreate,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (id === null || id === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter id was null or undefined when calling updateItem.',
|
||||
);
|
||||
}
|
||||
if (itemCreate === null || itemCreate === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter itemCreate was null or undefined when calling updateItem.',
|
||||
);
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'bearer',
|
||||
'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/inse-service/items/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'number', dataFormat: undefined })}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Item>('put', `${basePath}${localVarPath}`, {
|
||||
context: localVarHttpContext,
|
||||
body: itemCreate,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -556,6 +556,9 @@ export class NewsService extends BaseService {
|
||||
* @param page Page number (1-based).
|
||||
* @param pageSize Articles per page.
|
||||
* @param sortOrder Sort order: \'desc\' (newest first) or \'asc\' (oldest first).
|
||||
* @param relevance Comma-separated relevance filter: \'relevant\', \'not_relevant\'.
|
||||
* @param yearFrom Earliest publication year (inclusive).
|
||||
* @param yearTo Latest publication year (inclusive).
|
||||
* @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.
|
||||
*/
|
||||
@@ -563,6 +566,9 @@ export class NewsService extends BaseService {
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
sortOrder?: string,
|
||||
relevance?: string,
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -575,6 +581,9 @@ export class NewsService extends BaseService {
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
sortOrder?: string,
|
||||
relevance?: string,
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -587,6 +596,9 @@ export class NewsService extends BaseService {
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
sortOrder?: string,
|
||||
relevance?: string,
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -599,6 +611,9 @@ export class NewsService extends BaseService {
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
sortOrder?: string,
|
||||
relevance?: string,
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
@@ -623,6 +638,21 @@ export class NewsService extends BaseService {
|
||||
<any>sortOrder,
|
||||
'sortOrder',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>relevance,
|
||||
'relevance',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>yearFrom,
|
||||
'yearFrom',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>yearTo,
|
||||
'yearTo',
|
||||
);
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
@@ -680,6 +710,9 @@ export class NewsService extends BaseService {
|
||||
* @param page Page number (1-based).
|
||||
* @param pageSize Articles per page.
|
||||
* @param sortOrder Sort order: \'desc\' (newest first) or \'asc\' (oldest first).
|
||||
* @param relevance Comma-separated relevance filter: \'relevant\', \'not_relevant\'.
|
||||
* @param yearFrom Earliest publication year (inclusive).
|
||||
* @param yearTo Latest publication year (inclusive).
|
||||
* @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.
|
||||
*/
|
||||
@@ -687,6 +720,9 @@ export class NewsService extends BaseService {
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
sortOrder?: string,
|
||||
relevance?: string,
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -699,6 +735,9 @@ export class NewsService extends BaseService {
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
sortOrder?: string,
|
||||
relevance?: string,
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -711,6 +750,9 @@ export class NewsService extends BaseService {
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
sortOrder?: string,
|
||||
relevance?: string,
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -723,6 +765,9 @@ export class NewsService extends BaseService {
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
sortOrder?: string,
|
||||
relevance?: string,
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
@@ -747,6 +792,21 @@ export class NewsService extends BaseService {
|
||||
<any>sortOrder,
|
||||
'sortOrder',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>relevance,
|
||||
'relevance',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>yearFrom,
|
||||
'yearFrom',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>yearTo,
|
||||
'yearTo',
|
||||
);
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
@@ -804,6 +864,9 @@ export class NewsService extends BaseService {
|
||||
* @param query Search term, matched against the full text (full_content).
|
||||
* @param page Page number (1-based).
|
||||
* @param pageSize Articles per page.
|
||||
* @param relevance Comma-separated relevance filter: \'relevant\', \'not_relevant\'.
|
||||
* @param yearFrom Earliest publication year (inclusive).
|
||||
* @param yearTo Latest publication year (inclusive).
|
||||
* @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.
|
||||
*/
|
||||
@@ -811,6 +874,9 @@ export class NewsService extends BaseService {
|
||||
query: string,
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
relevance?: string,
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -823,6 +889,9 @@ export class NewsService extends BaseService {
|
||||
query: string,
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
relevance?: string,
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -835,6 +904,9 @@ export class NewsService extends BaseService {
|
||||
query: string,
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
relevance?: string,
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -847,6 +919,9 @@ export class NewsService extends BaseService {
|
||||
query: string,
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
relevance?: string,
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
@@ -877,6 +952,21 @@ export class NewsService extends BaseService {
|
||||
<any>pageSize,
|
||||
'pageSize',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>relevance,
|
||||
'relevance',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>yearFrom,
|
||||
'yearFrom',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>yearTo,
|
||||
'yearTo',
|
||||
);
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
@@ -934,6 +1024,9 @@ export class NewsService extends BaseService {
|
||||
* @param query Search term, matched against the full text (full_content).
|
||||
* @param page Page number (1-based).
|
||||
* @param pageSize Articles per page.
|
||||
* @param relevance Comma-separated relevance filter: \'relevant\', \'not_relevant\'.
|
||||
* @param yearFrom Earliest publication year (inclusive).
|
||||
* @param yearTo Latest publication year (inclusive).
|
||||
* @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.
|
||||
*/
|
||||
@@ -941,6 +1034,9 @@ export class NewsService extends BaseService {
|
||||
query: string,
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
relevance?: string,
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -953,6 +1049,9 @@ export class NewsService extends BaseService {
|
||||
query: string,
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
relevance?: string,
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -965,6 +1064,9 @@ export class NewsService extends BaseService {
|
||||
query: string,
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
relevance?: string,
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -977,6 +1079,9 @@ export class NewsService extends BaseService {
|
||||
query: string,
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
relevance?: string,
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
@@ -1007,6 +1112,21 @@ export class NewsService extends BaseService {
|
||||
<any>pageSize,
|
||||
'pageSize',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>relevance,
|
||||
'relevance',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>yearFrom,
|
||||
'yearFrom',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>yearTo,
|
||||
'yearTo',
|
||||
);
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
|
||||
+144
-220
@@ -22,14 +22,16 @@ import {
|
||||
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 { Item } from '../model/item';
|
||||
import { InseOrganizationManagementModelOrganizationProfile } from '../model/inseOrganizationManagementModelOrganizationProfile';
|
||||
// @ts-ignore
|
||||
import { ItemCreate } from '../model/itemCreate';
|
||||
import { OrganizationPage } from '../model/organizationPage';
|
||||
// @ts-ignore
|
||||
import { ItemPage } from '../model/itemPage';
|
||||
import { UpdateOrganizationRequest } from '../model/updateOrganizationRequest';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
@@ -39,7 +41,7 @@ import { BaseService } from '../api.base.service';
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ItemsService extends BaseService {
|
||||
export class OrganizationService extends BaseService {
|
||||
constructor(
|
||||
protected httpClient: HttpClient,
|
||||
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
||||
@@ -49,14 +51,14 @@ export class ItemsService extends BaseService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new item.
|
||||
* @endpoint post /api/inse-service/items
|
||||
* @param itemCreate
|
||||
* 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 addItem(
|
||||
itemCreate: ItemCreate,
|
||||
public createOrganisation(
|
||||
createOrganizationRequest: CreateOrganizationRequest,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -64,9 +66,9 @@ export class ItemsService extends BaseService {
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<Item>;
|
||||
public addItem(
|
||||
itemCreate: ItemCreate,
|
||||
): Observable<InseOrganizationManagementModelOrganizationProfile>;
|
||||
public createOrganisation(
|
||||
createOrganizationRequest: CreateOrganizationRequest,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -74,9 +76,11 @@ export class ItemsService extends BaseService {
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<Item>>;
|
||||
public addItem(
|
||||
itemCreate: ItemCreate,
|
||||
): Observable<
|
||||
HttpResponse<InseOrganizationManagementModelOrganizationProfile>
|
||||
>;
|
||||
public createOrganisation(
|
||||
createOrganizationRequest: CreateOrganizationRequest,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -84,9 +88,9 @@ export class ItemsService extends BaseService {
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<Item>>;
|
||||
public addItem(
|
||||
itemCreate: ItemCreate,
|
||||
): Observable<HttpEvent<InseOrganizationManagementModelOrganizationProfile>>;
|
||||
public createOrganisation(
|
||||
createOrganizationRequest: CreateOrganizationRequest,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
@@ -95,17 +99,20 @@ export class ItemsService extends BaseService {
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (itemCreate === null || itemCreate === undefined) {
|
||||
if (
|
||||
createOrganizationRequest === null ||
|
||||
createOrganizationRequest === undefined
|
||||
) {
|
||||
throw new Error(
|
||||
'Required parameter itemCreate was null or undefined when calling addItem.',
|
||||
'Required parameter createOrganizationRequest was null or undefined when calling createOrganisation.',
|
||||
);
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'bearer',
|
||||
'HTTPBearer',
|
||||
'Authorization',
|
||||
localVarHeaders,
|
||||
'Bearer ',
|
||||
@@ -150,31 +157,35 @@ export class ItemsService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/inse-service/items`;
|
||||
let localVarPath = `/api/organizations`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Item>('post', `${basePath}${localVarPath}`, {
|
||||
context: localVarHttpContext,
|
||||
body: itemCreate,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
});
|
||||
return this.httpClient.request<InseOrganizationManagementModelOrganizationProfile>(
|
||||
'post',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: createOrganizationRequest,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the item with the id.
|
||||
* @endpoint delete /api/inse-service/items/{id}
|
||||
* @param id The item id.
|
||||
* 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 deleteItem(
|
||||
id: number,
|
||||
public deleteOrganisation(
|
||||
organizationId: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -183,8 +194,8 @@ export class ItemsService extends BaseService {
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any>;
|
||||
public deleteItem(
|
||||
id: number,
|
||||
public deleteOrganisation(
|
||||
organizationId: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -193,8 +204,8 @@ export class ItemsService extends BaseService {
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<any>>;
|
||||
public deleteItem(
|
||||
id: number,
|
||||
public deleteOrganisation(
|
||||
organizationId: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -203,8 +214,8 @@ export class ItemsService extends BaseService {
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<any>>;
|
||||
public deleteItem(
|
||||
id: number,
|
||||
public deleteOrganisation(
|
||||
organizationId: string,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
@@ -213,17 +224,17 @@ export class ItemsService extends BaseService {
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (id === null || id === undefined) {
|
||||
if (organizationId === null || organizationId === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter id was null or undefined when calling deleteItem.',
|
||||
'Required parameter organizationId was null or undefined when calling deleteOrganisation.',
|
||||
);
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'bearer',
|
||||
'HTTPBearer',
|
||||
'Authorization',
|
||||
localVarHeaders,
|
||||
'Bearer ',
|
||||
@@ -257,7 +268,7 @@ export class ItemsService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/inse-service/items/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'number', dataFormat: undefined })}`;
|
||||
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<any>(
|
||||
'delete',
|
||||
@@ -277,14 +288,18 @@ export class ItemsService extends BaseService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the item with the id.
|
||||
* @endpoint get /api/inse-service/items/{id}
|
||||
* @param id The item id.
|
||||
* 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 getItem(
|
||||
id: number,
|
||||
public getOrganisations(
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
offset?: number,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -292,9 +307,11 @@ export class ItemsService extends BaseService {
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<Item>;
|
||||
public getItem(
|
||||
id: number,
|
||||
): Observable<OrganizationPage>;
|
||||
public getOrganisations(
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
offset?: number,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -302,9 +319,11 @@ export class ItemsService extends BaseService {
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<Item>>;
|
||||
public getItem(
|
||||
id: number,
|
||||
): Observable<HttpResponse<OrganizationPage>>;
|
||||
public getOrganisations(
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
offset?: number,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -312,120 +331,11 @@ export class ItemsService extends BaseService {
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<Item>>;
|
||||
public getItem(
|
||||
id: number,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (id === null || id === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter id was null or undefined when calling getItem.',
|
||||
);
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'bearer',
|
||||
'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/inse-service/items/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'number', dataFormat: undefined })}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Item>('get', `${basePath}${localVarPath}`, {
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a page of items.
|
||||
* @endpoint get /api/inse-service/items
|
||||
* @param pageOffset The page offset.
|
||||
* @param pageSize The page size.
|
||||
* @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 getItems(
|
||||
pageOffset?: number,
|
||||
pageSize?: number,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<ItemPage>;
|
||||
public getItems(
|
||||
pageOffset?: number,
|
||||
pageSize?: number,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<ItemPage>>;
|
||||
public getItems(
|
||||
pageOffset?: number,
|
||||
pageSize?: number,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<ItemPage>>;
|
||||
public getItems(
|
||||
pageOffset?: number,
|
||||
): Observable<HttpEvent<OrganizationPage>>;
|
||||
public getOrganisations(
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
offset?: number,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
@@ -437,20 +347,25 @@ export class ItemsService extends BaseService {
|
||||
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>pageOffset,
|
||||
'pageOffset',
|
||||
<any>page,
|
||||
'page',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>pageSize,
|
||||
'pageSize',
|
||||
'page_size',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>offset,
|
||||
'offset',
|
||||
);
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'bearer',
|
||||
'HTTPBearer',
|
||||
'Authorization',
|
||||
localVarHeaders,
|
||||
'Bearer ',
|
||||
@@ -484,9 +399,9 @@ export class ItemsService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/inse-service/items`;
|
||||
let localVarPath = `/api/organizations`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<ItemPage>(
|
||||
return this.httpClient.request<OrganizationPage>(
|
||||
'get',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
@@ -505,16 +420,16 @@ export class ItemsService extends BaseService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the item with the id.
|
||||
* @endpoint put /api/inse-service/items/{id}
|
||||
* @param id The item id.
|
||||
* @param itemCreate
|
||||
* 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 updateItem(
|
||||
id: number,
|
||||
itemCreate: ItemCreate,
|
||||
public updateOrganisation(
|
||||
organizationId: string,
|
||||
updateOrganizationRequest: UpdateOrganizationRequest,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -522,10 +437,10 @@ export class ItemsService extends BaseService {
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<Item>;
|
||||
public updateItem(
|
||||
id: number,
|
||||
itemCreate: ItemCreate,
|
||||
): Observable<InseOrganizationManagementModelOrganizationProfile>;
|
||||
public updateOrganisation(
|
||||
organizationId: string,
|
||||
updateOrganizationRequest: UpdateOrganizationRequest,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -533,10 +448,12 @@ export class ItemsService extends BaseService {
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<Item>>;
|
||||
public updateItem(
|
||||
id: number,
|
||||
itemCreate: ItemCreate,
|
||||
): Observable<
|
||||
HttpResponse<InseOrganizationManagementModelOrganizationProfile>
|
||||
>;
|
||||
public updateOrganisation(
|
||||
organizationId: string,
|
||||
updateOrganizationRequest: UpdateOrganizationRequest,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -544,10 +461,10 @@ export class ItemsService extends BaseService {
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<Item>>;
|
||||
public updateItem(
|
||||
id: number,
|
||||
itemCreate: ItemCreate,
|
||||
): Observable<HttpEvent<InseOrganizationManagementModelOrganizationProfile>>;
|
||||
public updateOrganisation(
|
||||
organizationId: string,
|
||||
updateOrganizationRequest: UpdateOrganizationRequest,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
@@ -556,22 +473,25 @@ export class ItemsService extends BaseService {
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (id === null || id === undefined) {
|
||||
if (organizationId === null || organizationId === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter id was null or undefined when calling updateItem.',
|
||||
'Required parameter organizationId was null or undefined when calling updateOrganisation.',
|
||||
);
|
||||
}
|
||||
if (itemCreate === null || itemCreate === undefined) {
|
||||
if (
|
||||
updateOrganizationRequest === null ||
|
||||
updateOrganizationRequest === undefined
|
||||
) {
|
||||
throw new Error(
|
||||
'Required parameter itemCreate was null or undefined when calling updateItem.',
|
||||
'Required parameter updateOrganizationRequest was null or undefined when calling updateOrganisation.',
|
||||
);
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'bearer',
|
||||
'HTTPBearer',
|
||||
'Authorization',
|
||||
localVarHeaders,
|
||||
'Bearer ',
|
||||
@@ -616,19 +536,23 @@ export class ItemsService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/inse-service/items/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'number', dataFormat: undefined })}`;
|
||||
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<Item>('put', `${basePath}${localVarPath}`, {
|
||||
context: localVarHttpContext,
|
||||
body: itemCreate,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
});
|
||||
return this.httpClient.request<InseOrganizationManagementModelOrganizationProfile>(
|
||||
'put',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: updateOrganizationRequest,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -704,6 +704,7 @@ export class TopicsService extends BaseService {
|
||||
* @endpoint get /api/topics/vector-search
|
||||
* @param query Word or sentence to search by similarity.
|
||||
* @param limit Maximum number of topics to return.
|
||||
* @param searchType Search approach: \'hybrid\' or \'semantic\'.
|
||||
* @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.
|
||||
*/
|
||||
@@ -772,13 +773,11 @@ export class TopicsService extends BaseService {
|
||||
<any>limit,
|
||||
'limit',
|
||||
);
|
||||
if (searchType !== undefined && searchType !== null) {
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>searchType,
|
||||
'searchType',
|
||||
);
|
||||
}
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>searchType,
|
||||
'searchType',
|
||||
);
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
|
||||
@@ -107,14 +107,6 @@ export class WorksService extends BaseService {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'bearer',
|
||||
'Authorization',
|
||||
localVarHeaders,
|
||||
'Bearer ',
|
||||
);
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||
options?.httpHeaderAccept ??
|
||||
this.configuration.selectHeaderAccept(['application/json']);
|
||||
@@ -309,14 +301,6 @@ export class WorksService extends BaseService {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'bearer',
|
||||
'Authorization',
|
||||
localVarHeaders,
|
||||
'Bearer ',
|
||||
);
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||
options?.httpHeaderAccept ??
|
||||
this.configuration.selectHeaderAccept(['application/json']);
|
||||
@@ -420,14 +404,6 @@ export class WorksService extends BaseService {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'bearer',
|
||||
'Authorization',
|
||||
localVarHeaders,
|
||||
'Bearer ',
|
||||
);
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||
options?.httpHeaderAccept ??
|
||||
this.configuration.selectHeaderAccept(['application/json']);
|
||||
@@ -562,14 +538,6 @@ export class WorksService extends BaseService {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'bearer',
|
||||
'Authorization',
|
||||
localVarHeaders,
|
||||
'Bearer ',
|
||||
);
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||
options?.httpHeaderAccept ??
|
||||
this.configuration.selectHeaderAccept(['application/json']);
|
||||
@@ -685,14 +653,6 @@ export class WorksService extends BaseService {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'bearer',
|
||||
'Authorization',
|
||||
localVarHeaders,
|
||||
'Bearer ',
|
||||
);
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||
options?.httpHeaderAccept ??
|
||||
this.configuration.selectHeaderAccept(['application/json']);
|
||||
|
||||
@@ -106,9 +106,9 @@ export class Configuration {
|
||||
encodeParam ?? ((param) => this.defaultEncodeParam(param));
|
||||
this.credentials = credentials ?? {};
|
||||
|
||||
// init default bearer credential
|
||||
if (!this.credentials['bearer']) {
|
||||
this.credentials['bearer'] = () => {
|
||||
// init default HTTPBearer credential
|
||||
if (!this.credentials['HTTPBearer']) {
|
||||
this.credentials['HTTPBearer'] = () => {
|
||||
return typeof this.accessToken === 'function'
|
||||
? this.accessToken()
|
||||
: this.accessToken;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 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 { RefreshToken } from './refreshToken';
|
||||
import { AccessToken } from './accessToken';
|
||||
|
||||
export interface AccessResponse {
|
||||
/**
|
||||
* The access token issued upon successful authentication.
|
||||
*/
|
||||
access_token: AccessToken;
|
||||
/**
|
||||
* The refresh token issued alongside the access token for obtaining new access tokens.
|
||||
*/
|
||||
refresh_token: RefreshToken;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* 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 { TokenType } from './tokenType';
|
||||
import { UserRole } from './userRole';
|
||||
|
||||
export interface AccessToken {
|
||||
/**
|
||||
* The type of the token, which is always ACCESS_TOKEN for this class.
|
||||
*/
|
||||
token_type?: TokenType;
|
||||
/**
|
||||
* The unique identifier of the real account associated with this token.
|
||||
*/
|
||||
real_account_id: string;
|
||||
/**
|
||||
* The timestamp indicating when the token will expire.
|
||||
*/
|
||||
expires_at: string;
|
||||
/**
|
||||
* The epoch value for the token. Used for versioning of tokens.
|
||||
*/
|
||||
epoch?: number;
|
||||
/**
|
||||
* A hash of the user\'s fingerprint to ensure the token is used by the same user.
|
||||
*/
|
||||
user_fingerprint_hash: string;
|
||||
/**
|
||||
* The raw token string.
|
||||
*/
|
||||
raw_token: string;
|
||||
/**
|
||||
* The unique identifier of the effective account associated with this access token. This may differ from the real account ID due to account impersonation.
|
||||
*/
|
||||
effective_account_id: string;
|
||||
/**
|
||||
* The specific role this access token grants within its organization.
|
||||
*/
|
||||
effective_role?: UserRole;
|
||||
/**
|
||||
* The unique identifier of the organization associated with this access token.
|
||||
*/
|
||||
effective_organization_id: string;
|
||||
}
|
||||
export namespace AccessToken {}
|
||||
@@ -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.
|
||||
*/
|
||||
import { AccountProfile } from './accountProfile';
|
||||
|
||||
export interface AccountPage {
|
||||
items: Array<AccountProfile>;
|
||||
total: number;
|
||||
page: number;
|
||||
page_size: number;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 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 { UserRole } from './userRole';
|
||||
|
||||
export interface AccountProfile {
|
||||
id: string;
|
||||
email: string;
|
||||
name: string;
|
||||
role: UserRole;
|
||||
organization_id: string;
|
||||
organization_name: string;
|
||||
deleted: boolean;
|
||||
is_current?: boolean;
|
||||
is_real_account?: boolean;
|
||||
is_impersonating?: boolean;
|
||||
}
|
||||
export namespace AccountProfile {}
|
||||
+5
-5
@@ -8,13 +8,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
export interface ItemCreate {
|
||||
export interface BodyChangePassword {
|
||||
/**
|
||||
* The name of the item.
|
||||
* Current password
|
||||
*/
|
||||
name: string;
|
||||
current_password: string;
|
||||
/**
|
||||
* The description of the item.
|
||||
* New password
|
||||
*/
|
||||
description: string;
|
||||
new_password: string;
|
||||
}
|
||||
@@ -8,17 +8,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
export interface Item {
|
||||
export interface BodyGetAccessToken {
|
||||
/**
|
||||
* The id of the entity.
|
||||
* User\'s account ID
|
||||
*/
|
||||
id: number;
|
||||
real_account_id: string;
|
||||
/**
|
||||
* The name of the item.
|
||||
* Effective account ID for the access token
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The description of the item.
|
||||
*/
|
||||
description: string;
|
||||
effective_account_id: string;
|
||||
}
|
||||
@@ -7,11 +7,14 @@
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { AuthScope } from './authScope';
|
||||
|
||||
export interface IdentityGrant {
|
||||
token_type: string;
|
||||
access_token: string;
|
||||
expires_in: number;
|
||||
scope: AuthScope;
|
||||
export interface BodyLogin {
|
||||
/**
|
||||
* User\'s account ID
|
||||
*/
|
||||
account_id: string;
|
||||
/**
|
||||
* One-time code sent to user\'s email
|
||||
*/
|
||||
email_code: string;
|
||||
}
|
||||
+8
-5
@@ -8,10 +8,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
export interface BodyCreateUser {
|
||||
username: string;
|
||||
password: string;
|
||||
export interface BodyRequestOtk {
|
||||
/**
|
||||
* User\'s email address
|
||||
*/
|
||||
email: string;
|
||||
institution: string;
|
||||
superadmin?: boolean;
|
||||
/**
|
||||
* User\'s password
|
||||
*/
|
||||
password: string;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* 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 { UserRole } from './userRole';
|
||||
|
||||
export interface CreateAccountRequest {
|
||||
email: string;
|
||||
name: string;
|
||||
role?: UserRole;
|
||||
organization_id: string;
|
||||
password: string;
|
||||
openalex_person_id?: string | null;
|
||||
}
|
||||
export namespace CreateAccountRequest {}
|
||||
+4
-1
@@ -8,4 +8,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
export interface Neteccontribution {}
|
||||
export interface CreateOrganizationRequest {
|
||||
name: string;
|
||||
other_inst_id?: string | null;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* 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 { TokenType } from './tokenType';
|
||||
|
||||
export interface IdToken {
|
||||
/**
|
||||
* The type of the token, which is always ID_TOKEN for this class.
|
||||
*/
|
||||
token_type?: TokenType;
|
||||
/**
|
||||
* The unique identifier of the real account associated with this token.
|
||||
*/
|
||||
real_account_id: string;
|
||||
/**
|
||||
* The timestamp indicating when the token will expire.
|
||||
*/
|
||||
expires_at: string;
|
||||
/**
|
||||
* The epoch value for the token. Used for versioning of tokens.
|
||||
*/
|
||||
epoch?: number;
|
||||
/**
|
||||
* A hash of the user\'s fingerprint to ensure the token is used by the same user.
|
||||
*/
|
||||
user_fingerprint_hash: string;
|
||||
/**
|
||||
* The raw token string.
|
||||
*/
|
||||
raw_token: string;
|
||||
}
|
||||
export namespace IdToken {}
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* 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 InseAccountManagementModelOrganizationProfile {
|
||||
id: string;
|
||||
name: string;
|
||||
openalex_institution_id?: string | null;
|
||||
}
|
||||
@@ -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 InseOrganizationManagementModelOrganizationProfile {
|
||||
id: string;
|
||||
name: string;
|
||||
other_inst_id?: string | null;
|
||||
deleted: boolean;
|
||||
member_count: number;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* 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 { Item } from './item';
|
||||
|
||||
export interface ItemPage {
|
||||
/**
|
||||
* The elements of the page.
|
||||
*/
|
||||
elements?: Array<Item>;
|
||||
/**
|
||||
* The page offset in elements.
|
||||
*/
|
||||
offset?: number;
|
||||
/**
|
||||
* The total number of elements.
|
||||
*/
|
||||
total?: number;
|
||||
/**
|
||||
* The page size in elements.
|
||||
*/
|
||||
size?: number;
|
||||
}
|
||||
@@ -7,11 +7,11 @@
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { AuthAccount } from './authAccount';
|
||||
import { IdToken } from './idToken';
|
||||
|
||||
export interface AuthScope {
|
||||
t: string;
|
||||
a: AuthAccount;
|
||||
d?: number | null;
|
||||
r?: Array<string>;
|
||||
export interface LoginResponse {
|
||||
/**
|
||||
* The ID token issued upon successful login.
|
||||
*/
|
||||
id_token: IdToken;
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
export * from './accessGrant';
|
||||
export * from './authAccount';
|
||||
export * from './authScope';
|
||||
export * from './accessResponse';
|
||||
export * from './accessToken';
|
||||
export * from './accountPage';
|
||||
export * from './accountProfile';
|
||||
export * from './allPatentsResponse';
|
||||
export * from './author';
|
||||
export * from './authorAffiliationsInner';
|
||||
export * from './authorCountsByYearInner';
|
||||
@@ -16,7 +18,10 @@ export * from './autocompleteResponse';
|
||||
export * from './autocompleteResponseMeta';
|
||||
export * from './autocompleteResponseResultsInner';
|
||||
export * from './award';
|
||||
export * from './bodyCreateUser';
|
||||
export * from './bodyChangePassword';
|
||||
export * from './bodyGetAccessToken';
|
||||
export * from './bodyLogin';
|
||||
export * from './bodyRequestOtk';
|
||||
export * from './bundProject';
|
||||
export * from './bundProjectDetails';
|
||||
export * from './bundProjectPage';
|
||||
@@ -29,6 +34,8 @@ export * from './companyConnectionsResponse';
|
||||
export * from './cordisEuProject';
|
||||
export * from './cordisEuProjectPage';
|
||||
export * from './costUsd';
|
||||
export * from './createAccountRequest';
|
||||
export * from './createOrganizationRequest';
|
||||
export * from './customAuthor';
|
||||
export * from './customAuthorsListResponse';
|
||||
export * from './dehydratedAuthor';
|
||||
@@ -41,6 +48,7 @@ export * from './dfgProjectSummary';
|
||||
export * from './euCordisProjectResponse';
|
||||
export * from './euOrganizationProjectSummary';
|
||||
export * from './euOrganizationProjectSummaryPage';
|
||||
export * from './euProjectData';
|
||||
export * from './filterInformation';
|
||||
export * from './filterProperties';
|
||||
export * from './fp7EurosciVoc';
|
||||
@@ -78,7 +86,9 @@ export * from './hEUReportSummary';
|
||||
export * from './hEUTopic';
|
||||
export * from './hEUWebLink';
|
||||
export * from './hTTPValidationError';
|
||||
export * from './identityGrant';
|
||||
export * from './idToken';
|
||||
export * from './inseAccountManagementModelOrganizationProfile';
|
||||
export * from './inseOrganizationManagementModelOrganizationProfile';
|
||||
export * from './institution';
|
||||
export * from './institutionFunderSummary';
|
||||
export * from './institutionGeo';
|
||||
@@ -87,22 +97,21 @@ export * from './institutionInformation';
|
||||
export * from './institutionNetworkNode';
|
||||
export * from './institutionPage';
|
||||
export * from './institutionsListResponse';
|
||||
export * from './item';
|
||||
export * from './itemCreate';
|
||||
export * from './itemPage';
|
||||
export * from './ipcClassification';
|
||||
export * from './keywords';
|
||||
export * from './latitude';
|
||||
export * from './location';
|
||||
export * from './loginResponse';
|
||||
export * from './longitude';
|
||||
export * from './matchedOfficer';
|
||||
export * from './mentionedPerson';
|
||||
export * from './meta';
|
||||
export * from './model2YrMeanCitedness';
|
||||
export * from './neteccontribution';
|
||||
export * from './newsArticle';
|
||||
export * from './newsArticleDetail';
|
||||
export * from './newsPage';
|
||||
export * from './openAccess';
|
||||
export * from './organizationPage';
|
||||
export * from './patentEntry';
|
||||
export * from './patentsByAuthorResponse';
|
||||
export * from './personBio';
|
||||
@@ -113,8 +122,10 @@ export * from './publicationDetailByFunder';
|
||||
export * from './publicationIdsByAuthorPosition';
|
||||
export * from './publicationsByAuthorResponse';
|
||||
export * from './rankingResponse';
|
||||
export * from './refreshToken';
|
||||
export * from './score';
|
||||
export * from './sortDirection';
|
||||
export * from './tokenType';
|
||||
export * from './topic';
|
||||
export * from './topicCount';
|
||||
export * from './topicDomain';
|
||||
@@ -127,7 +138,9 @@ export * from './topicsByYear';
|
||||
export * from './topicsListResponse';
|
||||
export * from './universityRanking';
|
||||
export * from './universityTopicData';
|
||||
export * from './user';
|
||||
export * from './updateAccountRequest';
|
||||
export * from './updateOrganizationRequest';
|
||||
export * from './userRole';
|
||||
export * from './validationError';
|
||||
export * from './validationErrorLocInner';
|
||||
export * from './value';
|
||||
|
||||
@@ -16,4 +16,5 @@ export interface NewsArticle {
|
||||
url?: string | null;
|
||||
relevant?: boolean | null;
|
||||
snippet?: string | null;
|
||||
related?: boolean | null;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,9 @@ export interface NewsArticleDetail {
|
||||
url?: string | null;
|
||||
relevant?: boolean | null;
|
||||
snippet?: string | null;
|
||||
related?: boolean | null;
|
||||
full_content?: string | null;
|
||||
authors?: Array<MentionedPerson>;
|
||||
topics?: Array<string>;
|
||||
keywords?: Array<string>;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
import { InseOrganizationManagementModelOrganizationProfile } from './inseOrganizationManagementModelOrganizationProfile';
|
||||
|
||||
export interface OrganizationPage {
|
||||
items: Array<InseOrganizationManagementModelOrganizationProfile>;
|
||||
total: number;
|
||||
page: number;
|
||||
page_size: number;
|
||||
}
|
||||
@@ -1,30 +1,32 @@
|
||||
export interface IpcClassification {
|
||||
symbol: string;
|
||||
section: string | null;
|
||||
class: string | null;
|
||||
subclass: string | null;
|
||||
main_group: string | null;
|
||||
subgroup: string | null;
|
||||
}
|
||||
/**
|
||||
* 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 { IpcClassification } from './ipcClassification';
|
||||
|
||||
export interface PatentEntry {
|
||||
patent_id: string;
|
||||
source: string;
|
||||
title: string | null;
|
||||
abstract: string | null;
|
||||
publication_date: string | null;
|
||||
publication_year: string | null;
|
||||
application_number: string | null;
|
||||
application_date: string | null;
|
||||
kind: string | null;
|
||||
application_type: string | null;
|
||||
number_of_claims: number | null;
|
||||
status: string | null;
|
||||
inventors: string[];
|
||||
assignees: string[];
|
||||
ipc: string[];
|
||||
ipc_descriptions: IpcClassification[];
|
||||
cpc: string[];
|
||||
cpc_descriptions: IpcClassification[];
|
||||
country: string | null;
|
||||
title?: string | null;
|
||||
abstract?: string | null;
|
||||
publication_date?: string | null;
|
||||
publication_year?: string | null;
|
||||
application_number?: string | null;
|
||||
application_date?: string | null;
|
||||
kind?: string | null;
|
||||
application_type?: string | null;
|
||||
number_of_claims?: number | null;
|
||||
status?: string | null;
|
||||
inventors?: Array<string>;
|
||||
assignees?: Array<string>;
|
||||
ipc?: Array<string>;
|
||||
ipc_descriptions?: Array<IpcClassification>;
|
||||
cpc?: Array<string>;
|
||||
cpc_descriptions?: Array<IpcClassification>;
|
||||
country?: string | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* 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 { TokenType } from './tokenType';
|
||||
import { UserRole } from './userRole';
|
||||
|
||||
export interface RefreshToken {
|
||||
/**
|
||||
* The type of the token, which is always REFRESH_TOKEN for this class.
|
||||
*/
|
||||
token_type?: TokenType;
|
||||
/**
|
||||
* The unique identifier of the real account associated with this token.
|
||||
*/
|
||||
real_account_id: string;
|
||||
/**
|
||||
* The timestamp indicating when the token will expire.
|
||||
*/
|
||||
expires_at: string;
|
||||
/**
|
||||
* The epoch value for the token. Used for versioning of tokens.
|
||||
*/
|
||||
epoch?: number;
|
||||
/**
|
||||
* A hash of the user\'s fingerprint to ensure the token is used by the same user.
|
||||
*/
|
||||
user_fingerprint_hash: string;
|
||||
/**
|
||||
* The raw token string.
|
||||
*/
|
||||
raw_token: string;
|
||||
/**
|
||||
* The unique identifier of the effective account associated with this access token. This may differ from the real account ID due to account impersonation.
|
||||
*/
|
||||
effective_account_id: string;
|
||||
/**
|
||||
* The specific role this access token grants within its organization.
|
||||
*/
|
||||
effective_role?: UserRole;
|
||||
/**
|
||||
* The unique identifier of the organization associated with this access token.
|
||||
*/
|
||||
effective_organization_id: string;
|
||||
}
|
||||
export namespace RefreshToken {}
|
||||
@@ -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 const TokenType = {
|
||||
Id: 'ID',
|
||||
Refresh: 'REFRESH',
|
||||
Access: 'ACCESS',
|
||||
} as const;
|
||||
export type TokenType = (typeof TokenType)[keyof typeof TokenType];
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* 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 { UserRole } from './userRole';
|
||||
|
||||
export interface UpdateAccountRequest {
|
||||
email?: string | null;
|
||||
name?: string | null;
|
||||
role?: UserRole | null;
|
||||
organization_id?: string | null;
|
||||
password?: string | null;
|
||||
openalex_person_id?: string | null;
|
||||
deleted?: boolean | null;
|
||||
}
|
||||
export namespace UpdateAccountRequest {}
|
||||
+4
-6
@@ -8,10 +8,8 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
export interface AuthAccount {
|
||||
i: number;
|
||||
l: string;
|
||||
o: number;
|
||||
e: string;
|
||||
on: string;
|
||||
export interface UpdateOrganizationRequest {
|
||||
name?: string | null;
|
||||
other_inst_id?: string | null;
|
||||
deleted?: boolean | null;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* An entry in the user configuration file.
|
||||
*/
|
||||
export interface User {
|
||||
/**
|
||||
* The username of the user.
|
||||
*/
|
||||
username: string;
|
||||
/**
|
||||
* The password of the user.
|
||||
*/
|
||||
password: string;
|
||||
/**
|
||||
* The email of the user.
|
||||
*/
|
||||
email: string;
|
||||
/**
|
||||
* The account id of the user.
|
||||
*/
|
||||
account: number;
|
||||
/**
|
||||
* The organization id of the user.
|
||||
*/
|
||||
organization: number;
|
||||
/**
|
||||
* The organization name of the user.
|
||||
*/
|
||||
organization_name: string;
|
||||
/**
|
||||
* Indicates whether the user is a superadmin.
|
||||
*/
|
||||
superadmin?: boolean;
|
||||
}
|
||||
@@ -7,12 +7,11 @@
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { AuthScope } from './authScope';
|
||||
|
||||
export interface AccessGrant {
|
||||
token_type: string;
|
||||
access_token: string;
|
||||
expires_in: number;
|
||||
scope: AuthScope;
|
||||
refresh_token: string;
|
||||
}
|
||||
export const UserRole = {
|
||||
SuperAdmin: 'SUPER_ADMIN',
|
||||
Admin: 'ADMIN',
|
||||
Manager: 'MANAGER',
|
||||
User: 'USER',
|
||||
} as const;
|
||||
export type UserRole = (typeof UserRole)[keyof typeof UserRole];
|
||||
@@ -19,9 +19,10 @@ 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';
|
||||
|
||||
registerLocaleData(locale);
|
||||
|
||||
@@ -72,7 +73,10 @@ export const appConfig: ApplicationConfig = {
|
||||
}),
|
||||
),
|
||||
provideHttpClient(withInterceptors([authenticationInterceptor])),
|
||||
// provideApi('/inse-service'),
|
||||
provideApi({
|
||||
basePath: '/inse-webapp',
|
||||
withCredentials: true,
|
||||
}),
|
||||
provideAnimationsAsync(),
|
||||
provideEchartsCore({ echarts: () => import('echarts') }),
|
||||
],
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Routes } from '@angular/router';
|
||||
import { userGuard } from './shared/guards/user.guard';
|
||||
import { adminGuard } from './shared/guards/admin.guard';
|
||||
import { superAdminGuard } from './shared/guards/super-admin.guard';
|
||||
import { collaborationNetworkResolver } from './resolvers/collaboration-network.resolver';
|
||||
import { personListResolver } from './resolvers/person-list.resolver';
|
||||
import { personBioResolver } from './resolvers/person-bio.resolver';
|
||||
@@ -18,6 +20,8 @@ import { fundingProjectPageResolver } from './resolvers/funding-project-page.res
|
||||
import { personCordisEuProjectPageResolver } from './resolvers/person-cordis-eu-project-page.resolver';
|
||||
import { euSingleProjectResolver } from './resolvers/eu-single-project-resolver';
|
||||
import { publicationResolver } from './resolvers/publication-resolver';
|
||||
import { accountResolver } from './resolvers/account.resolver';
|
||||
|
||||
export const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
@@ -85,6 +89,33 @@ 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],
|
||||
loadComponent: () =>
|
||||
import('./modules/accounts/accounts.component').then(
|
||||
(mod) => mod.AccountsComponent,
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'organizations',
|
||||
canActivate: [superAdminGuard],
|
||||
loadComponent: () =>
|
||||
import('./modules/organizations/organizations.component').then(
|
||||
(mod) => mod.OrganizationsComponent,
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'news/:id',
|
||||
canActivate: [userGuard],
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<div class="content">
|
||||
<div class="account-profile-information">
|
||||
<div class="personal-information">
|
||||
<span class="name">{{ accountProfile().name }}</span>
|
||||
<span class="mail">{{ accountProfile().email }}</span>
|
||||
</div>
|
||||
<span class="organization">{{ accountProfile().organization_name }}</span>
|
||||
<mat-chip-set>
|
||||
@for (role of roles; track $index) {
|
||||
<mat-chip class="role-chip">{{ role | role }}</mat-chip>
|
||||
}
|
||||
</mat-chip-set>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<mat-divider />
|
||||
|
||||
<mat-tab-group>
|
||||
<mat-tab label="Einstellungen"></mat-tab>
|
||||
</mat-tab-group>
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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<AccountProfile>();
|
||||
|
||||
roles: UserRole[] = [];
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
this.roles = [this.accountProfile().role];
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<h2 mat-dialog-title>
|
||||
{{ data.mode === 'create' ? 'Account erstellen' : 'Account bearbeiten' }}
|
||||
</h2>
|
||||
|
||||
<mat-dialog-content>
|
||||
<form class="account-form" [formGroup]="form" (ngSubmit)="submit()">
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>E-Mail</mat-label>
|
||||
<input matInput type="email" formControlName="email" />
|
||||
@if (form.controls.email.hasError('required')) {
|
||||
<mat-error>E-Mail ist erforderlich.</mat-error>
|
||||
} @else if (form.controls.email.hasError('email')) {
|
||||
<mat-error>Bitte gültige E-Mail eingeben.</mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Name</mat-label>
|
||||
<input matInput formControlName="name" />
|
||||
@if (form.controls.name.hasError('required')) {
|
||||
<mat-error>Name ist erforderlich.</mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Rolle</mat-label>
|
||||
<mat-select formControlName="role">
|
||||
@for (role of data.roles; track role) {
|
||||
<mat-option [value]="role">{{ role }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
@if (data.canSelectOrganization) {
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Organisation</mat-label>
|
||||
<mat-select formControlName="organizationId">
|
||||
@for (organization of data.organizations; track organization.id) {
|
||||
<mat-option [value]="organization.id">
|
||||
{{ organization.name }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
}
|
||||
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>
|
||||
{{ data.mode === 'create' ? 'Initiales Passwort' : 'Neues Passwort' }}
|
||||
</mat-label>
|
||||
<input matInput type="password" formControlName="password" />
|
||||
@if (form.controls.password.hasError('required')) {
|
||||
<mat-error>Passwort ist erforderlich.</mat-error>
|
||||
} @else if (form.controls.password.hasError('minlength')) {
|
||||
<mat-error>Mindestens 8 Zeichen.</mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
</form>
|
||||
</mat-dialog-content>
|
||||
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-button type="button" (click)="close()">Abbrechen</button>
|
||||
<button mat-flat-button color="primary" type="button" (click)="submit()">
|
||||
<mat-icon>save</mat-icon>
|
||||
Speichern
|
||||
</button>
|
||||
</mat-dialog-actions>
|
||||
@@ -0,0 +1,22 @@
|
||||
.account-form {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 10px 14px;
|
||||
min-width: min(680px, calc(100vw - 64px));
|
||||
padding-top: 4px;
|
||||
}
|
||||
|
||||
.account-form mat-form-field {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
mat-dialog-actions {
|
||||
padding: 12px 24px 20px;
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.account-form {
|
||||
grid-template-columns: 1fr;
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import {
|
||||
FormControl,
|
||||
FormGroup,
|
||||
ReactiveFormsModule,
|
||||
Validators,
|
||||
} from '@angular/forms';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import {
|
||||
MAT_DIALOG_DATA,
|
||||
MatDialogModule,
|
||||
MatDialogRef,
|
||||
} from '@angular/material/dialog';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import type {
|
||||
AccountPayload,
|
||||
AccountProfile,
|
||||
AccountRole,
|
||||
CreateAccountPayload,
|
||||
OrganizationProfile,
|
||||
} from '../../shared/services/account-management.service';
|
||||
|
||||
export type AccountDialogMode = 'create' | 'edit';
|
||||
|
||||
export interface AccountDialogData {
|
||||
mode: AccountDialogMode;
|
||||
account?: AccountProfile;
|
||||
organizations: OrganizationProfile[];
|
||||
canSelectOrganization: boolean;
|
||||
roles: AccountRole[];
|
||||
}
|
||||
|
||||
export type AccountDialogResult =
|
||||
| { mode: 'create'; payload: CreateAccountPayload }
|
||||
| { mode: 'edit'; accountId: string; payload: AccountPayload };
|
||||
|
||||
@Component({
|
||||
selector: 'app-account-dialog',
|
||||
imports: [
|
||||
CommonModule,
|
||||
ReactiveFormsModule,
|
||||
MatButtonModule,
|
||||
MatDialogModule,
|
||||
MatFormFieldModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatSelectModule,
|
||||
],
|
||||
templateUrl: './account-dialog.component.html',
|
||||
styleUrl: './account-dialog.component.scss',
|
||||
standalone: true,
|
||||
})
|
||||
export class AccountDialogComponent {
|
||||
private readonly dialogRef =
|
||||
inject<
|
||||
MatDialogRef<AccountDialogComponent, AccountDialogResult | undefined>
|
||||
>(MatDialogRef);
|
||||
protected readonly data = inject<AccountDialogData>(MAT_DIALOG_DATA);
|
||||
|
||||
protected readonly form = new FormGroup({
|
||||
email: new FormControl<string>(this.data.account?.email ?? '', [
|
||||
Validators.required,
|
||||
Validators.email,
|
||||
]),
|
||||
name: new FormControl<string>(this.data.account?.name ?? '', [
|
||||
Validators.required,
|
||||
]),
|
||||
role: new FormControl<AccountRole>(this.data.account?.role ?? 'USER', [
|
||||
Validators.required,
|
||||
]),
|
||||
organizationId: new FormControl<string>(
|
||||
this.data.account?.organization_id ??
|
||||
(this.data.organizations.length === 1
|
||||
? this.data.organizations[0].id
|
||||
: ''),
|
||||
[Validators.required],
|
||||
),
|
||||
password: new FormControl<string>('', [
|
||||
...(this.data.mode === 'create' ? [Validators.required] : []),
|
||||
Validators.minLength(8),
|
||||
]),
|
||||
});
|
||||
|
||||
protected submit(): void {
|
||||
if (this.form.invalid) {
|
||||
this.form.markAllAsTouched();
|
||||
return;
|
||||
}
|
||||
|
||||
const value = this.form.getRawValue();
|
||||
|
||||
if (this.data.mode === 'create') {
|
||||
this.dialogRef.close({
|
||||
mode: 'create',
|
||||
payload: {
|
||||
email: value.email ?? '',
|
||||
name: value.name ?? '',
|
||||
role: value.role ?? 'USER',
|
||||
organization_id: value.organizationId ?? '',
|
||||
password: value.password ?? '',
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const account = this.data.account!;
|
||||
const payload: AccountPayload = {};
|
||||
|
||||
const email = (value.email ?? '').trim();
|
||||
const name = (value.name ?? '').trim();
|
||||
const role = value.role ?? account.role;
|
||||
const organizationId = value.organizationId ?? account.organization_id;
|
||||
const password = value.password?.trim() ?? '';
|
||||
|
||||
if (email !== account.email) {
|
||||
payload.email = email;
|
||||
}
|
||||
|
||||
if (name !== account.name) {
|
||||
payload.name = name;
|
||||
}
|
||||
|
||||
if (role !== account.role) {
|
||||
payload.role = role;
|
||||
}
|
||||
|
||||
if (password) {
|
||||
payload.password = password;
|
||||
}
|
||||
|
||||
if (
|
||||
this.data.canSelectOrganization &&
|
||||
organizationId &&
|
||||
organizationId !== account.organization_id
|
||||
) {
|
||||
payload.organization_id = organizationId;
|
||||
}
|
||||
|
||||
this.dialogRef.close({
|
||||
mode: 'edit',
|
||||
accountId: account.id,
|
||||
payload,
|
||||
});
|
||||
}
|
||||
|
||||
protected close(): void {
|
||||
this.dialogRef.close(undefined);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
<section class="accounts-page">
|
||||
<header class="page-header">
|
||||
<div>
|
||||
<h1>Accounts</h1>
|
||||
<p>Account-Zugänge verwalten, Rollen setzen und Impersonation starten.</p>
|
||||
</div>
|
||||
<button
|
||||
mat-flat-button
|
||||
color="primary"
|
||||
type="button"
|
||||
(click)="startCreate()">
|
||||
<mat-icon>person_add</mat-icon>
|
||||
Neuer Account
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<form class="filters" [formGroup]="filterForm" (ngSubmit)="applyFilters()">
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Name oder E-Mail</mat-label>
|
||||
<input matInput formControlName="search" />
|
||||
</mat-form-field>
|
||||
|
||||
@if (credentialService.isEffectiveSuperAdmin()) {
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Organisation</mat-label>
|
||||
<mat-select formControlName="organizationId">
|
||||
<mat-option value="">Alle Organisationen</mat-option>
|
||||
@for (organization of organizations; track organization.id) {
|
||||
<mat-option [value]="organization.id">
|
||||
{{ organization.name }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
}
|
||||
|
||||
<div class="filter-actions">
|
||||
<button mat-flat-button color="primary" type="submit">
|
||||
<mat-icon>search</mat-icon>
|
||||
Suchen
|
||||
</button>
|
||||
<button mat-button type="button" (click)="resetFilters()">
|
||||
Zurücksetzen
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<section class="table-panel">
|
||||
<div class="table-header">
|
||||
<strong>{{ total }} Accounts</strong>
|
||||
@if (isLoading) {
|
||||
<span>Wird geladen...</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>E-Mail</th>
|
||||
<th>Organisation</th>
|
||||
<th>Rolle</th>
|
||||
<th>Status</th>
|
||||
<th>Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (account of accounts; track account.id) {
|
||||
<tr [class.deleted]="account.deleted">
|
||||
<td>
|
||||
<button
|
||||
class="link-button"
|
||||
type="button"
|
||||
(click)="startEdit(account)">
|
||||
{{ account.name }}
|
||||
</button>
|
||||
</td>
|
||||
<td>{{ account.email }}</td>
|
||||
<td>{{ account.organization_name }}</td>
|
||||
<td>
|
||||
<span class="role">{{ account.role | role }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="status" [class.status--deleted]="account.deleted">
|
||||
{{ account.deleted ? 'deleted' : 'active' }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<div class="row-actions">
|
||||
<button
|
||||
mat-icon-button
|
||||
type="button"
|
||||
aria-label="Bearbeiten"
|
||||
(click)="startEdit(account)">
|
||||
<mat-icon>edit</mat-icon>
|
||||
</button>
|
||||
<button
|
||||
mat-icon-button
|
||||
type="button"
|
||||
aria-label="Impersonate"
|
||||
[disabled]="!canImpersonate(account)"
|
||||
(click)="impersonate(account)">
|
||||
<mat-icon>switch_account</mat-icon>
|
||||
</button>
|
||||
<button
|
||||
mat-icon-button
|
||||
type="button"
|
||||
aria-label="Deaktivieren"
|
||||
[disabled]="account.is_current || account.deleted"
|
||||
(click)="deleteAccount(account)">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
} @empty {
|
||||
<tr>
|
||||
<td colspan="6" class="empty">Keine Accounts gefunden.</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<button
|
||||
mat-button
|
||||
type="button"
|
||||
[disabled]="!canPageBack"
|
||||
(click)="loadAccounts(page - 1)">
|
||||
<mat-icon>chevron_left</mat-icon>
|
||||
Zurück
|
||||
</button>
|
||||
<span>Seite {{ page + 1 }}</span>
|
||||
<button
|
||||
mat-button
|
||||
type="button"
|
||||
[disabled]="!canPageForward"
|
||||
(click)="loadAccounts(page + 1)">
|
||||
Weiter
|
||||
<mat-icon>chevron_right</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
@@ -0,0 +1,147 @@
|
||||
.accounts-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.page-header,
|
||||
.filters,
|
||||
.table-header,
|
||||
.pagination,
|
||||
.row-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.page-header p {
|
||||
color: #64748b;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.filters {
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.filters mat-form-field {
|
||||
width: min(320px, 100%);
|
||||
}
|
||||
|
||||
.filter-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-bottom: 22px;
|
||||
}
|
||||
|
||||
.table-panel {
|
||||
border: 1px solid #d7dde6;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.table-header {
|
||||
justify-content: space-between;
|
||||
padding: 16px;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.table-header span {
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.table-wrap {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 12px 16px;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid #edf1f7;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
th {
|
||||
color: #475569;
|
||||
font-weight: 700;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
tr.deleted {
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.link-button {
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: #1d4ed8;
|
||||
padding: 0;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.role,
|
||||
.status {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 24px;
|
||||
border-radius: 999px;
|
||||
padding: 2px 10px;
|
||||
background: #eef2ff;
|
||||
color: #3730a3;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.status {
|
||||
background: #dcfce7;
|
||||
color: #166534;
|
||||
}
|
||||
|
||||
.status--deleted {
|
||||
background: #fee2e2;
|
||||
color: #991b1b;
|
||||
}
|
||||
|
||||
.row-actions {
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.empty {
|
||||
color: #64748b;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pagination {
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
padding: 12px 16px;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.accounts-page {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,248 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, OnInit, inject } from '@angular/core';
|
||||
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||
import { Router } from '@angular/router';
|
||||
import { finalize } from 'rxjs';
|
||||
import { AccountManagementService } from '../../shared/services/account-management.service';
|
||||
import type {
|
||||
AccountProfile,
|
||||
AccountRole,
|
||||
OrganizationProfile,
|
||||
} from '../../shared/services/account-management.service';
|
||||
import { CredentialService } from '../../shared/services/credential.service';
|
||||
import type {
|
||||
AccountDialogComponent,
|
||||
AccountDialogResult,
|
||||
} from './account-dialog.component';
|
||||
import { RolePipe } from '../../shared/pipes/role.pipe';
|
||||
|
||||
@Component({
|
||||
selector: 'app-accounts',
|
||||
imports: [
|
||||
CommonModule,
|
||||
ReactiveFormsModule,
|
||||
MatButtonModule,
|
||||
MatIconModule,
|
||||
MatFormFieldModule,
|
||||
MatInputModule,
|
||||
MatSelectModule,
|
||||
MatSnackBarModule,
|
||||
MatDialogModule,
|
||||
RolePipe,
|
||||
],
|
||||
templateUrl: './accounts.component.html',
|
||||
styleUrl: './accounts.component.scss',
|
||||
standalone: true,
|
||||
})
|
||||
export class AccountsComponent implements OnInit {
|
||||
private readonly accountService = inject(AccountManagementService);
|
||||
protected readonly credentialService = inject(CredentialService);
|
||||
private readonly snackBar = inject(MatSnackBar);
|
||||
private readonly router = inject(Router);
|
||||
private readonly dialog = inject(MatDialog);
|
||||
|
||||
protected get availableRoles(): AccountRole[] {
|
||||
if (this.credentialService.isEffectiveSuperAdmin()) {
|
||||
return ['SUPER_ADMIN', 'ADMIN', 'MANAGER', 'USER'];
|
||||
}
|
||||
|
||||
return ['MANAGER', 'USER'];
|
||||
}
|
||||
protected accounts: AccountProfile[] = [];
|
||||
protected organizations: OrganizationProfile[] = [];
|
||||
protected total = 0;
|
||||
protected page = 0;
|
||||
protected readonly pageSize = 10;
|
||||
protected isLoading = false;
|
||||
|
||||
protected filterForm = new FormGroup({
|
||||
search: new FormControl<string>(''),
|
||||
organizationId: new FormControl<string>(''),
|
||||
});
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loadOrganizations();
|
||||
this.loadAccounts();
|
||||
}
|
||||
|
||||
protected loadAccounts(page = this.page): void {
|
||||
this.page = page;
|
||||
this.isLoading = true;
|
||||
this.accountService
|
||||
.listAccounts({
|
||||
page: this.page,
|
||||
pageSize: this.pageSize,
|
||||
search: this.filterForm.controls.search.value?.trim() || undefined,
|
||||
organizationId:
|
||||
this.filterForm.controls.organizationId.value || undefined,
|
||||
})
|
||||
.pipe(finalize(() => (this.isLoading = false)))
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
this.accounts = result.items;
|
||||
this.total = result.total;
|
||||
},
|
||||
error: () => {
|
||||
this.snackBar.open('Accounts konnten nicht geladen werden.', 'OK', {
|
||||
duration: 5000,
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
protected loadOrganizations(): void {
|
||||
this.accountService.listOrganizations().subscribe({
|
||||
next: (organizations) => {
|
||||
this.organizations = organizations;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
protected applyFilters(): void {
|
||||
this.loadAccounts(0);
|
||||
}
|
||||
|
||||
protected resetFilters(): void {
|
||||
this.filterForm.reset({ search: '', organizationId: '' });
|
||||
this.loadAccounts(0);
|
||||
}
|
||||
|
||||
protected startCreate(): void {
|
||||
this.openAccountDialog({ mode: 'create' });
|
||||
}
|
||||
|
||||
protected startEdit(account: AccountProfile): void {
|
||||
this.openAccountDialog({ mode: 'edit', account });
|
||||
}
|
||||
|
||||
private saveDialogResult(result: AccountDialogResult): void {
|
||||
const request =
|
||||
result.mode === 'create'
|
||||
? this.accountService.createAccount(result.payload)
|
||||
: this.accountService.updateAccount(result.accountId, result.payload);
|
||||
|
||||
request.subscribe({
|
||||
next: () => {
|
||||
this.snackBar.open('Account wurde gespeichert.', 'OK', {
|
||||
duration: 3000,
|
||||
});
|
||||
this.loadAccounts(0);
|
||||
},
|
||||
error: (error) => {
|
||||
const message =
|
||||
error.status === 409
|
||||
? 'Diese E-Mail-Adresse wird bereits verwendet.'
|
||||
: 'Account konnte nicht gespeichert werden.';
|
||||
this.snackBar.open(message, 'OK', { duration: 5000 });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private openAccountDialog(data: {
|
||||
mode: 'create' | 'edit';
|
||||
account?: AccountProfile;
|
||||
}): void {
|
||||
import('./account-dialog.component').then(({ AccountDialogComponent }) => {
|
||||
const dialogRef = this.dialog.open<
|
||||
AccountDialogComponent,
|
||||
{
|
||||
mode: 'create' | 'edit';
|
||||
account?: AccountProfile;
|
||||
organizations: OrganizationProfile[];
|
||||
canSelectOrganization: boolean;
|
||||
roles: AccountRole[];
|
||||
},
|
||||
AccountDialogResult | undefined
|
||||
>(AccountDialogComponent, {
|
||||
width: '760px',
|
||||
maxWidth: 'calc(100vw - 32px)',
|
||||
data: {
|
||||
...data,
|
||||
organizations: this.organizations,
|
||||
canSelectOrganization: this.credentialService.isEffectiveSuperAdmin(),
|
||||
roles: this.availableRoles,
|
||||
},
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe((result) => {
|
||||
if (result) {
|
||||
this.saveDialogResult(result);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
protected deleteAccount(account: AccountProfile): void {
|
||||
if (account.is_current) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.accountService.deleteAccount(account.id).subscribe({
|
||||
next: () => {
|
||||
this.snackBar.open('Account wurde deaktiviert.', 'OK', {
|
||||
duration: 3000,
|
||||
});
|
||||
this.loadAccounts();
|
||||
},
|
||||
error: () => {
|
||||
this.snackBar.open('Account konnte nicht deaktiviert werden.', 'OK', {
|
||||
duration: 5000,
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
protected impersonate(account: AccountProfile): void {
|
||||
if (!this.canImpersonate(account)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.credentialService.impersonateAccount(account.id).subscribe({
|
||||
next: () => {
|
||||
this.snackBar.open(`Impersonation aktiv: ${account.name}`, 'OK', {
|
||||
duration: 4000,
|
||||
});
|
||||
this.router.navigate(['/dashboard']);
|
||||
},
|
||||
error: () => {
|
||||
this.snackBar.open(
|
||||
'Impersonation konnte nicht gestartet werden.',
|
||||
'OK',
|
||||
{
|
||||
duration: 5000,
|
||||
},
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
protected get canPageBack(): boolean {
|
||||
return this.page > 0;
|
||||
}
|
||||
|
||||
protected get canPageForward(): boolean {
|
||||
return (this.page + 1) * this.pageSize < this.total;
|
||||
}
|
||||
|
||||
protected canImpersonate(account: AccountProfile): boolean {
|
||||
if (account.is_current || account.deleted) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.credentialService.isEffectiveSuperAdmin()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
this.credentialService.isEffectiveAdmin() &&
|
||||
(account.role === 'MANAGER' || account.role === 'USER')
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,68 +1,160 @@
|
||||
<div class="container">
|
||||
<form class="form" [formGroup]="loginForm">
|
||||
<h3>Anmeldung</h3>
|
||||
<p class="field">
|
||||
Um auf den Dienst zuzugreifen, musst Du Deine Anmeldedaten eingeben.
|
||||
</p>
|
||||
|
||||
<mat-form-field class="field">
|
||||
<mat-label>Login</mat-label>
|
||||
<input id="dp-login" matInput formControlName="login" />
|
||||
@if (loginForm.controls.login.hasError('required')) {
|
||||
<mat-error>Fehler: <b>Login</b> erforderlich.</mat-error>
|
||||
} @else if (loginForm.controls.login.hasError('minlength')) {
|
||||
<mat-error>Fehler: <b>Login</b> ist unvollständig.</mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="field">
|
||||
<mat-label>Passwort</mat-label>
|
||||
<input
|
||||
id="dp-password"
|
||||
matInput
|
||||
[type]="showPassword ? 'text' : 'password'"
|
||||
formControlName="password" />
|
||||
@if (showPassword) {
|
||||
<mat-icon matSuffix (click)="showPassword = false">visibility</mat-icon>
|
||||
} @else {
|
||||
<mat-icon matSuffix (click)="showPassword = true"
|
||||
>visibility_off</mat-icon
|
||||
>
|
||||
}
|
||||
@if (loginForm.controls.password.hasError('required')) {
|
||||
<mat-error>Fehler: <b>Passwort</b> erforderlich.</mat-error>
|
||||
} @else if (loginForm.controls.password.hasError('minlength')) {
|
||||
<mat-error>Fehler: <b>Passwort</b> ist unvollständig.</mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
<button
|
||||
mat-raised-button
|
||||
class="button"
|
||||
(click)="login()"
|
||||
[disabled]="!loginForm.valid || (credentialService.validating | async)">
|
||||
Anmelden
|
||||
</button>
|
||||
|
||||
<div class="field" style="text-align: center; margin-top: -10px">
|
||||
<button mat-button type="button" routerLink="/register">
|
||||
Noch kein Konto? <b>Registrieren</b>
|
||||
</button>
|
||||
<section class="login-page">
|
||||
<div class="login-panel">
|
||||
<div class="brand-block">
|
||||
<span class="eyebrow">SmartGuide Account Portal</span>
|
||||
<h1>Login</h1>
|
||||
<p>
|
||||
Melde Dich mit Deiner Organisation an. Nach den Zugangsdaten erhältst Du
|
||||
einen einmaligen Code per E-Mail.
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
<p class="progress">
|
||||
@if (credentialService.validating | async) {
|
||||
<span><i>Anmeldung läuft,</i> bitte warte einen Moment.</span>
|
||||
|
||||
<div class="stepper" aria-label="Login-Fortschritt">
|
||||
<div class="step" [class.step--active]="currentStep === 'credentials'">
|
||||
<span>1</span>
|
||||
<strong>Zugangsdaten</strong>
|
||||
</div>
|
||||
<div class="step-line"></div>
|
||||
<div class="step" [class.step--active]="currentStep === 'otk'">
|
||||
<span>2</span>
|
||||
<strong>OTK-Code</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (currentStep === 'credentials') {
|
||||
<form
|
||||
class="login-form"
|
||||
[formGroup]="credentialsForm"
|
||||
(ngSubmit)="requestOtk()">
|
||||
<mat-form-field class="field" appearance="outline">
|
||||
<mat-label>E-Mail-Adresse</mat-label>
|
||||
<input
|
||||
id="login-email"
|
||||
matInput
|
||||
type="email"
|
||||
autocomplete="email"
|
||||
formControlName="email" />
|
||||
@if (credentialsForm.controls.email.hasError('required')) {
|
||||
<mat-error>E-Mail-Adresse ist erforderlich.</mat-error>
|
||||
} @else if (credentialsForm.controls.email.hasError('email')) {
|
||||
<mat-error>Bitte gib eine gültige E-Mail-Adresse ein.</mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="field" appearance="outline">
|
||||
<mat-label>Passwort</mat-label>
|
||||
<input
|
||||
id="login-password"
|
||||
matInput
|
||||
[type]="showPassword ? 'text' : 'password'"
|
||||
autocomplete="current-password"
|
||||
formControlName="password" />
|
||||
<button
|
||||
mat-icon-button
|
||||
matSuffix
|
||||
type="button"
|
||||
[attr.aria-label]="
|
||||
showPassword ? 'Passwort verbergen' : 'Passwort anzeigen'
|
||||
"
|
||||
(click)="showPassword = !showPassword">
|
||||
<mat-icon>{{
|
||||
showPassword ? 'visibility' : 'visibility_off'
|
||||
}}</mat-icon>
|
||||
</button>
|
||||
@if (credentialsForm.controls.password.hasError('required')) {
|
||||
<mat-error>Passwort ist erforderlich.</mat-error>
|
||||
} @else if (credentialsForm.controls.password.hasError('minlength')) {
|
||||
<mat-error>Passwort muss mindestens 8 Zeichen haben.</mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
|
||||
<button
|
||||
mat-flat-button
|
||||
color="primary"
|
||||
class="submit-button"
|
||||
type="submit"
|
||||
[disabled]="credentialsForm.invalid || isSubmitting">
|
||||
@if (isSubmitting) {
|
||||
Code wird gesendet...
|
||||
} @else {
|
||||
Code per E-Mail senden
|
||||
}
|
||||
</button>
|
||||
|
||||
<div class="form-actions">
|
||||
<a routerLink="/login">Passwort vergessen?</a>
|
||||
<a routerLink="/register">Konto erstellen</a>
|
||||
</div>
|
||||
</form>
|
||||
} @else {
|
||||
@if (
|
||||
(credentialService.authenticated | async) &&
|
||||
!(credentialService.superadmin | async) &&
|
||||
!(credentialService.universityadmin | async)
|
||||
) {
|
||||
<span class="error"
|
||||
>Fehler: <b>{{ credentialService.login.value }}</b> ist nicht
|
||||
berechtigt.</span
|
||||
>
|
||||
}
|
||||
<form class="login-form" [formGroup]="otkForm" (ngSubmit)="login()">
|
||||
<div class="code-intro">
|
||||
<mat-icon>mark_email_unread</mat-icon>
|
||||
<div>
|
||||
<strong>Code eingeben</strong>
|
||||
<span>
|
||||
Wir haben den Code an
|
||||
{{
|
||||
credentialsForm.controls.email.value || 'Deine E-Mail-Adresse'
|
||||
}}
|
||||
gesendet.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<mat-form-field class="field" appearance="outline">
|
||||
<mat-label>OTK-Code</mat-label>
|
||||
<input
|
||||
id="login-otk"
|
||||
matInput
|
||||
inputmode="text"
|
||||
autocomplete="one-time-code"
|
||||
formControlName="code" />
|
||||
@if (otkForm.controls.code.hasError('required')) {
|
||||
<mat-error>OTK-Code ist erforderlich.</mat-error>
|
||||
} @else if (otkForm.controls.code.hasError('pattern')) {
|
||||
<mat-error>Bitte gib den Code aus der E-Mail ein.</mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
|
||||
<div
|
||||
class="expiry"
|
||||
[class.expiry--expired]="codeExpiresIn === 0"
|
||||
aria-live="polite">
|
||||
<mat-icon>timer</mat-icon>
|
||||
@if (codeExpiresIn > 0) {
|
||||
<span>Code läuft in {{ formatCountdown() }} ab.</span>
|
||||
} @else {
|
||||
<span>Code ist abgelaufen. Bitte neuen Code anfordern.</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
<button
|
||||
mat-flat-button
|
||||
color="primary"
|
||||
class="submit-button"
|
||||
type="submit"
|
||||
[disabled]="otkForm.invalid || isSubmitting || codeExpiresIn === 0">
|
||||
@if (isSubmitting) {
|
||||
Anmeldung wird geprüft...
|
||||
} @else {
|
||||
Anmelden
|
||||
}
|
||||
</button>
|
||||
|
||||
<div class="form-actions">
|
||||
<button
|
||||
mat-button
|
||||
type="button"
|
||||
(click)="resendCode()"
|
||||
[disabled]="isSubmitting">
|
||||
Code erneut senden
|
||||
</button>
|
||||
<button mat-button type="button" (click)="editCredentials()">
|
||||
E-Mail ändern
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -1,54 +1,191 @@
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.login-page {
|
||||
display: grid;
|
||||
min-height: calc(100svh - 41px);
|
||||
place-items: center;
|
||||
padding: 48px 20px;
|
||||
background:
|
||||
radial-gradient(
|
||||
circle at top left,
|
||||
rgba(61, 124, 255, 0.12),
|
||||
transparent 34%
|
||||
),
|
||||
linear-gradient(160deg, #f7f9ff 0%, #ffffff 64%);
|
||||
}
|
||||
|
||||
.login-panel {
|
||||
width: min(100%, 480px);
|
||||
padding: 34px;
|
||||
background: var(--sg-surface);
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
box-shadow: var(--sg-shadow-md);
|
||||
}
|
||||
|
||||
.brand-block {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
color: var(--sg-blue-highlight);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-size: 32px;
|
||||
line-height: 1.15;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
.stepper {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr auto;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.step {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.step span {
|
||||
display: grid;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
place-items: center;
|
||||
border: 1px solid var(--sg-border-strong);
|
||||
border-radius: 50%;
|
||||
background: var(--sg-surface);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.step--active {
|
||||
color: var(--sg-text);
|
||||
}
|
||||
|
||||
.step--active span {
|
||||
background: var(--sg-primary);
|
||||
border-color: var(--sg-primary);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.step-line {
|
||||
height: 1px;
|
||||
background: var(--sg-border);
|
||||
}
|
||||
|
||||
.login-form {
|
||||
display: grid;
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.field,
|
||||
.submit-button {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(160deg, #f4f6fb 0%, #e8ecf7 100%);
|
||||
}
|
||||
|
||||
.form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background: white;
|
||||
border: none;
|
||||
border-radius: 12px;
|
||||
box-shadow:
|
||||
0 2px 12px rgba(26, 58, 110, 0.1),
|
||||
0 1px 4px rgba(0, 0, 0, 0.06);
|
||||
gap: 20px;
|
||||
padding: 36px 32px 28px;
|
||||
}
|
||||
|
||||
.form h3 {
|
||||
margin: 0 0 4px;
|
||||
font-weight: 600;
|
||||
color: #1a3a6e;
|
||||
}
|
||||
|
||||
.button {
|
||||
.submit-button {
|
||||
min-height: 48px;
|
||||
min-width: 140px;
|
||||
border-radius: 8px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.02em;
|
||||
border-radius: var(--sg-radius-sm);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.field {
|
||||
width: 400px;
|
||||
.form-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
min-height: 40px;
|
||||
}
|
||||
|
||||
.progress {
|
||||
padding-top: 5px;
|
||||
width: 300px;
|
||||
height: 2em;
|
||||
text-align: center;
|
||||
font-size: small;
|
||||
color: #585f71;
|
||||
.form-actions a,
|
||||
.form-actions button {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.error {
|
||||
.code-intro {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
gap: 14px;
|
||||
padding: 14px;
|
||||
background: var(--sg-surface-soft);
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
}
|
||||
|
||||
.code-intro mat-icon {
|
||||
color: var(--sg-blue-highlight);
|
||||
}
|
||||
|
||||
.code-intro div {
|
||||
display: grid;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
.code-intro span {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 13px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.expiry {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
color: var(--sg-success);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.expiry mat-icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.expiry--expired {
|
||||
color: #ba1a1a;
|
||||
}
|
||||
|
||||
@media (max-width: 560px) {
|
||||
.login-page {
|
||||
padding: 28px 14px;
|
||||
place-items: start center;
|
||||
}
|
||||
|
||||
.login-panel {
|
||||
padding: 24px 18px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
.stepper {
|
||||
grid-template-columns: 1fr;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.step-line {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.form-actions {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,12 @@ import { MatInputModule } from '@angular/material/input';
|
||||
import { CredentialService } from '../../shared/services/credential.service';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { finalize, Subscription } from 'rxjs';
|
||||
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
|
||||
type LoginStep = 'credentials' | 'otk';
|
||||
|
||||
@Component({
|
||||
selector: 'app-app-login',
|
||||
@@ -32,20 +35,30 @@ import { Router, RouterLink } from '@angular/router';
|
||||
standalone: true,
|
||||
})
|
||||
export class AppLoginComponent implements OnInit, OnDestroy {
|
||||
loginForm = new FormGroup({
|
||||
login: new FormControl<string>('', [
|
||||
Validators.required,
|
||||
Validators.minLength(4),
|
||||
]),
|
||||
credentialsForm = new FormGroup({
|
||||
email: new FormControl<string>('', [Validators.required, Validators.email]),
|
||||
password: new FormControl<string>('', [
|
||||
Validators.required,
|
||||
Validators.minLength(4),
|
||||
Validators.minLength(8),
|
||||
]),
|
||||
});
|
||||
|
||||
otkForm = new FormGroup({
|
||||
code: new FormControl<string>('', [
|
||||
Validators.required,
|
||||
Validators.pattern(/^[0-9A-Za-z]{6,10}$/),
|
||||
]),
|
||||
});
|
||||
|
||||
currentStep: LoginStep = 'credentials';
|
||||
showPassword = false;
|
||||
isSubmitting = false;
|
||||
codeExpiresIn = 0;
|
||||
readonly codeLifetimeSeconds = 300;
|
||||
|
||||
subscription?: Subscription;
|
||||
private countdownInterval?: ReturnType<typeof setInterval>;
|
||||
private accountId?: string;
|
||||
|
||||
constructor(
|
||||
protected credentialService: CredentialService,
|
||||
@@ -57,20 +70,22 @@ export class AppLoginComponent implements OnInit, OnDestroy {
|
||||
this.subscription = this.credentialService.validating.subscribe(
|
||||
(validating) => {
|
||||
if (validating) {
|
||||
this.loginForm.disable();
|
||||
this.credentialsForm.disable();
|
||||
this.otkForm.disable();
|
||||
} else {
|
||||
this.loginForm.enable();
|
||||
this.credentialsForm.enable();
|
||||
this.otkForm.enable();
|
||||
this.checkEnter();
|
||||
}
|
||||
},
|
||||
);
|
||||
if (!this.credentialService.validating) {
|
||||
if (!this.credentialService.validating.value) {
|
||||
this.checkEnter();
|
||||
}
|
||||
}
|
||||
|
||||
checkEnter(): void {
|
||||
if (this.credentialService.authenticated.value) {
|
||||
if (this.credentialService.isAuthenticated.value) {
|
||||
this.router.navigate(['/dashboard']);
|
||||
}
|
||||
}
|
||||
@@ -80,13 +95,159 @@ export class AppLoginComponent implements OnInit, OnDestroy {
|
||||
this.subscription.unsubscribe();
|
||||
this.subscription = undefined;
|
||||
}
|
||||
this.stopCountdown();
|
||||
}
|
||||
|
||||
requestOtk() {
|
||||
if (this.credentialsForm.invalid || this.isSubmitting) {
|
||||
this.credentialsForm.markAllAsTouched();
|
||||
return;
|
||||
}
|
||||
|
||||
this.isSubmitting = true;
|
||||
this.credentialsForm.disable();
|
||||
|
||||
const email = this.credentialsForm.controls.email.value ?? '';
|
||||
const password = this.credentialsForm.controls.password.value ?? '';
|
||||
|
||||
this.credentialService
|
||||
.requestOtk(email, password)
|
||||
.pipe(
|
||||
finalize(() => {
|
||||
this.isSubmitting = false;
|
||||
this.credentialsForm.enable();
|
||||
}),
|
||||
)
|
||||
.subscribe({
|
||||
next: (accountId) => {
|
||||
if (!accountId) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.accountId = accountId;
|
||||
this.currentStep = 'otk';
|
||||
this.otkForm.reset();
|
||||
this.startCountdown();
|
||||
this.snackBar.open(
|
||||
'OTK-Code wurde an die E-Mail-Adresse gesendet.',
|
||||
'OK',
|
||||
{
|
||||
duration: 4000,
|
||||
},
|
||||
);
|
||||
},
|
||||
error: (error: HttpErrorResponse) => {
|
||||
this.credentialService.clearLocalAuthState();
|
||||
this.snackBar.open(this.getLoginErrorMessage(error), 'OK', {
|
||||
duration: 5000,
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
resendCode() {
|
||||
if (this.isSubmitting) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.requestOtk();
|
||||
}
|
||||
|
||||
login() {
|
||||
let user = this.loginForm.controls.login.value;
|
||||
let pass = this.loginForm.controls.password.value;
|
||||
if (user && pass) {
|
||||
this.credentialService.loginAccount(user, pass);
|
||||
if (this.otkForm.invalid || this.isSubmitting) {
|
||||
this.otkForm.markAllAsTouched();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.codeExpiresIn <= 0) {
|
||||
this.snackBar.open(
|
||||
'Der Code ist abgelaufen. Bitte fordere einen neuen Code an.',
|
||||
'OK',
|
||||
{ duration: 5000 },
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.accountId) {
|
||||
this.snackBar.open('Bitte fordere zuerst einen neuen Code an.', 'OK', {
|
||||
duration: 5000,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.isSubmitting = true;
|
||||
this.otkForm.disable();
|
||||
|
||||
const email = this.credentialsForm.controls.email.value ?? '';
|
||||
const code = this.otkForm.controls.code.value ?? '';
|
||||
|
||||
this.credentialService
|
||||
.loginWithOtk(this.accountId, email, code)
|
||||
.pipe(
|
||||
finalize(() => {
|
||||
this.isSubmitting = false;
|
||||
this.otkForm.enable();
|
||||
}),
|
||||
)
|
||||
.subscribe({
|
||||
next: () => {
|
||||
this.stopCountdown();
|
||||
this.router.navigate(['/dashboard']);
|
||||
},
|
||||
error: (error: HttpErrorResponse) => {
|
||||
this.credentialService.clearLocalAuthState();
|
||||
this.snackBar.open(this.getLoginErrorMessage(error), 'OK', {
|
||||
duration: 5000,
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
editCredentials() {
|
||||
this.currentStep = 'credentials';
|
||||
this.accountId = undefined;
|
||||
this.stopCountdown();
|
||||
this.otkForm.reset();
|
||||
}
|
||||
|
||||
formatCountdown(): string {
|
||||
const minutes = Math.floor(this.codeExpiresIn / 60);
|
||||
const seconds = this.codeExpiresIn % 60;
|
||||
return `${minutes}:${seconds.toString().padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
private startCountdown(): void {
|
||||
this.stopCountdown();
|
||||
this.codeExpiresIn = this.codeLifetimeSeconds;
|
||||
this.countdownInterval = setInterval(() => {
|
||||
this.codeExpiresIn = Math.max(this.codeExpiresIn - 1, 0);
|
||||
|
||||
if (this.codeExpiresIn === 0) {
|
||||
this.stopCountdown(false);
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
private stopCountdown(reset = true): void {
|
||||
if (this.countdownInterval) {
|
||||
clearInterval(this.countdownInterval);
|
||||
this.countdownInterval = undefined;
|
||||
}
|
||||
|
||||
if (reset) {
|
||||
this.codeExpiresIn = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private getLoginErrorMessage(error: HttpErrorResponse): string {
|
||||
if (error.status === 401) {
|
||||
return 'E-Mail, Passwort oder OTK-Code ist ungültig.';
|
||||
}
|
||||
|
||||
if (error.status === 403) {
|
||||
return 'Dieses Konto ist nicht für die Anmeldung freigeschaltet.';
|
||||
}
|
||||
|
||||
return 'Die Anmeldung konnte nicht abgeschlossen werden. Bitte versuche es erneut.';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ export class AppRegisterComponent implements OnDestroy, OnInit {
|
||||
}
|
||||
|
||||
checkEnter(): void {
|
||||
if (this.credentialService.authenticated.value) {
|
||||
if (this.credentialService.isAuthenticated.value) {
|
||||
this.router.navigate(['/dashboard']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Location } from '@angular/common';
|
||||
import { Component, input, OnInit, signal, inject } from '@angular/core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
@@ -28,7 +27,6 @@ export class ErrorPageComponent implements OnInit {
|
||||
|
||||
isDetailsOpen = signal<boolean>(false);
|
||||
|
||||
private readonly location = inject(Location);
|
||||
private readonly errorService = inject(ErrorService);
|
||||
|
||||
ngOnInit() {
|
||||
@@ -53,6 +51,6 @@ export class ErrorPageComponent implements OnInit {
|
||||
}
|
||||
|
||||
goBack() {
|
||||
this.location.back();
|
||||
window.history.back();
|
||||
}
|
||||
}
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
<h2 mat-dialog-title>
|
||||
{{
|
||||
data.mode === 'create'
|
||||
? 'Organisation erstellen'
|
||||
: 'Organisation bearbeiten'
|
||||
}}
|
||||
</h2>
|
||||
|
||||
<mat-dialog-content>
|
||||
<form class="organization-form" [formGroup]="form" (ngSubmit)="submit()">
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Name</mat-label>
|
||||
<input matInput formControlName="name" />
|
||||
@if (form.controls.name.hasError('required')) {
|
||||
<mat-error>Name ist erforderlich.</mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Externe Institutions-ID</mat-label>
|
||||
<input matInput formControlName="otherInstId" />
|
||||
</mat-form-field>
|
||||
|
||||
@if (data.mode === 'edit') {
|
||||
<mat-checkbox formControlName="deleted">
|
||||
Organisation als gelöscht markieren
|
||||
</mat-checkbox>
|
||||
}
|
||||
</form>
|
||||
</mat-dialog-content>
|
||||
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-button type="button" (click)="close()">Abbrechen</button>
|
||||
<button mat-flat-button color="primary" type="button" (click)="submit()">
|
||||
<mat-icon>save</mat-icon>
|
||||
Speichern
|
||||
</button>
|
||||
</mat-dialog-actions>
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
.organization-form {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
min-width: min(540px, calc(100vw - 64px));
|
||||
padding-top: 4px;
|
||||
}
|
||||
|
||||
.organization-form mat-form-field {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
mat-dialog-actions {
|
||||
padding: 12px 24px 20px;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.organization-form {
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import {
|
||||
FormControl,
|
||||
FormGroup,
|
||||
ReactiveFormsModule,
|
||||
Validators,
|
||||
} from '@angular/forms';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import {
|
||||
MAT_DIALOG_DATA,
|
||||
MatDialogModule,
|
||||
MatDialogRef,
|
||||
} from '@angular/material/dialog';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import type {
|
||||
CreateOrganizationPayload,
|
||||
OrganizationProfile,
|
||||
UpdateOrganizationPayload,
|
||||
} from '../../../shared/services/organization-management.service';
|
||||
|
||||
export interface OrganizationDialogData {
|
||||
mode: 'create' | 'edit';
|
||||
organization?: OrganizationProfile;
|
||||
}
|
||||
|
||||
export type OrganizationDialogResult =
|
||||
| { mode: 'create'; payload: CreateOrganizationPayload }
|
||||
| {
|
||||
mode: 'edit';
|
||||
organizationId: string;
|
||||
payload: UpdateOrganizationPayload;
|
||||
};
|
||||
|
||||
@Component({
|
||||
selector: 'app-organization-dialog',
|
||||
imports: [
|
||||
CommonModule,
|
||||
ReactiveFormsModule,
|
||||
MatButtonModule,
|
||||
MatCheckboxModule,
|
||||
MatDialogModule,
|
||||
MatFormFieldModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
],
|
||||
templateUrl: './organization-dialog.component.html',
|
||||
styleUrl: './organization-dialog.component.scss',
|
||||
standalone: true,
|
||||
})
|
||||
export class OrganizationDialogComponent {
|
||||
private readonly dialogRef =
|
||||
inject<
|
||||
MatDialogRef<
|
||||
OrganizationDialogComponent,
|
||||
OrganizationDialogResult | undefined
|
||||
>
|
||||
>(MatDialogRef);
|
||||
protected readonly data = inject<OrganizationDialogData>(MAT_DIALOG_DATA);
|
||||
|
||||
protected readonly form = new FormGroup({
|
||||
name: new FormControl(this.data.organization?.name ?? '', {
|
||||
nonNullable: true,
|
||||
validators: [Validators.required],
|
||||
}),
|
||||
otherInstId: new FormControl(this.data.organization?.other_inst_id ?? '', {
|
||||
nonNullable: true,
|
||||
}),
|
||||
deleted: new FormControl(this.data.organization?.deleted ?? false, {
|
||||
nonNullable: true,
|
||||
}),
|
||||
});
|
||||
|
||||
protected submit(): void {
|
||||
if (this.form.invalid) {
|
||||
this.form.markAllAsTouched();
|
||||
return;
|
||||
}
|
||||
|
||||
const value = this.form.getRawValue();
|
||||
const payload = {
|
||||
name: value.name.trim(),
|
||||
other_inst_id: value.otherInstId.trim(),
|
||||
};
|
||||
|
||||
if (this.data.mode === 'create') {
|
||||
this.dialogRef.close({ mode: 'create', payload });
|
||||
return;
|
||||
}
|
||||
|
||||
this.dialogRef.close({
|
||||
mode: 'edit',
|
||||
organizationId: this.data.organization!.id,
|
||||
payload: { ...payload, deleted: value.deleted },
|
||||
});
|
||||
}
|
||||
|
||||
protected close(): void {
|
||||
this.dialogRef.close(undefined);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<section class="organizations-page">
|
||||
<header class="page-header">
|
||||
<div>
|
||||
<h1>Organisationen</h1>
|
||||
<p>Mandanten, externe Institutions-IDs und Status verwalten.</p>
|
||||
</div>
|
||||
<button
|
||||
mat-flat-button
|
||||
color="primary"
|
||||
type="button"
|
||||
(click)="startCreate()">
|
||||
<mat-icon>add_business</mat-icon>
|
||||
Neue Organisation
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<section class="table-panel">
|
||||
<div class="table-header">
|
||||
<strong>{{ total }} Organisationen</strong>
|
||||
@if (isLoading) {
|
||||
<span>Wird geladen...</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Externe Institutions-ID</th>
|
||||
<th>Mitglieder</th>
|
||||
<th>Status</th>
|
||||
<th>Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (organization of organizations; track organization.id) {
|
||||
<tr [class.deleted]="organization.deleted">
|
||||
<td>
|
||||
<button
|
||||
class="link-button"
|
||||
type="button"
|
||||
(click)="startEdit(organization)">
|
||||
{{ organization.name }}
|
||||
</button>
|
||||
</td>
|
||||
<td>{{ organization.other_inst_id || '–' }}</td>
|
||||
<td>{{ organization.member_count }}</td>
|
||||
<td>
|
||||
<span
|
||||
class="status"
|
||||
[class.status--deleted]="organization.deleted">
|
||||
{{ organization.deleted ? 'deleted' : 'active' }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<div class="row-actions">
|
||||
<button
|
||||
mat-icon-button
|
||||
type="button"
|
||||
aria-label="Bearbeiten"
|
||||
(click)="startEdit(organization)">
|
||||
<mat-icon>edit</mat-icon>
|
||||
</button>
|
||||
<button
|
||||
mat-icon-button
|
||||
type="button"
|
||||
aria-label="Deaktivieren"
|
||||
[disabled]="organization.deleted"
|
||||
(click)="deleteOrganization(organization)">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
} @empty {
|
||||
<tr>
|
||||
<td colspan="6" class="empty">Keine Organisationen gefunden.</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<button
|
||||
mat-button
|
||||
type="button"
|
||||
[disabled]="!canPageBack"
|
||||
(click)="loadOrganizations(page - 1)">
|
||||
<mat-icon>chevron_left</mat-icon>
|
||||
Zurück
|
||||
</button>
|
||||
<span>Seite {{ page + 1 }}</span>
|
||||
<button
|
||||
mat-button
|
||||
type="button"
|
||||
[disabled]="!canPageForward"
|
||||
(click)="loadOrganizations(page + 1)">
|
||||
Weiter
|
||||
<mat-icon>chevron_right</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
@@ -0,0 +1,130 @@
|
||||
.organizations-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.page-header,
|
||||
.table-header,
|
||||
.pagination,
|
||||
.row-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
h1,
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.page-header p,
|
||||
.table-header span {
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.page-header p {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.table-panel {
|
||||
overflow: hidden;
|
||||
border: 1px solid #d7dde6;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.table-header {
|
||||
justify-content: space-between;
|
||||
padding: 16px;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.table-wrap {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 12px 16px;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid #edf1f7;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
th {
|
||||
color: #475569;
|
||||
font-weight: 700;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
tr.deleted {
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.identifier {
|
||||
font-family: monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.link-button {
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: #1d4ed8;
|
||||
padding: 0;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.status {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 24px;
|
||||
border-radius: 999px;
|
||||
padding: 2px 10px;
|
||||
background: #dcfce7;
|
||||
color: #166534;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.status--deleted {
|
||||
background: #fee2e2;
|
||||
color: #991b1b;
|
||||
}
|
||||
|
||||
.row-actions {
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.empty {
|
||||
color: #64748b;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pagination {
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
padding: 12px 16px;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.organizations-page {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, OnInit, inject } from '@angular/core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { finalize } from 'rxjs';
|
||||
import {
|
||||
OrganizationManagementService,
|
||||
OrganizationProfile,
|
||||
} from '../../shared/services/organization-management.service';
|
||||
import type {
|
||||
OrganizationDialogComponent,
|
||||
OrganizationDialogData,
|
||||
OrganizationDialogResult,
|
||||
} from './organization-dialog/organization-dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-organizations',
|
||||
imports: [
|
||||
CommonModule,
|
||||
MatButtonModule,
|
||||
MatDialogModule,
|
||||
MatIconModule,
|
||||
MatSnackBarModule,
|
||||
],
|
||||
templateUrl: './organizations.component.html',
|
||||
styleUrl: './organizations.component.scss',
|
||||
standalone: true,
|
||||
})
|
||||
export class OrganizationsComponent implements OnInit {
|
||||
private readonly organizationService = inject(OrganizationManagementService);
|
||||
private readonly dialog = inject(MatDialog);
|
||||
private readonly snackBar = inject(MatSnackBar);
|
||||
|
||||
protected organizations: OrganizationProfile[] = [];
|
||||
protected total = 0;
|
||||
protected page = 0;
|
||||
protected readonly pageSize = 10;
|
||||
protected isLoading = false;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loadOrganizations();
|
||||
}
|
||||
|
||||
protected loadOrganizations(page = this.page): void {
|
||||
this.page = page;
|
||||
this.isLoading = true;
|
||||
this.organizationService
|
||||
.getOrganizations(page, this.pageSize)
|
||||
.pipe(finalize(() => (this.isLoading = false)))
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
this.organizations = result.items;
|
||||
this.total = result.total;
|
||||
},
|
||||
error: () =>
|
||||
this.showError('Organisationen konnten nicht geladen werden.'),
|
||||
});
|
||||
}
|
||||
|
||||
protected startCreate(): void {
|
||||
this.openDialog({ mode: 'create' });
|
||||
}
|
||||
|
||||
protected startEdit(organization: OrganizationProfile): void {
|
||||
this.openDialog({ mode: 'edit', organization });
|
||||
}
|
||||
|
||||
protected deleteOrganization(organization: OrganizationProfile): void {
|
||||
if (organization.deleted) return;
|
||||
|
||||
import('../../shared/ui/confirmation-dialog/confirmation-dialog.component').then(
|
||||
({ ConfirmationDialogComponent }) => {
|
||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: {
|
||||
title: 'Organisation deaktivieren',
|
||||
message: `Möchtest Du die Organisation „${organization.name}“ wirklich deaktivieren?`,
|
||||
confirmText: 'Deaktivieren',
|
||||
cancelText: 'Abbrechen',
|
||||
},
|
||||
});
|
||||
|
||||
dialogRef.componentInstance.confirmDelete.subscribe(() => {
|
||||
this.softDeleteOrganization(organization);
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
private softDeleteOrganization(organization: OrganizationProfile): void {
|
||||
this.organizationService.deleteOrganization(organization.id).subscribe({
|
||||
next: () => {
|
||||
this.snackBar.open('Organisation wurde deaktiviert.', 'OK', {
|
||||
duration: 3000,
|
||||
});
|
||||
this.loadOrganizations();
|
||||
},
|
||||
error: () =>
|
||||
this.showError('Organisation konnte nicht deaktiviert werden.'),
|
||||
});
|
||||
}
|
||||
|
||||
protected get canPageBack(): boolean {
|
||||
return this.page > 0;
|
||||
}
|
||||
|
||||
protected get canPageForward(): boolean {
|
||||
return (this.page + 1) * this.pageSize < this.total;
|
||||
}
|
||||
|
||||
private openDialog(data: OrganizationDialogData): void {
|
||||
import('./organization-dialog/organization-dialog.component').then(
|
||||
({ OrganizationDialogComponent }) => {
|
||||
const dialogRef = this.dialog.open<
|
||||
OrganizationDialogComponent,
|
||||
OrganizationDialogData,
|
||||
OrganizationDialogResult | undefined
|
||||
>(OrganizationDialogComponent, {
|
||||
width: '620px',
|
||||
maxWidth: 'calc(100vw - 32px)',
|
||||
data,
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe((result) => {
|
||||
if (result) this.save(result);
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
private save(result: OrganizationDialogResult): void {
|
||||
const request =
|
||||
result.mode === 'create'
|
||||
? this.organizationService.createOrganization(result.payload)
|
||||
: this.organizationService.updateOrganization(
|
||||
result.organizationId,
|
||||
result.payload,
|
||||
);
|
||||
|
||||
request.subscribe({
|
||||
next: () => {
|
||||
this.snackBar.open('Organisation wurde gespeichert.', 'OK', {
|
||||
duration: 3000,
|
||||
});
|
||||
this.loadOrganizations(0);
|
||||
},
|
||||
error: (error) =>
|
||||
this.showError(
|
||||
error.status === 409
|
||||
? 'Eine Organisation mit diesem Namen existiert bereits.'
|
||||
: 'Organisation konnte nicht gespeichert werden.',
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
private showError(message: string): void {
|
||||
this.snackBar.open(message, 'OK', { duration: 5000 });
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@if (selectedPatent.assignees.length > 0) {
|
||||
@if ((selectedPatent.assignees?.length ?? 0) > 0) {
|
||||
<div class="detail-section">
|
||||
<h4>Anmelder</h4>
|
||||
<ul class="tag-list">
|
||||
@@ -101,7 +101,7 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (selectedPatent.ipc_descriptions.length > 0) {
|
||||
@if ((selectedPatent.ipc_descriptions?.length ?? 0) > 0) {
|
||||
<div
|
||||
class="detail-section classification-section classification-section--ipc">
|
||||
<h4>Klassifikation (IPC)</h4>
|
||||
@@ -166,7 +166,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
} @else if (selectedPatent.ipc.length > 0) {
|
||||
} @else if ((selectedPatent.ipc?.length ?? 0) > 0) {
|
||||
<div class="detail-section">
|
||||
<h4>Klassifikation (IPC)</h4>
|
||||
<ul class="tag-list tag-list--compact">
|
||||
@@ -177,7 +177,7 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (selectedPatent.cpc_descriptions.length > 0) {
|
||||
@if ((selectedPatent.cpc_descriptions?.length ?? 0) > 0) {
|
||||
<div
|
||||
class="detail-section classification-section classification-section--cpc">
|
||||
<h4>Klassifikation (CPC)</h4>
|
||||
@@ -242,7 +242,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
} @else if (selectedPatent.cpc.length > 0) {
|
||||
} @else if ((selectedPatent.cpc?.length ?? 0) > 0) {
|
||||
<div class="detail-section">
|
||||
<h4>Klassifikation (CPC)</h4>
|
||||
<ul class="tag-list tag-list--compact">
|
||||
@@ -284,7 +284,7 @@
|
||||
<mat-divider />
|
||||
<div class="card-metadata">
|
||||
<span>{{ patent.patent_id }}</span>
|
||||
<span>{{ formatDate(patent.publication_date) }}</span>
|
||||
<span>{{ formatDate(patent.publication_date ?? '') }}</span>
|
||||
</div>
|
||||
<mat-divider />
|
||||
</mat-card-content>
|
||||
|
||||
@@ -13,7 +13,8 @@ import { MatDividerModule } from '@angular/material/divider';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { debounceTime, distinctUntilChanged, Subject } from 'rxjs';
|
||||
import { PatentsService } from '../../api/api/patents.service';
|
||||
import { PatentEntry, IpcClassification } from '../../api/model/patentEntry';
|
||||
import { PatentEntry } from '../../api/model/patentEntry';
|
||||
import { IpcClassification } from '../../api';
|
||||
|
||||
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||
type ClassificationSystem = 'IPC' | 'CPC';
|
||||
@@ -332,9 +333,9 @@ export class PatentsComponent implements OnInit {
|
||||
seen.add(norm);
|
||||
rows.push({ label, value });
|
||||
};
|
||||
addRow('Sektion', entry.section);
|
||||
addRow('Klasse', entry.class);
|
||||
addRow('Unterklasse', entry.subclass);
|
||||
addRow('Sektion', entry.section ?? null);
|
||||
addRow('Klasse', entry.class ?? null);
|
||||
addRow('Unterklasse', entry.subclass ?? null);
|
||||
return rows;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { CustomAuthor, DehydratedInstitution, WorkTopic } from '../../api';
|
||||
import { SkTextDirective } from '../../custom-directives/sk-text.directive';
|
||||
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
|
||||
import { topicHierarchyColor } from '../../shared/utils/topic-colors';
|
||||
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
||||
|
||||
@Component({
|
||||
selector: 'app-person-card',
|
||||
|
||||
@@ -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 { TopicLegendComponent } from '../../shared/ui/topic-legend/topic-legend.component';
|
||||
import { topicHierarchyColor } from '../../shared/utils/topic-colors';
|
||||
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
||||
import {
|
||||
buildTopicLegendGroups,
|
||||
getTopicLegendFieldId,
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
TopicLegendSubfieldSelection,
|
||||
toggleTopicLegendFieldSelection,
|
||||
toggleTopicLegendSubfieldSelection,
|
||||
} from '../../shared/utils/topic-legend';
|
||||
} from '../../resolvers/utils/topic-legend';
|
||||
|
||||
interface InterestTag {
|
||||
id: string;
|
||||
|
||||
@@ -23,7 +23,7 @@ import { TopicsService } from '../../api/api/topics.service';
|
||||
import { TopicHierarchyComponent } from '../topic-hierarchy/topic-hierarchy.component';
|
||||
import { PersonCardComponent } from '../person-card/person-card.component';
|
||||
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
|
||||
import { topicHierarchyColor } from '../../shared/utils/topic-colors';
|
||||
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
||||
import { SharedStateService } from '../../shared/services/shared-state.service';
|
||||
import { PaginationService } from '../../shared/services/pagination.service';
|
||||
import {
|
||||
|
||||
+4
-4
@@ -14,7 +14,7 @@ import {
|
||||
} from '@angular/core';
|
||||
import { TopicChipComponent } from '../../../../shared/ui/topic-chip/topic-chip.component';
|
||||
import { TopicLegendComponent } from '../../../../shared/ui/topic-legend/topic-legend.component';
|
||||
import { topicHierarchyColor } from '../../../../shared/utils/topic-colors';
|
||||
import { topicHierarchyColor } from '../../../../resolvers/utils/topic-colors';
|
||||
import {
|
||||
buildTopicLegendGroups,
|
||||
getTopicLegendFieldId,
|
||||
@@ -24,8 +24,8 @@ import {
|
||||
TopicLegendTopic,
|
||||
toggleTopicLegendFieldSelection,
|
||||
toggleTopicLegendSubfieldSelection,
|
||||
} from '../../../../shared/utils/topic-legend';
|
||||
import { buildTopicHierarchyTooltip } from '../../../../shared/utils/topic-tooltip';
|
||||
} from '../../../../resolvers/utils/topic-legend';
|
||||
import { buildTopicHierarchyTooltip } from '../../../../resolvers/utils/topic-tooltip';
|
||||
|
||||
export interface TopicTimelineTopic {
|
||||
id?: string;
|
||||
@@ -103,7 +103,7 @@ interface TimelineScrollAnchor {
|
||||
})
|
||||
export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
||||
@ViewChild('timelineWrapper')
|
||||
private timelineWrapper?: ElementRef<HTMLDivElement>;
|
||||
private readonly timelineWrapper?: ElementRef<HTMLDivElement>;
|
||||
@Input() elements: TopicTimelineElement[] = [];
|
||||
@Input() loading = false;
|
||||
@Input() loadFailed = false;
|
||||
|
||||
@@ -6,9 +6,6 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { combineLatest, distinctUntilChanged, map } from 'rxjs';
|
||||
|
||||
import { TopicCount, TopicsByYear, WorksService } from '../../api';
|
||||
import { topicHierarchyColor } from '../../shared/utils/topic-colors';
|
||||
import { TopicLegendTopic } from '../../shared/utils/topic-legend';
|
||||
import { buildTopicHierarchyTooltip } from '../../shared/utils/topic-tooltip';
|
||||
import {
|
||||
ResearchTimelineComponent,
|
||||
TimelineViewMode,
|
||||
@@ -17,6 +14,9 @@ import {
|
||||
TopicTimelineElement,
|
||||
TopicTimelineTopic,
|
||||
} from './components/research-timeline/research-timeline.component';
|
||||
import { TopicLegendTopic } from '../../resolvers/utils/topic-legend';
|
||||
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
||||
import { buildTopicHierarchyTooltip } from '../../resolvers/utils/topic-tooltip';
|
||||
|
||||
export interface WordCloudWord {
|
||||
name: string;
|
||||
|
||||
@@ -2,7 +2,8 @@ import { Component, OnInit, inject } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { PatentsService } from '../../api/api/patents.service';
|
||||
import { PatentEntry, IpcClassification } from '../../api/model/patentEntry';
|
||||
import { PatentEntry } from '../../api/model/patentEntry';
|
||||
import { IpcClassification } from '../../api';
|
||||
|
||||
type SortMode = 'date' | 'title';
|
||||
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||
|
||||
@@ -40,10 +40,10 @@ import {
|
||||
|
||||
import { Work, WorksService, WorkTopic } 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';
|
||||
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 InstitutionAutocompleteOption {
|
||||
id?: string | null;
|
||||
|
||||
@@ -53,14 +53,18 @@
|
||||
<div class="metric-item">
|
||||
<mat-icon>calendar_today</mat-icon>
|
||||
<div class="metric-content">
|
||||
<strong>{{ getStartDate() || 'N/A' }}</strong>
|
||||
<strong>{{
|
||||
bundProject.funding_start_date | date: 'dd.MM.yyyy'
|
||||
}}</strong>
|
||||
<span>Förderbeginn</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="metric-item">
|
||||
<mat-icon>event_busy</mat-icon>
|
||||
<div class="metric-content">
|
||||
<strong>{{ getFundingStatus(getEndDate()) }}</strong>
|
||||
<strong>{{
|
||||
getFundingStatus(bundProject.funding_end_date)
|
||||
}}</strong>
|
||||
<span>Förderende</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -77,7 +81,10 @@
|
||||
<div class="metric-item">
|
||||
<mat-icon>paid</mat-icon>
|
||||
<div class="metric-content">
|
||||
<strong>{{ getFundingAmountDisplay() }}</strong>
|
||||
<strong>{{
|
||||
bundProject.funding_amount
|
||||
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
|
||||
}}</strong>
|
||||
<span>Fördersumme</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -351,7 +358,12 @@
|
||||
@if (bundProject.funding_amount) {
|
||||
<div class="detail-row">
|
||||
<dt>Fördersumme</dt>
|
||||
<dd>{{ getFundingAmountDisplay() }}</dd>
|
||||
<dd>
|
||||
{{
|
||||
bundProject.funding_amount
|
||||
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
|
||||
}}
|
||||
</dd>
|
||||
</div>
|
||||
}
|
||||
@if (bundProject.funding_amount) {
|
||||
@@ -374,12 +386,16 @@
|
||||
<dt>Förderende</dt>
|
||||
<dd>{{ getFundingStatus(getEndDate()) }}</dd>
|
||||
</div> -->
|
||||
@if (getDuration()) {
|
||||
<div class="detail-row">
|
||||
<dt>Laufzeit</dt>
|
||||
<dd>{{ getDuration() }}</dd>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="detail-row">
|
||||
<dt>Laufzeit</dt>
|
||||
<dd>
|
||||
von
|
||||
{{ bundProject.funding_start_date | date: 'dd.MM.yyyy' }} bis
|
||||
{{ bundProject.funding_end_date | date: 'dd.MM.yyyy' }}
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
@if (bundProject.joint_project) {
|
||||
<div class="detail-row">
|
||||
<dt>Gemeinschaftsprojekt</dt>
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { Component, OnInit, inject } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { BundProjectDetails } from '../../../api/model/bundProjectDetails';
|
||||
import { Router } from '@angular/router';
|
||||
import { formatGermanDate } from '../../../shared/utils/formatters';
|
||||
|
||||
@Component({
|
||||
selector: 'app-bund-details',
|
||||
standalone: true,
|
||||
@@ -14,10 +13,10 @@ import { formatGermanDate } from '../../../shared/utils/formatters';
|
||||
styleUrl: './bund-details.component.scss',
|
||||
})
|
||||
export class BundDetailsComponent implements OnInit {
|
||||
private route = inject(ActivatedRoute);
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
bundProject: BundProjectDetails | undefined;
|
||||
|
||||
constructor(private router: Router) {}
|
||||
constructor(private readonly router: Router) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.route.data.subscribe(({ bundSingleProject }) => {
|
||||
@@ -38,25 +37,13 @@ export class BundDetailsComponent implements OnInit {
|
||||
getFundingStatus(fundingEndDate: string | null | undefined): string {
|
||||
if (!fundingEndDate) return 'N/A';
|
||||
if (fundingEndDate === '2999') return 'laufend';
|
||||
const year = parseInt(fundingEndDate, 10);
|
||||
if (isNaN(year)) return fundingEndDate;
|
||||
const year = Number.parseInt(fundingEndDate, 10);
|
||||
if (Number.isNaN(year)) return fundingEndDate;
|
||||
return year >= new Date().getFullYear()
|
||||
? `${fundingEndDate}`
|
||||
: `${fundingEndDate}`;
|
||||
}
|
||||
|
||||
formatCurrency(amount: number | null | undefined): string {
|
||||
if (amount === null || amount === undefined) return 'N/A';
|
||||
|
||||
// Format as Euro with thousands separators
|
||||
return new Intl.NumberFormat('de-DE', {
|
||||
style: 'currency',
|
||||
currency: 'EUR',
|
||||
minimumFractionDigits: 0,
|
||||
maximumFractionDigits: 0,
|
||||
}).format(amount);
|
||||
}
|
||||
|
||||
searchForPersonName(personName: string): void {
|
||||
this.router.navigate(['/persons'], {
|
||||
queryParams: {
|
||||
@@ -110,22 +97,7 @@ export class BundDetailsComponent implements OnInit {
|
||||
getAssociatedPersons(): string[] {
|
||||
return this.bundProject?.associated_persons || [];
|
||||
}
|
||||
getStartDate(): string {
|
||||
return formatGermanDate(this.bundProject?.funding_start_date ?? '');
|
||||
}
|
||||
|
||||
getEndDate(): string {
|
||||
return formatGermanDate(this.bundProject?.funding_end_date ?? '');
|
||||
}
|
||||
|
||||
getDuration(): string {
|
||||
const start = this.bundProject?.funding_start_date;
|
||||
const end = this.bundProject?.funding_end_date;
|
||||
|
||||
if (!start || !end) return '';
|
||||
|
||||
return `von ${formatGermanDate(start)} bis ${formatGermanDate(end)}`;
|
||||
}
|
||||
/**
|
||||
* All institutions as a simple list.
|
||||
*/
|
||||
@@ -140,17 +112,10 @@ export class BundDetailsComponent implements OnInit {
|
||||
return this.bundProject?.is_new === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get display name for funding amount
|
||||
*/
|
||||
getFundingAmountDisplay(): string {
|
||||
if (!this.bundProject?.funding_amount) return 'N/A';
|
||||
return this.formatCurrency(this.bundProject.funding_amount);
|
||||
}
|
||||
getStatusDisplay(fundingEndDate: string | null | undefined): string {
|
||||
if (!fundingEndDate) return 'N/A';
|
||||
if (fundingEndDate === '2999') return 'Laufend';
|
||||
const year = parseInt(fundingEndDate, 10);
|
||||
const year = Number.parseInt(fundingEndDate, 10);
|
||||
return year >= new Date().getFullYear() ? `Laufend` : `Abgeschlossen`;
|
||||
}
|
||||
getStatusColor(status: string | null | undefined): string {
|
||||
|
||||
@@ -72,14 +72,14 @@
|
||||
<div class="metric-item">
|
||||
<mat-icon>calendar_today</mat-icon>
|
||||
<div class="metric-content">
|
||||
<strong>{{ formatDate(euProject.startDate) || 'N/A' }}</strong>
|
||||
<strong>{{ euProject.startDate | date: 'dd.MM.yyyy' }}</strong>
|
||||
<span>Förderbeginn</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="metric-item">
|
||||
<mat-icon>event_busy</mat-icon>
|
||||
<div class="metric-content">
|
||||
<strong>{{ formatDate(euProject.endDate) || 'N/A' }}</strong>
|
||||
<strong>{{ euProject.endDate | date: 'dd.MM.yyyy' }}</strong>
|
||||
<span>Förderende</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -94,7 +94,10 @@
|
||||
<div class="metric-item">
|
||||
<mat-icon>euro_symbol</mat-icon>
|
||||
<div class="metric-content">
|
||||
<strong>{{ formatCurr(euProject.ecMaxContribution) }}</strong>
|
||||
<strong>{{
|
||||
euProject.ecMaxContribution
|
||||
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
|
||||
}}</strong>
|
||||
<span>EU-Beitrag</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -103,7 +106,10 @@
|
||||
<div class="metric-item">
|
||||
<mat-icon>attach_money</mat-icon>
|
||||
<div class="metric-content">
|
||||
<strong>{{ formatCurr(euProject.totalCost) }}</strong>
|
||||
<strong>{{
|
||||
euProject.totalCost
|
||||
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
|
||||
}}</strong>
|
||||
<span>Gesamtkosten</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -368,19 +374,31 @@
|
||||
@if (euProject.ecMaxContribution) {
|
||||
<div class="detail-row">
|
||||
<dt>Max. EU-Beitrag</dt>
|
||||
<dd>{{ formatCurr(euProject.ecMaxContribution) }}</dd>
|
||||
<dd>
|
||||
{{
|
||||
euProject.ecMaxContribution
|
||||
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
|
||||
}}
|
||||
</dd>
|
||||
</div>
|
||||
}
|
||||
@if (euProject.totalCost) {
|
||||
<div class="detail-row">
|
||||
<dt>Gesamtkosten</dt>
|
||||
<dd>{{ formatCurr(euProject.totalCost) }}</dd>
|
||||
<dd>
|
||||
{{
|
||||
euProject.totalCost
|
||||
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
|
||||
}}
|
||||
</dd>
|
||||
</div>
|
||||
}
|
||||
@if (euProject.ecSignatureDate) {
|
||||
<div class="detail-row">
|
||||
<dt>EU-Unterzeichnung</dt>
|
||||
<dd>{{ formatDate(euProject.ecSignatureDate) }}</dd>
|
||||
<dd>
|
||||
{{ euProject.ecSignatureDate | date: 'dd.MM.yyyy' }}
|
||||
</dd>
|
||||
</div>
|
||||
}
|
||||
@if (euProject.nature) {
|
||||
@@ -402,22 +420,25 @@
|
||||
<div class="detail-row">
|
||||
<dt>Laufzeit</dt>
|
||||
<dd>
|
||||
{{
|
||||
getDuration(euProject.startDate, euProject.endDate) ||
|
||||
'N/A'
|
||||
}}
|
||||
von
|
||||
{{ euProject.startDate | date: 'dd.MM.yyyy' }}
|
||||
bis {{ euProject.endDate | date: 'dd.MM.yyyy' }}
|
||||
</dd>
|
||||
</div>
|
||||
@if (euProject.ecSignatureDate) {
|
||||
<div class="detail-row">
|
||||
<dt>EU-Unterzeichnung</dt>
|
||||
<dd>{{ formatDate(euProject.ecSignatureDate) }}</dd>
|
||||
<dd>
|
||||
{{ euProject.ecSignatureDate | date: 'dd.MM.yyyy' }}
|
||||
</dd>
|
||||
</div>
|
||||
}
|
||||
@if (euProject.contentUpdateDate) {
|
||||
<div class="detail-row">
|
||||
<dt>Letzte Aktualisierung</dt>
|
||||
<dd>{{ formatDate(euProject.contentUpdateDate) }}</dd>
|
||||
<dd>
|
||||
{{ euProject.contentUpdateDate | date: 'dd.MM.yyyy' }}
|
||||
</dd>
|
||||
</div>
|
||||
}
|
||||
@if (euProject.grantDoi) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// eu-details.component.ts (refactored)
|
||||
import { Component, OnInit, inject, OnDestroy } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { CommonModule, CurrencyPipe } from '@angular/common';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatChipsModule } from '@angular/material/chips';
|
||||
@@ -9,16 +9,13 @@ import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { Subscription } from 'rxjs';
|
||||
import {
|
||||
formatGermanDate,
|
||||
formatCurrency,
|
||||
} from '../../../shared/utils/formatters';
|
||||
import { EuProjectData } from '../../../api/model/euProjectData';
|
||||
import { TopicChipComponent } from '../../../shared/ui/topic-chip/topic-chip.component';
|
||||
import { OrganizationsTableComponent } from './organizations-table/organizations-table/organizations-table.component';
|
||||
import { PublicationsTableComponent } from './publications-table/publications-table.component';
|
||||
import { PatentsCardsComponent } from './patents-cards/patents-cards.component';
|
||||
import { DeliverablesCardsComponent } from './deliverables-cards/deliverables-cards.component';
|
||||
|
||||
export type TabType =
|
||||
| 'overview'
|
||||
| 'organizations'
|
||||
@@ -42,13 +39,14 @@ export type TabType =
|
||||
PublicationsTableComponent,
|
||||
PatentsCardsComponent,
|
||||
DeliverablesCardsComponent,
|
||||
CurrencyPipe,
|
||||
],
|
||||
templateUrl: './eu-details.component.html',
|
||||
styleUrl: './eu-details.component.scss',
|
||||
})
|
||||
export class EuDetailsComponent implements OnInit, OnDestroy {
|
||||
private route = inject(ActivatedRoute);
|
||||
private router = inject(Router);
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
// Data
|
||||
euProject: EuProjectData | undefined;
|
||||
@@ -320,30 +318,11 @@ export class EuDetailsComponent implements OnInit, OnDestroy {
|
||||
const end = new Date(endDate);
|
||||
const now = new Date();
|
||||
|
||||
if (isNaN(end.getTime())) return endDate;
|
||||
if (Number.isNaN(end.getTime())) return endDate;
|
||||
|
||||
return end >= now ? 'Laufend' : 'Abgeschlossen';
|
||||
}
|
||||
|
||||
getDuration(start: string | undefined, end: string | undefined): string {
|
||||
if (!start || !end) return '';
|
||||
return `von ${formatGermanDate(start)} bis ${formatGermanDate(end)}`;
|
||||
}
|
||||
|
||||
formatDate(date: string | undefined): string | undefined {
|
||||
if (date) {
|
||||
return formatGermanDate(date);
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
formatCurr(value: number | undefined | null): string | null | undefined {
|
||||
if (value) {
|
||||
return formatCurrency(value);
|
||||
}
|
||||
return String(value);
|
||||
}
|
||||
|
||||
getStatusColor(status: string | null | undefined): string {
|
||||
if (!status) return '#95a5a6';
|
||||
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@
|
||||
<td mat-cell *matCellDef="let org">
|
||||
@if (org.ecContribution) {
|
||||
<span class="currency-value">{{
|
||||
formatCurr(org.ecContribution)
|
||||
org.ecContribution | currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
|
||||
}}</span>
|
||||
} @else {
|
||||
<span class="empty-value">—</span>
|
||||
|
||||
+3
-9
@@ -1,18 +1,18 @@
|
||||
import { Component, inject, Input } from '@angular/core';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { Router } from '@angular/router';
|
||||
import { formatCurrency } from '../../../../../shared/utils/formatters';
|
||||
import { MatIcon } from '@angular/material/icon';
|
||||
import { MatCard } from '@angular/material/card';
|
||||
import { HEUOrganization } from '../../../../../api';
|
||||
import { CurrencyPipe } from '@angular/common';
|
||||
@Component({
|
||||
selector: 'app-organizations-table',
|
||||
imports: [MatTableModule, MatIcon, MatCard],
|
||||
imports: [MatTableModule, MatIcon, MatCard, CurrencyPipe],
|
||||
templateUrl: './organizations-table.component.html',
|
||||
styleUrl: './organizations-table.component.scss',
|
||||
})
|
||||
export class OrganizationsTableComponent {
|
||||
private router = inject(Router);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
@Input() orgs!: HEUOrganization[];
|
||||
@Input() showHeader: boolean = true;
|
||||
@@ -46,10 +46,4 @@ export class OrganizationsTableComponent {
|
||||
getOrgsCount(): number {
|
||||
return this.orgs?.length || 0;
|
||||
}
|
||||
formatCurr(value: number | undefined | null) {
|
||||
if (value) {
|
||||
return formatCurrency(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@
|
||||
<mat-divider />
|
||||
<div class="card-metadata">
|
||||
<span
|
||||
>Von {{ fundingProject.start_date | date }} bis
|
||||
{{ fundingProject.end_date | date }}</span
|
||||
>Von {{ fundingProject.start_date | date: 'dd.MM.yyyy' }} bis
|
||||
{{ fundingProject.end_date | date: 'dd.MM.yyyy' }}</span
|
||||
>
|
||||
</div>
|
||||
<mat-divider />
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
WorkTopic,
|
||||
} 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 DetailLink {
|
||||
label: string;
|
||||
|
||||
@@ -6,7 +6,7 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatRadioModule } from '@angular/material/radio';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { TopicsService } from '../../api/api/topics.service';
|
||||
import { topicHierarchyColor } from '../../shared/utils/topic-colors';
|
||||
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
||||
import { combineLatest, of } from 'rxjs';
|
||||
import { toObservable } from '@angular/core/rxjs-interop';
|
||||
import {
|
||||
|
||||
@@ -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<AccountProfile> = (route, state) => {
|
||||
return inject(AccountManagementService).getCurrentAccount();
|
||||
};
|
||||
@@ -1,23 +1,35 @@
|
||||
import { inject } from '@angular/core';
|
||||
import { CanActivateFn, Router } from '@angular/router';
|
||||
import { catchError, filter, of, switchMap, take } from 'rxjs';
|
||||
import { CredentialService } from '../services/credential.service';
|
||||
import { Observable, of, switchMap, takeWhile } from 'rxjs';
|
||||
|
||||
export const adminGuard: CanActivateFn = (route, state) => {
|
||||
let credentialService = inject(CredentialService);
|
||||
let router = inject(Router);
|
||||
return new Observable((subscriber) => {
|
||||
credentialService.validating
|
||||
.pipe(takeWhile((validating) => validating))
|
||||
.subscribe({
|
||||
complete: () => {
|
||||
if (!credentialService.superadmin.value) {
|
||||
router.navigate(['/login']);
|
||||
return subscriber.next(false);
|
||||
} else {
|
||||
return subscriber.next(true);
|
||||
export const adminGuard: CanActivateFn = () => {
|
||||
const credentialService = inject(CredentialService);
|
||||
const router = inject(Router);
|
||||
|
||||
return credentialService.validating.pipe(
|
||||
filter((validating) => !validating),
|
||||
take(1),
|
||||
switchMap(() => {
|
||||
if (!credentialService.isAuthenticated.value) {
|
||||
void router.navigate(['/login']);
|
||||
return of(false);
|
||||
}
|
||||
|
||||
return credentialService.validateCurrentSession().pipe(
|
||||
switchMap(() => {
|
||||
if (
|
||||
!credentialService.isEffectiveSuperAdmin() &&
|
||||
!credentialService.isEffectiveAdmin()
|
||||
) {
|
||||
void router.navigate(['/dashboard']);
|
||||
return of(false);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
return of(true);
|
||||
}),
|
||||
catchError(() => of(false)),
|
||||
);
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import { inject } from '@angular/core';
|
||||
import { CanActivateFn, Router } from '@angular/router';
|
||||
import { catchError, filter, of, switchMap, take } from 'rxjs';
|
||||
import { CredentialService } from '../services/credential.service';
|
||||
|
||||
export const superAdminGuard: CanActivateFn = () => {
|
||||
const credentialService = inject(CredentialService);
|
||||
const router = inject(Router);
|
||||
|
||||
return credentialService.validating.pipe(
|
||||
filter((validating) => !validating),
|
||||
take(1),
|
||||
switchMap(() => {
|
||||
if (!credentialService.isAuthenticated.value) {
|
||||
void router.navigate(['/login']);
|
||||
return of(false);
|
||||
}
|
||||
|
||||
return credentialService.validateCurrentSession().pipe(
|
||||
switchMap(() => {
|
||||
if (!credentialService.isEffectiveSuperAdmin()) {
|
||||
void router.navigate(['/dashboard']);
|
||||
return of(false);
|
||||
}
|
||||
return of(true);
|
||||
}),
|
||||
catchError(() => of(false)),
|
||||
);
|
||||
}),
|
||||
);
|
||||
};
|
||||
@@ -1,26 +1,25 @@
|
||||
import { inject } from '@angular/core';
|
||||
import { CanActivateFn, Router } from '@angular/router';
|
||||
import { catchError, filter, map, of, switchMap, take } from 'rxjs';
|
||||
import { CredentialService } from '../services/credential.service';
|
||||
import { Observable, of, switchMap, takeWhile } from 'rxjs';
|
||||
|
||||
export const userGuard: CanActivateFn = (route, state) => {
|
||||
let credentialService = inject(CredentialService);
|
||||
let router = inject(Router);
|
||||
return new Observable((subscriber) => {
|
||||
credentialService.validating
|
||||
.pipe(takeWhile((validating) => validating))
|
||||
.subscribe({
|
||||
complete: () => {
|
||||
if (
|
||||
!credentialService.superadmin.value &&
|
||||
!credentialService.universityadmin.value
|
||||
) {
|
||||
router.navigate(['/login']);
|
||||
return subscriber.next(false);
|
||||
} else {
|
||||
return subscriber.next(true);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
export const userGuard: CanActivateFn = () => {
|
||||
const credentialService = inject(CredentialService);
|
||||
const router = inject(Router);
|
||||
|
||||
return credentialService.validating.pipe(
|
||||
filter((validating) => !validating),
|
||||
take(1),
|
||||
switchMap(() => {
|
||||
if (!credentialService.isAuthenticated.value) {
|
||||
void router.navigate(['/login']);
|
||||
return of(false);
|
||||
}
|
||||
|
||||
return credentialService.validateCurrentSession().pipe(
|
||||
map(() => true),
|
||||
catchError(() => of(false)),
|
||||
);
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,35 +1,86 @@
|
||||
import { HttpErrorResponse, HttpInterceptorFn } from '@angular/common/http';
|
||||
import { inject } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { catchError, switchMap, tap, throwError } from 'rxjs';
|
||||
import { CredentialService } from '../services/credential.service';
|
||||
import { switchMap, throwError } from 'rxjs';
|
||||
import { UiFocusService } from '../services/ui-focus.service';
|
||||
|
||||
export const authenticationInterceptor: HttpInterceptorFn = (req, next) => {
|
||||
if (
|
||||
(req.method == 'POST' &&
|
||||
(req.url.endsWith('/auth/id') ||
|
||||
req.url.endsWith('/auth/access') ||
|
||||
req.url.endsWith('/inse-account/create'))) ||
|
||||
req.url.endsWith('/institutions/autocomplete')
|
||||
) {
|
||||
const url = req.url.split('?')[0];
|
||||
const uiFocusService = inject(UiFocusService);
|
||||
|
||||
const isPublicAuthRequest =
|
||||
req.method === 'POST' &&
|
||||
(url.endsWith('/api/auth/v2/request-otk') ||
|
||||
url.endsWith('/api/auth/v2/login') ||
|
||||
url.endsWith('/api/auth/v2/access') ||
|
||||
url.endsWith('/api/auth/v2/refresh'));
|
||||
|
||||
if (isPublicAuthRequest || url.endsWith('/institutions/autocomplete')) {
|
||||
return next(req);
|
||||
} else {
|
||||
const credentialService = inject(CredentialService);
|
||||
const tokenProvider = credentialService.getBearerToken();
|
||||
return tokenProvider.pipe(
|
||||
switchMap((response) => {
|
||||
if (response == undefined) {
|
||||
return throwError(
|
||||
() =>
|
||||
new HttpErrorResponse({ status: 403, statusText: 'Forbidden' }),
|
||||
);
|
||||
} else {
|
||||
return next(
|
||||
req.clone({
|
||||
headers: req.headers.set('Authorization', 'Bearer ' + response),
|
||||
}),
|
||||
);
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
const credentialService = inject(CredentialService);
|
||||
const router = inject(Router);
|
||||
const snackBar = inject(MatSnackBar);
|
||||
const tokenProvider = credentialService.getBearerToken();
|
||||
const isLogoutRequest = url.endsWith('/api/auth/v2/logout');
|
||||
|
||||
return tokenProvider.pipe(
|
||||
switchMap((response) => {
|
||||
if (response == undefined) {
|
||||
credentialService.clearLocalAuthState();
|
||||
|
||||
snackBar.open(
|
||||
'Ihre Sitzung ist abgelaufen oder wurde beendet. Bitte melden Sie sich erneut an.',
|
||||
'OK',
|
||||
{ duration: 7000 },
|
||||
);
|
||||
|
||||
void router.navigate(['/login']);
|
||||
|
||||
return throwError(
|
||||
() => new HttpErrorResponse({ status: 403, statusText: 'Forbidden' }),
|
||||
);
|
||||
}
|
||||
|
||||
const authorizedRequest = req.clone({
|
||||
headers: req.headers.set('Authorization', 'Bearer ' + response),
|
||||
});
|
||||
|
||||
return next(authorizedRequest).pipe(
|
||||
catchError((error: HttpErrorResponse) => {
|
||||
if (error.status === 401 && !isLogoutRequest) {
|
||||
return credentialService.handleUnauthorized().pipe(
|
||||
tap((result) => {
|
||||
uiFocusService.blurActiveElement();
|
||||
|
||||
if (result === 'stopped-impersonating') {
|
||||
snackBar.open(
|
||||
'Die Impersonation wurde beendet, weil die Sitzung nicht mehr gültig ist.',
|
||||
'OK',
|
||||
{ duration: 7000 },
|
||||
);
|
||||
|
||||
void router.navigate(['/accounts']);
|
||||
} else if (result === 'logged-out') {
|
||||
snackBar.open(
|
||||
'Ihre Sitzung ist abgelaufen oder wurde beendet. Bitte melden Sie sich erneut an.',
|
||||
'OK',
|
||||
{ duration: 7000 },
|
||||
);
|
||||
|
||||
void router.navigate(['/login']);
|
||||
}
|
||||
}),
|
||||
switchMap(() => throwError(() => error)),
|
||||
);
|
||||
}
|
||||
|
||||
return throwError(() => error);
|
||||
}),
|
||||
);
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Configuration } from '../../api';
|
||||
|
||||
export type AccountRole = 'SUPER_ADMIN' | 'ADMIN' | 'MANAGER' | 'USER';
|
||||
|
||||
export interface AccountProfile {
|
||||
id: string;
|
||||
email: string;
|
||||
name: string;
|
||||
role: AccountRole;
|
||||
organization_id: string;
|
||||
organization_name: string;
|
||||
deleted: boolean;
|
||||
is_current: boolean;
|
||||
is_real_account: boolean;
|
||||
is_impersonating: boolean;
|
||||
}
|
||||
|
||||
export interface AccountPage {
|
||||
items: AccountProfile[];
|
||||
total: number;
|
||||
page: number;
|
||||
page_size: number;
|
||||
}
|
||||
|
||||
export interface OrganizationProfile {
|
||||
id: string;
|
||||
name: string;
|
||||
openalex_institution_id?: string | null;
|
||||
}
|
||||
|
||||
export interface AccountPayload {
|
||||
email?: string;
|
||||
name?: string;
|
||||
role?: AccountRole;
|
||||
organization_id?: string;
|
||||
password?: string;
|
||||
deleted?: boolean;
|
||||
}
|
||||
|
||||
export interface CreateAccountPayload {
|
||||
email: string;
|
||||
name: string;
|
||||
role: AccountRole;
|
||||
organization_id: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class AccountManagementService {
|
||||
private readonly httpClient = inject(HttpClient);
|
||||
private readonly apiConfiguration = inject(Configuration, { optional: true });
|
||||
|
||||
getCurrentAccount(): Observable<AccountProfile> {
|
||||
return this.httpClient.get<AccountProfile>(
|
||||
`${this.apiBasePath}/api/accounts/me`,
|
||||
);
|
||||
}
|
||||
|
||||
listAccounts(options: {
|
||||
page: number;
|
||||
pageSize: number;
|
||||
search?: string;
|
||||
organizationId?: string;
|
||||
}): Observable<AccountPage> {
|
||||
let params = new HttpParams()
|
||||
.set('page', options.page)
|
||||
.set('page_size', options.pageSize);
|
||||
|
||||
if (options.search) {
|
||||
params = params.set('search', options.search);
|
||||
}
|
||||
|
||||
if (options.organizationId) {
|
||||
params = params.set('organization_id', options.organizationId);
|
||||
}
|
||||
|
||||
return this.httpClient.get<AccountPage>(
|
||||
`${this.apiBasePath}/api/accounts`,
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
createAccount(payload: CreateAccountPayload): Observable<AccountProfile> {
|
||||
return this.httpClient.post<AccountProfile>(
|
||||
`${this.apiBasePath}/api/accounts`,
|
||||
payload,
|
||||
);
|
||||
}
|
||||
|
||||
updateAccount(
|
||||
accountId: string,
|
||||
payload: AccountPayload,
|
||||
): Observable<AccountProfile> {
|
||||
return this.httpClient.put<AccountProfile>(
|
||||
`${this.apiBasePath}/api/accounts/${accountId}`,
|
||||
payload,
|
||||
);
|
||||
}
|
||||
|
||||
deleteAccount(accountId: string): Observable<void> {
|
||||
return this.httpClient.delete<void>(
|
||||
`${this.apiBasePath}/api/accounts/${accountId}`,
|
||||
);
|
||||
}
|
||||
|
||||
listOrganizations(): Observable<OrganizationProfile[]> {
|
||||
return this.httpClient.get<OrganizationProfile[]>(
|
||||
`${this.apiBasePath}/api/accounts/organizations`,
|
||||
);
|
||||
}
|
||||
|
||||
private get apiBasePath(): string {
|
||||
return this.apiConfiguration?.basePath ?? '';
|
||||
}
|
||||
}
|
||||
@@ -1,248 +1,352 @@
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { filter, take, map } from 'rxjs/operators'; //TODO: review by arman
|
||||
import { Observable, of } from 'rxjs'; // review
|
||||
import { BehaviorSubject } from 'rxjs'; //review
|
||||
import { Injectable, computed, inject, signal } from '@angular/core';
|
||||
import { filter, take, map, catchError, finalize } from 'rxjs/operators';
|
||||
import {
|
||||
INSEAccountServiceService,
|
||||
IdentityGrant as ApiIdentityGrant,
|
||||
AccessGrant as ApiAccessGrant,
|
||||
BehaviorSubject,
|
||||
Observable,
|
||||
of,
|
||||
switchMap,
|
||||
tap,
|
||||
throwError,
|
||||
} from 'rxjs';
|
||||
import {
|
||||
AccessResponse,
|
||||
AccessToken,
|
||||
AuthService,
|
||||
Configuration,
|
||||
IdToken,
|
||||
LoginResponse,
|
||||
AccountProfile,
|
||||
} from '../../api';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
|
||||
export interface AuthAccount {
|
||||
i: number;
|
||||
l: string;
|
||||
o: number;
|
||||
e: string;
|
||||
on: string;
|
||||
}
|
||||
|
||||
export interface AuthScope {
|
||||
t: string;
|
||||
a: AuthAccount;
|
||||
d: number | null;
|
||||
r: string[];
|
||||
}
|
||||
|
||||
export interface IdentityGrant {
|
||||
token_type: string;
|
||||
access_token: string;
|
||||
expires_in: number;
|
||||
scope: AuthScope;
|
||||
}
|
||||
|
||||
export interface AccessGrant {
|
||||
token_type: string;
|
||||
access_token: string;
|
||||
expires_in: number;
|
||||
scope: AuthScope;
|
||||
refresh_token: string;
|
||||
}
|
||||
|
||||
interface TimedIdentityGrant {
|
||||
grant: IdentityGrant;
|
||||
expiration: number;
|
||||
}
|
||||
|
||||
interface TimedAccessGrant {
|
||||
grant: AccessGrant;
|
||||
expiration: number;
|
||||
}
|
||||
type LogoutResult = 'logged-out' | 'stopped-impersonating';
|
||||
type UnauthorizedRecoveryResult =
|
||||
| 'logged-out'
|
||||
| 'stopped-impersonating'
|
||||
| 'already-handling';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class CredentialService {
|
||||
private accountService = inject(INSEAccountServiceService);
|
||||
private readonly authService = inject(AuthService);
|
||||
private readonly httpClient = inject(HttpClient);
|
||||
private readonly apiConfiguration = inject(Configuration, { optional: true });
|
||||
private handlingUnauthorized = false;
|
||||
|
||||
private static readonly KEY_GRANT = 'grant';
|
||||
|
||||
public readonly validating = new BehaviorSubject<boolean>(false);
|
||||
public readonly authenticated = new BehaviorSubject<boolean>(false);
|
||||
public readonly superadmin = new BehaviorSubject<boolean>(false);
|
||||
public readonly universityadmin = new BehaviorSubject<boolean>(false);
|
||||
public readonly organization = new BehaviorSubject<number | undefined>(
|
||||
undefined,
|
||||
public readonly isAuthenticated = new BehaviorSubject<boolean>(false);
|
||||
public readonly isEffectiveSuperAdmin = computed(
|
||||
() => this.accessToken()?.effective_role === 'SUPER_ADMIN',
|
||||
);
|
||||
public readonly isEffectiveAdmin = computed(
|
||||
() => this.accessToken()?.effective_role === 'ADMIN',
|
||||
);
|
||||
public readonly effectiveOrganizationId = computed(
|
||||
() => this.accessToken()?.effective_organization_id,
|
||||
);
|
||||
public readonly login = new BehaviorSubject<string>('');
|
||||
public readonly email = new BehaviorSubject<string>('');
|
||||
public readonly organizationName = new BehaviorSubject<string>('');
|
||||
|
||||
private readonly identityToken = new BehaviorSubject<
|
||||
TimedIdentityGrant | undefined
|
||||
>(undefined);
|
||||
private readonly accessToken = new BehaviorSubject<
|
||||
TimedAccessGrant | undefined
|
||||
>(undefined);
|
||||
public readonly realAccountId = computed(
|
||||
() => this.accessToken()?.real_account_id ?? '',
|
||||
);
|
||||
public readonly effectiveAccountId = computed(
|
||||
() => this.accessToken()?.effective_account_id ?? '',
|
||||
);
|
||||
public readonly isImpersonating = computed(
|
||||
() => this.realAccountId() !== this.effectiveAccountId(),
|
||||
);
|
||||
|
||||
private readonly identityToken = signal<IdToken | undefined>(undefined);
|
||||
private readonly accessToken = signal<AccessToken | undefined>(undefined);
|
||||
|
||||
private request = 0;
|
||||
|
||||
constructor() {
|
||||
this.accessToken.subscribe((token) => {
|
||||
if (token) {
|
||||
const r = token.grant.scope.r as string[];
|
||||
this.superadmin.next(r.includes('SUPER_ADMIN'));
|
||||
this.universityadmin.next(r.includes('UNI_ADMIN'));
|
||||
this.login.next(token.grant.scope.a?.l ?? '');
|
||||
this.email.next(token.grant.scope.a?.e ?? '');
|
||||
this.organizationName.next(token.grant.scope.a?.on ?? '');
|
||||
} else {
|
||||
this.superadmin.next(false);
|
||||
this.universityadmin.next(false);
|
||||
this.login.next('');
|
||||
this.email.next('');
|
||||
this.organizationName.next('');
|
||||
}
|
||||
});
|
||||
const data = localStorage.getItem(CredentialService.KEY_GRANT);
|
||||
const id = data ? (JSON.parse(data) as TimedIdentityGrant) : undefined;
|
||||
if (id && id.expiration && id.expiration >= Date.now()) {
|
||||
this.identityToken.next(id);
|
||||
const id = data ? (JSON.parse(data) as AccessToken) : undefined;
|
||||
if (id && new Date(id.expires_at).getTime() >= Date.now()) {
|
||||
this.identityToken.set(id);
|
||||
this.validating.next(true);
|
||||
setTimeout(() => this.refreshAccessToken(id), 0);
|
||||
}
|
||||
}
|
||||
|
||||
public loginAccount(login: string, password: string) {
|
||||
public validateCurrentSession(): Observable<void> {
|
||||
return this.loadCurrentProfile();
|
||||
}
|
||||
|
||||
public requestOtk(email: string, password: string): Observable<string> {
|
||||
const request = ++this.request;
|
||||
const now = Date.now();
|
||||
this.validating.next(true);
|
||||
this.authenticated.next(false);
|
||||
this.organization.next(undefined);
|
||||
this.superadmin.next(false);
|
||||
this.universityadmin.next(false);
|
||||
this.identityToken.next(undefined);
|
||||
this.accessToken.next(undefined);
|
||||
this.isAuthenticated.next(false);
|
||||
this.identityToken.set(undefined);
|
||||
this.accessToken.set(undefined);
|
||||
|
||||
const body = new URLSearchParams();
|
||||
body.set('username', login);
|
||||
body.set('password', password);
|
||||
return this.authService
|
||||
.requestOtk({ email: email.trim().toLowerCase(), password })
|
||||
.pipe(
|
||||
map((response: { account_id?: string }) => {
|
||||
if (this.request !== request) {
|
||||
return '';
|
||||
}
|
||||
|
||||
this.accountService.getIdentityGrant(login, password).subscribe({
|
||||
next: (result) => {
|
||||
if (this.request != request) return;
|
||||
const token: TimedIdentityGrant = {
|
||||
grant: result as any as IdentityGrant,
|
||||
expiration: result.expires_in * 1000 + now,
|
||||
};
|
||||
this.identityToken.next(token);
|
||||
localStorage.setItem(
|
||||
CredentialService.KEY_GRANT,
|
||||
JSON.stringify(token),
|
||||
);
|
||||
this.refreshAccessToken(token);
|
||||
},
|
||||
return response.account_id ?? '';
|
||||
}),
|
||||
finalize(() => {
|
||||
if (this.request === request) {
|
||||
this.validating.next(false);
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
public loginWithOtk(
|
||||
accountId: string,
|
||||
email: string,
|
||||
emailCode: string,
|
||||
): Observable<void> {
|
||||
const request = ++this.request;
|
||||
this.validating.next(true);
|
||||
this.isAuthenticated.next(false);
|
||||
|
||||
return this.authService
|
||||
.login({ account_id: accountId, email_code: emailCode.trim() })
|
||||
.pipe(
|
||||
switchMap((response: LoginResponse) => {
|
||||
if (this.request != request) return of(undefined);
|
||||
|
||||
const idToken = response.id_token;
|
||||
|
||||
this.identityToken.set(idToken);
|
||||
localStorage.setItem(
|
||||
CredentialService.KEY_GRANT,
|
||||
JSON.stringify(idToken),
|
||||
);
|
||||
return this.getAccessGrantForIdentity(idToken, request);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
public refreshAccessToken(identityToken: IdToken) {
|
||||
const request = ++this.request;
|
||||
this.validating.next(true);
|
||||
this.accessToken.set(undefined);
|
||||
this.getAccessGrantForIdentity(identityToken, request).subscribe({
|
||||
error: () => {
|
||||
if (this.request != request) return;
|
||||
this.validating.next(false);
|
||||
this.clearLocalAuthState();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
public refreshAccessToken(identityToken: TimedIdentityGrant) {
|
||||
const request = ++this.request;
|
||||
const now = Date.now();
|
||||
this.validating.next(true);
|
||||
this.accessToken.next(undefined);
|
||||
const uid = identityToken.grant.scope.a!.i;
|
||||
const org = identityToken.grant.scope.a!.o;
|
||||
public impersonateAccount(accountId: string): Observable<void> {
|
||||
const idToken = this.identityToken();
|
||||
|
||||
this.accountService
|
||||
.getAccessGrant(identityToken.grant.access_token, uid, org)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
if (this.request != request) return;
|
||||
const token: TimedAccessGrant = {
|
||||
grant: result as any as AccessGrant,
|
||||
expiration: result.expires_in * 1000 + now,
|
||||
};
|
||||
this.accessToken.next(token);
|
||||
this.organization.next(result.scope.a!.o);
|
||||
this.authenticated.next(true);
|
||||
this.validating.next(false);
|
||||
},
|
||||
error: () => {
|
||||
if (this.request != request) return;
|
||||
this.identityToken.next(undefined);
|
||||
this.organization.next(undefined);
|
||||
this.authenticated.next(false);
|
||||
this.superadmin.next(false);
|
||||
this.universityadmin.next(false);
|
||||
this.validating.next(false);
|
||||
},
|
||||
});
|
||||
if (!idToken) {
|
||||
return throwError(() => new Error('No identity token available.'));
|
||||
}
|
||||
|
||||
const request = ++this.request;
|
||||
this.validating.next(true);
|
||||
this.accessToken.set(undefined);
|
||||
return this.getAccessGrantForIdentity(idToken, request, accountId).pipe(
|
||||
tap({ error: () => this.validating.next(false) }),
|
||||
);
|
||||
}
|
||||
|
||||
public logoutAcount() {
|
||||
public stopImpersonating(): Observable<void> {
|
||||
const idToken = this.identityToken();
|
||||
|
||||
if (!idToken) {
|
||||
return throwError(() => new Error('No identity token available.'));
|
||||
}
|
||||
|
||||
const request = ++this.request;
|
||||
this.validating.next(true);
|
||||
this.accessToken.set(undefined);
|
||||
return this.getAccessGrantForIdentity(idToken, request).pipe(
|
||||
tap({ error: () => this.validating.next(false) }),
|
||||
);
|
||||
}
|
||||
|
||||
public logoutAccount(): Observable<LogoutResult> {
|
||||
const wasImpersonating = this.isImpersonating();
|
||||
|
||||
return this.authService
|
||||
.logout('body', false, { transferCache: false })
|
||||
.pipe(
|
||||
catchError((error) => {
|
||||
console.error('Backend logout failed', error);
|
||||
return of(null);
|
||||
}),
|
||||
switchMap(() => {
|
||||
if (!wasImpersonating) {
|
||||
this.clearLocalAuthState();
|
||||
return of('logged-out' as const);
|
||||
}
|
||||
|
||||
return this.stopImpersonating().pipe(
|
||||
map(() => 'stopped-impersonating' as const),
|
||||
catchError((error) => {
|
||||
console.error('Stop impersonating after logout failed', error);
|
||||
this.clearLocalAuthState();
|
||||
return of('logged-out' as const);
|
||||
}),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
public clearLocalAuthState(): void {
|
||||
this.request += 1;
|
||||
localStorage.removeItem(CredentialService.KEY_GRANT);
|
||||
this.authenticated.next(false);
|
||||
this.organization.next(undefined);
|
||||
this.superadmin.next(false);
|
||||
this.universityadmin.next(false);
|
||||
this.identityToken.next(undefined);
|
||||
this.accessToken.next(undefined);
|
||||
this.identityToken.set(undefined);
|
||||
this.accessToken.set(undefined);
|
||||
this.isAuthenticated.next(false);
|
||||
this.validating.next(false);
|
||||
this.login.next('');
|
||||
this.email.next('');
|
||||
this.organizationName.next('');
|
||||
}
|
||||
|
||||
public registerAccount(data: any): Observable<any> {
|
||||
return this.accountService.createUser(data);
|
||||
public handleUnauthorized(): Observable<UnauthorizedRecoveryResult> {
|
||||
if (this.handlingUnauthorized) {
|
||||
return of('already-handling' as const);
|
||||
}
|
||||
|
||||
this.handlingUnauthorized = true;
|
||||
|
||||
const isImpersonating = this.isImpersonating();
|
||||
const identityToken = this.identityToken();
|
||||
|
||||
const recovery$ =
|
||||
isImpersonating && identityToken
|
||||
? this.stopImpersonating().pipe(
|
||||
map(() => 'stopped-impersonating' as const),
|
||||
catchError((error) => {
|
||||
console.error('Failed to stop impersonation after 401', error);
|
||||
this.clearLocalAuthState();
|
||||
return of('logged-out' as const);
|
||||
}),
|
||||
)
|
||||
: of(null).pipe(
|
||||
tap(() => this.clearLocalAuthState()),
|
||||
map(() => 'logged-out' as const),
|
||||
);
|
||||
|
||||
return recovery$.pipe(
|
||||
finalize(() => {
|
||||
this.handlingUnauthorized = false;
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
public changePassword(
|
||||
currentPassword: string,
|
||||
newPassword: string,
|
||||
): Observable<void> {
|
||||
return this.httpClient
|
||||
.post(
|
||||
`${this.apiBasePath}/api/auth/v2/change-password`,
|
||||
{
|
||||
current_password: currentPassword,
|
||||
new_password: newPassword,
|
||||
},
|
||||
{ withCredentials: true },
|
||||
)
|
||||
.pipe(
|
||||
tap(() => this.clearLocalAuthState()),
|
||||
map(() => undefined),
|
||||
);
|
||||
}
|
||||
|
||||
public registerAccount(_data: unknown): Observable<never> {
|
||||
return throwError(() => new Error('Registration is temporarily disabled.'));
|
||||
}
|
||||
|
||||
//review: arman (generated fix)
|
||||
public getBearerToken(): Observable<string | undefined> {
|
||||
const accessToken = this.accessToken();
|
||||
const identityToken = this.identityToken();
|
||||
|
||||
// 1. If we have a valid access token, return it immediately and complete.
|
||||
if (
|
||||
this.accessToken.value &&
|
||||
Date.now() < this.accessToken.value.expiration
|
||||
accessToken &&
|
||||
Date.now() < new Date(accessToken.expires_at).getTime()
|
||||
) {
|
||||
return of(this.accessToken.value.grant.access_token);
|
||||
return of(accessToken.raw_token);
|
||||
}
|
||||
|
||||
// 2. If we don't have a token, and we ARE NOT currently validating, trigger a refresh.
|
||||
if (!this.validating.value) {
|
||||
if (!this.identityToken.value) {
|
||||
if (!identityToken) {
|
||||
return of(undefined); // No identity token to refresh with.
|
||||
}
|
||||
this.refreshAccessToken(this.identityToken.value);
|
||||
this.refreshAccessToken(identityToken);
|
||||
}
|
||||
|
||||
// 3. Wait for the validation to finish, then return the resulting token.
|
||||
return this.validating.pipe(
|
||||
filter((isValidating) => !isValidating), // Wait until validating becomes false
|
||||
take(1), // Take exactly 1 emission and then automatically complete()
|
||||
map(() =>
|
||||
this.accessToken.value
|
||||
? this.accessToken.value.grant.access_token
|
||||
: undefined,
|
||||
),
|
||||
map(() => this.accessToken()?.raw_token),
|
||||
);
|
||||
}
|
||||
/* Old version with added complete statements to resolve loading spinner issue
|
||||
public getBearerToken(): Observable<string | undefined> {
|
||||
return new Observable<string | undefined>((observer) => {
|
||||
if (this.validating.value) {
|
||||
this.validating.pipe(takeWhile((validating) => validating)).subscribe({
|
||||
complete: () => {
|
||||
observer.next(this.accessToken.value ? this.accessToken.value.grant.access_token : undefined);
|
||||
observer.complete(); // added complete
|
||||
}
|
||||
});
|
||||
} else if (!this.accessToken.value) {
|
||||
observer.next(undefined);
|
||||
observer.complete(); // added complete
|
||||
} else if (Date.now() < this.accessToken.value.expiration) {
|
||||
observer.next(this.accessToken.value.grant.access_token);
|
||||
observer.complete(); // added complete
|
||||
} else {
|
||||
this.refreshAccessToken(this.identityToken.value!);
|
||||
this.validating.pipe(takeWhile((validating) => validating)).subscribe({
|
||||
complete: () => {
|
||||
observer.next(this.accessToken.value ? this.accessToken.value.grant.access_token : undefined);
|
||||
observer.complete(); // added complete
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
private getAccessGrantForIdentity(
|
||||
idToken: IdToken,
|
||||
request: number,
|
||||
effectiveAccountId?: string,
|
||||
): Observable<void> {
|
||||
const realAccountId = idToken.real_account_id;
|
||||
const headers = new HttpHeaders({
|
||||
Authorization: `Bearer ${idToken.raw_token}`,
|
||||
});
|
||||
const payload = {
|
||||
real_account_id: realAccountId,
|
||||
effective_account_id: effectiveAccountId ?? realAccountId,
|
||||
};
|
||||
|
||||
return this.httpClient
|
||||
.post<AccessResponse>(`${this.apiBasePath}/api/auth/v2/access`, payload, {
|
||||
headers,
|
||||
withCredentials: true,
|
||||
})
|
||||
.pipe(
|
||||
tap((result: AccessResponse) => {
|
||||
if (this.request != request) return;
|
||||
|
||||
const accessToken = result.access_token;
|
||||
|
||||
this.accessToken.set(accessToken);
|
||||
this.isAuthenticated.next(true);
|
||||
this.validating.next(false);
|
||||
}),
|
||||
map(() => undefined),
|
||||
);
|
||||
}
|
||||
|
||||
private get apiBasePath(): string {
|
||||
return this.apiConfiguration?.basePath ?? '';
|
||||
}
|
||||
|
||||
private loadCurrentProfile(): Observable<void> {
|
||||
return this.httpClient
|
||||
.get<AccountProfile>(`${this.apiBasePath}/api/accounts/me`, {
|
||||
withCredentials: true,
|
||||
})
|
||||
.pipe(
|
||||
tap((profile) => {
|
||||
this.login.next(profile.name ?? profile.email ?? '');
|
||||
this.email.next(profile.email ?? '');
|
||||
this.organizationName.next(profile.organization_name ?? '');
|
||||
}),
|
||||
map(() => undefined),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Configuration } from '../../api';
|
||||
|
||||
export interface OrganizationProfile {
|
||||
id: string;
|
||||
name: string;
|
||||
other_inst_id?: string | null;
|
||||
deleted: boolean;
|
||||
member_count: number;
|
||||
}
|
||||
|
||||
export interface OrganizationPage {
|
||||
items: OrganizationProfile[];
|
||||
total: number;
|
||||
page: number;
|
||||
page_size: number;
|
||||
}
|
||||
|
||||
export interface CreateOrganizationPayload {
|
||||
name: string;
|
||||
other_inst_id?: string | null;
|
||||
}
|
||||
|
||||
export interface UpdateOrganizationPayload {
|
||||
name?: string;
|
||||
other_inst_id?: string | null;
|
||||
deleted?: boolean;
|
||||
}
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class OrganizationManagementService {
|
||||
private readonly httpClient = inject(HttpClient);
|
||||
private readonly apiConfiguration = inject(Configuration, { optional: true });
|
||||
|
||||
getOrganizations(
|
||||
page: number,
|
||||
pageSize: number,
|
||||
): Observable<OrganizationPage> {
|
||||
const params = new HttpParams()
|
||||
.set('page', page)
|
||||
.set('page_size', pageSize);
|
||||
return this.httpClient.get<OrganizationPage>(
|
||||
`${this.apiBasePath}/api/organizations`,
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
createOrganization(
|
||||
payload: CreateOrganizationPayload,
|
||||
): Observable<OrganizationProfile> {
|
||||
return this.httpClient.post<OrganizationProfile>(
|
||||
`${this.apiBasePath}/api/organizations`,
|
||||
payload,
|
||||
);
|
||||
}
|
||||
|
||||
updateOrganization(
|
||||
organizationId: string,
|
||||
payload: UpdateOrganizationPayload,
|
||||
): Observable<OrganizationProfile> {
|
||||
return this.httpClient.put<OrganizationProfile>(
|
||||
`${this.apiBasePath}/api/organizations/${organizationId}`,
|
||||
payload,
|
||||
);
|
||||
}
|
||||
|
||||
deleteOrganization(organizationId: string): Observable<void> {
|
||||
return this.httpClient.delete<void>(
|
||||
`${this.apiBasePath}/api/organizations/${organizationId}`,
|
||||
);
|
||||
}
|
||||
|
||||
private get apiBasePath(): string {
|
||||
return this.apiConfiguration?.basePath ?? '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class UiFocusService {
|
||||
public blurActiveElement(): void {
|
||||
const activeElement = document.activeElement;
|
||||
|
||||
if (activeElement instanceof HTMLElement) {
|
||||
activeElement.blur();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,7 @@
|
||||
<mat-drawer-container
|
||||
class="drawer-container"
|
||||
[autosize]="!mediaQuery.matches">
|
||||
@if (
|
||||
(credentialService.authenticated | async) &&
|
||||
((credentialService.superadmin | async) ||
|
||||
(credentialService.universityadmin | async))
|
||||
) {
|
||||
@if (credentialService.isAuthenticated | async) {
|
||||
<mat-drawer
|
||||
class="drawer"
|
||||
[class.drawer--collapsed]="isSidebarCollapsed()"
|
||||
@@ -22,7 +18,16 @@
|
||||
</mat-drawer>
|
||||
}
|
||||
<mat-drawer-content class="content-shell">
|
||||
@if (credentialService.authenticated | async) {
|
||||
@if (credentialService.isAuthenticated | async) {
|
||||
@if (credentialService.isImpersonating()) {
|
||||
<div class="impersonation-banner">
|
||||
<mat-icon>switch_account</mat-icon>
|
||||
<span>Impersonation aktiv</span>
|
||||
<button mat-button type="button" (click)="stopImpersonating()">
|
||||
Beenden
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
<mat-toolbar class="main">
|
||||
<div class="topbar-left">
|
||||
@if (mediaQuery.matches) {
|
||||
|
||||
@@ -58,6 +58,26 @@ mat-toolbar.main {
|
||||
color: var(--sg-text);
|
||||
}
|
||||
|
||||
.impersonation-banner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
min-height: 44px;
|
||||
padding: 6px 20px;
|
||||
background: #fff7ed;
|
||||
border-bottom: 1px solid #fed7aa;
|
||||
color: #9a3412;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.impersonation-banner mat-icon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.back-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
ViewChild,
|
||||
inject,
|
||||
} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { CommonModule, Location } from '@angular/common';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
@@ -16,7 +16,6 @@ import { MediaMatcher } from '@angular/cdk/layout';
|
||||
import { AppMenuComponent } from '../app-menu/app-menu.component';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { CredentialService } from '../../services/credential.service';
|
||||
import { Location } from '@angular/common';
|
||||
import { AppSearchbarComponent } from '../app-searchbar/app-searchbar.component';
|
||||
import { ResolverStateService } from '../../services/resolver-state.service';
|
||||
import { LoadingComponent } from '../loading/loading.component';
|
||||
@@ -52,7 +51,7 @@ export class AppLayoutComponent implements OnInit, OnDestroy {
|
||||
constructor(
|
||||
public credentialService: CredentialService,
|
||||
public router: Router,
|
||||
private location: Location,
|
||||
private readonly location: Location,
|
||||
public changeDetector: ChangeDetectorRef,
|
||||
media: MediaMatcher,
|
||||
) {
|
||||
@@ -104,9 +103,23 @@ export class AppLayoutComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
logout() {
|
||||
this.credentialService.logoutAcount();
|
||||
this.router.navigate(['/']);
|
||||
this.credentialService.logoutAccount().subscribe({
|
||||
next: (result) => {
|
||||
if (result === 'stopped-impersonating') {
|
||||
this.router.navigate(['/accounts']);
|
||||
} else {
|
||||
this.router.navigate(['/login']);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
stopImpersonating(): void {
|
||||
this.credentialService.stopImpersonating().subscribe({
|
||||
next: () => this.router.navigate(['/accounts']),
|
||||
});
|
||||
}
|
||||
|
||||
navigateBack() {
|
||||
this.location.back();
|
||||
}
|
||||
|
||||
@@ -41,33 +41,51 @@
|
||||
</div>
|
||||
|
||||
<mat-nav-list class="nav-list">
|
||||
@for (item of navItems; track item.label) {
|
||||
@if (collapsed()) {
|
||||
<a
|
||||
mat-icon-button
|
||||
class="nav-icon-button"
|
||||
[routerLink]="item.disabled ? null : item.route"
|
||||
[queryParams]="item.queryParams || null"
|
||||
routerLinkActive="active"
|
||||
[routerLinkActiveOptions]="navLinkActiveOptions"
|
||||
[class.disabled]="item.disabled"
|
||||
[matTooltip]="item.label"
|
||||
matTooltipPosition="right"
|
||||
[attr.aria-label]="item.label">
|
||||
<mat-icon>{{ item.icon }}</mat-icon>
|
||||
</a>
|
||||
} @else {
|
||||
<a
|
||||
mat-list-item
|
||||
[routerLink]="item.disabled ? null : item.route"
|
||||
[queryParams]="item.queryParams || null"
|
||||
routerLinkActive="active"
|
||||
[routerLinkActiveOptions]="navLinkActiveOptions"
|
||||
[class.disabled]="item.disabled">
|
||||
<mat-icon matListItemIcon>{{ item.icon }}</mat-icon>
|
||||
<span matListItemTitle>{{ item.label }}</span>
|
||||
</a>
|
||||
}
|
||||
@for (itemGroup of navItemGroups; track $index) {
|
||||
<div>
|
||||
@if (
|
||||
(!itemGroup.adminOnly ||
|
||||
credentialService.isEffectiveSuperAdmin() ||
|
||||
credentialService.isEffectiveAdmin()) &&
|
||||
(!itemGroup.superAdminOnly ||
|
||||
credentialService.isEffectiveSuperAdmin())
|
||||
) {
|
||||
<mat-divider></mat-divider>
|
||||
@if (!collapsed()) {
|
||||
<div class="nav-separator">
|
||||
<span>{{ itemGroup.label }}</span>
|
||||
</div>
|
||||
}
|
||||
@for (item of itemGroup.items; track item.label) {
|
||||
@if (collapsed()) {
|
||||
<a
|
||||
mat-icon-button
|
||||
class="nav-icon-button"
|
||||
[routerLink]="item.disabled ? null : item.route"
|
||||
[queryParams]="item.queryParams || null"
|
||||
routerLinkActive="active"
|
||||
[routerLinkActiveOptions]="navLinkActiveOptions"
|
||||
[class.disabled]="item.disabled"
|
||||
[matTooltip]="item.label"
|
||||
matTooltipPosition="right"
|
||||
[attr.aria-label]="item.label">
|
||||
<mat-icon>{{ item.icon }}</mat-icon>
|
||||
</a>
|
||||
} @else {
|
||||
<a
|
||||
mat-list-item
|
||||
[routerLink]="item.disabled ? null : item.route"
|
||||
[queryParams]="item.queryParams || null"
|
||||
routerLinkActive="active"
|
||||
[routerLinkActiveOptions]="navLinkActiveOptions"
|
||||
[class.disabled]="item.disabled">
|
||||
<mat-icon matListItemIcon>{{ item.icon }}</mat-icon>
|
||||
<span matListItemTitle>{{ item.label }}</span>
|
||||
</a>
|
||||
}
|
||||
}
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</mat-nav-list>
|
||||
|
||||
@@ -93,18 +111,20 @@
|
||||
</div>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="account-card">
|
||||
<div class="avatar">
|
||||
{{ (credentialService.login | async)?.charAt(0) }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>{{
|
||||
(credentialService.login | async) || 'Max Mustermann'
|
||||
}}</strong>
|
||||
<strong>{{ credentialService.organizationName | async }}</strong>
|
||||
<span>Startup Coach</span>
|
||||
</div>
|
||||
<mat-icon>expand_more</mat-icon>
|
||||
<div [routerLink]="['/account']">
|
||||
<mat-card appearance="outlined" class="account-card-content">
|
||||
<mat-card-content class="account-card">
|
||||
<div class="avatar">
|
||||
{{ (credentialService.login | async)?.charAt(0) }}
|
||||
</div>
|
||||
<div>
|
||||
<strong>{{
|
||||
(credentialService.login | async) || 'Max Mustermann'
|
||||
}}</strong>
|
||||
<strong>{{ credentialService.organizationName | async }}</strong>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@@ -174,16 +174,22 @@
|
||||
min-height: 28px;
|
||||
}
|
||||
|
||||
.account-card-content {
|
||||
background: var(--sg-none);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
}
|
||||
|
||||
.account-card {
|
||||
display: grid;
|
||||
grid-template-columns: 40px 1fr 20px;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
min-height: 68px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background: var(--sg-surface);
|
||||
|
||||
:hover {
|
||||
cursor: pointer;
|
||||
background: var(--sg-background-hover);
|
||||
}
|
||||
}
|
||||
|
||||
.account-icon {
|
||||
@@ -277,3 +283,14 @@
|
||||
.sidebar--collapsed .account-icon {
|
||||
margin-inline: auto;
|
||||
}
|
||||
|
||||
.nav-separator {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 0 12px;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import { Component, computed, inject, input, output } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import {
|
||||
IsActiveMatchOptions,
|
||||
Router,
|
||||
RouterLink,
|
||||
RouterLinkActive,
|
||||
} from '@angular/router';
|
||||
import { IsActiveMatchOptions, Router, RouterModule } from '@angular/router';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
@@ -14,18 +9,37 @@ import { CredentialService } from '../../services/credential.service';
|
||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ConfirmationDialogComponent } from '../confirmation-dialog/confirmation-dialog.component';
|
||||
import { MatCardContent, MatCardModule } from '@angular/material/card';
|
||||
|
||||
type NavItem = {
|
||||
label: string;
|
||||
icon: string;
|
||||
route: string;
|
||||
disabled: boolean;
|
||||
queryParams?: Record<string, string | number | boolean>;
|
||||
adminOnly?: boolean;
|
||||
superAdminOnly?: boolean;
|
||||
};
|
||||
|
||||
type NavItemGroup = {
|
||||
label: string;
|
||||
items: NavItem[];
|
||||
adminOnly?: boolean;
|
||||
superAdminOnly?: boolean;
|
||||
};
|
||||
|
||||
@Component({
|
||||
selector: 'app-menu',
|
||||
imports: [
|
||||
CommonModule,
|
||||
RouterLink,
|
||||
RouterModule,
|
||||
MatIconModule,
|
||||
MatListModule,
|
||||
RouterLinkActive,
|
||||
MatProgressBarModule,
|
||||
MatButtonModule,
|
||||
MatTooltipModule,
|
||||
MatCardModule,
|
||||
MatCardContent,
|
||||
],
|
||||
templateUrl: './app-menu.component.html',
|
||||
styleUrl: './app-menu.component.scss',
|
||||
@@ -41,7 +55,8 @@ export class AppMenuComponent {
|
||||
matrixParams: 'ignored',
|
||||
fragment: 'ignored',
|
||||
};
|
||||
navItems = [
|
||||
|
||||
navItems: NavItem[] = [
|
||||
{
|
||||
label: 'Dashboard',
|
||||
icon: 'dashboard',
|
||||
@@ -96,6 +111,40 @@ export class AppMenuComponent {
|
||||
route: '/patents',
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
label: 'Accounts',
|
||||
icon: 'manage_accounts',
|
||||
route: '/accounts',
|
||||
disabled: false,
|
||||
adminOnly: true,
|
||||
},
|
||||
{
|
||||
label: 'Organisationen',
|
||||
icon: 'domain',
|
||||
route: '/organizations',
|
||||
disabled: false,
|
||||
superAdminOnly: true,
|
||||
},
|
||||
];
|
||||
navItemGroups: NavItemGroup[] = [
|
||||
{
|
||||
label: 'Navigation',
|
||||
items: this.navItems.filter(
|
||||
(item) => !item.adminOnly && !item.superAdminOnly,
|
||||
),
|
||||
},
|
||||
{
|
||||
label: 'Administration',
|
||||
items: this.navItems.filter(
|
||||
(item) => item.adminOnly && !item.superAdminOnly,
|
||||
),
|
||||
adminOnly: true,
|
||||
},
|
||||
{
|
||||
label: 'Super Administration',
|
||||
items: this.navItems.filter((item) => item.superAdminOnly),
|
||||
superAdminOnly: true,
|
||||
},
|
||||
];
|
||||
|
||||
constructor(
|
||||
@@ -117,8 +166,15 @@ export class AppMenuComponent {
|
||||
});
|
||||
|
||||
dialogRef.componentInstance.confirmDelete.subscribe(() => {
|
||||
this.credentialService.logoutAcount();
|
||||
this.router.navigate(['/login']);
|
||||
this.credentialService.logoutAccount().subscribe({
|
||||
next: (result) => {
|
||||
if (result === 'stopped-impersonating') {
|
||||
this.router.navigate(['/accounts']);
|
||||
} else {
|
||||
this.router.navigate(['/login']);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
} from '@angular/core';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { buildTopicHierarchyTooltip } from '../../utils/topic-tooltip';
|
||||
import { buildTopicHierarchyTooltip } from '../../../resolvers/utils/topic-tooltip';
|
||||
|
||||
export const TOPIC_CHIP_PALETTE = [
|
||||
'purple',
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
TopicLegendGroup,
|
||||
TopicLegendItem,
|
||||
TopicLegendSubfieldSelection,
|
||||
} from '../../utils/topic-legend';
|
||||
} from '../../../resolvers/utils/topic-legend';
|
||||
|
||||
export type TopicLegendVariant = 'default' | 'compact';
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user