Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { CollectionResource } from 'core-app/features/hal/resources/collection-r
import { ApiV3ListParameters, listParamsString } from 'core-app/core/apiv3/paths/apiv3-list-resource.interface';
import { QueryFiltersService } from 'core-app/features/work-packages/components/wp-query/query-filters.service';
import { HalPayloadHelper } from 'core-app/features/hal/schemas/hal-payload.helper';
import { HTTPClientParamMap } from 'core-app/features/hal/http/http.interfaces';

export class ApiV3QueriesPaths extends ApiV3ResourceCollection<QueryResource, ApiV3QueryPaths> {
@LazyInject() private queryFilters:QueryFiltersService;
Expand Down Expand Up @@ -89,7 +90,7 @@ export class ApiV3QueriesPaths extends ApiV3ResourceCollection<QueryResource, Ap

return this
.halResourceService
.get<QueryResource>(path, queryData);
.get<QueryResource>(path, queryData as HTTPClientParamMap);
}

/**
Expand All @@ -101,7 +102,7 @@ export class ApiV3QueriesPaths extends ApiV3ResourceCollection<QueryResource, Ap
return this.halResourceService
.get<QueryResource>(
this.default.path,
params,
params as HTTPClientParamMap,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { LazyInject } from 'core-app/shared/helpers/angular/lazy-inject.decorato
import { QueryFiltersService } from 'core-app/features/work-packages/components/wp-query/query-filters.service';
import { HalPayloadHelper } from 'core-app/features/hal/schemas/hal-payload.helper';
import { PaginationObject } from 'core-app/shared/components/table-pagination/pagination-service';
import { HTTPClientParamMap } from 'core-app/features/hal/http/http.interfaces';

export class ApiV3QueryPaths extends ApiV3GettableResource<QueryResource> {
@LazyInject() private queryFilters:QueryFiltersService;
Expand All @@ -52,7 +53,7 @@ export class ApiV3QueryPaths extends ApiV3GettableResource<QueryResource> {
*/
public parameterised(params:object):Observable<QueryResource> {
return this.halResourceService
.get<QueryResource>(this.path, params);
.get<QueryResource>(this.path, params as HTTPClientParamMap);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/app/core/model-auth/model-auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { input } from '@openproject/reactivestates';
import { Observable } from 'rxjs';
import { takeUntil } from 'rxjs/operators';

export type ModelLinks = Record<string, any>;
export type ModelLinks = Record<string, unknown>;
export type ModelLinksHash = Record<string, ModelLinks>;

@Injectable({ providedIn: 'root' })
Expand All @@ -46,7 +46,7 @@ export class AuthorisationService {
});
}

