mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Merge branch 'main' into w2p-121534_removed-metadata-export-search-request-for-non-admins-on-search_contribute-main
This commit is contained in:
125
package-lock.json
generated
125
package-lock.json
generated
@@ -109,7 +109,7 @@
|
|||||||
"compression-webpack-plugin": "^9.2.0",
|
"compression-webpack-plugin": "^9.2.0",
|
||||||
"copy-webpack-plugin": "^6.4.1",
|
"copy-webpack-plugin": "^6.4.1",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"cypress": "^13.15.1",
|
"cypress": "^13.16.0",
|
||||||
"cypress-axe": "^1.5.0",
|
"cypress-axe": "^1.5.0",
|
||||||
"deep-freeze": "0.0.1",
|
"deep-freeze": "0.0.1",
|
||||||
"eslint": "^8.39.0",
|
"eslint": "^8.39.0",
|
||||||
@@ -4258,9 +4258,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@cypress/request": {
|
"node_modules/@cypress/request": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/@cypress/request/-/request-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@cypress/request/-/request-3.0.6.tgz",
|
||||||
"integrity": "sha512-eqNHMsxEXuit0sRvvWoGG3/4+Q5qwqjKARWXKM/KoSsKvTNBwWt8pwspg5+TniP3POAZcPPx0O8CiEIQ4e6NWg==",
|
"integrity": "sha512-fi0eVdCOtKu5Ed6+E8mYxUF6ZTFJDZvHogCBelM0xVXmrDEkyM22gRArQzq1YcHPm1V47Vf/iAD+WgVdUlJCGg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"aws-sign2": "~0.7.0",
|
"aws-sign2": "~0.7.0",
|
||||||
@@ -4269,7 +4269,7 @@
|
|||||||
"combined-stream": "~1.0.6",
|
"combined-stream": "~1.0.6",
|
||||||
"extend": "~3.0.2",
|
"extend": "~3.0.2",
|
||||||
"forever-agent": "~0.6.1",
|
"forever-agent": "~0.6.1",
|
||||||
"form-data": "~2.5.0",
|
"form-data": "~4.0.0",
|
||||||
"http-signature": "~1.4.0",
|
"http-signature": "~1.4.0",
|
||||||
"is-typedarray": "~1.0.0",
|
"is-typedarray": "~1.0.0",
|
||||||
"isstream": "~0.1.2",
|
"isstream": "~0.1.2",
|
||||||
@@ -4278,7 +4278,7 @@
|
|||||||
"performance-now": "^2.1.0",
|
"performance-now": "^2.1.0",
|
||||||
"qs": "6.13.0",
|
"qs": "6.13.0",
|
||||||
"safe-buffer": "^5.1.2",
|
"safe-buffer": "^5.1.2",
|
||||||
"tough-cookie": "^4.1.3",
|
"tough-cookie": "^5.0.0",
|
||||||
"tunnel-agent": "^0.6.0",
|
"tunnel-agent": "^0.6.0",
|
||||||
"uuid": "^8.3.2"
|
"uuid": "^8.3.2"
|
||||||
},
|
},
|
||||||
@@ -4286,20 +4286,6 @@
|
|||||||
"node": ">= 6"
|
"node": ">= 6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@cypress/request/node_modules/form-data": {
|
|
||||||
"version": "2.5.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
|
|
||||||
"integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"asynckit": "^0.4.0",
|
|
||||||
"combined-stream": "^1.0.6",
|
|
||||||
"mime-types": "^2.1.12"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@cypress/schematic": {
|
"node_modules/@cypress/schematic": {
|
||||||
"version": "1.7.0",
|
"version": "1.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/@cypress/schematic/-/schematic-1.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/@cypress/schematic/-/schematic-1.7.0.tgz",
|
||||||
@@ -9270,9 +9256,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/ci-info": {
|
"node_modules/ci-info": {
|
||||||
"version": "3.9.0",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.1.0.tgz",
|
||||||
"integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==",
|
"integrity": "sha512-HutrvTNsF48wnxkzERIXOe5/mlcfFcbfCmwcg6CJnizbSue78AbDt+1cgl26zwn61WFxhcPykPfZrbqjGmBb4A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -10285,13 +10271,13 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/cypress": {
|
"node_modules/cypress": {
|
||||||
"version": "13.15.1",
|
"version": "13.16.0",
|
||||||
"resolved": "https://registry.npmjs.org/cypress/-/cypress-13.15.1.tgz",
|
"resolved": "https://registry.npmjs.org/cypress/-/cypress-13.16.0.tgz",
|
||||||
"integrity": "sha512-DwUFiKXo4lef9kA0M4iEhixFqoqp2hw8igr0lTqafRb9qtU3X0XGxKbkSYsUFdkrAkphc7MPDxoNPhk5pj9PVg==",
|
"integrity": "sha512-g6XcwqnvzXrqiBQR/5gN+QsyRmKRhls1y5E42fyOvsmU7JuY+wM6uHJWj4ZPttjabzbnRvxcik2WemR8+xT6FA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@cypress/request": "^3.0.4",
|
"@cypress/request": "^3.0.6",
|
||||||
"@cypress/xvfb": "^1.2.4",
|
"@cypress/xvfb": "^1.2.4",
|
||||||
"@types/sinonjs__fake-timers": "8.1.1",
|
"@types/sinonjs__fake-timers": "8.1.1",
|
||||||
"@types/sizzle": "^2.3.2",
|
"@types/sizzle": "^2.3.2",
|
||||||
@@ -10302,6 +10288,7 @@
|
|||||||
"cachedir": "^2.3.0",
|
"cachedir": "^2.3.0",
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
"check-more-types": "^2.24.0",
|
"check-more-types": "^2.24.0",
|
||||||
|
"ci-info": "^4.0.0",
|
||||||
"cli-cursor": "^3.1.0",
|
"cli-cursor": "^3.1.0",
|
||||||
"cli-table3": "~0.6.1",
|
"cli-table3": "~0.6.1",
|
||||||
"commander": "^6.2.1",
|
"commander": "^6.2.1",
|
||||||
@@ -10316,7 +10303,6 @@
|
|||||||
"figures": "^3.2.0",
|
"figures": "^3.2.0",
|
||||||
"fs-extra": "^9.1.0",
|
"fs-extra": "^9.1.0",
|
||||||
"getos": "^3.2.1",
|
"getos": "^3.2.1",
|
||||||
"is-ci": "^3.0.1",
|
|
||||||
"is-installed-globally": "~0.4.0",
|
"is-installed-globally": "~0.4.0",
|
||||||
"lazy-ass": "^1.6.0",
|
"lazy-ass": "^1.6.0",
|
||||||
"listr2": "^3.8.3",
|
"listr2": "^3.8.3",
|
||||||
@@ -14122,18 +14108,6 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/is-ci": {
|
|
||||||
"version": "3.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/is-ci/-/is-ci-3.0.1.tgz",
|
|
||||||
"integrity": "sha512-ZYvCgrefwqoQ6yTyYUbQu64HsITZ3NfKX1lzaEYdkTDcfKzzCI/wthRRYKkdjHKFVgNiXKAKm65Zo1pk2as/QQ==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"ci-info": "^3.2.0"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"is-ci": "bin.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/is-core-module": {
|
"node_modules/is-core-module": {
|
||||||
"version": "2.15.1",
|
"version": "2.15.1",
|
||||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz",
|
||||||
@@ -19273,12 +19247,6 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"node_modules/psl": {
|
|
||||||
"version": "1.9.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz",
|
|
||||||
"integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/pstree.remy": {
|
"node_modules/pstree.remy": {
|
||||||
"version": "1.1.8",
|
"version": "1.1.8",
|
||||||
"resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
|
"resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
|
||||||
@@ -19324,12 +19292,6 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/querystringify": {
|
|
||||||
"version": "2.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
|
|
||||||
"integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/queue-microtask": {
|
"node_modules/queue-microtask": {
|
||||||
"version": "1.2.3",
|
"version": "1.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
|
||||||
@@ -21937,6 +21899,24 @@
|
|||||||
"resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",
|
||||||
"integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="
|
"integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="
|
||||||
},
|
},
|
||||||
|
"node_modules/tldts": {
|
||||||
|
"version": "6.1.65",
|
||||||
|
"resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.65.tgz",
|
||||||
|
"integrity": "sha512-xU9gLTfAGsADQ2PcWee6Hg8RFAv0DnjMGVJmDnUmI8a9+nYmapMQix4afwrdaCtT+AqP4MaxEzu7cCrYmBPbzQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"tldts-core": "^6.1.65"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"tldts": "bin/cli.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/tldts-core": {
|
||||||
|
"version": "6.1.65",
|
||||||
|
"resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.65.tgz",
|
||||||
|
"integrity": "sha512-Uq5t0N0Oj4nQSbU8wFN1YYENvMthvwU13MQrMJRspYCGLSAZjAfoBOJki5IQpnBM/WFskxxC/gIOTwaedmHaSg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/tmp": {
|
"node_modules/tmp": {
|
||||||
"version": "0.2.3",
|
"version": "0.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.3.tgz",
|
||||||
@@ -21988,36 +21968,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/tough-cookie": {
|
"node_modules/tough-cookie": {
|
||||||
"version": "4.1.4",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-5.0.0.tgz",
|
||||||
"integrity": "sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==",
|
"integrity": "sha512-FRKsF7cz96xIIeMZ82ehjC3xW2E+O2+v11udrDYewUbszngYhsGa8z6YUMMzO9QJZzzyd0nGGXnML/TReX6W8Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"psl": "^1.1.33",
|
"tldts": "^6.1.32"
|
||||||
"punycode": "^2.1.1",
|
|
||||||
"universalify": "^0.2.0",
|
|
||||||
"url-parse": "^1.5.3"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6"
|
"node": ">=16"
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/tough-cookie/node_modules/punycode": {
|
|
||||||
"version": "2.3.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
|
||||||
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/tough-cookie/node_modules/universalify": {
|
|
||||||
"version": "0.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz",
|
|
||||||
"integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 4.0.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/tr46": {
|
"node_modules/tr46": {
|
||||||
@@ -22512,16 +22471,6 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/url-parse": {
|
|
||||||
"version": "1.5.10",
|
|
||||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
|
|
||||||
"integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"querystringify": "^2.1.1",
|
|
||||||
"requires-port": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/use-memo-one": {
|
"node_modules/use-memo-one": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/use-memo-one/-/use-memo-one-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/use-memo-one/-/use-memo-one-1.1.3.tgz",
|
||||||
|
@@ -196,7 +196,7 @@
|
|||||||
"compression-webpack-plugin": "^9.2.0",
|
"compression-webpack-plugin": "^9.2.0",
|
||||||
"copy-webpack-plugin": "^6.4.1",
|
"copy-webpack-plugin": "^6.4.1",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"cypress": "^13.15.1",
|
"cypress": "^13.16.0",
|
||||||
"cypress-axe": "^1.5.0",
|
"cypress-axe": "^1.5.0",
|
||||||
"deep-freeze": "0.0.1",
|
"deep-freeze": "0.0.1",
|
||||||
"eslint": "^8.39.0",
|
"eslint": "^8.39.0",
|
||||||
|
@@ -19,6 +19,7 @@ import {
|
|||||||
} from '@ngx-translate/core';
|
} from '@ngx-translate/core';
|
||||||
import {
|
import {
|
||||||
BehaviorSubject,
|
BehaviorSubject,
|
||||||
|
catchError,
|
||||||
Observable,
|
Observable,
|
||||||
} from 'rxjs';
|
} from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
@@ -34,6 +35,7 @@ import { Item } from '../../../core/shared/item.model';
|
|||||||
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||||
import { AlertComponent } from '../../../shared/alert/alert.component';
|
import { AlertComponent } from '../../../shared/alert/alert.component';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { createFailedRemoteDataObjectFromError$ } from '../../../shared/remote-data.utils';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-orcid-auth',
|
selector: 'ds-orcid-auth',
|
||||||
@@ -203,13 +205,14 @@ export class OrcidAuthComponent implements OnInit, OnChanges {
|
|||||||
this.unlinkProcessing.next(true);
|
this.unlinkProcessing.next(true);
|
||||||
this.orcidAuthService.unlinkOrcidByItem(this.item).pipe(
|
this.orcidAuthService.unlinkOrcidByItem(this.item).pipe(
|
||||||
getFirstCompletedRemoteData(),
|
getFirstCompletedRemoteData(),
|
||||||
|
catchError(createFailedRemoteDataObjectFromError$<ResearcherProfile>),
|
||||||
).subscribe((remoteData: RemoteData<ResearcherProfile>) => {
|
).subscribe((remoteData: RemoteData<ResearcherProfile>) => {
|
||||||
this.unlinkProcessing.next(false);
|
this.unlinkProcessing.next(false);
|
||||||
if (remoteData.isSuccess) {
|
if (remoteData.hasFailed) {
|
||||||
|
this.notificationsService.error(this.translateService.get('person.page.orcid.unlink.error'));
|
||||||
|
} else {
|
||||||
this.notificationsService.success(this.translateService.get('person.page.orcid.unlink.success'));
|
this.notificationsService.success(this.translateService.get('person.page.orcid.unlink.success'));
|
||||||
this.unlink.emit();
|
this.unlink.emit();
|
||||||
} else {
|
|
||||||
this.notificationsService.error(this.translateService.get('person.page.orcid.unlink.error'));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -20,6 +20,7 @@ import {
|
|||||||
combineLatest,
|
combineLatest,
|
||||||
} from 'rxjs';
|
} from 'rxjs';
|
||||||
import {
|
import {
|
||||||
|
filter,
|
||||||
map,
|
map,
|
||||||
take,
|
take,
|
||||||
} from 'rxjs/operators';
|
} from 'rxjs/operators';
|
||||||
@@ -187,8 +188,20 @@ export class OrcidPageComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
private clearRouteParams(): void {
|
private clearRouteParams(): void {
|
||||||
// update route removing the code from query params
|
// update route removing the code from query params
|
||||||
const redirectUrl = this.router.url.split('?')[0];
|
this.route.queryParamMap
|
||||||
this.router.navigate([redirectUrl]);
|
.pipe(
|
||||||
|
filter((paramMap: ParamMap) => isNotEmpty(paramMap.keys)),
|
||||||
|
map(_ => Object.assign({})),
|
||||||
|
take(1),
|
||||||
|
).subscribe(queryParams =>
|
||||||
|
this.router.navigate(
|
||||||
|
[],
|
||||||
|
{
|
||||||
|
relativeTo: this.route,
|
||||||
|
queryParams,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -180,6 +180,7 @@ describe('OrcidSyncSettingsComponent test suite', () => {
|
|||||||
scheduler = getTestScheduler();
|
scheduler = getTestScheduler();
|
||||||
fixture = TestBed.createComponent(OrcidSyncSettingsComponent);
|
fixture = TestBed.createComponent(OrcidSyncSettingsComponent);
|
||||||
comp = fixture.componentInstance;
|
comp = fixture.componentInstance;
|
||||||
|
researcherProfileService.findByRelatedItem.and.returnValue(createSuccessfulRemoteDataObject$(mockResearcherProfile));
|
||||||
comp.item = mockItemLinkedToOrcid;
|
comp.item = mockItemLinkedToOrcid;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
}));
|
}));
|
||||||
@@ -216,7 +217,6 @@ describe('OrcidSyncSettingsComponent test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should call updateByOrcidOperations properly', () => {
|
it('should call updateByOrcidOperations properly', () => {
|
||||||
researcherProfileService.findByRelatedItem.and.returnValue(createSuccessfulRemoteDataObject$(mockResearcherProfile));
|
|
||||||
researcherProfileService.patch.and.returnValue(createSuccessfulRemoteDataObject$(mockResearcherProfile));
|
researcherProfileService.patch.and.returnValue(createSuccessfulRemoteDataObject$(mockResearcherProfile));
|
||||||
const expectedOps: Operation[] = [
|
const expectedOps: Operation[] = [
|
||||||
{
|
{
|
||||||
@@ -245,7 +245,6 @@ describe('OrcidSyncSettingsComponent test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should show notification on success', () => {
|
it('should show notification on success', () => {
|
||||||
researcherProfileService.findByRelatedItem.and.returnValue(createSuccessfulRemoteDataObject$(mockResearcherProfile));
|
|
||||||
researcherProfileService.patch.and.returnValue(createSuccessfulRemoteDataObject$(mockResearcherProfile));
|
researcherProfileService.patch.and.returnValue(createSuccessfulRemoteDataObject$(mockResearcherProfile));
|
||||||
|
|
||||||
scheduler.schedule(() => comp.onSubmit(formGroup));
|
scheduler.schedule(() => comp.onSubmit(formGroup));
|
||||||
@@ -257,6 +256,8 @@ describe('OrcidSyncSettingsComponent test suite', () => {
|
|||||||
|
|
||||||
it('should show notification on error', () => {
|
it('should show notification on error', () => {
|
||||||
researcherProfileService.findByRelatedItem.and.returnValue(createFailedRemoteDataObject$());
|
researcherProfileService.findByRelatedItem.and.returnValue(createFailedRemoteDataObject$());
|
||||||
|
comp.item = mockItemLinkedToOrcid;
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
scheduler.schedule(() => comp.onSubmit(formGroup));
|
scheduler.schedule(() => comp.onSubmit(formGroup));
|
||||||
scheduler.flush();
|
scheduler.flush();
|
||||||
@@ -266,7 +267,6 @@ describe('OrcidSyncSettingsComponent test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should show notification on error', () => {
|
it('should show notification on error', () => {
|
||||||
researcherProfileService.findByRelatedItem.and.returnValue(createSuccessfulRemoteDataObject$(mockResearcherProfile));
|
|
||||||
researcherProfileService.patch.and.returnValue(createFailedRemoteDataObject$());
|
researcherProfileService.patch.and.returnValue(createFailedRemoteDataObject$());
|
||||||
|
|
||||||
scheduler.schedule(() => comp.onSubmit(formGroup));
|
scheduler.schedule(() => comp.onSubmit(formGroup));
|
||||||
|
@@ -3,6 +3,7 @@ import {
|
|||||||
Component,
|
Component,
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
Input,
|
Input,
|
||||||
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
Output,
|
Output,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
@@ -15,17 +16,32 @@ import {
|
|||||||
TranslateService,
|
TranslateService,
|
||||||
} from '@ngx-translate/core';
|
} from '@ngx-translate/core';
|
||||||
import { Operation } from 'fast-json-patch';
|
import { Operation } from 'fast-json-patch';
|
||||||
import { of } from 'rxjs';
|
import {
|
||||||
import { switchMap } from 'rxjs/operators';
|
BehaviorSubject,
|
||||||
|
Observable,
|
||||||
|
} from 'rxjs';
|
||||||
|
import {
|
||||||
|
catchError,
|
||||||
|
filter,
|
||||||
|
map,
|
||||||
|
switchMap,
|
||||||
|
take,
|
||||||
|
takeUntil,
|
||||||
|
} from 'rxjs/operators';
|
||||||
|
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import { ResearcherProfile } from '../../../core/profile/model/researcher-profile.model';
|
import { ResearcherProfile } from '../../../core/profile/model/researcher-profile.model';
|
||||||
import { ResearcherProfileDataService } from '../../../core/profile/researcher-profile-data.service';
|
import { ResearcherProfileDataService } from '../../../core/profile/researcher-profile-data.service';
|
||||||
import { Item } from '../../../core/shared/item.model';
|
import { Item } from '../../../core/shared/item.model';
|
||||||
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
import {
|
||||||
|
getFirstCompletedRemoteData,
|
||||||
|
getRemoteDataPayload,
|
||||||
|
} from '../../../core/shared/operators';
|
||||||
import { AlertComponent } from '../../../shared/alert/alert.component';
|
import { AlertComponent } from '../../../shared/alert/alert.component';
|
||||||
import { AlertType } from '../../../shared/alert/alert-type';
|
import { AlertType } from '../../../shared/alert/alert-type';
|
||||||
|
import { hasValue } from '../../../shared/empty.util';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { createFailedRemoteDataObjectFromError$ } from '../../../shared/remote-data.utils';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-orcid-sync-setting',
|
selector: 'ds-orcid-sync-setting',
|
||||||
@@ -39,14 +55,9 @@ import { NotificationsService } from '../../../shared/notifications/notification
|
|||||||
],
|
],
|
||||||
standalone: true,
|
standalone: true,
|
||||||
})
|
})
|
||||||
export class OrcidSyncSettingsComponent implements OnInit {
|
export class OrcidSyncSettingsComponent implements OnInit, OnDestroy {
|
||||||
protected readonly AlertType = AlertType;
|
protected readonly AlertType = AlertType;
|
||||||
|
|
||||||
/**
|
|
||||||
* The item for which showing the orcid settings
|
|
||||||
*/
|
|
||||||
@Input() item: Item;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The prefix used for i18n keys
|
* The prefix used for i18n keys
|
||||||
*/
|
*/
|
||||||
@@ -91,12 +102,39 @@ export class OrcidSyncSettingsComponent implements OnInit {
|
|||||||
* An event emitted when settings are updated
|
* An event emitted when settings are updated
|
||||||
*/
|
*/
|
||||||
@Output() settingsUpdated: EventEmitter<void> = new EventEmitter<void>();
|
@Output() settingsUpdated: EventEmitter<void> = new EventEmitter<void>();
|
||||||
|
/**
|
||||||
|
* Emitter that triggers onDestroy lifecycle
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
readonly #destroy$ = new EventEmitter<void>();
|
||||||
|
/**
|
||||||
|
* {@link BehaviorSubject} that reflects {@link item} input changes
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
readonly #item$ = new BehaviorSubject<Item>(null);
|
||||||
|
/**
|
||||||
|
* {@link Observable} that contains {@link ResearcherProfile} linked to the {@link #item$}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
#researcherProfile$: Observable<ResearcherProfile>;
|
||||||
|
|
||||||
constructor(private researcherProfileService: ResearcherProfileDataService,
|
constructor(private researcherProfileService: ResearcherProfileDataService,
|
||||||
private notificationsService: NotificationsService,
|
private notificationsService: NotificationsService,
|
||||||
private translateService: TranslateService) {
|
private translateService: TranslateService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The item for which showing the orcid settings
|
||||||
|
*/
|
||||||
|
@Input()
|
||||||
|
set item(item: Item) {
|
||||||
|
this.#item$.next(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
this.#destroy$.next();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init orcid settings form
|
* Init orcid settings form
|
||||||
*/
|
*/
|
||||||
@@ -128,20 +166,21 @@ export class OrcidSyncSettingsComponent implements OnInit {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const syncProfilePreferences = this.item.allMetadataValues('dspace.orcid.sync-profile');
|
this.updateSyncProfileOptions(this.#item$.asObservable());
|
||||||
|
this.updateSyncPreferences(this.#item$.asObservable());
|
||||||
|
|
||||||
this.syncProfileOptions = ['BIOGRAPHICAL', 'IDENTIFIERS']
|
this.#researcherProfile$ =
|
||||||
.map((value) => {
|
this.#item$.pipe(
|
||||||
return {
|
switchMap(item =>
|
||||||
label: this.messagePrefix + '.sync-profile.' + value.toLowerCase(),
|
this.researcherProfileService.findByRelatedItem(item)
|
||||||
value: value,
|
.pipe(
|
||||||
checked: syncProfilePreferences.includes(value),
|
getFirstCompletedRemoteData(),
|
||||||
};
|
catchError(createFailedRemoteDataObjectFromError$<ResearcherProfile>),
|
||||||
});
|
getRemoteDataPayload(),
|
||||||
|
),
|
||||||
this.currentSyncMode = this.getCurrentPreference('dspace.orcid.sync-mode', ['BATCH', 'MANUAL'], 'MANUAL');
|
),
|
||||||
this.currentSyncPublications = this.getCurrentPreference('dspace.orcid.sync-publications', ['DISABLED', 'ALL'], 'DISABLED');
|
takeUntil(this.#destroy$),
|
||||||
this.currentSyncFunding = this.getCurrentPreference('dspace.orcid.sync-fundings', ['DISABLED', 'ALL'], 'DISABLED');
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -166,37 +205,84 @@ export class OrcidSyncSettingsComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.researcherProfileService.findByRelatedItem(this.item).pipe(
|
this.#researcherProfile$
|
||||||
getFirstCompletedRemoteData(),
|
.pipe(
|
||||||
switchMap((profileRD: RemoteData<ResearcherProfile>) => {
|
switchMap(researcherProfile => this.researcherProfileService.patch(researcherProfile, operations)),
|
||||||
if (profileRD.hasSucceeded) {
|
getFirstCompletedRemoteData(),
|
||||||
return this.researcherProfileService.patch(profileRD.payload, operations).pipe(
|
catchError(createFailedRemoteDataObjectFromError$<ResearcherProfile>),
|
||||||
getFirstCompletedRemoteData(),
|
take(1),
|
||||||
);
|
)
|
||||||
|
.subscribe((remoteData: RemoteData<ResearcherProfile>) => {
|
||||||
|
if (remoteData.hasFailed) {
|
||||||
|
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.synchronization-settings-update.error'));
|
||||||
} else {
|
} else {
|
||||||
return of(profileRD);
|
this.notificationsService.success(this.translateService.get(this.messagePrefix + '.synchronization-settings-update.success'));
|
||||||
|
this.settingsUpdated.emit();
|
||||||
}
|
}
|
||||||
}),
|
});
|
||||||
).subscribe((remoteData: RemoteData<ResearcherProfile>) => {
|
}
|
||||||
if (remoteData.isSuccess) {
|
|
||||||
this.notificationsService.success(this.translateService.get(this.messagePrefix + '.synchronization-settings-update.success'));
|
/**
|
||||||
this.settingsUpdated.emit();
|
*
|
||||||
} else {
|
* Handles subscriptions to populate sync preferences
|
||||||
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.synchronization-settings-update.error'));
|
*
|
||||||
}
|
* @param item observable that emits update on item changes
|
||||||
});
|
* @private
|
||||||
|
*/
|
||||||
|
private updateSyncPreferences(item: Observable<Item>) {
|
||||||
|
item.pipe(
|
||||||
|
filter(hasValue),
|
||||||
|
map(i => this.getCurrentPreference(i, 'dspace.orcid.sync-mode', ['BATCH', 'MANUAL'], 'MANUAL')),
|
||||||
|
takeUntil(this.#destroy$),
|
||||||
|
).subscribe(val => this.currentSyncMode = val);
|
||||||
|
item.pipe(
|
||||||
|
filter(hasValue),
|
||||||
|
map(i => this.getCurrentPreference(i, 'dspace.orcid.sync-publications', ['DISABLED', 'ALL'], 'DISABLED')),
|
||||||
|
takeUntil(this.#destroy$),
|
||||||
|
).subscribe(val => this.currentSyncPublications = val);
|
||||||
|
item.pipe(
|
||||||
|
filter(hasValue),
|
||||||
|
map(i => this.getCurrentPreference(i, 'dspace.orcid.sync-fundings', ['DISABLED', 'ALL'], 'DISABLED')),
|
||||||
|
takeUntil(this.#destroy$),
|
||||||
|
).subscribe(val => this.currentSyncFunding = val);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles subscription to populate the {@link syncProfileOptions} field
|
||||||
|
*
|
||||||
|
* @param item observable that emits update on item changes
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private updateSyncProfileOptions(item: Observable<Item>) {
|
||||||
|
item.pipe(
|
||||||
|
filter(hasValue),
|
||||||
|
map(i => i.allMetadataValues('dspace.orcid.sync-profile')),
|
||||||
|
map(metadata =>
|
||||||
|
['BIOGRAPHICAL', 'IDENTIFIERS']
|
||||||
|
.map((value) => {
|
||||||
|
return {
|
||||||
|
label: this.messagePrefix + '.sync-profile.' + value.toLowerCase(),
|
||||||
|
value: value,
|
||||||
|
checked: metadata.includes(value),
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
takeUntil(this.#destroy$),
|
||||||
|
)
|
||||||
|
.subscribe(value => this.syncProfileOptions = value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve setting saved in the item's metadata
|
* Retrieve setting saved in the item's metadata
|
||||||
*
|
*
|
||||||
|
* @param item The item from which retrieve settings
|
||||||
* @param metadataField The metadata name that contains setting
|
* @param metadataField The metadata name that contains setting
|
||||||
* @param allowedValues The allowed values
|
* @param allowedValues The allowed values
|
||||||
* @param defaultValue The default value
|
* @param defaultValue The default value
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
private getCurrentPreference(metadataField: string, allowedValues: string[], defaultValue: string): string {
|
private getCurrentPreference(item: Item, metadataField: string, allowedValues: string[], defaultValue: string): string {
|
||||||
const currentPreference = this.item.firstMetadataValue(metadataField);
|
const currentPreference = item.firstMetadataValue(metadataField);
|
||||||
return (currentPreference && allowedValues.includes(currentPreference)) ? currentPreference : defaultValue;
|
return (currentPreference && allowedValues.includes(currentPreference)) ? currentPreference : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,3 +302,4 @@ export class OrcidSyncSettingsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,6 +5,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
<div data-test="admin-div" *ngIf="(isAdmin$ | async)">
|
||||||
<button class="btn btn-outline-primary btn-lg btn-block" (click)="selectObject(undefined)">{{'dso-selector.create.community.top-level' | translate}}</button>
|
<button class="btn btn-outline-primary btn-lg btn-block" (click)="selectObject(undefined)">{{'dso-selector.create.community.top-level' | translate}}</button>
|
||||||
<div class="h3 position-relative py-1 my-3 font-weight-normal">
|
<div class="h3 position-relative py-1 my-3 font-weight-normal">
|
||||||
<hr>
|
<hr>
|
||||||
@@ -12,7 +13,7 @@
|
|||||||
<span class="px-4 bg-white">{{'dso-selector.create.community.or-divider' | translate}}</span>
|
<span class="px-4 bg-white">{{'dso-selector.create.community.or-divider' | translate}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<span class="h5 px-2">{{'dso-selector.create.community.sub-level' | translate}}</span>
|
<span class="h5 px-2">{{'dso-selector.create.community.sub-level' | translate}}</span>
|
||||||
<ds-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" [sort]="defaultSort" (onSelect)="selectObject($event)"></ds-dso-selector>
|
<ds-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" [sort]="defaultSort" (onSelect)="selectObject($event)"></ds-dso-selector>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -7,13 +7,16 @@ import {
|
|||||||
TestBed,
|
TestBed,
|
||||||
waitForAsync,
|
waitForAsync,
|
||||||
} from '@angular/core/testing';
|
} from '@angular/core/testing';
|
||||||
|
import { By } from '@angular/platform-browser';
|
||||||
import {
|
import {
|
||||||
ActivatedRoute,
|
ActivatedRoute,
|
||||||
Router,
|
Router,
|
||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { of as observableOf } from 'rxjs';
|
||||||
|
|
||||||
|
import { AuthorizationDataService } from '../../../../core/data/feature-authorization/authorization-data.service';
|
||||||
import { Community } from '../../../../core/shared/community.model';
|
import { Community } from '../../../../core/shared/community.model';
|
||||||
import { MetadataValue } from '../../../../core/shared/metadata.models';
|
import { MetadataValue } from '../../../../core/shared/metadata.models';
|
||||||
import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
|
import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
|
||||||
@@ -38,7 +41,9 @@ describe('CreateCommunityParentSelectorComponent', () => {
|
|||||||
const communityRD = createSuccessfulRemoteDataObject(community);
|
const communityRD = createSuccessfulRemoteDataObject(community);
|
||||||
const modalStub = jasmine.createSpyObj('modalStub', ['close']);
|
const modalStub = jasmine.createSpyObj('modalStub', ['close']);
|
||||||
const createPath = '/communities/create';
|
const createPath = '/communities/create';
|
||||||
|
const mockAuthorizationDataService = jasmine.createSpyObj('authorizationService', {
|
||||||
|
isAuthorized: observableOf(true),
|
||||||
|
});
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [TranslateModule.forRoot(), CreateCommunityParentSelectorComponent],
|
imports: [TranslateModule.forRoot(), CreateCommunityParentSelectorComponent],
|
||||||
@@ -59,6 +64,7 @@ describe('CreateCommunityParentSelectorComponent', () => {
|
|||||||
{
|
{
|
||||||
provide: Router, useValue: router,
|
provide: Router, useValue: router,
|
||||||
},
|
},
|
||||||
|
{ provide: AuthorizationDataService, useValue: mockAuthorizationDataService },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
})
|
})
|
||||||
@@ -85,4 +91,20 @@ describe('CreateCommunityParentSelectorComponent', () => {
|
|||||||
expect(router.navigate).toHaveBeenCalledWith([createPath], { queryParams: { parent: community.uuid } });
|
expect(router.navigate).toHaveBeenCalledWith([createPath], { queryParams: { parent: community.uuid } });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should show the div when user is an admin', (waitForAsync(() => {
|
||||||
|
component.isAdmin$ = observableOf(true);
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
const divElement = fixture.debugElement.query(By.css('div[data-test="admin-div"]'));
|
||||||
|
expect(divElement).toBeTruthy();
|
||||||
|
})));
|
||||||
|
|
||||||
|
it('should hide the div when user is not an admin', (waitForAsync(() => {
|
||||||
|
component.isAdmin$ = observableOf(false);
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
const divElement = fixture.debugElement.query(By.css('div[data-test="admin-div"]'));
|
||||||
|
expect(divElement).toBeFalsy();
|
||||||
|
})));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@@ -1,3 +1,7 @@
|
|||||||
|
import {
|
||||||
|
AsyncPipe,
|
||||||
|
NgIf,
|
||||||
|
} from '@angular/common';
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
OnInit,
|
OnInit,
|
||||||
@@ -9,6 +13,7 @@ import {
|
|||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
import { environment } from '../../../../../environments/environment';
|
import { environment } from '../../../../../environments/environment';
|
||||||
import {
|
import {
|
||||||
@@ -19,6 +24,8 @@ import {
|
|||||||
SortDirection,
|
SortDirection,
|
||||||
SortOptions,
|
SortOptions,
|
||||||
} from '../../../../core/cache/models/sort-options.model';
|
} from '../../../../core/cache/models/sort-options.model';
|
||||||
|
import { AuthorizationDataService } from '../../../../core/data/feature-authorization/authorization-data.service';
|
||||||
|
import { FeatureID } from '../../../../core/data/feature-authorization/feature-id';
|
||||||
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
||||||
import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model';
|
import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model';
|
||||||
import { hasValue } from '../../../empty.util';
|
import { hasValue } from '../../../empty.util';
|
||||||
@@ -40,18 +47,23 @@ import {
|
|||||||
styleUrls: ['./create-community-parent-selector.component.scss'],
|
styleUrls: ['./create-community-parent-selector.component.scss'],
|
||||||
templateUrl: './create-community-parent-selector.component.html',
|
templateUrl: './create-community-parent-selector.component.html',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [DSOSelectorComponent, TranslateModule],
|
imports: [DSOSelectorComponent, TranslateModule, NgIf, AsyncPipe],
|
||||||
})
|
})
|
||||||
export class CreateCommunityParentSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit {
|
export class CreateCommunityParentSelectorComponent extends DSOSelectorModalWrapperComponent implements OnInit {
|
||||||
objectType = DSpaceObjectType.COMMUNITY;
|
objectType = DSpaceObjectType.COMMUNITY;
|
||||||
selectorTypes = [DSpaceObjectType.COMMUNITY];
|
selectorTypes = [DSpaceObjectType.COMMUNITY];
|
||||||
action = SelectorActionType.CREATE;
|
action = SelectorActionType.CREATE;
|
||||||
defaultSort = new SortOptions(environment.comcolSelectionSort.sortField, environment.comcolSelectionSort.sortDirection as SortDirection);
|
defaultSort = new SortOptions(environment.comcolSelectionSort.sortField, environment.comcolSelectionSort.sortDirection as SortDirection);
|
||||||
|
isAdmin$: Observable<boolean>;
|
||||||
|
|
||||||
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router) {
|
constructor(protected activeModal: NgbActiveModal, protected route: ActivatedRoute, private router: Router, protected authorizationService: AuthorizationDataService) {
|
||||||
super(activeModal, route);
|
super(activeModal, route);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.isAdmin$ = this.authorizationService.isAuthorized(FeatureID.AdministratorOf);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Navigate to the community create page
|
* Navigate to the community create page
|
||||||
*/
|
*/
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import { HttpErrorResponse } from '@angular/common/http';
|
||||||
import {
|
import {
|
||||||
Observable,
|
Observable,
|
||||||
of as observableOf,
|
of as observableOf,
|
||||||
@@ -107,3 +108,27 @@ export function createNoContentRemoteDataObject<T>(timeCompleted?: number): Remo
|
|||||||
export function createNoContentRemoteDataObject$<T>(timeCompleted?: number): Observable<RemoteData<T>> {
|
export function createNoContentRemoteDataObject$<T>(timeCompleted?: number): Observable<RemoteData<T>> {
|
||||||
return createSuccessfulRemoteDataObject$(undefined, timeCompleted);
|
return createSuccessfulRemoteDataObject$(undefined, timeCompleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to create a remote data object that has failed starting from a given error
|
||||||
|
*
|
||||||
|
* @param error
|
||||||
|
*/
|
||||||
|
export function createFailedRemoteDataObjectFromError<T>(error: unknown): RemoteData<T> {
|
||||||
|
const remoteData = createFailedRemoteDataObject<T>();
|
||||||
|
if (error instanceof Error) {
|
||||||
|
remoteData.errorMessage = error.message;
|
||||||
|
}
|
||||||
|
if (error instanceof HttpErrorResponse) {
|
||||||
|
remoteData.statusCode = error.status;
|
||||||
|
}
|
||||||
|
return remoteData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to create a remote data object that has failed starting from a given error
|
||||||
|
* @param error
|
||||||
|
*/
|
||||||
|
export function createFailedRemoteDataObjectFromError$<T>(error: unknown): Observable<RemoteData<T>> {
|
||||||
|
return observableOf(createFailedRemoteDataObjectFromError<T>(error));
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user