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 @@ -26,7 +26,7 @@
// See COPYRIGHT and LICENSE files for more details.
//++

import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, Injector, Input, OnInit, Output, ViewChild, OnDestroy, inject } from '@angular/core';
import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, Injector, Input, OnInit, Output, ViewChild, OnDestroy, inject, ProviderToken } from '@angular/core';
import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/query-space/isolated-query-space';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { WorkPackageInlineCreateService } from 'core-app/features/work-packages/components/wp-inline-create/wp-inline-create.service';
Expand Down Expand Up @@ -224,7 +224,10 @@ export class WorkPackageCardViewComponent extends UntilDestroyedMixin implements
this.cardDragDrop.init(this);

// Register event handlers for the cards
const registry = this.injector.get<any>(WorkPackageViewHandlerToken, CardViewHandlerRegistry);
const registry = this.injector.get(
WorkPackageViewHandlerToken as ProviderToken<CardViewHandlerRegistry|typeof CardViewHandlerRegistry>,
CardViewHandlerRegistry,
);
if (registry instanceof CardViewHandlerRegistry) {
registry.attachTo(this);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { DisplayFieldService } from 'core-app/shared/components/fields/display/d
import { groupedRowClassName } from 'core-app/features/work-packages/components/wp-fast-table/builders/modes/grouped/grouped-rows-helpers';
import { SchemaResource } from 'core-app/features/hal/resources/schema-resource';
import { GroupObject } from 'core-app/features/hal/resources/wp-collection-resource';
import { HalResource } from 'core-app/features/hal/resources/hal-resource';

export class GroupSumsBuilder extends SingleRowBuilder {
@LazyInject() readonly querySpace:IsolatedQuerySpace;
Expand All @@ -56,7 +57,7 @@ export class GroupSumsBuilder extends SingleRowBuilder {
return tr;
}

public renderColumns(sums:Record<string, any>, tr:HTMLTableRowElement) {
public renderColumns(sums:GroupObject['sums'], tr:HTMLTableRowElement) {
this.augmentedColumns.forEach((column, i:number) => {
const td = document.createElement('td');
const div = this.renderContent(sums, column.id, this.sumsSchema[column.id] as IFieldSchema);
Expand Down Expand Up @@ -85,7 +86,7 @@ export class GroupSumsBuilder extends SingleRowBuilder {
return this.schemaCache.state(href).value!;
}

private renderContent(sums:any, name:string, fieldSchema:IFieldSchema) {
private renderContent(sums:GroupObject['sums'], name:string, fieldSchema:IFieldSchema) {
const div = document.createElement('div');
div.classList.add('wp-table--sum-container', name);

Expand All @@ -96,7 +97,7 @@ export class GroupSumsBuilder extends SingleRowBuilder {
}

const field = this.displayFieldService.getField(
sums,
sums as unknown as HalResource,
name,
fieldSchema,
{ injector: this.injector, container: 'table', options: {} },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import { GroupObject } from 'core-app/features/hal/resources/wp-collection-resource';

export function groupIdentifier(group:GroupObject) {
let value = group.value || 'nullValue';
let value = (group.value as string) || 'nullValue';

if (group.href) {
try {
Expand All @@ -44,7 +44,7 @@ export function groupIdentifier(group:GroupObject) {
}

export function groupName(group:GroupObject) {
const { value } = group;
const value = group.value as string|null;
if (value === null) {
return '-';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import {
} from 'core-app/features/work-packages/components/wp-fast-table/handlers/state/sharing-transformer';

// noinspection JSUnusedLocalSymbols
type StateTransformers = new(injector:Injector, table:WorkPackageTable) => any;
type StateTransformers = new(injector:Injector, table:WorkPackageTable) => unknown;

export interface TableEventComponent extends WorkPackageViewOutputs {
// Reference to the fast table instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* A PortalOutlet that lets multiple components live for the lifetime of the outlet,
* allowing faster switching and persistent data.
*/
import { ComponentPortal } from '@angular/cdk/portal';
import { ComponentPortal, ComponentType } from '@angular/cdk/portal';
import {
ApplicationRef,
ComponentRef,
Expand All @@ -41,7 +41,7 @@ import {
import { TabDefinition } from 'core-app/shared/components/tabs/tab.interface';

export interface TabInterface extends TabDefinition {
componentClass:new(...args:any[]) => TabComponent;
componentClass:ComponentType<TabComponent>;
}

export interface TabComponent {
Expand Down Expand Up @@ -88,7 +88,7 @@ export class TabPortalOutlet {
// At this point the component has been instantiated, so we move it to the location in the DOM
// where we want it to be rendered.
this.outletElement.innerHTML = '';
this.outletElement.appendChild(this._getComponentRootNode(instance.componentRef));
this.outletElement.appendChild(this.getComponentRootNode(instance.componentRef));
this.outletElement.dataset.tabName = tab.name;
this.currentTab = instance;
}
Expand Down Expand Up @@ -144,7 +144,7 @@ export class TabPortalOutlet {
}

/** Gets the root HTMLElement for an instantiated component. */
private _getComponentRootNode(componentRef:ComponentRef<any>):HTMLElement {
return (componentRef.hostView as EmbeddedViewRef<any>).rootNodes[0] as HTMLElement;
private getComponentRootNode(componentRef:ComponentRef<unknown>):HTMLElement {
return (componentRef.hostView as EmbeddedViewRef<unknown>).rootNodes[0] as HTMLElement;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class WpTableConfigurationHighlightingTabComponent implements TabComponen

public availableInlineHighlightedAttributes:HalResource[] = [];

public selectedAttributes:any[] = [];
public selectedAttributes:HalResource[] = [];

public availableRowHighlightedAttributes:{ name:string; value:HighlightingMode }[] = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
import { QueryFormResource } from 'core-app/features/hal/resources/query-form-resource';
import { QueryResource } from 'core-app/features/hal/resources/query-resource';

export const WpTableConfigurationModalPrependToken = new InjectionToken<ComponentType<any>>('WpTableConfigurationModalPrependComponent');
export const WpTableConfigurationModalPrependToken = new InjectionToken<ComponentType<unknown>>('WpTableConfigurationModalPrependComponent');

@Component({
templateUrl: './wp-table-configuration.modal.html',
Expand Down Expand Up @@ -107,7 +107,7 @@ export class WpTableConfigurationModalComponent extends OpModalComponent impleme

this.loadingIndicator.indicator('modal').promise = this.loadForm()
.then(() => {
const initialTabName = this.locals.initialTab;
const initialTabName = this.locals.initialTab as string|undefined;
const initialTab = this.availableTabs.find((el) => el.id === initialTabName);
this.switchTo(initialTab || this.availableTabs[0]);
this.cdRef.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ export class WorkPackageContextMenuHelperService {
},
];

public getPermittedActionLinks(workPackage:WorkPackageResource, permittedActionConstants:any, allowSplitScreenActions:boolean):WorkPackageAction[] {
const singularPermittedActions:any[] = [];
public getPermittedActionLinks(workPackage:WorkPackageResource, permittedActionConstants:WorkPackageAction[], allowSplitScreenActions:boolean):WorkPackageAction[] {
const singularPermittedActions:WorkPackageAction[] = [];

let allowedActions = this.getAllowedActions(workPackage, permittedActionConstants);

Expand Down Expand Up @@ -146,15 +146,15 @@ export class WorkPackageContextMenuHelperService {
return bulkPermittedActions;
}

public getBulkActionLink(action:any, workPackages:any) {
public getBulkActionLink(action:WorkPackageAction, workPackages:WorkPackageResource[]) {
const workPackageIdParams = {
'ids[]': workPackages.map((wp:any) => wp.id),
'ids[]': workPackages.map((wp) => wp.id),
};
const serializedIdParams = this.UrlParamsHelper.buildQueryString(workPackageIdParams);

const linkAndQueryString = action.href.split('?');
const linkAndQueryString = action.href!.split('?');
const link = linkAndQueryString.shift();
const queryParts = linkAndQueryString.concat(new Array(serializedIdParams));
const queryParts = linkAndQueryString.concat(new Array<string>(serializedIdParams!));

return `${link}?${queryParts.join('&')}`;
}
Expand Down Expand Up @@ -247,7 +247,7 @@ export class WorkPackageContextMenuHelperService {
return allowedActions;
}

public getPermittedActions(workPackages:WorkPackageResource[], permittedActionConstants:any, allowSplitScreenActions:boolean):WorkPackageAction[] {
public getPermittedActions(workPackages:WorkPackageResource[], permittedActionConstants:WorkPackageAction[], allowSplitScreenActions:boolean):WorkPackageAction[] {
if (workPackages.length === 1) {
return this.getPermittedActionLinks(workPackages[0], permittedActionConstants, allowSplitScreenActions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export abstract class WorkPackageEmbeddedBaseComponent extends WorkPackagesViewB
this.cdRef.detectChanges();
}

public refresh(visible = true, firstPage = false):Promise<any> {
public refresh(visible = true, firstPage = false):void {
const query = this.querySpace.query.value!;
const pagination = this.wpTablePagination.paginationObject;

Expand All @@ -133,7 +133,6 @@ export abstract class WorkPackageEmbeddedBaseComponent extends WorkPackagesViewB
if (visible) {
this.loadingIndicator = promise;
}
return promise;
}

public get isInitialized() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
//++

import { InjectionToken } from '@angular/core';
import type { QueryConfigurationLocals } from 'core-app/features/work-packages/components/wp-table/external-configuration/external-query-configuration.component';

export const OpQueryConfigurationLocalsToken = new InjectionToken<any>('OpQueryConfigurationLocalsToken');
export const OpQueryConfigurationLocalsToken = new InjectionToken<QueryConfigurationLocals>('OpQueryConfigurationLocalsToken');
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
//++

import { ApplicationRef, Injectable, Injector, inject } from '@angular/core';
import { ComponentPortal, DomPortalOutlet } from '@angular/cdk/portal';
import { ComponentPortal, ComponentType, DomPortalOutlet } from '@angular/cdk/portal';
import { FocusHelperService } from 'core-app/shared/directives/focus/focus-helper';
import {
ExternalQueryConfigurationComponent,
QueryConfigurationLocals,
} from 'core-app/features/work-packages/components/wp-table/external-configuration/external-query-configuration.component';
import { OpQueryConfigurationLocalsToken } from 'core-app/features/work-packages/components/wp-table/external-configuration/external-query-configuration.constants';

export type Class = new(...args:any[]) => any;
export type Class = ComponentType<unknown>;

@Injectable()
export class ExternalQueryConfigurationService {
Expand Down Expand Up @@ -101,7 +101,7 @@ export class ExternalQueryConfigurationService {
* This allows callers to pass data into the newly created modal.
*
*/
private injectorFor(data:any) {
private injectorFor(data:Partial<QueryConfigurationLocals>) {
// Pass the service because otherwise we're getting a cyclic dependency between the portal
// host service and the bound portal
data.service = this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ export class TimelineMilestoneCellRenderer extends TimelineCellRenderer {
*/
public assignDateValues(change:WorkPackageChangeset,
labels:WorkPackageCellLabels,
dates:any):void {
this.assignDate(change, 'date', dates.date);
dates:CellDateMovement):void {
this.assignDate(change, 'date', dates.date!);
this.updateLabels(true, labels, change);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class WorkPackageTimelineTableController extends UntilDestroyedMixin impl
private orderedRows:RenderedWorkPackage[] = [];

get commonPipes() {
return (source:Observable<any>) => source.pipe(
return <T>(source:Observable<T>) => source.pipe(
this.untilDestroyed(),
takeUntil(this.querySpace.stopAllSubscriptions),
filter(() => this.initialized && this.wpTableTimeline.isVisible),
Expand Down Expand Up @@ -300,7 +300,7 @@ export class WorkPackageTimelineTableController extends UntilDestroyedMixin impl
relationType: 'follows',
});
})
.catch((error:any) => this.notificationService.handleRawError(error, end));
.catch((error:unknown) => this.notificationService.handleRawError(error, end));
});
}

Expand All @@ -315,7 +315,7 @@ export class WorkPackageTimelineTableController extends UntilDestroyedMixin impl
relationType: 'precedes',
});
})
.catch((error:any) => this.notificationService.handleRawError(error, end));
.catch((error:unknown) => this.notificationService.handleRawError(error, end));
});
}

Expand Down Expand Up @@ -366,7 +366,7 @@ export class WorkPackageTimelineTableController extends UntilDestroyedMixin impl
this.refreshView();
}

private activateSelectionMode(start:string, callback:(wp:WorkPackageResource) => any) {
private activateSelectionMode(start:string, callback:(wp:WorkPackageResource) => void) {
start = start.toString(); // old system bug: ID can be a 'number'

this._viewParameters.activeSelectionMode = (wp:WorkPackageResource) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class TimelineViewParameters {

settings:TimelineViewParametersSettings = new TimelineViewParametersSettings();

activeSelectionMode:null | ((wp:WorkPackageResource) => any) = null;
activeSelectionMode:null | ((wp:WorkPackageResource) => void) = null;

selectionModeStart:null | string = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
// See COPYRIGHT and LICENSE files for more details.
//++

type IGroupCellsMap = Record<string, WorkPackageTimelineCell[]>;
type IGroupCellsMap = Record<string, import('core-app/features/work-packages/components/wp-table/timeline/cells/wp-timeline-cell').WorkPackageTimelineCell[]>;
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class WorkPackageTableConfiguration {
constructor(providedConfig:WorkPackageTableConfigurationObject) {
Object.entries(providedConfig).forEach(([k, value]) => {
const key = (k as keyof WorkPackageTableConfiguration);
(this as any)[key] = value;
(this as Record<string, unknown>)[key] = value;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class WorkPackagesTableComponent extends UntilDestroyedMixin implements O

private element:HTMLElement;

private scrollSyncUpdate:(timelineVisible:boolean) => any;
private scrollSyncUpdate:(timelineVisible:boolean) => void;

private wpTableHoverSync:WpTableHoverSync;

Expand All @@ -114,7 +114,13 @@ export class WorkPackagesTableComponent extends UntilDestroyedMixin implements O

public locale:string;

public text:any;
public text:{
cancel:string;
noResults:{ title:string; description:string };
limitedResults:(count:number, total:number) => string;
tableSummary:string;
tableSummaryHints:string;
};

public results:WorkPackageCollectionResource;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class OpColumnsContextMenu extends OpContextMenuTrigger {
hidden: !this.wpTableSortBy.isSortable(c),
linkText: this.I18n.t('js.work_packages.query.sort_descending'),
icon: 'icon-sort-descending',
onClick: (evt:any) => {
onClick: () => {
if (this.wpTableSortBy.isManualSortingMode) {
this.confirmDialog.confirm({
text: this.text.confirmDelete,
Expand All @@ -128,7 +128,7 @@ export class OpColumnsContextMenu extends OpContextMenuTrigger {
hidden: !this.wpTableSortBy.isSortable(c),
linkText: this.I18n.t('js.work_packages.query.sort_ascending'),
icon: 'icon-sort-ascending',
onClick: (evt:any) => {
onClick: () => {
if (this.wpTableSortBy.isManualSortingMode) {
this.confirmDialog.confirm({
text: this.text.confirmDelete,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class OpContextMenuTrigger extends OpContextMenuHandler implements AfterV
});

// Open with keyboard combination as well
Mousetrap(this.element).bind('shift+alt+f10', (evt:any) => {
Mousetrap(this.element).bind('shift+alt+f10', (evt) => {
this.open(evt);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class OpSettingsMenuDirective extends OpContextMenuTrigger implements Aft

private form:QueryFormResource;

private loadingPromise:PromiseLike<any>;
private loadingPromise:PromiseLike<unknown>;

override readonly placement = 'bottom-end';

Expand Down Expand Up @@ -133,11 +133,11 @@ export class OpSettingsMenuDirective extends OpContextMenuTrigger implements Aft
}
}

private allowQueryAction(event:Event, action:any) {
private allowQueryAction(event:Event, action:string) {
return this.allowAction(event, 'query', action);
}

private allowWorkPackageAction(event:Event, action:any) {
private allowWorkPackageAction(event:Event, action:string) {
return this.allowAction(event, 'work_packages', action);
}

Expand All @@ -149,7 +149,7 @@ export class OpSettingsMenuDirective extends OpContextMenuTrigger implements Aft
return false;
}

private allowAction(event:Event, modelName:string, action:any) {
private allowAction(event:Event, modelName:string, action:string) {
if (this.authorisationService.can(modelName, action)) {
return true;
}
Expand Down
Loading
Loading