Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<osf-sub-header
[title]="'project.analytics.kpi.forks' | translate"
[showButton]="!hasNoPermissions()"
[showButton]="isAuthenticated()"
[buttonLabel]="'project.overview.actions.forkProjectLabel' | translate"
(buttonClick)="handleForkResource()"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
import { toSignal } from '@angular/core/rxjs-interop';
import { ActivatedRoute, Router, RouterLink } from '@angular/router';

import { UserSelectors } from '@core/store/user';
import { DeleteComponentDialogComponent, ForkDialogComponent } from '@osf/features/project/overview/components';
import { ClearProjectOverview, GetProjectById, ProjectOverviewSelectors } from '@osf/features/project/overview/store';
import {
Expand All @@ -42,7 +43,7 @@ import { IS_SMALL } from '@osf/shared/helpers';
import { ToolbarResource } from '@osf/shared/models';
import { Duplicate } from '@osf/shared/models/duplicates';
import { CustomDialogService } from '@osf/shared/services';
import { ClearDuplicates, CurrentResourceSelectors, DuplicatesSelectors, GetAllDuplicates } from '@osf/shared/stores';
import { ClearDuplicates, DuplicatesSelectors, GetAllDuplicates } from '@osf/shared/stores';

@Component({
selector: 'osf-view-duplicates',
Expand Down Expand Up @@ -76,7 +77,7 @@ export class ViewDuplicatesComponent {
duplicates = select(DuplicatesSelectors.getDuplicates);
isDuplicatesLoading = select(DuplicatesSelectors.getDuplicatesLoading);
totalDuplicates = select(DuplicatesSelectors.getDuplicatesTotalCount);
hasNoPermissions = select(CurrentResourceSelectors.hasNoPermissions);
isAuthenticated = select(UserSelectors.isAuthenticated);

readonly pageSize = 10;
readonly UserPermissions = UserPermissions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
}
}

@if (!hasNoPermissions()) {
@if (isAuthenticated()) {
<div class="flex ml-auto">
<div class="flex flex-1 flex-column-reverse gap-3 justify-content-end sm:gap-3 sm:flex-row-reverse lg:flex-row">
@if (resource.storage && !isCollectionsRoute()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
import { FormsModule } from '@angular/forms';
import { ActivatedRoute, Router, RouterLink } from '@angular/router';

import { UserSelectors } from '@core/store/user';
import { ClearDuplicatedProject, ProjectOverviewSelectors } from '@osf/features/project/overview/store';
import { IconComponent } from '@osf/shared/components';
import { ResourceType } from '@osf/shared/enums';
Expand Down Expand Up @@ -78,7 +79,7 @@ export class OverviewToolbarComponent {
bookmarksCollectionId = select(BookmarksSelectors.getBookmarksCollectionId);
bookmarkedProjects = select(MyResourcesSelectors.getBookmarks);
duplicatedProject = select(ProjectOverviewSelectors.getDuplicatedProject);
hasNoPermissions = select(ProjectOverviewSelectors.hasNoPermissions);
isAuthenticated = select(UserSelectors.isAuthenticated);
socialsActionItems = computed(() => {
const shareableContent = this.createShareableContent();
return shareableContent ? this.buildSocialActionItems(shareableContent) : [];
Expand Down
9 changes: 8 additions & 1 deletion src/app/features/project/wiki/wiki.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ButtonGroupModule } from 'primeng/buttongroup';

import { filter, map, mergeMap, of, tap } from 'rxjs';

import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';
import { ChangeDetectionStrategy, Component, computed, DestroyRef, inject } from '@angular/core';
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
import { ActivatedRoute, Router } from '@angular/router';

Expand All @@ -23,6 +23,7 @@ import { hasViewOnlyParam } from '@osf/shared/helpers';
import { WikiModes } from '@osf/shared/models';
import { ToastService } from '@osf/shared/services';
import {
ClearWiki,
CreateWiki,
CreateWikiVersion,
CurrentResourceSelectors,
Expand Down Expand Up @@ -61,6 +62,7 @@ import { ViewOnlyLinkMessageComponent } from '@shared/components/view-only-link-
export class WikiComponent {
private readonly route = inject(ActivatedRoute);
private readonly router = inject(Router);
private readonly destroyRef = inject(DestroyRef);
private toastService = inject(ToastService);

WikiModes = WikiModes;
Expand Down Expand Up @@ -99,6 +101,7 @@ export class WikiComponent {
createWikiVersion: CreateWikiVersion,
getWikiVersionContent: GetWikiVersionContent,
getCompareVersionContent: GetCompareVersionContent,
clearWiki: ClearWiki,
});

wikiIdFromQueryParams = this.route.snapshot.queryParams['wiki'];
Expand Down Expand Up @@ -132,6 +135,10 @@ export class WikiComponent {
mergeMap((wikiId) => this.actions.getWikiVersions(wikiId))
)
.subscribe();

this.destroyRef.onDestroy(() => {
this.actions.clearWiki();
});
}

toggleMode(mode: WikiModes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ButtonGroup } from 'primeng/buttongroup';

import { filter, map, mergeMap, tap } from 'rxjs';

import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';
import { ChangeDetectionStrategy, Component, computed, DestroyRef, inject } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { ActivatedRoute, Router } from '@angular/router';

Expand All @@ -17,6 +17,7 @@ import { ResourceType } from '@osf/shared/enums';
import { hasViewOnlyParam } from '@osf/shared/helpers';
import { WikiModes } from '@osf/shared/models';
import {
ClearWiki,
GetCompareVersionContent,
GetComponentsWikiList,
GetWikiContent,
Expand Down Expand Up @@ -47,6 +48,7 @@ import {
export class RegistryWikiComponent {
private readonly route = inject(ActivatedRoute);
private readonly router = inject(Router);
private readonly destroyRef = inject(DestroyRef);

WikiModes = WikiModes;
wikiModes = select(WikiSelectors.getWikiModes);
Expand All @@ -73,6 +75,7 @@ export class RegistryWikiComponent {
getWikiVersionContent: GetWikiVersionContent,
getCompareVersionContent: GetCompareVersionContent,
getComponentsWikiList: GetComponentsWikiList,
clearWiki: ClearWiki,
});

wikiIdFromQueryParams = this.route.snapshot.queryParams['wiki'];
Expand Down Expand Up @@ -103,14 +106,20 @@ export class RegistryWikiComponent {
mergeMap((wikiId) => this.actions.getWikiVersions(wikiId))
)
.subscribe();

this.destroyRef.onDestroy(() => {
this.actions.clearWiki();
});
}

toggleMode(mode: WikiModes) {
this.actions.toggleMode(mode);
}

onSelectVersion(versionId: string) {
this.actions.getWikiVersionContent(this.currentWikiId(), versionId);
if (versionId) {
this.actions.getWikiVersionContent(this.currentWikiId(), versionId);
}
}

onSelectCompareVersion(versionId: string) {
Expand Down
Loading