Undo the change of making the ID a number as it broke too much and need to be handled separatly

pull/9581/head
Henriette Darge 3 years ago
parent ca16219d0a
commit 0eacbcd12e
  1. 2
      frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts
  2. 2
      frontend/src/app/features/bim/ifc_models/ifc-viewer/ifc-viewer.service.ts
  3. 4
      frontend/src/app/features/hal/helpers/id-from-link.ts
  4. 2
      frontend/src/app/features/hal/resources/hal-resource.ts
  5. 4
      frontend/src/app/features/hal/resources/relation-resource.ts
  6. 2
      frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts
  7. 2
      frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.service.ts
  8. 2
      frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts
  9. 2
      frontend/src/app/features/invite-user-modal/project-selection/project-allowed.validator.ts
  10. 2
      frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts
  11. 2
      frontend/src/app/features/work-packages/components/wp-activity/activity-entry.component.ts
  12. 2
      frontend/src/app/features/work-packages/components/wp-new/wp-create.service.ts
  13. 4
      frontend/src/app/features/work-packages/components/wp-single-view/wp-single-view.component.ts
  14. 2
      frontend/src/app/shared/components/dynamic-forms/components/dynamic-inputs/select-input/select-input.component.ts
  15. 2
      frontend/src/app/shared/components/fields/edit/field-types/te-work-package-edit-field.component.ts
  16. 2
      frontend/src/app/shared/components/grids/widgets/news/news.component.ts