public observeUntil(unsubscribe:Observable<any>) {
public observeUntil(unsubscribe:Observable<unknown>) {
return this.links.values$().pipe(takeUntil(unsubscribe));
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/core/schemas/schema-cache.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class SchemaCacheService extends StateCacheService<SchemaResource> {
);
}

protected loadAll(hrefs:string[]):Promise<unknown|undefined> {
protected loadAll(hrefs:string[]):Promise<unknown> {
return Promise.all(hrefs.map((href) => this.load(href)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
ResourceStore,
ResourceStoreService,
} from 'core-app/core/state/resource-store.service';
import { HttpErrorResponse } from '@angular/common/http';

@Injectable()
export class CapabilitiesResourceService extends ResourceStoreService<ICapability> {
Expand All @@ -59,7 +60,7 @@ export class CapabilitiesResourceService extends ResourceStoreService<ICapabilit
return this
.fetchCollection(params)
.pipe(
catchError((error) => {
catchError((error:HttpErrorResponse) => {
this.toastService.addError(error);
throw error;
}),
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/core/states/states.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class States extends StatesGroup {
additional:Record<string, MultiInputState<unknown>> = {};

forType<T>(stateName:string):MultiInputState<T> {
let state = (this as any)[stateName] || this.additional[stateName];
let state = (this as unknown as Record<string, MultiInputState<T>|undefined>)[stateName] ?? this.additional[stateName] as MultiInputState<T>|undefined;

if (!state) {
state = this.additional[stateName] = multiInput<T>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class EditableQueryPropsComponent implements OnInit {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return JSON.parse(this.queryProps);
} catch (e) {
console.error(`Failed to parse query props from ${this.queryProps}: ${e}`);
console.error(`Failed to parse query props from ${this.queryProps}: ${String(e)}`);
return {};
}
})();
Expand Down
18 changes: 9 additions & 9 deletions frontend/src/app/features/bim/bcf/api/bcf-api-request.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class BcfApiRequestService<T> {
responseType: 'json',
};

return this._request('get', path, config);
return this.sendRequest('get', path, config);
}

/**
Expand All @@ -81,11 +81,11 @@ export class BcfApiRequestService<T> {
* @param data Request payload (URL params for get, JSON payload otherwise)
* @param headers Request headers
*/
public request(method:HTTPSupportedMethods, path:string, data:HTTPClientParamMap = {}, headers:HTTPClientHeaders = {}):Observable<T> {
public request(method:HTTPSupportedMethods, path:string, data:unknown = {}, headers:HTTPClientHeaders = {}):Observable<T> {
// HttpClient requires us to create HttpParams instead of passing data for get
// so forward to that method instead.
if (method === 'get') {
return this.get(path, data, headers);
return this.get(path, data as HTTPClientParamMap, headers);
}

const config:HTTPClientOptions = {
Expand All @@ -95,7 +95,7 @@ export class BcfApiRequestService<T> {
responseType: 'json',
};

return this._request(method, path, config);
return this.sendRequest(method, path, config);
}

/**
Expand All @@ -107,12 +107,12 @@ export class BcfApiRequestService<T> {
*
* @private
*/
private _request(method:HTTPSupportedMethods, path:string, config:HTTPClientOptions):Observable<T> {
private sendRequest(method:HTTPSupportedMethods, path:string, config:HTTPClientOptions):Observable<T> {
return this
.http
.request<T>(method, path, config)
.pipe(
map((response:any) => this.deserialize(response)),
map((response) => this.deserialize(response)),
catchError((error:HttpErrorResponse) => {
console.error(`Failed to ${method} ${path}: ${error.name}`);
return throwError(error);
Expand All @@ -124,11 +124,11 @@ export class BcfApiRequestService<T> {
* Deserialize the JSON data into the mapped resource class, if given.
* @param data JSON API response.
*/
protected deserialize(data:any):T {
protected deserialize(data:unknown):T {
if (this.resourceClass) {
const serializer = new TypedJSON(this.resourceClass);
return serializer.parse(data)!;
return serializer.parse(data) as T;
}
return data;
return data as T;
}
}
8 changes: 4 additions & 4 deletions frontend/src/app/features/bim/bcf/api/bcf-api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,22 @@ export class BcfApiService {
.split('/');

// Try to find a target collection or resource
let current:any = this;
let current = this as object;

for (const pathOrId of parts) {
if (pathOrId in current) {
// Current has a member named like this URL part
// descend into it
current = current[pathOrId];
current = (current as Record<string, object>)[pathOrId];
} else if (current instanceof BcfResourceCollectionPath) {
// Otherwise, assume we're looking for an ID
current = current.id(pathOrId);
current = current.id(pathOrId) as object;
} else {
// Otherwise, return the current
break;
}
}

return current === this ? undefined : current;
return current === this ? undefined : current as T;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ export class BcfTopicResource {
@jsonArrayMember(String)
labels:string[];

@jsonMember({ deserializer: (value) => moment(value), serializer: (timestamp:Moment) => timestamp.toISOString() })
@jsonMember({ deserializer: (value:string) => moment(value), serializer: (timestamp:Moment) => timestamp.toISOString() })
creation_date:Moment;

@jsonMember(String)
creation_author:string;

@jsonMember({ deserializer: (value) => moment(value), serializer: (timestamp:Moment) => timestamp.toISOString() })
@jsonMember({ deserializer: (value:string) => moment(value), serializer: (timestamp:Moment) => timestamp.toISOString() })
modified_date:Moment;

@jsonMember(String, { preserveNull: true })
Expand All @@ -86,7 +86,7 @@ export class BcfTopicResource {
description:string;

@jsonMember({
deserializer: (value) => moment(value),
deserializer: (value:string) => moment(value),
serializer: (timestamp:Moment) => timestamp.format('YYYY-MM-DD'),
})
due_date:Moment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class BcfTopicCollectionPath extends BcfResourceCollectionPath<BcfTopicPa
/**
* Create a topic from its to-be-associated work package
*/
post(payload:any):Observable<BcfTopicResource> {
post(payload:unknown):Observable<BcfTopicResource> {
return this
.bcfTopicService
.request(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit, ViewChild, inject } from '@angular/core';
import { UrlParamsService } from 'core-app/core/navigation/url-params.service';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { NgxGalleryComponent, NgxGalleryOptions } from '@kolkov/ngx-gallery';
import { NgxGalleryComponent, NgxGalleryImage, NgxGalleryOptions } from '@kolkov/ngx-gallery';
import { HalLink } from 'core-app/features/hal/hal-link/hal-link';
import idFromLink from 'core-app/features/hal/helpers/id-from-link';
import { I18nService } from 'core-app/core/i18n/i18n.service';
Expand Down Expand Up @@ -135,7 +135,7 @@ export class BcfWpAttributeGroupComponent extends UntilDestroyedMixin implements

viewpoints:BcfViewpointItem[] = [];

galleryImages:any[] = [];
galleryImages:NgxGalleryImage[] = [];

// Store whether viewing is allowed
viewAllowed = false;
Expand Down Expand Up @@ -279,15 +279,15 @@ export class BcfWpAttributeGroupComponent extends UntilDestroyedMixin implements
return [
{
icon: 'icon-view-model',
onClick: (evt:any, index:number) => {
onClick: (evt:Event, index:number) => {
this.showViewpoint(this.workPackage, index);
this.gallery.preview.close();
},
titleText: this.text.show_viewpoint,
},
{
icon: 'icon-delete',
onClick: (evt:any, index:number) => this.deleteViewpoint(this.workPackage, index),
onClick: (evt:Event, index:number) => this.deleteViewpoint(this.workPackage, index),
titleText: this.text.delete_viewpoint,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class BcfExportButtonComponent extends UntilDestroyedMixin implements OnI
});
}

public showDelayedExport(event:any) {
public showDelayedExport(event:Event) {
this.requestExport(this.exportLink);

event.preventDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class AddListModalComponent extends OpModalComponent implements OnInit {

public warningText:string|undefined;

public text:any = {
public text = {
title: this.I18n.t('js.boards.add_list'),
button_add: this.I18n.t('js.button_add'),
button_create: this.I18n.t('js.button_create'),
Expand All @@ -118,7 +118,7 @@ export class AddListModalComponent extends OpModalComponent implements OnInit {

ngOnInit() {
super.ngOnInit();
this.board = this.locals.board;
this.board = this.locals.board as Board;
this.active = new Set(this.locals.active as string[]);
this.actionService = this.boardActions.get(this.board.actionAttribute!);
this.autocompleterOptions.resource = this.actionService.resourceName.toLowerCase();
Expand Down Expand Up @@ -162,15 +162,14 @@ export class AddListModalComponent extends OpModalComponent implements OnInit {
}

private getVersionPayload(name:string) {
const payload:any = {};
payload.name = name;
payload._links = {
definingProject: {
href: this.apiV3Service.projects.id(this.currentProject.id!).path,
return {
name,
_links: {
definingProject: {
href: this.apiV3Service.projects.id(this.currentProject.id!).path,
},
},
};

return payload;
}

private warnIfNoOptions(values:unknown[]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ import { firstValueFrom } from 'rxjs';
import { WorkPackageIsolatedQuerySpaceDirective } from 'core-app/features/work-packages/directives/query-space/wp-isolated-query-space.directive';
import { CurrentProjectService } from 'core-app/core/current-project/current-project.service';
import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';
import { HTTPClientParamMap } from 'core-app/features/hal/http/http.interfaces';

export interface DisabledButtonPlaceholder {
text:string;
Expand Down Expand Up @@ -176,7 +177,7 @@ export class BoardListComponent extends AbstractWidgetComponent implements OnIni

private canAdd = firstValueFrom(this.wpInlineCreate.canAdd);

public columnsQueryProps:any;
public columnsQueryProps:HTTPClientParamMap;

public get text() {
return {
Expand Down Expand Up @@ -480,7 +481,7 @@ export class BoardListComponent extends AbstractWidgetComponent implements OnIni
const existingFilters = (this.resource.options.filters || []) as ApiV3Filter[];

const newFilters = existingFilters.concat(filters);
const newColumnsQueryProps:any = {
const newColumnsQueryProps:HTTPClientParamMap = {
'columns[]': ['id', 'subject'],
showHierarchies: false,
pageSize: 500,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,19 +183,20 @@ export class BoardListContainerComponent extends UntilDestroyedMixin implements
this.saveBoard(board);
}

addList(board:Board):any {
addList(board:Board):Promise<unknown>|undefined {
if (board.isFree) {
return this.BoardList
.addFreeQuery(board, { name: this.text.unnamedList })
.then((board) => this.Boards.save(board).toPromise())
.catch((error) => this.showError(error));
.catch((error) => this.showError(error as string));
}
const active = this.getActionFiltersFromWidget(board);
this.opModalService.show(
AddListModalComponent,
this.injector,
{ board, active },
);
return undefined;
}

changeVisibilityOfList(board:Board, boardWidget:GridWidgetResource, visible:boolean) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { SubmenuService } from 'core-app/core/main-menu/submenu.service';
import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';
import { CurrentProjectService } from 'core-app/core/current-project/current-project.service';
import * as Turbo from '@hotwired/turbo';
import { ApiV3Filter } from 'core-app/shared/helpers/api-v3/api-v3-filter-builder';

export function boardCardViewHandlerFactory(injector:Injector) {
return new CardViewHandlerRegistry(injector);
Expand Down Expand Up @@ -189,7 +190,7 @@ export class BoardPartitionedPageComponent extends UntilDestroyedMixin implement
this.editable = board.editable;
this.selectedTitle = board.name;
this.titleService.setFirstPart(board.name);
this.boardFilters.filters.putValue(queryProps ? JSON.parse(queryProps) : board.filters);
this.boardFilters.filters.putValue(queryProps ? JSON.parse(queryProps) as ApiV3Filter[] : board.filters);

this.cdRef.detectChanges();
});
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/features/boards/board/board.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class BoardService {
private text = {
unnamed_board: this.I18n.t('js.boards.label_unnamed_board'),
action_board: (attr:string) => this.I18n.t('js.boards.board_type.action_by_attribute',
{ attribute: this.I18n.t(`js.boards.board_type.action_type.${attr}`) }),
{ attribute: this.I18n.t<string>(`js.boards.board_type.action_type.${attr}`) }),
unnamed_list: this.I18n.t('js.boards.label_unnamed_list'),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class BoardHighlightingTabComponent implements TabComponent, OnInit {
}

ngOnInit() {
this.board = this.locals.board;
this.board = this.locals.board as Board;
this.highlightingMode = this.board.highlightingMode;
this.updateMode(this.highlightingMode);
}
Expand Down
Loading
Loading