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 @@ -62,7 +62,7 @@ export abstract class ApiV3Collection<
if (response instanceof CollectionResource) {
response.elements?.forEach(this.touch.bind(this));
} else if (response instanceof HalResource) {
this.touch(response as any);
this.touch(response as unknown as T);
}
},
),
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/app/core/apiv3/cache/state-cache.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ export class StateCacheService<T> {
*
* @param resource<T> The value.
*/
public updateFor(resource:HasId):Promise<T> {
return this.updateValue(resource.id!, resource as any);
public updateFor(resource:T & HasId):Promise<T> {
return this.updateValue(resource.id!, resource);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ import URI from 'urijs';
import { map, tap } from 'rxjs/operators';
import { LazyInject } from 'core-app/shared/helpers/angular/lazy-inject.decorator';
import { QueryFiltersService } from 'core-app/features/work-packages/components/wp-query/query-filters.service';
import { HalSourceLink } from 'core-app/features/hal/interfaces';

export interface QueryFormPayload {
[key:string]:unknown;
name?:string;
_links?:Record<string, HalSourceLink|HalSourceLink[]>;
}

export class ApiV3QueryForm extends ApiV3FormResource<QueryFormResource> {
@LazyInject() private queryFilters:QueryFiltersService;
Expand All @@ -46,7 +53,7 @@ export class ApiV3QueryForm extends ApiV3FormResource<QueryFormResource> {
// We need a valid payload so that we
// can check whether form saving is possible.
// The query needs a name to be valid.
const payload:any = {
const payload:QueryFormPayload = {
name: query.name || '!!!__O__o__O__!!!',
};

Expand Down Expand Up @@ -75,7 +82,7 @@ export class ApiV3QueryForm extends ApiV3FormResource<QueryFormResource> {
* @param projectIdentifier
* @param payload
*/
public loadWithParams(params:Record<string, unknown>, queryId:string|null|undefined, projectIdentifier:string|undefined|null, payload:any = {}):Observable<[QueryFormResource, QueryResource]> {
public loadWithParams(params:Record<string, unknown>, queryId:string|null|undefined, projectIdentifier:string|undefined|null, payload:QueryFormPayload = {}):Observable<[QueryFormResource, QueryResource]> {
// We need a valid payload so that we
// can check whether form saving is possible.
// The query needs a name to be valid.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ export class BoardAssigneeActionService extends CachedBoardActionService {

image = imagePath('board_creation_modal/assignees.svg');

readonly unassignedUser:any = {
readonly unassignedUser = {
id: null,
href: null,
name: this.I18n.t('js.filter.noneElement'),
};
} as unknown as HalResource;

/**
* Add a single action query
*/
addColumnWithActionAttribute(board:Board, value:HalResource):Promise<Board> {
const params:any = {
const params = {
name: value.name,
};

Expand Down Expand Up @@ -148,7 +148,7 @@ export class BoardAssigneeActionService extends CachedBoardActionService {
.available_assignees
.get()
.pipe(
map((collection:CollectionResource<UserResource>) => [this.unassignedUser].concat(collection.elements) as HalResource[]),
map((collection:CollectionResource<UserResource>) => [this.unassignedUser].concat(collection.elements)),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export abstract class BoardActionService {
* Add a single action query
*/
addColumnWithActionAttribute(board:Board, value:HalResource):Promise<Board> {
const params:any = {
const params = {
name: value.name,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import { WorkPackageCreateComponent } from 'core-app/features/work-packages/components/wp-new/wp-create.component';
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { BreadcrumbItem } from 'core-app/shared/components/breadcrumbs/op-breadcrumbs.component';

@Component({
// eslint-disable-next-line @angular-eslint/component-selector
Expand All @@ -39,11 +40,11 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
})
export class WorkPackageNewFullViewComponent extends WorkPackageCreateComponent {
breadcrumbItems() {
const items = [];
const items:BreadcrumbItem[] = [];
if (this.currentProjectService?.identifier) {
items.push({
href: this.pathHelper.projectPath(this.currentProjectService.identifier),
text: this.currentProjectService.name,
text: this.currentProjectService.name!,
});
}
items.push({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class UrlParamsHelperService {


// copied more or less from angular buildUrl
public buildQueryString(params:any) {
public buildQueryString(params:object|null|undefined) {
if (!params) {
return undefined;
}
Expand Down Expand Up @@ -256,7 +256,7 @@ export class UrlParamsHelperService {
const properties = JSON.parse(updateJson) as QueryProps;

if (properties.c) {
queryData['columns[]'] = properties.c.map((column:any) => column);
queryData['columns[]'] = properties.c.map((column) => column);
}
if (properties.s) {
queryData.showSums = properties.s;
Expand Down Expand Up @@ -287,7 +287,7 @@ export class UrlParamsHelperService {
}

if (properties.hla) {
queryData['highlightedAttributes[]'] = properties.hla.map((column:any) => column);
queryData['highlightedAttributes[]'] = properties.hla.map((column) => column);
}

if (properties.hi !== undefined) {
Expand Down Expand Up @@ -319,7 +319,7 @@ export class UrlParamsHelperService {

// Sortation
if (properties.t) {
queryData.sortBy = JSON.stringify(properties.t.split(',').map((sort:any) => sort.split(':')));
queryData.sortBy = JSON.stringify(properties.t.split(',').map((sort) => sort.split(':')));
}

if (properties.ts) {
Expand Down Expand Up @@ -401,7 +401,7 @@ export class UrlParamsHelperService {

private buildV3GetColumnsFromQueryResource(query:QueryResource):string[] {
if (query.columns) {
return query.columns.map((column:any) => column.id || idFromLink(column.href)) as string[];
return query.columns.map((column) => column.id || idFromLink(column.href));
}
const links = query._links as { columns?:HalLink[] };
if (links.columns) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import { QueryResource } from 'core-app/features/hal/resources/query-resource';
import { ChartOptions } from 'chart.js';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { QueryFormPayload } from 'core-app/core/apiv3/endpoints/queries/apiv3-query-form';

export interface WpGraphQueryParams {
id?:string;
Expand All @@ -54,7 +55,7 @@ export class WpGraphConfiguration implements WpGraphConfiguration {
this.chartType = this.chartType || 'bar';
}

public static queryCreationParams(i18n:I18nService, isPublic:boolean):unknown {
public static queryCreationParams(i18n:I18nService, isPublic:boolean):QueryFormPayload {
return {
public: isPublic,
name: i18n.t('js.grid.widgets.work_packages_graph.title'),
Expand Down
Loading