diff --git a/src/app/+my-dspace-page/my-dspace-new-submission/my-dspace-new-submission.component.ts b/src/app/+my-dspace-page/my-dspace-new-submission/my-dspace-new-submission.component.ts
index 6c1a6963c9..938a1ec899 100644
--- a/src/app/+my-dspace-page/my-dspace-new-submission/my-dspace-new-submission.component.ts
+++ b/src/app/+my-dspace-page/my-dspace-new-submission/my-dspace-new-submission.component.ts
@@ -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
>>();
+ /**
+ * 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} 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();
diff --git a/src/app/core/roles/role.service.ts b/src/app/core/roles/role.service.ts
index 49c358d3f5..7a4b6e6ccf 100644
--- a/src/app/core/roles/role.service.ts
+++ b/src/app/core/roles/role.service.ts
@@ -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) {
-
+ /**
+ * Initialize instance variables
+ *
+ * @param {CollectionDataService} collectionService
+ */
+ constructor(private collectionService: CollectionDataService) {
}
+ /**
+ * Check if current user is a submitter
+ */
isSubmitter(): Observable {
return this.collectionService.hasAuthorizedCollection().pipe(
distinctUntilChanged()
);
}
+ /**
+ * Check if current user is a controller
+ */
isController(): Observable {
// TODO find a way to check if user is a controller
return observableOf(true);
}
+ /**
+ * Check if current user is an admin
+ */
isAdmin(): Observable {
// 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 {
let check: Observable;
switch (role) {
diff --git a/src/app/shared/object-collection/shared/claimed-task-my-dspace-result.model.ts b/src/app/shared/object-collection/shared/claimed-task-my-dspace-result.model.ts
index 7c5fe42a0f..051bfe6d9f 100644
--- a/src/app/shared/object-collection/shared/claimed-task-my-dspace-result.model.ts
+++ b/src/app/shared/object-collection/shared/claimed-task-my-dspace-result.model.ts
@@ -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 {
}
diff --git a/src/app/shared/object-collection/shared/item-my-dspace-result.model.ts b/src/app/shared/object-collection/shared/item-my-dspace-result.model.ts
index 3ccf111337..92724a762f 100644
--- a/src/app/shared/object-collection/shared/item-my-dspace-result.model.ts
+++ b/src/app/shared/object-collection/shared/item-my-dspace-result.model.ts
@@ -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- {
}
diff --git a/src/app/shared/object-collection/shared/pool-task-my-dspace-result.model.ts b/src/app/shared/object-collection/shared/pool-task-my-dspace-result.model.ts
index 04352b5b4c..1bc2c4c4c2 100644
--- a/src/app/shared/object-collection/shared/pool-task-my-dspace-result.model.ts
+++ b/src/app/shared/object-collection/shared/pool-task-my-dspace-result.model.ts
@@ -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 {
}
diff --git a/src/app/shared/object-collection/shared/workflowitem-my-dspace-result.model.ts b/src/app/shared/object-collection/shared/workflowitem-my-dspace-result.model.ts
index d60fabc04c..89f6f351ad 100644
--- a/src/app/shared/object-collection/shared/workflowitem-my-dspace-result.model.ts
+++ b/src/app/shared/object-collection/shared/workflowitem-my-dspace-result.model.ts
@@ -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 {
}
diff --git a/src/app/shared/object-collection/shared/workspaceitem-my-dspace-result.model.ts b/src/app/shared/object-collection/shared/workspaceitem-my-dspace-result.model.ts
index 381b8cd3c4..20474c9ad3 100644
--- a/src/app/shared/object-collection/shared/workspaceitem-my-dspace-result.model.ts
+++ b/src/app/shared/object-collection/shared/workspaceitem-my-dspace-result.model.ts
@@ -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 {
}
diff --git a/src/app/shared/object-detail/object-detail.component.ts b/src/app/shared/object-detail/object-detail.component.ts
index a22d0f89ce..3187a2cd1b 100644
--- a/src/app/shared/object-detail/object-detail.component.ts
+++ b/src/app/shared/object-detail/object-detail.component.ts
@@ -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,