mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACS-8959] Introduce new takeUntilDestroyed
operator (#4237)
This commit is contained in:
parent
dec6c41e5c
commit
adda597f15
@ -23,7 +23,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, ViewEncapsulation } from '@angular/core';
|
import { Component, ViewEncapsulation } from '@angular/core';
|
||||||
import { Subject } from 'rxjs';
|
|
||||||
import { AppService } from '@alfresco/aca-shared';
|
import { AppService } from '@alfresco/aca-shared';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -33,8 +32,6 @@ import { AppService } from '@alfresco/aca-shared';
|
|||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
onDestroy$: Subject<boolean> = new Subject<boolean>();
|
|
||||||
|
|
||||||
constructor(private appService: AppService) {
|
constructor(private appService: AppService) {
|
||||||
this.appService.init();
|
this.appService.init();
|
||||||
}
|
}
|
||||||
|
809
package-lock.json
generated
809
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@ -30,11 +30,11 @@
|
|||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alfresco/adf-content-services": "7.0.0-alpha.6",
|
"@alfresco/adf-content-services": "7.0.0-alpha.6-11937616463",
|
||||||
"@alfresco/adf-core": "7.0.0-alpha.6",
|
"@alfresco/adf-core": "7.0.0-alpha.6-11937616463",
|
||||||
"@alfresco/adf-extensions": "7.0.0-alpha.6",
|
"@alfresco/adf-extensions": "7.0.0-alpha.6-11937616463",
|
||||||
"@alfresco/eslint-plugin-eslint-angular": "7.0.0-alpha.6",
|
"@alfresco/eslint-plugin-eslint-angular": "7.0.0-alpha.6-11937616463",
|
||||||
"@alfresco/js-api": "8.0.0-alpha.6",
|
"@alfresco/js-api": "8.0.0-alpha.6-11937616463",
|
||||||
"@angular/animations": "16.2.9",
|
"@angular/animations": "16.2.9",
|
||||||
"@angular/cdk": "16.2.9",
|
"@angular/cdk": "16.2.9",
|
||||||
"@angular/common": "16.2.9",
|
"@angular/common": "16.2.9",
|
||||||
@ -62,7 +62,7 @@
|
|||||||
"zone.js": "0.13.3"
|
"zone.js": "0.13.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@alfresco/adf-cli": "7.0.0-alpha.6",
|
"@alfresco/adf-cli": "7.0.0-alpha.6-11937616463",
|
||||||
"@angular-devkit/build-angular": "16.2.9",
|
"@angular-devkit/build-angular": "16.2.9",
|
||||||
"@angular-devkit/core": "16.2.9",
|
"@angular-devkit/core": "16.2.9",
|
||||||
"@angular-devkit/schematics": "16.2.9",
|
"@angular-devkit/schematics": "16.2.9",
|
||||||
|
@ -22,17 +22,17 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ChangeDetectionStrategy, Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, DestroyRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { CommonModule, Location } from '@angular/common';
|
import { CommonModule, Location } from '@angular/common';
|
||||||
import { FolderRulesService } from '../services/folder-rules.service';
|
import { FolderRulesService } from '../services/folder-rules.service';
|
||||||
import { Observable, Subject, Subscription } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { Rule } from '../model/rule.model';
|
import { Rule } from '../model/rule.model';
|
||||||
import { ActivatedRoute, RouterModule } from '@angular/router';
|
import { ActivatedRoute, RouterModule } from '@angular/router';
|
||||||
import { NodeInfo } from '@alfresco/aca-shared/store';
|
import { NodeInfo } from '@alfresco/aca-shared/store';
|
||||||
import { delay, takeUntil } from 'rxjs/operators';
|
import { delay } from 'rxjs/operators';
|
||||||
import { EditRuleDialogUiComponent } from '../rule-details/edit-rule-dialog.ui-component';
|
import { EditRuleDialogUiComponent } from '../rule-details/edit-rule-dialog.ui-component';
|
||||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||||
import { NotificationService, TemplateModule, ToolbarModule, ConfirmDialogComponent } from '@alfresco/adf-core';
|
import { ConfirmDialogComponent, NotificationService, TemplateModule, ToolbarModule } from '@alfresco/adf-core';
|
||||||
import { ActionDefinitionTransformed } from '../model/rule-action.model';
|
import { ActionDefinitionTransformed } from '../model/rule-action.model';
|
||||||
import { ActionsService } from '../services/actions.service';
|
import { ActionsService } from '../services/actions.service';
|
||||||
import { FolderRuleSetsService } from '../services/folder-rule-sets.service';
|
import { FolderRuleSetsService } from '../services/folder-rule-sets.service';
|
||||||
@ -48,6 +48,7 @@ import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|||||||
import { MatDividerModule } from '@angular/material/divider';
|
import { MatDividerModule } from '@angular/material/divider';
|
||||||
import { RuleListUiComponent } from '../rule-list/rule-list/rule-list.ui-component';
|
import { RuleListUiComponent } from '../rule-list/rule-list/rule-list.ui-component';
|
||||||
import { RuleDetailsUiComponent } from '../rule-details/rule-details.ui-component';
|
import { RuleDetailsUiComponent } from '../rule-details/rule-details.ui-component';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -75,7 +76,7 @@ import { RuleDetailsUiComponent } from '../rule-details/rule-details.ui-componen
|
|||||||
changeDetection: ChangeDetectionStrategy.Default,
|
changeDetection: ChangeDetectionStrategy.Default,
|
||||||
host: { class: 'aca-manage-rules' }
|
host: { class: 'aca-manage-rules' }
|
||||||
})
|
})
|
||||||
export class ManageRulesSmartComponent implements OnInit, OnDestroy {
|
export class ManageRulesSmartComponent implements OnInit {
|
||||||
nodeId = '';
|
nodeId = '';
|
||||||
isInheritanceEnabled = true;
|
isInheritanceEnabled = true;
|
||||||
isInheritanceToggleDisabled = false;
|
isInheritanceToggleDisabled = false;
|
||||||
@ -96,8 +97,7 @@ export class ManageRulesSmartComponent implements OnInit, OnDestroy {
|
|||||||
isMainRuleSetNotEmpty = false;
|
isMainRuleSetNotEmpty = false;
|
||||||
isInheritedRuleSetsNotEmpty = false;
|
isInheritedRuleSetsNotEmpty = false;
|
||||||
|
|
||||||
private destroyed$ = new Subject<void>();
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
private _actionDefinitionsSub: Subscription;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private location: Location,
|
private location: Location,
|
||||||
@ -122,7 +122,7 @@ export class ManageRulesSmartComponent implements OnInit, OnDestroy {
|
|||||||
this.actionDefinitions$ = this.actionsService.actionDefinitionsListing$;
|
this.actionDefinitions$ = this.actionsService.actionDefinitionsListing$;
|
||||||
this.parameterConstraints$ = this.actionsService.parameterConstraints$;
|
this.parameterConstraints$ = this.actionsService.parameterConstraints$;
|
||||||
|
|
||||||
this.folderRulesService.deletedRuleId$.pipe(takeUntil(this.destroyed$)).subscribe((deletedRuleId) => this.onRuleDelete(deletedRuleId));
|
this.folderRulesService.deletedRuleId$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((deletedRuleId) => this.onRuleDelete(deletedRuleId));
|
||||||
|
|
||||||
this.actionsService.loadActionDefinitions();
|
this.actionsService.loadActionDefinitions();
|
||||||
|
|
||||||
@ -137,30 +137,24 @@ export class ManageRulesSmartComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this._actionDefinitionsSub = this.actionDefinitions$.subscribe((actionDefinitions: ActionDefinitionTransformed[]) =>
|
this.actionDefinitions$
|
||||||
this.actionsService.loadActionParameterConstraints(actionDefinitions)
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
);
|
.subscribe((actionDefinitions: ActionDefinitionTransformed[]) => this.actionsService.loadActionParameterConstraints(actionDefinitions));
|
||||||
|
|
||||||
this.mainRuleSet$.pipe(takeUntil(this.destroyed$)).subscribe((ruleSet) => {
|
this.mainRuleSet$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((ruleSet) => {
|
||||||
this.canEditMainRule = this.canEditRule(ruleSet);
|
this.canEditMainRule = this.canEditRule(ruleSet);
|
||||||
this.isMainRuleSetNotEmpty = !!ruleSet;
|
this.isMainRuleSetNotEmpty = !!ruleSet;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.inheritedRuleSets$.pipe(takeUntil(this.destroyed$)).subscribe((inheritedRuleSet) => {
|
this.inheritedRuleSets$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((inheritedRuleSet) => {
|
||||||
this.isInheritedRuleSetsNotEmpty = inheritedRuleSet.some((ruleSet) => ruleSet.rules.some((rule: Rule) => rule.isEnabled));
|
this.isInheritedRuleSetsNotEmpty = inheritedRuleSet.some((ruleSet) => ruleSet.rules.some((rule: Rule) => rule.isEnabled));
|
||||||
});
|
});
|
||||||
|
|
||||||
this.selectedRuleSet$.pipe(takeUntil(this.destroyed$)).subscribe((ruleSet) => {
|
this.selectedRuleSet$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((ruleSet) => {
|
||||||
this.canEditSelectedRule = this.canEditRule(ruleSet);
|
this.canEditSelectedRule = this.canEditRule(ruleSet);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.destroyed$.next();
|
|
||||||
this.destroyed$.complete();
|
|
||||||
this._actionDefinitionsSub.unsubscribe();
|
|
||||||
}
|
|
||||||
|
|
||||||
goBack(): void {
|
goBack(): void {
|
||||||
this.location.back();
|
this.location.back();
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, forwardRef, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
import { Component, DestroyRef, forwardRef, inject, Input, OnChanges, OnInit, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
||||||
import { ControlValueAccessor, FormControl, FormGroup, NG_VALUE_ACCESSOR, ReactiveFormsModule, Validators } from '@angular/forms';
|
import { ControlValueAccessor, FormControl, FormGroup, NG_VALUE_ACCESSOR, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||||
import { ActionDefinitionTransformed, RuleAction } from '../../model/rule-action.model';
|
import { ActionDefinitionTransformed, RuleAction } from '../../model/rule-action.model';
|
||||||
import {
|
import {
|
||||||
@ -37,23 +37,24 @@ import {
|
|||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { ActionParameterDefinition, Category, Node, SecurityMark } from '@alfresco/js-api';
|
import { ActionParameterDefinition, Category, Node, SecurityMark } from '@alfresco/js-api';
|
||||||
import { from, of, Subject } from 'rxjs';
|
import { from, of, Subject } from 'rxjs';
|
||||||
import { map, takeUntil } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { ActionParameterConstraint, ConstraintValue } from '../../model/action-parameter-constraint.model';
|
import { ActionParameterConstraint, ConstraintValue } from '../../model/action-parameter-constraint.model';
|
||||||
import {
|
import {
|
||||||
|
CategorySelectorDialogComponent,
|
||||||
|
CategorySelectorDialogOptions,
|
||||||
CategoryService,
|
CategoryService,
|
||||||
ContentNodeSelectorComponent,
|
ContentNodeSelectorComponent,
|
||||||
ContentNodeSelectorComponentData,
|
ContentNodeSelectorComponentData,
|
||||||
NodeAction,
|
NodeAction,
|
||||||
TagService,
|
SecurityControlsService,
|
||||||
CategorySelectorDialogComponent,
|
TagService
|
||||||
CategorySelectorDialogOptions,
|
|
||||||
SecurityControlsService
|
|
||||||
} from '@alfresco/adf-content-services';
|
} from '@alfresco/adf-content-services';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
import { MatSelectModule } from '@angular/material/select';
|
import { MatSelectModule } from '@angular/material/select';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -72,7 +73,7 @@ import { MatSelectModule } from '@angular/material/select';
|
|||||||
CardViewUpdateService
|
CardViewUpdateService
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class RuleActionUiComponent implements ControlValueAccessor, OnInit, OnChanges, OnDestroy {
|
export class RuleActionUiComponent implements ControlValueAccessor, OnInit, OnChanges {
|
||||||
@Input()
|
@Input()
|
||||||
nodeId = '';
|
nodeId = '';
|
||||||
|
|
||||||
@ -107,7 +108,6 @@ export class RuleActionUiComponent implements ControlValueAccessor, OnInit, OnCh
|
|||||||
|
|
||||||
cardViewItems: CardViewItem[] = [];
|
cardViewItems: CardViewItem[] = [];
|
||||||
parameters: { [key: string]: unknown } = {};
|
parameters: { [key: string]: unknown } = {};
|
||||||
private onDestroy$ = new Subject<void>();
|
|
||||||
|
|
||||||
get selectedActionDefinitionId(): string {
|
get selectedActionDefinitionId(): string {
|
||||||
return this.form.get('actionDefinitionId').value;
|
return this.form.get('actionDefinitionId').value;
|
||||||
@ -120,6 +120,8 @@ export class RuleActionUiComponent implements ControlValueAccessor, OnInit, OnCh
|
|||||||
onChange: (action: RuleAction) => void = () => undefined;
|
onChange: (action: RuleAction) => void = () => undefined;
|
||||||
onTouch: () => void = () => undefined;
|
onTouch: () => void = () => undefined;
|
||||||
|
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private cardViewUpdateService: CardViewUpdateService,
|
private cardViewUpdateService: CardViewUpdateService,
|
||||||
private dialog: MatDialog,
|
private dialog: MatDialog,
|
||||||
@ -156,7 +158,7 @@ export class RuleActionUiComponent implements ControlValueAccessor, OnInit, OnCh
|
|||||||
firstActionDefinition.title.localeCompare(secondActionDefinition.title)
|
firstActionDefinition.title.localeCompare(secondActionDefinition.title)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.form.valueChanges.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
|
this.form.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
||||||
this.setDefaultParameters();
|
this.setDefaultParameters();
|
||||||
this.setCardViewProperties();
|
this.setCardViewProperties();
|
||||||
this.onChange({
|
this.onChange({
|
||||||
@ -166,7 +168,7 @@ export class RuleActionUiComponent implements ControlValueAccessor, OnInit, OnCh
|
|||||||
this.onTouch();
|
this.onTouch();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.cardViewUpdateService.itemUpdated$.pipe(takeUntil(this.onDestroy$)).subscribe((updateNotification: UpdateNotification) => {
|
this.cardViewUpdateService.itemUpdated$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((updateNotification: UpdateNotification) => {
|
||||||
const isSecurityGroupUpdated = updateNotification.target.key === 'securityGroupId';
|
const isSecurityGroupUpdated = updateNotification.target.key === 'securityGroupId';
|
||||||
if (isSecurityGroupUpdated) {
|
if (isSecurityGroupUpdated) {
|
||||||
this.parameters.securityMarkId = null;
|
this.parameters.securityMarkId = null;
|
||||||
@ -202,11 +204,6 @@ export class RuleActionUiComponent implements ControlValueAccessor, OnInit, OnCh
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$.next();
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
setCardViewProperties(securityMarkOptions?: CardViewSelectItemOption<string>[]) {
|
setCardViewProperties(securityMarkOptions?: CardViewSelectItemOption<string>[]) {
|
||||||
const disabledTags = !this.tagService.areTagsEnabled();
|
const disabledTags = !this.tagService.areTagsEnabled();
|
||||||
const disabledCategories = !this.categoryService.areCategoriesEnabled();
|
const disabledCategories = !this.categoryService.areCategoriesEnabled();
|
||||||
@ -338,7 +335,7 @@ export class RuleActionUiComponent implements ControlValueAccessor, OnInit, OnCh
|
|||||||
width: '630px'
|
width: '630px'
|
||||||
});
|
});
|
||||||
|
|
||||||
data.select.pipe(takeUntil(this.onDestroy$)).subscribe((selections: Category[]) => {
|
data.select.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((selections: Category[]) => {
|
||||||
if (selections[0].id) {
|
if (selections[0].id) {
|
||||||
this.writeValue({
|
this.writeValue({
|
||||||
actionDefinitionId: this.selectedActionDefinitionId,
|
actionDefinitionId: this.selectedActionDefinitionId,
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, forwardRef, inject, Input, OnDestroy, OnInit, ViewEncapsulation, OnChanges, SimpleChanges } from '@angular/core';
|
import { Component, DestroyRef, forwardRef, inject, Input, OnChanges, OnInit, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
||||||
import { AbstractControl, ControlValueAccessor, FormControl, FormGroup, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
|
import { AbstractControl, ControlValueAccessor, FormControl, FormGroup, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { RuleSimpleCondition } from '../../model/rule-simple-condition.model';
|
import { RuleSimpleCondition } from '../../model/rule-simple-condition.model';
|
||||||
import { comparatorHiddenForConditionFieldType, RuleConditionField, ruleConditionFields } from './rule-condition-fields';
|
import { comparatorHiddenForConditionFieldType, RuleConditionField, ruleConditionFields } from './rule-condition-fields';
|
||||||
@ -34,12 +34,13 @@ import { MatSelectModule } from '@angular/material/select';
|
|||||||
import { MatInputModule } from '@angular/material/input';
|
import { MatInputModule } from '@angular/material/input';
|
||||||
import { CategoryService, TagService } from '@alfresco/adf-content-services';
|
import { CategoryService, TagService } from '@alfresco/adf-content-services';
|
||||||
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||||
import { debounceTime, distinctUntilChanged, first, takeUntil } from 'rxjs/operators';
|
import { debounceTime, distinctUntilChanged, first } from 'rxjs/operators';
|
||||||
import { Subject, Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import { MatOptionModule } from '@angular/material/core';
|
import { MatOptionModule } from '@angular/material/core';
|
||||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||||
import { CategoryEntry } from '@alfresco/js-api';
|
import { CategoryEntry } from '@alfresco/js-api';
|
||||||
import { AlfrescoMimeType, AppSettingsService } from '@alfresco/aca-shared';
|
import { AlfrescoMimeType, AppSettingsService } from '@alfresco/aca-shared';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
interface AutoCompleteOption {
|
interface AutoCompleteOption {
|
||||||
displayLabel: string;
|
displayLabel: string;
|
||||||
@ -75,7 +76,7 @@ const AUTOCOMPLETE_OPTIONS_DEBOUNCE_TIME = 500;
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class RuleSimpleConditionUiComponent implements OnInit, ControlValueAccessor, OnChanges, OnDestroy {
|
export class RuleSimpleConditionUiComponent implements OnInit, ControlValueAccessor, OnChanges {
|
||||||
private appSettings = inject(AppSettingsService);
|
private appSettings = inject(AppSettingsService);
|
||||||
private categoryService = inject(CategoryService);
|
private categoryService = inject(CategoryService);
|
||||||
private tagService = inject(TagService);
|
private tagService = inject(TagService);
|
||||||
@ -92,9 +93,9 @@ export class RuleSimpleConditionUiComponent implements OnInit, ControlValueAcces
|
|||||||
|
|
||||||
@Input() readOnly = false;
|
@Input() readOnly = false;
|
||||||
|
|
||||||
private onDestroy$ = new Subject<void>();
|
|
||||||
private autoCompleteOptionsSubscription: Subscription;
|
private autoCompleteOptionsSubscription: Subscription;
|
||||||
|
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
private readonly disabledTags = !this.tagService.areTagsEnabled();
|
private readonly disabledTags = !this.tagService.areTagsEnabled();
|
||||||
private readonly disabledCategories = !this.categoryService.areCategoriesEnabled();
|
private readonly disabledCategories = !this.categoryService.areCategoriesEnabled();
|
||||||
|
|
||||||
@ -175,25 +176,20 @@ export class RuleSimpleConditionUiComponent implements OnInit, ControlValueAcces
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$.next();
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.form.valueChanges.pipe(takeUntil(this.onDestroy$)).subscribe((value: RuleSimpleCondition) => {
|
this.form.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((value: RuleSimpleCondition) => {
|
||||||
this.onChange(value);
|
this.onChange(value);
|
||||||
this.onTouch();
|
this.onTouch();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.form
|
this.form
|
||||||
.get('field')
|
.get('field')
|
||||||
.valueChanges.pipe(distinctUntilChanged(), takeUntil(this.onDestroy$))
|
.valueChanges.pipe(distinctUntilChanged(), takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((field: string) => {
|
.subscribe((field: string) => {
|
||||||
if (field === 'category') {
|
if (field === 'category') {
|
||||||
this.autoCompleteOptionsSubscription = this.form
|
this.autoCompleteOptionsSubscription = this.form
|
||||||
.get('parameter')
|
.get('parameter')
|
||||||
.valueChanges.pipe(distinctUntilChanged(), debounceTime(AUTOCOMPLETE_OPTIONS_DEBOUNCE_TIME), takeUntil(this.onDestroy$))
|
.valueChanges.pipe(distinctUntilChanged(), debounceTime(AUTOCOMPLETE_OPTIONS_DEBOUNCE_TIME), takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((categoryName) => {
|
.subscribe((categoryName) => {
|
||||||
this.getCategories(categoryName);
|
this.getCategories(categoryName);
|
||||||
});
|
});
|
||||||
|
@ -22,10 +22,9 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
import { Component, DestroyRef, EventEmitter, inject, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
||||||
import { UntypedFormGroup, UntypedFormControl, Validators, ReactiveFormsModule } from '@angular/forms';
|
import { ReactiveFormsModule, UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
|
||||||
import { Subject } from 'rxjs';
|
import { distinctUntilChanged, map } from 'rxjs/operators';
|
||||||
import { distinctUntilChanged, map, takeUntil } from 'rxjs/operators';
|
|
||||||
import { Rule, RuleForForm } from '../model/rule.model';
|
import { Rule, RuleForForm } from '../model/rule.model';
|
||||||
import { ruleCompositeConditionValidator } from './validators/rule-composite-condition.validator';
|
import { ruleCompositeConditionValidator } from './validators/rule-composite-condition.validator';
|
||||||
import { FolderRulesService } from '../services/folder-rules.service';
|
import { FolderRulesService } from '../services/folder-rules.service';
|
||||||
@ -41,6 +40,7 @@ import { RuleCompositeConditionUiComponent } from './conditions/rule-composite-c
|
|||||||
import { RuleActionListUiComponent } from './actions/rule-action-list.ui-component';
|
import { RuleActionListUiComponent } from './actions/rule-action-list.ui-component';
|
||||||
import { RuleOptionsUiComponent } from './options/rule-options.ui-component';
|
import { RuleOptionsUiComponent } from './options/rule-options.ui-component';
|
||||||
import { CategoryService } from '@alfresco/adf-content-services';
|
import { CategoryService } from '@alfresco/adf-content-services';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -61,7 +61,7 @@ import { CategoryService } from '@alfresco/adf-content-services';
|
|||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
host: { class: 'aca-rule-details' }
|
host: { class: 'aca-rule-details' }
|
||||||
})
|
})
|
||||||
export class RuleDetailsUiComponent implements OnInit, OnDestroy {
|
export class RuleDetailsUiComponent implements OnInit {
|
||||||
@Input()
|
@Input()
|
||||||
readOnly: boolean;
|
readOnly: boolean;
|
||||||
|
|
||||||
@ -115,7 +115,6 @@ export class RuleDetailsUiComponent implements OnInit, OnDestroy {
|
|||||||
@Output()
|
@Output()
|
||||||
formValueChanged = new EventEmitter<Partial<Rule>>();
|
formValueChanged = new EventEmitter<Partial<Rule>>();
|
||||||
|
|
||||||
private onDestroy$ = new Subject<void>();
|
|
||||||
form: UntypedFormGroup;
|
form: UntypedFormGroup;
|
||||||
|
|
||||||
errorScriptConstraint: ActionParameterConstraint;
|
errorScriptConstraint: ActionParameterConstraint;
|
||||||
@ -137,6 +136,8 @@ export class RuleDetailsUiComponent implements OnInit, OnDestroy {
|
|||||||
return !this.readOnly || this.value.isAsynchronous || this.value.isInheritable;
|
return !this.readOnly || this.value.isAsynchronous || this.value.isInheritable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(private categoryService: CategoryService) {}
|
constructor(private categoryService: CategoryService) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -169,14 +170,14 @@ export class RuleDetailsUiComponent implements OnInit, OnDestroy {
|
|||||||
.pipe(
|
.pipe(
|
||||||
map(() => this.form.valid),
|
map(() => this.form.valid),
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
takeUntil(this.onDestroy$)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
)
|
)
|
||||||
.subscribe((value: boolean) => {
|
.subscribe((value: boolean) => {
|
||||||
this.formValidationChanged.emit(value);
|
this.formValidationChanged.emit(value);
|
||||||
});
|
});
|
||||||
this.formValidationChanged.emit(this.form.valid);
|
this.formValidationChanged.emit(this.form.valid);
|
||||||
|
|
||||||
this.form.valueChanges.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
|
this.form.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
||||||
this.formValueChanged.emit(this.value);
|
this.formValueChanged.emit(this.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -194,9 +195,4 @@ export class RuleDetailsUiComponent implements OnInit, OnDestroy {
|
|||||||
(parameterConstraint: ActionParameterConstraint) => parameterConstraint.name === 'script-ref'
|
(parameterConstraint: ActionParameterConstraint) => parameterConstraint.name === 'script-ref'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$.next();
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
import { Component, DestroyRef, EventEmitter, inject, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
||||||
import { RuleSet } from '../../model/rule-set.model';
|
import { RuleSet } from '../../model/rule-set.model';
|
||||||
import { Rule } from '../../model/rule.model';
|
import { Rule } from '../../model/rule.model';
|
||||||
import { RuleGroupingItem } from '../../model/rule-grouping-item.model';
|
import { RuleGroupingItem } from '../../model/rule-grouping-item.model';
|
||||||
@ -35,7 +35,8 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
|||||||
import { RuleListGroupingUiComponent } from '../rule-list-grouping/rule-list-grouping.ui-component';
|
import { RuleListGroupingUiComponent } from '../rule-list-grouping/rule-list-grouping.ui-component';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { Observable, Subscription } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -55,7 +56,7 @@ import { Observable, Subscription } from 'rxjs';
|
|||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
host: { class: 'aca-rule-list' }
|
host: { class: 'aca-rule-list' }
|
||||||
})
|
})
|
||||||
export class RuleListUiComponent implements OnInit, OnDestroy {
|
export class RuleListUiComponent implements OnInit {
|
||||||
@Input()
|
@Input()
|
||||||
mainRuleSet$: Observable<RuleSet>;
|
mainRuleSet$: Observable<RuleSet>;
|
||||||
@Input()
|
@Input()
|
||||||
@ -90,10 +91,10 @@ export class RuleListUiComponent implements OnInit, OnDestroy {
|
|||||||
isMainRuleSetOwned = false;
|
isMainRuleSetOwned = false;
|
||||||
isMainRuleSetLinked = false;
|
isMainRuleSetLinked = false;
|
||||||
|
|
||||||
private _mainRuleSetSub: Subscription;
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this._mainRuleSetSub = this.mainRuleSet$.subscribe((ruleSet: RuleSet) => {
|
this.mainRuleSet$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((ruleSet: RuleSet) => {
|
||||||
if (ruleSet) {
|
if (ruleSet) {
|
||||||
this.mainRuleSet = ruleSet;
|
this.mainRuleSet = ruleSet;
|
||||||
this.isMainRuleSetOwned = FolderRuleSetsService.isOwnedRuleSet(ruleSet, this.folderId);
|
this.isMainRuleSetOwned = FolderRuleSetsService.isOwnedRuleSet(ruleSet, this.folderId);
|
||||||
@ -114,10 +115,6 @@ export class RuleListUiComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this._mainRuleSetSub.unsubscribe();
|
|
||||||
}
|
|
||||||
|
|
||||||
getRuleSetGroupingItems(ruleSet: RuleSet, filterOutDisabledRules: boolean): RuleGroupingItem[] {
|
getRuleSetGroupingItems(ruleSet: RuleSet, filterOutDisabledRules: boolean): RuleGroupingItem[] {
|
||||||
const items: RuleGroupingItem[] = ruleSet.rules
|
const items: RuleGroupingItem[] = ruleSet.rules
|
||||||
.filter((rule: Rule) => rule.isEnabled || !filterOutDisabledRules)
|
.filter((rule: Rule) => rule.isEnabled || !filterOutDisabledRules)
|
||||||
|
@ -22,13 +22,13 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Inject, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, DestroyRef, inject, Inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
||||||
import { FolderRuleSetsService } from '../services/folder-rule-sets.service';
|
import { FolderRuleSetsService } from '../services/folder-rule-sets.service';
|
||||||
import { Node } from '@alfresco/js-api';
|
import { Node } from '@alfresco/js-api';
|
||||||
import { RuleSet } from '../model/rule-set.model';
|
import { RuleSet } from '../model/rule-set.model';
|
||||||
import { BehaviorSubject, combineLatest, from, of, Subject } from 'rxjs';
|
import { BehaviorSubject, combineLatest, from, of } from 'rxjs';
|
||||||
import { finalize, map, switchMap, takeUntil } from 'rxjs/operators';
|
import { finalize, map, switchMap } from 'rxjs/operators';
|
||||||
import { NotificationService, TemplateModule } from '@alfresco/adf-core';
|
import { NotificationService, TemplateModule } from '@alfresco/adf-core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
@ -37,6 +37,7 @@ import { MatIconModule } from '@angular/material/icon';
|
|||||||
import { ContentNodeSelectorModule } from '@alfresco/adf-content-services';
|
import { ContentNodeSelectorModule } from '@alfresco/adf-content-services';
|
||||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||||
import { RuleListItemUiComponent } from '../rule-list/rule-list-item/rule-list-item.ui-component';
|
import { RuleListItemUiComponent } from '../rule-list/rule-list-item/rule-list-item.ui-component';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
export interface RuleSetPickerOptions {
|
export interface RuleSetPickerOptions {
|
||||||
nodeId: string;
|
nodeId: string;
|
||||||
@ -64,7 +65,7 @@ export interface RuleSetPickerOptions {
|
|||||||
host: { class: 'aca-rule-set-picker' },
|
host: { class: 'aca-rule-set-picker' },
|
||||||
providers: [FolderRuleSetsService]
|
providers: [FolderRuleSetsService]
|
||||||
})
|
})
|
||||||
export class RuleSetPickerSmartComponent implements OnInit, OnDestroy {
|
export class RuleSetPickerSmartComponent implements OnInit {
|
||||||
nodeId = '-root-';
|
nodeId = '-root-';
|
||||||
defaultNodeId = '-root-';
|
defaultNodeId = '-root-';
|
||||||
isBusy = false;
|
isBusy = false;
|
||||||
@ -79,7 +80,7 @@ export class RuleSetPickerSmartComponent implements OnInit, OnDestroy {
|
|||||||
map(([rulesLoading, folderLoading]) => rulesLoading || folderLoading)
|
map(([rulesLoading, folderLoading]) => rulesLoading || folderLoading)
|
||||||
);
|
);
|
||||||
|
|
||||||
onDestroy$ = new Subject<void>();
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(MAT_DIALOG_DATA) public data: RuleSetPickerOptions,
|
@Inject(MAT_DIALOG_DATA) public data: RuleSetPickerOptions,
|
||||||
@ -93,16 +94,11 @@ export class RuleSetPickerSmartComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.mainRuleSet$.pipe(takeUntil(this.onDestroy$)).subscribe((mainRuleSet) => {
|
this.mainRuleSet$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((mainRuleSet) => {
|
||||||
this.hasOwnedRules = mainRuleSet?.rules.length > 0 && FolderRuleSetsService.isOwnedRuleSet(mainRuleSet, this.selectedNodeId);
|
this.hasOwnedRules = mainRuleSet?.rules.length > 0 && FolderRuleSetsService.isOwnedRuleSet(mainRuleSet, this.selectedNodeId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
|
||||||
this.onDestroy$.next();
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
onNodeSelect(nodes: Node[]) {
|
onNodeSelect(nodes: Node[]) {
|
||||||
if (nodes?.length && nodes[0].isFolder && nodes[0].id !== this.selectedNodeId) {
|
if (nodes?.length && nodes[0].isFolder && nodes[0].id !== this.selectedNodeId) {
|
||||||
this.selectedNodeId = nodes[0].id;
|
this.selectedNodeId = nodes[0].id;
|
||||||
|
@ -25,15 +25,16 @@
|
|||||||
import { ContentActionRef } from '@alfresco/adf-extensions';
|
import { ContentActionRef } from '@alfresco/adf-extensions';
|
||||||
import { AppStore, getSearchItemsTotalCount } from '@alfresco/aca-shared/store';
|
import { AppStore, getSearchItemsTotalCount } from '@alfresco/aca-shared/store';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { Component, inject, Input, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, DestroyRef, inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { MatSelectModule } from '@angular/material/select';
|
import { MatSelectModule } from '@angular/material/select';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { combineLatest, Observable, Subject } from 'rxjs';
|
import { combineLatest, Observable } from 'rxjs';
|
||||||
import { IconComponent, TranslationService } from '@alfresco/adf-core';
|
import { IconComponent, TranslationService } from '@alfresco/adf-core';
|
||||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { switchMap, takeUntil } from 'rxjs/operators';
|
import { switchMap } from 'rxjs/operators';
|
||||||
import { AppExtensionService } from '@alfresco/aca-shared';
|
import { AppExtensionService } from '@alfresco/aca-shared';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -43,7 +44,7 @@ import { AppExtensionService } from '@alfresco/aca-shared';
|
|||||||
imports: [CommonModule, TranslateModule, MatSelectModule, IconComponent, ReactiveFormsModule],
|
imports: [CommonModule, TranslateModule, MatSelectModule, IconComponent, ReactiveFormsModule],
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class BulkActionsDropdownComponent implements OnInit, OnDestroy {
|
export class BulkActionsDropdownComponent implements OnInit {
|
||||||
@Input() items: ContentActionRef[];
|
@Input() items: ContentActionRef[];
|
||||||
|
|
||||||
placeholder: string;
|
placeholder: string;
|
||||||
@ -53,9 +54,9 @@ export class BulkActionsDropdownComponent implements OnInit, OnDestroy {
|
|||||||
private readonly store = inject<Store<AppStore>>(Store);
|
private readonly store = inject<Store<AppStore>>(Store);
|
||||||
private readonly translationService = inject(TranslationService);
|
private readonly translationService = inject(TranslationService);
|
||||||
private readonly extensions = inject(AppExtensionService);
|
private readonly extensions = inject(AppExtensionService);
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
private readonly onDestroy$ = new Subject();
|
|
||||||
private readonly totalItems$: Observable<number> = this.store.select(getSearchItemsTotalCount);
|
private readonly totalItems$: Observable<number> = this.store.select(getSearchItemsTotalCount);
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.totalItems$
|
this.totalItems$
|
||||||
.pipe(
|
.pipe(
|
||||||
@ -76,23 +77,18 @@ export class BulkActionsDropdownComponent implements OnInit, OnDestroy {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
takeUntil(this.onDestroy$)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
)
|
)
|
||||||
.subscribe(([placeholder, title]) => {
|
.subscribe(([placeholder, title]) => {
|
||||||
this.tooltip = title;
|
this.tooltip = title;
|
||||||
this.placeholder = placeholder;
|
this.placeholder = placeholder;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.extensions.bulkActionExecuted$.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
|
this.extensions.bulkActionExecuted$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
||||||
this.bulkSelectControl.setValue(null);
|
this.bulkSelectControl.setValue(null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
runAction(actionOption: ContentActionRef) {
|
runAction(actionOption: ContentActionRef) {
|
||||||
this.extensions.runActionById(actionOption.actions.click, {
|
this.extensions.runActionById(actionOption.actions.click, {
|
||||||
focusedElementOnCloseSelector: '.adf-context-menu-source'
|
focusedElementOnCloseSelector: '.adf-context-menu-source'
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
import { ToggleSharedComponent } from './toggle-shared.component';
|
import { ToggleSharedComponent } from './toggle-shared.component';
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
describe('ToggleSharedComponent', () => {
|
describe('ToggleSharedComponent', () => {
|
||||||
let component;
|
let component;
|
||||||
@ -41,8 +42,10 @@ describe('ToggleSharedComponent', () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TestBed.runInInjectionContext(() => {
|
||||||
component = new ToggleSharedComponent(storeMock);
|
component = new ToggleSharedComponent(storeMock);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should get Store selection entry on initialization', (done) => {
|
it('should get Store selection entry on initialization', (done) => {
|
||||||
component.ngOnInit();
|
component.ngOnInit();
|
||||||
|
@ -22,17 +22,17 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, DestroyRef, inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { Observable, Subject } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { SelectionState } from '@alfresco/adf-extensions';
|
import { SelectionState } from '@alfresco/adf-extensions';
|
||||||
import { AppStore, ShareNodeAction, getAppSelection } from '@alfresco/aca-shared/store';
|
import { AppStore, getAppSelection, ShareNodeAction } from '@alfresco/aca-shared/store';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { MatMenuModule } from '@angular/material/menu';
|
import { MatMenuModule } from '@angular/material/menu';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -41,7 +41,7 @@ import { takeUntil } from 'rxjs/operators';
|
|||||||
templateUrl: './toggle-shared.component.html',
|
templateUrl: './toggle-shared.component.html',
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class ToggleSharedComponent implements OnInit, OnDestroy {
|
export class ToggleSharedComponent implements OnInit {
|
||||||
@Input()
|
@Input()
|
||||||
data: {
|
data: {
|
||||||
iconButton?: string;
|
iconButton?: string;
|
||||||
@ -52,13 +52,13 @@ export class ToggleSharedComponent implements OnInit, OnDestroy {
|
|||||||
selectionLabel = '';
|
selectionLabel = '';
|
||||||
isShared = false;
|
isShared = false;
|
||||||
|
|
||||||
onDestroy$ = new Subject<void>();
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(private store: Store<AppStore>) {}
|
constructor(private store: Store<AppStore>) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.selection$ = this.store.select(getAppSelection);
|
this.selection$ = this.store.select(getAppSelection);
|
||||||
this.selection$.pipe(takeUntil(this.onDestroy$)).subscribe((selectionState) => {
|
this.selection$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((selectionState) => {
|
||||||
this.selectionState = selectionState;
|
this.selectionState = selectionState;
|
||||||
|
|
||||||
this.isShared =
|
this.isShared =
|
||||||
@ -69,10 +69,6 @@ export class ToggleSharedComponent implements OnInit, OnDestroy {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
|
||||||
this.onDestroy$.next();
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
editSharedNode(selection: SelectionState, focusedElementOnCloseSelector: string) {
|
editSharedNode(selection: SelectionState, focusedElementOnCloseSelector: string) {
|
||||||
this.store.dispatch(
|
this.store.dispatch(
|
||||||
new ShareNodeAction(selection.first, {
|
new ShareNodeAction(selection.first, {
|
||||||
|
@ -22,31 +22,28 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Directive, Output, EventEmitter, OnInit, OnDestroy } from '@angular/core';
|
import { DestroyRef, Directive, EventEmitter, inject, OnInit, Output } from '@angular/core';
|
||||||
import { fromEvent, Subscription } from 'rxjs';
|
import { fromEvent } from 'rxjs';
|
||||||
import { filter } from 'rxjs/operators';
|
import { filter } from 'rxjs/operators';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
selector: '[acaContextMenuOutsideEvent]'
|
selector: '[acaContextMenuOutsideEvent]'
|
||||||
})
|
})
|
||||||
export class OutsideEventDirective implements OnInit, OnDestroy {
|
export class OutsideEventDirective implements OnInit {
|
||||||
private subscriptions: Subscription[] = [];
|
|
||||||
|
|
||||||
@Output()
|
@Output()
|
||||||
clickOutside: EventEmitter<void> = new EventEmitter();
|
clickOutside: EventEmitter<void> = new EventEmitter();
|
||||||
|
|
||||||
ngOnInit() {
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
this.subscriptions = this.subscriptions.concat([
|
|
||||||
fromEvent(document.body, 'click')
|
|
||||||
.pipe(filter((event) => !this.findAncestor(event.target as Element)))
|
|
||||||
.subscribe(() => this.clickOutside.next())
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnInit() {
|
||||||
this.subscriptions.forEach((subscription) => subscription.unsubscribe());
|
fromEvent(document.body, 'click')
|
||||||
this.subscriptions = [];
|
.pipe(
|
||||||
|
filter((event) => !this.findAncestor(event.target as Element)),
|
||||||
|
takeUntilDestroyed(this.destroyRef)
|
||||||
|
)
|
||||||
|
.subscribe(() => this.clickOutside.next());
|
||||||
}
|
}
|
||||||
|
|
||||||
private findAncestor(el: Element): boolean {
|
private findAncestor(el: Element): boolean {
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, ViewEncapsulation, OnInit, AfterViewInit, Inject, inject, DestroyRef } from '@angular/core';
|
import { AfterViewInit, Component, DestroyRef, inject, Inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { MatMenuModule } from '@angular/material/menu';
|
import { MatMenuModule } from '@angular/material/menu';
|
||||||
import { DynamicExtensionComponent } from '@alfresco/adf-extensions';
|
import { DynamicExtensionComponent } from '@alfresco/adf-extensions';
|
||||||
import { ContextMenuOverlayRef } from './context-menu-overlay';
|
import { ContextMenuOverlayRef } from './context-menu-overlay';
|
||||||
|
@ -67,12 +67,13 @@ import { FileSizePipe, InfoDrawerButtonsDirective } from '@alfresco/adf-core';
|
|||||||
export class DetailsComponent extends PageComponent implements OnInit, OnDestroy {
|
export class DetailsComponent extends PageComponent implements OnInit, OnDestroy {
|
||||||
nodeId: string;
|
nodeId: string;
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
onDestroy$ = new Subject<void>();
|
|
||||||
activeTab = 1;
|
activeTab = 1;
|
||||||
aspectActions: Array<ContentActionRef> = [];
|
aspectActions: Array<ContentActionRef> = [];
|
||||||
nodeIcon: string;
|
nodeIcon: string;
|
||||||
canManagePermissions = true;
|
canManagePermissions = true;
|
||||||
|
|
||||||
|
private readonly onDestroy$: Subject<void> = new Subject<void>();
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private contentApi: ContentApiService, private contentService: ContentService) {
|
constructor(private route: ActivatedRoute, private contentApi: ContentApiService, private contentService: ContentService) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
@ -145,9 +146,10 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.store.dispatch(new SetSelectedNodesAction([]));
|
|
||||||
this.onDestroy$.next();
|
this.onDestroy$.next();
|
||||||
this.onDestroy$.complete();
|
this.onDestroy$.complete();
|
||||||
|
this.store.dispatch(new SetSelectedNodesAction([]));
|
||||||
|
super.ngOnDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
private isSmartFolder(): boolean {
|
private isSmartFolder(): boolean {
|
||||||
|
@ -27,10 +27,9 @@ import { IconComponent } from '@alfresco/adf-core';
|
|||||||
import { DynamicExtensionComponent } from '@alfresco/adf-extensions';
|
import { DynamicExtensionComponent } from '@alfresco/adf-extensions';
|
||||||
import { NodeEntry } from '@alfresco/js-api';
|
import { NodeEntry } from '@alfresco/js-api';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { Component, Input, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, DestroyRef, inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { Subject } from 'rxjs';
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'aca-datatable-cell-badges',
|
selector: 'aca-datatable-cell-badges',
|
||||||
@ -41,29 +40,24 @@ import { takeUntil } from 'rxjs/operators';
|
|||||||
imports: [CommonModule, TranslateModule, DynamicExtensionComponent, IconComponent],
|
imports: [CommonModule, TranslateModule, DynamicExtensionComponent, IconComponent],
|
||||||
standalone: true
|
standalone: true
|
||||||
})
|
})
|
||||||
export class DatatableCellBadgesComponent implements OnInit, OnDestroy {
|
export class DatatableCellBadgesComponent implements OnInit {
|
||||||
@Input() node: NodeEntry;
|
@Input() node: NodeEntry;
|
||||||
|
|
||||||
badges: Badge[];
|
badges: Badge[];
|
||||||
|
|
||||||
private onDestroy$ = new Subject<boolean>();
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(private appExtensionService: AppExtensionService) {}
|
constructor(private appExtensionService: AppExtensionService) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.appExtensionService
|
this.appExtensionService
|
||||||
.getBadges(this.node)
|
.getBadges(this.node)
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((badges) => {
|
.subscribe((badges) => {
|
||||||
this.badges = badges;
|
this.badges = badges;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
onBadgeClick(badge: Badge) {
|
onBadgeClick(badge: Badge) {
|
||||||
if (badge.actions?.click) {
|
if (badge.actions?.click) {
|
||||||
this.appExtensionService.runActionById(badge.actions?.click, this.node);
|
this.appExtensionService.runActionById(badge.actions?.click, this.node);
|
||||||
|
@ -23,17 +23,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { NameColumnComponent, NodeNameTooltipPipe, NodesApiService } from '@alfresco/adf-content-services';
|
import { NameColumnComponent, NodeNameTooltipPipe, NodesApiService } from '@alfresco/adf-content-services';
|
||||||
import { ChangeDetectorRef, Component, ElementRef, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
import { ChangeDetectorRef, Component, DestroyRef, ElementRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { Actions, ofType } from '@ngrx/effects';
|
import { Actions, ofType } from '@ngrx/effects';
|
||||||
import { Subject } from 'rxjs';
|
import { filter } from 'rxjs/operators';
|
||||||
import { filter, takeUntil } from 'rxjs/operators';
|
|
||||||
import { NodeActionTypes } from '@alfresco/aca-shared/store';
|
import { NodeActionTypes } from '@alfresco/aca-shared/store';
|
||||||
import { LockedByComponent, isLocked } from '@alfresco/aca-shared';
|
import { isLocked, LockedByComponent } from '@alfresco/aca-shared';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { IconComponent } from '@alfresco/adf-core';
|
import { IconComponent } from '@alfresco/adf-core';
|
||||||
import { DynamicExtensionComponent } from '@alfresco/adf-extensions';
|
import { DynamicExtensionComponent } from '@alfresco/adf-extensions';
|
||||||
import { DatatableCellBadgesComponent } from '../datatable-cell-badges/datatable-cell-badges.component';
|
import { DatatableCellBadgesComponent } from '../datatable-cell-badges/datatable-cell-badges.component';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -54,12 +54,12 @@ import { DatatableCellBadgesComponent } from '../datatable-cell-badges/datatable
|
|||||||
class: 'adf-datatable-content-cell adf-datatable-link adf-name-column aca-custom-name-column'
|
class: 'adf-datatable-content-cell adf-datatable-link adf-name-column aca-custom-name-column'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
export class CustomNameColumnComponent extends NameColumnComponent implements OnInit, OnDestroy {
|
export class CustomNameColumnComponent extends NameColumnComponent implements OnInit {
|
||||||
private onDestroy$$ = new Subject<boolean>();
|
|
||||||
|
|
||||||
isFile: boolean;
|
isFile: boolean;
|
||||||
isFileWriteLocked: boolean;
|
isFileWriteLocked: boolean;
|
||||||
|
|
||||||
|
private readonly destroy = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(element: ElementRef, private cd: ChangeDetectorRef, private actions$: Actions, private nodesService: NodesApiService) {
|
constructor(element: ElementRef, private cd: ChangeDetectorRef, private actions$: Actions, private nodesService: NodesApiService) {
|
||||||
super(element, nodesService);
|
super(element, nodesService);
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ export class CustomNameColumnComponent extends NameColumnComponent implements On
|
|||||||
this.isFile = this.node?.entry && !this.node.entry.isFolder;
|
this.isFile = this.node?.entry && !this.node.entry.isFolder;
|
||||||
this.isFileWriteLocked = isLocked(this.node);
|
this.isFileWriteLocked = isLocked(this.node);
|
||||||
|
|
||||||
this.nodesService.nodeUpdated.pipe(takeUntil(this.onDestroy$$)).subscribe((node: any) => {
|
this.nodesService.nodeUpdated.pipe(takeUntilDestroyed(this.destroy)).subscribe((node: any) => {
|
||||||
const row = this.context.row;
|
const row = this.context.row;
|
||||||
if (row) {
|
if (row) {
|
||||||
const { entry } = row.node;
|
const { entry } = row.node;
|
||||||
@ -91,7 +91,7 @@ export class CustomNameColumnComponent extends NameColumnComponent implements On
|
|||||||
.pipe(
|
.pipe(
|
||||||
ofType<any>(NodeActionTypes.EditOffline),
|
ofType<any>(NodeActionTypes.EditOffline),
|
||||||
filter((val) => this.node.entry.id === val.payload.entry.id),
|
filter((val) => this.node.entry.id === val.payload.entry.id),
|
||||||
takeUntil(this.onDestroy$$)
|
takeUntilDestroyed(this.destroy)
|
||||||
)
|
)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.isFileWriteLocked = isLocked(this.node);
|
this.isFileWriteLocked = isLocked(this.node);
|
||||||
@ -103,9 +103,4 @@ export class CustomNameColumnComponent extends NameColumnComponent implements On
|
|||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
this.onClick();
|
this.onClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$$.next(true);
|
|
||||||
this.onDestroy$$.complete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ import {
|
|||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { ActivatedRoute, Params } from '@angular/router';
|
import { ActivatedRoute, Params } from '@angular/router';
|
||||||
import { NodeEntry, Node, PathElement } from '@alfresco/js-api';
|
import { Node, NodeEntry, PathElement } from '@alfresco/js-api';
|
||||||
import { NodeActionsService } from '../../services/node-actions.service';
|
import { NodeActionsService } from '../../services/node-actions.service';
|
||||||
import {
|
import {
|
||||||
ContentApiService,
|
ContentApiService,
|
||||||
@ -43,8 +43,8 @@ import {
|
|||||||
PaginationDirective,
|
PaginationDirective,
|
||||||
ToolbarComponent
|
ToolbarComponent
|
||||||
} from '@alfresco/aca-shared';
|
} from '@alfresco/aca-shared';
|
||||||
import { SetCurrentFolderAction, isAdmin, UploadFileVersionAction, showLoaderSelector } from '@alfresco/aca-shared/store';
|
import { isAdmin, SetCurrentFolderAction, showLoaderSelector, UploadFileVersionAction } from '@alfresco/aca-shared/store';
|
||||||
import { debounceTime, takeUntil } from 'rxjs/operators';
|
import { debounceTime } from 'rxjs/operators';
|
||||||
import {
|
import {
|
||||||
BreadcrumbComponent,
|
BreadcrumbComponent,
|
||||||
DocumentListComponent,
|
DocumentListComponent,
|
||||||
@ -59,6 +59,7 @@ import { TranslateModule } from '@ngx-translate/core';
|
|||||||
import { DocumentListDirective } from '../../directives/document-list.directive';
|
import { DocumentListDirective } from '../../directives/document-list.directive';
|
||||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||||
import { SearchAiInputContainerComponent } from '../knowledge-retrieval/search-ai/search-ai-input-container/search-ai-input-container.component';
|
import { SearchAiInputContainerComponent } from '../knowledge-retrieval/search-ai/search-ai-input-container/search-ai-input-container.component';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -109,15 +110,15 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this.title = data.title;
|
this.title = data.title;
|
||||||
|
|
||||||
this.route.queryParamMap.pipe(takeUntil(this.onDestroy$)).subscribe((queryMap: Params) => {
|
this.route.queryParamMap.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((queryMap: Params) => {
|
||||||
this.queryParams = queryMap.params;
|
this.queryParams = queryMap.params;
|
||||||
});
|
});
|
||||||
this.route.params.pipe(takeUntil(this.onDestroy$)).subscribe(({ folderId }: Params) => {
|
this.route.params.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(({ folderId }: Params) => {
|
||||||
const nodeId = folderId || data.defaultNodeId;
|
const nodeId = folderId || data.defaultNodeId;
|
||||||
|
|
||||||
this.contentApi
|
this.contentApi
|
||||||
.getNode(nodeId)
|
.getNode(nodeId)
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(node) => {
|
(node) => {
|
||||||
this.isValidPath = true;
|
this.isValidPath = true;
|
||||||
@ -142,12 +143,12 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this.store
|
this.store
|
||||||
.select(isAdmin)
|
.select(isAdmin)
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((value) => {
|
.subscribe((value) => {
|
||||||
this.isAdmin = value;
|
this.isAdmin = value;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.extensions.filesDocumentListPreset$.pipe(takeUntil(this.onDestroy$)).subscribe((preset) => {
|
this.extensions.filesDocumentListPreset$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((preset) => {
|
||||||
this.columns = preset;
|
this.columns = preset;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -22,32 +22,32 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, OnChanges, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, DestroyRef, inject, Input, OnChanges, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
UntypedFormGroup,
|
|
||||||
UntypedFormControl,
|
|
||||||
Validators,
|
|
||||||
FormGroupDirective,
|
|
||||||
NgForm,
|
|
||||||
FormsModule,
|
|
||||||
ReactiveFormsModule,
|
|
||||||
FormControl,
|
FormControl,
|
||||||
ValidationErrors
|
FormGroupDirective,
|
||||||
|
FormsModule,
|
||||||
|
NgForm,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
UntypedFormControl,
|
||||||
|
UntypedFormGroup,
|
||||||
|
ValidationErrors,
|
||||||
|
Validators
|
||||||
} from '@angular/forms';
|
} from '@angular/forms';
|
||||||
import { QueriesApi, SiteEntry, SitePaging } from '@alfresco/js-api';
|
import { QueriesApi, SiteEntry, SitePaging } from '@alfresco/js-api';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import {
|
import {
|
||||||
AppStore,
|
AppStore,
|
||||||
|
isAdmin,
|
||||||
SnackbarAction,
|
SnackbarAction,
|
||||||
SnackbarActionTypes,
|
SnackbarActionTypes,
|
||||||
SnackbarErrorAction,
|
SnackbarErrorAction,
|
||||||
SnackbarInfoAction,
|
SnackbarInfoAction,
|
||||||
UpdateLibraryAction,
|
UpdateLibraryAction
|
||||||
isAdmin
|
|
||||||
} from '@alfresco/aca-shared/store';
|
} from '@alfresco/aca-shared/store';
|
||||||
import { debounceTime, filter, mergeMap, takeUntil } from 'rxjs/operators';
|
import { debounceTime, filter, mergeMap } from 'rxjs/operators';
|
||||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||||
import { Observable, from, Subject } from 'rxjs';
|
import { from, Observable } from 'rxjs';
|
||||||
import { ErrorStateMatcher, MatOptionModule } from '@angular/material/core';
|
import { ErrorStateMatcher, MatOptionModule } from '@angular/material/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { MatCardModule } from '@angular/material/card';
|
import { MatCardModule } from '@angular/material/card';
|
||||||
@ -58,6 +58,7 @@ import { MatInputModule } from '@angular/material/input';
|
|||||||
import { A11yModule } from '@angular/cdk/a11y';
|
import { A11yModule } from '@angular/cdk/a11y';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { Actions, ofType } from '@ngrx/effects';
|
import { Actions, ofType } from '@ngrx/effects';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
export class InstantErrorStateMatcher implements ErrorStateMatcher {
|
export class InstantErrorStateMatcher implements ErrorStateMatcher {
|
||||||
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
|
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean {
|
||||||
@ -86,7 +87,7 @@ export class InstantErrorStateMatcher implements ErrorStateMatcher {
|
|||||||
styleUrls: ['./library-metadata-form.component.scss'],
|
styleUrls: ['./library-metadata-form.component.scss'],
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class LibraryMetadataFormComponent implements OnInit, OnChanges, OnDestroy {
|
export class LibraryMetadataFormComponent implements OnInit, OnChanges {
|
||||||
private _queriesApi: QueriesApi;
|
private _queriesApi: QueriesApi;
|
||||||
private _titleErrorTranslationKey: string;
|
private _titleErrorTranslationKey: string;
|
||||||
|
|
||||||
@ -121,7 +122,7 @@ export class LibraryMetadataFormComponent implements OnInit, OnChanges, OnDestro
|
|||||||
canUpdateLibrary = false;
|
canUpdateLibrary = false;
|
||||||
isAdmin = false;
|
isAdmin = false;
|
||||||
|
|
||||||
onDestroy$: Subject<boolean> = new Subject<boolean>();
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(private alfrescoApiService: AlfrescoApiService, protected store: Store<AppStore>, private actions$: Actions) {}
|
constructor(private alfrescoApiService: AlfrescoApiService, protected store: Store<AppStore>, private actions$: Actions) {}
|
||||||
|
|
||||||
@ -148,7 +149,7 @@ export class LibraryMetadataFormComponent implements OnInit, OnChanges, OnDestro
|
|||||||
this.toggleEdit();
|
this.toggleEdit();
|
||||||
this.updateForm(this.node);
|
this.updateForm(this.node);
|
||||||
this.form.controls.title.statusChanges
|
this.form.controls.title.statusChanges
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
() =>
|
() =>
|
||||||
(this._titleErrorTranslationKey = this.form.controls.title.errors?.empty
|
(this._titleErrorTranslationKey = this.form.controls.title.errors?.empty
|
||||||
@ -159,7 +160,7 @@ export class LibraryMetadataFormComponent implements OnInit, OnChanges, OnDestro
|
|||||||
.pipe(
|
.pipe(
|
||||||
debounceTime(300),
|
debounceTime(300),
|
||||||
mergeMap((title) => this.findLibraryByTitle(title)),
|
mergeMap((title) => this.findLibraryByTitle(title)),
|
||||||
takeUntil(this.onDestroy$)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
)
|
)
|
||||||
.subscribe((result) => {
|
.subscribe((result) => {
|
||||||
const { entries } = result.list;
|
const { entries } = result.list;
|
||||||
@ -176,7 +177,7 @@ export class LibraryMetadataFormComponent implements OnInit, OnChanges, OnDestro
|
|||||||
});
|
});
|
||||||
this.store
|
this.store
|
||||||
.select(isAdmin)
|
.select(isAdmin)
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((value) => {
|
.subscribe((value) => {
|
||||||
this.isAdmin = value;
|
this.isAdmin = value;
|
||||||
});
|
});
|
||||||
@ -187,11 +188,6 @@ export class LibraryMetadataFormComponent implements OnInit, OnChanges, OnDestro
|
|||||||
this.handleUpdatingEvent<SnackbarErrorAction>(SnackbarActionTypes.Error, 'LIBRARY.ERRORS.LIBRARY_UPDATE_ERROR', () => this.form.markAsDirty());
|
this.handleUpdatingEvent<SnackbarErrorAction>(SnackbarActionTypes.Error, 'LIBRARY.ERRORS.LIBRARY_UPDATE_ERROR', () => this.form.markAsDirty());
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnChanges() {
|
ngOnChanges() {
|
||||||
this.updateForm(this.node);
|
this.updateForm(this.node);
|
||||||
this.canUpdateLibrary = this.node?.entry?.role === 'SiteManager' || this.isAdmin;
|
this.canUpdateLibrary = this.node?.entry?.role === 'SiteManager' || this.isAdmin;
|
||||||
@ -236,7 +232,7 @@ export class LibraryMetadataFormComponent implements OnInit, OnChanges, OnDestro
|
|||||||
.pipe(
|
.pipe(
|
||||||
ofType<T>(actionType),
|
ofType<T>(actionType),
|
||||||
filter((action) => action.payload === payload),
|
filter((action) => action.payload === payload),
|
||||||
takeUntil(this.onDestroy$)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
)
|
)
|
||||||
.subscribe(handle);
|
.subscribe(handle);
|
||||||
}
|
}
|
||||||
|
@ -22,23 +22,24 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, ViewEncapsulation, OnInit, OnDestroy } from '@angular/core';
|
import { Component, DestroyRef, inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { Node } from '@alfresco/js-api';
|
import { Node } from '@alfresco/js-api';
|
||||||
import { NodePermissionService, isLocked, AppExtensionService } from '@alfresco/aca-shared';
|
import { AppExtensionService, isLocked, NodePermissionService } from '@alfresco/aca-shared';
|
||||||
import { AppStore, EditOfflineAction, NodeActionTypes, infoDrawerMetadataAspect } from '@alfresco/aca-shared/store';
|
import { AppStore, EditOfflineAction, infoDrawerMetadataAspect, NodeActionTypes } from '@alfresco/aca-shared/store';
|
||||||
import { AppConfigService, NotificationService } from '@alfresco/adf-core';
|
import { AppConfigService, NotificationService } from '@alfresco/adf-core';
|
||||||
import { Observable, Subject } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import {
|
import {
|
||||||
ContentMetadataService,
|
|
||||||
ContentMetadataCustomPanel,
|
|
||||||
TagService,
|
|
||||||
CategoryService,
|
CategoryService,
|
||||||
ContentMetadataComponent
|
ContentMetadataComponent,
|
||||||
|
ContentMetadataCustomPanel,
|
||||||
|
ContentMetadataService,
|
||||||
|
TagService
|
||||||
} from '@alfresco/adf-content-services';
|
} from '@alfresco/adf-content-services';
|
||||||
import { filter, map, takeUntil } from 'rxjs/operators';
|
import { filter, map } from 'rxjs/operators';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { Actions, ofType } from '@ngrx/effects';
|
import { Actions, ofType } from '@ngrx/effects';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -58,8 +59,7 @@ import { Store } from '@ngrx/store';
|
|||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
host: { class: 'app-metadata-tab' }
|
host: { class: 'app-metadata-tab' }
|
||||||
})
|
})
|
||||||
export class MetadataTabComponent implements OnInit, OnDestroy {
|
export class MetadataTabComponent implements OnInit {
|
||||||
protected onDestroy$ = new Subject<boolean>();
|
|
||||||
private _displayCategories = true;
|
private _displayCategories = true;
|
||||||
private _displayTags = true;
|
private _displayTags = true;
|
||||||
|
|
||||||
@ -77,6 +77,8 @@ export class MetadataTabComponent implements OnInit, OnDestroy {
|
|||||||
return this._displayTags;
|
return this._displayTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private permission: NodePermissionService,
|
private permission: NodePermissionService,
|
||||||
protected extensions: AppExtensionService,
|
protected extensions: AppExtensionService,
|
||||||
@ -97,7 +99,7 @@ export class MetadataTabComponent implements OnInit, OnDestroy {
|
|||||||
this._displayTags = this.tagService.areTagsEnabled();
|
this._displayTags = this.tagService.areTagsEnabled();
|
||||||
this._displayCategories = this.categoryService.areCategoriesEnabled();
|
this._displayCategories = this.categoryService.areCategoriesEnabled();
|
||||||
|
|
||||||
this.contentMetadataService.error.pipe(takeUntil(this.onDestroy$)).subscribe((err: { message: string }) => {
|
this.contentMetadataService.error.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((err: { message: string }) => {
|
||||||
this.notificationService.showError(err.message);
|
this.notificationService.showError(err.message);
|
||||||
});
|
});
|
||||||
this.checkIfNodeIsUpdatable(this.node);
|
this.checkIfNodeIsUpdatable(this.node);
|
||||||
@ -105,7 +107,7 @@ export class MetadataTabComponent implements OnInit, OnDestroy {
|
|||||||
.pipe(
|
.pipe(
|
||||||
ofType<EditOfflineAction>(NodeActionTypes.EditOffline),
|
ofType<EditOfflineAction>(NodeActionTypes.EditOffline),
|
||||||
filter((updatedNode) => this.node.id === updatedNode.payload.entry.id),
|
filter((updatedNode) => this.node.id === updatedNode.payload.entry.id),
|
||||||
takeUntil(this.onDestroy$)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
)
|
)
|
||||||
.subscribe((updatedNode) => {
|
.subscribe((updatedNode) => {
|
||||||
this.checkIfNodeIsUpdatable(updatedNode?.payload.entry);
|
this.checkIfNodeIsUpdatable(updatedNode?.payload.entry);
|
||||||
@ -116,19 +118,14 @@ export class MetadataTabComponent implements OnInit, OnDestroy {
|
|||||||
return { panelTitle: panel.title, component: panel.component };
|
return { panelTitle: panel.title, component: panel.component };
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
takeUntil(this.onDestroy$)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
);
|
);
|
||||||
this.store
|
this.store
|
||||||
.select(infoDrawerMetadataAspect)
|
.select(infoDrawerMetadataAspect)
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((metadataAspect) => (this.metadataAspect = metadataAspect));
|
.subscribe((metadataAspect) => (this.metadataAspect = metadataAspect));
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
private checkIfNodeIsUpdatable(node: Node) {
|
private checkIfNodeIsUpdatable(node: Node) {
|
||||||
this.readOnly = !(node && !isLocked({ entry: node }) ? this.permission.check(node, ['update']) : false);
|
this.readOnly = !(node && !isLocked({ entry: node }) ? this.permission.check(node, ['update']) : false);
|
||||||
}
|
}
|
||||||
|
@ -22,20 +22,21 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ChangeDetectorRef, Component, Input, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
import { ChangeDetectorRef, Component, DestroyRef, inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { SelectionState } from '@alfresco/adf-extensions';
|
import { SelectionState } from '@alfresco/adf-extensions';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { AppStore, getAppSelection } from '@alfresco/aca-shared/store';
|
import { AppStore, getAppSelection } from '@alfresco/aca-shared/store';
|
||||||
import { AvatarComponent, IconComponent, NotificationService } from '@alfresco/adf-core';
|
import { AvatarComponent, IconComponent, NotificationService } from '@alfresco/adf-core';
|
||||||
import { forkJoin, Subject, throwError } from 'rxjs';
|
import { forkJoin, throwError } from 'rxjs';
|
||||||
import { catchError, take, takeUntil } from 'rxjs/operators';
|
import { catchError, take } from 'rxjs/operators';
|
||||||
import { MatMenuModule } from '@angular/material/menu';
|
import { MatMenuModule } from '@angular/material/menu';
|
||||||
import { MatListModule, MatSelectionListChange } from '@angular/material/list';
|
import { MatListModule, MatSelectionListChange } from '@angular/material/list';
|
||||||
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||||
import { Agent } from '@alfresco/js-api';
|
import { Agent } from '@alfresco/js-api';
|
||||||
import { AgentService, SearchAiService } from '@alfresco/adf-content-services';
|
import { AgentService, SearchAiService } from '@alfresco/adf-content-services';
|
||||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -46,13 +47,12 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
|||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
host: { class: 'aca-agents-button' }
|
host: { class: 'aca-agents-button' }
|
||||||
})
|
})
|
||||||
export class AgentsButtonComponent implements OnInit, OnDestroy {
|
export class AgentsButtonComponent implements OnInit {
|
||||||
@Input()
|
@Input()
|
||||||
data: { trigger: string };
|
data: { trigger: string };
|
||||||
|
|
||||||
private selectedNodesState: SelectionState;
|
private selectedNodesState: SelectionState;
|
||||||
private _agents: Agent[] = [];
|
private _agents: Agent[] = [];
|
||||||
private onDestroy$ = new Subject<void>();
|
|
||||||
private _disabled = true;
|
private _disabled = true;
|
||||||
private _initialsByAgentId: { [key: string]: string } = {};
|
private _initialsByAgentId: { [key: string]: string } = {};
|
||||||
private _hxInsightUrl: string;
|
private _hxInsightUrl: string;
|
||||||
@ -73,6 +73,8 @@ export class AgentsButtonComponent implements OnInit, OnDestroy {
|
|||||||
return this._hxInsightUrl;
|
return this._hxInsightUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private store: Store<AppStore>,
|
private store: Store<AppStore>,
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
@ -85,7 +87,7 @@ export class AgentsButtonComponent implements OnInit, OnDestroy {
|
|||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.store
|
this.store
|
||||||
.select(getAppSelection)
|
.select(getAppSelection)
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((selection) => {
|
.subscribe((selection) => {
|
||||||
this.selectedNodesState = selection;
|
this.selectedNodesState = selection;
|
||||||
});
|
});
|
||||||
@ -114,11 +116,6 @@ export class AgentsButtonComponent implements OnInit, OnDestroy {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
|
||||||
this.onDestroy$.next();
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
onClick(): void {
|
onClick(): void {
|
||||||
if (!this.selectedNodesState.isEmpty) {
|
if (!this.selectedNodesState.isEmpty) {
|
||||||
const message = this.searchAiService.checkSearchAvailability(this.selectedNodesState);
|
const message = this.searchAiService.checkSearchAvailability(this.selectedNodesState);
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, DestroyRef, inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
@ -32,10 +32,8 @@ import { MatInputModule } from '@angular/material/input';
|
|||||||
import { A11yModule } from '@angular/cdk/a11y';
|
import { A11yModule } from '@angular/cdk/a11y';
|
||||||
import { AvatarComponent, IconComponent, NotificationService, UserPreferencesService } from '@alfresco/adf-core';
|
import { AvatarComponent, IconComponent, NotificationService, UserPreferencesService } from '@alfresco/adf-core';
|
||||||
import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { Subject } from 'rxjs';
|
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { AiSearchByTermPayload, AppStore, getAppSelection, SearchByTermAiAction, ToggleAISearchInput } from '@alfresco/aca-shared/store';
|
import { AiSearchByTermPayload, AppStore, getAppSelection, SearchByTermAiAction, ToggleAISearchInput } from '@alfresco/aca-shared/store';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
|
||||||
import { SelectionState } from '@alfresco/adf-extensions';
|
import { SelectionState } from '@alfresco/adf-extensions';
|
||||||
import { MatSelectModule } from '@angular/material/select';
|
import { MatSelectModule } from '@angular/material/select';
|
||||||
import { AgentService, SearchAiService } from '@alfresco/adf-content-services';
|
import { AgentService, SearchAiService } from '@alfresco/adf-content-services';
|
||||||
@ -48,6 +46,7 @@ import {
|
|||||||
} from '@angular/material/tooltip';
|
} from '@angular/material/tooltip';
|
||||||
import { ModalAiService } from '../../../../services/modal-ai.service';
|
import { ModalAiService } from '../../../../services/modal-ai.service';
|
||||||
import { Agent } from '@alfresco/js-api';
|
import { Agent } from '@alfresco/js-api';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
const MatTooltipOptions: MatTooltipDefaultOptions = {
|
const MatTooltipOptions: MatTooltipDefaultOptions = {
|
||||||
...MAT_TOOLTIP_DEFAULT_OPTIONS_FACTORY(),
|
...MAT_TOOLTIP_DEFAULT_OPTIONS_FACTORY(),
|
||||||
@ -78,7 +77,7 @@ const MatTooltipOptions: MatTooltipDefaultOptions = {
|
|||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
providers: [{ provide: MAT_TOOLTIP_DEFAULT_OPTIONS, useValue: MatTooltipOptions }]
|
providers: [{ provide: MAT_TOOLTIP_DEFAULT_OPTIONS, useValue: MatTooltipOptions }]
|
||||||
})
|
})
|
||||||
export class SearchAiInputComponent implements OnInit, OnDestroy {
|
export class SearchAiInputComponent implements OnInit {
|
||||||
@Input()
|
@Input()
|
||||||
placeholder: string;
|
placeholder: string;
|
||||||
|
|
||||||
@ -95,7 +94,6 @@ export class SearchAiInputComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
private _agentControl = new FormControl<Agent>(null);
|
private _agentControl = new FormControl<Agent>(null);
|
||||||
private _agents: Agent[] = [];
|
private _agents: Agent[] = [];
|
||||||
private onDestroy$ = new Subject<void>();
|
|
||||||
private selectedNodesState: SelectionState;
|
private selectedNodesState: SelectionState;
|
||||||
private _queryControl = new FormControl('');
|
private _queryControl = new FormControl('');
|
||||||
private _initialsByAgentId: { [key: string]: string } = {};
|
private _initialsByAgentId: { [key: string]: string } = {};
|
||||||
@ -116,6 +114,8 @@ export class SearchAiInputComponent implements OnInit, OnDestroy {
|
|||||||
return this._initialsByAgentId;
|
return this._initialsByAgentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private store: Store<AppStore>,
|
private store: Store<AppStore>,
|
||||||
private searchAiService: SearchAiService,
|
private searchAiService: SearchAiService,
|
||||||
@ -133,7 +133,7 @@ export class SearchAiInputComponent implements OnInit, OnDestroy {
|
|||||||
if (!this.usedInAiResultsPage) {
|
if (!this.usedInAiResultsPage) {
|
||||||
this.store
|
this.store
|
||||||
.select(getAppSelection)
|
.select(getAppSelection)
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((selection) => {
|
.subscribe((selection) => {
|
||||||
this.selectedNodesState = selection;
|
this.selectedNodesState = selection;
|
||||||
});
|
});
|
||||||
@ -143,7 +143,7 @@ export class SearchAiInputComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this.agentService
|
this.agentService
|
||||||
.getAgents()
|
.getAgents()
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(agents) => {
|
(agents) => {
|
||||||
this._agents = agents;
|
this._agents = agents;
|
||||||
@ -159,11 +159,6 @@ export class SearchAiInputComponent implements OnInit, OnDestroy {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
|
||||||
this.onDestroy$.next();
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
onSearchSubmit() {
|
onSearchSubmit() {
|
||||||
this.modalAiService.openUnsavedChangesModal(() => this.search());
|
this.modalAiService.openUnsavedChangesModal(() => this.search());
|
||||||
}
|
}
|
||||||
|
@ -22,10 +22,10 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { PageComponent, PageLayoutComponent, ToolbarActionComponent, ToolbarComponent } from '@alfresco/aca-shared';
|
import { PageComponent, PageLayoutComponent, ToolbarActionComponent, ToolbarComponent } from '@alfresco/aca-shared';
|
||||||
import { concatMap, delay, filter, finalize, retryWhen, skipWhile, switchMap, takeUntil } from 'rxjs/operators';
|
import { concatMap, delay, filter, finalize, retryWhen, skipWhile, switchMap } from 'rxjs/operators';
|
||||||
import { AvatarComponent, ClipboardService, EmptyContentComponent, ThumbnailService, ToolbarModule, UnsavedChangesGuard } from '@alfresco/adf-core';
|
import { AvatarComponent, ClipboardService, EmptyContentComponent, ThumbnailService, ToolbarModule, UnsavedChangesGuard } from '@alfresco/adf-core';
|
||||||
import { AiAnswer, Node } from '@alfresco/js-api';
|
import { AiAnswer, Node } from '@alfresco/js-api';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
@ -42,6 +42,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
|||||||
import { ModalAiService } from '../../../../services/modal-ai.service';
|
import { ModalAiService } from '../../../../services/modal-ai.service';
|
||||||
import { ViewNodeAction } from '@alfresco/aca-shared/store';
|
import { ViewNodeAction } from '@alfresco/aca-shared/store';
|
||||||
import { ViewerService } from '@alfresco/aca-content/viewer';
|
import { ViewerService } from '@alfresco/aca-content/viewer';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -67,7 +68,7 @@ import { ViewerService } from '@alfresco/aca-content/viewer';
|
|||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
host: { class: 'aca-search-ai-results' }
|
host: { class: 'aca-search-ai-results' }
|
||||||
})
|
})
|
||||||
export class SearchAiResultsComponent extends PageComponent implements OnInit, OnDestroy {
|
export class SearchAiResultsComponent extends PageComponent implements OnInit {
|
||||||
private _agentId: string;
|
private _agentId: string;
|
||||||
private _hasAnsweringError = false;
|
private _hasAnsweringError = false;
|
||||||
private _hasError = false;
|
private _hasError = false;
|
||||||
@ -133,7 +134,7 @@ export class SearchAiResultsComponent extends PageComponent implements OnInit, O
|
|||||||
this.openedViewer = !!params.location;
|
this.openedViewer = !!params.location;
|
||||||
return !this.openedViewer && (!openedViewerPreviously || !this.queryAnswer);
|
return !this.openedViewer && (!openedViewerPreviously || !this.queryAnswer);
|
||||||
}),
|
}),
|
||||||
takeUntil(this.onDestroy$)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
)
|
)
|
||||||
.subscribe((params) => {
|
.subscribe((params) => {
|
||||||
this._agentId = params.agentId;
|
this._agentId = params.agentId;
|
||||||
@ -156,11 +157,6 @@ export class SearchAiResultsComponent extends PageComponent implements OnInit, O
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
|
||||||
this.onDestroy$.next();
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
copyResponseToClipboard(): void {
|
copyResponseToClipboard(): void {
|
||||||
this.clipboardService.copyContentToClipboard(
|
this.clipboardService.copyContentToClipboard(
|
||||||
this.queryAnswer.answer,
|
this.queryAnswer.answer,
|
||||||
@ -192,7 +188,7 @@ export class SearchAiResultsComponent extends PageComponent implements OnInit, O
|
|||||||
}),
|
}),
|
||||||
retryWhen((errors: Observable<Error>) => this.aiSearchRetryWhen(errors)),
|
retryWhen((errors: Observable<Error>) => this.aiSearchRetryWhen(errors)),
|
||||||
finalize(() => (this._loading = false)),
|
finalize(() => (this._loading = false)),
|
||||||
takeUntil(this.onDestroy$)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
)
|
)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(nodes) => {
|
(nodes) => {
|
||||||
|
@ -22,8 +22,7 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, EventEmitter, Input, OnDestroy, Output, ViewEncapsulation, ViewChild, ElementRef } from '@angular/core';
|
import { Component, ElementRef, EventEmitter, Input, Output, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||||
import { Subject } from 'rxjs';
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
@ -41,9 +40,7 @@ import { FormsModule } from '@angular/forms';
|
|||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
host: { class: 'app-search-control' }
|
host: { class: 'app-search-control' }
|
||||||
})
|
})
|
||||||
export class SearchInputControlComponent implements OnDestroy {
|
export class SearchInputControlComponent {
|
||||||
onDestroy$: Subject<boolean> = new Subject<boolean>();
|
|
||||||
|
|
||||||
/** Type of the input field to render, e.g. "search" or "text" (default). */
|
/** Type of the input field to render, e.g. "search" or "text" (default). */
|
||||||
@Input()
|
@Input()
|
||||||
inputType = 'text';
|
inputType = 'text';
|
||||||
@ -68,11 +65,6 @@ export class SearchInputControlComponent implements OnDestroy {
|
|||||||
|
|
||||||
searchTerm = '';
|
searchTerm = '';
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
searchSubmit(event: any) {
|
searchSubmit(event: any) {
|
||||||
this.submit.emit(event);
|
this.submit.emit(event);
|
||||||
}
|
}
|
||||||
|
@ -26,12 +26,10 @@ import { AppHookService, AppService } from '@alfresco/aca-shared';
|
|||||||
import { AppStore, SearchByTermAction, SearchOptionIds, SearchOptionModel } from '@alfresco/aca-shared/store';
|
import { AppStore, SearchByTermAction, SearchOptionIds, SearchOptionModel } from '@alfresco/aca-shared/store';
|
||||||
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||||
import { AppConfigService, NotificationService } from '@alfresco/adf-core';
|
import { AppConfigService, NotificationService } from '@alfresco/adf-core';
|
||||||
import { Component, inject, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
import { Component, DestroyRef, inject, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||||
import { MatMenuModule, MatMenuTrigger } from '@angular/material/menu';
|
import { MatMenuModule, MatMenuTrigger } from '@angular/material/menu';
|
||||||
import { ActivatedRoute, Params, PRIMARY_OUTLET, Router, UrlSegment, UrlSegmentGroup, UrlTree } from '@angular/router';
|
import { ActivatedRoute, Params, PRIMARY_OUTLET, Router, UrlSegment, UrlSegmentGroup, UrlTree } from '@angular/router';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { Subject } from 'rxjs';
|
|
||||||
import { takeUntil } from 'rxjs/operators';
|
|
||||||
import { SearchInputControlComponent } from '../search-input-control/search-input-control.component';
|
import { SearchInputControlComponent } from '../search-input-control/search-input-control.component';
|
||||||
import { SearchNavigationService } from '../search-navigation.service';
|
import { SearchNavigationService } from '../search-navigation.service';
|
||||||
import { SearchLibrariesQueryBuilderService } from '../search-libraries-results/search-libraries-query-builder.service';
|
import { SearchLibrariesQueryBuilderService } from '../search-libraries-results/search-libraries-query-builder.service';
|
||||||
@ -45,6 +43,7 @@ import { A11yModule } from '@angular/cdk/a11y';
|
|||||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { extractSearchedWordFromEncodedQuery } from '../../../utils/aca-search-utils';
|
import { extractSearchedWordFromEncodedQuery } from '../../../utils/aca-search-utils';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -70,7 +69,6 @@ import { extractSearchedWordFromEncodedQuery } from '../../../utils/aca-search-u
|
|||||||
export class SearchInputComponent implements OnInit, OnDestroy {
|
export class SearchInputComponent implements OnInit, OnDestroy {
|
||||||
private readonly notificationService = inject(NotificationService);
|
private readonly notificationService = inject(NotificationService);
|
||||||
|
|
||||||
onDestroy$: Subject<boolean> = new Subject<boolean>();
|
|
||||||
has400LibraryError = false;
|
has400LibraryError = false;
|
||||||
hasLibrariesConstraint = false;
|
hasLibrariesConstraint = false;
|
||||||
searchOnChange: boolean;
|
searchOnChange: boolean;
|
||||||
@ -103,6 +101,8 @@ export class SearchInputComponent implements OnInit, OnDestroy {
|
|||||||
@ViewChild(MatMenuTrigger, { static: true })
|
@ViewChild(MatMenuTrigger, { static: true })
|
||||||
trigger: MatMenuTrigger;
|
trigger: MatMenuTrigger;
|
||||||
|
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly queryBuilder: SearchQueryBuilderService,
|
private readonly queryBuilder: SearchQueryBuilderService,
|
||||||
private readonly queryLibrariesBuilder: SearchLibrariesQueryBuilderService,
|
private readonly queryLibrariesBuilder: SearchLibrariesQueryBuilderService,
|
||||||
@ -120,7 +120,7 @@ export class SearchInputComponent implements OnInit, OnDestroy {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.showInputValue();
|
this.showInputValue();
|
||||||
|
|
||||||
this.route.queryParams.pipe(takeUntil(this.onDestroy$)).subscribe((params: Params) => {
|
this.route.queryParams.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((params: Params) => {
|
||||||
const encodedQuery = params['q'];
|
const encodedQuery = params['q'];
|
||||||
if (encodedQuery && this.searchInputControl) {
|
if (encodedQuery && this.searchInputControl) {
|
||||||
this.searchedWord = extractSearchedWordFromEncodedQuery(encodedQuery);
|
this.searchedWord = extractSearchedWordFromEncodedQuery(encodedQuery);
|
||||||
@ -128,7 +128,7 @@ export class SearchInputComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.appHookService.library400Error.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
|
this.appHookService.library400Error.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
||||||
this.has400LibraryError = true;
|
this.has400LibraryError = true;
|
||||||
this.hasLibrariesConstraint = this.evaluateLibrariesConstraint();
|
this.hasLibrariesConstraint = this.evaluateLibrariesConstraint();
|
||||||
});
|
});
|
||||||
@ -151,8 +151,6 @@ export class SearchInputComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.appService.setAppNavbarMode('expanded');
|
this.appService.setAppNavbarMode('expanded');
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
this.removeContentFilters();
|
this.removeContentFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|||||||
import { DocumentListDirective } from '../../../directives/document-list.directive';
|
import { DocumentListDirective } from '../../../directives/document-list.directive';
|
||||||
import { DocumentListComponent } from '@alfresco/adf-content-services';
|
import { DocumentListComponent } from '@alfresco/adf-content-services';
|
||||||
import { extractSearchedWordFromEncodedQuery } from '../../../utils/aca-search-utils';
|
import { extractSearchedWordFromEncodedQuery } from '../../../utils/aca-search-utils';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -130,7 +130,7 @@ export class SearchLibrariesResultsComponent extends PageComponent implements On
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (this.route) {
|
if (this.route) {
|
||||||
this.route.queryParams.pipe(takeUntil(this.onDestroy$)).subscribe((params: Params) => {
|
this.route.queryParams.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((params: Params) => {
|
||||||
const encodedQuery = params[this.queryParamName] || null;
|
const encodedQuery = params[this.queryParamName] || null;
|
||||||
this.searchedWord = extractSearchedWordFromEncodedQuery(encodedQuery);
|
this.searchedWord = extractSearchedWordFromEncodedQuery(encodedQuery);
|
||||||
if (this.searchedWord?.length > 1) {
|
if (this.searchedWord?.length > 1) {
|
||||||
|
@ -22,19 +22,19 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, OnInit, ViewEncapsulation, ChangeDetectionStrategy, OnDestroy, inject } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, DestroyRef, inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { NodeEntry, SearchEntryHighlight } from '@alfresco/js-api';
|
import { NodeEntry, SearchEntryHighlight } from '@alfresco/js-api';
|
||||||
import { NavigateToFolder, ViewNodeAction } from '@alfresco/aca-shared/store';
|
import { NavigateToFolder, ViewNodeAction } from '@alfresco/aca-shared/store';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { BehaviorSubject, Subject } from 'rxjs';
|
import { BehaviorSubject } from 'rxjs';
|
||||||
import { NodesApiService } from '@alfresco/adf-content-services';
|
import { NodesApiService } from '@alfresco/adf-content-services';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { AutoDownloadService, AppSettingsService } from '@alfresco/aca-shared';
|
import { AppSettingsService, AutoDownloadService } from '@alfresco/aca-shared';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { LocationLinkComponent } from '../../common/location-link/location-link.component';
|
import { LocationLinkComponent } from '../../common/location-link/location-link.component';
|
||||||
import { MatDialogModule } from '@angular/material/dialog';
|
import { MatDialogModule } from '@angular/material/dialog';
|
||||||
import { DatatableCellBadgesComponent } from '../../dl-custom-components/datatable-cell-badges/datatable-cell-badges.component';
|
import { DatatableCellBadgesComponent } from '../../dl-custom-components/datatable-cell-badges/datatable-cell-badges.component';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -46,14 +46,13 @@ import { DatatableCellBadgesComponent } from '../../dl-custom-components/datatab
|
|||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
host: { class: 'aca-search-results-row' }
|
host: { class: 'aca-search-results-row' }
|
||||||
})
|
})
|
||||||
export class SearchResultsRowComponent implements OnInit, OnDestroy {
|
export class SearchResultsRowComponent implements OnInit {
|
||||||
private settings = inject(AppSettingsService);
|
private settings = inject(AppSettingsService);
|
||||||
|
|
||||||
private readonly highlightPrefix = "<span class='aca-highlight'>";
|
private readonly highlightPrefix = "<span class='aca-highlight'>";
|
||||||
private readonly highlightPostfix = '</span>';
|
private readonly highlightPostfix = '</span>';
|
||||||
|
|
||||||
private node: NodeEntry;
|
private node: NodeEntry;
|
||||||
private onDestroy$ = new Subject<boolean>();
|
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
context: any;
|
context: any;
|
||||||
@ -68,6 +67,8 @@ export class SearchResultsRowComponent implements OnInit, OnDestroy {
|
|||||||
contentStripped = '';
|
contentStripped = '';
|
||||||
isFile = false;
|
isFile = false;
|
||||||
|
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private store: Store<any>,
|
private store: Store<any>,
|
||||||
private nodesApiService: NodesApiService,
|
private nodesApiService: NodesApiService,
|
||||||
@ -78,7 +79,7 @@ export class SearchResultsRowComponent implements OnInit, OnDestroy {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.updateValues();
|
this.updateValues();
|
||||||
|
|
||||||
this.nodesApiService.nodeUpdated.pipe(takeUntil(this.onDestroy$)).subscribe((node) => {
|
this.nodesApiService.nodeUpdated.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((node) => {
|
||||||
const row = this.context.row;
|
const row = this.context.row;
|
||||||
if (row) {
|
if (row) {
|
||||||
const { entry } = row.node;
|
const { entry } = row.node;
|
||||||
@ -136,11 +137,6 @@ export class SearchResultsRowComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
showPreview(event: Event) {
|
showPreview(event: Event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ChangeDetectorRef, Component, DestroyRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
import { ChangeDetectorRef, Component, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { NodeEntry, Pagination, ResultSetPaging } from '@alfresco/js-api';
|
import { NodeEntry, Pagination, ResultSetPaging } from '@alfresco/js-api';
|
||||||
import { ActivatedRoute, Params } from '@angular/router';
|
import { ActivatedRoute, Params } from '@angular/router';
|
||||||
import {
|
import {
|
||||||
@ -153,8 +153,6 @@ export class SearchResultsComponent extends PageComponent implements OnInit {
|
|||||||
searchConfig: SearchConfiguration;
|
searchConfig: SearchConfiguration;
|
||||||
|
|
||||||
private readonly loadedFilters$ = new Subject<void>();
|
private readonly loadedFilters$ = new Subject<void>();
|
||||||
private readonly destroyRef = inject(DestroyRef);
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
tagsService: TagService,
|
tagsService: TagService,
|
||||||
private readonly queryBuilder: SearchQueryBuilderService,
|
private readonly queryBuilder: SearchQueryBuilderService,
|
||||||
|
@ -22,15 +22,14 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, inject, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, DestroyRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { SavedSearch, SavedSearchesService } from '@alfresco/adf-content-services';
|
import { SavedSearch, SavedSearchesService } from '@alfresco/adf-content-services';
|
||||||
import { Subject } from 'rxjs';
|
|
||||||
import { takeUntil } from 'rxjs/operators';
|
|
||||||
import { CoreModule, TranslationService } from '@alfresco/adf-core';
|
import { CoreModule, TranslationService } from '@alfresco/adf-core';
|
||||||
import { DynamicExtensionComponent, NavBarLinkRef } from '@alfresco/adf-extensions';
|
import { DynamicExtensionComponent, NavBarLinkRef } from '@alfresco/adf-extensions';
|
||||||
import { ExpandMenuComponent } from '../../../sidenav/components/expand-menu.component';
|
import { ExpandMenuComponent } from '../../../sidenav/components/expand-menu.component';
|
||||||
import { SidenavHeaderComponent } from '../../../sidenav/components/sidenav-header.component';
|
import { SidenavHeaderComponent } from '../../../sidenav/components/sidenav-header.component';
|
||||||
import { AppService } from '@alfresco/aca-shared';
|
import { AppService } from '@alfresco/aca-shared';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'aca-save-search-sidenav',
|
selector: 'aca-save-search-sidenav',
|
||||||
@ -39,30 +38,25 @@ import { AppService } from '@alfresco/aca-shared';
|
|||||||
templateUrl: './save-search-sidenav.component.html',
|
templateUrl: './save-search-sidenav.component.html',
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class SaveSearchSidenavComponent implements OnInit, OnDestroy {
|
export class SaveSearchSidenavComponent implements OnInit {
|
||||||
savedSearchesService = inject(SavedSearchesService);
|
savedSearchesService = inject(SavedSearchesService);
|
||||||
appService = inject(AppService);
|
appService = inject(AppService);
|
||||||
translationService = inject(TranslationService);
|
translationService = inject(TranslationService);
|
||||||
destroy$ = new Subject<void>();
|
|
||||||
item: NavBarLinkRef;
|
item: NavBarLinkRef;
|
||||||
|
|
||||||
private readonly manageSearchesId = 'manage-saved-searches';
|
private readonly manageSearchesId = 'manage-saved-searches';
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.savedSearchesService.innit();
|
this.savedSearchesService.innit();
|
||||||
this.savedSearchesService.savedSearches$
|
this.savedSearchesService.savedSearches$
|
||||||
.asObservable()
|
.asObservable()
|
||||||
.pipe(takeUntil(this.destroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((savedSearches) => {
|
.subscribe((savedSearches) => {
|
||||||
this.item = this.createNavBarLinkRef(savedSearches);
|
this.item = this.createNavBarLinkRef(savedSearches);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
|
||||||
this.destroy$.next();
|
|
||||||
this.destroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
onActionClick(el: NavBarLinkRef): void {
|
onActionClick(el: NavBarLinkRef): void {
|
||||||
if (el.id !== this.manageSearchesId) {
|
if (el.id !== this.manageSearchesId) {
|
||||||
this.appService.appNavNarMode$.next('collapsed');
|
this.appService.appNavNarMode$.next('collapsed');
|
||||||
|
@ -26,14 +26,15 @@ import { AppStore, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
|||||||
import { ViewerModule } from '@alfresco/adf-core';
|
import { ViewerModule } from '@alfresco/adf-core';
|
||||||
import { ContentActionRef } from '@alfresco/adf-extensions';
|
import { ContentActionRef } from '@alfresco/adf-extensions';
|
||||||
import { SharedLinkEntry, SharedlinksApi } from '@alfresco/js-api';
|
import { SharedLinkEntry, SharedlinksApi } from '@alfresco/js-api';
|
||||||
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, DestroyRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { forkJoin, from, of, Subject } from 'rxjs';
|
import { forkJoin, from, of } from 'rxjs';
|
||||||
import { catchError, mergeMap, takeUntil } from 'rxjs/operators';
|
import { catchError, mergeMap } from 'rxjs/operators';
|
||||||
import { AppExtensionService, AppService, ToolbarComponent } from '@alfresco/aca-shared';
|
import { AppExtensionService, AppService, ToolbarComponent } from '@alfresco/aca-shared';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { AlfrescoApiService, AlfrescoViewerModule } from '@alfresco/adf-content-services';
|
import { AlfrescoApiService, AlfrescoViewerModule } from '@alfresco/adf-content-services';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -44,12 +45,14 @@ import { AlfrescoApiService, AlfrescoViewerModule } from '@alfresco/adf-content-
|
|||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
host: { class: 'app-shared-link-view' }
|
host: { class: 'app-shared-link-view' }
|
||||||
})
|
})
|
||||||
export class SharedLinkViewComponent implements OnInit, OnDestroy {
|
export class SharedLinkViewComponent implements OnInit {
|
||||||
private onDestroy$: Subject<boolean> = new Subject<boolean>();
|
|
||||||
private sharedLinksApi: SharedlinksApi;
|
|
||||||
sharedLinkId: string = null;
|
sharedLinkId: string = null;
|
||||||
viewerToolbarActions: Array<ContentActionRef> = [];
|
viewerToolbarActions: Array<ContentActionRef> = [];
|
||||||
|
|
||||||
|
private sharedLinksApi: SharedlinksApi;
|
||||||
|
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private store: Store<AppStore>,
|
private store: Store<AppStore>,
|
||||||
@ -77,14 +80,9 @@ export class SharedLinkViewComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this.extensions
|
this.extensions
|
||||||
.getSharedLinkViewerToolbarActions()
|
.getSharedLinkViewerToolbarActions()
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((actions) => {
|
.subscribe((actions) => {
|
||||||
this.viewerToolbarActions = actions;
|
this.viewerToolbarActions = actions;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -22,14 +22,13 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, EventEmitter, inject, OnDestroy, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
import { Component, DestroyRef, EventEmitter, inject, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
||||||
import { Subject } from 'rxjs';
|
|
||||||
import { ContentActionRef } from '@alfresco/adf-extensions';
|
import { ContentActionRef } from '@alfresco/adf-extensions';
|
||||||
import { AppExtensionService, AppSettingsService, ToolbarComponent } from '@alfresco/aca-shared';
|
import { AppExtensionService, AppSettingsService, ToolbarComponent } from '@alfresco/aca-shared';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -39,11 +38,12 @@ import { RouterModule } from '@angular/router';
|
|||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
host: { class: 'app-sidenav-header' }
|
host: { class: 'app-sidenav-header' }
|
||||||
})
|
})
|
||||||
export class SidenavHeaderComponent implements OnInit, OnDestroy {
|
export class SidenavHeaderComponent implements OnInit {
|
||||||
private onDestroy$ = new Subject<boolean>();
|
|
||||||
private appSettings = inject(AppSettingsService);
|
private appSettings = inject(AppSettingsService);
|
||||||
private appExtensions = inject(AppExtensionService);
|
private appExtensions = inject(AppExtensionService);
|
||||||
|
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
appName = this.appSettings.appName;
|
appName = this.appSettings.appName;
|
||||||
logoUrl = this.appSettings.appLogoUrl;
|
logoUrl = this.appSettings.appLogoUrl;
|
||||||
landingPage = this.appSettings.landingPage;
|
landingPage = this.appSettings.landingPage;
|
||||||
@ -55,14 +55,9 @@ export class SidenavHeaderComponent implements OnInit, OnDestroy {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.appExtensions
|
this.appExtensions
|
||||||
.getHeaderActions()
|
.getHeaderActions()
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((actions) => {
|
.subscribe((actions) => {
|
||||||
this.actions = actions;
|
this.actions = actions;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,23 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { AfterContentInit, ContentChildren, Directive, ElementRef, Input, OnInit, Optional, QueryList, Renderer2 } from '@angular/core';
|
import {
|
||||||
|
AfterContentInit,
|
||||||
|
ContentChildren,
|
||||||
|
DestroyRef,
|
||||||
|
Directive,
|
||||||
|
ElementRef,
|
||||||
|
inject,
|
||||||
|
Input,
|
||||||
|
OnInit,
|
||||||
|
Optional,
|
||||||
|
QueryList,
|
||||||
|
Renderer2
|
||||||
|
} from '@angular/core';
|
||||||
import { NavigationEnd, Router } from '@angular/router';
|
import { NavigationEnd, Router } from '@angular/router';
|
||||||
import { filter, takeUntil } from 'rxjs/operators';
|
import { filter } from 'rxjs/operators';
|
||||||
import { Subject } from 'rxjs';
|
|
||||||
import { ActionDirective } from './action.directive';
|
import { ActionDirective } from './action.directive';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -39,7 +51,7 @@ export class ActiveLinkDirective implements OnInit, AfterContentInit {
|
|||||||
links: QueryList<ActionDirective>;
|
links: QueryList<ActionDirective>;
|
||||||
isLinkActive = false;
|
isLinkActive = false;
|
||||||
|
|
||||||
private onDestroy$: Subject<boolean> = new Subject<boolean>();
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(private router: Router, private element: ElementRef, private renderer: Renderer2, @Optional() private action?: ActionDirective) {}
|
constructor(private router: Router, private element: ElementRef, private renderer: Renderer2, @Optional() private action?: ActionDirective) {}
|
||||||
|
|
||||||
@ -47,7 +59,7 @@ export class ActiveLinkDirective implements OnInit, AfterContentInit {
|
|||||||
this.router.events
|
this.router.events
|
||||||
.pipe(
|
.pipe(
|
||||||
filter((event) => event instanceof NavigationEnd),
|
filter((event) => event instanceof NavigationEnd),
|
||||||
takeUntil(this.onDestroy$)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
)
|
)
|
||||||
.subscribe((event: NavigationEnd) => {
|
.subscribe((event: NavigationEnd) => {
|
||||||
this.update(event.urlAfterRedirects);
|
this.update(event.urlAfterRedirects);
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
import { NavigationEnd } from '@angular/router';
|
import { NavigationEnd } from '@angular/router';
|
||||||
import { ExpansionPanelDirective } from './expansion-panel.directive';
|
import { ExpansionPanelDirective } from './expansion-panel.directive';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
class RouterStub {
|
class RouterStub {
|
||||||
url;
|
url;
|
||||||
@ -64,7 +65,10 @@ describe('AcaExpansionPanel', () => {
|
|||||||
const item = {
|
const item = {
|
||||||
children: [{ url: 'dummy-route-1' }, { url: 'dummy-route-2' }]
|
children: [{ url: 'dummy-route-1' }, { url: 'dummy-route-2' }]
|
||||||
};
|
};
|
||||||
const directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
|
let directive: ExpansionPanelDirective;
|
||||||
|
TestBed.runInInjectionContext(() => {
|
||||||
|
directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
|
||||||
|
});
|
||||||
|
|
||||||
directive.acaExpansionPanel = item;
|
directive.acaExpansionPanel = item;
|
||||||
|
|
||||||
@ -75,7 +79,10 @@ describe('AcaExpansionPanel', () => {
|
|||||||
const item = {
|
const item = {
|
||||||
children: [{ url: 'dummy-route-1' }, { url: 'dummy-route-2' }]
|
children: [{ url: 'dummy-route-1' }, { url: 'dummy-route-2' }]
|
||||||
};
|
};
|
||||||
const directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
|
let directive: ExpansionPanelDirective;
|
||||||
|
TestBed.runInInjectionContext(() => {
|
||||||
|
directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
|
||||||
|
});
|
||||||
|
|
||||||
directive.acaExpansionPanel = item;
|
directive.acaExpansionPanel = item;
|
||||||
|
|
||||||
@ -93,7 +100,10 @@ describe('AcaExpansionPanel', () => {
|
|||||||
|
|
||||||
mockMatExpansionPanel.expanded = true;
|
mockMatExpansionPanel.expanded = true;
|
||||||
|
|
||||||
const directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
|
let directive: ExpansionPanelDirective;
|
||||||
|
TestBed.runInInjectionContext(() => {
|
||||||
|
directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
|
||||||
|
});
|
||||||
|
|
||||||
directive.acaExpansionPanel = item;
|
directive.acaExpansionPanel = item;
|
||||||
|
|
||||||
@ -109,7 +119,10 @@ describe('AcaExpansionPanel', () => {
|
|||||||
children: [{ url: 'dummy-route-1' }, { url: 'dummy-route-2' }]
|
children: [{ url: 'dummy-route-1' }, { url: 'dummy-route-2' }]
|
||||||
};
|
};
|
||||||
|
|
||||||
const directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
|
let directive: ExpansionPanelDirective;
|
||||||
|
TestBed.runInInjectionContext(() => {
|
||||||
|
directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
|
||||||
|
});
|
||||||
|
|
||||||
directive.acaExpansionPanel = item;
|
directive.acaExpansionPanel = item;
|
||||||
mockMatExpansionPanel.expanded = true;
|
mockMatExpansionPanel.expanded = true;
|
||||||
@ -129,7 +142,10 @@ describe('AcaExpansionPanel', () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
|
let directive: ExpansionPanelDirective;
|
||||||
|
TestBed.runInInjectionContext(() => {
|
||||||
|
directive = new ExpansionPanelDirective(mockStore, router, mockMatExpansionPanel);
|
||||||
|
});
|
||||||
|
|
||||||
directive.acaExpansionPanel = item;
|
directive.acaExpansionPanel = item;
|
||||||
mockMatExpansionPanel.expanded = true;
|
mockMatExpansionPanel.expanded = true;
|
||||||
|
@ -22,24 +22,22 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Directive, Input, HostListener, OnInit, OnDestroy } from '@angular/core';
|
import { DestroyRef, Directive, HostListener, inject, Input, OnInit } from '@angular/core';
|
||||||
import { Router, NavigationEnd, PRIMARY_OUTLET } from '@angular/router';
|
import { NavigationEnd, PRIMARY_OUTLET, Router } from '@angular/router';
|
||||||
import { filter, takeUntil } from 'rxjs/operators';
|
import { filter } from 'rxjs/operators';
|
||||||
import { Subject } from 'rxjs';
|
|
||||||
import { MatExpansionPanel } from '@angular/material/expansion';
|
import { MatExpansionPanel } from '@angular/material/expansion';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
selector: '[acaExpansionPanel]',
|
selector: '[acaExpansionPanel]',
|
||||||
exportAs: 'acaExpansionPanel'
|
exportAs: 'acaExpansionPanel'
|
||||||
})
|
})
|
||||||
export class ExpansionPanelDirective implements OnInit, OnDestroy {
|
export class ExpansionPanelDirective implements OnInit {
|
||||||
@Input() acaExpansionPanel;
|
@Input() acaExpansionPanel;
|
||||||
public hasActiveChildren = false;
|
public hasActiveChildren = false;
|
||||||
|
|
||||||
private onDestroy$: Subject<boolean> = new Subject<boolean>();
|
|
||||||
|
|
||||||
@HostListener('click')
|
@HostListener('click')
|
||||||
onClick() {
|
onClick() {
|
||||||
if (this.expansionPanel.expanded && !this.hasActiveLinks() && !this.acaExpansionPanel.data?.canBeInactive) {
|
if (this.expansionPanel.expanded && !this.hasActiveLinks() && !this.acaExpansionPanel.data?.canBeInactive) {
|
||||||
@ -55,6 +53,8 @@ export class ExpansionPanelDirective implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(private store: Store<any>, private router: Router, private expansionPanel: MatExpansionPanel) {}
|
constructor(private store: Store<any>, private router: Router, private expansionPanel: MatExpansionPanel) {}
|
||||||
|
|
||||||
hasActiveLinks() {
|
hasActiveLinks() {
|
||||||
@ -70,18 +70,13 @@ export class ExpansionPanelDirective implements OnInit, OnDestroy {
|
|||||||
this.router.events
|
this.router.events
|
||||||
.pipe(
|
.pipe(
|
||||||
filter((event) => event instanceof NavigationEnd),
|
filter((event) => event instanceof NavigationEnd),
|
||||||
takeUntil(this.onDestroy$)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
)
|
)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.hasActiveChildren = this.hasActiveLinks();
|
this.hasActiveChildren = this.hasActiveLinks();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
private getNavigationCommands(url: string): any[] {
|
private getNavigationCommands(url: string): any[] {
|
||||||
const urlTree = this.router.parseUrl(url);
|
const urlTree = this.router.parseUrl(url);
|
||||||
const urlSegmentGroup = urlTree.root.children[PRIMARY_OUTLET];
|
const urlSegmentGroup = urlTree.root.children[PRIMARY_OUTLET];
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
import { NavigationEnd } from '@angular/router';
|
import { NavigationEnd } from '@angular/router';
|
||||||
import { MenuPanelDirective } from './menu-panel.directive';
|
import { MenuPanelDirective } from './menu-panel.directive';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
class RouterStub {
|
class RouterStub {
|
||||||
url;
|
url;
|
||||||
@ -64,7 +65,10 @@ describe('MenuPanelDirective', () => {
|
|||||||
const item = {
|
const item = {
|
||||||
children: [{ url: 'dummy-route-1' }, { url: 'dummy-route-2' }]
|
children: [{ url: 'dummy-route-1' }, { url: 'dummy-route-2' }]
|
||||||
};
|
};
|
||||||
const directive = new MenuPanelDirective(mockStore, router);
|
let directive: MenuPanelDirective;
|
||||||
|
TestBed.runInInjectionContext(() => {
|
||||||
|
directive = new MenuPanelDirective(mockStore, router);
|
||||||
|
});
|
||||||
|
|
||||||
directive.acaMenuPanel = item;
|
directive.acaMenuPanel = item;
|
||||||
|
|
||||||
@ -75,7 +79,10 @@ describe('MenuPanelDirective', () => {
|
|||||||
const item = {
|
const item = {
|
||||||
children: [{ url: 'dummy-route-1' }, { url: 'dummy-route-2' }]
|
children: [{ url: 'dummy-route-1' }, { url: 'dummy-route-2' }]
|
||||||
};
|
};
|
||||||
const directive = new MenuPanelDirective(mockStore, router);
|
let directive: MenuPanelDirective;
|
||||||
|
TestBed.runInInjectionContext(() => {
|
||||||
|
directive = new MenuPanelDirective(mockStore, router);
|
||||||
|
});
|
||||||
|
|
||||||
directive.acaMenuPanel = item;
|
directive.acaMenuPanel = item;
|
||||||
|
|
||||||
@ -93,7 +100,10 @@ describe('MenuPanelDirective', () => {
|
|||||||
|
|
||||||
mockMatExpansionPanel.expanded = true;
|
mockMatExpansionPanel.expanded = true;
|
||||||
|
|
||||||
const directive = new MenuPanelDirective(mockStore, router);
|
let directive: MenuPanelDirective;
|
||||||
|
TestBed.runInInjectionContext(() => {
|
||||||
|
directive = new MenuPanelDirective(mockStore, router);
|
||||||
|
});
|
||||||
|
|
||||||
directive.acaMenuPanel = item;
|
directive.acaMenuPanel = item;
|
||||||
|
|
||||||
@ -109,7 +119,10 @@ describe('MenuPanelDirective', () => {
|
|||||||
children: [{ url: 'dummy-route-1' }, { url: 'dummy-route-2' }]
|
children: [{ url: 'dummy-route-1' }, { url: 'dummy-route-2' }]
|
||||||
};
|
};
|
||||||
|
|
||||||
const directive = new MenuPanelDirective(mockStore, router);
|
let directive: MenuPanelDirective;
|
||||||
|
TestBed.runInInjectionContext(() => {
|
||||||
|
directive = new MenuPanelDirective(mockStore, router);
|
||||||
|
});
|
||||||
|
|
||||||
directive.acaMenuPanel = item;
|
directive.acaMenuPanel = item;
|
||||||
mockMatExpansionPanel.expanded = true;
|
mockMatExpansionPanel.expanded = true;
|
||||||
|
@ -22,23 +22,21 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Directive, Input, OnInit, OnDestroy, HostListener } from '@angular/core';
|
import { DestroyRef, Directive, HostListener, inject, Input, OnInit } from '@angular/core';
|
||||||
import { Router, NavigationEnd, PRIMARY_OUTLET } from '@angular/router';
|
import { NavigationEnd, PRIMARY_OUTLET, Router } from '@angular/router';
|
||||||
import { filter, takeUntil } from 'rxjs/operators';
|
import { filter } from 'rxjs/operators';
|
||||||
import { Subject } from 'rxjs';
|
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
selector: '[acaMenuPanel]',
|
selector: '[acaMenuPanel]',
|
||||||
exportAs: 'acaMenuPanel'
|
exportAs: 'acaMenuPanel'
|
||||||
})
|
})
|
||||||
export class MenuPanelDirective implements OnInit, OnDestroy {
|
export class MenuPanelDirective implements OnInit {
|
||||||
@Input() acaMenuPanel;
|
@Input() acaMenuPanel;
|
||||||
hasActiveChildren = false;
|
hasActiveChildren = false;
|
||||||
|
|
||||||
private onDestroy$: Subject<boolean> = new Subject<boolean>();
|
|
||||||
|
|
||||||
@HostListener('menuOpened')
|
@HostListener('menuOpened')
|
||||||
menuOpened() {
|
menuOpened() {
|
||||||
if (this.acaMenuPanel.children && !this.hasActiveLinks()) {
|
if (this.acaMenuPanel.children && !this.hasActiveLinks()) {
|
||||||
@ -54,6 +52,8 @@ export class MenuPanelDirective implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(private store: Store<any>, private router: Router) {}
|
constructor(private store: Store<any>, private router: Router) {}
|
||||||
|
|
||||||
hasActiveLinks() {
|
hasActiveLinks() {
|
||||||
@ -69,18 +69,13 @@ export class MenuPanelDirective implements OnInit, OnDestroy {
|
|||||||
this.router.events
|
this.router.events
|
||||||
.pipe(
|
.pipe(
|
||||||
filter((event) => event instanceof NavigationEnd),
|
filter((event) => event instanceof NavigationEnd),
|
||||||
takeUntil(this.onDestroy$)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
)
|
)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.hasActiveChildren = this.hasActiveLinks();
|
this.hasActiveChildren = this.hasActiveLinks();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
private getNavigationCommands(url: string): any[] {
|
private getNavigationCommands(url: string): any[] {
|
||||||
const urlTree = this.router.parseUrl(url);
|
const urlTree = this.router.parseUrl(url);
|
||||||
const urlSegmentGroup = urlTree.root.children[PRIMARY_OUTLET];
|
const urlSegmentGroup = urlTree.root.children[PRIMARY_OUTLET];
|
||||||
|
@ -22,12 +22,11 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, OnInit, ViewEncapsulation, OnDestroy } from '@angular/core';
|
import { Component, DestroyRef, inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { DynamicExtensionComponent, NavBarGroupRef, NavBarLinkRef } from '@alfresco/adf-extensions';
|
import { DynamicExtensionComponent, NavBarGroupRef, NavBarLinkRef } from '@alfresco/adf-extensions';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { AppStore, getSideNavState } from '@alfresco/aca-shared/store';
|
import { AppStore, getSideNavState } from '@alfresco/aca-shared/store';
|
||||||
import { Subject } from 'rxjs';
|
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
||||||
import { takeUntil, distinctUntilChanged, debounceTime } from 'rxjs/operators';
|
|
||||||
import { AppExtensionService, AppService, NavigationHistoryService } from '@alfresco/aca-shared';
|
import { AppExtensionService, AppService, NavigationHistoryService } from '@alfresco/aca-shared';
|
||||||
import { SidenavLayoutComponent } from '@alfresco/adf-core';
|
import { SidenavLayoutComponent } from '@alfresco/adf-core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
@ -35,6 +34,7 @@ import { SidenavHeaderComponent } from './components/sidenav-header.component';
|
|||||||
import { MatListModule } from '@angular/material/list';
|
import { MatListModule } from '@angular/material/list';
|
||||||
import { ExpandMenuComponent } from './components/expand-menu.component';
|
import { ExpandMenuComponent } from './components/expand-menu.component';
|
||||||
import { NavigationEnd } from '@angular/router';
|
import { NavigationEnd } from '@angular/router';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -45,7 +45,7 @@ import { NavigationEnd } from '@angular/router';
|
|||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
host: { class: 'app-sidenav' }
|
host: { class: 'app-sidenav' }
|
||||||
})
|
})
|
||||||
export class SidenavComponent implements OnInit, OnDestroy {
|
export class SidenavComponent implements OnInit {
|
||||||
@Input()
|
@Input()
|
||||||
data: {
|
data: {
|
||||||
layout?: SidenavLayoutComponent;
|
layout?: SidenavLayoutComponent;
|
||||||
@ -53,7 +53,8 @@ export class SidenavComponent implements OnInit, OnDestroy {
|
|||||||
} = {};
|
} = {};
|
||||||
|
|
||||||
groups: Array<NavBarGroupRef> = [];
|
groups: Array<NavBarGroupRef> = [];
|
||||||
private onDestroy$ = new Subject<boolean>();
|
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private store: Store<AppStore>,
|
private store: Store<AppStore>,
|
||||||
@ -65,17 +66,17 @@ export class SidenavComponent implements OnInit, OnDestroy {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.store
|
this.store
|
||||||
.select(getSideNavState)
|
.select(getSideNavState)
|
||||||
.pipe(debounceTime(300), distinctUntilChanged(), takeUntil(this.onDestroy$))
|
.pipe(debounceTime(300), distinctUntilChanged(), takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.groups = this.extensions.getApplicationNavigation(this.extensions.navbar);
|
this.groups = this.extensions.getApplicationNavigation(this.extensions.navbar);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.appService.setAppNavbarMode(this.data.mode);
|
this.appService.setAppNavbarMode(this.data.mode);
|
||||||
this.appService.toggleAppNavBar$.pipe(takeUntil(this.onDestroy$)).subscribe(() => this.toggleNavBar());
|
this.appService.toggleAppNavBar$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => this.toggleNavBar());
|
||||||
this.data.layout.expanded.pipe(takeUntil(this.onDestroy$)).subscribe(() => this.setNavBarMode());
|
this.data.layout.expanded.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => this.setNavBarMode());
|
||||||
this.navigationHistoryService
|
this.navigationHistoryService
|
||||||
.listenToRouteChanges()
|
.listenToRouteChanges()
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((event: NavigationEnd) => {
|
.subscribe((event: NavigationEnd) => {
|
||||||
this.navigationHistoryService.setHistory(event, 3);
|
this.navigationHistoryService.setHistory(event, 3);
|
||||||
});
|
});
|
||||||
@ -101,9 +102,4 @@ export class SidenavComponent implements OnInit, OnDestroy {
|
|||||||
this.data.layout.toggleMenu();
|
this.data.layout.toggleMenu();
|
||||||
this.setNavBarMode();
|
this.setNavBarMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -22,19 +22,19 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, ViewEncapsulation, OnInit, OnDestroy } from '@angular/core';
|
import { Component, DestroyRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { AppHookService } from '@alfresco/aca-shared';
|
import { AppHookService } from '@alfresco/aca-shared';
|
||||||
import { AppStore, getAppSelection } from '@alfresco/aca-shared/store';
|
import { AppStore, getAppSelection } from '@alfresco/aca-shared/store';
|
||||||
import { SelectionState } from '@alfresco/adf-extensions';
|
import { SelectionState } from '@alfresco/adf-extensions';
|
||||||
import { distinctUntilChanged, takeUntil } from 'rxjs/operators';
|
import { distinctUntilChanged } from 'rxjs/operators';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { Subject } from 'rxjs';
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { LibraryFavoriteDirective } from '@alfresco/adf-content-services';
|
import { LibraryFavoriteDirective } from '@alfresco/adf-content-services';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { MatMenuModule } from '@angular/material/menu';
|
import { MatMenuModule } from '@angular/material/menu';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -55,9 +55,10 @@ import { MatMenuModule } from '@angular/material/menu';
|
|||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
host: { class: 'app-toggle-favorite-library' }
|
host: { class: 'app-toggle-favorite-library' }
|
||||||
})
|
})
|
||||||
export class ToggleFavoriteLibraryComponent implements OnInit, OnDestroy {
|
export class ToggleFavoriteLibraryComponent implements OnInit {
|
||||||
library;
|
library;
|
||||||
private onDestroy$: Subject<void> = new Subject<void>();
|
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(private store: Store<AppStore>, private appHookService: AppHookService, private router: Router) {}
|
constructor(private store: Store<AppStore>, private appHookService: AppHookService, private router: Router) {}
|
||||||
|
|
||||||
@ -66,7 +67,7 @@ export class ToggleFavoriteLibraryComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this.store
|
this.store
|
||||||
.select(getAppSelection)
|
.select(getAppSelection)
|
||||||
.pipe(distinctUntilChanged(), takeUntil(this.onDestroy$))
|
.pipe(distinctUntilChanged(), takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((selection: SelectionState) => {
|
.subscribe((selection: SelectionState) => {
|
||||||
this.library = { ...selection.library };
|
this.library = { ...selection.library };
|
||||||
|
|
||||||
@ -77,11 +78,6 @@ export class ToggleFavoriteLibraryComponent implements OnInit, OnDestroy {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$.next();
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
onToggleEvent() {
|
onToggleEvent() {
|
||||||
this.appHookService.favoriteLibraryToggle.next();
|
this.appHookService.favoriteLibraryToggle.next();
|
||||||
}
|
}
|
||||||
|
@ -22,13 +22,14 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, OnDestroy, ViewEncapsulation } from '@angular/core';
|
import { Component, ViewEncapsulation } from '@angular/core';
|
||||||
import { Observable, Subject } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { delay, takeUntil } from 'rxjs/operators';
|
import { delay } from 'rxjs/operators';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { AppStore, getFileUploadingDialog } from '@alfresco/aca-shared/store';
|
import { AppStore, getFileUploadingDialog } from '@alfresco/aca-shared/store';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { UploadModule } from '@alfresco/adf-content-services';
|
import { UploadModule } from '@alfresco/adf-content-services';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -37,17 +38,10 @@ import { UploadModule } from '@alfresco/adf-content-services';
|
|||||||
templateUrl: './upload-files-dialog.component.html',
|
templateUrl: './upload-files-dialog.component.html',
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class UploadFilesDialogComponent implements OnDestroy {
|
export class UploadFilesDialogComponent {
|
||||||
showFileUploadingDialog$: Observable<boolean>;
|
showFileUploadingDialog$: Observable<boolean>;
|
||||||
|
|
||||||
private onDestroy$: Subject<boolean> = new Subject<boolean>();
|
|
||||||
|
|
||||||
constructor(private store: Store<AppStore>) {
|
constructor(private store: Store<AppStore>) {
|
||||||
this.showFileUploadingDialog$ = this.store.select(getFileUploadingDialog).pipe(delay(0), takeUntil(this.onDestroy$));
|
this.showFileUploadingDialog$ = this.store.select(getFileUploadingDialog).pipe(delay(0), takeUntilDestroyed());
|
||||||
}
|
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,18 +24,18 @@
|
|||||||
|
|
||||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||||
import { PeopleApi, Person } from '@alfresco/js-api';
|
import { PeopleApi, Person } from '@alfresco/js-api';
|
||||||
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
|
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { Observable, Subject, throwError } from 'rxjs';
|
import { Observable, throwError } from 'rxjs';
|
||||||
import { AppService } from '@alfresco/aca-shared';
|
import { AppService } from '@alfresco/aca-shared';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { MatDividerModule } from '@angular/material/divider';
|
import { MatDividerModule } from '@angular/material/divider';
|
||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -45,7 +45,7 @@ import { MatFormFieldModule } from '@angular/material/form-field';
|
|||||||
styleUrls: ['./view-profile.component.scss'],
|
styleUrls: ['./view-profile.component.scss'],
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class ViewProfileComponent implements OnInit, OnDestroy {
|
export class ViewProfileComponent implements OnInit {
|
||||||
peopleApi: PeopleApi;
|
peopleApi: PeopleApi;
|
||||||
|
|
||||||
profileForm: FormGroup;
|
profileForm: FormGroup;
|
||||||
@ -61,11 +61,10 @@ export class ViewProfileComponent implements OnInit, OnDestroy {
|
|||||||
contactSectionDropdown = false;
|
contactSectionDropdown = false;
|
||||||
contactSectionButtonsToggle = true;
|
contactSectionButtonsToggle = true;
|
||||||
appNavNarMode$: Observable<'collapsed' | 'expanded'>;
|
appNavNarMode$: Observable<'collapsed' | 'expanded'>;
|
||||||
private onDestroy$ = new Subject<boolean>();
|
|
||||||
|
|
||||||
constructor(private router: Router, apiService: AlfrescoApiService, private appService: AppService) {
|
constructor(private router: Router, apiService: AlfrescoApiService, private appService: AppService) {
|
||||||
this.peopleApi = new PeopleApi(apiService.getInstance());
|
this.peopleApi = new PeopleApi(apiService.getInstance());
|
||||||
this.appNavNarMode$ = appService.appNavNarMode$.pipe(takeUntil(this.onDestroy$));
|
this.appNavNarMode$ = appService.appNavNarMode$.pipe(takeUntilDestroyed());
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -205,9 +204,4 @@ export class ViewProfileComponent implements OnInit, OnDestroy {
|
|||||||
isSaveButtonDisabled(): boolean {
|
isSaveButtonDisabled(): boolean {
|
||||||
return this.profileForm.invalid;
|
return this.profileForm.invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
import { DocumentListDirective } from './document-list.directive';
|
import { DocumentListDirective } from './document-list.directive';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import { SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
import { SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
describe('DocumentListDirective', () => {
|
describe('DocumentListDirective', () => {
|
||||||
let documentListDirective: DocumentListDirective;
|
let documentListDirective: DocumentListDirective;
|
||||||
@ -74,6 +75,7 @@ describe('DocumentListDirective', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
TestBed.runInInjectionContext(() => {
|
||||||
documentListDirective = new DocumentListDirective(
|
documentListDirective = new DocumentListDirective(
|
||||||
storeMock,
|
storeMock,
|
||||||
documentListMock,
|
documentListMock,
|
||||||
@ -83,6 +85,7 @@ describe('DocumentListDirective', () => {
|
|||||||
documentListServiceMock as any
|
documentListServiceMock as any
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
storeMock.dispatch.calls.reset();
|
storeMock.dispatch.calls.reset();
|
||||||
|
@ -22,30 +22,30 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Directive, OnDestroy, OnInit, HostListener } from '@angular/core';
|
import { DestroyRef, Directive, HostListener, inject, OnInit } from '@angular/core';
|
||||||
import { DocumentListComponent, DocumentListService } from '@alfresco/adf-content-services';
|
import { DocumentListComponent, DocumentListService } from '@alfresco/adf-content-services';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { UserPreferencesService } from '@alfresco/adf-core';
|
import { UserPreferencesService } from '@alfresco/adf-core';
|
||||||
import { Subject } from 'rxjs';
|
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
import { SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||||
import { takeUntil, filter } from 'rxjs/operators';
|
import { filter } from 'rxjs/operators';
|
||||||
import { NodeEntry } from '@alfresco/js-api';
|
import { NodeEntry } from '@alfresco/js-api';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
selector: '[acaDocumentList]'
|
selector: '[acaDocumentList]'
|
||||||
})
|
})
|
||||||
export class DocumentListDirective implements OnInit, OnDestroy {
|
export class DocumentListDirective implements OnInit {
|
||||||
private isLibrary = false;
|
private isLibrary = false;
|
||||||
selectedNode: NodeEntry;
|
selectedNode: NodeEntry;
|
||||||
|
|
||||||
onDestroy$ = new Subject<boolean>();
|
|
||||||
|
|
||||||
get sortingPreferenceKey(): string {
|
get sortingPreferenceKey(): string {
|
||||||
return this.route.snapshot.data.sortingPreferenceKey;
|
return this.route.snapshot.data.sortingPreferenceKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private store: Store<any>,
|
private store: Store<any>,
|
||||||
private documentList: DocumentListComponent,
|
private documentList: DocumentListComponent,
|
||||||
@ -87,24 +87,19 @@ export class DocumentListDirective implements OnInit, OnDestroy {
|
|||||||
this.documentList.ready
|
this.documentList.ready
|
||||||
.pipe(
|
.pipe(
|
||||||
filter(() => !this.router.url.includes('viewer:view')),
|
filter(() => !this.router.url.includes('viewer:view')),
|
||||||
takeUntil(this.onDestroy$)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
)
|
)
|
||||||
.subscribe(() => this.onReady());
|
.subscribe(() => this.onReady());
|
||||||
|
|
||||||
this.documentListService.reload$.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
|
this.documentListService.reload$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
||||||
this.reload();
|
this.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.documentListService.resetSelection$.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
|
this.documentListService.resetSelection$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
||||||
this.reset();
|
this.reset();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
@HostListener('sorting-changed', ['$event'])
|
@HostListener('sorting-changed', ['$event'])
|
||||||
onSortingChanged(event: CustomEvent) {
|
onSortingChanged(event: CustomEvent) {
|
||||||
if (this.sortingPreferenceKey) {
|
if (this.sortingPreferenceKey) {
|
||||||
|
@ -22,25 +22,26 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, OnInit, OnDestroy, ViewEncapsulation, HostListener } from '@angular/core';
|
import { Component, HostListener, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { CommonModule, Location } from '@angular/common';
|
import { CommonModule, Location } from '@angular/common';
|
||||||
import { UrlTree, UrlSegmentGroup, UrlSegment, PRIMARY_OUTLET, ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute, PRIMARY_OUTLET, UrlSegment, UrlSegmentGroup, UrlTree } from '@angular/router';
|
||||||
import { debounceTime, map, takeUntil } from 'rxjs/operators';
|
import { debounceTime, map } from 'rxjs/operators';
|
||||||
import { ViewerModule } from '@alfresco/adf-core';
|
import { ViewerModule } from '@alfresco/adf-core';
|
||||||
import { ClosePreviewAction, ViewerActionTypes, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
import { ClosePreviewAction, SetSelectedNodesAction, ViewerActionTypes } from '@alfresco/aca-shared/store';
|
||||||
import {
|
import {
|
||||||
PageComponent,
|
|
||||||
AppHookService,
|
AppHookService,
|
||||||
ContentApiService,
|
ContentApiService,
|
||||||
InfoDrawerComponent,
|
InfoDrawerComponent,
|
||||||
ToolbarMenuItemComponent,
|
PageComponent,
|
||||||
ToolbarComponent
|
ToolbarComponent,
|
||||||
|
ToolbarMenuItemComponent
|
||||||
} from '@alfresco/aca-shared';
|
} from '@alfresco/aca-shared';
|
||||||
import { ContentActionRef } from '@alfresco/adf-extensions';
|
import { ContentActionRef } from '@alfresco/adf-extensions';
|
||||||
import { from } from 'rxjs';
|
import { from } from 'rxjs';
|
||||||
import { Actions, ofType } from '@ngrx/effects';
|
import { Actions, ofType } from '@ngrx/effects';
|
||||||
import { AlfrescoViewerModule, NodesApiService } from '@alfresco/adf-content-services';
|
import { AlfrescoViewerModule, NodesApiService } from '@alfresco/adf-content-services';
|
||||||
import { ViewerService } from '../../services/viewer.service';
|
import { ViewerService } from '../../services/viewer.service';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -51,7 +52,7 @@ import { ViewerService } from '../../services/viewer.service';
|
|||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
host: { class: 'app-preview' }
|
host: { class: 'app-preview' }
|
||||||
})
|
})
|
||||||
export class PreviewComponent extends PageComponent implements OnInit, OnDestroy {
|
export class PreviewComponent extends PageComponent implements OnInit {
|
||||||
folderId: string = null;
|
folderId: string = null;
|
||||||
navigateBackAsClose = false;
|
navigateBackAsClose = false;
|
||||||
navigateMultiple = false;
|
navigateMultiple = false;
|
||||||
@ -84,7 +85,7 @@ export class PreviewComponent extends PageComponent implements OnInit, OnDestroy
|
|||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
|
|
||||||
from(this.infoDrawerOpened$)
|
from(this.infoDrawerOpened$)
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((val) => {
|
.subscribe((val) => {
|
||||||
this.showRightSide = val;
|
this.showRightSide = val;
|
||||||
});
|
});
|
||||||
@ -131,16 +132,12 @@ export class PreviewComponent extends PageComponent implements OnInit, OnDestroy
|
|||||||
|
|
||||||
this.extensions
|
this.extensions
|
||||||
.getOpenWithActions()
|
.getOpenWithActions()
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((actions) => {
|
.subscribe((actions) => {
|
||||||
this.openWith = actions;
|
this.openWith = actions;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
super.ngOnDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the particular node into the Viewer
|
* Loads the particular node into the Viewer
|
||||||
*
|
*
|
||||||
|
@ -44,16 +44,17 @@ import {
|
|||||||
} from '@alfresco/aca-shared/store';
|
} from '@alfresco/aca-shared/store';
|
||||||
import { ContentActionRef, SelectionState } from '@alfresco/adf-extensions';
|
import { ContentActionRef, SelectionState } from '@alfresco/adf-extensions';
|
||||||
import { Node, VersionEntry, VersionsApi } from '@alfresco/js-api';
|
import { Node, VersionEntry, VersionsApi } from '@alfresco/js-api';
|
||||||
import { Component, HostListener, inject, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, DestroyRef, HostListener, inject, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { ActivatedRoute, PRIMARY_OUTLET, Router } from '@angular/router';
|
import { ActivatedRoute, PRIMARY_OUTLET, Router } from '@angular/router';
|
||||||
import { ViewerOpenWithComponent, ViewerSidebarComponent, ViewerToolbarActionsComponent } from '@alfresco/adf-core';
|
import { ViewerOpenWithComponent, ViewerSidebarComponent, ViewerToolbarActionsComponent } from '@alfresco/adf-core';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { from, Observable, Subject } from 'rxjs';
|
import { from, Observable } from 'rxjs';
|
||||||
import { debounceTime, takeUntil } from 'rxjs/operators';
|
import { debounceTime } from 'rxjs/operators';
|
||||||
import { Actions, ofType } from '@ngrx/effects';
|
import { Actions, ofType } from '@ngrx/effects';
|
||||||
import { AlfrescoApiService, AlfrescoViewerComponent, DocumentListService, NodesApiService, UploadService } from '@alfresco/adf-content-services';
|
import { AlfrescoApiService, AlfrescoViewerComponent, DocumentListService, NodesApiService, UploadService } from '@alfresco/adf-content-services';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { ViewerService } from '../../services/viewer.service';
|
import { ViewerService } from '../../services/viewer.service';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -84,8 +85,6 @@ export class AcaViewerComponent implements OnInit, OnDestroy {
|
|||||||
return this._versionsApi;
|
return this._versionsApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
onDestroy$ = new Subject<boolean>();
|
|
||||||
|
|
||||||
fileName: string;
|
fileName: string;
|
||||||
folderId: string = null;
|
folderId: string = null;
|
||||||
infoDrawerOpened$: Observable<boolean>;
|
infoDrawerOpened$: Observable<boolean>;
|
||||||
@ -106,6 +105,8 @@ export class AcaViewerComponent implements OnInit, OnDestroy {
|
|||||||
private previewLocation: string;
|
private previewLocation: string;
|
||||||
private containersSkipNavigation = ['adf-viewer__sidebar', 'cdk-overlay-container', 'adf-image-viewer'];
|
private containersSkipNavigation = ['adf-viewer__sidebar', 'cdk-overlay-container', 'adf-image-viewer'];
|
||||||
|
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private actions$: Actions,
|
private actions$: Actions,
|
||||||
private apiService: AlfrescoApiService,
|
private apiService: AlfrescoApiService,
|
||||||
@ -124,28 +125,28 @@ export class AcaViewerComponent implements OnInit, OnDestroy {
|
|||||||
this.infoDrawerOpened$ = this.store.select(isInfoDrawerOpened);
|
this.infoDrawerOpened$ = this.store.select(isInfoDrawerOpened);
|
||||||
|
|
||||||
from(this.infoDrawerOpened$)
|
from(this.infoDrawerOpened$)
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((val) => {
|
.subscribe((val) => {
|
||||||
this.showRightSide = val;
|
this.showRightSide = val;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.store
|
this.store
|
||||||
.select(getAppSelection)
|
.select(getAppSelection)
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((selection) => {
|
.subscribe((selection) => {
|
||||||
this.selection = selection;
|
this.selection = selection;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.extensions
|
this.extensions
|
||||||
.getViewerToolbarActions()
|
.getViewerToolbarActions()
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((actions) => {
|
.subscribe((actions) => {
|
||||||
this.toolbarActions = actions;
|
this.toolbarActions = actions;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.extensions
|
this.extensions
|
||||||
.getOpenWithActions()
|
.getOpenWithActions()
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((actions) => {
|
.subscribe((actions) => {
|
||||||
this.openWith = actions;
|
this.openWith = actions;
|
||||||
});
|
});
|
||||||
@ -177,23 +178,23 @@ export class AcaViewerComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.actions$.pipe(ofType<ClosePreviewAction>(ViewerActionTypes.ClosePreview), takeUntil(this.onDestroy$)).subscribe(() => {
|
this.actions$.pipe(ofType<ClosePreviewAction>(ViewerActionTypes.ClosePreview), takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
||||||
this.store.dispatch(new SetCurrentNodeVersionAction(null));
|
this.store.dispatch(new SetCurrentNodeVersionAction(null));
|
||||||
this.navigateToFileLocation();
|
this.navigateToFileLocation();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.actions$
|
this.actions$
|
||||||
.pipe(ofType<RefreshPreviewAction>(ViewerActionTypes.RefreshPreview), takeUntil(this.onDestroy$))
|
.pipe(ofType<RefreshPreviewAction>(ViewerActionTypes.RefreshPreview), takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((action: RefreshPreviewAction) => {
|
.subscribe((action: RefreshPreviewAction) => {
|
||||||
this.nodesApiService.nodeUpdated.next(action.node);
|
this.nodesApiService.nodeUpdated.next(action.node);
|
||||||
void this.displayNode(action.node.id);
|
void this.displayNode(action.node.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.appHookService.nodesDeleted.pipe(takeUntil(this.onDestroy$)).subscribe(() => this.navigateToFileLocation());
|
this.appHookService.nodesDeleted.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => this.navigateToFileLocation());
|
||||||
|
|
||||||
this.uploadService.fileUploadDeleted.pipe(takeUntil(this.onDestroy$)).subscribe(() => this.navigateToFileLocation());
|
this.uploadService.fileUploadDeleted.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => this.navigateToFileLocation());
|
||||||
|
|
||||||
this.uploadService.fileUploadComplete.pipe(debounceTime(300), takeUntil(this.onDestroy$)).subscribe((file) => {
|
this.uploadService.fileUploadComplete.pipe(debounceTime(300), takeUntilDestroyed(this.destroyRef)).subscribe((file) => {
|
||||||
this.nodesApiService.nodeUpdated.next(file.data.entry);
|
this.nodesApiService.nodeUpdated.next(file.data.entry);
|
||||||
void this.displayNode(file.data.entry.id);
|
void this.displayNode(file.data.entry.id);
|
||||||
});
|
});
|
||||||
@ -208,8 +209,6 @@ export class AcaViewerComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.store.dispatch(new SetCurrentNodeVersionAction(null));
|
this.store.dispatch(new SetCurrentNodeVersionAction(null));
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
trackByActionId(_: number, obj: ContentActionRef): string {
|
trackByActionId(_: number, obj: ContentActionRef): string {
|
||||||
|
@ -32,20 +32,19 @@ import {
|
|||||||
} from '@alfresco/adf-content-services';
|
} from '@alfresco/adf-content-services';
|
||||||
import { ShowHeaderMode, UserPreferencesService } from '@alfresco/adf-core';
|
import { ShowHeaderMode, UserPreferencesService } from '@alfresco/adf-core';
|
||||||
import { ContentActionRef, DocumentListPresetRef, SelectionState } from '@alfresco/adf-extensions';
|
import { ContentActionRef, DocumentListPresetRef, SelectionState } from '@alfresco/adf-extensions';
|
||||||
import { OnDestroy, OnInit, OnChanges, ViewChild, SimpleChanges, Directive, inject, HostListener } from '@angular/core';
|
import { DestroyRef, Directive, HostListener, inject, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewChild } from '@angular/core';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { NodeEntry, Node, NodePaging } from '@alfresco/js-api';
|
import { Node, NodeEntry, NodePaging } from '@alfresco/js-api';
|
||||||
import { Observable, Subject, Subscription } from 'rxjs';
|
import { Observable, Subscription } from 'rxjs';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
|
||||||
import { DocumentBasePageService } from './document-base-page.service';
|
import { DocumentBasePageService } from './document-base-page.service';
|
||||||
import {
|
import {
|
||||||
AppStore,
|
AppStore,
|
||||||
getCurrentFolder,
|
|
||||||
getAppSelection,
|
getAppSelection,
|
||||||
|
getCurrentFolder,
|
||||||
isInfoDrawerOpened,
|
isInfoDrawerOpened,
|
||||||
|
SetSelectedNodesAction,
|
||||||
ViewNodeAction,
|
ViewNodeAction,
|
||||||
ViewNodeExtras,
|
ViewNodeExtras
|
||||||
SetSelectedNodesAction
|
|
||||||
} from '@alfresco/aca-shared/store';
|
} from '@alfresco/aca-shared/store';
|
||||||
import { AppExtensionService } from '../../services/app.extension.service';
|
import { AppExtensionService } from '../../services/app.extension.service';
|
||||||
import { isLibrary, isLocked } from '../../utils/node.utils';
|
import { isLibrary, isLocked } from '../../utils/node.utils';
|
||||||
@ -54,12 +53,11 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
|||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { AppSettingsService } from '../../services/app-settings.service';
|
import { AppSettingsService } from '../../services/app-settings.service';
|
||||||
import { NavigationHistoryService } from '../../services/navigation-history.service';
|
import { NavigationHistoryService } from '../../services/navigation-history.service';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
/* eslint-disable @angular-eslint/directive-class-suffix */
|
/* eslint-disable @angular-eslint/directive-class-suffix */
|
||||||
@Directive()
|
@Directive()
|
||||||
export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
|
export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
onDestroy$: Subject<void> = new Subject<void>();
|
|
||||||
|
|
||||||
@ViewChild(DocumentListComponent)
|
@ViewChild(DocumentListComponent)
|
||||||
documentList: DocumentListComponent;
|
documentList: DocumentListComponent;
|
||||||
|
|
||||||
@ -90,6 +88,9 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
|
|||||||
protected router = inject(Router);
|
protected router = inject(Router);
|
||||||
protected userPreferencesService = inject(UserPreferencesService);
|
protected userPreferencesService = inject(UserPreferencesService);
|
||||||
protected searchAiService = inject(SearchAiService);
|
protected searchAiService = inject(SearchAiService);
|
||||||
|
|
||||||
|
protected readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
private autoDownloadService = inject(AutoDownloadService, { optional: true });
|
private autoDownloadService = inject(AutoDownloadService, { optional: true });
|
||||||
private navigationHistoryService = inject(NavigationHistoryService);
|
private navigationHistoryService = inject(NavigationHistoryService);
|
||||||
|
|
||||||
@ -106,7 +107,7 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.extensions
|
this.extensions
|
||||||
.getCreateActions()
|
.getCreateActions()
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((actions) => {
|
.subscribe((actions) => {
|
||||||
this.createActions = actions;
|
this.createActions = actions;
|
||||||
});
|
});
|
||||||
@ -115,7 +116,7 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
|
|||||||
|
|
||||||
this.store
|
this.store
|
||||||
.select(getAppSelection)
|
.select(getAppSelection)
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((selection) => {
|
.subscribe((selection) => {
|
||||||
this.selection = selection;
|
this.selection = selection;
|
||||||
this.canUpdateNode = this.selection.count === 1 && this.content.canUpdateNode(selection.first);
|
this.canUpdateNode = this.selection.count === 1 && this.content.canUpdateNode(selection.first);
|
||||||
@ -123,41 +124,41 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
|
|||||||
|
|
||||||
this.extensions
|
this.extensions
|
||||||
.getAllowedToolbarActions()
|
.getAllowedToolbarActions()
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((actions) => {
|
.subscribe((actions) => {
|
||||||
this.actions = actions;
|
this.actions = actions;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.extensions
|
this.extensions
|
||||||
.getBulkActions()
|
.getBulkActions()
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((actions) => {
|
.subscribe((actions) => {
|
||||||
this.bulkActions = actions;
|
this.bulkActions = actions;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.extensions
|
this.extensions
|
||||||
.getViewerToolbarActions()
|
.getViewerToolbarActions()
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((actions) => {
|
.subscribe((actions) => {
|
||||||
this.viewerToolbarActions = actions;
|
this.viewerToolbarActions = actions;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.store
|
this.store
|
||||||
.select(getCurrentFolder)
|
.select(getCurrentFolder)
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((node) => {
|
.subscribe((node) => {
|
||||||
this.canUpload = node && this.content.canUploadContent(node);
|
this.canUpload = node && this.content.canUploadContent(node);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.breakpointObserver
|
this.breakpointObserver
|
||||||
.observe([Breakpoints.HandsetPortrait, Breakpoints.HandsetLandscape])
|
.observe([Breakpoints.HandsetPortrait, Breakpoints.HandsetLandscape])
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((result) => {
|
.subscribe((result) => {
|
||||||
this.isSmallScreen = result.matches;
|
this.isSmallScreen = result.matches;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.searchAiService.toggleSearchAiInput$
|
this.searchAiService.toggleSearchAiInput$
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((searchAiInputState) => (this._searchAiInputState = searchAiInputState));
|
.subscribe((searchAiInputState) => (this._searchAiInputState = searchAiInputState));
|
||||||
|
|
||||||
this.setKnowledgeRetrievalState();
|
this.setKnowledgeRetrievalState();
|
||||||
@ -173,8 +174,6 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
|
|||||||
this.subscriptions.forEach((subscription) => subscription.unsubscribe());
|
this.subscriptions.forEach((subscription) => subscription.unsubscribe());
|
||||||
this.subscriptions = [];
|
this.subscriptions = [];
|
||||||
|
|
||||||
this.onDestroy$.next();
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
this.store.dispatch(new SetSelectedNodesAction([]));
|
this.store.dispatch(new SetSelectedNodesAction([]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,15 +22,13 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, HostListener, Input, OnChanges, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, DestroyRef, HostListener, inject, Input, OnChanges, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { NodeEntry, Node, SiteEntry } from '@alfresco/js-api';
|
import { Node, NodeEntry, SiteEntry } from '@alfresco/js-api';
|
||||||
import { ContentActionRef, DynamicTabComponent, SidebarTabRef } from '@alfresco/adf-extensions';
|
import { ContentActionRef, DynamicTabComponent, SidebarTabRef } from '@alfresco/adf-extensions';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { SetInfoDrawerStateAction, ToggleInfoDrawerAction, infoDrawerPreview } from '@alfresco/aca-shared/store';
|
import { infoDrawerPreview, SetInfoDrawerStateAction, ToggleInfoDrawerAction } from '@alfresco/aca-shared/store';
|
||||||
import { AppExtensionService } from '../../services/app.extension.service';
|
import { AppExtensionService } from '../../services/app.extension.service';
|
||||||
import { ContentApiService } from '../../services/content-api.service';
|
import { ContentApiService } from '../../services/content-api.service';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
|
||||||
import { Subject } from 'rxjs';
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||||
import { InfoDrawerModule } from '@alfresco/adf-core';
|
import { InfoDrawerModule } from '@alfresco/adf-core';
|
||||||
@ -38,6 +36,7 @@ import { TranslateModule } from '@ngx-translate/core';
|
|||||||
import { A11yModule } from '@angular/cdk/a11y';
|
import { A11yModule } from '@angular/cdk/a11y';
|
||||||
import { ToolbarComponent } from '../toolbar/toolbar.component';
|
import { ToolbarComponent } from '../toolbar/toolbar.component';
|
||||||
import { ContentService, NodesApiService } from '@alfresco/adf-content-services';
|
import { ContentService, NodesApiService } from '@alfresco/adf-content-services';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -57,7 +56,7 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
displayNode: Node | SiteEntry;
|
displayNode: Node | SiteEntry;
|
||||||
tabs: Array<SidebarTabRef> = [];
|
tabs: Array<SidebarTabRef> = [];
|
||||||
actions: Array<ContentActionRef> = [];
|
actions: Array<ContentActionRef> = [];
|
||||||
onDestroy$ = new Subject<boolean>();
|
|
||||||
preventFromClosing = false;
|
preventFromClosing = false;
|
||||||
icon: string = null;
|
icon: string = null;
|
||||||
|
|
||||||
@ -66,6 +65,8 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private store: Store<any>,
|
private store: Store<any>,
|
||||||
private contentApi: ContentApiService,
|
private contentApi: ContentApiService,
|
||||||
@ -78,26 +79,24 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
this.tabs = this.extensions.getSidebarTabs();
|
this.tabs = this.extensions.getSidebarTabs();
|
||||||
this.extensions
|
this.extensions
|
||||||
.getAllowedSidebarActions()
|
.getAllowedSidebarActions()
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((actions) => {
|
.subscribe((actions) => {
|
||||||
this.actions = actions;
|
this.actions = actions;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.store
|
this.store
|
||||||
.select(infoDrawerPreview)
|
.select(infoDrawerPreview)
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((isInfoDrawerPreviewOpened) => {
|
.subscribe((isInfoDrawerPreviewOpened) => {
|
||||||
this.preventFromClosing = isInfoDrawerPreviewOpened;
|
this.preventFromClosing = isInfoDrawerPreviewOpened;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.nodesService.nodeUpdated.pipe(takeUntil(this.onDestroy$)).subscribe((node: any) => {
|
this.nodesService.nodeUpdated.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((node: any) => {
|
||||||
this.node.entry = node;
|
this.node.entry = node;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
if (!this.preventFromClosing) {
|
if (!this.preventFromClosing) {
|
||||||
this.store.dispatch(new SetInfoDrawerStateAction(false));
|
this.store.dispatch(new SetInfoDrawerStateAction(false));
|
||||||
}
|
}
|
||||||
|
@ -22,14 +22,14 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, ViewEncapsulation, Input, OnDestroy } from '@angular/core';
|
import { Component, Input, ViewEncapsulation } from '@angular/core';
|
||||||
import { Observable, Subject } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
|
||||||
import { AppService } from '../../services/app.service';
|
import { AppService } from '../../services/app.service';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -40,23 +40,17 @@ import { MatIconModule } from '@angular/material/icon';
|
|||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
host: { class: 'aca-page-layout' }
|
host: { class: 'aca-page-layout' }
|
||||||
})
|
})
|
||||||
export class PageLayoutComponent implements OnDestroy {
|
export class PageLayoutComponent {
|
||||||
@Input()
|
@Input()
|
||||||
hasError = false;
|
hasError = false;
|
||||||
|
|
||||||
private onDestroy$ = new Subject<boolean>();
|
|
||||||
appNavNarMode$: Observable<'collapsed' | 'expanded'>;
|
appNavNarMode$: Observable<'collapsed' | 'expanded'>;
|
||||||
|
|
||||||
constructor(private appService: AppService) {
|
constructor(private appService: AppService) {
|
||||||
this.appNavNarMode$ = appService.appNavNarMode$.pipe(takeUntil(this.onDestroy$));
|
this.appNavNarMode$ = appService.appNavNarMode$.pipe(takeUntilDestroyed());
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleClick() {
|
toggleClick() {
|
||||||
this.appService.toggleAppNavBar$.next();
|
this.appService.toggleAppNavBar$.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,9 @@
|
|||||||
import { ContextActionsDirective } from './contextmenu.directive';
|
import { ContextActionsDirective } from './contextmenu.directive';
|
||||||
import { ContextMenu, CustomContextMenu } from '@alfresco/aca-shared/store';
|
import { ContextMenu, CustomContextMenu } from '@alfresco/aca-shared/store';
|
||||||
import { ContentActionRef, ContentActionType } from '@alfresco/adf-extensions';
|
import { ContentActionRef, ContentActionType } from '@alfresco/adf-extensions';
|
||||||
import { fakeAsync, tick } from '@angular/core/testing';
|
import { fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
import { Injector, runInInjectionContext } from '@angular/core';
|
||||||
|
|
||||||
const customActionsMock: ContentActionRef[] = [
|
const customActionsMock: ContentActionRef[] = [
|
||||||
{
|
{
|
||||||
@ -46,8 +48,14 @@ describe('ContextActionsDirective', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [ContextActionsDirective],
|
||||||
|
providers: [{ provide: Store, useValue: storeMock }]
|
||||||
|
});
|
||||||
|
runInInjectionContext(TestBed.inject(Injector), () => {
|
||||||
directive = new ContextActionsDirective(storeMock);
|
directive = new ContextActionsDirective(storeMock);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should not render context menu when `enabled` property is false', () => {
|
it('should not render context menu when `enabled` property is false', () => {
|
||||||
spyOn(directive, 'execute').and.stub();
|
spyOn(directive, 'execute').and.stub();
|
||||||
|
@ -22,22 +22,20 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Directive, HostListener, Input, OnInit, OnDestroy } from '@angular/core';
|
import { DestroyRef, Directive, HostListener, inject, Input, OnInit } from '@angular/core';
|
||||||
import { debounceTime, takeUntil } from 'rxjs/operators';
|
import { debounceTime } from 'rxjs/operators';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { AppStore, ContextMenu, CustomContextMenu } from '@alfresco/aca-shared/store';
|
import { AppStore, ContextMenu, CustomContextMenu } from '@alfresco/aca-shared/store';
|
||||||
import { ContentActionRef } from '@alfresco/adf-extensions';
|
import { ContentActionRef } from '@alfresco/adf-extensions';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
selector: '[acaContextActions]',
|
selector: '[acaContextActions]',
|
||||||
exportAs: 'acaContextActions'
|
exportAs: 'acaContextActions'
|
||||||
})
|
})
|
||||||
export class ContextActionsDirective implements OnInit, OnDestroy {
|
export class ContextActionsDirective implements OnInit {
|
||||||
private execute$: Subject<any> = new Subject();
|
|
||||||
onDestroy$: Subject<boolean> = new Subject<boolean>();
|
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
@Input('acaContextEnable')
|
@Input('acaContextEnable')
|
||||||
enabled = true;
|
enabled = true;
|
||||||
@ -59,10 +57,14 @@ export class ContextActionsDirective implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private execute$: Subject<any> = new Subject();
|
||||||
|
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(private store: Store<AppStore>) {}
|
constructor(private store: Store<AppStore>) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.execute$.pipe(debounceTime(300), takeUntil(this.onDestroy$)).subscribe((event: MouseEvent) => {
|
this.execute$.pipe(debounceTime(300), takeUntilDestroyed(this.destroyRef)).subscribe((event: MouseEvent) => {
|
||||||
if (this.customActions?.length) {
|
if (this.customActions?.length) {
|
||||||
this.store.dispatch(new CustomContextMenu(event, this.customActions));
|
this.store.dispatch(new CustomContextMenu(event, this.customActions));
|
||||||
} else {
|
} else {
|
||||||
@ -70,12 +72,6 @@ export class ContextActionsDirective implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
execute(event: MouseEvent, target: Element) {
|
execute(event: MouseEvent, target: Element) {
|
||||||
if (!this.isSelected(target)) {
|
if (!this.isSelected(target)) {
|
||||||
target.dispatchEvent(new MouseEvent('click'));
|
target.dispatchEvent(new MouseEvent('click'));
|
||||||
|
@ -23,10 +23,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { PaginationDirective } from './pagination.directive';
|
import { PaginationDirective } from './pagination.directive';
|
||||||
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { UserPreferencesService, AppConfigService, PaginationComponent, PaginationModel } from '@alfresco/adf-core';
|
import { AppConfigService, PaginationComponent, PaginationModel, UserPreferencesService } from '@alfresco/adf-core';
|
||||||
import { initialState, LibTestingModule } from '../testing/lib-testing-module';
|
import { initialState, LibTestingModule } from '../testing/lib-testing-module';
|
||||||
import { provideMockStore } from '@ngrx/store/testing';
|
import { provideMockStore } from '@ngrx/store/testing';
|
||||||
|
import { Injector, runInInjectionContext } from '@angular/core';
|
||||||
|
|
||||||
describe('PaginationDirective', () => {
|
describe('PaginationDirective', () => {
|
||||||
let preferences: UserPreferencesService;
|
let preferences: UserPreferencesService;
|
||||||
@ -45,12 +46,13 @@ describe('PaginationDirective', () => {
|
|||||||
config = TestBed.inject(AppConfigService);
|
config = TestBed.inject(AppConfigService);
|
||||||
fixture = TestBed.createComponent(PaginationComponent);
|
fixture = TestBed.createComponent(PaginationComponent);
|
||||||
pagination = fixture.componentInstance;
|
pagination = fixture.componentInstance;
|
||||||
|
runInInjectionContext(TestBed.inject(Injector), () => {
|
||||||
directive = new PaginationDirective(pagination, preferences, config);
|
directive = new PaginationDirective(pagination, preferences, config);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
fixture.destroy();
|
fixture.destroy();
|
||||||
directive.ngOnDestroy();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should setup supported page sizes from app config', () => {
|
it('should setup supported page sizes from app config', () => {
|
||||||
|
@ -22,31 +22,23 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Directive, OnInit, OnDestroy } from '@angular/core';
|
import { DestroyRef, Directive, inject, OnInit } from '@angular/core';
|
||||||
import { PaginationComponent, UserPreferencesService, PaginationModel, AppConfigService } from '@alfresco/adf-core';
|
import { AppConfigService, PaginationComponent, PaginationModel, UserPreferencesService } from '@alfresco/adf-core';
|
||||||
import { Subscription } from 'rxjs';
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
selector: '[acaPagination]'
|
selector: '[acaPagination]'
|
||||||
})
|
})
|
||||||
export class PaginationDirective implements OnInit, OnDestroy {
|
export class PaginationDirective implements OnInit {
|
||||||
private subscriptions: Subscription[] = [];
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(private pagination: PaginationComponent, private preferences: UserPreferencesService, private config: AppConfigService) {}
|
constructor(private pagination: PaginationComponent, private preferences: UserPreferencesService, private config: AppConfigService) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.pagination.supportedPageSizes = this.config.get('pagination.supportedPageSizes');
|
this.pagination.supportedPageSizes = this.config.get('pagination.supportedPageSizes');
|
||||||
|
this.pagination.changePageSize.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event: PaginationModel) => {
|
||||||
this.subscriptions.push(
|
|
||||||
this.pagination.changePageSize.subscribe((event: PaginationModel) => {
|
|
||||||
this.preferences.paginationSize = event.maxItems;
|
this.preferences.paginationSize = event.maxItems;
|
||||||
})
|
});
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.subscriptions.forEach((subscription) => subscription.unsubscribe());
|
|
||||||
this.subscriptions = [];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,20 +22,20 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { inject, Injectable, OnDestroy } from '@angular/core';
|
import { inject, Injectable } from '@angular/core';
|
||||||
import { AuthenticationService, AppConfigService, PageTitleService, UserPreferencesService, NotificationService } from '@alfresco/adf-core';
|
import { AppConfigService, AuthenticationService, NotificationService, PageTitleService, UserPreferencesService } from '@alfresco/adf-core';
|
||||||
import { Observable, BehaviorSubject, Subject } from 'rxjs';
|
import { BehaviorSubject, Observable, Subject } from 'rxjs';
|
||||||
import {
|
import {
|
||||||
AlfrescoApiService,
|
AlfrescoApiService,
|
||||||
|
FileUploadErrorEvent,
|
||||||
SearchQueryBuilderService,
|
SearchQueryBuilderService,
|
||||||
SharedLinksApiService,
|
SharedLinksApiService,
|
||||||
UploadService,
|
UploadService
|
||||||
FileUploadErrorEvent
|
|
||||||
} from '@alfresco/adf-content-services';
|
} from '@alfresco/adf-content-services';
|
||||||
import { OverlayContainer } from '@angular/cdk/overlay';
|
import { OverlayContainer } from '@angular/cdk/overlay';
|
||||||
import { ActivatedRoute, ActivationEnd, NavigationStart, Router } from '@angular/router';
|
import { ActivatedRoute, ActivationEnd, NavigationStart, Router } from '@angular/router';
|
||||||
import { filter, map } from 'rxjs/operators';
|
import { filter, map } from 'rxjs/operators';
|
||||||
import { AppStore, SetCurrentUrlAction, SetRepositoryInfoAction, SetUserProfileAction, ResetSelectionAction } from '@alfresco/aca-shared/store';
|
import { AppStore, ResetSelectionAction, SetCurrentUrlAction, SetRepositoryInfoAction, SetUserProfileAction } from '@alfresco/aca-shared/store';
|
||||||
import { ContentApiService } from './content-api.service';
|
import { ContentApiService } from './content-api.service';
|
||||||
import { RouterExtensionService } from './router.extension.service';
|
import { RouterExtensionService } from './router.extension.service';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
@ -50,7 +50,7 @@ import { MatDialog } from '@angular/material/dialog';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
// After moving shell to ADF to core, AppService will implement ShellAppService
|
// After moving shell to ADF to core, AppService will implement ShellAppService
|
||||||
export class AppService implements ShellAppService, OnDestroy {
|
export class AppService implements ShellAppService {
|
||||||
private notificationService = inject(NotificationService);
|
private notificationService = inject(NotificationService);
|
||||||
private matDialog = inject(MatDialog);
|
private matDialog = inject(MatDialog);
|
||||||
private ready: BehaviorSubject<boolean>;
|
private ready: BehaviorSubject<boolean>;
|
||||||
@ -67,8 +67,6 @@ export class AppService implements ShellAppService, OnDestroy {
|
|||||||
hideSidenavConditions = ['/preview/'];
|
hideSidenavConditions = ['/preview/'];
|
||||||
minimizeSidenavConditions = ['/search'];
|
minimizeSidenavConditions = ['/search'];
|
||||||
|
|
||||||
onDestroy$ = new Subject<boolean>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether `withCredentials` mode is enabled.
|
* Whether `withCredentials` mode is enabled.
|
||||||
* Usually means that `Kerberos` mode is used.
|
* Usually means that `Kerberos` mode is used.
|
||||||
@ -121,11 +119,6 @@ export class AppService implements ShellAppService, OnDestroy {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
|
||||||
this.onDestroy$.next(true);
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
init(): void {
|
init(): void {
|
||||||
this.alfrescoApiService.getInstance().on('error', (error: { status: number; response: any }) => {
|
this.alfrescoApiService.getInstance().on('error', (error: { status: number; response: any }) => {
|
||||||
if (error.status === 401 && !this.alfrescoApiService.isExcludedErrorListener(error?.response?.req?.url)) {
|
if (error.status === 401 && !this.alfrescoApiService.isExcludedErrorListener(error?.response?.req?.url)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user