Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Use forked reactivestates to build with rxjs

Oliver Günther17b47504d364
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index b94463a1474..42b5e027606 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -40,6 +40,7 @@
"@ng-select/ng-select": "^4.0.4",
"@ngneat/content-loader": "^6.1.0",
"@ngx-formly/core": "^5.10.19",
+ "@openproject/reactivestates": "^3.0.1",
"@uirouter/angular": "^11.1.0",
"@uirouter/core": "^6.0.8",
"@uirouter/rx": "^1.0.0",
@@ -80,7 +81,6 @@
"observable-array": "0.0.4",
"pako": "^2.0.3",
"qr-creator": "^1.0.0",
- "reactivestates": "2.0.1",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.0",
"screenfull": "^4.2.1",
@@ -6177,6 +6177,17 @@
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
}
},
+ "node_modules/@openproject/reactivestates": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/@openproject/reactivestates/-/reactivestates-3.0.1.tgz",
+ "integrity": "sha512-Ov9TyxGCDSPU6Uv83bUN7dEn8ntAZsFAioPtZ0F6ZBJ+OU7NS7raDz/5gGjbmk8ESRcmcZvWSmncRHG2rj74Fw==",
+ "dependencies": {
+ "rxjs": "^7.8.0"
+ },
+ "peerDependencies": {
+ "rxjs": "^7.8.0"
+ }
+ },
"node_modules/@polka/url": {
"version": "1.0.0-next.15",
"resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.15.tgz",
@@ -35995,33 +36006,6 @@
"react-dom": ">=16.6.0"
}
},
- "node_modules/reactivestates": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/reactivestates/-/reactivestates-2.0.1.tgz",
- "integrity": "sha512-WppC3LbbOcfMCIyxBNLemI0W3pYG0Au9fUQMscNCmZkJEf5pgvunERv92nhWaEHsKCDgMsLl7BmTQmjv/p/B8A==",
- "dependencies": {
- "rxjs": "^6.0.0"
- },
- "peerDependencies": {
- "rxjs": "^6.0.0"
- }
- },
- "node_modules/reactivestates/node_modules/rxjs": {
- "version": "6.6.7",
- "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
- "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==",
- "dependencies": {
- "tslib": "^1.9.0"
- },
- "engines": {
- "npm": ">=2.0.0"
- }
- },
- "node_modules/reactivestates/node_modules/tslib": {
- "version": "1.14.1",
- "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
- "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
- },
"node_modules/read-package-json": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-6.0.1.tgz",
@@ -47210,6 +47194,14 @@
}
}
},
+ "@openproject/reactivestates": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/@openproject/reactivestates/-/reactivestates-3.0.1.tgz",
+ "integrity": "sha512-Ov9TyxGCDSPU6Uv83bUN7dEn8ntAZsFAioPtZ0F6ZBJ+OU7NS7raDz/5gGjbmk8ESRcmcZvWSmncRHG2rj74Fw==",
+ "requires": {
+ "rxjs": "^7.8.0"
+ }
+ },
"@polka/url": {
"version": "1.0.0-next.15",
"resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.15.tgz",
@@ -70044,29 +70036,6 @@
"prop-types": "^15.6.2"
}
},
- "reactivestates": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/reactivestates/-/reactivestates-2.0.1.tgz",
- "integrity": "sha512-WppC3LbbOcfMCIyxBNLemI0W3pYG0Au9fUQMscNCmZkJEf5pgvunERv92nhWaEHsKCDgMsLl7BmTQmjv/p/B8A==",
- "requires": {
- "rxjs": "^6.0.0"
- },
- "dependencies": {
- "rxjs": {
- "version": "6.6.7",
- "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
- "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==",
- "requires": {
- "tslib": "^1.9.0"
- }
- },
- "tslib": {
- "version": "1.14.1",
- "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
- "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
- }
- }
- },
"read-package-json": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-6.0.1.tgz",
diff --git a/frontend/package.json b/frontend/package.json
index da6879c2e5c..08dc5806bc0 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -113,6 +113,7 @@
"@ng-select/ng-select": "^4.0.4",
"@ngneat/content-loader": "^6.1.0",
"@ngx-formly/core": "^5.10.19",
+ "@openproject/reactivestates": "^3.0.1",
"@uirouter/angular": "^11.1.0",
"@uirouter/core": "^6.0.8",
"@uirouter/rx": "^1.0.0",
@@ -153,7 +154,6 @@
"observable-array": "0.0.4",
"pako": "^2.0.3",
"qr-creator": "^1.0.0",
- "reactivestates": "2.0.1",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.0",
"screenfull": "^4.2.1",
diff --git a/frontend/src/app/core/apiv3/cache/cachable-apiv3-resource.ts b/frontend/src/app/core/apiv3/cache/cachable-apiv3-resource.ts
index 9e3eda1d509..08454823dcf 100644
--- a/frontend/src/app/core/apiv3/cache/cachable-apiv3-resource.ts
+++ b/frontend/src/app/core/apiv3/cache/cachable-apiv3-resource.ts
@@ -76,7 +76,7 @@ export abstract class ApiV3Resource<T extends HasId = HalResource>
return concat(
observable,
this.cache.state(id).values$(),
- ) as Observable<T>;
+ );
}
return this.cache.state(id).values$();
diff --git a/frontend/src/app/core/apiv3/cache/state-cache.service.ts b/frontend/src/app/core/apiv3/cache/state-cache.service.ts
index 295d3c52617..569613b2c39 100644
--- a/frontend/src/app/core/apiv3/cache/state-cache.service.ts
+++ b/frontend/src/app/core/apiv3/cache/state-cache.service.ts
@@ -26,7 +26,7 @@
// See COPYRIGHT and LICENSE files for more details.
//++
-import { MultiInputState, State } from 'reactivestates';
+import { MultiInputState, State } from '@openproject/reactivestates';
import {
firstValueFrom,
Observable,
diff --git a/frontend/src/app/core/apiv3/endpoints/projects/project.cache.ts b/frontend/src/app/core/apiv3/endpoints/projects/project.cache.ts
index 9386fdefe73..b32a9f221bd 100644
--- a/frontend/src/app/core/apiv3/endpoints/projects/project.cache.ts
+++ b/frontend/src/app/core/apiv3/endpoints/projects/project.cache.ts
@@ -26,7 +26,7 @@
// See COPYRIGHT and LICENSE files for more details.
//++
-import { MultiInputState } from 'reactivestates';
+import { MultiInputState } from '@openproject/reactivestates';
import { Injectable, Injector } from '@angular/core';
import { StateCacheService } from 'core-app/core/apiv3/cache/state-cache.service';
import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';
diff --git a/frontend/src/app/core/apiv3/endpoints/time-entries/time-entry-cache.service.ts b/frontend/src/app/core/apiv3/endpoints/time-entries/time-entry-cache.service.ts
index 1aa2645e9f2..9030bf83201 100644
--- a/frontend/src/app/core/apiv3/endpoints/time-entries/time-entry-cache.service.ts
+++ b/frontend/src/app/core/apiv3/endpoints/time-entries/time-entry-cache.service.ts
@@ -32,7 +32,7 @@ import { SchemaCacheService } from 'core-app/core/schemas/schema-cache.service';
import { States } from 'core-app/core/states/states.service';
import { Injector } from '@angular/core';
import { StateCacheService } from 'core-app/core/apiv3/cache/state-cache.service';
-import { MultiInputState } from 'reactivestates';
+import { MultiInputState } from '@openproject/reactivestates';
export class TimeEntryCacheService extends StateCacheService<TimeEntryResource> {
@InjectField() readonly states:States;
diff --git a/frontend/src/app/core/apiv3/endpoints/work_packages/api-v3-work-packages-paths.ts b/frontend/src/app/core/apiv3/endpoints/work_packages/api-v3-work-packages-paths.ts
index d2f32f5da55..b76186aa88b 100644
--- a/frontend/src/app/core/apiv3/endpoints/work_packages/api-v3-work-packages-paths.ts
+++ b/frontend/src/app/core/apiv3/endpoints/work_packages/api-v3-work-packages-paths.ts
@@ -95,7 +95,7 @@ export class ApiV3WorkPackagesPaths extends ApiV3Collection<WorkPackageResource,
* @param payload
* @return {Promise<WorkPackageResource>}
*/
- public post(payload:Object):Observable<WorkPackageResource> {
+ public post(payload:object):Observable<WorkPackageResource> {
return this
.halResourceService
.post<WorkPackageResource>(this.path, payload)
@@ -161,11 +161,9 @@ export class ApiV3WorkPackagesPaths extends ApiV3Collection<WorkPackageResource,
protected loadCollectionsFor(ids:string[]):Promise<WorkPackageCollectionResource[]> {
return this
.halResourceService
- .getAllPaginated<WorkPackageCollectionResource>(
+ .getAllPaginated(
this.path,
- {
- filters: ApiV3Filter('id', '=', ids).toJson(),
- },
+ { filters: ApiV3Filter('id', '=', ids).toJson() },
)
.toPromise() as Promise<WorkPackageCollectionResource[]>;
}
diff --git a/frontend/src/app/core/apiv3/endpoints/work_packages/work-package.cache.ts b/frontend/src/app/core/apiv3/endpoints/work_packages/work-package.cache.ts
index 3e198621eca..930c82efff7 100644
--- a/frontend/src/app/core/apiv3/endpoints/work_packages/work-package.cache.ts
+++ b/frontend/src/app/core/apiv3/endpoints/work_packages/work-package.cache.ts
@@ -26,7 +26,7 @@
// See COPYRIGHT and LICENSE files for more details.
//++
-import { MultiInputState } from 'reactivestates';
+import { MultiInputState } from '@openproject/reactivestates';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { Injectable, Injector } from '@angular/core';
import { debugLog } from 'core-app/shared/helpers/debug_output';
diff --git a/frontend/src/app/core/config/configuration.service.ts b/frontend/src/app/core/config/configuration.service.ts
index da98247ab4e..0fd8f87017a 100644
--- a/frontend/src/app/core/config/configuration.service.ts
+++ b/frontend/src/app/core/config/configuration.service.ts
@@ -31,7 +31,6 @@ import * as moment from 'moment';
import { ConfigurationResource } from 'core-app/features/hal/resources/configuration-resource';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
-import { HalResource } from 'core-app/features/hal/resources/hal-resource';
@Injectable({ providedIn: 'root' })
export class ConfigurationService {
diff --git a/frontend/src/app/core/model-auth/model-auth.service.ts b/frontend/src/app/core/model-auth/model-auth.service.ts
index dac2957b219..18a57440000 100644
--- a/frontend/src/app/core/model-auth/model-auth.service.ts
+++ b/frontend/src/app/core/model-auth/model-auth.service.ts
@@ -27,7 +27,7 @@
//++
import { Injectable } from '@angular/core';
-import { input } from 'reactivestates';
+import { input } from '@openproject/reactivestates';
import { Observable } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
diff --git a/frontend/src/app/core/schemas/schema-cache.service.ts b/frontend/src/app/core/schemas/schema-cache.service.ts
index 4d5e349ef33..64f95174372 100644
--- a/frontend/src/app/core/schemas/schema-cache.service.ts
+++ b/frontend/src/app/core/schemas/schema-cache.service.ts
@@ -25,7 +25,7 @@
//
// See COPYRIGHT and LICENSE files for more details.
//++
-import { State } from 'reactivestates';
+import { State } from '@openproject/reactivestates';
import { Injectable } from '@angular/core';
import { StateCacheService } from 'core-app/core/apiv3/cache/state-cache.service';
import { Observable } from 'rxjs';
diff --git a/frontend/src/app/core/setup/globals/openproject.ts b/frontend/src/app/core/setup/globals/openproject.ts
index f62bae4595a..c44b48c3a09 100644
--- a/frontend/src/app/core/setup/globals/openproject.ts
+++ b/frontend/src/app/core/setup/globals/openproject.ts
@@ -27,7 +27,7 @@
//++
import { OpenProjectPluginContext } from 'core-app/features/plugins/plugin-context';
-import { input, InputState } from 'reactivestates';
+import { input, InputState } from '@openproject/reactivestates';
import { take } from 'rxjs/operators';
import { GlobalHelpers } from 'core-app/core/setup/globals/global-helpers';
import { firstValueFrom } from 'rxjs';
diff --git a/frontend/src/app/core/state/effects/effect-handler.decorator.ts b/frontend/src/app/core/state/effects/effect-handler.decorator.ts
index bb45c19458f..e54720b8541 100644
--- a/frontend/src/app/core/state/effects/effect-handler.decorator.ts
+++ b/frontend/src/app/core/state/effects/effect-handler.decorator.ts
@@ -65,8 +65,7 @@ export function EffectHandler<T extends { new(...args:any[]):EffectClass }>(cons
try {
item.callback.call(this, instance);
} catch (e) {
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
- console.error(`Error thrown in effect callback ${key}: ${e}`);
+ console.error(`Error thrown in effect callback ${key}: ${e as string}`);
}
});
});
diff --git a/frontend/src/app/core/states/states.service.ts b/frontend/src/app/core/states/states.service.ts
index 8009d48b47f..688f9859d17 100644
--- a/frontend/src/app/core/states/states.service.ts
+++ b/frontend/src/app/core/states/states.service.ts
@@ -1,4 +1,9 @@
-import { InputState, multiInput, MultiInputState, StatesGroup } from 'reactivestates';
+import {
+ InputState,
+ multiInput,
+ MultiInputState,
+ StatesGroup,
+} from '@openproject/reactivestates';
import { Subject } from 'rxjs';
import { TypeResource } from 'core-app/features/hal/resources/type-resource';
import { TimeEntryResource } from 'core-app/features/hal/resources/time-entry-resource';
diff --git a/frontend/src/app/features/bim/bcf/api/bcf-authorization.service.ts b/frontend/src/app/features/bim/bcf/api/bcf-authorization.service.ts
index c52b2beed3b..9c61b30fbfa 100644
--- a/frontend/src/app/features/bim/bcf/api/bcf-authorization.service.ts
+++ b/frontend/src/app/features/bim/bcf/api/bcf-authorization.service.ts
@@ -1,14 +1,11 @@
-import { multiInput } from 'reactivestates';
+import { multiInput } from '@openproject/reactivestates';
import { BcfExtensionResource } from 'core-app/features/bim/bcf/api/extensions/bcf-extension.resource';
import { BcfApiService } from 'core-app/features/bim/bcf/api/bcf-api.service';
import {
firstValueFrom,
Observable,
} from 'rxjs';
-import {
- map,
- take,
-} from 'rxjs/operators';
+import { map } from 'rxjs/operators';
import { Injectable } from '@angular/core';
export type AllowedExtensionKey = keyof BcfExtensionResource;
diff --git a/frontend/src/app/features/boards/board/board-actions/cached-board-action.service.ts b/frontend/src/app/features/boards/board/board-actions/cached-board-action.service.ts
index 1c4cb5352ab..799f8437531 100644
--- a/frontend/src/app/features/boards/board/board-actions/cached-board-action.service.ts
+++ b/frontend/src/app/features/boards/board/board-actions/cached-board-action.service.ts
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { BoardActionService } from 'core-app/features/boards/board/board-actions/board-action.service';
-import { input } from 'reactivestates';
+import { input } from '@openproject/reactivestates';
import {
firstValueFrom,
Observable,
@@ -48,7 +48,7 @@ export abstract class CachedBoardActionService extends BoardActionService {
.putFromPromiseIfPristine(() => firstValueFrom(this.loadUncached()));
return firstValueFrom(this.cache.values$())
- .then((results:HalResource[]) => results.find((resource) => resource.id === id)!);
+ .then((results:HalResource[]) => results.find((resource) => resource.id === id) as HalResource);
}
protected abstract loadUncached():Observable<HalResource[]>;
diff --git a/frontend/src/app/features/boards/board/board-filter/board-filters.service.ts b/frontend/src/app/features/boards/board/board-filter/board-filters.service.ts
index 8f2501ed9ef..45c186cd220 100644
--- a/frontend/src/app/features/boards/board/board-filter/board-filters.service.ts
+++ b/frontend/src/app/features/boards/board/board-filter/board-filters.service.ts
@@ -1,4 +1,4 @@
-import { input } from 'reactivestates';
+import { input } from '@openproject/reactivestates';
import { Injectable } from '@angular/core';
import { ApiV3Filter } from 'core-app/shared/helpers/api-v3/api-v3-filter-builder';
diff --git a/frontend/src/app/features/boards/board/board-list/board-lists.service.ts b/frontend/src/app/features/boards/board/board-list/board-lists.service.ts
index 6b9dc489a3a..7248460ba19 100644
--- a/frontend/src/app/features/boards/board/board-list/board-lists.service.ts
+++ b/frontend/src/app/features/boards/board/board-list/board-lists.service.ts
@@ -29,7 +29,7 @@ export class BoardListsService {
}
- private create(params:Object, filters:ApiV3Filter[]):Observable<QueryResource> {
+ private create(params:object, filters:ApiV3Filter[]):Observable<QueryResource> {
const filterJson = JSON.stringify(filters);
return this
@@ -49,7 +49,7 @@ export class BoardListsService {
switchMap(([form, query]) => {
// When the permission to create public queries is missing, throw an error.
// Otherwise private queries would be created.
- if (form.schema.public.writable) {
+ if ((form.schema.public as IOPFieldSchema).writable) {
return this
.apiV3Service
.queries
@@ -63,7 +63,7 @@ export class BoardListsService {
/**
* Add a free query to the board
*/
- public addFreeQuery(board:Board, queryParams:Object) {
+ public addFreeQuery(board:Board, queryParams:object) {
const filter = this.freeBoardQueryFilter();
return this.addQuery(board, queryParams, [filter]);
}
@@ -73,7 +73,7 @@ export class BoardListsService {
* @param board
* @param query
*/
- public async addQuery(board:Board, queryParams:Object, filters:ApiV3Filter[]):Promise<Board> {
+ public async addQuery(board:Board, queryParams:object, filters:ApiV3Filter[]):Promise<Board> {
const count = board.queries.length;
try {
const query = await firstValueFrom(this.create(queryParams, filters));
diff --git a/frontend/src/app/features/boards/board/board.service.ts b/frontend/src/app/features/boards/board/board.service.ts
index 3f51d27de16..2c17dd24556 100644
--- a/frontend/src/app/features/boards/board/board.service.ts
+++ b/frontend/src/app/features/boards/board/board.service.ts
@@ -51,17 +51,16 @@ export class BoardService {
* @param projectIdentifier
*/
public loadAllBoards(projectIdentifier:string|null = this.CurrentProject.identifier, force = false) {
- if (!(force || this.loadAllPromise === undefined)) {
- return this.loadAllPromise;
+ if (force || this.loadAllPromise === undefined) {
+ this.loadAllPromise = firstValueFrom(
+ this
+ .apiV3Service
+ .boards
+ .allInScope(projectIdentifier as string),
+ );
}
- // eslint-disable-next-line no-return-assign
- return this.loadAllPromise = firstValueFrom(
- this
- .apiV3Service
- .boards
- .allInScope(projectIdentifier!),
- );
+ return this.loadAllPromise;
}
/**
@@ -85,20 +84,20 @@ export class BoardService {
/**
* Create a new board
- * @param name
+ * @param params
*/
public async create(params:CreateBoardParams):Promise<Board> {
const board = await firstValueFrom(
this
.apiV3Service
.boards
- .create(params.type, this.boardName(params), this.CurrentProject.identifier!, params.attribute),
+ .create(params.type, this.boardName(params), this.CurrentProject.identifier as string, params.attribute),
);
if (params.type === 'free') {
await this.boardsList.addFreeQuery(board, { name: this.text.unnamed_list });
} else {
- await this.boardActions.get(params.attribute!).addInitialColumnsForAction(board);
+ await this.boardActions.get(params.attribute as string).addInitialColumnsForAction(board);
}
await firstValueFrom(this.save(board));
diff --git a/frontend/src/app/features/hal/hal-link/hal-link.ts b/frontend/src/app/features/hal/hal-link/hal-link.ts
index 6a370547ff7..88939644b09 100644
--- a/frontend/src/app/features/hal/hal-link/hal-link.ts
+++ b/frontend/src/app/features/hal/hal-link/hal-link.ts
@@ -27,7 +27,10 @@
//++
import { HalResource } from 'core-app/features/hal/resources/hal-resource';
-import { HTTPSupportedMethods } from 'core-app/features/hal/http/http.interfaces';
+import {
+ HTTPClientHeaders,
+ HTTPSupportedMethods,
+} from 'core-app/features/hal/http/http.interfaces';
import { HalResourceService } from 'core-app/features/hal/services/hal-resource.service';
import { firstValueFrom } from 'rxjs';
@@ -67,7 +70,7 @@ export class HalLink implements HalLinkInterface {
*/
public static fromObject(halResourceService:HalResourceService, link:HalLinkInterface):HalLink {
return new HalLink(
- (method:HTTPSupportedMethods, href:string, data:any, headers:any) => firstValueFrom(halResourceService.request(method, href, data, headers)),
+ (method:HTTPSupportedMethods, href:string, data:object, headers:HTTPClientHeaders) => firstValueFrom(halResourceService.request(method, href, data, headers)),
link.href,
link.title,
link.method,
diff --git a/frontend/src/app/features/hal/resources/hal-resource.ts b/frontend/src/app/features/hal/resources/hal-resource.ts
index caebff84353..6c294181a4d 100644
--- a/frontend/src/app/features/hal/resources/hal-resource.ts
+++ b/frontend/src/app/features/hal/resources/hal-resource.ts
@@ -26,7 +26,7 @@
// See COPYRIGHT and LICENSE files for more details.
//++
-import { InputState } from 'reactivestates';
+import { InputState } from '@openproject/reactivestates';
import { Injector } from '@angular/core';
import { States } from 'core-app/core/states/states.service';
import { I18nService } from 'core-app/core/i18n/i18n.service';
diff --git a/frontend/src/app/features/hal/resources/placeholder-user-resource.ts b/frontend/src/app/features/hal/resources/placeholder-user-resource.ts
index c9df3bc6341..54df7f6e983 100644
--- a/frontend/src/app/features/hal/resources/placeholder-user-resource.ts
+++ b/frontend/src/app/features/hal/resources/placeholder-user-resource.ts
@@ -27,7 +27,7 @@
//++
import { HalResource } from 'core-app/features/hal/resources/hal-resource';
-import { InputState } from 'reactivestates';
+import { InputState } from '@openproject/reactivestates';
export class PlaceholderUserResource extends HalResource {
// Links
diff --git a/frontend/src/app/features/hal/resources/query-filter-instance-schema-resource.ts b/frontend/src/app/features/hal/resources/query-filter-instance-schema-resource.ts
index 776b49ebd3d..6e773bcf06f 100644
--- a/frontend/src/app/features/hal/resources/query-filter-instance-schema-resource.ts
+++ b/frontend/src/app/features/hal/resources/query-filter-instance-schema-resource.ts
@@ -31,9 +31,10 @@ import { HalResource } from 'core-app/features/hal/resources/hal-resource';
import { HalLink } from 'core-app/features/hal/hal-link/hal-link';
import { QueryOperatorResource } from 'core-app/features/hal/resources/query-operator-resource';
import { QueryFilterInstanceResource } from 'core-app/features/hal/resources/query-filter-instance-resource';
-import { SchemaAttributeObject, SchemaResource } from 'core-app/features/hal/resources/schema-resource';
+import { SchemaResource } from 'core-app/features/hal/resources/schema-resource';
import { QueryFilterResource } from 'core-app/features/hal/resources/query-filter-resource';
import { SchemaDependencyResource } from 'core-app/features/hal/resources/schema-dependency-resource';
+import { SchemaAttributeObject } from 'core-app/features/hal/resources/schema-attribute-object';
export interface QueryFilterInstanceSchemaResourceLinks {
self:HalLink;
diff --git a/frontend/src/app/features/hal/resources/schema-attribute-object.ts b/frontend/src/app/features/hal/resources/schema-attribute-object.ts
new file mode 100644
index 00000000000..4be1d7c4a3a
--- /dev/null
+++ b/frontend/src/app/features/hal/resources/schema-attribute-object.ts
@@ -0,0 +1,16 @@
+import { HalResource } from 'core-app/features/hal/resources/hal-resource';
+import { CollectionResource } from 'core-app/features/hal/resources/collection-resource';
+
+export class SchemaAttributeObject<T = HalResource> {
+ public type:string;
+
+ public name:string;
+
+ public required:boolean;
+
+ public hasDefault:boolean;
+
+ public writable:boolean;
+
+ public allowedValues:T[] | CollectionResource<T>;
+}
diff --git a/frontend/src/app/features/hal/resources/schema-resource.ts b/frontend/src/app/features/hal/resources/schema-resource.ts
index 88111688b27..29e5ed26ce0 100644
--- a/frontend/src/app/features/hal/resources/schema-resource.ts
+++ b/frontend/src/app/features/hal/resources/schema-resource.ts
@@ -27,8 +27,7 @@
//++
import { HalResource } from 'core-app/features/hal/resources/hal-resource';
-import { CollectionResource } from 'core-app/features/hal/resources/collection-resource';
-import { InputState } from 'reactivestates';
+import { InputState } from '@openproject/reactivestates';
export class SchemaResource extends HalResource {
public get state():InputState<this> {
@@ -54,17 +53,3 @@ export class SchemaResource extends HalResource {
return match;
}
}
-
-export class SchemaAttributeObject<T = HalResource> {
- public type:string;
-
- public name:string;
-
- public required:boolean;
-
- public hasDefault:boolean;
-
- public writable:boolean;
-
- public allowedValues:T[] | CollectionResource<T>;
-}
diff --git a/frontend/src/app/features/hal/resources/status-resource.ts b/frontend/src/app/features/hal/resources/status-resource.ts
index de5d3566ba9..3b2fca2e1b5 100644
--- a/frontend/src/app/features/hal/resources/status-resource.ts
+++ b/frontend/src/app/features/hal/resources/status-resource.ts
@@ -27,7 +27,7 @@
//++
import { HalResource } from 'core-app/features/hal/resources/hal-resource';
-import { InputState } from 'reactivestates';
+import { InputState } from '@openproject/reactivestates';
export class StatusResource extends HalResource {
isClosed:boolean;
diff --git a/frontend/src/app/features/hal/resources/time-entry-resource.ts b/frontend/src/app/features/hal/resources/time-entry-resource.ts
index c65e51610de..aad9fcf30bf 100644
--- a/frontend/src/app/features/hal/resources/time-entry-resource.ts
+++ b/frontend/src/app/features/hal/resources/time-entry-resource.ts
@@ -28,7 +28,7 @@
import { HalResource } from 'core-app/features/hal/resources/hal-resource';
import { ProjectResource } from 'core-app/features/hal/resources/project-resource';
-import { InputState } from 'reactivestates';
+import { InputState } from '@openproject/reactivestates';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import Formattable = api.v3.Formattable;
diff --git a/frontend/src/app/features/hal/resources/type-resource.ts b/frontend/src/app/features/hal/resources/type-resource.ts
index 86e3976ffc7..01b2eafed84 100644
--- a/frontend/src/app/features/hal/resources/type-resource.ts
+++ b/frontend/src/app/features/hal/resources/type-resource.ts
@@ -27,7 +27,7 @@
//++
import { HalResource } from 'core-app/features/hal/resources/hal-resource';
-import { InputState } from 'reactivestates';
+import { InputState } from '@openproject/reactivestates';
export class TypeResource extends HalResource {
public color:string;
diff --git a/frontend/src/app/features/hal/resources/user-resource.ts b/frontend/src/app/features/hal/resources/user-resource.ts
index e066abaf706..47896bbe27c 100644
--- a/frontend/src/app/features/hal/resources/user-resource.ts
+++ b/frontend/src/app/features/hal/resources/user-resource.ts
@@ -26,7 +26,7 @@
// See COPYRIGHT and LICENSE files for more details.
//++
-import { InputState } from 'reactivestates';
+import { InputState } from '@openproject/reactivestates';
import { HalResource } from 'core-app/features/hal/resources/hal-resource';
export class UserResource extends HalResource {
diff --git a/frontend/src/app/features/hal/resources/work-package-resource.ts b/frontend/src/app/features/hal/resources/work-package-resource.ts
index 8505f327a22..b87e9a19d79 100644
--- a/frontend/src/app/features/hal/resources/work-package-resource.ts
+++ b/frontend/src/app/features/hal/resources/work-package-resource.ts
@@ -30,7 +30,7 @@ import { I18nService } from 'core-app/core/i18n/i18n.service';
import { States } from 'core-app/core/states/states.service';
import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';
import { ToastService } from 'core-app/shared/components/toaster/toast.service';
-import { InputState } from 'reactivestates';
+import { InputState } from '@openproject/reactivestates';
import {
WorkPackagesActivityService,
} from 'core-app/features/work-packages/components/wp-single-view-tabs/activity-panel/wp-activity.service';
diff --git a/frontend/src/app/features/work-packages/components/filters/quick-filter-by-text-input/quick-filter-by-text-input.component.ts b/frontend/src/app/features/work-packages/components/filters/quick-filter-by-text-input/quick-filter-by-text-input.component.ts
index 7128ffe0434..5e522be55f2 100644
--- a/frontend/src/app/features/work-packages/components/filters/quick-filter-by-text-input/quick-filter-by-text-input.component.ts
+++ b/frontend/src/app/features/work-packages/components/filters/quick-filter-by-text-input/quick-filter-by-text-input.component.ts
@@ -34,7 +34,7 @@ import {
debounceTime, distinctUntilChanged, map, tap,
} from 'rxjs/operators';
import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/query-space/isolated-query-space';
-import { input } from 'reactivestates';
+import { input } from '@openproject/reactivestates';
import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
import { QueryFilterResource } from 'core-app/features/hal/resources/query-filter-resource';
diff --git a/frontend/src/app/features/work-packages/components/filters/wp-filters/wp-filters.service.ts b/frontend/src/app/features/work-packages/components/filters/wp-filters/wp-filters.service.ts
index fc4982854ec..c7400334577 100644
--- a/frontend/src/app/features/work-packages/components/filters/wp-filters/wp-filters.service.ts
+++ b/frontend/src/app/features/work-packages/components/filters/wp-filters/wp-filters.service.ts
@@ -27,7 +27,7 @@
//++
import { Injectable } from '@angular/core';
-import { input } from 'reactivestates';
+import { input } from '@openproject/reactivestates';
import { Observable } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
diff --git a/frontend/src/app/features/work-packages/components/wp-fast-table/handlers/state/drag-and-drop-transformer.ts b/frontend/src/app/features/work-packages/components/wp-fast-table/handlers/state/drag-and-drop-transformer.ts
index 32a5fb61b89..6cf79f16420 100644
--- a/frontend/src/app/features/work-packages/components/wp-fast-table/handlers/state/drag-and-drop-transformer.ts
+++ b/frontend/src/app/features/work-packages/components/wp-fast-table/handlers/state/drag-and-drop-transformer.ts
@@ -77,6 +77,7 @@ export class DragAndDropTransformer {
const workPackage = this.states.workPackages.get(wpId).value;
return !!workPackage && this.actionService.canPickup(workPackage);
},
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
onMoved: async (el:HTMLElement, target:HTMLElement, source:HTMLElement, sibling:HTMLElement|null) => {
const wpId:string = el.dataset.workPackageId!;
let rowIndex;
@@ -135,6 +136,7 @@ export class DragAndDropTransformer {
})
.catch(() => false);
},
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
onCloned: async (clone:HTMLElement, original:HTMLElement) => {
// Replace clone with one TD of the subject
const wpId:string = original.dataset.workPackageId!;
diff --git a/frontend/src/app/features/work-packages/components/wp-list/wp-list.service.ts b/frontend/src/app/features/work-packages/components/wp-list/wp-list.service.ts
index e36562c70fb..75e300241a3 100644
--- a/frontend/src/app/features/work-packages/components/wp-list/wp-list.service.ts
+++ b/frontend/src/app/features/work-packages/components/wp-list/wp-list.service.ts
@@ -42,7 +42,7 @@ import {
Observable,
of,
} from 'rxjs';
-import { input } from 'reactivestates';
+import { input } from '@openproject/reactivestates';
import {
catchError,
mapTo,
@@ -233,7 +233,7 @@ export class WorkPackagesListService {
* Load the query from the given state params
*/
public loadCurrentQueryFromParams(projectIdentifier?:string):Promise<QueryResource> {
- return firstValueFrom(this.fromQueryParams(this.$state.params as any, projectIdentifier));
+ return firstValueFrom(this.fromQueryParams(this.$state.params as { query_id?:string|null, query_props?:string }, projectIdentifier));
}
public loadForm(query:QueryResource):Promise<QueryFormResource> {
@@ -371,7 +371,12 @@ export class WorkPackagesListService {
return this.querySpace.query.value!;
}
- private handleQueryLoadingError(error:ErrorResource, queryProps:any, queryId?:string|null, projectIdentifier?:string|null):Promise<QueryResource> {
+ private handleQueryLoadingError(
+ error:ErrorResource,
+ queryProps:{ [key:string]:unknown },
+ queryId?:string|null,
+ projectIdentifier?:string|null,
+ ):Promise<QueryResource> {
this.toastService.addError(this.I18n.t('js.work_packages.faulty_query.description'), error.message);
return new Promise((resolve, reject) => {
@@ -391,7 +396,7 @@ export class WorkPackagesListService {
.then((query:QueryResource) => {
this.wpListInvalidQueryService.restoreQuery(query, form);
- query.results.pageSize = queryProps.pageSize;
+ query.results.pageSize = queryProps.pageSize as number;
query.results.total = 0;
if (queryId) {
diff --git a/frontend/src/app/features/work-packages/components/wp-new/wp-create.service.ts b/frontend/src/app/features/work-packages/components/wp-new/wp-create.service.ts
index 2b77a70d084..3532ce28ce2 100644
--- a/frontend/src/app/features/work-packages/components/wp-new/wp-create.service.ts
+++ b/frontend/src/app/features/work-packages/components/wp-new/wp-create.service.ts
@@ -368,7 +368,7 @@ export class WorkPackageCreateService extends UntilDestroyedMixin {
* @param form
*/
private initializeNewResource(form:FormResource) {
- const payload = form.payload.$plain();
+ const payload = form.payload.$plain() as object&{ _links:{ schema:{ href:string } } };
// maintain the reference to the schema
payload._links.schema = { href: 'new' };
@@ -387,7 +387,8 @@ export class WorkPackageCreateService extends UntilDestroyedMixin {
// Set update link to form
wp.update = wp.$links.update = form.$links.self;
// Use POST /work_packages for saving link
- wp.updateImmediately = wp.$links.updateImmediately = (payload) => firstValueFrom(this.apiV3Service.work_packages.post(payload));
+ wp.updateImmediately = (data:object) => firstValueFrom(this.apiV3Service.work_packages.post(data));
+ wp.$links.updateImmediately = (data:object) => firstValueFrom(this.apiV3Service.work_packages.post(data));
// We need to provide the schema to the cache so that it is available in the html form to e.g. determine
// the editability.
diff --git a/frontend/src/app/features/work-packages/components/wp-relations/wp-relations.service.ts b/frontend/src/app/features/work-packages/components/wp-relations/wp-relations.service.ts
index d43be3cde8c..8be4945eff0 100644
--- a/frontend/src/app/features/work-packages/components/wp-relations/wp-relations.service.ts
+++ b/frontend/src/app/features/work-packages/components/wp-relations/wp-relations.service.ts
@@ -1,6 +1,6 @@
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';
-import { multiInput, MultiInputState, StatesGroup } from 'reactivestates';
+import { multiInput, MultiInputState, StatesGroup } from '@openproject/reactivestates';
import { Injectable } from '@angular/core';
import { HalResourceService } from 'core-app/features/hal/services/hal-resource.service';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/wp-linked-resource-cache.service.ts b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/wp-linked-resource-cache.service.ts
index 92c352b9c83..e15d63dccfd 100644
--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/wp-linked-resource-cache.service.ts
+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/wp-linked-resource-cache.service.ts
@@ -27,7 +27,7 @@
//++
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
-import { input, InputState } from 'reactivestates';
+import { input, InputState } from '@openproject/reactivestates';
import {
filter,
map,
diff --git a/frontend/src/app/features/work-packages/components/wp-table/embedded/wp-embedded-base.component.ts b/frontend/src/app/features/work-packages/components/wp-table/embedded/wp-embedded-base.component.ts
index 5c08aeca8f4..0287ba60741 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/embedded/wp-embedded-base.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-table/embedded/wp-embedded-base.component.ts
@@ -66,12 +66,12 @@ export abstract class WorkPackageEmbeddedBaseComponent extends WorkPackagesViewB
ngAfterViewInit():void {
// Load initially
- this.loadQuery(true, false);
+ void this.loadQuery(true, false);
}
ngOnChanges(changes:SimpleChanges) {
if (this.initialized && (changes.queryId || changes.queryProps)) {
- this.loadQuery(this.initialLoadingIndicator, false);
+ void this.loadQuery(this.initialLoadingIndicator, false);
}
}
@@ -82,15 +82,15 @@ export abstract class WorkPackageEmbeddedBaseComponent extends WorkPackagesViewB
return this.configuration.projectIdentifier || undefined;
}
- public buildQueryProps() {
- const query = this.querySpace.query.value!;
+ public buildQueryProps():object {
+ const query = this.querySpace.query.value as QueryResource;
this.wpStatesInitialization.applyToQuery(query);
- return this.urlParamsHelper.buildV3GetQueryFromQueryResource(query);
+ return this.urlParamsHelper.buildV3GetQueryFromQueryResource(query) as object;
}
public buildUrlParams() {
- const query = this.querySpace.query.value!;
+ const query = this.querySpace.query.value as QueryResource;
this.wpStatesInitialization.applyToQuery(query);
return this.urlParamsHelper.encodeQueryJsonParams(query);
@@ -102,20 +102,20 @@ export abstract class WorkPackageEmbeddedBaseComponent extends WorkPackagesViewB
}
public refresh(visible = true, firstPage = false):Promise<any> {
- const query = this.querySpace.query.value!;
+ const query = this.querySpace.query.value as QueryResource;
const pagination = this.wpTablePagination.paginationObject;
if (firstPage) {
pagination.offset = 1;
}
- const params = this.urlParamsHelper.buildV3GetQueryFromQueryResource(query, pagination);
+ const params = this.urlParamsHelper.buildV3GetQueryFromQueryResource(query, pagination) as object;
const promise = firstValueFrom(
this
.wpListService
.loadQueryFromExisting(query, params, this.queryProjectScope),
)
- .then((query) => this.wpStatesInitialization.updateQuerySpace(query, query.results));
+ .then((updated) => this.wpStatesInitialization.updateQuerySpace(updated, updated.results));
if (visible) {
this.loadingIndicator = promise;
@@ -127,7 +127,7 @@ export abstract class WorkPackageEmbeddedBaseComponent extends WorkPackagesViewB
return !!this.configuration;
}
- public set loadingIndicator(promise:Promise<any>) {
+ public set loadingIndicator(promise:Promise<unknown>) {
if (this.configuration.tableVisible) {
this.loadingIndicatorService
.indicator(this.uniqueEmbeddedTableName)
@@ -135,7 +135,7 @@ export abstract class WorkPackageEmbeddedBaseComponent extends WorkPackagesViewB
}
}
- public abstract loadQuery(visible:boolean, firstPage:boolean):Promise<any>;
+ public abstract loadQuery(visible:boolean, firstPage:boolean):Promise<QueryResource|undefined>;
protected get queryProjectScope() {
if (!this.configuration.projectContext) {
diff --git a/frontend/src/app/features/work-packages/components/wp-table/embedded/wp-embedded-table.component.ts b/frontend/src/app/features/work-packages/components/wp-table/embedded/wp-embedded-table.component.ts
index c019a7dce6c..5c9f3d53867 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/embedded/wp-embedded-table.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-table/embedded/wp-embedded-table.component.ts
@@ -127,29 +127,27 @@ export class WorkPackageEmbeddedTableComponent extends WorkPackageEmbeddedBaseCo
});
}
- private loadForm(query:QueryResource):Promise<QueryFormResource|void> {
- if (this.formPromise) {
- return this.formPromise;
+ private loadForm(query:QueryResource):Promise<QueryFormResource|undefined> {
+ if (!this.formPromise) {
+ this.formPromise = firstValueFrom(
+ this
+ .apiv3Service
+ .withOptionalProject(this.projectIdentifier)
+ .queries
+ .form
+ .load(query),
+ )
+ .then(([form, _]) => {
+ this.wpStatesInitialization.updateStatesFromForm(query, form);
+ return form;
+ })
+ .catch(() => undefined);
}
- // eslint-disable-next-line no-return-assign
- return this.formPromise = firstValueFrom(
- this
- .apiv3Service
- .withOptionalProject(this.projectIdentifier)
- .queries
- .form
- .load(query),
- )
- .then(([form, _]) => {
- this.wpStatesInitialization.updateStatesFromForm(query, form);
- return form;
- })
- // eslint-disable-next-line no-return-assign
- .catch(() => this.formPromise = undefined);
+ return this.formPromise;
}
- public loadQuery(visible = true, firstPage = false):Promise<QueryResource|void> {
+ public loadQuery(visible = true, firstPage = false):Promise<QueryResource> {
// Ensure we are loading the form.
this.formPromise = undefined;
@@ -157,7 +155,7 @@ export class WorkPackageEmbeddedTableComponent extends WorkPackageEmbeddedBaseCo
const query = this.loadedQuery;
this.loadedQuery = undefined;
this.initializeStates(query);
- return Promise.resolve(this.loadedQuery!);
+ return Promise.resolve(query);
}
// HACK: Decrease loading time of queries when results are not needed.
@@ -198,7 +196,7 @@ export class WorkPackageEmbeddedTableComponent extends WorkPackageEmbeddedBaseCo
this.loadingIndicator = promise;
}
- return promise;
+ return promise as Promise<QueryResource>;
}
handleWorkPackageClicked(event:{ workPackageId:string; double:boolean }) {
diff --git a/frontend/src/app/features/work-packages/components/wp-table/timeline/container/wp-timeline-container.directive.ts b/frontend/src/app/features/work-packages/components/wp-table/timeline/container/wp-timeline-container.directive.ts
index d233ecc7f55..aa71b626207 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/timeline/container/wp-timeline-container.directive.ts
+++ b/frontend/src/app/features/work-packages/components/wp-table/timeline/container/wp-timeline-container.directive.ts
@@ -48,7 +48,7 @@ import {
import {
input,
InputState,
-} from 'reactivestates';
+} from '@openproject/reactivestates';
import { WorkPackageTable } from 'core-app/features/work-packages/components/wp-fast-table/wp-fast-table';
import { WorkPackageTimelineCellsRenderer } from 'core-app/features/work-packages/components/wp-table/timeline/cells/wp-timeline-cells-renderer';
import { States } from 'core-app/core/states/states.service';
diff --git a/frontend/src/app/features/work-packages/components/wp-table/timeline/global-elements/wp-timeline-relations.directive.ts b/frontend/src/app/features/work-packages/components/wp-table/timeline/global-elements/wp-timeline-relations.directive.ts
index 36155fd3b3c..9f86fded236 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/timeline/global-elements/wp-timeline-relations.directive.ts
+++ b/frontend/src/app/features/work-packages/components/wp-table/timeline/global-elements/wp-timeline-relations.directive.ts
@@ -30,7 +30,7 @@ import {
Component, ElementRef, Injector, OnInit,
} from '@angular/core';
import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/query-space/isolated-query-space';
-import { State } from 'reactivestates';
+import { State } from '@openproject/reactivestates';
import { combineLatest } from 'rxjs';
import { filter, map, take } from 'rxjs/operators';
import { States } from 'core-app/core/states/states.service';
diff --git a/frontend/src/app/features/work-packages/components/wp-table/timeline/wp-timeline.ts b/frontend/src/app/features/work-packages/components/wp-table/timeline/wp-timeline.ts
index 754e48fcdcb..6aae88b34c1 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/timeline/wp-timeline.ts
+++ b/frontend/src/app/features/work-packages/components/wp-table/timeline/wp-timeline.ts
@@ -26,7 +26,7 @@
// See COPYRIGHT and LICENSE files for more details.
//++
import * as moment from 'moment';
-import { InputState, MultiInputState } from 'reactivestates';
+import { InputState, MultiInputState } from '@openproject/reactivestates';
import { WorkPackageChangeset } from 'core-app/features/work-packages/components/wp-edit/work-package-changeset';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { TimelineZoomLevel } from 'core-app/features/hal/resources/query-resource';
diff --git a/frontend/src/app/features/work-packages/directives/query-space/isolated-graph-query-space.ts b/frontend/src/app/features/work-packages/directives/query-space/isolated-graph-query-space.ts
index fc3a3e75379..009f19c8729 100644
--- a/frontend/src/app/features/work-packages/directives/query-space/isolated-graph-query-space.ts
+++ b/frontend/src/app/features/work-packages/directives/query-space/isolated-graph-query-space.ts
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
-import { input } from 'reactivestates';
+import { input } from '@openproject/reactivestates';
import { ChartType } from 'chart.js';
import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/query-space/isolated-query-space';
diff --git a/frontend/src/app/features/work-packages/directives/query-space/isolated-query-space.ts b/frontend/src/app/features/work-packages/directives/query-space/isolated-query-space.ts
index 3f132df2f38..a83e3377f79 100644
--- a/frontend/src/app/features/work-packages/directives/query-space/isolated-query-space.ts
+++ b/frontend/src/app/features/work-packages/directives/query-space/isolated-query-space.ts
@@ -4,7 +4,7 @@ import {
InputState,
State,
StatesGroup,
-} from 'reactivestates';
+} from '@openproject/reactivestates';
import { Subject } from 'rxjs';
import { Injectable } from '@angular/core';
import { map } from 'rxjs/operators';
diff --git a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-base.service.ts b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-base.service.ts
index e367ef32a18..e995bcabfea 100644
--- a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-base.service.ts
+++ b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-base.service.ts
@@ -29,7 +29,7 @@
import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/query-space/isolated-query-space';
import {
combine, deriveRaw, input, State,
-} from 'reactivestates';
+} from '@openproject/reactivestates';
import { map, mapTo, take } from 'rxjs/operators';
import { merge, Observable } from 'rxjs';
import { QueryResource } from 'core-app/features/hal/resources/query-resource';
diff --git a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-columns.service.ts b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-columns.service.ts
index fd8a3f0df55..b3fbefe8d3b 100644
--- a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-columns.service.ts
+++ b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-columns.service.ts
@@ -31,7 +31,7 @@ import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/q
import { States } from 'core-app/core/states/states.service';
import { Injectable } from '@angular/core';
import { QueryColumn, queryColumnTypes } from 'core-app/features/work-packages/components/wp-query/query-column';
-import { combine } from 'reactivestates';
+import { combine } from '@openproject/reactivestates';
import { mapTo, take } from 'rxjs/operators';
import { cloneHalResourceCollection } from 'core-app/features/hal/helpers/hal-resource-builder';
import { WorkPackageQueryStateService } from './wp-view-base.service';
diff --git a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-filters.service.ts b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-filters.service.ts
index cdee9a8a231..2e0eb233d6a 100644
--- a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-filters.service.ts
+++ b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-filters.service.ts
@@ -28,7 +28,7 @@
import { Injectable } from '@angular/core';
import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/query-space/isolated-query-space';
-import { combine, input, InputState } from 'reactivestates';
+import { combine, input, InputState } from '@openproject/reactivestates';
import { States } from 'core-app/core/states/states.service';
import { HalResource } from 'core-app/features/hal/resources/hal-resource';
import { QuerySchemaResource } from 'core-app/features/hal/resources/query-schema-resource';
diff --git a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-order.service.ts b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-order.service.ts
index d85a8836778..19689a9868d 100644
--- a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-order.service.ts
+++ b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-order.service.ts
@@ -28,7 +28,7 @@
import { Injectable } from '@angular/core';
import { take } from 'rxjs/operators';
-import { InputState } from 'reactivestates';
+import { InputState } from '@openproject/reactivestates';
import { States } from 'core-app/core/states/states.service';
import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/query-space/isolated-query-space';
import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';
diff --git a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-sort-by.service.ts b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-sort-by.service.ts
index 7554d3134be..72c62820c20 100644
--- a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-sort-by.service.ts
+++ b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-sort-by.service.ts
@@ -26,7 +26,7 @@
// See COPYRIGHT and LICENSE files for more details.
//++
-import { combine } from 'reactivestates';
+import { combine } from '@openproject/reactivestates';
import { mapTo } from 'rxjs/operators';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
diff --git a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-timeline.service.ts b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-timeline.service.ts
index 350cb7dd78d..d5cf021f1aa 100644
--- a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-timeline.service.ts
+++ b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-timeline.service.ts
@@ -29,7 +29,7 @@
import { Injectable } from '@angular/core';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/query-space/isolated-query-space';
-import { input } from 'reactivestates';
+import { input } from '@openproject/reactivestates';
import { WorkPackageTimelineState } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-table-timeline';
import { zoomLevelOrder } from 'core-app/features/work-packages/components/wp-table/timeline/wp-timeline';
import { QueryResource, TimelineLabels, TimelineZoomLevel } from 'core-app/features/hal/resources/query-resource';
diff --git a/frontend/src/app/shared/components/attribute-help-texts/attribute-help-text.service.ts b/frontend/src/app/shared/components/attribute-help-texts/attribute-help-text.service.ts
index c1a5ae6552a..d2205d86e51 100644
--- a/frontend/src/app/shared/components/attribute-help-texts/attribute-help-text.service.ts
+++ b/frontend/src/app/shared/components/attribute-help-texts/attribute-help-text.service.ts
@@ -26,7 +26,7 @@
// See COPYRIGHT and LICENSE files for more details.
//++
-import { input } from 'reactivestates';
+import { input } from '@openproject/reactivestates';
import { Injectable } from '@angular/core';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
import { take } from 'rxjs/operators';
diff --git a/frontend/src/app/shared/components/fields/changeset/resource-changeset.ts b/frontend/src/app/shared/components/fields/changeset/resource-changeset.ts
index c8262fc1354..367ef8bbba9 100644
--- a/frontend/src/app/shared/components/fields/changeset/resource-changeset.ts
+++ b/frontend/src/app/shared/components/fields/changeset/resource-changeset.ts
@@ -26,7 +26,7 @@
// See COPYRIGHT and LICENSE files for more details.
//++
-import { input, InputState } from 'reactivestates';
+import { input, InputState } from '@openproject/reactivestates';
import { take } from 'rxjs/operators';
import { SchemaResource } from 'core-app/features/hal/resources/schema-resource';
diff --git a/frontend/src/app/shared/components/fields/edit/edit-form/edit-form.component.ts b/frontend/src/app/shared/components/fields/edit/edit-form/edit-form.component.ts
index 8abe7f0e97c..c163fa43c0c 100644
--- a/frontend/src/app/shared/components/fields/edit/edit-form/edit-form.component.ts
+++ b/frontend/src/app/shared/components/fields/edit/edit-form/edit-form.component.ts
@@ -40,7 +40,7 @@ import {
import { StateService, Transition, TransitionService } from '@uirouter/core';
import { ConfigurationService } from 'core-app/core/config/configuration.service';
import { EditableAttributeFieldComponent } from 'core-app/shared/components/fields/edit/field/editable-attribute-field.component';
-import { input } from 'reactivestates';
+import { input } from '@openproject/reactivestates';
import { filter, map, take } from 'rxjs/operators';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import {
diff --git a/frontend/src/app/shared/components/fields/edit/services/hal-resource-editing.service.ts b/frontend/src/app/shared/components/fields/edit/services/hal-resource-editing.service.ts
index 425cdb92eb9..825509da573 100644
--- a/frontend/src/app/shared/components/fields/edit/services/hal-resource-editing.service.ts
+++ b/frontend/src/app/shared/components/fields/edit/services/hal-resource-editing.service.ts
@@ -28,7 +28,7 @@
import {
combine, deriveRaw, InputState, multiInput, State, StatesGroup,
-} from 'reactivestates';
+} from '@openproject/reactivestates';
import { filter, map } from 'rxjs/operators';
import { Injectable, Injector } from '@angular/core';
import { Subject } from 'rxjs';
diff --git a/frontend/src/app/shared/components/fields/macros/attribute-label-macro.component.ts b/frontend/src/app/shared/components/fields/macros/attribute-label-macro.component.ts
index a9f78ca3035..6a085fb5644 100644
--- a/frontend/src/app/shared/components/fields/macros/attribute-label-macro.component.ts
+++ b/frontend/src/app/shared/components/fields/macros/attribute-label-macro.component.ts
@@ -104,27 +104,22 @@ export class AttributeLabelMacroComponent implements OnInit {
}
private async loadResourceAttribute(model:SupportedAttributeModels, id:string, attributeName:string):Promise<void> {
- let resource:HalResource|null;
-
try {
- // eslint-disable-next-line no-multi-assign
- this.resource = resource = await firstValueFrom(this.resourceLoader.require(model, id));
+ this.resource = await firstValueFrom(this.resourceLoader.require(model, id));
} catch (e) {
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
- console.error(`Failed to render macro ${e}`);
+ console.error('Failed to render macro %O', e);
this.markError(this.text.not_found);
return;
}
- if (!resource) {
+ if (!this.resource) {
this.markError(this.text.not_found);
return;
}
- const schema = await this.schemaCache.ensureLoaded(resource);
+ const schema = await this.schemaCache.ensureLoaded(this.resource);
this.attribute = schema.attributeFromLocalizedName(attributeName) || attributeName;
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
- this.label = schema[this.attribute]?.name as string|undefined;
+ this.label = (schema[this.attribute] as IOPFieldSchema|undefined)?.name;
if (!this.label) {
this.markError(this.text.invalid_attribute(attributeName));
diff --git a/frontend/src/app/shared/components/fields/macros/attribute-model-loader.service.ts b/frontend/src/app/shared/components/fields/macros/attribute-model-loader.service.ts
index 0cc334fc750..23b228fa0b8 100644
--- a/frontend/src/app/shared/components/fields/macros/attribute-model-loader.service.ts
+++ b/frontend/src/app/shared/components/fields/macros/attribute-model-loader.service.ts
@@ -42,7 +42,7 @@ import {
tap,
} from 'rxjs/operators';
import { I18nService } from 'core-app/core/i18n/i18n.service';
-import { multiInput } from 'reactivestates';
+import { multiInput } from '@openproject/reactivestates';
import { TransitionService } from '@uirouter/core';
import { CurrentProjectService } from 'core-app/core/current-project/current-project.service';
import { HalResource } from 'core-app/features/hal/resources/hal-resource';
diff --git a/frontend/src/app/shared/components/grids/widgets/project-details/project-details.component.ts b/frontend/src/app/shared/components/grids/widgets/project-details/project-details.component.ts
index e708b1e5291..0510836065b 100644
--- a/frontend/src/app/shared/components/grids/widgets/project-details/project-details.component.ts
+++ b/frontend/src/app/shared/components/grids/widgets/project-details/project-details.component.ts
@@ -38,11 +38,12 @@ import {
import { AbstractWidgetComponent } from 'core-app/shared/components/grids/widgets/abstract-widget.component';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { CurrentProjectService } from 'core-app/core/current-project/current-project.service';
-import { SchemaAttributeObject, SchemaResource } from 'core-app/features/hal/resources/schema-resource';
+import { SchemaResource } from 'core-app/features/hal/resources/schema-resource';
import { Observable } from 'rxjs';
import { ProjectResource } from 'core-app/features/hal/resources/project-resource';
import { HalResourceEditingService } from 'core-app/shared/components/fields/edit/services/hal-resource-editing.service';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
+import { SchemaAttributeObject } from 'core-app/features/hal/resources/schema-attribute-object';
@Component({
templateUrl: './project-details.component.html',
diff --git a/frontend/src/app/shared/components/hide-section/hide-section.service.ts b/frontend/src/app/shared/components/hide-section/hide-section.service.ts
index 333ca3bc2f5..73dab5349fd 100644
--- a/frontend/src/app/shared/components/hide-section/hide-section.service.ts
+++ b/frontend/src/app/shared/components/hide-section/hide-section.service.ts
@@ -28,7 +28,7 @@
import { GonService } from 'core-app/core/gon/gon.service';
import { Injectable } from '@angular/core';
-import { input } from 'reactivestates';
+import { input } from '@openproject/reactivestates';
export interface HideSectionDefinition {
key:string;
diff --git a/frontend/src/app/shared/components/toaster/toast.service.ts b/frontend/src/app/shared/components/toaster/toast.service.ts
index 5d2a4a4b071..81290b94386 100644
--- a/frontend/src/app/shared/components/toaster/toast.service.ts
+++ b/frontend/src/app/shared/components/toaster/toast.service.ts
@@ -28,7 +28,7 @@
import { Observable } from 'rxjs';
import { take } from 'rxjs/operators';
-import { input, State } from 'reactivestates';
+import { input, State } from '@openproject/reactivestates';
import { Injectable } from '@angular/core';
import { HttpErrorResponse, HttpEvent } from '@angular/common/http';
diff --git a/frontend/src/main.ts b/frontend/src/main.ts
index 5ddcf1a806c..37f5a275775 100644
--- a/frontend/src/main.ts
+++ b/frontend/src/main.ts
@@ -3,7 +3,6 @@ import { enableProdMode } from '@angular/core';
import * as jQuery from 'jquery';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { whenDebugging } from 'core-app/shared/helpers/debug_output';
-import { enableReactiveStatesLogging } from 'reactivestates';
import { initializeLocale } from 'core-app/core/setup/init-locale';
import { environment } from './environments/environment';
import { configureErrorReporter } from 'core-app/core/errors/configure-reporter';
@@ -32,12 +31,6 @@ if (environment.production) {
enableProdMode();
}
-// Enable debug logging for reactive states
-whenDebugging(() => {
- (window as any).enableReactiveStatesLogging = () => enableReactiveStatesLogging(true);
- (window as any).disableReactiveStatesLogging = () => enableReactiveStatesLogging(false);
-});
-
// Import the correct locale early on
void initializeLocale()
.then(() => {
diff --git a/modules/budgets/frontend/module/main.ts b/modules/budgets/frontend/module/main.ts
index be7fd012b21..ae97b9232b4 100644
--- a/modules/budgets/frontend/module/main.ts
+++ b/modules/budgets/frontend/module/main.ts
@@ -26,7 +26,7 @@
import { Injector, NgModule } from '@angular/core';
import { OpenProjectPluginContext } from 'core-app/features/plugins/plugin-context';
-import { multiInput } from 'reactivestates';
+import { multiInput } from '@openproject/reactivestates';
import { PlannedCostsFormAugment } from 'core-app/features/plugins/linked/budgets/augment/planned-costs-form';
import { CostBudgetSubformAugmentService } from 'core-app/features/plugins/linked/budgets/augment/cost-budget-subform.augment.service';
import { CostSubformAugmentService } from './augment/cost-subform.augment.service';
diff --git a/modules/documents/frontend/module/main.ts b/modules/documents/frontend/module/main.ts
index 2980f967579..f605b24c9e1 100644
--- a/modules/documents/frontend/module/main.ts
+++ b/modules/documents/frontend/module/main.ts
@@ -28,7 +28,7 @@
import { NgModule } from '@angular/core';
import { OpenProjectPluginContext } from 'core-app/features/plugins/plugin-context';
-import { multiInput } from 'reactivestates';
+import { multiInput } from '@openproject/reactivestates';
import { DocumentResource } from './hal/resources/document-resource';
export function initializeDocumentPlugin() {