mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 23:13:04 +00:00
Added typedoc comments
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<div class="parent mb-3">
|
||||
<div class="upload">
|
||||
<ds-uploader *ngIf="uploadFilesOptions.url !== ''"
|
||||
[onBeforeUpload]="onBeforeUpload"
|
||||
[uploadFilesOptions]="uploadFilesOptions"
|
||||
(onCompleteItem)="onCompleteItem($event)"
|
||||
(onUploadError)="onUploadError($event)"></ds-uploader>
|
||||
|
@@ -16,15 +16,20 @@ import { HALEndpointService } from '../../core/shared/hal-endpoint.service';
|
||||
import { NotificationType } from '../../shared/notifications/models/notification-type';
|
||||
import { hasValue } from '../../shared/empty.util';
|
||||
|
||||
/**
|
||||
* This component represents the whole mydspace page header
|
||||
*/
|
||||
@Component({
|
||||
selector: 'ds-my-dspace-new-submission',
|
||||
styleUrls: ['./my-dspace-new-submission.component.scss'],
|
||||
templateUrl: './my-dspace-new-submission.component.html'
|
||||
})
|
||||
|
||||
export class MyDSpaceNewSubmissionComponent implements OnDestroy, OnInit {
|
||||
@Output() uploadEnd = new EventEmitter<Array<MyDSpaceResult<DSpaceObject>>>();
|
||||
|
||||
/**
|
||||
* The UploaderOptions object
|
||||
*/
|
||||
public uploadFilesOptions: UploaderOptions = {
|
||||
url: '',
|
||||
authToken: null,
|
||||
@@ -32,8 +37,21 @@ export class MyDSpaceNewSubmissionComponent implements OnDestroy, OnInit {
|
||||
itemAlias: null
|
||||
};
|
||||
|
||||
/**
|
||||
* Subscription to unsubscribe from
|
||||
*/
|
||||
private sub: Subscription;
|
||||
|
||||
/**
|
||||
* Initialize instance variables
|
||||
*
|
||||
* @param {AuthService} authService
|
||||
* @param {ChangeDetectorRef} changeDetectorRef
|
||||
* @param {HALEndpointService} halService
|
||||
* @param {NotificationsService} notificationsService
|
||||
* @param {Store<SubmissionState>} store
|
||||
* @param {TranslateService} translate
|
||||
*/
|
||||
constructor(private authService: AuthService,
|
||||
private changeDetectorRef: ChangeDetectorRef,
|
||||
private halService: HALEndpointService,
|
||||
@@ -42,6 +60,9 @@ export class MyDSpaceNewSubmissionComponent implements OnDestroy, OnInit {
|
||||
private translate: TranslateService) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize url and Bearer token
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.sub = this.halService.getEndpoint('workspaceitems').pipe(first()).subscribe((url) => {
|
||||
this.uploadFilesOptions.url = url;
|
||||
@@ -51,10 +72,9 @@ export class MyDSpaceNewSubmissionComponent implements OnDestroy, OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
onBeforeUpload = () => {
|
||||
// Nothing
|
||||
};
|
||||
|
||||
/**
|
||||
* Method called when file upload is completed to notify upload status
|
||||
*/
|
||||
public onCompleteItem(res) {
|
||||
if (res && res._embedded && res._embedded.workspaceitems && res._embedded.workspaceitems.length > 0) {
|
||||
const workspaceitems = res._embedded.workspaceitems;
|
||||
@@ -80,10 +100,16 @@ export class MyDSpaceNewSubmissionComponent implements OnDestroy, OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called on file upload error
|
||||
*/
|
||||
public onUploadError() {
|
||||
this.notificationsService.error(null, this.translate.get('mydspace.upload.upload-failed'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsubscribe from the subscription
|
||||
*/
|
||||
ngOnDestroy(): void {
|
||||
if (hasValue(this.sub)) {
|
||||
this.sub.unsubscribe();
|
||||
|
@@ -1,38 +1,56 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AppState } from '../../app.reducer';
|
||||
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { distinctUntilChanged } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { RoleType } from './role-types';
|
||||
import { CollectionDataService } from '../data/collection-data.service';
|
||||
|
||||
/**
|
||||
* A service that provides methods to identify user role.
|
||||
*/
|
||||
@Injectable()
|
||||
export class RoleService {
|
||||
|
||||
constructor(
|
||||
private collectionService: CollectionDataService,
|
||||
private store: Store<AppState>) {
|
||||
|
||||
/**
|
||||
* Initialize instance variables
|
||||
*
|
||||
* @param {CollectionDataService} collectionService
|
||||
*/
|
||||
constructor(private collectionService: CollectionDataService) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if current user is a submitter
|
||||
*/
|
||||
isSubmitter(): Observable<boolean> {
|
||||
return this.collectionService.hasAuthorizedCollection().pipe(
|
||||
distinctUntilChanged()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if current user is a controller
|
||||
*/
|
||||
isController(): Observable<boolean> {
|
||||
// TODO find a way to check if user is a controller
|
||||
return observableOf(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if current user is an admin
|
||||
*/
|
||||
isAdmin(): Observable<boolean> {
|
||||
// TODO find a way to check if user is an admin
|
||||
return observableOf(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if current user by role type
|
||||
*
|
||||
* @param {RoleType} role
|
||||
* the role type
|
||||
*/
|
||||
checkRole(role: RoleType): Observable<boolean> {
|
||||
let check: Observable<boolean>;
|
||||
switch (role) {
|
||||
|
@@ -3,6 +3,9 @@ import { SearchResult } from '../../../+search-page/search-result.model';
|
||||
import { MyDSpaceConfigurationValueType } from '../../../+my-dspace-page/my-dspace-configuration-value-type';
|
||||
import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator';
|
||||
|
||||
/**
|
||||
* Represents a search result object of a ClaimedTask object
|
||||
*/
|
||||
@searchResultFor(ClaimedTask, MyDSpaceConfigurationValueType.Workflow)
|
||||
export class ClaimedTaskMyDSpaceResult extends SearchResult<ClaimedTask> {
|
||||
}
|
||||
|
@@ -3,6 +3,9 @@ import { SearchResult } from '../../../+search-page/search-result.model';
|
||||
import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator';
|
||||
import { MyDSpaceConfigurationValueType } from '../../../+my-dspace-page/my-dspace-configuration-value-type';
|
||||
|
||||
/**
|
||||
* Represents a search result object of a Item object
|
||||
*/
|
||||
@searchResultFor(Item, MyDSpaceConfigurationValueType.Workspace)
|
||||
export class ItemMyDSpaceResult extends SearchResult<Item> {
|
||||
}
|
||||
|
@@ -3,6 +3,9 @@ import { SearchResult } from '../../../+search-page/search-result.model';
|
||||
import { MyDSpaceConfigurationValueType } from '../../../+my-dspace-page/my-dspace-configuration-value-type';
|
||||
import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator';
|
||||
|
||||
/**
|
||||
* Represents a search result object of a PoolTask object
|
||||
*/
|
||||
@searchResultFor(PoolTask, MyDSpaceConfigurationValueType.Workflow)
|
||||
export class PoolTaskMyDSpaceResult extends SearchResult<PoolTask> {
|
||||
}
|
||||
|
@@ -3,6 +3,9 @@ import { SearchResult } from '../../../+search-page/search-result.model';
|
||||
import { MyDSpaceConfigurationValueType } from '../../../+my-dspace-page/my-dspace-configuration-value-type';
|
||||
import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator';
|
||||
|
||||
/**
|
||||
* Represents a search result object of a Workflowitem object
|
||||
*/
|
||||
@searchResultFor(Workflowitem, MyDSpaceConfigurationValueType.Workspace)
|
||||
export class WorkflowitemMyDSpaceResult extends SearchResult<Workflowitem> {
|
||||
}
|
||||
|
@@ -3,6 +3,9 @@ import { MyDSpaceConfigurationValueType } from '../../../+my-dspace-page/my-dspa
|
||||
import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator';
|
||||
import { SearchResult } from '../../../+search-page/search-result.model';
|
||||
|
||||
/**
|
||||
* Represents a search result object of a Workspaceitem object
|
||||
*/
|
||||
@searchResultFor(Workspaceitem, MyDSpaceConfigurationValueType.Workspace)
|
||||
export class WorkspaceitemMyDSpaceResult extends SearchResult<Workspaceitem> {
|
||||
}
|
||||
|
@@ -16,6 +16,9 @@ import { ListableObject } from '../object-collection/shared/listable-object.mode
|
||||
|
||||
import { PaginationComponentOptions } from '../pagination/pagination-component-options.model';
|
||||
|
||||
/**
|
||||
* This component renders a paginated set of results in the detail view.
|
||||
*/
|
||||
@Component({
|
||||
changeDetection: ChangeDetectionStrategy.Default,
|
||||
encapsulation: ViewEncapsulation.Emulated,
|
||||
|
Reference in New Issue
Block a user