-
-
diff --git a/src/app/+item-page/edit-item-page/item-status/item-status.component.ts b/src/app/+item-page/edit-item-page/item-status/item-status.component.ts
index 28cd23a5fe..b9a9e4a2f3 100644
--- a/src/app/+item-page/edit-item-page/item-status/item-status.component.ts
+++ b/src/app/+item-page/edit-item-page/item-status/item-status.component.ts
@@ -6,6 +6,7 @@ import { ItemOperation } from '../item-operation/itemOperation.model';
import { first, map } from 'rxjs/operators';
import { Observable } from 'rxjs';
import { RemoteData } from '../../../core/data/remote-data';
+import { getItemEditPath, getItemPageRoute } from '../../item-page-routing.module';
@Component({
selector: 'ds-item-status',
@@ -68,16 +69,16 @@ export class ItemStatusComponent implements OnInit {
*/
this.operations = [];
if (item.isWithdrawn) {
- this.operations.push(new ItemOperation('reinstate', this.getCurrentUrl() + '/reinstate'));
+ this.operations.push(new ItemOperation('reinstate', this.getCurrentUrl(item) + '/reinstate'));
} else {
- this.operations.push(new ItemOperation('withdraw', this.getCurrentUrl() + '/withdraw'));
+ this.operations.push(new ItemOperation('withdraw', this.getCurrentUrl(item) + '/withdraw'));
}
if (item.isDiscoverable) {
- this.operations.push(new ItemOperation('private', this.getCurrentUrl() + '/private'));
+ this.operations.push(new ItemOperation('private', this.getCurrentUrl(item) + '/private'));
} else {
- this.operations.push(new ItemOperation('public', this.getCurrentUrl() + '/public'));
+ this.operations.push(new ItemOperation('public', this.getCurrentUrl(item) + '/public'));
}
- this.operations.push(new ItemOperation('delete', this.getCurrentUrl() + '/delete'));
+ this.operations.push(new ItemOperation('delete', this.getCurrentUrl(item) + '/delete'));
});
}
@@ -86,20 +87,16 @@ export class ItemStatusComponent implements OnInit {
* Get the url to the simple item page
* @returns {string} url
*/
- getItemPage(): string {
- return this.router.url.substr(0, this.router.url.lastIndexOf('/'));
+ getItemPage(item: Item): string {
+ return getItemPageRoute(item.id)
}
/**
* Get the current url without query params
* @returns {string} url
*/
- getCurrentUrl(): string {
- if (this.router.url.indexOf('?') > -1) {
- return this.router.url.substr(0, this.router.url.indexOf('?'));
- } else {
- return this.router.url;
- }
+ getCurrentUrl(item: Item): string {
+ return getItemEditPath(item.id);
}
}
diff --git a/src/app/core/core.module.ts b/src/app/core/core.module.ts
index 1039ded993..357f552074 100644
--- a/src/app/core/core.module.ts
+++ b/src/app/core/core.module.ts
@@ -68,6 +68,7 @@ import { MenuService } from '../shared/menu/menu.service';
import { NormalizedObjectBuildService } from './cache/builders/normalized-object-build.service';
import { DSOChangeAnalyzer } from './data/dso-change-analyzer.service';
import { ObjectUpdatesService } from './data/object-updates/object-updates.service';
+import { DefaultChangeAnalyzer } from './data/default-change-analyzer.service';
const IMPORTS = [
CommonModule,
@@ -133,6 +134,7 @@ const PROVIDERS = [
UUIDService,
DSpaceObjectDataService,
DSOChangeAnalyzer,
+ DefaultChangeAnalyzer,
CSSVariableService,
MenuService,
ObjectUpdatesService,
diff --git a/src/app/core/data/default-change-analyzer.service.ts b/src/app/core/data/default-change-analyzer.service.ts
new file mode 100644
index 0000000000..1fd207d2bf
--- /dev/null
+++ b/src/app/core/data/default-change-analyzer.service.ts
@@ -0,0 +1,29 @@
+import { Operation } from 'fast-json-patch/lib/core';
+import { compare } from 'fast-json-patch';
+import { ChangeAnalyzer } from './change-analyzer';
+import { NormalizedDSpaceObject } from '../cache/models/normalized-dspace-object.model';
+import { Injectable } from '@angular/core';
+import { DSpaceObject } from '../shared/dspace-object.model';
+import { CacheableObject } from '../cache/object-cache.reducer';
+import { NormalizedObject } from '../cache/models/normalized-object.model';
+
+/**
+ * A class to determine what differs between two
+ * CacheableObjects
+ */
+@Injectable()
+export class DefaultChangeAnalyzer implements ChangeAnalyzer {
+
+ /**
+ * Compare the metadata of two CacheableObject and return the differences as
+ * a JsonPatch Operation Array
+ *
+ * @param {NormalizedObject} object1
+ * The first object to compare
+ * @param {NormalizedObject} object2
+ * The second object to compare
+ */
+ diff(object1: T | NormalizedObject, object2: T | NormalizedObject): Operation[] {
+ return compare(object1, object2);
+ }
+}
diff --git a/src/app/core/data/metadata-schema-data.service.ts b/src/app/core/data/metadata-schema-data.service.ts
index 7f17ad9cf1..ab5b859530 100644
--- a/src/app/core/data/metadata-schema-data.service.ts
+++ b/src/app/core/data/metadata-schema-data.service.ts
@@ -11,10 +11,10 @@ import { HALEndpointService } from '../shared/hal-endpoint.service';
import { FindAllOptions } from './request.models';
import { ObjectCacheService } from '../cache/object-cache.service';
import { MetadataSchema } from '../metadata/metadataschema.model';
-import { ChangeAnalyzer } from './change-analyzer';
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
import { HttpClient } from '@angular/common/http';
import { NotificationsService } from '../../shared/notifications/notifications.service';
+import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
@Injectable()
export class MetadataSchemaDataService extends DataService {
@@ -27,7 +27,7 @@ export class MetadataSchemaDataService extends DataService {
private bs: BrowseService,
protected halService: HALEndpointService,
protected objectCache: ObjectCacheService,
- protected comparator: ChangeAnalyzer,
+ protected comparator: DefaultChangeAnalyzer,
protected dataBuildService: NormalizedObjectBuildService,
protected http: HttpClient,
protected notificationsService: NotificationsService) {
diff --git a/src/app/core/metadata/metadata.service.spec.ts b/src/app/core/metadata/metadata.service.spec.ts
index 1841fba6a0..25579a0690 100644
--- a/src/app/core/metadata/metadata.service.spec.ts
+++ b/src/app/core/metadata/metadata.service.spec.ts
@@ -228,6 +228,7 @@ describe('MetadataService', () => {
const mockPublisher = (mockItem: Item): Item => {
const publishedMockItem = Object.assign(new Item(), mockItem) as Item;
publishedMockItem.metadata.push({
+ uuid: 'b3826cf5-5f07-44cf-88d8-2da968354d18',
key: 'dc.publisher',
language: 'en_US',
value: 'Mock Publisher'
diff --git a/src/styles/_bootstrap_variables.scss b/src/styles/_bootstrap_variables.scss
index d24811b382..7be76ff5d3 100644
--- a/src/styles/_bootstrap_variables.scss
+++ b/src/styles/_bootstrap_variables.scss
@@ -19,7 +19,6 @@ $gray-700: lighten($gray-base, 46.6%) !default; // #777
$gray-600: lighten($gray-base, 73.3%) !default; // #bbb
$gray-100: lighten($gray-base, 93.5%) !default; // #eee
-
/* Reassign color vars to semantic color scheme */
$blue: #2B4E72 !default;
$green: #94BA65 !default;
diff --git a/src/styles/_custom_variables.scss b/src/styles/_custom_variables.scss
index dda018ad2c..05387e8740 100644
--- a/src/styles/_custom_variables.scss
+++ b/src/styles/_custom_variables.scss
@@ -1,7 +1,6 @@
$content-spacing: $spacer * 1.5;
$button-height: $input-btn-padding-y * 2 + $input-btn-line-height + calculateRem($input-btn-border-width*2);
-$button-min-width: 100px;
$card-height-percentage:98%;
$card-thumbnail-height:240px;
@@ -24,3 +23,6 @@ $admin-sidebar-header-bg: darken($dark, 7%);
$dark-scrollbar-background: $admin-sidebar-active-bg;
$dark-scrollbar-foreground: #47495d;
+
+$edit-item-button-min-width: 100px;
+$edit-item-metadata-field-width: 190px;
\ No newline at end of file