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