Skip to content

Commit

Permalink
code fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DenysVuika committed Aug 16, 2023
1 parent ff908b1 commit e8121a5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,10 @@

import { Injectable } from '@angular/core';
import { AlfrescoApi } from '@alfresco/js-api';
import { ReplaySubject } from 'rxjs';
import { AlfrescoApiService } from '@alfresco/adf-core';

@Injectable({ providedIn: 'root' })
export class ExternalAlfrescoApiService {
alfrescoApiInitialized: ReplaySubject<boolean> = new ReplaySubject(1);
protected alfrescoApi: AlfrescoApi;

getInstance(): AlfrescoApi {
return this.alfrescoApi;
}

export class ExternalAlfrescoApiService extends AlfrescoApiService {
init(ecmHost: string, contextRoot: string) {
const domainPrefix = this.createPrefixFromHost(ecmHost);

Expand All @@ -38,11 +31,11 @@ export class ExternalAlfrescoApiService {
contextRoot,
domainPrefix
};
this.initAlfrescoApi(config);
this.setup(config);
this.alfrescoApiInitialized.next(true);
}

protected initAlfrescoApi(config) {
private setup(config) {
if (this.alfrescoApi) {
this.alfrescoApi.setConfig(config);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@

import { Component, Inject, ViewEncapsulation, ViewChild } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import {
AlfrescoApiService,
LoginDialogPanelComponent,
TranslationService,
AuthenticationService
} from '@alfresco/adf-core';
import { AlfrescoApiService, LoginDialogPanelComponent, TranslationService, AuthenticationService } from '@alfresco/adf-core';
import { AttachFileWidgetDialogComponentData } from './attach-file-widget-dialog-component.interface';
import { DocumentListService, SitesService, SearchService } from '@alfresco/adf-content-services';
import { ExternalAlfrescoApiService } from '../../services/external-alfresco-api.service';
Expand All @@ -38,10 +33,10 @@ import { Node } from '@alfresco/js-api';
DocumentListService,
SitesService,
SearchService,
{ provide: AlfrescoApiService, useClass: ExternalAlfrescoApiService } ]
{ provide: AlfrescoApiService, useClass: ExternalAlfrescoApiService }
]
})
export class AttachFileWidgetDialogComponent {

@ViewChild('adfLoginPanel')
loginPanel: LoginDialogPanelComponent;

Expand All @@ -50,12 +45,14 @@ export class AttachFileWidgetDialogComponent {
buttonActionName: string;
chosenNode: Node[];

constructor(private translation: TranslationService,
@Inject(MAT_DIALOG_DATA) public data: AttachFileWidgetDialogComponentData,
private externalApiService: AlfrescoApiService,
private authenticationService: AuthenticationService,
private matDialogRef: MatDialogRef<AttachFileWidgetDialogComponent>) {
(externalApiService as any).init(data.ecmHost, data.context);
constructor(
private translation: TranslationService,
@Inject(MAT_DIALOG_DATA) public data: AttachFileWidgetDialogComponentData,
private externalApiService: AlfrescoApiService,
private authenticationService: AuthenticationService,
private matDialogRef: MatDialogRef<AttachFileWidgetDialogComponent>
) {
(externalApiService as ExternalAlfrescoApiService).init(data.ecmHost, data.context);
this.action = data.actionName ? data.actionName.toUpperCase() : 'CHOOSE';
this.buttonActionName = `ATTACH-FILE.ACTIONS.${this.action}`;
this.updateTitle('DROPDOWN.MY_FILES_OPTION');
Expand Down

0 comments on commit e8121a5

Please sign in to comment.