mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-1103] Add custom tslint rules to avoid unwanted Class and File name prefix (#2087)
* custom tslint rules adf project name files * filename and class prefix rule * filename process service mock * fix spec filename * fix demo shell * rename mock * alias deprecated name class * core rename services * fix pacakge.json adf-rules * add exclude in whitelist
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
+ [1. Define the model for the custom type](#1-define-the-model-for-the-custom-type)
|
||||
+ [2. Define the component for the custom type](#2-define-the-component-for-the-custom-type)
|
||||
+ [3. Add you custom component to your module's entryComponents list](#3-add-you-custom-component-to-your-modules-entrycomponents-list)
|
||||
- [AlfrescoTranslationService](#alfrescotranslationservice)
|
||||
- [TranslationService](#translationservice)
|
||||
- [Renditions Service](#renditions-service)
|
||||
- [Build from sources](#build-from-sources)
|
||||
- [NPM scripts](#npm-scripts)
|
||||
@@ -419,12 +419,12 @@ The preferences are bound to a particular `prefix` so the application can switch
|
||||
For example upon login you can set the `prefix` as current username:
|
||||
|
||||
```ts
|
||||
import { UserPreferencesService, AlfrescoAuthenticationService } from 'ng2-alfresco-core';
|
||||
import { UserPreferencesService, AuthenticationService } from 'ng2-alfresco-core';
|
||||
|
||||
@Component({...})
|
||||
class AppComponent {
|
||||
constructor(private userPreferences: UserPreferencesService,
|
||||
private authService: AlfrescoAuthenticationService) {
|
||||
private authService: AuthenticationService) {
|
||||
}
|
||||
|
||||
onLoggedIn() {
|
||||
@@ -583,12 +583,12 @@ The authentication service is used inside the [login component](../ng2-alfresco-
|
||||
**app.component.ts**
|
||||
|
||||
```ts
|
||||
import { AlfrescoAuthenticationService } from 'ng2-alfresco-core';
|
||||
import { AuthenticationService } from 'ng2-alfresco-core';
|
||||
|
||||
@Component({...})
|
||||
export class AppComponent {
|
||||
constructor(authService: AlfrescoAuthenticationService) {
|
||||
this.alfrescoAuthenticationService.login('admin', 'admin').subscribe(
|
||||
constructor(authService: AuthenticationService) {
|
||||
this.AuthenticationService.login('admin', 'admin').subscribe(
|
||||
token => {
|
||||
console.log(token);
|
||||
},
|
||||
@@ -624,7 +624,7 @@ The CardViewComponent is a configurable property list renderer. You define the p
|
||||
### Editing
|
||||
|
||||
The card view can optionally allow its properties to be edited. You can control the editing of the properties in two level.
|
||||
- **global level** - *via the editable paramter of the adf-card-view component*
|
||||
- **global level** - *via the editable paramter of the card-view.component*
|
||||
- **property level** - *in each property via the editable attribute*
|
||||
|
||||
If you set the global editable parameter to false, no properties can be edited regardless of what is set inside the property.
|
||||
@@ -790,14 +790,14 @@ For Angular to be able to load your custom component dynamically, you have to re
|
||||
export class MyModule {}
|
||||
```
|
||||
|
||||
## AlfrescoTranslationService
|
||||
## TranslationService
|
||||
|
||||
In order to enable localisation support you will need creating a `/resources/i18n/en.json` file
|
||||
and registering path to it's parent `i18n` folder:
|
||||
|
||||
```ts
|
||||
class MainApplication {
|
||||
constructor(translateService: AlfrescoTranslationService) {
|
||||
constructor(translateService: TranslationService) {
|
||||
translateService.addTranslationFolder('app', 'resources');
|
||||
}
|
||||
}
|
||||
@@ -808,7 +808,7 @@ Imagine you got a language picker that invokes `onLanguageClicked` method:
|
||||
|
||||
```ts
|
||||
class MyComponent {
|
||||
constructor(private translateService: AlfrescoTranslationService) {
|
||||
constructor(private translateService: TranslationService) {
|
||||
}
|
||||
|
||||
onLanguageClicked(lang: string) {
|
||||
@@ -821,7 +821,7 @@ It is also possible providing custom translations for existing components by ove
|
||||
|
||||
```ts
|
||||
class MyComponent {
|
||||
constructor(private translateService: AlfrescoTranslationService) {
|
||||
constructor(private translateService: TranslationService) {
|
||||
translateService.addTranslationFolder(
|
||||
'ng2-alfresco-login',
|
||||
'i18n/custom-translation/alfresco-login'
|
||||
|
@@ -24,34 +24,57 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
import { CollapsableModule } from './src/components/collapsable/collapsable.module';
|
||||
import { ContextMenuModule } from './src/components/context-menu/context-menu.module';
|
||||
import { AdfToolbarComponent } from './src/components/toolbar/toolbar.component';
|
||||
import { ToolbarComponent } from './src/components/toolbar/toolbar.component';
|
||||
import { CardViewModule } from './src/components/view/card-view.module';
|
||||
import { MaterialModule } from './src/material.module';
|
||||
|
||||
import { AlfrescoApiService } from './src/services/alfresco-api.service';
|
||||
import { AlfrescoContentService } from './src/services/alfresco-content.service';
|
||||
import { AlfrescoSettingsService } from './src/services/alfresco-settings.service';
|
||||
import { AppConfigModule } from './src/services/app-config.service';
|
||||
import { AppConfigService } from './src/services/app-config.service';
|
||||
import { InitAppConfigServiceProvider } from './src/services/app-config.service';
|
||||
import { AuthGuardBpm } from './src/services/auth-guard-bpm.service';
|
||||
import { AuthGuardEcm } from './src/services/auth-guard-ecm.service';
|
||||
import { AuthGuard } from './src/services/auth-guard.service';
|
||||
import { AuthenticationService } from './src/services/authentication.service';
|
||||
import { ContentService } from './src/services/content.service';
|
||||
import { CookieService } from './src/services/cookie.service';
|
||||
import { LogService } from './src/services/log.service';
|
||||
import { LogServiceMock } from './src/services/log.service';
|
||||
import { NotificationService } from './src/services/notification.service';
|
||||
import { RenditionsService } from './src/services/renditions.service';
|
||||
import { StorageService } from './src/services/storage.service';
|
||||
import { ThumbnailService } from './src/services/thumbnail.service';
|
||||
import { AlfrescoTranslateLoader } from './src/services/translate-loader.service';
|
||||
import { TranslationService } from './src/services/translation.service';
|
||||
import { UploadService } from './src/services/upload.service';
|
||||
import { UserPreferencesService } from './src/services/user-preferences.service';
|
||||
|
||||
import {
|
||||
AlfrescoApiService,
|
||||
AlfrescoAuthenticationService,
|
||||
AlfrescoContentService,
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoTranslateLoader,
|
||||
AlfrescoTranslationService,
|
||||
AppConfigService,
|
||||
AuthGuard,
|
||||
AuthGuardBpm,
|
||||
AuthGuardEcm,
|
||||
ContentService,
|
||||
CookieService,
|
||||
InitAppConfigServiceProvider,
|
||||
LogService,
|
||||
LogServiceMock,
|
||||
NotificationService,
|
||||
RenditionsService,
|
||||
StorageService,
|
||||
ThumbnailService,
|
||||
UploadService
|
||||
} from './src/services/index';
|
||||
export { ContentService } from './src/services/content.service';
|
||||
export { StorageService } from './src/services/storage.service';
|
||||
export { CookieService } from './src/services/cookie.service';
|
||||
export { AlfrescoApiService } from './src/services/alfresco-api.service';
|
||||
export { AlfrescoSettingsService } from './src/services/alfresco-settings.service';
|
||||
export { AlfrescoContentService } from './src/services/alfresco-content.service';
|
||||
export { RenditionsService } from './src/services/renditions.service';
|
||||
export { AuthGuard } from './src/services/auth-guard.service';
|
||||
export { AuthGuardEcm } from './src/services/auth-guard-ecm.service';
|
||||
export { AuthGuardBpm } from './src/services/auth-guard-bpm.service';
|
||||
export { NotificationService } from './src/services/notification.service';
|
||||
export { LogService } from './src/services/log.service';
|
||||
export { LogServiceMock } from './src/services/log.service';
|
||||
export { AuthenticationService } from './src/services/authentication.service';
|
||||
export { TranslationService } from './src/services/translation.service';
|
||||
export { AlfrescoTranslateLoader } from './src/services/translate-loader.service';
|
||||
export { AppConfigService } from './src/services/app-config.service';
|
||||
export { InitAppConfigServiceProvider } from './src/services/app-config.service';
|
||||
export { ThumbnailService } from './src/services/thumbnail.service';
|
||||
export { UploadService } from './src/services/upload.service';
|
||||
export { CardViewUpdateService } from './src/services/card-view-update.service';
|
||||
export { UpdateNotification } from './src/services/card-view-update.service';
|
||||
export { AppConfigModule } from './src/services/app-config.service';
|
||||
export { UserPreferencesService } from './src/services/user-preferences.service';
|
||||
|
||||
import { DataColumnListComponent } from './src/components/data-column/data-column-list.component';
|
||||
import { DataColumnComponent } from './src/components/data-column/data-column.component';
|
||||
@@ -68,9 +91,8 @@ import { MDLDirective } from './src/components/material/mdl-upgrade-element.dire
|
||||
export { ContextMenuModule } from './src/components/context-menu/context-menu.module';
|
||||
export { CardViewModule } from './src/components/view/card-view.module';
|
||||
export { CollapsableModule } from './src/components/collapsable/collapsable.module';
|
||||
export { UserPreferencesService } from './src/services/user-preferences.service';
|
||||
export { CardViewItem } from './src/interface/card-view-item.interface';
|
||||
export * from './src/services/index';
|
||||
|
||||
export * from './src/components/data-column/data-column.component';
|
||||
export * from './src/components/data-column/data-column-list.component';
|
||||
export * from './src/directives/upload.directive';
|
||||
@@ -134,7 +156,7 @@ export function createTranslateLoader(http: Http, logService: LogService) {
|
||||
DataColumnListComponent,
|
||||
FileSizePipe,
|
||||
HighlightPipe,
|
||||
AdfToolbarComponent
|
||||
ToolbarComponent
|
||||
],
|
||||
providers: providers(),
|
||||
exports: [
|
||||
@@ -154,7 +176,7 @@ export function createTranslateLoader(http: Http, logService: LogService) {
|
||||
DataColumnListComponent,
|
||||
FileSizePipe,
|
||||
HighlightPipe,
|
||||
AdfToolbarComponent
|
||||
ToolbarComponent
|
||||
]
|
||||
})
|
||||
export class CoreModule {
|
||||
|
@@ -24,7 +24,7 @@ import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@a
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class AdfToolbarComponent {
|
||||
export class ToolbarComponent {
|
||||
|
||||
@Input()
|
||||
title: string = '';
|
||||
|
@@ -20,6 +20,6 @@ import { Directive, ViewContainerRef } from '@angular/core';
|
||||
@Directive({
|
||||
selector: '[adf-card-view-content-proxy]'
|
||||
})
|
||||
export class AdfCardViewContentProxyDirective {
|
||||
export class CardViewContentProxyDirective {
|
||||
constructor(public viewContainerRef: ViewContainerRef) { }
|
||||
}
|
@@ -19,8 +19,8 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MdDatepickerModule, MdInputModule, MdNativeDateModule } from '@angular/material';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { CardViewDateItemModel } from '../../models/card-view-dateitem.model';
|
||||
import { CardViewUpdateService } from '../../services/adf-card-view-update.service';
|
||||
import { CardViewDateItemComponent } from './adf-card-view-dateitem.component';
|
||||
import { CardViewUpdateService } from '../../services/card-view-update.service';
|
||||
import { CardViewDateItemComponent } from './card-view-dateitem.component';
|
||||
|
||||
describe('CardViewDateItemComponent', () => {
|
||||
|
@@ -18,12 +18,12 @@
|
||||
import { Component, Input, ViewChild } from '@angular/core';
|
||||
import { MdDatepicker } from '@angular/material';
|
||||
import { CardViewDateItemModel } from '../../models/card-view-dateitem.model';
|
||||
import { CardViewUpdateService } from '../../services/adf-card-view-update.service';
|
||||
import { CardViewUpdateService } from '../../services/card-view-update.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-card-view-dateitem',
|
||||
templateUrl: './adf-card-view-dateitem.component.html',
|
||||
styleUrls: ['./adf-card-view-dateitem.component.scss']
|
||||
templateUrl: './card-view-dateitem.component.html',
|
||||
styleUrls: ['./card-view-dateitem.component.scss']
|
||||
})
|
||||
export class CardViewDateItemComponent {
|
||||
@Input()
|
@@ -20,8 +20,8 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
|
||||
import { CardViewItem } from '../../interface/card-view-item.interface';
|
||||
import { AdfCardViewContentProxyDirective } from './adf-card-view-content-proxy.directive';
|
||||
import { CardViewItemDispatcherComponent } from './adf-card-view-item-dispatcher.component';
|
||||
import { CardViewContentProxyDirective } from './card-view-content-proxy.directive';
|
||||
import { CardViewItemDispatcherComponent } from './card-view-item-dispatcher.component';
|
||||
|
||||
@Component({
|
||||
selector: 'whatever-you-want-to-have',
|
||||
@@ -43,7 +43,7 @@ describe('CardViewItemDispatcherComponent', () => {
|
||||
declarations: [
|
||||
CardViewItemDispatcherComponent,
|
||||
CardViewShinyCustomElementItemComponent,
|
||||
AdfCardViewContentProxyDirective
|
||||
CardViewContentProxyDirective
|
||||
],
|
||||
providers: []
|
||||
});
|
@@ -24,7 +24,7 @@ import {
|
||||
ViewChild
|
||||
} from '@angular/core';
|
||||
import { CardViewItem } from '../../interface/card-view-item.interface';
|
||||
import { AdfCardViewContentProxyDirective } from './adf-card-view-content-proxy.directive';
|
||||
import { CardViewContentProxyDirective } from './card-view-content-proxy.directive';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-card-view-item-dispatcher',
|
||||
@@ -37,8 +37,8 @@ export class CardViewItemDispatcherComponent implements OnChanges {
|
||||
@Input()
|
||||
editable: boolean;
|
||||
|
||||
@ViewChild(AdfCardViewContentProxyDirective)
|
||||
private content: AdfCardViewContentProxyDirective;
|
||||
@ViewChild(CardViewContentProxyDirective)
|
||||
private content: CardViewContentProxyDirective;
|
||||
|
||||
private loaded: boolean = false;
|
||||
private componentReference: any = null;
|
@@ -21,8 +21,8 @@ import { MdDatepickerModule, MdIconModule, MdInputModule, MdNativeDateModule } f
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { CardViewTextItemModel } from '../../models/card-view-textitem.model';
|
||||
import { CardViewUpdateService } from '../../services/adf-card-view-update.service';
|
||||
import { CardViewTextItemComponent } from './adf-card-view-textitem.component';
|
||||
import { CardViewUpdateService } from '../../services/card-view-update.service';
|
||||
import { CardViewTextItemComponent } from './card-view-textitem.component';
|
||||
|
||||
describe('CardViewTextItemComponent', () => {
|
||||
|
@@ -17,12 +17,12 @@
|
||||
|
||||
import { Component, Input, OnChanges, ViewChild } from '@angular/core';
|
||||
import { CardViewTextItemModel } from '../../models/card-view-textitem.model';
|
||||
import { CardViewUpdateService } from '../../services/adf-card-view-update.service';
|
||||
import { CardViewUpdateService } from '../../services/card-view-update.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-card-view-textitem',
|
||||
templateUrl: './adf-card-view-textitem.component.html',
|
||||
styleUrls: ['./adf-card-view-textitem.component.scss']
|
||||
templateUrl: './card-view-textitem.component.html',
|
||||
styleUrls: ['./card-view-textitem.component.scss']
|
||||
})
|
||||
export class CardViewTextItemComponent implements OnChanges {
|
||||
@Input()
|
@@ -22,12 +22,12 @@ import { By } from '@angular/platform-browser';
|
||||
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
|
||||
import { CardViewDateItemModel } from '../../models/card-view-dateitem.model';
|
||||
import { CardViewTextItemModel } from '../../models/card-view-textitem.model';
|
||||
import { CardViewUpdateService } from '../../services/adf-card-view-update.service';
|
||||
import { AdfCardViewContentProxyDirective } from './adf-card-view-content-proxy.directive';
|
||||
import { CardViewDateItemComponent } from './adf-card-view-dateitem.component';
|
||||
import { CardViewItemDispatcherComponent } from './adf-card-view-item-dispatcher.component';
|
||||
import { CardViewTextItemComponent } from './adf-card-view-textitem.component';
|
||||
import { CardViewComponent } from './adf-card-view.component';
|
||||
import { CardViewUpdateService } from '../../services/card-view-update.service';
|
||||
import { CardViewContentProxyDirective } from './card-view-content-proxy.directive';
|
||||
import { CardViewDateItemComponent } from './card-view-dateitem.component';
|
||||
import { CardViewItemDispatcherComponent } from './card-view-item-dispatcher.component';
|
||||
import { CardViewTextItemComponent } from './card-view-textitem.component';
|
||||
import { CardViewComponent } from './card-view.component';
|
||||
|
||||
describe('AdfCardView', () => {
|
||||
|
||||
@@ -46,7 +46,7 @@ describe('AdfCardView', () => {
|
||||
declarations: [
|
||||
CardViewComponent,
|
||||
CardViewItemDispatcherComponent,
|
||||
AdfCardViewContentProxyDirective,
|
||||
CardViewContentProxyDirective,
|
||||
CardViewTextItemComponent,
|
||||
CardViewDateItemComponent
|
||||
],
|
@@ -20,8 +20,8 @@ import { CardViewItem } from '../../interface/card-view-item.interface';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-card-view',
|
||||
templateUrl: './adf-card-view.component.html',
|
||||
styleUrls: ['./adf-card-view.component.scss']
|
||||
templateUrl: './card-view.component.html',
|
||||
styleUrls: ['./card-view.component.scss']
|
||||
})
|
||||
export class CardViewComponent {
|
||||
@Input()
|
@@ -19,11 +19,11 @@ import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { MdButtonModule, MdDatepickerModule, MdIconModule, MdInputModule, MdNativeDateModule } from '@angular/material';
|
||||
import { AdfCardViewContentProxyDirective } from './adf-card-view-content-proxy.directive';
|
||||
import { CardViewDateItemComponent } from './adf-card-view-dateitem.component';
|
||||
import { CardViewItemDispatcherComponent } from './adf-card-view-item-dispatcher.component';
|
||||
import { CardViewTextItemComponent } from './adf-card-view-textitem.component';
|
||||
import { CardViewComponent } from './adf-card-view.component';
|
||||
import { CardViewContentProxyDirective } from './card-view-content-proxy.directive';
|
||||
import { CardViewDateItemComponent } from './card-view-dateitem.component';
|
||||
import { CardViewItemDispatcherComponent } from './card-view-item-dispatcher.component';
|
||||
import { CardViewTextItemComponent } from './card-view-textitem.component';
|
||||
import { CardViewComponent } from './card-view.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -38,7 +38,7 @@ import { CardViewComponent } from './adf-card-view.component';
|
||||
declarations: [
|
||||
CardViewComponent,
|
||||
CardViewItemDispatcherComponent,
|
||||
AdfCardViewContentProxyDirective,
|
||||
CardViewContentProxyDirective,
|
||||
CardViewTextItemComponent,
|
||||
CardViewDateItemComponent
|
||||
],
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { AlfrescoContentService } from './alfresco-content.service';
|
||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||
import { AppConfigModule } from './app-config.service';
|
||||
@@ -32,7 +32,7 @@ declare let jasmine: any;
|
||||
describe('AlfrescoContentService', () => {
|
||||
|
||||
let contentService: AlfrescoContentService;
|
||||
let authService: AlfrescoAuthenticationService;
|
||||
let authService: AuthenticationService;
|
||||
let settingsService: AlfrescoSettingsService;
|
||||
let storage: StorageService;
|
||||
let node: any;
|
||||
@@ -49,7 +49,7 @@ describe('AlfrescoContentService', () => {
|
||||
providers: [
|
||||
AlfrescoApiService,
|
||||
AlfrescoContentService,
|
||||
AlfrescoAuthenticationService,
|
||||
AuthenticationService,
|
||||
AlfrescoSettingsService,
|
||||
StorageService,
|
||||
UserPreferencesService,
|
||||
@@ -60,7 +60,7 @@ describe('AlfrescoContentService', () => {
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
authService = TestBed.get(AlfrescoAuthenticationService);
|
||||
authService = TestBed.get(AuthenticationService);
|
||||
settingsService = TestBed.get(AlfrescoSettingsService);
|
||||
contentService = TestBed.get(AlfrescoContentService);
|
||||
storage = TestBed.get(StorageService);
|
||||
|
@@ -19,7 +19,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Observable, Subject } from 'rxjs/Rx';
|
||||
import { FolderCreatedEvent } from '../events/folder-created.event';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { LogService } from './log.service';
|
||||
|
||||
@Injectable()
|
||||
@@ -27,7 +27,7 @@ export class AlfrescoContentService {
|
||||
|
||||
folderCreated: Subject<FolderCreatedEvent> = new Subject<FolderCreatedEvent>();
|
||||
|
||||
constructor(public authService: AlfrescoAuthenticationService,
|
||||
constructor(public authService: AuthenticationService,
|
||||
public apiService: AlfrescoApiService,
|
||||
private logService: LogService) {
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
||||
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||
import { AppConfigModule } from './app-config.service';
|
||||
import { AuthGuardBpm } from './auth-guard-bpm.service';
|
||||
@@ -44,7 +44,7 @@ describe('AuthGuardService BPM', () => {
|
||||
AuthGuardBpm,
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoApiService,
|
||||
AlfrescoAuthenticationService,
|
||||
AuthenticationService,
|
||||
StorageService,
|
||||
UserPreferencesService,
|
||||
{ provide: CookieService, useClass: CookieServiceMock },
|
||||
@@ -54,7 +54,7 @@ describe('AuthGuardService BPM', () => {
|
||||
}));
|
||||
|
||||
it('if the alfresco js api is logged in should canActivate be true',
|
||||
async(inject([AuthGuardBpm, Router, AlfrescoSettingsService, StorageService, AlfrescoAuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
async(inject([AuthGuardBpm, Router, AlfrescoSettingsService, StorageService, AuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
spyOn(router, 'navigate');
|
||||
|
||||
authService.isBpmLoggedIn = () => {
|
||||
@@ -67,7 +67,7 @@ describe('AuthGuardService BPM', () => {
|
||||
);
|
||||
|
||||
it('if the alfresco js api is NOT logged in should canActivate be false',
|
||||
async(inject([AuthGuardBpm, Router, AlfrescoSettingsService, StorageService, AlfrescoAuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
async(inject([AuthGuardBpm, Router, AlfrescoSettingsService, StorageService, AuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
|
||||
spyOn(router, 'navigate');
|
||||
|
||||
|
@@ -22,11 +22,11 @@ import {
|
||||
RouterStateSnapshot
|
||||
} from '@angular/router';
|
||||
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
|
||||
@Injectable()
|
||||
export class AuthGuardBpm implements CanActivate, CanActivateChild {
|
||||
constructor(private authService: AlfrescoAuthenticationService, private router: Router) {}
|
||||
constructor(private authService: AuthenticationService, private router: Router) {}
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||
// let url: string = state.url;
|
||||
|
@@ -21,7 +21,7 @@ import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
||||
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||
import { AppConfigModule } from './app-config.service';
|
||||
import { AuthGuardEcm } from './auth-guard-ecm.service';
|
||||
@@ -44,7 +44,7 @@ describe('AuthGuardService ECM', () => {
|
||||
AuthGuardEcm,
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoApiService,
|
||||
AlfrescoAuthenticationService,
|
||||
AuthenticationService,
|
||||
StorageService,
|
||||
UserPreferencesService,
|
||||
{ provide: CookieService, useClass: CookieServiceMock },
|
||||
@@ -54,7 +54,7 @@ describe('AuthGuardService ECM', () => {
|
||||
}));
|
||||
|
||||
it('if the alfresco js api is logged in should canActivate be true',
|
||||
async(inject([AuthGuardEcm, Router, AlfrescoSettingsService, StorageService, AlfrescoAuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
async(inject([AuthGuardEcm, Router, AlfrescoSettingsService, StorageService, AuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
spyOn(router, 'navigate');
|
||||
|
||||
authService.isEcmLoggedIn = () => {
|
||||
@@ -67,7 +67,7 @@ describe('AuthGuardService ECM', () => {
|
||||
);
|
||||
|
||||
it('if the alfresco js api is NOT logged in should canActivate be false',
|
||||
async(inject([AuthGuardEcm, Router, AlfrescoSettingsService, StorageService, AlfrescoAuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
async(inject([AuthGuardEcm, Router, AlfrescoSettingsService, StorageService, AuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
|
||||
spyOn(router, 'navigate');
|
||||
|
||||
|
@@ -22,11 +22,11 @@ import {
|
||||
RouterStateSnapshot
|
||||
} from '@angular/router';
|
||||
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
|
||||
@Injectable()
|
||||
export class AuthGuardEcm implements CanActivate, CanActivateChild {
|
||||
constructor(private authService: AlfrescoAuthenticationService, private router: Router) {}
|
||||
constructor(private authService: AuthenticationService, private router: Router) {}
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||
// let url: string = state.url;
|
||||
|
@@ -21,7 +21,7 @@ import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
||||
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||
import { AppConfigModule } from './app-config.service';
|
||||
import { AuthGuard } from './auth-guard.service';
|
||||
@@ -42,7 +42,7 @@ describe('AuthGuardService', () => {
|
||||
AuthGuard,
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoApiService,
|
||||
AlfrescoAuthenticationService,
|
||||
AuthenticationService,
|
||||
UserPreferencesService,
|
||||
StorageService,
|
||||
{ provide: CookieService, useClass: CookieServiceMock },
|
||||
@@ -52,7 +52,7 @@ describe('AuthGuardService', () => {
|
||||
}));
|
||||
|
||||
it('if the alfresco js api is logged in should canActivate be true',
|
||||
async(inject([AuthGuard, Router, AlfrescoSettingsService, StorageService, AlfrescoAuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
async(inject([AuthGuard, Router, AlfrescoSettingsService, StorageService, AuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
spyOn(router, 'navigate');
|
||||
|
||||
authService.isLoggedIn = () => {
|
||||
@@ -65,7 +65,7 @@ describe('AuthGuardService', () => {
|
||||
);
|
||||
|
||||
it('if the alfresco js api is NOT logged in should canActivate be false',
|
||||
async(inject([AuthGuard, Router, AlfrescoSettingsService, StorageService, AlfrescoAuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
async(inject([AuthGuard, Router, AlfrescoSettingsService, StorageService, AuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||
|
||||
spyOn(router, 'navigate');
|
||||
|
||||
|
@@ -22,11 +22,11 @@ import {
|
||||
RouterStateSnapshot
|
||||
} from '@angular/router';
|
||||
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
|
||||
@Injectable()
|
||||
export class AuthGuard implements CanActivate, CanActivateChild {
|
||||
constructor(private authService: AlfrescoAuthenticationService, private router: Router) {}
|
||||
constructor(private authService: AuthenticationService, private router: Router) {}
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||
// let url: string = state.url;
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||
import { AppConfigModule } from './app-config.service';
|
||||
import { CookieService } from './cookie.service';
|
||||
@@ -28,9 +28,9 @@ import { UserPreferencesService } from './user-preferences.service';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
describe('AlfrescoAuthenticationService', () => {
|
||||
describe('AuthenticationService', () => {
|
||||
let apiService: AlfrescoApiService;
|
||||
let authService: AlfrescoAuthenticationService;
|
||||
let authService: AuthenticationService;
|
||||
let settingsService: AlfrescoSettingsService;
|
||||
let preferences: UserPreferencesService;
|
||||
let storage: StorageService;
|
||||
@@ -44,7 +44,7 @@ describe('AlfrescoAuthenticationService', () => {
|
||||
providers: [
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoApiService,
|
||||
AlfrescoAuthenticationService,
|
||||
AuthenticationService,
|
||||
StorageService,
|
||||
UserPreferencesService,
|
||||
{ provide: CookieService, useClass: CookieServiceMock },
|
||||
@@ -55,7 +55,7 @@ describe('AlfrescoAuthenticationService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
apiService = TestBed.get(AlfrescoApiService);
|
||||
authService = TestBed.get(AlfrescoAuthenticationService);
|
||||
authService = TestBed.get(AuthenticationService);
|
||||
settingsService = TestBed.get(AlfrescoSettingsService);
|
||||
preferences = TestBed.get(UserPreferencesService);
|
||||
cookie = TestBed.get(CookieService);
|
@@ -27,7 +27,7 @@ const REMEMBER_ME_COOKIE_KEY = 'ALFRESCO_REMEMBER_ME';
|
||||
const REMEMBER_ME_UNTIL = 1000 * 60 * 60 * 24 * 30 ;
|
||||
|
||||
@Injectable()
|
||||
export class AlfrescoAuthenticationService {
|
||||
export class AuthenticationService {
|
||||
|
||||
onLogin: Subject<any> = new Subject<any>();
|
||||
onLogout: Subject<any> = new Subject<any>();
|
||||
@@ -211,7 +211,7 @@ export class AlfrescoAuthenticationService {
|
||||
*
|
||||
* @returns {string} The username value
|
||||
*
|
||||
* @memberof AlfrescoAuthenticationService
|
||||
* @memberof AuthenticationService
|
||||
*/
|
||||
getEcmUsername(): string {
|
||||
return this.alfrescoApi.getInstance().ecmAuth.username;
|
||||
@@ -222,7 +222,7 @@ export class AlfrescoAuthenticationService {
|
||||
*
|
||||
* @returns {string} The username value
|
||||
*
|
||||
* @memberof AlfrescoAuthenticationService
|
||||
* @memberof AuthenticationService
|
||||
*/
|
||||
getBpmUsername(): string {
|
||||
return this.alfrescoApi.getInstance().bpmAuth.username;
|
@@ -1,36 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './content.service';
|
||||
export * from './storage.service';
|
||||
export * from './cookie.service';
|
||||
export * from './alfresco-api.service';
|
||||
export * from './alfresco-settings.service';
|
||||
export * from './alfresco-content.service';
|
||||
export * from './renditions.service';
|
||||
export * from './auth-guard.service';
|
||||
export * from './auth-guard-ecm.service';
|
||||
export * from './auth-guard-bpm.service';
|
||||
export * from './notification.service';
|
||||
export * from './log.service';
|
||||
export * from './alfresco-authentication.service';
|
||||
export * from './alfresco-translation.service';
|
||||
export * from './alfresco-translate-loader.service';
|
||||
export * from './app-config.service';
|
||||
export * from './thumbnail.service';
|
||||
export * from './upload.service';
|
||||
export * from './adf-card-view-update.service';
|
@@ -19,7 +19,7 @@ import { async, TestBed } from '@angular/core/testing';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { AlfrescoContentService } from './alfresco-content.service';
|
||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||
import { AppConfigService } from './app-config.service';
|
||||
@@ -40,7 +40,7 @@ describe('ThumbnailService', () => {
|
||||
],
|
||||
providers: [
|
||||
UserPreferencesService,
|
||||
AlfrescoAuthenticationService,
|
||||
AuthenticationService,
|
||||
AlfrescoContentService,
|
||||
AlfrescoSettingsService,
|
||||
AppConfigService,
|
||||
|
@@ -21,8 +21,8 @@ import { HttpModule, Response, ResponseOptions, XHRBackend } from '@angular/http
|
||||
import { MockBackend, MockConnection } from '@angular/http/testing';
|
||||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
import { AlfrescoTranslateLoader } from './alfresco-translate-loader.service';
|
||||
import { AlfrescoTranslationService } from './alfresco-translation.service';
|
||||
import { AlfrescoTranslateLoader } from './translate-loader.service';
|
||||
import { TranslationService } from './translation.service';
|
||||
import { LogService } from './log.service';
|
||||
|
||||
let componentJson1 = ' {"TEST": "This is a test", "TEST2": "This is another test"} ' ;
|
||||
@@ -34,7 +34,7 @@ const mockBackendResponse = (connection: MockConnection, response: string) => {
|
||||
describe('TranslateLoader', () => {
|
||||
let injector: Injector;
|
||||
let backend: any;
|
||||
let alfrescoTranslationService: AlfrescoTranslationService;
|
||||
let translationService: TranslationService;
|
||||
let connection: MockConnection; // this will be set when a new connection is emitted from the backend.
|
||||
let customLoader;
|
||||
|
||||
@@ -50,22 +50,22 @@ describe('TranslateLoader', () => {
|
||||
})
|
||||
],
|
||||
providers: [
|
||||
AlfrescoTranslationService,
|
||||
TranslationService,
|
||||
LogService,
|
||||
{provide: XHRBackend, useClass: MockBackend}
|
||||
]
|
||||
});
|
||||
injector = getTestBed();
|
||||
backend = injector.get(XHRBackend);
|
||||
alfrescoTranslationService = injector.get(AlfrescoTranslationService);
|
||||
translationService = injector.get(TranslationService);
|
||||
backend.connections.subscribe((c: MockConnection) => connection = c);
|
||||
customLoader = alfrescoTranslationService.translate.currentLoader;
|
||||
customLoader = translationService.translate.currentLoader;
|
||||
});
|
||||
|
||||
it('should be able to provide any TranslateLoader', () => {
|
||||
expect(alfrescoTranslationService).toBeDefined();
|
||||
expect(alfrescoTranslationService.translate.currentLoader).toBeDefined();
|
||||
expect(alfrescoTranslationService.translate.currentLoader instanceof AlfrescoTranslateLoader).toBeTruthy();
|
||||
expect(translationService).toBeDefined();
|
||||
expect(translationService.translate.currentLoader).toBeDefined();
|
||||
expect(translationService.translate.currentLoader instanceof AlfrescoTranslateLoader).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should add the component to the list', () => {
|
@@ -21,18 +21,18 @@ import { HttpModule, Response, ResponseOptions, XHRBackend } from '@angular/http
|
||||
import { MockBackend, MockConnection } from '@angular/http/testing';
|
||||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
import { AlfrescoTranslateLoader } from './alfresco-translate-loader.service';
|
||||
import { AlfrescoTranslationService } from './alfresco-translation.service';
|
||||
import { AlfrescoTranslateLoader } from './translate-loader.service';
|
||||
import { TranslationService } from './translation.service';
|
||||
import { LogService } from './log.service';
|
||||
|
||||
const mockBackendResponse = (connection: MockConnection, response: string) => {
|
||||
connection.mockRespond(new Response(new ResponseOptions({body: response})));
|
||||
};
|
||||
|
||||
describe('AlfrescoTranslationService', () => {
|
||||
describe('TranslationService', () => {
|
||||
let injector: Injector;
|
||||
let backend: any;
|
||||
let alfrescoTranslationService: AlfrescoTranslationService;
|
||||
let translationService: TranslationService;
|
||||
let connection: MockConnection; // this will be set when a new connection is emitted from the backend.
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -47,25 +47,25 @@ describe('AlfrescoTranslationService', () => {
|
||||
})
|
||||
],
|
||||
providers: [
|
||||
AlfrescoTranslationService,
|
||||
TranslationService,
|
||||
LogService,
|
||||
{provide: XHRBackend, useClass: MockBackend}
|
||||
]
|
||||
});
|
||||
injector = getTestBed();
|
||||
backend = injector.get(XHRBackend);
|
||||
alfrescoTranslationService = injector.get(AlfrescoTranslationService);
|
||||
translationService = injector.get(TranslationService);
|
||||
backend.connections.subscribe((c: MockConnection) => connection = c);
|
||||
alfrescoTranslationService.addTranslationFolder('fake-name', 'fake-path');
|
||||
translationService.addTranslationFolder('fake-name', 'fake-path');
|
||||
});
|
||||
|
||||
it('is defined', () => {
|
||||
expect(AlfrescoTranslationService).toBeDefined();
|
||||
expect(alfrescoTranslationService instanceof AlfrescoTranslationService).toBeTruthy();
|
||||
expect(translationService).toBeDefined();
|
||||
expect(translationService instanceof TranslationService).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should be able to get translations of the KEY: TEST', () => {
|
||||
alfrescoTranslationService.get('TEST').subscribe((res: string) => {
|
||||
translationService.get('TEST').subscribe((res: string) => {
|
||||
expect(res).toEqual('This is a test');
|
||||
});
|
||||
|
||||
@@ -73,7 +73,7 @@ describe('AlfrescoTranslationService', () => {
|
||||
});
|
||||
|
||||
it('should be able to get translations of the KEY: TEST2', () => {
|
||||
alfrescoTranslationService.get('TEST2').subscribe((res: string) => {
|
||||
translationService.get('TEST2').subscribe((res: string) => {
|
||||
expect(res).toEqual('This is another test');
|
||||
});
|
||||
|
@@ -18,10 +18,10 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { AlfrescoTranslateLoader } from './alfresco-translate-loader.service';
|
||||
import { AlfrescoTranslateLoader } from './translate-loader.service';
|
||||
|
||||
@Injectable()
|
||||
export class AlfrescoTranslationService {
|
||||
export class TranslationService {
|
||||
defaultLang: string = 'en';
|
||||
userLang: string = 'en';
|
||||
customLoader: AlfrescoTranslateLoader;
|
@@ -19,7 +19,7 @@ import { EventEmitter } from '@angular/core';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { FileModel, FileUploadOptions } from '../models/file.model';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||
import { AppConfigModule } from './app-config.service';
|
||||
import { StorageService } from './storage.service';
|
||||
@@ -44,7 +44,7 @@ describe('UploadService', () => {
|
||||
UploadService,
|
||||
AlfrescoApiService,
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoAuthenticationService,
|
||||
AuthenticationService,
|
||||
StorageService
|
||||
]
|
||||
});
|
||||
|
Reference in New Issue
Block a user