-
-
-
-
-
-
{{ 'collection.edit.tabs.source.head' | translate }}
-
-
-
-
-
-
{{ 'collection.edit.tabs.source.form.head' | translate }}
+
+
+
+
+
+
{{ 'collection.edit.tabs.source.head' | translate }}
+
+
+
+
+
+
{{ 'collection.edit.tabs.source.form.head' | translate }}
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.spec.ts b/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.spec.ts
index 869238b956..3fb1a50bf1 100644
--- a/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.spec.ts
+++ b/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.spec.ts
@@ -62,7 +62,8 @@ describe('CollectionSourceComponent', () => {
label: 'DSpace Intermediate Metadata',
nameSpace: 'http://www.dspace.org/xmlns/dspace/dim'
}
- ]
+ ],
+ _links: { self: { href: 'contentsource-selflink' } }
});
fieldUpdate = {
field: contentSource,
@@ -115,7 +116,7 @@ describe('CollectionSourceComponent', () => {
updateContentSource: observableOf(contentSource),
getHarvesterEndpoint: observableOf('harvester-endpoint')
});
- requestService = jasmine.createSpyObj('requestService', ['removeByHrefSubstring']);
+ requestService = jasmine.createSpyObj('requestService', ['removeByHrefSubstring', 'setStaleByHrefSubstring']);
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), RouterTestingModule],
diff --git a/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.ts b/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.ts
index c4b42d028d..ae48b9309e 100644
--- a/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.ts
+++ b/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.ts
@@ -380,7 +380,7 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
switchMap((uuid) => this.collectionService.getHarvesterEndpoint(uuid)),
take(1)
).subscribe((endpoint) => this.requestService.removeByHrefSubstring(endpoint));
-
+ this.requestService.setStaleByHrefSubstring(this.contentSource._links.self.href);
// Update harvester
this.collectionRD$.pipe(
getFirstSucceededRemoteData(),
diff --git a/src/app/collection-page/edit-collection-page/edit-collection-page.module.ts b/src/app/collection-page/edit-collection-page/edit-collection-page.module.ts
index b743032c8c..0b09542fa0 100644
--- a/src/app/collection-page/edit-collection-page/edit-collection-page.module.ts
+++ b/src/app/collection-page/edit-collection-page/edit-collection-page.module.ts
@@ -9,6 +9,7 @@ import { CollectionCurateComponent } from './collection-curate/collection-curate
import { CollectionSourceComponent } from './collection-source/collection-source.component';
import { CollectionAuthorizationsComponent } from './collection-authorizations/collection-authorizations.component';
import { CollectionFormModule } from '../collection-form/collection-form.module';
+import { CollectionSourceControlsComponent } from './collection-source/collection-source-controls/collection-source-controls.component';
/**
* Module that contains all components related to the Edit Collection page administrator functionality
@@ -26,6 +27,8 @@ import { CollectionFormModule } from '../collection-form/collection-form.module'
CollectionRolesComponent,
CollectionCurateComponent,
CollectionSourceComponent,
+
+ CollectionSourceControlsComponent,
CollectionAuthorizationsComponent
]
})
diff --git a/src/app/core/data/collection-data.service.ts b/src/app/core/data/collection-data.service.ts
index 12bd12ec59..127223b424 100644
--- a/src/app/core/data/collection-data.service.ts
+++ b/src/app/core/data/collection-data.service.ts
@@ -138,7 +138,7 @@ export class CollectionDataService extends ComColDataService
{
* Get the collection's content harvester
* @param collectionId
*/
- getContentSource(collectionId: string): Observable> {
+ getContentSource(collectionId: string, useCachedVersionIfAvailable = true): Observable> {
const href$ = this.getHarvesterEndpoint(collectionId).pipe(
isNotEmptyOperator(),
take(1)
@@ -146,7 +146,7 @@ export class CollectionDataService extends ComColDataService {
href$.subscribe((href: string) => {
const request = new ContentSourceRequest(this.requestService.generateRequestId(), href);
- this.requestService.send(request, true);
+ this.requestService.send(request, useCachedVersionIfAvailable);
});
return this.rdbService.buildSingle(href$);
diff --git a/src/app/core/shared/content-source-set-serializer.spec.ts b/src/app/core/shared/content-source-set-serializer.spec.ts
new file mode 100644
index 0000000000..2203481250
--- /dev/null
+++ b/src/app/core/shared/content-source-set-serializer.spec.ts
@@ -0,0 +1,26 @@
+import { ContentSourceSetSerializer } from './content-source-set-serializer';
+
+describe('ContentSourceSetSerializer', () => {
+ let serializer: ContentSourceSetSerializer;
+
+ beforeEach(() => {
+ serializer = new ContentSourceSetSerializer();
+ });
+
+ describe('Serialize', () => {
+ it('should return all when the value is empty', () => {
+ expect(serializer.Serialize('')).toEqual('all');
+ });
+ it('should return the value when it is not empty', () => {
+ expect(serializer.Serialize('test-value')).toEqual('test-value');
+ });
+ });
+ describe('Deserialize', () => {
+ it('should return an empty value when the value is \'all\'', () => {
+ expect(serializer.Deserialize('all')).toEqual('');
+ });
+ it('should return the value when it is not \'all\'', () => {
+ expect(serializer.Deserialize('test-value')).toEqual('test-value');
+ });
+ });
+});
diff --git a/src/app/core/shared/content-source-set-serializer.ts b/src/app/core/shared/content-source-set-serializer.ts
new file mode 100644
index 0000000000..ec0baec5a6
--- /dev/null
+++ b/src/app/core/shared/content-source-set-serializer.ts
@@ -0,0 +1,31 @@
+import { isEmpty } from '../../shared/empty.util';
+
+/**
+ * Serializer to create convert the 'all' value supported by the server to an empty string and vice versa.
+ */
+export class ContentSourceSetSerializer {
+
+ /**
+ * Method to serialize a setId
+ * @param {string} setId
+ * @returns {string} the provided set ID, unless when an empty set ID is provided. In that case, 'all' will be returned.
+ */
+ Serialize(setId: string): any {
+ if (isEmpty(setId)) {
+ return 'all';
+ }
+ return setId;
+ }
+
+ /**
+ * Method to deserialize a setId
+ * @param {string} setId
+ * @returns {string} the provided set ID. When 'all' is provided, an empty set ID will be returned.
+ */
+ Deserialize(setId: string): string {
+ if (setId === 'all') {
+ return '';
+ }
+ return setId;
+ }
+}
diff --git a/src/app/core/shared/content-source.model.ts b/src/app/core/shared/content-source.model.ts
index 326407822f..40cf43ad0c 100644
--- a/src/app/core/shared/content-source.model.ts
+++ b/src/app/core/shared/content-source.model.ts
@@ -1,4 +1,4 @@
-import { autoserializeAs, deserializeAs, deserialize } from 'cerialize';
+import { autoserializeAs, deserialize, deserializeAs, serializeAs } from 'cerialize';
import { HALLink } from './hal-link.model';
import { MetadataConfig } from './metadata-config.model';
import { CacheableObject } from '../cache/object-cache.reducer';
@@ -6,6 +6,7 @@ import { typedObject } from '../cache/builders/build-decorators';
import { CONTENT_SOURCE } from './content-source.resource-type';
import { excludeFromEquals } from '../utilities/equals.decorators';
import { ResourceType } from './resource-type';
+import { ContentSourceSetSerializer } from './content-source-set-serializer';
/**
* The type of content harvesting used
@@ -49,7 +50,8 @@ export class ContentSource extends CacheableObject {
/**
* OAI Specific set ID
*/
- @autoserializeAs('oai_set_id')
+ @deserializeAs(new ContentSourceSetSerializer(), 'oai_set_id')
+ @serializeAs(new ContentSourceSetSerializer(), 'oai_set_id')
oaiSetId: string;
/**
@@ -70,6 +72,30 @@ export class ContentSource extends CacheableObject {
*/
metadataConfigs: MetadataConfig[];
+ /**
+ * The current harvest status
+ */
+ @autoserializeAs('harvest_status')
+ harvestStatus: string;
+
+ /**
+ * The last's harvest start time
+ */
+ @autoserializeAs('harvest_start_time')
+ harvestStartTime: string;
+
+ /**
+ * When the collection was last harvested
+ */
+ @autoserializeAs('last_harvested')
+ lastHarvested: string;
+
+ /**
+ * The current harvest message
+ */
+ @autoserializeAs('harvest_message')
+ message: string;
+
/**
* The {@link HALLink}s for this ContentSource
*/
diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5
index 1bacd39bbc..7446672cde 100644
--- a/src/assets/i18n/en.json5
+++ b/src/assets/i18n/en.json5
@@ -895,6 +895,30 @@
"collection.select.table.title": "Title",
+ "collection.source.controls.head": "Harvest Controls",
+ "collection.source.controls.test.submit.error": "Something went wrong with initiating the testing of the settings",
+ "collection.source.controls.test.failed": "The script to test the settings has failed",
+ "collection.source.controls.test.completed": "The script to test the settings has successfully finished",
+ "collection.source.controls.test.submit": "Test configuration",
+ "collection.source.controls.test.running": "Testing configuration...",
+ "collection.source.controls.import.submit.success": "The import has been successfully initiated",
+ "collection.source.controls.import.submit.error": "Something went wrong with initiating the import",
+ "collection.source.controls.import.submit": "Import now",
+ "collection.source.controls.import.running": "Importing...",
+ "collection.source.controls.import.failed": "An error occurred during the import",
+ "collection.source.controls.import.completed": "The import completed",
+ "collection.source.controls.reset.submit.success": "The reset and reimport has been successfully initiated",
+ "collection.source.controls.reset.submit.error": "Something went wrong with initiating the reset and reimport",
+ "collection.source.controls.reset.failed": "An error occurred during the reset and reimport",
+ "collection.source.controls.reset.completed": "The reset and reimport completed",
+ "collection.source.controls.reset.submit": "Reset and reimport",
+ "collection.source.controls.reset.running": "Resetting and reimporting...",
+ "collection.source.controls.harvest.status": "Harvest status:",
+ "collection.source.controls.harvest.start": "Harvest start time:",
+ "collection.source.controls.harvest.last": "Last time harvested:",
+ "collection.source.controls.harvest.message": "Harvest info:",
+ "collection.source.controls.harvest.no-information": "N/A",
+
"collection.source.update.notifications.error.content": "The provided settings have been tested and didn't work.",