@ -163,7 +163,7 @@ export class BcfWpAttributeGroupComponent extends UntilDestroyedMixin implements
}
async initialize(workPackage:WorkPackageResource) {
this.projectId = String(idFromLink(workPackage.project.href));
this.projectId = idFromLink(workPackage.project.href);
this.viewAllowed = await this.bcfAuthorization.isAllowedTo(this.projectId, 'project_actions', 'viewTopic');
this.createAllowed = await this.bcfAuthorization.isAllowedTo(this.projectId, 'topic_actions', 'createViewpoint');

@ -167,7 +167,7 @@ export class IFCViewerService extends ViewerBridgeService {
// and redirect to a route with a place to show viewer
// ('bim.partitioned.split')
window.location.href = this.pathHelper.bimDetailsPath(
String(idFromLink(workPackage.project.href)),
idFromLink(workPackage.project.href),
workPackage.id!,
index,
);

@ -1,4 +1,4 @@
export default function idFromLink(href:string|null):number {
export default function idFromLink(href:string|null):string {
const idPart = (href || '').split('/').pop()!;
return parseInt(decodeURIComponent(idPart), 10);
return decodeURIComponent(idPart);
}

@ -146,7 +146,7 @@ export class HalResource {
return this.$source.id.toString();
}
const id = String(idFromLink(this.href));
const id = idFromLink(this.href);
if (/^\d+$/.exec(id)) {
return id;
}

@ -118,8 +118,8 @@ export class RelationResource extends HalResource {
*/
public get ids() {
return {
from: String(idFromLink(this.from.href!)),
to: String(idFromLink(this.to.href!)),
from: idFromLink(this.from.href!),
to: idFromLink(this.to.href!),
};
}

@ -62,7 +62,7 @@ export class IanMenuComponent implements OnInit {
.map((item) => ({
...item,
title: (item.projectHasParent ? '...' : '') + item.value,
href: this.getHrefForFilters({ filter: 'project', name: String(idFromLink(item._links.valueLink[0].href)) }),
href: this.getHrefForFilters({ filter: 'project', name: idFromLink(item._links.valueLink[0].href) }),
}))
.sort((a, b) => {
if (b.projectHasParent && !a.projectHasParent) {

@ -55,7 +55,7 @@ export class IanMenuService {
};
if (data.groups) {
projectsFilter.filters = [['id', '=', data.groups.map((group) => String(idFromLink(group._links.valueLink[0].href)))]];
projectsFilter.filters = [['id', '=', data.groups.map((group) => idFromLink(group._links.valueLink[0].href))]];
}
this.store.update({

@ -213,7 +213,7 @@ export class InAppNotificationEntryComponent implements OnInit {
if (project) {
this.project = {
...project,
showUrl: this.pathHelper.projectPath(String(idFromLink(project.href))),
showUrl: this.pathHelper.projectPath(idFromLink(project.href)),
};
}
}

@ -8,7 +8,7 @@ export const ProjectAllowedValidator = (currentUserService:CurrentUserService) =
(control:AbstractControl) =>
currentUserService.hasCapabilities$(
'memberships/create',
String(idFromLink(control.value.href)),
idFromLink(control.value.href),
).pipe(
take(1),
map((isAllowed) => (isAllowed ? null : { lackingPermission: true })),

@ -48,7 +48,7 @@ export class NotificationSettingsTableComponent {
) {}
projectLink(href:string) {
return this.pathHelper.projectPath(String(idFromLink(href)));
return this.pathHelper.projectPath(idFromLink(href));
}
addProjectSettings(project:HalSourceLink):void {

@ -56,7 +56,7 @@ export class ActivityEntryComponent implements OnInit {
}
ngOnInit() {
this.projectId = String(idFromLink(this.workPackage.project.href));
this.projectId = idFromLink(this.workPackage.project.href);
this.activityType = this.activity._type;
}

@ -212,7 +212,7 @@ export class WorkPackageCreateService extends UntilDestroyedMixin {
const hasChanges = !change.isEmpty();
const typeEmpty = !changeType && !type;
const typeMatches = type && changeType && idFromLink(changeType.href) === type;
const typeMatches = type && changeType && idFromLink(changeType.href) === type.toString();
if (hasChanges && (typeEmpty || typeMatches)) {
return Promise.resolve(change);

@ -190,7 +190,7 @@ export class WorkPackageSingleViewComponent extends UntilDestroyedMixin implemen
this.projectContext = { matches: false, href: null };
} else {
this.projectContext = {
href: this.PathHelper.projectWorkPackagePath(String(idFromLink(resource.project.href)), this.workPackage.id!),
href: this.PathHelper.projectWorkPackagePath(idFromLink(resource.project.href), this.workPackage.id!),
matches: resource.project.href === this.currentProject.apiv3Path,
};
}
@ -261,7 +261,7 @@ export class WorkPackageSingleViewComponent extends UntilDestroyedMixin implemen
}
public get projectContextText():string {
const id = String(idFromLink(this.workPackage.project.href));
const id = idFromLink(this.workPackage.project.href);
const projectPath = this.PathHelper.projectPath(id);
const project = `<a href="${projectPath}">${this.workPackage.project.name}<a>`;
return this.I18n.t('js.project.work_package_belongs_to', { projectname: project });

@ -12,7 +12,7 @@ export class SelectInputComponent extends FieldType implements OnInit {
public ngOnInit():void {
if (this.model?.project) {
this.projectId = String(idFromLink(this.model.project?.href));
this.projectId = idFromLink(this.model.project?.href);
}
}
}

@ -93,7 +93,7 @@ export class TimeEntryWorkPackageEditFieldComponent extends WorkPackageEditField
.then((collection) => {
this.recentWorkPackageIds = collection
.elements
.map((timeEntry) => String(idFromLink(timeEntry.workPackage.href)))
.map((timeEntry) => idFromLink(timeEntry.workPackage.href))
.filter((v, i, a) => a.indexOf(v) === i);
return this.fetchAllowedValueQuery(query);

@ -63,7 +63,7 @@ export class WidgetNewsComponent extends AbstractWidgetComponent implements OnIn
}
public newsProjectPath(news:NewsResource) {
return this.pathHelper.projectPath(String(idFromLink(news.project?.href)));
return this.pathHelper.projectPath(idFromLink(news.project?.href));
}
public newsProjectName(news:NewsResource) {

Loading…
Cancel
Save