mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-09 11:03:05 +00:00
Merge branch 'master' into CST-3090-collection-dropdown
This commit is contained in:
@@ -91,6 +91,7 @@
|
|||||||
"express": "4.16.2",
|
"express": "4.16.2",
|
||||||
"fast-json-patch": "^2.0.7",
|
"fast-json-patch": "^2.0.7",
|
||||||
"file-saver": "^1.3.8",
|
"file-saver": "^1.3.8",
|
||||||
|
"filesize": "^6.1.0",
|
||||||
"font-awesome": "4.7.0",
|
"font-awesome": "4.7.0",
|
||||||
"https": "1.0.0",
|
"https": "1.0.0",
|
||||||
"js-cookie": "2.2.0",
|
"js-cookie": "2.2.0",
|
||||||
|
@@ -150,7 +150,8 @@ describe('AuthEffects', () => {
|
|||||||
|
|
||||||
describe('authenticatedSuccess$', () => {
|
describe('authenticatedSuccess$', () => {
|
||||||
|
|
||||||
it('should return a RETRIEVE_AUTHENTICATED_EPERSON action in response to a AUTHENTICATED_SUCCESS action', () => {
|
it('should return a RETRIEVE_AUTHENTICATED_EPERSON action in response to a AUTHENTICATED_SUCCESS action', (done) => {
|
||||||
|
spyOn((authEffects as any).authService, 'storeToken');
|
||||||
actions = hot('--a-', {
|
actions = hot('--a-', {
|
||||||
a: {
|
a: {
|
||||||
type: AuthActionTypes.AUTHENTICATED_SUCCESS, payload: {
|
type: AuthActionTypes.AUTHENTICATED_SUCCESS, payload: {
|
||||||
@@ -163,8 +164,14 @@ describe('AuthEffects', () => {
|
|||||||
|
|
||||||
const expected = cold('--b-', { b: new RetrieveAuthenticatedEpersonAction(EPersonMock._links.self.href) });
|
const expected = cold('--b-', { b: new RetrieveAuthenticatedEpersonAction(EPersonMock._links.self.href) });
|
||||||
|
|
||||||
|
authEffects.authenticatedSuccess$.subscribe(() => {
|
||||||
|
expect(authServiceStub.storeToken).toHaveBeenCalledWith(token);
|
||||||
|
});
|
||||||
|
|
||||||
expect(authEffects.authenticatedSuccess$).toBeObservable(expected);
|
expect(authEffects.authenticatedSuccess$).toBeObservable(expected);
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('checkToken$', () => {
|
describe('checkToken$', () => {
|
||||||
|
@@ -65,7 +65,6 @@ export class AuthEffects {
|
|||||||
@Effect()
|
@Effect()
|
||||||
public authenticateSuccess$: Observable<Action> = this.actions$.pipe(
|
public authenticateSuccess$: Observable<Action> = this.actions$.pipe(
|
||||||
ofType(AuthActionTypes.AUTHENTICATE_SUCCESS),
|
ofType(AuthActionTypes.AUTHENTICATE_SUCCESS),
|
||||||
tap((action: AuthenticationSuccessAction) => this.authService.storeToken(action.payload)),
|
|
||||||
map((action: AuthenticationSuccessAction) => new AuthenticatedAction(action.payload))
|
map((action: AuthenticationSuccessAction) => new AuthenticatedAction(action.payload))
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -82,6 +81,7 @@ export class AuthEffects {
|
|||||||
@Effect()
|
@Effect()
|
||||||
public authenticatedSuccess$: Observable<Action> = this.actions$.pipe(
|
public authenticatedSuccess$: Observable<Action> = this.actions$.pipe(
|
||||||
ofType(AuthActionTypes.AUTHENTICATED_SUCCESS),
|
ofType(AuthActionTypes.AUTHENTICATED_SUCCESS),
|
||||||
|
tap((action: AuthenticatedSuccessAction) => this.authService.storeToken(action.payload.authToken)),
|
||||||
map((action: AuthenticatedSuccessAction) => new RetrieveAuthenticatedEpersonAction(action.payload.userHref))
|
map((action: AuthenticatedSuccessAction) => new RetrieveAuthenticatedEpersonAction(action.payload.userHref))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import { Pipe, PipeTransform } from '@angular/core';
|
import { Pipe, PipeTransform } from '@angular/core';
|
||||||
|
import * as fileSize from 'filesize';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert bytes into largest possible unit.
|
* Convert bytes into largest possible unit.
|
||||||
@@ -12,30 +13,7 @@ import { Pipe, PipeTransform } from '@angular/core';
|
|||||||
|
|
||||||
@Pipe({ name: 'dsFileSize' })
|
@Pipe({ name: 'dsFileSize' })
|
||||||
export class FileSizePipe implements PipeTransform {
|
export class FileSizePipe implements PipeTransform {
|
||||||
|
|
||||||
private units: string[] = [
|
|
||||||
'bytes',
|
|
||||||
'KiB',
|
|
||||||
'MiB',
|
|
||||||
'GiB',
|
|
||||||
'TiB',
|
|
||||||
'PiB'
|
|
||||||
];
|
|
||||||
|
|
||||||
transform(bytes: number = 0, precision: number = 2): string {
|
transform(bytes: number = 0, precision: number = 2): string {
|
||||||
let result: string;
|
return fileSize(bytes, { standard: 'jedec', round: precision });
|
||||||
if (isNaN(parseFloat(String(bytes))) || !isFinite(bytes)) {
|
|
||||||
result = '?';
|
|
||||||
} else {
|
|
||||||
let unit = 0;
|
|
||||||
|
|
||||||
while (bytes >= 1024) {
|
|
||||||
bytes /= 1024;
|
|
||||||
unit++;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = bytes.toFixed(+ precision) + ' ' + this.units[unit];
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -52,11 +52,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/***************************************************************************************************
|
|
||||||
* Zone JS is required by default for Angular itself.
|
|
||||||
*/
|
|
||||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
|
||||||
|
|
||||||
/***************************************************************************************************
|
/***************************************************************************************************
|
||||||
* APPLICATION IMPORTS
|
* APPLICATION IMPORTS
|
||||||
*/
|
*/
|
||||||
@@ -64,4 +59,6 @@ import 'zone.js/dist/zone'; // Included with Angular CLI.
|
|||||||
import 'core-js/es';
|
import 'core-js/es';
|
||||||
import 'core-js/features/reflect';
|
import 'core-js/features/reflect';
|
||||||
|
|
||||||
|
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||||
|
|
||||||
import 'reflect-metadata';
|
import 'reflect-metadata';
|
||||||
|
@@ -4309,6 +4309,11 @@ filesize@^3.6.1:
|
|||||||
resolved "https://registry.yarnpkg.com/filesize/-/filesize-3.6.1.tgz#090bb3ee01b6f801a8a8be99d31710b3422bb317"
|
resolved "https://registry.yarnpkg.com/filesize/-/filesize-3.6.1.tgz#090bb3ee01b6f801a8a8be99d31710b3422bb317"
|
||||||
integrity sha512-7KjR1vv6qnicaPMi1iiTcI85CyYwRO/PSFCu6SvqL8jN2Wjt/NIYQTFtFs7fSDCYOstUkEWIQGFUg5YZQfjlcg==
|
integrity sha512-7KjR1vv6qnicaPMi1iiTcI85CyYwRO/PSFCu6SvqL8jN2Wjt/NIYQTFtFs7fSDCYOstUkEWIQGFUg5YZQfjlcg==
|
||||||
|
|
||||||
|
filesize@^6.1.0:
|
||||||
|
version "6.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/filesize/-/filesize-6.1.0.tgz#e81bdaa780e2451d714d71c0d7a4f3238d37ad00"
|
||||||
|
integrity sha512-LpCHtPQ3sFx67z+uh2HnSyWSLLu5Jxo21795uRDuar/EOuYWXib5EmPaGIBuSnRqH2IODiKA2k5re/K9OnN/Yg==
|
||||||
|
|
||||||
fill-range@^4.0.0:
|
fill-range@^4.0.0:
|
||||||
version "4.0.0"
|
version "4.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7"
|
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7"
|
||||||
|
Reference in New Issue
Block a user