mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
[CST-4875] Fix imports path
This commit is contained in:
@@ -8,7 +8,7 @@ import { NotificationsService } from '../../shared/notifications/notifications.s
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { DSOChangeAnalyzer } from 'src/app/core/data/dso-change-analyzer.service';
|
||||
import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service';
|
||||
import { Feedback } from './models/feedback.model';
|
||||
|
||||
describe('FeedbackDataService', () => {
|
||||
@@ -85,16 +85,4 @@ describe('FeedbackDataService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('createFeedback', () => {
|
||||
beforeEach(() => {
|
||||
spyOn(service, 'create');
|
||||
service.createFeedback(feedbackPayload);
|
||||
});
|
||||
|
||||
it('should call postToEndpoint with the payload', () => {
|
||||
expect(service.create).toHaveBeenCalledWith(feedbackPayload);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -3,17 +3,16 @@ import { Observable } from 'rxjs';
|
||||
import { DataService } from '../data/data.service';
|
||||
import { Feedback } from './models/feedback.model';
|
||||
import { FEEDBACK } from './models/feedback.resource-type';
|
||||
import { dataService } from 'src/app/core/cache/builders/build-decorators';
|
||||
import { RequestService } from 'src/app/core/data/request.service';
|
||||
import { RemoteDataBuildService } from 'src/app/core/cache/builders/remote-data-build.service';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { RequestService } from '../data/request.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { ObjectCacheService } from 'src/app/core/cache/object-cache.service';
|
||||
import { HALEndpointService } from 'src/app/core/shared/hal-endpoint.service';
|
||||
import { NotificationsService } from 'src/app/shared/notifications/notifications.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { DSOChangeAnalyzer } from 'src/app/core/data/dso-change-analyzer.service';
|
||||
import { getFirstSucceededRemoteData, getRemoteDataPayload } from 'src/app/core/shared/operators';
|
||||
import { RemoteData } from 'src/app/core/data/remote-data';
|
||||
import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service';
|
||||
import { getFirstSucceededRemoteData, getRemoteDataPayload } from '../shared/operators';
|
||||
|
||||
/**
|
||||
* Service for checking and managing the feedback
|
||||
@@ -21,41 +20,30 @@ import { RemoteData } from 'src/app/core/data/remote-data';
|
||||
@Injectable()
|
||||
@dataService(FEEDBACK)
|
||||
export class FeedbackDataService extends DataService<Feedback> {
|
||||
protected linkPath = 'feedbacks';
|
||||
protected linkPath = 'feedbacks';
|
||||
|
||||
constructor(
|
||||
protected requestService: RequestService,
|
||||
protected rdbService: RemoteDataBuildService,
|
||||
protected store: Store<any>,
|
||||
protected objectCache: ObjectCacheService,
|
||||
protected halService: HALEndpointService,
|
||||
protected notificationsService: NotificationsService,
|
||||
protected http: HttpClient,
|
||||
protected comparator: DSOChangeAnalyzer<Feedback>,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
constructor(
|
||||
protected requestService: RequestService,
|
||||
protected rdbService: RemoteDataBuildService,
|
||||
protected store: Store<any>,
|
||||
protected objectCache: ObjectCacheService,
|
||||
protected halService: HALEndpointService,
|
||||
protected notificationsService: NotificationsService,
|
||||
protected http: HttpClient,
|
||||
protected comparator: DSOChangeAnalyzer<Feedback>,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get feedback from its id
|
||||
* @param uuid string the id of the feedback
|
||||
*/
|
||||
getFeedback(uuid: string): Observable<Feedback> {
|
||||
return this.findById(uuid).pipe(
|
||||
getFirstSucceededRemoteData(),
|
||||
getRemoteDataPayload(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create feedback
|
||||
* @param payload feedback to be sent
|
||||
* @return Observable<RemoteData<Feedback>
|
||||
* server response
|
||||
*/
|
||||
createFeedback(payload: Feedback): Observable<RemoteData<Feedback>> {
|
||||
return this.create(payload);
|
||||
}
|
||||
/**
|
||||
* Get feedback from its id
|
||||
* @param uuid string the id of the feedback
|
||||
*/
|
||||
getFeedback(uuid: string): Observable<Feedback> {
|
||||
return this.findById(uuid).pipe(
|
||||
getFirstSucceededRemoteData(),
|
||||
getRemoteDataPayload(),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot, UrlTree } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { AuthorizationDataService } from '../data/feature-authorization/authorization-data.service';
|
||||
import { FeatureID } from 'src/app/core/data/feature-authorization/feature-id';
|
||||
import { FeatureID } from '../data/feature-authorization/feature-id';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
/**
|
||||
@@ -10,11 +10,11 @@ import { Injectable } from '@angular/core';
|
||||
@Injectable()
|
||||
export class FeedbackGuard implements CanActivate {
|
||||
|
||||
constructor(private authorizationService: AuthorizationDataService) {
|
||||
}
|
||||
constructor(private authorizationService: AuthorizationDataService) {
|
||||
}
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> {
|
||||
return this.authorizationService.isAuthorized(FeatureID.CanSendFeedback);
|
||||
}
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> {
|
||||
return this.authorizationService.isAuthorized(FeatureID.CanSendFeedback);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -6,5 +6,4 @@ import { ResourceType } from '../../shared/resource-type';
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
|
||||
export const FEEDBACK = new ResourceType('feedback');
|
||||
|
@@ -30,7 +30,7 @@
|
||||
<input class="form-control" formControlName="page" name="page" type="hidden" [value]="routeService.getPreviousUrl() | async"
|
||||
/>
|
||||
<div class="row py-2">
|
||||
<div class="control-group col-sm-12">
|
||||
<div class="control-group col-sm-12 text-right">
|
||||
<button [disabled]="!feedbackForm.valid" class="btn btn-primary" name="submit" type="submit">{{ 'info.feedback.send' | translate }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -3,16 +3,16 @@ import { FeedbackDataService } from '../../../core/feedback/feedback-data.servic
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { FeedbackFormComponent } from './feedback-form.component';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { NO_ERRORS_SCHEMA, DebugElement } from '@angular/core';
|
||||
import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { RouteService } from 'src/app/core/services/route.service';
|
||||
import { routeServiceStub } from 'src/app/shared/testing/route-service.stub';
|
||||
import { RouteService } from '../../../core/services/route.service';
|
||||
import { routeServiceStub } from '../../../shared/testing/route-service.stub';
|
||||
import { FormBuilder } from '@angular/forms';
|
||||
import { NotificationsService } from 'src/app/shared/notifications/notifications.service';
|
||||
import { NotificationsServiceStub } from 'src/app/shared/testing/notifications-service.stub';
|
||||
import { AuthService } from 'src/app/core/auth/auth.service';
|
||||
import { AuthServiceStub } from 'src/app/shared/testing/auth-service.stub';
|
||||
import { of } from 'rxjs/internal/observable/of';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||
import { AuthService } from '../../../core/auth/auth.service';
|
||||
import { AuthServiceStub } from '../../../shared/testing/auth-service.stub';
|
||||
import { of } from 'rxjs';
|
||||
import { Feedback } from '../../../core/feedback/models/feedback.model';
|
||||
|
||||
|
||||
|
@@ -2,11 +2,11 @@ import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { NoContent } from '../../../core/shared/NoContent.model';
|
||||
import { FeedbackDataService } from '../../../core/feedback/feedback-data.service';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { RouteService } from 'src/app/core/services/route.service';
|
||||
import { RouteService } from '../../../core/services/route.service';
|
||||
import { FormBuilder, Validators } from '@angular/forms';
|
||||
import { NotificationsService } from 'src/app/shared/notifications/notifications.service';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { AuthService } from 'src/app/core/auth/auth.service';
|
||||
import { AuthService } from '../../../core/auth/auth.service';
|
||||
import { EPerson } from '../../../core/eperson/models/eperson.model';
|
||||
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||
|
||||
|
Reference in New Issue
Block a user