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

Rename interfaces in Akita stores; prefix them with I

Benjamin Bädorfc5e61c5bd1b3
diff --git a/frontend/src/app/core/apiv3/endpoints/views/apiv3-views-paths.ts b/frontend/src/app/core/apiv3/endpoints/views/apiv3-views-paths.ts
index edc634409eb..dda92575b70 100644
--- a/frontend/src/app/core/apiv3/endpoints/views/apiv3-views-paths.ts
+++ b/frontend/src/app/core/apiv3/endpoints/views/apiv3-views-paths.ts
@@ -27,7 +27,7 @@
//++
import { Observable } from 'rxjs';
-import { View, ViewCreatePayload } from 'core-app/core/state/views/view.model';
+import { IView, IViewCreatePayload } from 'core-app/core/state/views/view.model';
import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';
import { HttpClient } from '@angular/common/http';
import { map } from 'rxjs/operators';
@@ -37,7 +37,7 @@ import {
} from 'core-app/core/apiv3/paths/apiv3-resource';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
-export class ApiV3ViewsPaths extends ApiV3ResourceCollection<View, ApiV3GettableResource<View>> {
+export class ApiV3ViewsPaths extends ApiV3ResourceCollection<IView, ApiV3GettableResource<IView>> {
@InjectField() http:HttpClient;
constructor(
@@ -53,7 +53,7 @@ export class ApiV3ViewsPaths extends ApiV3ResourceCollection<View, ApiV3Gettable
* @param resource
* @param type The query's view type
*/
- post(resource:ViewCreatePayload, type:string):Observable<View> {
+ post(resource:IViewCreatePayload, type:string):Observable<IView> {
return this
.http
.post(
@@ -64,7 +64,7 @@ export class ApiV3ViewsPaths extends ApiV3ResourceCollection<View, ApiV3Gettable
responseType: 'json',
},
).pipe(
- map((view:View) => view),
+ map((view:IView) => view),
);
}
}
diff --git a/frontend/src/app/core/state/hal-resource.ts b/frontend/src/app/core/state/hal-resource.ts
index bc6e47f03d4..179af058e2d 100644
--- a/frontend/src/app/core/state/hal-resource.ts
+++ b/frontend/src/app/core/state/hal-resource.ts
@@ -1,18 +1,15 @@
-export interface HalResourceLink {
+export interface IHalResourceLink {
href:string;
title:string;
}
-/*
- * TODO: This typing is not perfect, since overriding with more specific keys that are optional
- * e.g. `project?:HalResourceLink;` is not possible. This would result in a possible undefined type.
- * I'm not sure how to fix this, but it works for now.
- */
-export type HalResourceLinks = Record<string, HalResourceLink|HalResourceLink[]>;
+export interface IHalResourceLinks {
+ self: IHalResourceLink;
+}
export type FormattableFormat = 'markdown'|'custom';
-export interface Formattable {
+export interface IFormattable {
format:FormattableFormat;
raw:string;
html:string;
diff --git a/frontend/src/app/core/state/in-app-notifications/in-app-notification.model.ts b/frontend/src/app/core/state/in-app-notifications/in-app-notification.model.ts
index b5b85c79516..cc9260e6767 100644
--- a/frontend/src/app/core/state/in-app-notifications/in-app-notification.model.ts
+++ b/frontend/src/app/core/state/in-app-notifications/in-app-notification.model.ts
@@ -1,16 +1,16 @@
import { ID } from '@datorama/akita';
import {
- HalResourceLink,
- HalResourceLinks,
+ IHalResourceLink,
+ IHalResourceLinks,
} from 'core-app/core/state/hal-resource';
export const NOTIFICATIONS_MAX_SIZE = 100;
-export interface InAppNotificationHalResourceLinks extends HalResourceLinks {
- actor:HalResourceLink;
- project:HalResourceLink;
- resource:HalResourceLink;
- activity:HalResourceLink;
+export interface IInAppNotificationHalResourceLinks extends IHalResourceLinks {
+ actor:IHalResourceLink;
+ project:IHalResourceLink;
+ resource:IHalResourceLink;
+ activity:IHalResourceLink;
}
export interface InAppNotification {
@@ -27,5 +27,5 @@ export interface InAppNotification {
// Show message of a notification?
expanded:boolean;
- _links:InAppNotificationHalResourceLinks;
+ _links:IInAppNotificationHalResourceLinks;
}
diff --git a/frontend/src/app/core/state/principals/group.model.ts b/frontend/src/app/core/state/principals/group.model.ts
index 9fd2628ff27..400021a70b1 100644
--- a/frontend/src/app/core/state/principals/group.model.ts
+++ b/frontend/src/app/core/state/principals/group.model.ts
@@ -1,13 +1,13 @@
import { ID } from '@datorama/akita';
-import { HalResourceLinks } from 'core-app/core/state/hal-resource';
+import { IHalResourceLinks } from 'core-app/core/state/hal-resource';
-export interface GroupHalResourceLinks extends HalResourceLinks { }
+export interface IGroupHalResourceLinks extends IHalResourceLinks { }
-export interface Group {
+export interface IGroup {
id:ID;
name:string;
createdAt:string;
updatedAt:string;
- _links:GroupHalResourceLinks;
+ _links:IGroupHalResourceLinks;
}
diff --git a/frontend/src/app/core/state/principals/placeholder-user.model.ts b/frontend/src/app/core/state/principals/placeholder-user.model.ts
index 3dc91212b60..55b528872d8 100644
--- a/frontend/src/app/core/state/principals/placeholder-user.model.ts
+++ b/frontend/src/app/core/state/principals/placeholder-user.model.ts
@@ -1,17 +1,17 @@
import { ID } from '@datorama/akita';
-import { HalResourceLink, HalResourceLinks } from 'core-app/core/state/hal-resource';
+import { IHalResourceLink, IHalResourceLinks } from 'core-app/core/state/hal-resource';
-export interface PlaceholderUserHalResourceLinks extends HalResourceLinks {
- updateImmediately:HalResourceLink;
- delete:HalResourceLink;
- showUser:HalResourceLink;
+export interface IPlaceholderUserHalResourceLinks extends IHalResourceLinks {
+ updateImmediately:IHalResourceLink;
+ delete:IHalResourceLink;
+ showUser:IHalResourceLink;
}
-export interface PlaceholderUser {
+export interface IPlaceholderUser {
id:ID;
name:string;
createdAt:string;
updatedAt:string;
- _links:PlaceholderUserHalResourceLinks;
+ _links:IPlaceholderUserHalResourceLinks;
}
diff --git a/frontend/src/app/core/state/principals/principal.model.ts b/frontend/src/app/core/state/principals/principal.model.ts
index 41baf6dcd67..8c30a7ba956 100644
--- a/frontend/src/app/core/state/principals/principal.model.ts
+++ b/frontend/src/app/core/state/principals/principal.model.ts
@@ -1,5 +1,5 @@
-import { User } from './user.model';
-import { Group } from './group.model';
-import { PlaceholderUser } from './placeholder-user.model';
+import { IUser } from './user.model';
+import { IGroup } from './group.model';
+import { IPlaceholderUser } from './placeholder-user.model';
-export type Principal = User|Group|PlaceholderUser;
+export type IPrincipal = IUser|IGroup|IPlaceholderUser;
diff --git a/frontend/src/app/core/state/principals/principals.query.ts b/frontend/src/app/core/state/principals/principals.query.ts
index ec5d89563e4..508fbf87d86 100644
--- a/frontend/src/app/core/state/principals/principals.query.ts
+++ b/frontend/src/app/core/state/principals/principals.query.ts
@@ -1,10 +1,10 @@
import { QueryEntity } from '@datorama/akita';
import { Observable } from 'rxjs';
-import { Principal } from './principal.model';
+import { IPrincipal } from './principal.model';
import { PrincipalsState } from './principals.store';
export class PrincipalsQuery extends QueryEntity<PrincipalsState> {
- public byIds(ids:string[]):Observable<Principal[]> {
+ public byIds(ids:string[]):Observable<IPrincipal[]> {
return this.selectMany(ids);
}
}
diff --git a/frontend/src/app/core/state/principals/principals.service.ts b/frontend/src/app/core/state/principals/principals.service.ts
index 28219dafedf..241aca40f99 100644
--- a/frontend/src/app/core/state/principals/principals.service.ts
+++ b/frontend/src/app/core/state/principals/principals.service.ts
@@ -20,7 +20,7 @@ import {
} from 'core-app/core/state/effects/effect-handler.decorator';
import { ActionsService } from 'core-app/core/state/actions/actions.service';
import { PrincipalsStore } from './principals.store';
-import { Principal } from './principal.model';
+import { IPrincipal } from './principal.model';
@EffectHandler
@Injectable()
@@ -44,12 +44,12 @@ export class PrincipalsResourceService {
) {
}
- fetchPrincipals(params:ApiV3ListParameters):Observable<IHALCollection<Principal>> {
+ fetchPrincipals(params:ApiV3ListParameters):Observable<IHALCollection<IPrincipal>> {
const collectionURL = collectionKey(params);
return this
.http
- .get<IHALCollection<Principal>>(this.principalsPath + collectionURL)
+ .get<IHALCollection<IPrincipal>>(this.principalsPath + collectionURL)
.pipe(
tap((events) => {
applyTransaction(() => {
@@ -74,7 +74,7 @@ export class PrincipalsResourceService {
);
}
- update(id:ID, principal:Partial<Principal>):void {
+ update(id:ID, principal:Partial<IPrincipal>):void {
this.store.update(id, principal);
}
diff --git a/frontend/src/app/core/state/principals/principals.store.ts b/frontend/src/app/core/state/principals/principals.store.ts
index 19b8fae8b21..d95173996e3 100644
--- a/frontend/src/app/core/state/principals/principals.store.ts
+++ b/frontend/src/app/core/state/principals/principals.store.ts
@@ -1,8 +1,8 @@
import { EntityStore, StoreConfig } from '@datorama/akita';
-import { Principal } from './principal.model';
+import { IPrincipal } from './principal.model';
import { CollectionState, createInitialCollectionState } from 'core-app/core/state/collection-store';
-export interface PrincipalsState extends CollectionState<Principal> {
+export interface PrincipalsState extends CollectionState<IPrincipal> {
}
@StoreConfig({ name: 'principals' })
diff --git a/frontend/src/app/core/state/principals/user.model.ts b/frontend/src/app/core/state/principals/user.model.ts
index 60f6282d618..9851b39c4a7 100644
--- a/frontend/src/app/core/state/principals/user.model.ts
+++ b/frontend/src/app/core/state/principals/user.model.ts
@@ -1,14 +1,14 @@
import { ID } from '@datorama/akita';
-import { HalResourceLink, HalResourceLinks } from 'core-app/core/state/hal-resource';
+import { IHalResourceLink, IHalResourceLinks } from 'core-app/core/state/hal-resource';
-export interface UserHalResourceLinks extends HalResourceLinks {
- lock:HalResourceLink;
- unlock:HalResourceLink;
- delete:HalResourceLink;
- showUser:HalResourceLink;
+export interface IUserHalResourceLinks extends IHalResourceLinks {
+ lock:IHalResourceLink;
+ unlock:IHalResourceLink;
+ delete:IHalResourceLink;
+ showUser:IHalResourceLink;
}
-export interface User {
+export interface IUser {
id:ID;
name:string;
createdAt:string;
@@ -27,5 +27,5 @@ export interface User {
status:string;
- _links:UserHalResourceLinks;
+ _links:IUserHalResourceLinks;
}
diff --git a/frontend/src/app/core/state/projects/project.model.ts b/frontend/src/app/core/state/projects/project.model.ts
index baf62ea7009..0ce383139d7 100644
--- a/frontend/src/app/core/state/projects/project.model.ts
+++ b/frontend/src/app/core/state/projects/project.model.ts
@@ -1,32 +1,32 @@
import { ID } from '@datorama/akita';
import {
- HalResourceLink,
- HalResourceLinks,
- Formattable,
+ IHalResourceLink,
+ IHalResourceLinks,
+ IFormattable,
} from 'core-app/core/state/hal-resource';
export const PROJECTS_MAX_SIZE = 100;
-export interface ProjectHalResourceLinks extends HalResourceLinks {
- categories:HalResourceLink;
- delete:HalResourceLink;
- parent:HalResourceLink;
- self:HalResourceLink;
- status:HalResourceLink;
- schema:HalResourceLink;
+export interface IProjectHalResourceLinks extends IHalResourceLinks {
+ categories:IHalResourceLink;
+ delete:IHalResourceLink;
+ parent:IHalResourceLink;
+ self:IHalResourceLink;
+ status:IHalResourceLink;
+ schema:IHalResourceLink;
}
-export interface Project {
+export interface IProject {
id:ID;
identifier:string;
name:string;
public:boolean;
active:boolean;
- statusExplanation:Formattable;
- description:Formattable;
+ statusExplanation:IFormattable;
+ description:IFormattable;
createdAt:string;
updatedAt:string;
- _links:ProjectHalResourceLinks;
+ _links:IProjectHalResourceLinks;
}
diff --git a/frontend/src/app/core/state/projects/projects.service.ts b/frontend/src/app/core/state/projects/projects.service.ts
index cc9e0ebe000..67764a05383 100644
--- a/frontend/src/app/core/state/projects/projects.service.ts
+++ b/frontend/src/app/core/state/projects/projects.service.ts
@@ -16,7 +16,7 @@ import { ProjectsQuery } from 'core-app/core/state/projects/projects.query';
import { ApiV3ListParameters } from 'core-app/core/apiv3/paths/apiv3-list-resource.interface';
import { collectionKey } from 'core-app/core/state/collection-store';
import { ProjectsStore } from './projects.store';
-import { Project } from './project.model';
+import { IProject } from './project.model';
@Injectable()
export class ProjectsResourceService {
@@ -38,12 +38,12 @@ export class ProjectsResourceService {
) {
}
- fetchProjects(params:ApiV3ListParameters):Observable<IHALCollection<Project>> {
+ fetchProjects(params:ApiV3ListParameters):Observable<IHALCollection<IProject>> {
const collectionURL = collectionKey(params);
return this
.http
- .get<IHALCollection<Project>>(this.projectsPath + collectionURL)
+ .get<IHALCollection<IProject>>(this.projectsPath + collectionURL)
.pipe(
tap((events) => {
applyTransaction(() => {
@@ -67,7 +67,7 @@ export class ProjectsResourceService {
);
}
- update(id:ID, project:Partial<Project>):void {
+ update(id:ID, project:Partial<IProject>):void {
this.store.update(id, project);
}
diff --git a/frontend/src/app/core/state/projects/projects.store.ts b/frontend/src/app/core/state/projects/projects.store.ts
index 00fa14ac83f..04f2e0b106b 100644
--- a/frontend/src/app/core/state/projects/projects.store.ts
+++ b/frontend/src/app/core/state/projects/projects.store.ts
@@ -1,8 +1,8 @@
import { EntityStore, StoreConfig } from '@datorama/akita';
import { CollectionState, createInitialCollectionState } from 'core-app/core/state/collection-store';
-import { Project } from './project.model';
+import { IProject } from './project.model';
-export interface ProjectsState extends CollectionState<Project> {
+export interface ProjectsState extends CollectionState<IProject> {
}
@StoreConfig({ name: 'projects' })
diff --git a/frontend/src/app/core/state/views/view.model.ts b/frontend/src/app/core/state/views/view.model.ts
index 09089326b84..e5349386b80 100644
--- a/frontend/src/app/core/state/views/view.model.ts
+++ b/frontend/src/app/core/state/views/view.model.ts
@@ -1,21 +1,21 @@
import { ID } from '@datorama/akita';
import {
- HalResourceLink,
- HalResourceLinks,
+ IHalResourceLink,
+ IHalResourceLinks,
} from 'core-app/core/state/hal-resource';
-export interface ViewLinks extends HalResourceLinks {
- query:HalResourceLink
+export interface IViewLinks extends IHalResourceLinks {
+ query:IHalResourceLink
}
-export interface View {
+export interface IView {
id:ID;
starred:boolean;
public:boolean;
- _links:ViewLinks;
+ _links:IViewLinks;
}
-export interface ViewCreatePayload {
+export interface IViewCreatePayload {
_links:{
[P in 'query']:{
[Q in 'href']:string
diff --git a/frontend/src/app/core/state/views/views.service.ts b/frontend/src/app/core/state/views/views.service.ts
index 7a713df6b6f..0837c32238c 100644
--- a/frontend/src/app/core/state/views/views.service.ts
+++ b/frontend/src/app/core/state/views/views.service.ts
@@ -18,7 +18,7 @@ import {
import { ActionsService } from 'core-app/core/state/actions/actions.service';
import { ViewsStore } from 'core-app/core/state/views/views.store';
import { ViewsQuery } from 'core-app/core/state/views/views.query';
-import { View } from 'core-app/core/state/views/view.model';
+import { IView } from 'core-app/core/state/views/view.model';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
import { ApiV3ListParameters } from 'core-app/core/apiv3/paths/apiv3-list-resource.interface';
@@ -44,12 +44,12 @@ export class ViewsResourceService {
) {
}
- fetchViews(params:ApiV3ListParameters):Observable<IHALCollection<View>> {
+ fetchViews(params:ApiV3ListParameters):Observable<IHALCollection<IView>> {
const collectionURL = collectionKey(params);
return this
.http
- .get<IHALCollection<View>>(this.viewsPath + collectionURL)
+ .get<IHALCollection<IView>>(this.viewsPath + collectionURL)
.pipe(
tap((events) => {
applyTransaction(() => {
@@ -74,7 +74,7 @@ export class ViewsResourceService {
);
}
- update(id:ID, view:Partial<View>):void {
+ update(id:ID, view:Partial<IView>):void {
this.store.update(id, view);
}
diff --git a/frontend/src/app/core/state/views/views.store.ts b/frontend/src/app/core/state/views/views.store.ts
index d8fcbbd34f4..dede123199a 100644
--- a/frontend/src/app/core/state/views/views.store.ts
+++ b/frontend/src/app/core/state/views/views.store.ts
@@ -1,8 +1,8 @@
import { EntityStore, StoreConfig } from '@datorama/akita';
import { CollectionState, createInitialCollectionState } from 'core-app/core/state/collection-store';
-import { View } from './view.model';
+import { IView } from './view.model';
-export interface ViewsState extends CollectionState<View> {
+export interface ViewsState extends CollectionState<IView> {
}
@StoreConfig({ name: 'views' })
diff --git a/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.query.ts b/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.query.ts
index c32f60f1f88..3c2cd59fe77 100644
--- a/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.query.ts
+++ b/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.query.ts
@@ -4,7 +4,7 @@ import { map } from 'rxjs/operators';
import idFromLink from 'core-app/features/hal/helpers/id-from-link';
import { InAppNotificationsResourceService } from 'core-app/core/state/in-app-notifications/in-app-notifications.service';
import { ProjectsResourceService } from 'core-app/core/state/projects/projects.service';
-import { Project } from 'core-app/core/state/projects/project.model';
+import { IProject } from 'core-app/core/state/projects/project.model';
import { collectionKey } from 'core-app/core/state/collection-store';
import {
IanMenuState,
@@ -25,7 +25,7 @@ export class IanMenuQuery extends Query<IanMenuState> {
return ids
.map((id:string) => this.projectsResourceService.query.getEntity(id))
- .filter((item:Project|undefined) => !!item) as Project[];
+ .filter((item:IProject|undefined) => !!item) as IProject[];
}),
);
diff --git a/frontend/src/app/features/work-packages/components/wp-list/wp-query-view.service.ts b/frontend/src/app/features/work-packages/components/wp-list/wp-query-view.service.ts
index 5dd18c86679..b6375a01d74 100644
--- a/frontend/src/app/features/work-packages/components/wp-list/wp-query-view.service.ts
+++ b/frontend/src/app/features/work-packages/components/wp-list/wp-query-view.service.ts
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { StateService } from '@uirouter/core';
import { QueryResource } from 'core-app/features/hal/resources/query-resource';
import { Observable } from 'rxjs';
-import { View } from 'core-app/core/state/views/view.model';
+import { IView } from 'core-app/core/state/views/view.model';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
@Injectable()
@@ -12,7 +12,7 @@ export class WorkPackagesQueryViewService {
protected apiV3Service:ApiV3Service,
) { }
- create(query:QueryResource):Observable<View> {
+ create(query:QueryResource):Observable<IView> {
if (!query.href) {
throw new Error('Expected only queries that are created since an href is required');
}
diff --git a/frontend/src/app/shared/components/op-view-select/op-view-select.component.ts b/frontend/src/app/shared/components/op-view-select/op-view-select.component.ts
index d5ef9d99ff2..ec45d5a5ff7 100644
--- a/frontend/src/app/shared/components/op-view-select/op-view-select.component.ts
+++ b/frontend/src/app/shared/components/op-view-select/op-view-select.component.ts
@@ -49,7 +49,7 @@ import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destr
import { IOpSidemenuItem } from 'core-app/shared/components/sidemenu/sidemenu.component';
import { StaticQueriesService } from 'core-app/shared/components/op-view-select/op-static-queries.service';
import { ViewsResourceService } from 'core-app/core/state/views/views.service';
-import { View } from 'core-app/core/state/views/view.model';
+import { IView } from 'core-app/core/state/views/view.model';
import idFromLink from 'core-app/features/hal/helpers/id-from-link';
import { ApiV3ListParameters } from 'core-app/core/apiv3/paths/apiv3-list-resource.interface';
@@ -211,7 +211,7 @@ export class ViewSelectComponent extends UntilDestroyedMixin implements OnInit {
});
}
- private toOpSideMenuItem(view:View):IOpSidemenuItem {
+ private toOpSideMenuItem(view:IView):IOpSidemenuItem {
const { query } = view._links;
return {
title: query.title,
diff --git a/frontend/src/app/shared/components/principal/principal-helper.ts b/frontend/src/app/shared/components/principal/principal-helper.ts
index f0cf29f8061..7d9724ee840 100644
--- a/frontend/src/app/shared/components/principal/principal-helper.ts
+++ b/frontend/src/app/shared/components/principal/principal-helper.ts
@@ -27,7 +27,7 @@
//++
import { PrincipalLike } from 'core-app/shared/components/principal/principal-types';
-import { Principal } from 'core-app/core/state/principals/principal.model';
+import { IPrincipal } from 'core-app/core/state/principals/principal.model';
import { HalSourceLink } from 'core-app/features/hal/resources/hal-resource';
export namespace PrincipalHelper {
@@ -39,13 +39,13 @@ export namespace PrincipalHelper {
*
* TODO: Remove old HalResource stuff :P
*/
- export function hrefFromPrincipal(p:Principal|PrincipalLike):string {
+ export function hrefFromPrincipal(p:IPrincipal|PrincipalLike):string {
if ((p as PrincipalLike).href) {
return (p as PrincipalLike).href || '';
}
- if ((p as Principal)._links) {
- const self = (p as Principal)._links.self as HalSourceLink;
+ if ((p as IPrincipal)._links) {
+ const self = (p as IPrincipal)._links.self as HalSourceLink;
return self.href || '';
}
diff --git a/frontend/src/app/shared/components/principal/principal-renderer.service.ts b/frontend/src/app/shared/components/principal/principal-renderer.service.ts
index be59e3ab9a0..18b4af62bf5 100644
--- a/frontend/src/app/shared/components/principal/principal-renderer.service.ts
+++ b/frontend/src/app/shared/components/principal/principal-renderer.service.ts
@@ -3,7 +3,7 @@ import { PathHelperService } from 'core-app/core/path-helper/path-helper.service
import { ColorsService } from 'core-app/shared/components/colors/colors.service';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
import idFromLink from 'core-app/features/hal/helpers/id-from-link';
-import { Principal } from 'core-app/core/state/principals/principal.model';
+import { IPrincipal } from 'core-app/core/state/principals/principal.model';
import { PrincipalLike } from './principal-types';
import { PrincipalHelper } from './principal-helper';
import PrincipalType = PrincipalHelper.PrincipalType;
@@ -30,7 +30,7 @@ export class PrincipalRendererService {
renderMultiple(
container:HTMLElement,
- users:PrincipalLike[]|Principal[],
+ users:PrincipalLike[]|IPrincipal[],
name:NameOptions = { hide: false, link: false },
avatar:AvatarOptions = { hide: false, size: 'default' },
multiLine = false,
@@ -60,7 +60,7 @@ export class PrincipalRendererService {
render(
container:HTMLElement,
- principal:PrincipalLike|Principal,
+ principal:PrincipalLike|IPrincipal,
name:NameOptions = { hide: false, link: true },
avatar:AvatarOptions = { hide: false, size: 'default' },
):void {
@@ -79,7 +79,7 @@ export class PrincipalRendererService {
}
private renderAvatar(
- principal:PrincipalLike|Principal,
+ principal:PrincipalLike|IPrincipal,
options:AvatarOptions,
type:PrincipalType,
) {
@@ -110,7 +110,7 @@ export class PrincipalRendererService {
return fallback;
}
- private renderUserAvatar(principal:PrincipalLike|Principal, fallback:HTMLElement, options:AvatarOptions):void {
+ private renderUserAvatar(principal:PrincipalLike|IPrincipal, fallback:HTMLElement, options:AvatarOptions):void {
const url = this.userAvatarUrl(principal);
if (!url) {
@@ -130,12 +130,12 @@ export class PrincipalRendererService {
};
}
- private userAvatarUrl(principal:PrincipalLike|Principal):string|null {
+ private userAvatarUrl(principal:PrincipalLike|IPrincipal):string|null {
const id = principal.id || idFromLink(PrincipalHelper.hrefFromPrincipal(principal));
return id ? this.apiV3Service.users.id(id).avatar.toString() : null;
}
- private renderName(principal:PrincipalLike|Principal, type:PrincipalType, asLink = true) {
+ private renderName(principal:PrincipalLike|IPrincipal, type:PrincipalType, asLink = true) {
if (asLink) {
const link = document.createElement('a');
link.textContent = principal.name;
@@ -152,7 +152,7 @@ export class PrincipalRendererService {
return span;
}
- private principalURL(principal:PrincipalLike|Principal, type:PrincipalType):string {
+ private principalURL(principal:PrincipalLike|IPrincipal, type:PrincipalType):string {
const href = PrincipalHelper.hrefFromPrincipal(principal);
const id = principal.id || (href ? idFromLink(href) : '');