mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-05-13 22:06:35 +02:00
upgrading to angular 6
This commit is contained in:
parent
ad19ed158d
commit
3ce67a4088
@ -1,60 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
||||||
"project": {
|
|
||||||
"name": "pigallery2"
|
|
||||||
},
|
|
||||||
"apps": [
|
|
||||||
{
|
|
||||||
"root": "frontend",
|
|
||||||
"outDir": "dist",
|
|
||||||
"assets": [
|
|
||||||
"assets",
|
|
||||||
"config_inject.ejs"
|
|
||||||
],
|
|
||||||
"index": "index.html",
|
|
||||||
"main": "main.ts",
|
|
||||||
"polyfills": "polyfills.ts",
|
|
||||||
"test": "test.ts",
|
|
||||||
"tsconfig": "tsconfig.app.json",
|
|
||||||
"testTsconfig": "tsconfig.spec.json",
|
|
||||||
"prefix": "app",
|
|
||||||
"styles": [
|
|
||||||
"../node_modules/ng2-toastr/bundles/ng2-toastr.min.css",
|
|
||||||
"../node_modules/bootstrap/dist/css/bootstrap.css",
|
|
||||||
"../node_modules/open-iconic/font/css/open-iconic-bootstrap.css",
|
|
||||||
"styles.css"
|
|
||||||
],
|
|
||||||
"scripts": [],
|
|
||||||
"environmentSource": "environments/environment.ts",
|
|
||||||
"environments": {
|
|
||||||
"dev": "environments/environment.ts",
|
|
||||||
"prod": "environments/environment.prod.ts"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"e2e": {
|
|
||||||
"protractor": {
|
|
||||||
"config": "./protractor.conf.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lint": [
|
|
||||||
{
|
|
||||||
"project": "src/tsconfig.app.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"project": "src/tsconfig.spec.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"project": "test/e2e/tsconfig.e2e.json"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"test": {
|
|
||||||
"karma": {
|
|
||||||
"config": "./karma.conf.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaults": {
|
|
||||||
"styleExt": "css",
|
|
||||||
"component": {}
|
|
||||||
}
|
|
||||||
}
|
|
132
angular.json
Normal file
132
angular.json
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||||
|
"version": 1,
|
||||||
|
"newProjectRoot": "projects",
|
||||||
|
"projects": {
|
||||||
|
"pigallery2": {
|
||||||
|
"root": "",
|
||||||
|
"sourceRoot": "frontend",
|
||||||
|
"projectType": "application",
|
||||||
|
"architect": {
|
||||||
|
"build": {
|
||||||
|
"builder": "@angular-devkit/build-angular:browser",
|
||||||
|
"options": {
|
||||||
|
"outputPath": "dist",
|
||||||
|
"index": "frontend/index.html",
|
||||||
|
"main": "frontend/main.ts",
|
||||||
|
"tsConfig": "frontend/tsconfig.app.json",
|
||||||
|
"polyfills": "frontend/polyfills.ts",
|
||||||
|
"assets": [
|
||||||
|
"frontend/assets"
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"node_modules/ngx-toastr/toastr.css",
|
||||||
|
"node_modules/bootstrap/dist/css/bootstrap.css",
|
||||||
|
"node_modules/open-iconic/font/css/open-iconic-bootstrap.css",
|
||||||
|
"frontend/styles.css"
|
||||||
|
],
|
||||||
|
"scripts": []
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"optimization": true,
|
||||||
|
"outputHashing": "all",
|
||||||
|
"sourceMap": false,
|
||||||
|
"extractCss": true,
|
||||||
|
"namedChunks": false,
|
||||||
|
"aot": true,
|
||||||
|
"extractLicenses": true,
|
||||||
|
"vendorChunk": false,
|
||||||
|
"buildOptimizer": true,
|
||||||
|
"fileReplacements": [
|
||||||
|
{
|
||||||
|
"replace": "frontend/environments/environment.ts",
|
||||||
|
"with": "frontend/environments/environment.prod.ts"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"serve": {
|
||||||
|
"builder": "@angular-devkit/build-angular:dev-server",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "pigallery2:build"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"browserTarget": "pigallery2:build:production"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extract-i18n": {
|
||||||
|
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "pigallery2:build"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"builder": "@angular-devkit/build-angular:karma",
|
||||||
|
"options": {
|
||||||
|
"main": "frontend/test.ts",
|
||||||
|
"karmaConfig": "./karma.conf.js",
|
||||||
|
"polyfills": "frontend/polyfills.ts",
|
||||||
|
"tsConfig": "frontend/tsconfig.spec.json",
|
||||||
|
"scripts": [],
|
||||||
|
"styles": [
|
||||||
|
"node_modules/ng2-toastr/bundles/ng2-toastr.min.css",
|
||||||
|
"node_modules/bootstrap/dist/css/bootstrap.css",
|
||||||
|
"node_modules/open-iconic/font/css/open-iconic-bootstrap.css",
|
||||||
|
"frontend/styles.css"
|
||||||
|
],
|
||||||
|
"assets": [
|
||||||
|
"frontend/assets"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"builder": "@angular-devkit/build-angular:tslint",
|
||||||
|
"options": {
|
||||||
|
"tsConfig": [
|
||||||
|
"src/tsconfig.app.json",
|
||||||
|
"src/tsconfig.spec.json"
|
||||||
|
],
|
||||||
|
"exclude": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pigallery2-e2e": {
|
||||||
|
"root": "",
|
||||||
|
"sourceRoot": "",
|
||||||
|
"projectType": "application",
|
||||||
|
"architect": {
|
||||||
|
"e2e": {
|
||||||
|
"builder": "@angular-devkit/build-angular:protractor",
|
||||||
|
"options": {
|
||||||
|
"protractorConfig": "./protractor.conf.js",
|
||||||
|
"devServerTarget": "pigallery2:serve"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"builder": "@angular-devkit/build-angular:tslint",
|
||||||
|
"options": {
|
||||||
|
"tsConfig": [
|
||||||
|
"test/e2e/tsconfig.e2e.json"
|
||||||
|
],
|
||||||
|
"exclude": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultProject": "pigallery2",
|
||||||
|
"schematics": {
|
||||||
|
"@schematics/angular:component": {
|
||||||
|
"prefix": "app",
|
||||||
|
"styleext": "css"
|
||||||
|
},
|
||||||
|
"@schematics/angular:directive": {
|
||||||
|
"prefix": "app"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -20,9 +20,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
constructor(private _router: Router,
|
constructor(private _router: Router,
|
||||||
private _authenticationService: AuthenticationService,
|
private _authenticationService: AuthenticationService,
|
||||||
private _shareService: ShareService,
|
private _shareService: ShareService,
|
||||||
private _title: Title, vcr: ViewContainerRef,
|
private _title: Title) {
|
||||||
notificationService: NotificationService) {
|
|
||||||
notificationService.setRootViewContainerRef(vcr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
@ -44,7 +44,7 @@ import {ShareLoginComponent} from './sharelogin/share-login.component';
|
|||||||
import {ShareService} from './gallery/share.service';
|
import {ShareService} from './gallery/share.service';
|
||||||
import {ModalModule} from 'ngx-bootstrap/modal';
|
import {ModalModule} from 'ngx-bootstrap/modal';
|
||||||
import {DatabaseSettingsComponent} from './settings/database/database.settings.component';
|
import {DatabaseSettingsComponent} from './settings/database/database.settings.component';
|
||||||
import {ToastModule} from 'ng2-toastr/ng2-toastr';
|
import {ToastrModule} from 'ngx-toastr';
|
||||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||||
import {NotificationService} from './model/notification.service';
|
import {NotificationService} from './model/notification.service';
|
||||||
import {JWBootstrapSwitchModule} from 'jw-bootstrap-switch-ng2';
|
import {JWBootstrapSwitchModule} from 'jw-bootstrap-switch-ng2';
|
||||||
@ -116,7 +116,7 @@ export function translationsFactory(locale: string) {
|
|||||||
ClipboardModule,
|
ClipboardModule,
|
||||||
JWBootstrapSwitchModule,
|
JWBootstrapSwitchModule,
|
||||||
TooltipModule.forRoot(),
|
TooltipModule.forRoot(),
|
||||||
ToastModule.forRoot(),
|
ToastrModule.forRoot(),
|
||||||
ModalModule.forRoot(),
|
ModalModule.forRoot(),
|
||||||
CollapseModule.forRoot(),
|
CollapseModule.forRoot(),
|
||||||
BsDropdownModule.forRoot(),
|
BsDropdownModule.forRoot(),
|
||||||
|
@ -3,7 +3,7 @@ import {RouterLink} from '@angular/router';
|
|||||||
import {AuthenticationService} from '../model/network/authentication.service';
|
import {AuthenticationService} from '../model/network/authentication.service';
|
||||||
import {UserDTO, UserRoles} from '../../../common/entities/UserDTO';
|
import {UserDTO, UserRoles} from '../../../common/entities/UserDTO';
|
||||||
import {Config} from '../../../common/config/public/Config';
|
import {Config} from '../../../common/config/public/Config';
|
||||||
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
|
import {BehaviorSubject} from 'rxjs';
|
||||||
import {NotificationService} from '../model/notification.service';
|
import {NotificationService} from '../model/notification.service';
|
||||||
import {ShareService} from '../gallery/share.service';
|
import {ShareService} from '../gallery/share.service';
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import {SearchResultDTO} from '../../../common/entities/SearchResultDTO';
|
|||||||
import {ShareService} from './share.service';
|
import {ShareService} from './share.service';
|
||||||
import {NavigationService} from '../model/navigation.service';
|
import {NavigationService} from '../model/navigation.service';
|
||||||
import {UserRoles} from '../../../common/entities/UserDTO';
|
import {UserRoles} from '../../../common/entities/UserDTO';
|
||||||
import {interval} from 'rxjs/observable/interval';
|
import {interval} from 'rxjs';
|
||||||
import {ContentWrapper} from '../../../common/entities/ConentWrapper';
|
import {ContentWrapper} from '../../../common/entities/ConentWrapper';
|
||||||
import {PageHelper} from '../model/page.helper';
|
import {PageHelper} from '../model/page.helper';
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import {ContentWrapper} from '../../../common/entities/ConentWrapper';
|
|||||||
import {DirectoryDTO} from '../../../common/entities/DirectoryDTO';
|
import {DirectoryDTO} from '../../../common/entities/DirectoryDTO';
|
||||||
import {SearchTypes} from '../../../common/entities/AutoCompleteItem';
|
import {SearchTypes} from '../../../common/entities/AutoCompleteItem';
|
||||||
import {GalleryCacheService} from './cache.gallery.service';
|
import {GalleryCacheService} from './cache.gallery.service';
|
||||||
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
|
import {BehaviorSubject} from 'rxjs';
|
||||||
import {SharingDTO} from '../../../common/entities/SharingDTO';
|
import {SharingDTO} from '../../../common/entities/SharingDTO';
|
||||||
import {Config} from '../../../common/config/public/Config';
|
import {Config} from '../../../common/config/public/Config';
|
||||||
import {ShareService} from './share.service';
|
import {ShareService} from './share.service';
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
<a *ngIf="searchEnabled"
|
<a *ngIf="searchEnabled"
|
||||||
[routerLink]="['/search', keyword, {type: SearchTypes[SearchTypes.keyword]}]">#{{keyword}}</a>
|
[routerLink]="['/search', keyword, {type: SearchTypes[SearchTypes.keyword]}]">#{{keyword}}</a>
|
||||||
<span *ngIf="!searchEnabled">#{{keyword}}</span>
|
<span *ngIf="!searchEnabled">#{{keyword}}</span>
|
||||||
<ng-template [ngIf]="!last">,</ng-template>
|
<ng-template [ngIf]="!last">, </ng-template>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,11 +15,9 @@ import {GalleryPhotoComponent} from '../grid/photo/photo.grid.gallery.component'
|
|||||||
import {Dimension} from '../../model/IRenderable';
|
import {Dimension} from '../../model/IRenderable';
|
||||||
import {FullScreenService} from '../fullscreen.service';
|
import {FullScreenService} from '../fullscreen.service';
|
||||||
import {OverlayService} from '../overlay.service';
|
import {OverlayService} from '../overlay.service';
|
||||||
import {Subscription} from 'rxjs/Subscription';
|
|
||||||
import {animate, AnimationBuilder, AnimationPlayer, style} from '@angular/animations';
|
import {animate, AnimationBuilder, AnimationPlayer, style} from '@angular/animations';
|
||||||
import {GalleryLightboxPhotoComponent} from './photo/photo.lightbox.gallery.component';
|
import {GalleryLightboxPhotoComponent} from './photo/photo.lightbox.gallery.component';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable, Subscription, timer} from 'rxjs';
|
||||||
import {timer} from 'rxjs/observable/timer';
|
|
||||||
import {filter} from 'rxjs/operators';
|
import {filter} from 'rxjs/operators';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -2,7 +2,7 @@ import {Injectable} from '@angular/core';
|
|||||||
import {NetworkService} from '../model/network/network.service';
|
import {NetworkService} from '../model/network/network.service';
|
||||||
import {CreateSharingDTO, SharingDTO} from '../../../common/entities/SharingDTO';
|
import {CreateSharingDTO, SharingDTO} from '../../../common/entities/SharingDTO';
|
||||||
import {Router, RoutesRecognized} from '@angular/router';
|
import {Router, RoutesRecognized} from '@angular/router';
|
||||||
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
|
import {BehaviorSubject} from 'rxjs';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ShareService {
|
export class ShareService {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import {inject, TestBed} from '@angular/core/testing';
|
import {inject, TestBed} from '@angular/core/testing';
|
||||||
import {UserService} from './user.service';
|
import {UserService} from './user.service';
|
||||||
import {UserDTO} from '../../../../common/entities/UserDTO';
|
import {UserDTO} from '../../../../common/entities/UserDTO';
|
||||||
import 'rxjs/Rx';
|
|
||||||
import {LoginCredential} from '../../../../common/entities/LoginCredential';
|
import {LoginCredential} from '../../../../common/entities/LoginCredential';
|
||||||
import {AuthenticationService} from './authentication.service';
|
import {AuthenticationService} from './authentication.service';
|
||||||
import {NetworkService} from './network.service';
|
import {NetworkService} from './network.service';
|
||||||
@ -34,33 +33,35 @@ describe('AuthenticationService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should call UserDTO service login', inject([AuthenticationService, UserService], (authService, userService) => {
|
it('should call UserDTO service login', inject([AuthenticationService, UserService],
|
||||||
spyOn(userService, 'login').and.callThrough();
|
async (authService, userService) => {
|
||||||
|
spyOn(userService, 'login').and.callThrough();
|
||||||
|
|
||||||
expect(userService.login).not.toHaveBeenCalled();
|
expect(userService.login).not.toHaveBeenCalled();
|
||||||
authService.login();
|
await authService.login();
|
||||||
expect(userService.login).toHaveBeenCalled();
|
expect(userService.login).toHaveBeenCalled();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should have NO Authenticated use', inject([AuthenticationService], (authService: AuthenticationService) => {
|
it('should have NO Authenticated use', inject([AuthenticationService],
|
||||||
expect(authService.user.value).toBe(null);
|
(authService: AuthenticationService) => {
|
||||||
expect(authService.isAuthenticated()).toBe(false);
|
expect(authService.user.value).toBe(null);
|
||||||
}));
|
expect(authService.isAuthenticated()).toBe(false);
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
it('should have Authenticated use', inject([AuthenticationService], (authService: AuthenticationService) => {
|
it('should have Authenticated use', (done) => inject([AuthenticationService],
|
||||||
spyOn(authService.user, 'next').and.callThrough();
|
(authService: AuthenticationService) => {
|
||||||
authService.user.subscribe((user) => {
|
spyOn(authService.user, 'next').and.callThrough();
|
||||||
if (user == null) {
|
authService.user.subscribe((user) => {
|
||||||
return;
|
if (user == null) {
|
||||||
}
|
return;
|
||||||
expect(authService.user.next).toHaveBeenCalled();
|
}
|
||||||
expect(authService.user.value).not.toBe(null);
|
expect(authService.user.next).toHaveBeenCalled();
|
||||||
expect(authService.isAuthenticated()).toBe(true);
|
expect(authService.user.value).not.toBe(null);
|
||||||
});
|
expect(authService.isAuthenticated()).toBe(true);
|
||||||
authService.login(<any>{});
|
done();
|
||||||
|
});
|
||||||
}));
|
authService.login(<any>{});
|
||||||
|
})());
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import {UserDTO, UserRoles} from '../../../../common/entities/UserDTO';
|
import {UserDTO, UserRoles} from '../../../../common/entities/UserDTO';
|
||||||
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
|
import {BehaviorSubject} from 'rxjs';
|
||||||
import {UserService} from './user.service';
|
import {UserService} from './user.service';
|
||||||
import {LoginCredential} from '../../../../common/entities/LoginCredential';
|
import {LoginCredential} from '../../../../common/entities/LoginCredential';
|
||||||
import {Cookie} from 'ng2-cookies';
|
import {Cookie} from 'ng2-cookies';
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import {getTestBed, inject, TestBed} from '@angular/core/testing';
|
import {getTestBed, inject, TestBed} from '@angular/core/testing';
|
||||||
import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing';
|
import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing';
|
||||||
import 'rxjs/Rx';
|
|
||||||
import {NetworkService} from './network.service';
|
import {NetworkService} from './network.service';
|
||||||
import {Message} from '../../../../common/entities/Message';
|
import {Message} from '../../../../common/entities/Message';
|
||||||
import {SlimLoadingBarService} from 'ng2-slim-loading-bar';
|
import {SlimLoadingBarService} from 'ng2-slim-loading-bar';
|
||||||
@ -143,7 +142,6 @@ describe('NetworkService Fail tests', () => {
|
|||||||
httpMock.verify();
|
httpMock.verify();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should call GET with error', inject([NetworkService], (networkService) => {
|
it('should call GET with error', inject([NetworkService], (networkService) => {
|
||||||
|
|
||||||
networkService.getJson(testUrl).then((res: any) => {
|
networkService.getJson(testUrl).then((res: any) => {
|
||||||
|
@ -1,44 +1,53 @@
|
|||||||
import {inject, TestBed} from '@angular/core/testing';
|
import {inject, TestBed} from '@angular/core/testing';
|
||||||
import {BaseRequestOptions, Http} from '@angular/http';
|
import {HttpClientTestingModule} from '@angular/common/http/testing';
|
||||||
import {MockBackend} from '@angular/http/testing';
|
|
||||||
import 'rxjs/Rx';
|
|
||||||
import {NetworkService} from './network.service';
|
import {NetworkService} from './network.service';
|
||||||
import {UserService} from './user.service';
|
import {UserService} from './user.service';
|
||||||
import {LoginCredential} from '../../../../common/entities/LoginCredential';
|
import {LoginCredential} from '../../../../common/entities/LoginCredential';
|
||||||
|
import {SlimLoadingBarService} from 'ng2-slim-loading-bar';
|
||||||
|
import {ShareService} from '../../gallery/share.service';
|
||||||
|
|
||||||
|
class MockShareService {
|
||||||
|
wait() {
|
||||||
|
return Promise.resolve(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
isSharing() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
describe('UserService', () => {
|
describe('UserService', () => {
|
||||||
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
|
imports: [HttpClientTestingModule],
|
||||||
providers: [
|
providers: [
|
||||||
MockBackend,
|
UserService,
|
||||||
BaseRequestOptions,
|
SlimLoadingBarService,
|
||||||
{
|
|
||||||
provide: Http, useFactory: (backend, options) => {
|
|
||||||
return new Http(backend, options);
|
|
||||||
}, deps: [MockBackend, BaseRequestOptions]
|
|
||||||
},
|
|
||||||
NetworkService,
|
NetworkService,
|
||||||
UserService]
|
{provide: ShareService, useClass: MockShareService}
|
||||||
|
]
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should call postJson at login', inject([UserService, NetworkService],
|
||||||
it('should call postJson at login', inject([UserService, NetworkService], (userService, networkService) => {
|
async (userService, networkService) => {
|
||||||
spyOn(networkService, 'postJson');
|
spyOn(networkService, 'postJson');
|
||||||
const credential = new LoginCredential('name', 'pass');
|
const credential = new LoginCredential('name', 'pass');
|
||||||
userService.login(credential);
|
await userService.login(credential);
|
||||||
expect(networkService.postJson).toHaveBeenCalled();
|
expect(networkService.postJson).toHaveBeenCalled();
|
||||||
expect(networkService.postJson.calls.argsFor(0)).toEqual(['/user/login', {'loginCredential': credential}]);
|
expect(networkService.postJson.calls.argsFor(0)).toEqual(['/user/login', {'loginCredential': credential}]);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should call getJson at getSessionUser', inject([UserService, NetworkService], (userService, networkService) => {
|
it('should call getJson at getSessionUser', inject([UserService, NetworkService],
|
||||||
|
async (userService, networkService) => {
|
||||||
spyOn(networkService, 'getJson');
|
spyOn(networkService, 'getJson');
|
||||||
userService.getSessionUser();
|
await userService.getSessionUser();
|
||||||
expect(networkService.getJson).toHaveBeenCalled();
|
expect(networkService.getJson).toHaveBeenCalled();
|
||||||
expect(networkService.getJson.calls.argsFor(0)).toEqual(['/user/login']);
|
expect(networkService.getJson.calls.argsFor(0)).toEqual(['/user/login']);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {Injectable, ViewContainerRef} from '@angular/core';
|
import {Injectable, ViewContainerRef} from '@angular/core';
|
||||||
import {ToastsManager} from 'ng2-toastr/ng2-toastr';
|
import {ToastrService} from 'ngx-toastr';
|
||||||
import {NetworkService} from './network/network.service';
|
import {NetworkService} from './network/network.service';
|
||||||
import {AuthenticationService} from './network/authentication.service';
|
import {AuthenticationService} from './network/authentication.service';
|
||||||
import {NotificationDTO, NotificationType} from '../../../common/entities/NotificationDTO';
|
import {NotificationDTO, NotificationType} from '../../../common/entities/NotificationDTO';
|
||||||
@ -16,7 +16,7 @@ export class NotificationService {
|
|||||||
notifications: NotificationDTO[] = [];
|
notifications: NotificationDTO[] = [];
|
||||||
lastUser: UserDTO = null;
|
lastUser: UserDTO = null;
|
||||||
|
|
||||||
constructor(private _toastr: ToastsManager,
|
constructor(private _toastr: ToastrService,
|
||||||
private _networkService: NetworkService,
|
private _networkService: NetworkService,
|
||||||
private _authService: AuthenticationService,
|
private _authService: AuthenticationService,
|
||||||
public i18n: I18n) {
|
public i18n: I18n) {
|
||||||
@ -53,10 +53,6 @@ export class NotificationService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setRootViewContainerRef(vcr: ViewContainerRef) {
|
|
||||||
this._toastr.setRootViewContainerRef(vcr);
|
|
||||||
}
|
|
||||||
|
|
||||||
success(text, title = null) {
|
success(text, title = null) {
|
||||||
this._toastr.success(text, title, this.options);
|
this._toastr.success(text, title, this.options);
|
||||||
}
|
}
|
||||||
@ -74,7 +70,7 @@ export class NotificationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
get Toastr(): ToastsManager {
|
get Toastr(): ToastrService {
|
||||||
return this._toastr;
|
return this._toastr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,12 +44,6 @@ export class BasicSettingsComponent extends SettingsComponent<BasicConfigDTO> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
calcBaseUrl(): string {
|
calcBaseUrl(): string {
|
||||||
console.log(this.settings.publicUrl.replace(new RegExp('\\\\', 'g'), '/'));
|
|
||||||
console.log(this.settings.publicUrl.replace(new RegExp('\\\\', 'g'), '/')
|
|
||||||
.replace(new RegExp('http://', 'g'), ''));
|
|
||||||
console.log(this.settings.publicUrl.replace(new RegExp('\\\\', 'g'), '/')
|
|
||||||
.replace(new RegExp('http://', 'g'), '')
|
|
||||||
.replace(new RegExp('https://', 'g'), ''));
|
|
||||||
const url = this.settings.publicUrl.replace(new RegExp('\\\\', 'g'), '/')
|
const url = this.settings.publicUrl.replace(new RegExp('\\\\', 'g'), '/')
|
||||||
.replace(new RegExp('http://', 'g'), '')
|
.replace(new RegExp('http://', 'g'), '')
|
||||||
.replace(new RegExp('https://', 'g'), '');
|
.replace(new RegExp('https://', 'g'), '');
|
||||||
|
@ -4,8 +4,7 @@ import {AuthenticationService} from '../../model/network/authentication.service'
|
|||||||
import {NavigationService} from '../../model/navigation.service';
|
import {NavigationService} from '../../model/navigation.service';
|
||||||
import {NotificationService} from '../../model/notification.service';
|
import {NotificationService} from '../../model/notification.service';
|
||||||
import {ErrorDTO} from '../../../../common/entities/Error';
|
import {ErrorDTO} from '../../../../common/entities/Error';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable, interval} from 'rxjs';
|
||||||
import {interval} from 'rxjs/observable/interval';
|
|
||||||
import {IndexingConfig, ReIndexingSensitivity} from '../../../../common/config/private/IPrivateConfig';
|
import {IndexingConfig, ReIndexingSensitivity} from '../../../../common/config/private/IPrivateConfig';
|
||||||
import {SettingsComponent} from '../_abstract/abstract.settings.component';
|
import {SettingsComponent} from '../_abstract/abstract.settings.component';
|
||||||
import {Utils} from '../../../../common/Utils';
|
import {Utils} from '../../../../common/Utils';
|
||||||
|
@ -4,7 +4,7 @@ import {SettingsService} from '../settings.service';
|
|||||||
import {AbstractSettingsService} from '../_abstract/abstract.settings.service';
|
import {AbstractSettingsService} from '../_abstract/abstract.settings.service';
|
||||||
import {DatabaseType, IndexingConfig} from '../../../../common/config/private/IPrivateConfig';
|
import {DatabaseType, IndexingConfig} from '../../../../common/config/private/IPrivateConfig';
|
||||||
import {IndexingProgressDTO} from '../../../../common/entities/settings/IndexingProgressDTO';
|
import {IndexingProgressDTO} from '../../../../common/entities/settings/IndexingProgressDTO';
|
||||||
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
|
import {BehaviorSubject} from 'rxjs';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class IndexingSettingsService extends AbstractSettingsService<IndexingConfig> {
|
export class IndexingSettingsService extends AbstractSettingsService<IndexingConfig> {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
|
import {BehaviorSubject} from 'rxjs';
|
||||||
import {DatabaseType, IPrivateConfig, ReIndexingSensitivity, ThumbnailProcessingLib} from '../../../common/config/private/IPrivateConfig';
|
import {DatabaseType, IPrivateConfig, ReIndexingSensitivity, ThumbnailProcessingLib} from '../../../common/config/private/IPrivateConfig';
|
||||||
import {NetworkService} from '../model/network/network.service';
|
import {NetworkService} from '../model/network/network.service';
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ import 'zone.js/dist/zone'; // Included with Angular CLI.
|
|||||||
* Date, currency, decimal and percent pipes.
|
* Date, currency, decimal and percent pipes.
|
||||||
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
|
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
|
||||||
*/
|
*/
|
||||||
import 'intl'; // Run `npm install --save intl`.
|
// import 'intl'; // Run `npm install --save intl`.
|
||||||
/**
|
/**
|
||||||
* Need to import at least one locale-data with intl.
|
* Need to import at least one locale-data with intl.
|
||||||
*/
|
*/
|
||||||
|
22
gulpfile.js
22
gulpfile.js
@ -33,16 +33,16 @@ gulp.task('build-frontend', function (done) {
|
|||||||
});
|
});
|
||||||
var tasks = [];
|
var tasks = [];
|
||||||
createFrontendTask('build-frontend-release default',
|
createFrontendTask('build-frontend-release default',
|
||||||
"ng build --aot -prod --output-path=./release/dist --no-progress --locale=en" +
|
"ng build --aot --prod --output-path=./release/dist --no-progress --i18n-locale=en" +
|
||||||
" --i18n-format xlf --i18n-file frontend/" + translationFolder + "/messages.en.xlf" +
|
" --i18n-format xlf --i18n-file frontend/" + translationFolder + "/messages.en.xlf" +
|
||||||
" --missing-translation warning");
|
" --i18n-missing-translation warning");
|
||||||
tasks.push('build-frontend-release default');
|
tasks.push('build-frontend-release default');
|
||||||
for (var i = 0; i < languages.length; i++) {
|
for (var i = 0; i < languages.length; i++) {
|
||||||
createFrontendTask('build-frontend-release ' + languages[i],
|
createFrontendTask('build-frontend-release ' + languages[i],
|
||||||
"ng build --aot -prod --output-path=./release/dist/" + languages[i] +
|
"ng build --aot --prod --output-path=./release/dist/" + languages[i] +
|
||||||
" --no-progress --locale=" + languages[i] +
|
" --no-progress --i18n-locale=" + languages[i] +
|
||||||
" --i18n-format xlf --i18n-file frontend/" + translationFolder + "/messages." + languages[i] + ".xlf" +
|
" --i18n-format xlf --i18n-file frontend/" + translationFolder + "/messages." + languages[i] + ".xlf" +
|
||||||
" --missing-translation warning");
|
" --i18n-missing-translation warning");
|
||||||
tasks.push('build-frontend-release ' + languages[i]);
|
tasks.push('build-frontend-release ' + languages[i]);
|
||||||
}
|
}
|
||||||
tasks.push(function () {
|
tasks.push(function () {
|
||||||
@ -108,14 +108,14 @@ var simpleBuild = function (isProd) {
|
|||||||
var tasks = [];
|
var tasks = [];
|
||||||
var cmd = "ng build --aot ";
|
var cmd = "ng build --aot ";
|
||||||
if (isProd) {
|
if (isProd) {
|
||||||
cmd += " -prod "
|
cmd += " --prod "
|
||||||
}
|
}
|
||||||
createFrontendTask('build-frontend default', cmd + "--output-path=./dist --no-progress --no-progress --locale en" +
|
createFrontendTask('build-frontend default', cmd + "--output-path=./dist --no-progress --no-progress --i18n-locale en" +
|
||||||
" --i18n-format=xlf --i18n-file=frontend/" + translationFolder + "/messages.en.xlf" + " --missing-translation warning");
|
" --i18n-format=xlf --i18n-file=frontend/" + translationFolder + "/messages.en.xlf" + " --i18n-missing-translation warning");
|
||||||
tasks.push('build-frontend default');
|
tasks.push('build-frontend default');
|
||||||
for (var i = 0; i < languages.length; i++) {
|
for (var i = 0; i < languages.length; i++) {
|
||||||
createFrontendTask('build-frontend ' + languages[i], cmd + "--output-path=./dist/" + languages[i] + " --no-progress --locale " + languages[i] +
|
createFrontendTask('build-frontend ' + languages[i], cmd + "--output-path=./dist/" + languages[i] + " --no-progress --i18n-locale " + languages[i] +
|
||||||
" --i18n-format=xlf --i18n-file=frontend/" + translationFolder + "/messages." + languages[i] + ".xlf" + " --missing-translation warning");
|
" --i18n-format=xlf --i18n-file=frontend/" + translationFolder + "/messages." + languages[i] + ".xlf" + " --i18n-missing-translation warning");
|
||||||
tasks.push('build-frontend ' + languages[i]);
|
tasks.push('build-frontend ' + languages[i]);
|
||||||
}
|
}
|
||||||
tasks.push(function () {
|
tasks.push(function () {
|
||||||
@ -128,7 +128,7 @@ var simpleBuild = function (isProd) {
|
|||||||
|
|
||||||
gulp.task("extract-locale", function (cb) {
|
gulp.task("extract-locale", function (cb) {
|
||||||
console.log("creating source translation file: locale.source.xlf");
|
console.log("creating source translation file: locale.source.xlf");
|
||||||
exec('ng xi18n -of ./../locale.source.xlf -f xlf --locale en', function (err, stdout, stderr) {
|
exec('ng xi18n -of ./../locale.source.xlf -f xlf --i18n-locale en', function (err, stdout, stderr) {
|
||||||
console.log(stdout);
|
console.log(stdout);
|
||||||
console.log(stderr);
|
console.log(stderr);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -4,19 +4,19 @@
|
|||||||
module.exports = function (config) {
|
module.exports = function (config) {
|
||||||
config.set({
|
config.set({
|
||||||
basePath: '',
|
basePath: '',
|
||||||
frameworks: ['jasmine', '@angular/cli'],
|
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||||
plugins: [
|
plugins: [
|
||||||
require('karma-jasmine'),
|
require('karma-jasmine'),
|
||||||
require('karma-chrome-launcher'),
|
require('karma-chrome-launcher'),
|
||||||
require('karma-jasmine-html-reporter'),
|
require('karma-jasmine-html-reporter'),
|
||||||
require('karma-coverage-istanbul-reporter'),
|
require('karma-coverage-istanbul-reporter'),
|
||||||
require('@angular/cli/plugins/karma')
|
require('@angular-devkit/build-angular/plugins/karma')
|
||||||
],
|
],
|
||||||
client: {
|
client: {
|
||||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||||
},
|
},
|
||||||
coverageIstanbulReporter: {
|
coverageIstanbulReporter: {
|
||||||
reports: ['html', 'lcovonly'],
|
dir: require('path').join(__dirname, 'coverage'), reports: ['html', 'lcovonly'],
|
||||||
fixWebpackSourcePaths: true
|
fixWebpackSourcePaths: true
|
||||||
},
|
},
|
||||||
angularCli: {
|
angularCli: {
|
||||||
|
64
package.json
64
package.json
@ -29,10 +29,10 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bcryptjs": "2.4.3",
|
"bcryptjs": "2.4.3",
|
||||||
"body-parser": "1.18.2",
|
"body-parser": "1.18.3",
|
||||||
"cookie-parser": "^1.4.3",
|
"cookie-parser": "^1.4.3",
|
||||||
"cookie-session": "2.0.0-beta.3",
|
"cookie-session": "2.0.0-beta.3",
|
||||||
"ejs": "2.5.9",
|
"ejs": "2.6.1",
|
||||||
"express": "4.16.3",
|
"express": "4.16.3",
|
||||||
"jimp": "0.2.28",
|
"jimp": "0.2.28",
|
||||||
"locale": "0.1.0",
|
"locale": "0.1.0",
|
||||||
@ -42,37 +42,38 @@
|
|||||||
"ts-exif-parser": "0.1.23",
|
"ts-exif-parser": "0.1.23",
|
||||||
"ts-node-iptc": "1.0.9",
|
"ts-node-iptc": "1.0.9",
|
||||||
"typeconfig": "1.0.6",
|
"typeconfig": "1.0.6",
|
||||||
"typeorm": "0.2.5",
|
"typeorm": "0.2.6",
|
||||||
"winston": "2.4.2"
|
"winston": "2.4.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@agm/core": "1.0.0-beta.2",
|
"@agm/core": "1.0.0-beta.2",
|
||||||
"@angular/animations": "5.2.10",
|
"@angular-devkit/build-angular": "~0.6.3",
|
||||||
"@angular/cli": "1.7.4",
|
"@angular/animations": "6.0.2",
|
||||||
"@angular/common": "5.2.10",
|
"@angular/cli": "6.0.3",
|
||||||
"@angular/compiler": "5.2.10",
|
"@angular/common": "6.0.2",
|
||||||
"@angular/compiler-cli": "5.2.10",
|
"@angular/compiler": "6.0.2",
|
||||||
"@angular/core": "5.2.10",
|
"@angular/compiler-cli": "6.0.2",
|
||||||
"@angular/forms": "5.2.10",
|
"@angular/core": "6.0.2",
|
||||||
"@angular/http": "5.2.10",
|
"@angular/forms": "6.0.2",
|
||||||
"@angular/language-service": "^5.2.10",
|
"@angular/http": "6.0.2",
|
||||||
"@angular/platform-browser": "5.2.10",
|
"@angular/language-service": "^6.0.2",
|
||||||
"@angular/platform-browser-dynamic": "5.2.10",
|
"@angular/platform-browser": "6.0.2",
|
||||||
"@angular/router": "5.2.10",
|
"@angular/platform-browser-dynamic": "6.0.2",
|
||||||
|
"@angular/router": "6.0.2",
|
||||||
"@ngx-translate/i18n-polyfill": "0.1.3",
|
"@ngx-translate/i18n-polyfill": "0.1.3",
|
||||||
"@types/bcryptjs": "2.4.1",
|
"@types/bcryptjs": "2.4.1",
|
||||||
"@types/chai": "4.1.3",
|
"@types/chai": "4.1.3",
|
||||||
"@types/cookie-session": "2.0.34",
|
"@types/cookie-session": "2.0.34",
|
||||||
"@types/express": "4.11.1",
|
"@types/express": "4.11.1",
|
||||||
"@types/gm": "1.17.33",
|
"@types/gm": "1.18.0",
|
||||||
"@types/jasmine": "2.8.6",
|
"@types/jasmine": "2.8.7",
|
||||||
"@types/node": "10.0.3",
|
"@types/node": "10.1.2",
|
||||||
"@types/sharp": "0.17.8",
|
"@types/sharp": "0.17.8",
|
||||||
"@types/winston": "2.3.9",
|
"@types/winston": "2.3.9",
|
||||||
"bootstrap": "4.1.1",
|
"bootstrap": "4.1.1",
|
||||||
"chai": "4.1.2",
|
"chai": "4.1.2",
|
||||||
"codelyzer": "4.3.0",
|
"codelyzer": "4.3.0",
|
||||||
"core-js": "2.5.5",
|
"core-js": "2.5.6",
|
||||||
"ejs-loader": "0.3.1",
|
"ejs-loader": "0.3.1",
|
||||||
"gulp": "3.9.1",
|
"gulp": "3.9.1",
|
||||||
"gulp-json-modify": "1.0.2",
|
"gulp-json-modify": "1.0.2",
|
||||||
@ -86,28 +87,29 @@
|
|||||||
"karma": "2.0.2",
|
"karma": "2.0.2",
|
||||||
"karma-chrome-launcher": "2.2.0",
|
"karma-chrome-launcher": "2.2.0",
|
||||||
"karma-cli": "1.0.1",
|
"karma-cli": "1.0.1",
|
||||||
"karma-coverage-istanbul-reporter": "1.4.2",
|
"karma-coverage-istanbul-reporter": "2.0.0",
|
||||||
"karma-jasmine": "1.1.2",
|
"karma-jasmine": "1.1.2",
|
||||||
"karma-jasmine-html-reporter": "1.0.0",
|
"karma-jasmine-html-reporter": "1.1.0",
|
||||||
"karma-remap-istanbul": "0.6.0",
|
"karma-remap-istanbul": "0.6.0",
|
||||||
"karma-systemjs": "0.16.0",
|
"karma-systemjs": "0.16.0",
|
||||||
"merge2": "1.2.1",
|
"merge2": "1.2.2",
|
||||||
"mocha": "5.1.1",
|
"mocha": "5.2.0",
|
||||||
"ng2-cookies": "1.0.12",
|
"ng2-cookies": "1.0.12",
|
||||||
"ng2-slim-loading-bar": "4.0.0",
|
"ng2-slim-loading-bar": "4.0.0",
|
||||||
"ng2-toastr": "4.1.2",
|
"ngx-bootstrap": "3.0.0",
|
||||||
"ngx-bootstrap": "2.0.4",
|
"ngx-clipboard": "11.1.0",
|
||||||
"ngx-clipboard": "10.0.0",
|
"ngx-toastr": "^8.7.3",
|
||||||
"open-iconic": "1.1.1",
|
"open-iconic": "1.1.1",
|
||||||
"protractor": "5.3.1",
|
"protractor": "5.3.2",
|
||||||
"remap-istanbul": "0.11.1",
|
"remap-istanbul": "0.11.1",
|
||||||
"rimraf": "2.6.2",
|
"rimraf": "2.6.2",
|
||||||
"run-sequence": "2.2.1",
|
"run-sequence": "2.2.1",
|
||||||
"rxjs": "5.5.8",
|
"rxjs": "6.1.0",
|
||||||
|
"rxjs-compat": "^6.1.0",
|
||||||
"ts-helpers": "1.1.2",
|
"ts-helpers": "1.1.2",
|
||||||
"ts-node": "6.0.2",
|
"ts-node": "6.0.3",
|
||||||
"tslint": "5.9.1",
|
"tslint": "5.10.0",
|
||||||
"typescript": "2.8.3",
|
"typescript": "2.7.2",
|
||||||
"xlf-google-translate": "1.0.0-beta.8",
|
"xlf-google-translate": "1.0.0-beta.8",
|
||||||
"zone.js": "0.8.26"
|
"zone.js": "0.8.26"
|
||||||
},
|
},
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
"forin": true,
|
"forin": true,
|
||||||
"import-blacklist": [
|
"import-blacklist": [
|
||||||
true,
|
true,
|
||||||
"rxjs",
|
|
||||||
"rxjs/Rx"
|
"rxjs/Rx"
|
||||||
],
|
],
|
||||||
"import-spacing": true,
|
"import-spacing": true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user