mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Merge branch 'main' into DURACOM-191-20231219-ALIGNMENT
# Conflicts: # src/app/access-control/epeople-registry/epeople-registry.component.html # src/app/access-control/epeople-registry/epeople-registry.component.ts # src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html # src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts # src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts # src/app/access-control/group-registry/group-form/group-form.component.html # src/app/access-control/group-registry/group-form/group-form.component.ts # src/app/access-control/group-registry/group-form/members-list/members-list.component.html # src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.spec.ts # src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.ts # src/app/admin/admin-registries/metadata-schema/metadata-schema.component.ts # src/app/browse-by/browse-by.module.ts # src/app/community-list-page/community-list/community-list.component.spec.ts # src/app/core/core.module.ts # src/app/core/data/root-data.service.ts # src/app/core/eperson/eperson-data.service.ts # src/app/core/eperson/group-data.service.ts # src/app/curation-form/curation-form.component.ts # src/app/header/header.component.spec.ts # src/app/header/header.component.ts # src/app/health-page/health-page.component.ts # src/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.html # src/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.spec.ts # src/app/item-page/edit-item-page/item-status/item-status.component.ts # src/app/process-page/form/process-parameters/parameter-select/parameter-select.component.spec.ts # src/app/process-page/form/process-parameters/parameter-value-input/boolean-value-input/boolean-value-input.component.spec.ts # src/app/register-email-form/register-email-form.module.ts # src/app/register-email-form/themed-registry-email-form.component.ts # src/app/shared/auth-nav-menu/auth-nav-menu.component.html # src/app/shared/auth-nav-menu/user-menu/themed-user-menu.component.ts # src/app/shared/browse-by/shared-browse-by.module.ts # src/app/shared/browse-by/themed-browse-by.component.ts # src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.ts # src/app/shared/dso-page/dso-edit-menu/dso-edit-menu-section/dso-edit-menu-section.component.ts # src/app/shared/file-download-link/file-download-link.component.spec.ts # src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.component.ts # src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.html # src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.ts # src/app/shared/lang-switch/lang-switch.component.ts # src/app/shared/lang-switch/themed-lang-switch.component.ts # src/app/shared/log-in/log-in.component.ts # src/app/shared/log-in/themed-log-in.component.ts # src/app/shared/menu/menu.component.spec.ts # src/app/shared/object-collection/shared/badges/access-status-badge/access-status-badge.component.ts # src/app/shared/object-collection/shared/selectable-list-item-control/selectable-list-item-control.component.spec.ts # src/app/shared/search/search-filters/search-filter/search-filter.component.html # src/app/shared/search/search-labels/search-label/search-label.component.html # src/app/submission/import-external/submission-import-external.component.ts # src/app/subscriptions-page/subscriptions-page.component.ts # src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/reviewers-list/reviewers-list.component.spec.ts # src/themes/custom/app/entity-groups/research-entities/item-pages/person/person.component.ts # src/themes/custom/app/register-email-form/register-email-form.component.ts # src/themes/custom/app/shared/auth-nav-menu/user-menu/user-menu.component.ts # src/themes/custom/app/shared/browse-by/browse-by.component.ts # src/themes/custom/app/shared/lang-switch/lang-switch.component.ts # src/themes/custom/app/shared/log-in/log-in.component.ts # src/themes/custom/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.ts
This commit is contained in:
16
.github/workflows/build.yml
vendored
16
.github/workflows/build.yml
vendored
@@ -43,11 +43,11 @@ jobs:
|
||||
steps:
|
||||
# https://github.com/actions/checkout
|
||||
- name: Checkout codebase
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# https://github.com/actions/setup-node
|
||||
- name: Install Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
@@ -118,7 +118,7 @@ jobs:
|
||||
# https://github.com/cypress-io/github-action
|
||||
# (NOTE: to run these e2e tests locally, just use 'ng e2e')
|
||||
- name: Run e2e tests (integration tests)
|
||||
uses: cypress-io/github-action@v5
|
||||
uses: cypress-io/github-action@v6
|
||||
with:
|
||||
# Run tests in Chrome, headless mode (default)
|
||||
browser: chrome
|
||||
@@ -191,7 +191,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Download artifacts from previous 'tests' job
|
||||
- name: Download coverage artifacts
|
||||
@@ -203,10 +203,14 @@ jobs:
|
||||
# Retry action: https://github.com/marketplace/actions/retry-action
|
||||
# Codecov action: https://github.com/codecov/codecov-action
|
||||
- name: Upload coverage to Codecov.io
|
||||
uses: Wandalen/wretry.action@v1.0.36
|
||||
uses: Wandalen/wretry.action@v1.3.0
|
||||
with:
|
||||
action: codecov/codecov-action@v3
|
||||
# Try upload 5 times max
|
||||
# Ensure codecov-action throws an error when it fails to upload
|
||||
# This allows us to auto-restart the action if an error is thrown
|
||||
with: |
|
||||
fail_ci_if_error: true
|
||||
# Try re-running action 5 times max
|
||||
attempt_limit: 5
|
||||
# Run again in 30 seconds
|
||||
attempt_delay: 30000
|
||||
|
2
.github/workflows/codescan.yml
vendored
2
.github/workflows/codescan.yml
vendored
@@ -35,7 +35,7 @@ jobs:
|
||||
steps:
|
||||
# https://github.com/actions/checkout
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
# https://github.com/github/codeql-action
|
||||
|
151
.github/workflows/docker.yml
vendored
151
.github/workflows/docker.yml
vendored
@@ -3,6 +3,9 @@ name: Docker images
|
||||
|
||||
# Run this Build for all pushes to 'main' or maintenance branches, or tagged releases.
|
||||
# Also run for PRs to ensure PR doesn't break Docker build process
|
||||
# NOTE: uses "reusable-docker-build.yml" in DSpace/DSpace to actually build each of the Docker images
|
||||
# https://github.com/DSpace/DSpace/blob/main/.github/workflows/reusable-docker-build.yml
|
||||
#
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
@@ -15,82 +18,22 @@ on:
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
|
||||
|
||||
env:
|
||||
# Define tags to use for Docker images based on Git tags/branches (for docker/metadata-action)
|
||||
# For a new commit on default branch (main), use the literal tag 'latest' on Docker image.
|
||||
# For a new commit on other branches, use the branch name as the tag for Docker image.
|
||||
# For a new tag, copy that tag name as the tag for Docker image.
|
||||
IMAGE_TAGS: |
|
||||
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
|
||||
type=ref,event=branch,enable=${{ !endsWith(github.ref, github.event.repository.default_branch) }}
|
||||
type=ref,event=tag
|
||||
# Define default tag "flavor" for docker/metadata-action per
|
||||
# https://github.com/docker/metadata-action#flavor-input
|
||||
# We manage the 'latest' tag ourselves to the 'main' branch (see settings above)
|
||||
TAGS_FLAVOR: |
|
||||
latest=false
|
||||
# Architectures / Platforms for which we will build Docker images
|
||||
# If this is a PR, we ONLY build for AMD64. For PRs we only do a sanity check test to ensure Docker builds work.
|
||||
# If this is NOT a PR (e.g. a tag or merge commit), also build for ARM64.
|
||||
PLATFORMS: linux/amd64${{ github.event_name != 'pull_request' && ', linux/arm64' || '' }}
|
||||
|
||||
|
||||
jobs:
|
||||
###############################################
|
||||
#############################################################
|
||||
# Build/Push the 'dspace/dspace-angular' image
|
||||
###############################################
|
||||
#############################################################
|
||||
dspace-angular:
|
||||
# Ensure this job never runs on forked repos. It's only executed for 'dspace/dspace-angular'
|
||||
if: github.repository == 'dspace/dspace-angular'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# https://github.com/actions/checkout
|
||||
- name: Checkout codebase
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# https://github.com/docker/setup-buildx-action
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
# https://github.com/docker/setup-qemu-action
|
||||
- name: Set up QEMU emulation to build for multiple architectures
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
# https://github.com/docker/login-action
|
||||
- name: Login to DockerHub
|
||||
# Only login if not a PR, as PRs only trigger a Docker build and not a push
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
|
||||
|
||||
# https://github.com/docker/metadata-action
|
||||
# Get Metadata for docker_build step below
|
||||
- name: Sync metadata (tags, labels) from GitHub to Docker for 'dspace-angular' image
|
||||
id: meta_build
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: dspace/dspace-angular
|
||||
tags: ${{ env.IMAGE_TAGS }}
|
||||
flavor: ${{ env.TAGS_FLAVOR }}
|
||||
|
||||
# https://github.com/docker/build-push-action
|
||||
- name: Build and push 'dspace-angular' image
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: ${{ env.PLATFORMS }}
|
||||
# For pull requests, we run the Docker build (to ensure no PR changes break the build),
|
||||
# but we ONLY do an image push to DockerHub if it's NOT a PR
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
# Use tags / labels provided by 'docker/metadata-action' above
|
||||
tags: ${{ steps.meta_build.outputs.tags }}
|
||||
labels: ${{ steps.meta_build.outputs.labels }}
|
||||
# Use the reusable-docker-build.yml script from DSpace/DSpace repo to build our Docker image
|
||||
uses: DSpace/DSpace/.github/workflows/reusable-docker-build.yml@main
|
||||
with:
|
||||
build_id: dspace-angular
|
||||
image_name: dspace/dspace-angular
|
||||
dockerfile_path: ./Dockerfile
|
||||
secrets:
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_ACCESS_TOKEN: ${{ secrets.DOCKER_ACCESS_TOKEN }}
|
||||
|
||||
#############################################################
|
||||
# Build/Push the 'dspace/dspace-angular' image ('-dist' tag)
|
||||
@@ -98,53 +41,19 @@ jobs:
|
||||
dspace-angular-dist:
|
||||
# Ensure this job never runs on forked repos. It's only executed for 'dspace/dspace-angular'
|
||||
if: github.repository == 'dspace/dspace-angular'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# https://github.com/actions/checkout
|
||||
- name: Checkout codebase
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# https://github.com/docker/setup-buildx-action
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
# https://github.com/docker/setup-qemu-action
|
||||
- name: Set up QEMU emulation to build for multiple architectures
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
# https://github.com/docker/login-action
|
||||
- name: Login to DockerHub
|
||||
# Only login if not a PR, as PRs only trigger a Docker build and not a push
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
|
||||
|
||||
# https://github.com/docker/metadata-action
|
||||
# Get Metadata for docker_build_dist step below
|
||||
- name: Sync metadata (tags, labels) from GitHub to Docker for 'dspace-angular-dist' image
|
||||
id: meta_build_dist
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: dspace/dspace-angular
|
||||
tags: ${{ env.IMAGE_TAGS }}
|
||||
# As this is a "dist" image, its tags are all suffixed with "-dist". Otherwise, it uses the same
|
||||
# tagging logic as the primary 'dspace/dspace-angular' image above.
|
||||
flavor: ${{ env.TAGS_FLAVOR }}
|
||||
suffix=-dist
|
||||
|
||||
- name: Build and push 'dspace-angular-dist' image
|
||||
id: docker_build_dist
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile.dist
|
||||
platforms: ${{ env.PLATFORMS }}
|
||||
# For pull requests, we run the Docker build (to ensure no PR changes break the build),
|
||||
# but we ONLY do an image push to DockerHub if it's NOT a PR
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
# Use tags / labels provided by 'docker/metadata-action' above
|
||||
tags: ${{ steps.meta_build_dist.outputs.tags }}
|
||||
labels: ${{ steps.meta_build_dist.outputs.labels }}
|
||||
# Use the reusable-docker-build.yml script from DSpace/DSpace repo to build our Docker image
|
||||
uses: DSpace/DSpace/.github/workflows/reusable-docker-build.yml@main
|
||||
with:
|
||||
build_id: dspace-angular-dist
|
||||
image_name: dspace/dspace-angular
|
||||
dockerfile_path: ./Dockerfile.dist
|
||||
# As this is a "dist" image, its tags are all suffixed with "-dist". Otherwise, it uses the same
|
||||
# tagging logic as the primary 'dspace/dspace-angular' image above.
|
||||
tags_flavor: suffix=-dist
|
||||
secrets:
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_ACCESS_TOKEN: ${{ secrets.DOCKER_ACCESS_TOKEN }}
|
||||
# Enable redeploy of sandbox & demo if the branch for this image matches the deployment branch of
|
||||
# these sites as specified in reusable-docker-build.xml
|
||||
REDEPLOY_SANDBOX_URL: ${{ secrets.REDEPLOY_SANDBOX_URL }}
|
||||
REDEPLOY_DEMO_URL: ${{ secrets.REDEPLOY_DEMO_URL }}
|
@@ -23,11 +23,11 @@ jobs:
|
||||
if: github.event.pull_request.merged
|
||||
steps:
|
||||
# Checkout code
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
# Port PR to other branch (ONLY if labeled with "port to")
|
||||
# See https://github.com/korthout/backport-action
|
||||
- name: Create backport pull requests
|
||||
uses: korthout/backport-action@v1
|
||||
uses: korthout/backport-action@v2
|
||||
with:
|
||||
# Trigger based on a "port to [branch]" label on PR
|
||||
# (This label must specify the branch name to port to)
|
||||
|
2
.github/workflows/pull_request_opened.yml
vendored
2
.github/workflows/pull_request_opened.yml
vendored
@@ -21,4 +21,4 @@ jobs:
|
||||
# Assign the PR to whomever created it. This is useful for visualizing assignments on project boards
|
||||
# See https://github.com/toshimaru/auto-author-assign
|
||||
- name: Assign PR to creator
|
||||
uses: toshimaru/auto-author-assign@v1.6.2
|
||||
uses: toshimaru/auto-author-assign@v2.0.1
|
||||
|
@@ -8,11 +8,6 @@ describe('Header', () => {
|
||||
cy.get('ds-header').should('be.visible');
|
||||
|
||||
// Analyze <ds-header> for accessibility
|
||||
testA11y({
|
||||
include: ['ds-header'],
|
||||
exclude: [
|
||||
['#search-navbar-container'] // search in navbar has duplicative ID. Will be fixed in #1174
|
||||
],
|
||||
});
|
||||
testA11y('ds-header');
|
||||
});
|
||||
});
|
||||
|
@@ -121,7 +121,7 @@
|
||||
"ngx-infinite-scroll": "^15.0.0",
|
||||
"ngx-pagination": "6.0.3",
|
||||
"ngx-sortablejs": "^11.1.0",
|
||||
"ngx-ui-switch": "^14.0.3",
|
||||
"ngx-ui-switch": "^14.1.0",
|
||||
"nouislider": "^15.7.1",
|
||||
"pem": "1.14.7",
|
||||
"prop-types": "^15.8.1",
|
||||
|
@@ -1,15 +1,15 @@
|
||||
<ngb-accordion #acc="ngbAccordion" [activeIds]="'browse'">
|
||||
<ngb-panel [id]="'browse'">
|
||||
<ng-template ngbPanelHeader>
|
||||
<div class="w-100 d-flex justify-content-between collapse-toggle" ngbPanelToggle (click)="acc.toggle('browse')"
|
||||
<div class="w-100 d-flex gap-3 justify-content-between collapse-toggle" ngbPanelToggle (click)="acc.toggle('browse')"
|
||||
data-test="browse">
|
||||
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()"
|
||||
[attr.aria-expanded]="!acc.isExpanded('browse')"
|
||||
aria-controls="collapsePanels">
|
||||
[attr.aria-expanded]="acc.isExpanded('browse')"
|
||||
aria-controls="bulk-access-browse-panel-content">
|
||||
{{ 'admin.access-control.bulk-access-browse.header' | translate }}
|
||||
</button>
|
||||
<div class="text-right d-flex">
|
||||
<div class="ml-3 d-inline-block">
|
||||
<div class="text-right d-flex gap-2">
|
||||
<div class="d-flex my-auto">
|
||||
<span *ngIf="acc.isExpanded('browse')" class="fas fa-chevron-up fa-fw"></span>
|
||||
<span *ngIf="!acc.isExpanded('browse')" class="fas fa-chevron-down fa-fw"></span>
|
||||
</div>
|
||||
@@ -17,51 +17,53 @@
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template ngbPanelContent>
|
||||
<ul ngbNav #nav="ngbNav" [(activeId)]="activateId" class="nav-pills">
|
||||
<li [ngbNavItem]="'search'">
|
||||
<a ngbNavLink>{{'admin.access-control.bulk-access-browse.search.header' | translate}}</a>
|
||||
<ng-template ngbNavContent>
|
||||
<div class="mx-n3">
|
||||
<ds-themed-search [configuration]="'administrativeBulkAccess'"
|
||||
[selectable]="true"
|
||||
[selectionConfig]="{ repeatable: true, listId: listId }"
|
||||
[showThumbnails]="false"></ds-themed-search>
|
||||
</div>
|
||||
</ng-template>
|
||||
</li>
|
||||
<li [ngbNavItem]="'selected'">
|
||||
<a ngbNavLink>
|
||||
{{'admin.access-control.bulk-access-browse.selected.header' | translate: {number: ((objectsSelected$ | async)?.payload?.totalElements) ? (objectsSelected$ | async)?.payload?.totalElements : '0'} }}
|
||||
</a>
|
||||
<ng-template ngbNavContent>
|
||||
<ds-pagination
|
||||
[paginationOptions]="(paginationOptions$ | async)"
|
||||
[pageInfoState]="(objectsSelected$|async)?.payload.pageInfo"
|
||||
[collectionSize]="(objectsSelected$|async)?.payload?.totalElements"
|
||||
[objects]="(objectsSelected$|async)"
|
||||
[showPaginator]="false"
|
||||
(prev)="pagePrev()"
|
||||
(next)="pageNext()">
|
||||
<ul *ngIf="(objectsSelected$|async)?.hasSucceeded" class="list-unstyled ml-4">
|
||||
<li *ngFor='let object of (objectsSelected$|async)?.payload?.page | paginate: { itemsPerPage: (paginationOptions$ | async).pageSize,
|
||||
currentPage: (paginationOptions$ | async).currentPage, totalItems: (objectsSelected$|async)?.payload?.page.length }; let i = index; let last = last '
|
||||
class="mt-4 mb-4 d-flex"
|
||||
[attr.data-test]="'list-object' | dsBrowserOnly">
|
||||
<ds-selectable-list-item-control [index]="i"
|
||||
[object]="object"
|
||||
[selectionConfig]="{ repeatable: true, listId: listId }"></ds-selectable-list-item-control>
|
||||
<ds-listable-object-component-loader [listID]="listId"
|
||||
[index]="i"
|
||||
[object]="object"
|
||||
[showThumbnails]="false"
|
||||
[viewMode]="'list'"></ds-listable-object-component-loader>
|
||||
</li>
|
||||
</ul>
|
||||
</ds-pagination>
|
||||
</ng-template>
|
||||
</li>
|
||||
</ul>
|
||||
<div [ngbNavOutlet]="nav" class="mt-5"></div>
|
||||
<div id="bulk-access-browse-panel-content">
|
||||
<ul ngbNav #nav="ngbNav" [(activeId)]="activateId" class="nav-pills">
|
||||
<li [ngbNavItem]="'search'" role="presentation">
|
||||
<a ngbNavLink>{{'admin.access-control.bulk-access-browse.search.header' | translate}}</a>
|
||||
<ng-template ngbNavContent>
|
||||
<div class="mx-n3">
|
||||
<ds-themed-search [configuration]="'administrativeBulkAccess'"
|
||||
[selectable]="true"
|
||||
[selectionConfig]="{ repeatable: true, listId: listId }"
|
||||
[showThumbnails]="false"></ds-themed-search>
|
||||
</div>
|
||||
</ng-template>
|
||||
</li>
|
||||
<li [ngbNavItem]="'selected'" role="presentation">
|
||||
<a ngbNavLink>
|
||||
{{'admin.access-control.bulk-access-browse.selected.header' | translate: {number: ((objectsSelected$ | async)?.payload?.totalElements) ? (objectsSelected$ | async)?.payload?.totalElements : '0'} }}
|
||||
</a>
|
||||
<ng-template ngbNavContent>
|
||||
<ds-pagination
|
||||
[paginationOptions]="(paginationOptions$ | async)"
|
||||
[pageInfoState]="(objectsSelected$|async)?.payload.pageInfo"
|
||||
[collectionSize]="(objectsSelected$|async)?.payload?.totalElements"
|
||||
[objects]="(objectsSelected$|async)"
|
||||
[showPaginator]="false"
|
||||
(prev)="pagePrev()"
|
||||
(next)="pageNext()">
|
||||
<ul *ngIf="(objectsSelected$|async)?.hasSucceeded" class="list-unstyled ml-4">
|
||||
<li *ngFor='let object of (objectsSelected$|async)?.payload?.page | paginate: { itemsPerPage: (paginationOptions$ | async).pageSize,
|
||||
currentPage: (paginationOptions$ | async).currentPage, totalItems: (objectsSelected$|async)?.payload?.page.length }; let i = index; let last = last '
|
||||
class="mt-4 mb-4 d-flex"
|
||||
[attr.data-test]="'list-object' | dsBrowserOnly">
|
||||
<ds-selectable-list-item-control [index]="i"
|
||||
[object]="object"
|
||||
[selectionConfig]="{ repeatable: true, listId: listId }"></ds-selectable-list-item-control>
|
||||
<ds-listable-object-component-loader [listID]="listId"
|
||||
[index]="i"
|
||||
[object]="object"
|
||||
[showThumbnails]="false"
|
||||
[viewMode]="'list'"></ds-listable-object-component-loader>
|
||||
</li>
|
||||
</ul>
|
||||
</ds-pagination>
|
||||
</ng-template>
|
||||
</li>
|
||||
</ul>
|
||||
<div [ngbNavOutlet]="nav" class="mt-5"></div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</ngb-panel>
|
||||
</ngb-accordion>
|
||||
|
@@ -1,13 +1,13 @@
|
||||
<ngb-accordion #acc="ngbAccordion" [activeIds]="'settings'">
|
||||
<ngb-panel [id]="'settings'">
|
||||
<ng-template ngbPanelHeader>
|
||||
<div class="w-100 d-flex justify-content-between collapse-toggle" ngbPanelToggle (click)="acc.toggle('settings')" data-test="settings">
|
||||
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="!acc.isExpanded('browse')"
|
||||
aria-controls="collapsePanels">
|
||||
<div class="w-100 d-flex gap-3 justify-content-between collapse-toggle" ngbPanelToggle (click)="acc.toggle('settings')" data-test="settings">
|
||||
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="acc.isExpanded('settings')"
|
||||
aria-controls="bulk-access-settings-panel-content">
|
||||
{{ 'admin.access-control.bulk-access-settings.header' | translate }}
|
||||
</button>
|
||||
<div class="text-right d-flex">
|
||||
<div class="ml-3 d-inline-block">
|
||||
<div class="text-right d-flex gap-2">
|
||||
<div class="d-flex my-auto">
|
||||
<span *ngIf="acc.isExpanded('settings')" class="fas fa-chevron-up fa-fw"></span>
|
||||
<span *ngIf="!acc.isExpanded('settings')" class="fas fa-chevron-down fa-fw"></span>
|
||||
</div>
|
||||
@@ -15,7 +15,7 @@
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template ngbPanelContent>
|
||||
<ds-access-control-form-container #dsAccessControlForm [showSubmit]="false"></ds-access-control-form-container>
|
||||
<ds-access-control-form-container id="bulk-access-settings-panel-content" #dsAccessControlForm [showSubmit]="false"></ds-access-control-form-container>
|
||||
</ng-template>
|
||||
</ngb-panel>
|
||||
</ngb-accordion>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<div class="epeople-registry row">
|
||||
<div class="col-12">
|
||||
<div class="d-flex justify-content-between border-bottom mb-3">
|
||||
<h2 id="header" class="pb-2">{{labelPrefix + 'head' | translate}}</h2>
|
||||
<h1 id="header" class="pb-2">{{labelPrefix + 'head' | translate}}</h1>
|
||||
|
||||
<div>
|
||||
<button class="mr-auto btn btn-success addEPerson-button"
|
||||
@@ -13,9 +13,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 id="search" class="border-bottom pb-2">{{labelPrefix + 'search.head' | translate}}
|
||||
|
||||
</h3>
|
||||
<h2 id="search" class="border-bottom pb-2">
|
||||
{{labelPrefix + 'search.head' | translate}}
|
||||
</h2>
|
||||
<form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)" class="d-flex justify-content-between">
|
||||
<div>
|
||||
<select name="scope" id="scope" formControlName="scope" class="form-control" aria-label="Search scope">
|
||||
|
@@ -5,11 +5,11 @@
|
||||
<div *ngIf="epersonService.getActiveEPerson() | async; then editHeader; else createHeader"></div>
|
||||
|
||||
<ng-template #createHeader>
|
||||
<h2 class="border-bottom pb-2">{{messagePrefix + '.create' | translate}}</h2>
|
||||
<h1 class="border-bottom pb-2">{{messagePrefix + '.create' | translate}}</h1>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #editHeader>
|
||||
<h2 class="border-bottom pb-2">{{messagePrefix + '.edit' | translate}}</h2>
|
||||
<h1 class="border-bottom pb-2">{{messagePrefix + '.edit' | translate}}</h1>
|
||||
</ng-template>
|
||||
|
||||
<ds-form [formId]="formId"
|
||||
@@ -45,7 +45,7 @@
|
||||
<ds-themed-loading [showMessage]="false" *ngIf="!formGroup"></ds-themed-loading>
|
||||
|
||||
<div *ngIf="epersonService.getActiveEPerson() | async">
|
||||
<h5>{{messagePrefix + '.groupsEPersonIsMemberOf' | translate}}</h5>
|
||||
<h2>{{messagePrefix + '.groupsEPersonIsMemberOf' | translate}}</h2>
|
||||
|
||||
<ds-themed-loading [showMessage]="false" *ngIf="!(groups | async)"></ds-themed-loading>
|
||||
|
||||
|
@@ -34,9 +34,9 @@ import { ThemedLoadingComponent } from '../../../shared/loading/themed-loading.c
|
||||
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
||||
import { FormComponent } from '../../../shared/form/form.component';
|
||||
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||
import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
describe('EPersonFormComponent', () => {
|
||||
let component: EPersonFormComponent;
|
||||
|
@@ -5,11 +5,11 @@
|
||||
<div *ngIf="groupDataService.getActiveGroup() | async; then editHeader; else createHeader"></div>
|
||||
|
||||
<ng-template #createHeader>
|
||||
<h2 class="border-bottom pb-2">{{messagePrefix + '.head.create' | translate}}</h2>
|
||||
<h1 class="border-bottom pb-2">{{messagePrefix + '.head.create' | translate}}</h1>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #editHeader>
|
||||
<h2 class="border-bottom pb-2">
|
||||
<h1 class="border-bottom pb-2">
|
||||
<span
|
||||
*dsContextHelp="{
|
||||
content: 'admin.access-control.groups.form.tooltip.editGroupPage',
|
||||
@@ -20,7 +20,7 @@
|
||||
>
|
||||
{{messagePrefix + '.head.edit' | translate}}
|
||||
</span>
|
||||
</h2>
|
||||
</h1>
|
||||
</ng-template>
|
||||
|
||||
<ds-alert *ngIf="groupBeingEdited?.permanent" [type]="AlertTypeEnum.Warning"
|
||||
@@ -39,9 +39,8 @@
|
||||
<button (click)="onCancel()" type="button"
|
||||
class="btn btn-outline-secondary"><i class="fas fa-arrow-left"></i> {{messagePrefix + '.return' | translate}}</button>
|
||||
</div>
|
||||
<div after *ngIf="(canEdit$ | async) && !groupBeingEdited.permanent" class="btn-group">
|
||||
<button class="btn btn-danger delete-button" [disabled]="!(canEdit$ | async) || groupBeingEdited.permanent"
|
||||
(click)="delete()" type="button">
|
||||
<div after *ngIf="(canEdit$ | async) && !groupBeingEdited?.permanent" class="btn-group">
|
||||
<button (click)="delete()" class="btn btn-danger delete-button" type="button">
|
||||
<i class="fa fa-trash"></i> {{ messagePrefix + '.actions.delete' | translate}}
|
||||
</button>
|
||||
</div>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<ng-container>
|
||||
<h3 class="border-bottom pb-2">{{messagePrefix + '.head' | translate}}</h3>
|
||||
<h2 class="border-bottom pb-2">{{messagePrefix + '.head' | translate}}</h2>
|
||||
|
||||
<h4>{{messagePrefix + '.headMembers' | translate}}</h4>
|
||||
<h3>{{messagePrefix + '.headMembers' | translate}}</h3>
|
||||
|
||||
<ds-pagination *ngIf="(ePeopleMembersOfGroup | async)?.totalElements > 0"
|
||||
[paginationOptions]="config"
|
||||
@@ -55,7 +55,7 @@
|
||||
{{messagePrefix + '.no-members-yet' | translate}}
|
||||
</div>
|
||||
|
||||
<h4 id="search" class="border-bottom pb-2">
|
||||
<h3 id="search" class="border-bottom pb-2">
|
||||
<span
|
||||
*dsContextHelp="{
|
||||
content: 'admin.access-control.groups.form.tooltip.editGroup.addEpeople',
|
||||
@@ -66,7 +66,7 @@
|
||||
>
|
||||
{{messagePrefix + '.search.head' | translate}}
|
||||
</span>
|
||||
</h4>
|
||||
</h3>
|
||||
|
||||
<form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)" class="d-flex justify-content-between">
|
||||
<div class="flex-grow-1 mr-3">
|
||||
|
@@ -131,7 +131,7 @@ describe('SubgroupsListComponent', () => {
|
||||
builderService = getMockFormBuilderService();
|
||||
translateService = getMockTranslateService();
|
||||
paginationService = new PaginationServiceStub();
|
||||
TestBed.configureTestingModule({
|
||||
return TestBed.configureTestingModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
NgbModule,
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<div class="groups-registry row">
|
||||
<div class="col-12">
|
||||
<div class="d-flex justify-content-between border-bottom mb-3">
|
||||
<h2 id="header" class="pb-2">{{messagePrefix + 'head' | translate}}</h2>
|
||||
<h1 id="header" class="pb-2">{{messagePrefix + 'head' | translate}}</h1>
|
||||
<div>
|
||||
<button class="mr-auto btn btn-success"
|
||||
[routerLink]="'create'">
|
||||
@@ -12,7 +12,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 id="search" class="border-bottom pb-2">{{messagePrefix + 'search.head' | translate}}</h3>
|
||||
<h2 id="search" class="border-bottom pb-2">{{messagePrefix + 'search.head' | translate}}</h2>
|
||||
<form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)" class="d-flex justify-content-between">
|
||||
<div class="flex-grow-1 mr-3">
|
||||
<div class="form-group input-group">
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<div class="container">
|
||||
<h2>{{'admin.curation-tasks.header' |translate }}</h2>
|
||||
<h1>{{'admin.curation-tasks.header' |translate }}</h1>
|
||||
<ds-curation-form></ds-curation-form>
|
||||
</div>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<div class="container">
|
||||
<h2 id="header">{{'admin.metadata-import.page.header' | translate}}</h2>
|
||||
<h1 id="header">{{'admin.metadata-import.page.header' | translate}}</h1>
|
||||
<p>{{'admin.metadata-import.page.help' | translate}}</p>
|
||||
<div class="form-group">
|
||||
<div class="form-check">
|
||||
|
@@ -0,0 +1,8 @@
|
||||
import { URLCombiner } from '../../core/url-combiner/url-combiner';
|
||||
import { getNotificationsModuleRoute } from '../admin-routing-paths';
|
||||
|
||||
export const QUALITY_ASSURANCE_EDIT_PATH = 'quality-assurance';
|
||||
|
||||
export function getQualityAssuranceRoute(id: string) {
|
||||
return new URLCombiner(getNotificationsModuleRoute(), QUALITY_ASSURANCE_EDIT_PATH, id).toString();
|
||||
}
|
@@ -0,0 +1,87 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { AuthenticatedGuard } from '../../core/auth/authenticated.guard';
|
||||
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||
import { I18nBreadcrumbsService } from '../../core/breadcrumbs/i18n-breadcrumbs.service';
|
||||
import { QUALITY_ASSURANCE_EDIT_PATH } from './admin-notifications-routing-paths';
|
||||
import { AdminQualityAssuranceTopicsPageComponent } from './admin-quality-assurance-topics-page/admin-quality-assurance-topics-page.component';
|
||||
import { AdminQualityAssuranceEventsPageComponent } from './admin-quality-assurance-events-page/admin-quality-assurance-events-page.component';
|
||||
import { AdminQualityAssuranceTopicsPageResolver } from './admin-quality-assurance-topics-page/admin-quality-assurance-topics-page-resolver.service';
|
||||
import { AdminQualityAssuranceEventsPageResolver } from './admin-quality-assurance-events-page/admin-quality-assurance-events-page.resolver';
|
||||
import { AdminQualityAssuranceSourcePageComponent } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-page.component';
|
||||
import { AdminQualityAssuranceSourcePageResolver } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-page-resolver.service';
|
||||
import { QualityAssuranceBreadcrumbResolver } from '../../core/breadcrumbs/quality-assurance-breadcrumb.resolver';
|
||||
import { QualityAssuranceBreadcrumbService } from '../../core/breadcrumbs/quality-assurance-breadcrumb.service';
|
||||
import {
|
||||
SourceDataResolver
|
||||
} from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-data.resolver';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{
|
||||
canActivate: [ AuthenticatedGuard ],
|
||||
path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId`,
|
||||
component: AdminQualityAssuranceTopicsPageComponent,
|
||||
pathMatch: 'full',
|
||||
resolve: {
|
||||
breadcrumb: QualityAssuranceBreadcrumbResolver,
|
||||
openaireQualityAssuranceTopicsParams: AdminQualityAssuranceTopicsPageResolver
|
||||
},
|
||||
data: {
|
||||
title: 'admin.quality-assurance.page.title',
|
||||
breadcrumbKey: 'admin.quality-assurance',
|
||||
showBreadcrumbsFluid: false
|
||||
}
|
||||
},
|
||||
{
|
||||
canActivate: [ AuthenticatedGuard ],
|
||||
path: `${QUALITY_ASSURANCE_EDIT_PATH}`,
|
||||
component: AdminQualityAssuranceSourcePageComponent,
|
||||
pathMatch: 'full',
|
||||
resolve: {
|
||||
breadcrumb: I18nBreadcrumbResolver,
|
||||
openaireQualityAssuranceSourceParams: AdminQualityAssuranceSourcePageResolver,
|
||||
sourceData: SourceDataResolver
|
||||
},
|
||||
data: {
|
||||
title: 'admin.notifications.source.breadcrumbs',
|
||||
breadcrumbKey: 'admin.notifications.source',
|
||||
showBreadcrumbsFluid: false
|
||||
}
|
||||
},
|
||||
{
|
||||
canActivate: [ AuthenticatedGuard ],
|
||||
path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId/:topicId`,
|
||||
component: AdminQualityAssuranceEventsPageComponent,
|
||||
pathMatch: 'full',
|
||||
resolve: {
|
||||
breadcrumb: QualityAssuranceBreadcrumbResolver,
|
||||
openaireQualityAssuranceEventsParams: AdminQualityAssuranceEventsPageResolver
|
||||
},
|
||||
data: {
|
||||
title: 'admin.notifications.event.page.title',
|
||||
breadcrumbKey: 'admin.notifications.event',
|
||||
showBreadcrumbsFluid: false
|
||||
}
|
||||
}
|
||||
])
|
||||
],
|
||||
providers: [
|
||||
I18nBreadcrumbResolver,
|
||||
I18nBreadcrumbsService,
|
||||
SourceDataResolver,
|
||||
AdminQualityAssuranceTopicsPageResolver,
|
||||
AdminQualityAssuranceEventsPageResolver,
|
||||
AdminQualityAssuranceSourcePageResolver,
|
||||
QualityAssuranceBreadcrumbResolver,
|
||||
QualityAssuranceBreadcrumbService
|
||||
]
|
||||
})
|
||||
/**
|
||||
* Routing module for the Notifications section of the admin sidebar
|
||||
*/
|
||||
export class AdminNotificationsRoutingModule {
|
||||
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CoreModule } from '../../core/core.module';
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import { AdminNotificationsRoutingModule } from './admin-notifications-routing.module';
|
||||
import { AdminQualityAssuranceTopicsPageComponent } from './admin-quality-assurance-topics-page/admin-quality-assurance-topics-page.component';
|
||||
import { AdminQualityAssuranceEventsPageComponent } from './admin-quality-assurance-events-page/admin-quality-assurance-events-page.component';
|
||||
import { AdminQualityAssuranceSourcePageComponent } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-page.component';
|
||||
import {NotificationsModule} from '../../notifications/notifications.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
SharedModule,
|
||||
CoreModule.forRoot(),
|
||||
AdminNotificationsRoutingModule,
|
||||
NotificationsModule
|
||||
],
|
||||
declarations: [
|
||||
AdminQualityAssuranceTopicsPageComponent,
|
||||
AdminQualityAssuranceEventsPageComponent,
|
||||
AdminQualityAssuranceSourcePageComponent
|
||||
],
|
||||
entryComponents: []
|
||||
})
|
||||
/**
|
||||
* This module handles all components related to the notifications pages
|
||||
*/
|
||||
export class AdminNotificationsModule {
|
||||
|
||||
}
|
@@ -0,0 +1 @@
|
||||
<ds-quality-assurance-events></ds-quality-assurance-events>
|
@@ -0,0 +1,26 @@
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AdminQualityAssuranceEventsPageComponent } from './admin-quality-assurance-events-page.component';
|
||||
|
||||
describe('AdminQualityAssuranceEventsPageComponent', () => {
|
||||
let component: AdminQualityAssuranceEventsPageComponent;
|
||||
let fixture: ComponentFixture<AdminQualityAssuranceEventsPageComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AdminQualityAssuranceEventsPageComponent ],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AdminQualityAssuranceEventsPageComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create AdminQualityAssuranceEventsPageComponent', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@@ -0,0 +1,12 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
/**
|
||||
* Component for the page that show the QA events related to a specific topic.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'ds-quality-assurance-events-page',
|
||||
templateUrl: './admin-quality-assurance-events-page.component.html'
|
||||
})
|
||||
export class AdminQualityAssuranceEventsPageComponent {
|
||||
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
||||
|
||||
/**
|
||||
* Interface for the route parameters.
|
||||
*/
|
||||
export interface AdminQualityAssuranceEventsPageParams {
|
||||
pageId?: string;
|
||||
pageSize?: number;
|
||||
currentPage?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class represents a resolver that retrieve the route data before the route is activated.
|
||||
*/
|
||||
@Injectable()
|
||||
export class AdminQualityAssuranceEventsPageResolver implements Resolve<AdminQualityAssuranceEventsPageParams> {
|
||||
|
||||
/**
|
||||
* Method for resolving the parameters in the current route.
|
||||
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
|
||||
* @param {RouterStateSnapshot} state The current RouterStateSnapshot
|
||||
* @returns AdminQualityAssuranceEventsPageParams Emits the route parameters
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): AdminQualityAssuranceEventsPageParams {
|
||||
return {
|
||||
pageId: route.queryParams.pageId,
|
||||
pageSize: parseInt(route.queryParams.pageSize, 10),
|
||||
currentPage: parseInt(route.queryParams.page, 10)
|
||||
};
|
||||
}
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot, Router } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { QualityAssuranceSourceObject } from '../../../core/notifications/qa/models/quality-assurance-source.model';
|
||||
import { QualityAssuranceSourceService } from '../../../notifications/qa/source/quality-assurance-source.service';
|
||||
import {environment} from '../../../../environments/environment';
|
||||
/**
|
||||
* This class represents a resolver that retrieve the route data before the route is activated.
|
||||
*/
|
||||
@Injectable()
|
||||
export class SourceDataResolver implements Resolve<Observable<QualityAssuranceSourceObject[]>> {
|
||||
private pageSize = environment.qualityAssuranceConfig.pageSize;
|
||||
/**
|
||||
* Initialize the effect class variables.
|
||||
* @param {QualityAssuranceSourceService} qualityAssuranceSourceService
|
||||
*/
|
||||
constructor(
|
||||
private qualityAssuranceSourceService: QualityAssuranceSourceService,
|
||||
private router: Router
|
||||
) { }
|
||||
/**
|
||||
* Method for resolving the parameters in the current route.
|
||||
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
|
||||
* @param {RouterStateSnapshot} state The current RouterStateSnapshot
|
||||
* @returns Observable<QualityAssuranceSourceObject[]>
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<QualityAssuranceSourceObject[]> {
|
||||
return this.qualityAssuranceSourceService.getSources(this.pageSize, 0).pipe(
|
||||
map((sources: PaginatedList<QualityAssuranceSourceObject>) => {
|
||||
if (sources.page.length === 1) {
|
||||
this.router.navigate([this.getResolvedUrl(route) + '/' + sources.page[0].id]);
|
||||
}
|
||||
return sources.page;
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param route url path
|
||||
* @returns url path
|
||||
*/
|
||||
getResolvedUrl(route: ActivatedRouteSnapshot): string {
|
||||
return route.pathFromRoot.map(v => v.url.map(segment => segment.toString()).join('/')).join('/');
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';
|
||||
|
||||
/**
|
||||
* Interface for the route parameters.
|
||||
*/
|
||||
export interface AdminQualityAssuranceSourcePageParams {
|
||||
pageId?: string;
|
||||
pageSize?: number;
|
||||
currentPage?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class represents a resolver that retrieve the route data before the route is activated.
|
||||
*/
|
||||
@Injectable()
|
||||
export class AdminQualityAssuranceSourcePageResolver implements Resolve<AdminQualityAssuranceSourcePageParams> {
|
||||
|
||||
/**
|
||||
* Method for resolving the parameters in the current route.
|
||||
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
|
||||
* @param {RouterStateSnapshot} state The current RouterStateSnapshot
|
||||
* @returns AdminQualityAssuranceSourcePageParams Emits the route parameters
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): AdminQualityAssuranceSourcePageParams {
|
||||
return {
|
||||
pageId: route.queryParams.pageId,
|
||||
pageSize: parseInt(route.queryParams.pageSize, 10),
|
||||
currentPage: parseInt(route.queryParams.page, 10)
|
||||
};
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
<ds-quality-assurance-source></ds-quality-assurance-source>
|
@@ -0,0 +1,27 @@
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AdminQualityAssuranceSourcePageComponent } from './admin-quality-assurance-source-page.component';
|
||||
|
||||
describe('AdminQualityAssuranceSourcePageComponent', () => {
|
||||
let component: AdminQualityAssuranceSourcePageComponent;
|
||||
let fixture: ComponentFixture<AdminQualityAssuranceSourcePageComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AdminQualityAssuranceSourcePageComponent ],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AdminQualityAssuranceSourcePageComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create AdminQualityAssuranceSourcePageComponent', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@@ -0,0 +1,10 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
/**
|
||||
* Component for the page that show the QA sources.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'ds-admin-quality-assurance-source-page-component',
|
||||
templateUrl: './admin-quality-assurance-source-page.component.html',
|
||||
})
|
||||
export class AdminQualityAssuranceSourcePageComponent {}
|
@@ -0,0 +1,32 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';
|
||||
|
||||
/**
|
||||
* Interface for the route parameters.
|
||||
*/
|
||||
export interface AdminQualityAssuranceTopicsPageParams {
|
||||
pageId?: string;
|
||||
pageSize?: number;
|
||||
currentPage?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class represents a resolver that retrieve the route data before the route is activated.
|
||||
*/
|
||||
@Injectable()
|
||||
export class AdminQualityAssuranceTopicsPageResolver implements Resolve<AdminQualityAssuranceTopicsPageParams> {
|
||||
|
||||
/**
|
||||
* Method for resolving the parameters in the current route.
|
||||
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
|
||||
* @param {RouterStateSnapshot} state The current RouterStateSnapshot
|
||||
* @returns AdminQualityAssuranceTopicsPageParams Emits the route parameters
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): AdminQualityAssuranceTopicsPageParams {
|
||||
return {
|
||||
pageId: route.queryParams.pageId,
|
||||
pageSize: parseInt(route.queryParams.pageSize, 10),
|
||||
currentPage: parseInt(route.queryParams.page, 10)
|
||||
};
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
<ds-quality-assurance-topic></ds-quality-assurance-topic>
|
@@ -0,0 +1,26 @@
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AdminQualityAssuranceTopicsPageComponent } from './admin-quality-assurance-topics-page.component';
|
||||
|
||||
describe('AdminQualityAssuranceTopicsPageComponent', () => {
|
||||
let component: AdminQualityAssuranceTopicsPageComponent;
|
||||
let fixture: ComponentFixture<AdminQualityAssuranceTopicsPageComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AdminQualityAssuranceTopicsPageComponent ],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AdminQualityAssuranceTopicsPageComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create AdminQualityAssuranceTopicsPageComponent', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@@ -0,0 +1,12 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
/**
|
||||
* Component for the page that show the QA topics related to a specific source.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'ds-notification-qa-page',
|
||||
templateUrl: './admin-quality-assurance-topics-page.component.html'
|
||||
})
|
||||
export class AdminQualityAssuranceTopicsPageComponent {
|
||||
|
||||
}
|
@@ -1,11 +1,11 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12 mb-4">
|
||||
<h2 id="sub-header"
|
||||
class="border-bottom mb-2">{{ 'admin.registries.bitstream-formats.create.new' | translate }}</h2>
|
||||
<h1 id="sub-header"
|
||||
class="border-bottom pb-2">{{ 'admin.registries.bitstream-formats.create.new' | translate }}</h1>
|
||||
|
||||
<ds-bitstream-format-form (updatedFormat)="createBitstreamFormat($event)"></ds-bitstream-format-form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<div class="bitstream-formats row">
|
||||
<div class="col-12">
|
||||
|
||||
<h2 id="header" class="border-bottom pb-2 ">{{'admin.registries.bitstream-formats.head' | translate}}</h2>
|
||||
<h1 id="header" class="border-bottom pb-2">{{'admin.registries.bitstream-formats.head' | translate}}</h1>
|
||||
|
||||
<p id="description">{{'admin.registries.bitstream-formats.description' | translate}}</p>
|
||||
<p id="create-new" class="mb-2"><a [routerLink]="'add'" class="btn btn-success">{{'admin.registries.bitstream-formats.create.new' | translate}}</a></p>
|
||||
@@ -19,7 +19,7 @@
|
||||
<table id="formats" class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"></th>
|
||||
<th scope="col" [attr.aria-label]="'admin.registries.bitstream-formats.select' | translate"></th>
|
||||
<th scope="col">{{'admin.registries.bitstream-formats.table.id' | translate}}</th>
|
||||
<th scope="col">{{'admin.registries.bitstream-formats.table.name' | translate}}</th>
|
||||
<th scope="col">{{'admin.registries.bitstream-formats.table.mimetype' | translate}}</th>
|
||||
@@ -31,6 +31,7 @@
|
||||
<td>
|
||||
<label class="mb-0">
|
||||
<input type="checkbox"
|
||||
[attr.aria-label]="'admin.registries.bitstream-formats.select' | translate"
|
||||
[checked]="isSelected(bitstreamFormat) | async"
|
||||
(change)="selectBitStreamFormat(bitstreamFormat, $event)"
|
||||
>
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12 mb-4">
|
||||
<h2 id="sub-header"
|
||||
class="border-bottom mb-2">{{'admin.registries.bitstream-formats.edit.head' | translate:{format: (bitstreamFormatRD$ | async)?.payload.shortDescription} }}</h2>
|
||||
<h1 id="sub-header"
|
||||
class="border-bottom pb-2">{{'admin.registries.bitstream-formats.edit.head' | translate:{format: (bitstreamFormatRD$ | async)?.payload.shortDescription} }}</h1>
|
||||
|
||||
<ds-bitstream-format-form [bitstreamFormat]="(bitstreamFormatRD$ | async)?.payload" (updatedFormat)="updateFormat($event)"></ds-bitstream-format-form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { RegistryService } from '../../../core/registry/registry.service';
|
||||
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||
import {
|
||||
@@ -48,7 +48,7 @@ import { PaginationComponent } from '../../../shared/pagination/pagination.compo
|
||||
* A component used for managing all existing metadata fields within the current metadata schema.
|
||||
* The admin can create, edit or delete metadata fields here.
|
||||
*/
|
||||
export class MetadataSchemaComponent implements OnInit {
|
||||
export class MetadataSchemaComponent implements OnInit, OnDestroy {
|
||||
/**
|
||||
* The metadata schema
|
||||
*/
|
||||
@@ -76,7 +76,6 @@ export class MetadataSchemaComponent implements OnInit {
|
||||
constructor(private registryService: RegistryService,
|
||||
private route: ActivatedRoute,
|
||||
private notificationsService: NotificationsService,
|
||||
private router: Router,
|
||||
private paginationService: PaginationService,
|
||||
private translateService: TranslateService) {
|
||||
|
||||
@@ -102,7 +101,7 @@ export class MetadataSchemaComponent implements OnInit {
|
||||
*/
|
||||
private updateFields() {
|
||||
this.metadataFields$ = this.paginationService.getCurrentPagination(this.config.id, this.config).pipe(
|
||||
switchMap((currentPagination) => combineLatest(this.metadataSchema$, this.needsUpdate$, observableOf(currentPagination))),
|
||||
switchMap((currentPagination) => combineLatest([this.metadataSchema$, this.needsUpdate$, observableOf(currentPagination)])),
|
||||
switchMap(([schema, update, currentPagination]: [MetadataSchema, boolean, PaginationComponentOptions]) => {
|
||||
if (update) {
|
||||
this.needsUpdate$.next(false);
|
||||
@@ -209,10 +208,10 @@ export class MetadataSchemaComponent implements OnInit {
|
||||
showNotification(success: boolean, amount: number) {
|
||||
const prefix = 'admin.registries.schema.notification';
|
||||
const suffix = success ? 'success' : 'failure';
|
||||
const messages = observableCombineLatest(
|
||||
const messages = observableCombineLatest([
|
||||
this.translateService.get(success ? `${prefix}.${suffix}` : `${prefix}.${suffix}`),
|
||||
this.translateService.get(`${prefix}.field.deleted.${suffix}`, { amount: amount })
|
||||
);
|
||||
]);
|
||||
messages.subscribe(([head, content]) => {
|
||||
if (success) {
|
||||
this.notificationsService.success(head, content);
|
||||
@@ -223,6 +222,7 @@ export class MetadataSchemaComponent implements OnInit {
|
||||
}
|
||||
ngOnDestroy(): void {
|
||||
this.paginationService.clearPagination(this.config.id);
|
||||
this.registryService.deselectAllMetadataField();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,7 +2,12 @@ import { URLCombiner } from '../core/url-combiner/url-combiner';
|
||||
import { getAdminModuleRoute } from '../app-routing-paths';
|
||||
|
||||
export const REGISTRIES_MODULE_PATH = 'registries';
|
||||
export const NOTIFICATIONS_MODULE_PATH = 'notifications';
|
||||
|
||||
export function getRegistriesModuleRoute() {
|
||||
return new URLCombiner(getAdminModuleRoute(), REGISTRIES_MODULE_PATH).toString();
|
||||
}
|
||||
|
||||
export function getNotificationsModuleRoute() {
|
||||
return new URLCombiner(getAdminModuleRoute(), NOTIFICATIONS_MODULE_PATH).toString();
|
||||
}
|
||||
|
@@ -6,12 +6,17 @@ import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.reso
|
||||
import { AdminWorkflowPageComponent } from './admin-workflow-page/admin-workflow-page.component';
|
||||
import { I18nBreadcrumbsService } from '../core/breadcrumbs/i18n-breadcrumbs.service';
|
||||
import { AdminCurationTasksComponent } from './admin-curation-tasks/admin-curation-tasks.component';
|
||||
import { REGISTRIES_MODULE_PATH } from './admin-routing-paths';
|
||||
import { REGISTRIES_MODULE_PATH, NOTIFICATIONS_MODULE_PATH } from './admin-routing-paths';
|
||||
import { BatchImportPageComponent } from './admin-import-batch-page/batch-import-page.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{
|
||||
path: NOTIFICATIONS_MODULE_PATH,
|
||||
loadChildren: () => import('./admin-notifications/admin-notifications.module')
|
||||
.then((m) => m.AdminNotificationsModule),
|
||||
},
|
||||
{
|
||||
path: REGISTRIES_MODULE_PATH,
|
||||
loadChildren: () => import('./admin-registries/admin-registries.module')
|
||||
|
@@ -34,22 +34,21 @@
|
||||
</div>
|
||||
<div class="navbar-nav">
|
||||
<div class="sidebar-section" id="sidebar-collapse-toggle">
|
||||
<a class="nav-item nav-link sidebar-section d-flex flex-row flex-nowrap"
|
||||
href="javascript:void(0);"
|
||||
<button class="nav-item nav-link sidebar-section d-flex flex-row flex-nowrap border-0" type="button"
|
||||
(click)="toggle($event)"
|
||||
(keyup.space)="toggle($event)"
|
||||
>
|
||||
<div class="shortcut-icon">
|
||||
<span class="shortcut-icon">
|
||||
<i *ngIf="(menuCollapsed | async)" class="fas fa-fw fa-angle-double-right"
|
||||
[title]="'menu.section.icon.pin' | translate"></i>
|
||||
<i *ngIf="!(menuCollapsed | async)" class="fas fa-fw fa-angle-double-left"
|
||||
[title]="'menu.section.icon.unpin' | translate"></i>
|
||||
</div>
|
||||
<div class="sidebar-collapsible">
|
||||
</span>
|
||||
<span class="sidebar-collapsible text-left">
|
||||
<span *ngIf="menuCollapsed | async" class="section-header-text">{{'menu.section.pin' | translate }}</span>
|
||||
<span *ngIf="!(menuCollapsed | async)" class="section-header-text">{{'menu.section.unpin' | translate }}</span>
|
||||
</div>
|
||||
</a>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
@@ -142,7 +142,7 @@ describe('AdminSidebarComponent', () => {
|
||||
describe('when the collapse link is clicked', () => {
|
||||
beforeEach(() => {
|
||||
spyOn(menuService, 'toggleMenu');
|
||||
const sidebarToggler = fixture.debugElement.query(By.css('#sidebar-collapse-toggle > a'));
|
||||
const sidebarToggler = fixture.debugElement.query(By.css('#sidebar-collapse-toggle > button'));
|
||||
sidebarToggler.triggerEventHandler('click', {
|
||||
preventDefault: () => {/**/
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<div class="container">
|
||||
<h3>{{'bitstream.download.page' | translate:{ bitstream: dsoNameService.getName((bitstream$ | async)) } }}</h3>
|
||||
<h1 class="h2">{{'bitstream.download.page' | translate:{ bitstream: dsoNameService.getName((bitstream$ | async)) } }}</h1>
|
||||
<div class="pt-3">
|
||||
<button (click)="back()" class="btn btn-outline-secondary">
|
||||
<i class="fas fa-arrow-left"></i> {{'bitstream.download.page.back' | translate}}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h3>{{dsoNameService.getName(bitstreamRD?.payload)}} <span class="text-muted">({{bitstreamRD?.payload?.sizeBytes | dsFileSize}})</span></h3>
|
||||
<h1 class="h2">{{dsoNameService.getName(bitstreamRD?.payload)}} <span class="text-muted">({{bitstreamRD?.payload?.sizeBytes | dsFileSize}})</span></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<div class="container">
|
||||
<h1>{{ ('browse.taxonomy_' + vocabularyName + '.title') | translate }}</h1>
|
||||
<div class="mb-3">
|
||||
<ds-vocabulary-treeview [vocabularyOptions]=vocabularyOptions
|
||||
[multiSelect]="true"
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<p>{{'collection.edit.item-mapper.description' | translate}}</p>
|
||||
|
||||
<ul ngbNav (navChange)="tabChange($event)" [destroyOnHide]="true" #tabs="ngbNav" class="nav-tabs">
|
||||
<li [ngbNavItem]="'browseTab'">
|
||||
<li [ngbNavItem]="'browseTab'" role="presentation">
|
||||
<a ngbNavLink>{{'collection.edit.item-mapper.tabs.browse' | translate}}</a>
|
||||
<ng-template ngbNavContent>
|
||||
<div class="mt-2">
|
||||
@@ -23,7 +23,7 @@
|
||||
</div>
|
||||
</ng-template>
|
||||
</li>
|
||||
<li [ngbNavItem]="'mapTab'">
|
||||
<li [ngbNavItem]="'mapTab'" role="presentation">
|
||||
<a ngbNavLink>{{'collection.edit.item-mapper.tabs.map' | translate}}</a>
|
||||
<ng-template ngbNavContent>
|
||||
<div class="row mt-2">
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<div class="row">
|
||||
<ng-container *ngVar="(dsoRD$ | async)?.payload as dso">
|
||||
<div class="col-12 pb-4">
|
||||
<h2 id="header" class="border-bottom pb-2">{{ 'collection.delete.head' | translate}}</h2>
|
||||
<h1 id="header" class="border-bottom pb-2">{{ 'collection.delete.head' | translate}}</h1>
|
||||
<p class="pb-2">{{ 'collection.delete.text' | translate:{ dso: dsoNameService.getName(dso) } }}</p>
|
||||
<div class="form-group row">
|
||||
<div class="col text-right space-children-mr">
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<div class="container">
|
||||
<h3>{{'collection.curate.header' |translate:{collection: (collectionName$ |async)} }}</h3>
|
||||
<h2>{{'collection.curate.header' |translate:{collection: (collectionName$ |async)} }}</h2>
|
||||
<ds-curation-form
|
||||
[dsoHandle]="(dsoRD$|async)?.payload.handle"
|
||||
></ds-curation-form>
|
||||
|
@@ -18,7 +18,7 @@
|
||||
<span class="d-none d-sm-inline"> {{"item.edit.metadata.save-button" | translate}}</span>
|
||||
</button>
|
||||
</div>
|
||||
<h4>{{ 'collection.edit.tabs.source.head' | translate }}</h4>
|
||||
<h2>{{ 'collection.edit.tabs.source.head' | translate }}</h2>
|
||||
<div *ngIf="contentSource" class="form-check mb-4">
|
||||
<input type="checkbox" class="form-check-input" id="externalSourceCheck"
|
||||
[checked]="(contentSource?.harvestType !== harvestTypeNone)" (change)="changeExternalSource()">
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<div class="row">
|
||||
<div class="col-12" *ngVar="(itemRD$ | async) as itemRD">
|
||||
<ng-container *ngIf="itemRD?.hasSucceeded">
|
||||
<h2 class="border-bottom">{{ 'collection.edit.template.head' | translate:{ collection: dsoNameService.getName(collection) } }}</h2>
|
||||
<h1 class="border-bottom">{{ 'collection.edit.template.head' | translate:{ collection: dsoNameService.getName(collection) } }}</h1>
|
||||
<ds-themed-dso-edit-metadata [updateDataService]="itemTemplateService" [dso]="itemRD?.payload"></ds-themed-dso-edit-metadata>
|
||||
<button [routerLink]="getCollectionEditUrl(collection)" class="btn btn-outline-secondary">{{ 'collection.edit.template.cancel' | translate }}</button>
|
||||
</ng-container>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<div class="row">
|
||||
<ng-container *ngVar="(dsoRD$ | async)?.payload as dso">
|
||||
<div class="col-12 pb-4">
|
||||
<h2 id="header" class="border-bottom pb-2">{{ 'community.delete.head' | translate}}</h2>
|
||||
<h1 id="header" class="border-bottom pb-2">{{ 'community.delete.head' | translate}}</h1>
|
||||
<p class="pb-2">{{ 'community.delete.text' | translate:{ dso: dsoNameService.getName(dso) } }}</p>
|
||||
<div class="form-group row">
|
||||
<div class="col text-right space-children-mr">
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<div class="container">
|
||||
<h3>{{'community.curate.header' |translate:{community: (communityName$ |async)} }}</h3>
|
||||
<h2>{{'community.curate.header' |translate:{community: (communityName$ |async)} }}</h2>
|
||||
<ds-curation-form
|
||||
[dsoHandle]="(dsoRD$|async)?.payload.handle"
|
||||
></ds-curation-form>
|
||||
|
@@ -50,7 +50,7 @@ export class DSONameService {
|
||||
}
|
||||
},
|
||||
OrgUnit: (dso: DSpaceObject): string => {
|
||||
return dso.firstMetadataValue('organization.legalName');
|
||||
return dso.firstMetadataValue('organization.legalName') || this.translateService.instant('dso.name.untitled');
|
||||
},
|
||||
Default: (dso: DSpaceObject): string => {
|
||||
// If object doesn't have dc.title metadata use name property
|
||||
@@ -106,7 +106,7 @@ export class DSONameService {
|
||||
}
|
||||
return `${familyName}, ${givenName}`;
|
||||
} else if (entityType === 'OrgUnit') {
|
||||
return this.firstMetadataValue(object, dso, 'organization.legalName');
|
||||
return this.firstMetadataValue(object, dso, 'organization.legalName') || this.translateService.instant('dso.name.untitled');
|
||||
}
|
||||
return this.firstMetadataValue(object, dso, 'dc.title') || dso.name || this.translateService.instant('dso.name.untitled');
|
||||
}
|
||||
|
@@ -0,0 +1,31 @@
|
||||
import {QualityAssuranceBreadcrumbResolver} from './quality-assurance-breadcrumb.resolver';
|
||||
|
||||
describe('QualityAssuranceBreadcrumbResolver', () => {
|
||||
describe('resolve', () => {
|
||||
let resolver: QualityAssuranceBreadcrumbResolver;
|
||||
let qualityAssuranceBreadcrumbService: any;
|
||||
let route: any;
|
||||
const fullPath = '/test/quality-assurance/';
|
||||
const expectedKey = 'testSourceId:testTopicId';
|
||||
|
||||
beforeEach(() => {
|
||||
route = {
|
||||
paramMap: {
|
||||
get: function (param) {
|
||||
return this[param];
|
||||
},
|
||||
sourceId: 'testSourceId',
|
||||
topicId: 'testTopicId'
|
||||
}
|
||||
};
|
||||
qualityAssuranceBreadcrumbService = {};
|
||||
resolver = new QualityAssuranceBreadcrumbResolver(qualityAssuranceBreadcrumbService);
|
||||
});
|
||||
|
||||
it('should resolve the breadcrumb config', () => {
|
||||
const resolvedConfig = resolver.resolve(route as any, {url: fullPath + 'testSourceId'} as any);
|
||||
const expectedConfig = { provider: qualityAssuranceBreadcrumbService, key: expectedKey, url: fullPath };
|
||||
expect(resolvedConfig).toEqual(expectedConfig);
|
||||
});
|
||||
});
|
||||
});
|
@@ -0,0 +1,32 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {QualityAssuranceBreadcrumbService} from './quality-assurance-breadcrumb.service';
|
||||
import {ActivatedRouteSnapshot, Resolve, RouterStateSnapshot} from '@angular/router';
|
||||
import {BreadcrumbConfig} from '../../breadcrumbs/breadcrumb/breadcrumb-config.model';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class QualityAssuranceBreadcrumbResolver implements Resolve<BreadcrumbConfig<string>> {
|
||||
constructor(protected breadcrumbService: QualityAssuranceBreadcrumbService) {}
|
||||
|
||||
/**
|
||||
* Method that resolve QA item into a breadcrumb
|
||||
* The parameter are retrieved by the url since part of the QA route config
|
||||
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
|
||||
* @param {RouterStateSnapshot} state The current RouterStateSnapshot
|
||||
* @returns BreadcrumbConfig object
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): BreadcrumbConfig<string> {
|
||||
const sourceId = route.paramMap.get('sourceId');
|
||||
const topicId = route.paramMap.get('topicId');
|
||||
let key = sourceId;
|
||||
|
||||
if (topicId) {
|
||||
key += `:${topicId}`;
|
||||
}
|
||||
const fullPath = state.url;
|
||||
const url = fullPath.substr(0, fullPath.indexOf(sourceId));
|
||||
|
||||
return { provider: this.breadcrumbService, key, url };
|
||||
}
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
import { TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { Breadcrumb } from '../../breadcrumbs/breadcrumb/breadcrumb.model';
|
||||
import { getTestScheduler } from 'jasmine-marbles';
|
||||
import {QualityAssuranceBreadcrumbService} from './quality-assurance-breadcrumb.service';
|
||||
|
||||
describe('QualityAssuranceBreadcrumbService', () => {
|
||||
let service: QualityAssuranceBreadcrumbService;
|
||||
let dataService: any;
|
||||
let translateService: any = {
|
||||
instant: (str) => str,
|
||||
};
|
||||
|
||||
let exampleString;
|
||||
let exampleURL;
|
||||
let exampleQaKey;
|
||||
|
||||
function init() {
|
||||
exampleString = 'sourceId';
|
||||
exampleURL = '/test/quality-assurance/';
|
||||
exampleQaKey = 'admin.quality-assurance.breadcrumbs';
|
||||
}
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
init();
|
||||
TestBed.configureTestingModule({}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
service = new QualityAssuranceBreadcrumbService(dataService,translateService);
|
||||
});
|
||||
|
||||
describe('getBreadcrumbs', () => {
|
||||
it('should return a breadcrumb based on a string', () => {
|
||||
const breadcrumbs = service.getBreadcrumbs(exampleString, exampleURL);
|
||||
getTestScheduler().expectObservable(breadcrumbs).toBe('(a|)', { a: [new Breadcrumb(exampleQaKey, exampleURL),
|
||||
new Breadcrumb(exampleString, exampleURL + exampleString)]
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
@@ -0,0 +1,53 @@
|
||||
import { Breadcrumb } from '../../breadcrumbs/breadcrumb/breadcrumb.model';
|
||||
import { BreadcrumbsProviderService } from './breadcrumbsProviderService';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { getFirstCompletedRemoteData } from '../shared/operators';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { QualityAssuranceTopicDataService } from '../notifications/qa/topics/quality-assurance-topic-data.service';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Service to calculate QA breadcrumbs for a single part of the route
|
||||
*/
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class QualityAssuranceBreadcrumbService implements BreadcrumbsProviderService<string> {
|
||||
|
||||
private QUALITY_ASSURANCE_BREADCRUMB_KEY = 'admin.quality-assurance.breadcrumbs';
|
||||
constructor(
|
||||
protected qualityAssuranceService: QualityAssuranceTopicDataService,
|
||||
private translationService: TranslateService,
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to calculate the breadcrumbs
|
||||
* @param key The key used to resolve the breadcrumb
|
||||
* @param url The url to use as a link for this breadcrumb
|
||||
*/
|
||||
getBreadcrumbs(key: string, url: string): Observable<Breadcrumb[]> {
|
||||
const sourceId = key.split(':')[0];
|
||||
const topicId = key.split(':')[1];
|
||||
|
||||
if (topicId) {
|
||||
return this.qualityAssuranceService.getTopic(topicId).pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
map((topic) => {
|
||||
return [new Breadcrumb(this.translationService.instant(this.QUALITY_ASSURANCE_BREADCRUMB_KEY), url),
|
||||
new Breadcrumb(sourceId, `${url}${sourceId}`),
|
||||
new Breadcrumb(topicId, undefined)];
|
||||
})
|
||||
);
|
||||
} else {
|
||||
return observableOf([new Breadcrumb(this.translationService.instant(this.QUALITY_ASSURANCE_BREADCRUMB_KEY), url),
|
||||
new Breadcrumb(sourceId, `${url}${sourceId}`)]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
422
src/app/core/core.module.ts
Normal file
422
src/app/core/core.module.ts
Normal file
@@ -0,0 +1,422 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
|
||||
|
||||
import { EffectsModule } from '@ngrx/effects';
|
||||
|
||||
import { Action, StoreConfig, StoreModule } from '@ngrx/store';
|
||||
import { MyDSpaceGuard } from '../my-dspace-page/my-dspace.guard';
|
||||
|
||||
import { isNotEmpty } from '../shared/empty.util';
|
||||
import { HostWindowService } from '../shared/host-window.service';
|
||||
import { MenuService } from '../shared/menu/menu.service';
|
||||
import { EndpointMockingRestService } from '../shared/mocks/dspace-rest/endpoint-mocking-rest.service';
|
||||
import {
|
||||
MOCK_RESPONSE_MAP,
|
||||
mockResponseMap,
|
||||
ResponseMapMock
|
||||
} from '../shared/mocks/dspace-rest/mocks/response-map.mock';
|
||||
import { NotificationsService } from '../shared/notifications/notifications.service';
|
||||
import { SelectableListService } from '../shared/object-list/selectable-list/selectable-list.service';
|
||||
import { ObjectSelectService } from '../shared/object-select/object-select.service';
|
||||
import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model';
|
||||
import { SidebarService } from '../shared/sidebar/sidebar.service';
|
||||
import { AuthenticatedGuard } from './auth/authenticated.guard';
|
||||
import { AuthStatus } from './auth/models/auth-status.model';
|
||||
import { BrowseService } from './browse/browse.service';
|
||||
import { RemoteDataBuildService } from './cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from './cache/object-cache.service';
|
||||
import { SubmissionDefinitionsModel } from './config/models/config-submission-definitions.model';
|
||||
import { SubmissionFormsModel } from './config/models/config-submission-forms.model';
|
||||
import { SubmissionSectionModel } from './config/models/config-submission-section.model';
|
||||
import { SubmissionUploadsModel } from './config/models/config-submission-uploads.model';
|
||||
import { SubmissionFormsConfigDataService } from './config/submission-forms-config-data.service';
|
||||
import { coreEffects } from './core.effects';
|
||||
import { coreReducers } from './core.reducers';
|
||||
import { BitstreamFormatDataService } from './data/bitstream-format-data.service';
|
||||
import { CollectionDataService } from './data/collection-data.service';
|
||||
import { CommunityDataService } from './data/community-data.service';
|
||||
import { ContentSourceResponseParsingService } from './data/content-source-response-parsing.service';
|
||||
import { DebugResponseParsingService } from './data/debug-response-parsing.service';
|
||||
import { DefaultChangeAnalyzer } from './data/default-change-analyzer.service';
|
||||
import { DSOChangeAnalyzer } from './data/dso-change-analyzer.service';
|
||||
import { DSOResponseParsingService } from './data/dso-response-parsing.service';
|
||||
import { DSpaceObjectDataService } from './data/dspace-object-data.service';
|
||||
import { EndpointMapResponseParsingService } from './data/endpoint-map-response-parsing.service';
|
||||
import { EntityTypeDataService } from './data/entity-type-data.service';
|
||||
import { ExternalSourceDataService } from './data/external-source-data.service';
|
||||
import { FacetConfigResponseParsingService } from './data/facet-config-response-parsing.service';
|
||||
import { FacetValueResponseParsingService } from './data/facet-value-response-parsing.service';
|
||||
import { FilteredDiscoveryPageResponseParsingService } from './data/filtered-discovery-page-response-parsing.service';
|
||||
import { ItemDataService } from './data/item-data.service';
|
||||
import { LookupRelationService } from './data/lookup-relation.service';
|
||||
import { MyDSpaceResponseParsingService } from './data/mydspace-response-parsing.service';
|
||||
import { ObjectUpdatesService } from './data/object-updates/object-updates.service';
|
||||
import { RelationshipTypeDataService } from './data/relationship-type-data.service';
|
||||
import { RelationshipDataService } from './data/relationship-data.service';
|
||||
import { ResourcePolicyDataService } from './resource-policy/resource-policy-data.service';
|
||||
import { SearchResponseParsingService } from './data/search-response-parsing.service';
|
||||
import { SiteDataService } from './data/site-data.service';
|
||||
import { DspaceRestService } from './dspace-rest/dspace-rest.service';
|
||||
import { EPersonDataService } from './eperson/eperson-data.service';
|
||||
import { EPerson } from './eperson/models/eperson.model';
|
||||
import { Group } from './eperson/models/group.model';
|
||||
import { JsonPatchOperationsBuilder } from './json-patch/builder/json-patch-operations-builder';
|
||||
import { MetadataField } from './metadata/metadata-field.model';
|
||||
import { MetadataSchema } from './metadata/metadata-schema.model';
|
||||
import { MetadataService } from './metadata/metadata.service';
|
||||
import { RegistryService } from './registry/registry.service';
|
||||
import { RoleService } from './roles/role.service';
|
||||
import { FeedbackDataService } from './feedback/feedback-data.service';
|
||||
|
||||
import { ServerResponseService } from './services/server-response.service';
|
||||
import { NativeWindowFactory, NativeWindowService } from './services/window.service';
|
||||
import { BitstreamFormat } from './shared/bitstream-format.model';
|
||||
import { Bitstream } from './shared/bitstream.model';
|
||||
import { BrowseDefinition } from './shared/browse-definition.model';
|
||||
import { BrowseEntry } from './shared/browse-entry.model';
|
||||
import { Bundle } from './shared/bundle.model';
|
||||
import { Collection } from './shared/collection.model';
|
||||
import { Community } from './shared/community.model';
|
||||
import { DSpaceObject } from './shared/dspace-object.model';
|
||||
import { ExternalSourceEntry } from './shared/external-source-entry.model';
|
||||
import { ExternalSource } from './shared/external-source.model';
|
||||
import { HALEndpointService } from './shared/hal-endpoint.service';
|
||||
import { ItemType } from './shared/item-relationships/item-type.model';
|
||||
import { RelationshipType } from './shared/item-relationships/relationship-type.model';
|
||||
import { Relationship } from './shared/item-relationships/relationship.model';
|
||||
import { Item } from './shared/item.model';
|
||||
import { License } from './shared/license.model';
|
||||
import { ResourcePolicy } from './resource-policy/models/resource-policy.model';
|
||||
import { SearchConfigurationService } from './shared/search/search-configuration.service';
|
||||
import { SearchFilterService } from './shared/search/search-filter.service';
|
||||
import { SearchService } from './shared/search/search.service';
|
||||
import { Site } from './shared/site.model';
|
||||
import { UUIDService } from './shared/uuid.service';
|
||||
import { WorkflowItem } from './submission/models/workflowitem.model';
|
||||
import { WorkspaceItem } from './submission/models/workspaceitem.model';
|
||||
import { SubmissionJsonPatchOperationsService } from './submission/submission-json-patch-operations.service';
|
||||
import { SubmissionResponseParsingService } from './submission/submission-response-parsing.service';
|
||||
import { SubmissionRestService } from './submission/submission-rest.service';
|
||||
import { WorkflowItemDataService } from './submission/workflowitem-data.service';
|
||||
import { WorkspaceitemDataService } from './submission/workspaceitem-data.service';
|
||||
import { ClaimedTaskDataService } from './tasks/claimed-task-data.service';
|
||||
import { ClaimedTask } from './tasks/models/claimed-task-object.model';
|
||||
import { PoolTask } from './tasks/models/pool-task-object.model';
|
||||
import { TaskObject } from './tasks/models/task-object.model';
|
||||
import { PoolTaskDataService } from './tasks/pool-task-data.service';
|
||||
import { TaskResponseParsingService } from './tasks/task-response-parsing.service';
|
||||
import { ArrayMoveChangeAnalyzer } from './data/array-move-change-analyzer.service';
|
||||
import { BitstreamDataService } from './data/bitstream-data.service';
|
||||
import { environment } from '../../environments/environment';
|
||||
import { storeModuleConfig } from '../app.reducer';
|
||||
import { VersionDataService } from './data/version-data.service';
|
||||
import { VersionHistoryDataService } from './data/version-history-data.service';
|
||||
import { Version } from './shared/version.model';
|
||||
import { VersionHistory } from './shared/version-history.model';
|
||||
import { Script } from '../process-page/scripts/script.model';
|
||||
import { Process } from '../process-page/processes/process.model';
|
||||
import { ProcessDataService } from './data/processes/process-data.service';
|
||||
import { ScriptDataService } from './data/processes/script-data.service';
|
||||
import { WorkflowActionDataService } from './data/workflow-action-data.service';
|
||||
import { WorkflowAction } from './tasks/models/workflow-action-object.model';
|
||||
import { ItemTemplateDataService } from './data/item-template-data.service';
|
||||
import { TemplateItem } from './shared/template-item.model';
|
||||
import { Feature } from './shared/feature.model';
|
||||
import { Authorization } from './shared/authorization.model';
|
||||
import { FeatureDataService } from './data/feature-authorization/feature-data.service';
|
||||
import { AuthorizationDataService } from './data/feature-authorization/authorization-data.service';
|
||||
import {
|
||||
SiteAdministratorGuard
|
||||
} from './data/feature-authorization/feature-authorization-guard/site-administrator.guard';
|
||||
import { Registration } from './shared/registration.model';
|
||||
import { MetadataSchemaDataService } from './data/metadata-schema-data.service';
|
||||
import { MetadataFieldDataService } from './data/metadata-field-data.service';
|
||||
import { TokenResponseParsingService } from './auth/token-response-parsing.service';
|
||||
import { SubmissionCcLicenseDataService } from './submission/submission-cc-license-data.service';
|
||||
import { SubmissionCcLicence } from './submission/models/submission-cc-license.model';
|
||||
import { SubmissionCcLicenceUrl } from './submission/models/submission-cc-license-url.model';
|
||||
import { SubmissionCcLicenseUrlDataService } from './submission/submission-cc-license-url-data.service';
|
||||
import { VocabularyEntry } from './submission/vocabularies/models/vocabulary-entry.model';
|
||||
import { Vocabulary } from './submission/vocabularies/models/vocabulary.model';
|
||||
import { VocabularyEntryDetail } from './submission/vocabularies/models/vocabulary-entry-detail.model';
|
||||
import { VocabularyService } from './submission/vocabularies/vocabulary.service';
|
||||
import { ConfigurationDataService } from './data/configuration-data.service';
|
||||
import { ConfigurationProperty } from './shared/configuration-property.model';
|
||||
import { ReloadGuard } from './reload/reload.guard';
|
||||
import { EndUserAgreementCurrentUserGuard } from './end-user-agreement/end-user-agreement-current-user.guard';
|
||||
import { EndUserAgreementCookieGuard } from './end-user-agreement/end-user-agreement-cookie.guard';
|
||||
import { EndUserAgreementService } from './end-user-agreement/end-user-agreement.service';
|
||||
import { SiteRegisterGuard } from './data/feature-authorization/feature-authorization-guard/site-register.guard';
|
||||
import { ShortLivedToken } from './auth/models/short-lived-token.model';
|
||||
import { UsageReport } from './statistics/models/usage-report.model';
|
||||
import { RootDataService } from './data/root-data.service';
|
||||
import { Root } from './data/root.model';
|
||||
import { SearchConfig } from './shared/search/search-filters/search-config.model';
|
||||
import { SequenceService } from './shared/sequence.service';
|
||||
import { CoreState } from './core-state.model';
|
||||
import { GroupDataService } from './eperson/group-data.service';
|
||||
import { SubmissionAccessesModel } from './config/models/config-submission-accesses.model';
|
||||
import { QualityAssuranceTopicObject } from './notifications/qa/models/quality-assurance-topic.model';
|
||||
import { QualityAssuranceEventObject } from './notifications/qa/models/quality-assurance-event.model';
|
||||
import { QualityAssuranceSourceObject } from './notifications/qa/models/quality-assurance-source.model';
|
||||
import { RatingAdvancedWorkflowInfo } from './tasks/models/rating-advanced-workflow-info.model';
|
||||
import { AdvancedWorkflowInfo } from './tasks/models/advanced-workflow-info.model';
|
||||
import { SelectReviewerAdvancedWorkflowInfo } from './tasks/models/select-reviewer-advanced-workflow-info.model';
|
||||
import { AccessStatusObject } from '../shared/object-collection/shared/badges/access-status-badge/access-status.model';
|
||||
import { AccessStatusDataService } from './data/access-status-data.service';
|
||||
import { LinkHeadService } from './services/link-head.service';
|
||||
import { ResearcherProfileDataService } from './profile/researcher-profile-data.service';
|
||||
import { ProfileClaimService } from '../profile-page/profile-claim/profile-claim.service';
|
||||
import { ResearcherProfile } from './profile/model/researcher-profile.model';
|
||||
import { OrcidQueueDataService } from './orcid/orcid-queue-data.service';
|
||||
import { OrcidHistoryDataService } from './orcid/orcid-history-data.service';
|
||||
import { OrcidQueue } from './orcid/model/orcid-queue.model';
|
||||
import { OrcidHistory } from './orcid/model/orcid-history.model';
|
||||
import { OrcidAuthService } from './orcid/orcid-auth.service';
|
||||
import { VocabularyDataService } from './submission/vocabularies/vocabulary.data.service';
|
||||
import { VocabularyEntryDetailsDataService } from './submission/vocabularies/vocabulary-entry-details.data.service';
|
||||
import { IdentifierData } from '../shared/object-list/identifier-data/identifier-data.model';
|
||||
import { Subscription } from '../shared/subscriptions/models/subscription.model';
|
||||
import { SupervisionOrderDataService } from './supervision-order/supervision-order-data.service';
|
||||
import { ItemRequest } from './shared/item-request.model';
|
||||
import { HierarchicalBrowseDefinition } from './shared/hierarchical-browse-definition.model';
|
||||
import { FlatBrowseDefinition } from './shared/flat-browse-definition.model';
|
||||
import { ValueListBrowseDefinition } from './shared/value-list-browse-definition.model';
|
||||
import { NonHierarchicalBrowseDefinition } from './shared/non-hierarchical-browse-definition';
|
||||
import { BulkAccessConditionOptions } from './config/models/bulk-access-condition-options.model';
|
||||
|
||||
/**
|
||||
* When not in production, endpoint responses can be mocked for testing purposes
|
||||
* If there is no mock version available for the endpoint, the actual REST response will be used just like in production mode
|
||||
*/
|
||||
export const restServiceFactory = (mocks: ResponseMapMock, http: HttpClient) => {
|
||||
if (environment.production) {
|
||||
return new DspaceRestService(http);
|
||||
} else {
|
||||
return new EndpointMockingRestService(mocks, http);
|
||||
}
|
||||
};
|
||||
|
||||
const IMPORTS = [
|
||||
CommonModule,
|
||||
StoreModule.forFeature('core', coreReducers, storeModuleConfig as StoreConfig<CoreState, Action>),
|
||||
EffectsModule.forFeature(coreEffects)
|
||||
];
|
||||
|
||||
const DECLARATIONS = [];
|
||||
|
||||
const EXPORTS = [];
|
||||
|
||||
const PROVIDERS = [
|
||||
AuthenticatedGuard,
|
||||
CommunityDataService,
|
||||
CollectionDataService,
|
||||
SiteDataService,
|
||||
DSOResponseParsingService,
|
||||
{ provide: MOCK_RESPONSE_MAP, useValue: mockResponseMap },
|
||||
{ provide: DspaceRestService, useFactory: restServiceFactory, deps: [MOCK_RESPONSE_MAP, HttpClient] },
|
||||
EPersonDataService,
|
||||
LinkHeadService,
|
||||
HALEndpointService,
|
||||
HostWindowService,
|
||||
ItemDataService,
|
||||
MetadataService,
|
||||
ObjectCacheService,
|
||||
PaginationComponentOptions,
|
||||
ResourcePolicyDataService,
|
||||
RegistryService,
|
||||
BitstreamFormatDataService,
|
||||
RemoteDataBuildService,
|
||||
EndpointMapResponseParsingService,
|
||||
FacetValueResponseParsingService,
|
||||
FacetConfigResponseParsingService,
|
||||
DebugResponseParsingService,
|
||||
SearchResponseParsingService,
|
||||
MyDSpaceResponseParsingService,
|
||||
ServerResponseService,
|
||||
BrowseService,
|
||||
AccessStatusDataService,
|
||||
SubmissionCcLicenseDataService,
|
||||
SubmissionCcLicenseUrlDataService,
|
||||
SubmissionFormsConfigDataService,
|
||||
SubmissionRestService,
|
||||
SubmissionResponseParsingService,
|
||||
SubmissionJsonPatchOperationsService,
|
||||
JsonPatchOperationsBuilder,
|
||||
UUIDService,
|
||||
NotificationsService,
|
||||
WorkspaceitemDataService,
|
||||
WorkflowItemDataService,
|
||||
DSpaceObjectDataService,
|
||||
ConfigurationDataService,
|
||||
DSOChangeAnalyzer,
|
||||
DefaultChangeAnalyzer,
|
||||
ArrayMoveChangeAnalyzer,
|
||||
ObjectSelectService,
|
||||
MenuService,
|
||||
ObjectUpdatesService,
|
||||
SearchService,
|
||||
RelationshipDataService,
|
||||
MyDSpaceGuard,
|
||||
RoleService,
|
||||
TaskResponseParsingService,
|
||||
ClaimedTaskDataService,
|
||||
PoolTaskDataService,
|
||||
BitstreamDataService,
|
||||
EntityTypeDataService,
|
||||
ContentSourceResponseParsingService,
|
||||
ItemTemplateDataService,
|
||||
SearchService,
|
||||
SidebarService,
|
||||
SearchFilterService,
|
||||
SearchFilterService,
|
||||
SearchConfigurationService,
|
||||
SelectableListService,
|
||||
RelationshipTypeDataService,
|
||||
ExternalSourceDataService,
|
||||
LookupRelationService,
|
||||
VersionDataService,
|
||||
VersionHistoryDataService,
|
||||
WorkflowActionDataService,
|
||||
ProcessDataService,
|
||||
ScriptDataService,
|
||||
FeatureDataService,
|
||||
AuthorizationDataService,
|
||||
SiteAdministratorGuard,
|
||||
SiteRegisterGuard,
|
||||
MetadataSchemaDataService,
|
||||
MetadataFieldDataService,
|
||||
TokenResponseParsingService,
|
||||
ReloadGuard,
|
||||
EndUserAgreementCurrentUserGuard,
|
||||
EndUserAgreementCookieGuard,
|
||||
EndUserAgreementService,
|
||||
RootDataService,
|
||||
NotificationsService,
|
||||
FilteredDiscoveryPageResponseParsingService,
|
||||
{ provide: NativeWindowService, useFactory: NativeWindowFactory },
|
||||
VocabularyService,
|
||||
VocabularyDataService,
|
||||
VocabularyEntryDetailsDataService,
|
||||
SequenceService,
|
||||
GroupDataService,
|
||||
FeedbackDataService,
|
||||
ResearcherProfileDataService,
|
||||
ProfileClaimService,
|
||||
OrcidAuthService,
|
||||
OrcidQueueDataService,
|
||||
OrcidHistoryDataService,
|
||||
SupervisionOrderDataService
|
||||
];
|
||||
|
||||
/**
|
||||
* Declaration needed to make sure all decorator functions are called in time
|
||||
*/
|
||||
export const models =
|
||||
[
|
||||
Root,
|
||||
DSpaceObject,
|
||||
Bundle,
|
||||
Bitstream,
|
||||
BitstreamFormat,
|
||||
Item,
|
||||
Site,
|
||||
Collection,
|
||||
Community,
|
||||
EPerson,
|
||||
Group,
|
||||
ResourcePolicy,
|
||||
MetadataSchema,
|
||||
MetadataField,
|
||||
License,
|
||||
WorkflowItem,
|
||||
WorkspaceItem,
|
||||
SubmissionCcLicence,
|
||||
SubmissionCcLicenceUrl,
|
||||
SubmissionDefinitionsModel,
|
||||
SubmissionFormsModel,
|
||||
SubmissionSectionModel,
|
||||
SubmissionUploadsModel,
|
||||
AuthStatus,
|
||||
BrowseEntry,
|
||||
BrowseDefinition,
|
||||
NonHierarchicalBrowseDefinition,
|
||||
FlatBrowseDefinition,
|
||||
ValueListBrowseDefinition,
|
||||
HierarchicalBrowseDefinition,
|
||||
ClaimedTask,
|
||||
TaskObject,
|
||||
PoolTask,
|
||||
Relationship,
|
||||
RelationshipType,
|
||||
ItemType,
|
||||
ExternalSource,
|
||||
ExternalSourceEntry,
|
||||
Script,
|
||||
Process,
|
||||
Version,
|
||||
VersionHistory,
|
||||
WorkflowAction,
|
||||
AdvancedWorkflowInfo,
|
||||
RatingAdvancedWorkflowInfo,
|
||||
SelectReviewerAdvancedWorkflowInfo,
|
||||
TemplateItem,
|
||||
Feature,
|
||||
Authorization,
|
||||
Registration,
|
||||
Vocabulary,
|
||||
VocabularyEntry,
|
||||
VocabularyEntryDetail,
|
||||
ConfigurationProperty,
|
||||
ShortLivedToken,
|
||||
Registration,
|
||||
UsageReport,
|
||||
QualityAssuranceTopicObject,
|
||||
QualityAssuranceEventObject,
|
||||
Root,
|
||||
SearchConfig,
|
||||
SubmissionAccessesModel,
|
||||
QualityAssuranceSourceObject,
|
||||
AccessStatusObject,
|
||||
ResearcherProfile,
|
||||
OrcidQueue,
|
||||
OrcidHistory,
|
||||
AccessStatusObject,
|
||||
IdentifierData,
|
||||
Subscription,
|
||||
ItemRequest,
|
||||
BulkAccessConditionOptions
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
...IMPORTS
|
||||
],
|
||||
declarations: [
|
||||
...DECLARATIONS
|
||||
],
|
||||
exports: [
|
||||
...EXPORTS
|
||||
],
|
||||
providers: [
|
||||
...PROVIDERS
|
||||
]
|
||||
})
|
||||
|
||||
export class CoreModule {
|
||||
static forRoot(): ModuleWithProviders<CoreModule> {
|
||||
return {
|
||||
ngModule: CoreModule,
|
||||
providers: [
|
||||
...PROVIDERS
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
constructor(@Optional() @SkipSelf() parentModule: CoreModule) {
|
||||
if (isNotEmpty(parentModule)) {
|
||||
throw new Error('CoreModule is already loaded. Import it in the AppModule only');
|
||||
}
|
||||
}
|
||||
}
|
@@ -34,4 +34,5 @@ export enum FeatureID {
|
||||
CanEditItem = 'canEditItem',
|
||||
CanRegisterDOI = 'canRegisterDOI',
|
||||
CanSubscribe = 'canSubscribeDso',
|
||||
CanSeeQA = 'canSeeQA'
|
||||
}
|
||||
|
@@ -0,0 +1,247 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
|
||||
import { TestScheduler } from 'rxjs/testing';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { cold, getTestScheduler } from 'jasmine-marbles';
|
||||
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { buildPaginatedList } from '../../../data/paginated-list.model';
|
||||
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../cache/object-cache.service';
|
||||
import { RestResponse } from '../../../cache/response.models';
|
||||
import { PageInfo } from '../../../shared/page-info.model';
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
|
||||
import { QualityAssuranceEventDataService } from './quality-assurance-event-data.service';
|
||||
import {
|
||||
qualityAssuranceEventObjectMissingPid,
|
||||
qualityAssuranceEventObjectMissingPid2,
|
||||
qualityAssuranceEventObjectMissingProjectFound
|
||||
} from '../../../../shared/mocks/notifications.mock';
|
||||
import { ReplaceOperation } from 'fast-json-patch';
|
||||
import { RequestEntry } from '../../../data/request-entry.model';
|
||||
import { FindListOptions } from '../../../data/find-list-options.model';
|
||||
|
||||
describe('QualityAssuranceEventDataService', () => {
|
||||
let scheduler: TestScheduler;
|
||||
let service: QualityAssuranceEventDataService;
|
||||
let serviceASAny: any;
|
||||
let responseCacheEntry: RequestEntry;
|
||||
let responseCacheEntryB: RequestEntry;
|
||||
let responseCacheEntryC: RequestEntry;
|
||||
let requestService: RequestService;
|
||||
let rdbService: RemoteDataBuildService;
|
||||
let objectCache: ObjectCacheService;
|
||||
let halService: HALEndpointService;
|
||||
let notificationsService: NotificationsService;
|
||||
let http: HttpClient;
|
||||
let comparator: any;
|
||||
|
||||
const endpointURL = 'https://rest.api/rest/api/integration/qualityassurancetopics';
|
||||
const requestUUID = '8b3c913a-5a4b-438b-9181-be1a5b4a1c8a';
|
||||
const topic = 'ENRICH!MORE!PID';
|
||||
|
||||
const pageInfo = new PageInfo();
|
||||
const array = [qualityAssuranceEventObjectMissingPid, qualityAssuranceEventObjectMissingPid2];
|
||||
const paginatedList = buildPaginatedList(pageInfo, array);
|
||||
const qaEventObjectRD = createSuccessfulRemoteDataObject(qualityAssuranceEventObjectMissingPid);
|
||||
const qaEventObjectMissingProjectRD = createSuccessfulRemoteDataObject(qualityAssuranceEventObjectMissingProjectFound);
|
||||
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
|
||||
|
||||
const status = 'ACCEPTED';
|
||||
const operation: ReplaceOperation<string>[] = [
|
||||
{
|
||||
path: '/status',
|
||||
op: 'replace',
|
||||
value: status
|
||||
}
|
||||
];
|
||||
|
||||
beforeEach(() => {
|
||||
scheduler = getTestScheduler();
|
||||
|
||||
responseCacheEntry = new RequestEntry();
|
||||
responseCacheEntry.request = { href: 'https://rest.api/' } as any;
|
||||
responseCacheEntry.response = new RestResponse(true, 200, 'Success');
|
||||
requestService = jasmine.createSpyObj('requestService', {
|
||||
generateRequestId: requestUUID,
|
||||
send: true,
|
||||
removeByHrefSubstring: {},
|
||||
getByHref: jasmine.createSpy('getByHref'),
|
||||
getByUUID: jasmine.createSpy('getByUUID')
|
||||
});
|
||||
|
||||
responseCacheEntryB = new RequestEntry();
|
||||
responseCacheEntryB.request = { href: 'https://rest.api/' } as any;
|
||||
responseCacheEntryB.response = new RestResponse(true, 201, 'Created');
|
||||
|
||||
responseCacheEntryC = new RequestEntry();
|
||||
responseCacheEntryC.request = { href: 'https://rest.api/' } as any;
|
||||
responseCacheEntryC.response = new RestResponse(true, 204, 'No Content');
|
||||
|
||||
rdbService = jasmine.createSpyObj('rdbService', {
|
||||
buildSingle: cold('(a)', {
|
||||
a: qaEventObjectRD
|
||||
}),
|
||||
buildList: cold('(a)', {
|
||||
a: paginatedListRD
|
||||
}),
|
||||
buildFromRequestUUID: jasmine.createSpy('buildFromRequestUUID'),
|
||||
buildFromRequestUUIDAndAwait: jasmine.createSpy('buildFromRequestUUIDAndAwait')
|
||||
});
|
||||
|
||||
objectCache = {} as ObjectCacheService;
|
||||
halService = jasmine.createSpyObj('halService', {
|
||||
getEndpoint: cold('a|', { a: endpointURL })
|
||||
});
|
||||
|
||||
notificationsService = {} as NotificationsService;
|
||||
http = {} as HttpClient;
|
||||
comparator = {} as any;
|
||||
|
||||
service = new QualityAssuranceEventDataService(
|
||||
requestService,
|
||||
rdbService,
|
||||
objectCache,
|
||||
halService,
|
||||
notificationsService,
|
||||
comparator
|
||||
);
|
||||
|
||||
serviceASAny = service;
|
||||
|
||||
spyOn(serviceASAny.searchData, 'searchBy').and.callThrough();
|
||||
spyOn(serviceASAny, 'findById').and.callThrough();
|
||||
spyOn(serviceASAny.patchData, 'patch').and.callThrough();
|
||||
spyOn(serviceASAny, 'postOnRelated').and.callThrough();
|
||||
spyOn(serviceASAny, 'deleteOnRelated').and.callThrough();
|
||||
});
|
||||
|
||||
describe('getEventsByTopic', () => {
|
||||
beforeEach(() => {
|
||||
serviceASAny.requestService.getByHref.and.returnValue(observableOf(responseCacheEntry));
|
||||
serviceASAny.requestService.getByUUID.and.returnValue(observableOf(responseCacheEntry));
|
||||
serviceASAny.rdbService.buildFromRequestUUID.and.returnValue(observableOf(qaEventObjectRD));
|
||||
});
|
||||
|
||||
it('should proxy the call to searchData.searchBy', () => {
|
||||
const options: FindListOptions = {
|
||||
searchParams: [
|
||||
{
|
||||
fieldName: 'topic',
|
||||
fieldValue: topic
|
||||
}
|
||||
]
|
||||
};
|
||||
service.getEventsByTopic(topic);
|
||||
expect(serviceASAny.searchData.searchBy).toHaveBeenCalledWith('findByTopic', options, true, true);
|
||||
});
|
||||
|
||||
it('should return a RemoteData<PaginatedList<QualityAssuranceEventObject>> for the object with the given Topic', () => {
|
||||
const result = service.getEventsByTopic(topic);
|
||||
const expected = cold('(a)', {
|
||||
a: paginatedListRD
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getEvent', () => {
|
||||
beforeEach(() => {
|
||||
serviceASAny.requestService.getByHref.and.returnValue(observableOf(responseCacheEntry));
|
||||
serviceASAny.requestService.getByUUID.and.returnValue(observableOf(responseCacheEntry));
|
||||
serviceASAny.rdbService.buildFromRequestUUID.and.returnValue(observableOf(qaEventObjectRD));
|
||||
});
|
||||
|
||||
it('should call findById', () => {
|
||||
service.getEvent(qualityAssuranceEventObjectMissingPid.id).subscribe(
|
||||
(res) => {
|
||||
expect(serviceASAny.findById).toHaveBeenCalledWith(qualityAssuranceEventObjectMissingPid.id, true, true);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should return a RemoteData for the object with the given URL', () => {
|
||||
const result = service.getEvent(qualityAssuranceEventObjectMissingPid.id);
|
||||
const expected = cold('(a)', {
|
||||
a: qaEventObjectRD
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('patchEvent', () => {
|
||||
beforeEach(() => {
|
||||
serviceASAny.requestService.getByHref.and.returnValue(observableOf(responseCacheEntry));
|
||||
serviceASAny.requestService.getByUUID.and.returnValue(observableOf(responseCacheEntry));
|
||||
serviceASAny.rdbService.buildFromRequestUUID.and.returnValue(observableOf(qaEventObjectRD));
|
||||
serviceASAny.rdbService.buildFromRequestUUIDAndAwait.and.returnValue(observableOf(qaEventObjectRD));
|
||||
});
|
||||
|
||||
it('should proxy the call to patchData.patch', () => {
|
||||
service.patchEvent(status, qualityAssuranceEventObjectMissingPid).subscribe(
|
||||
(res) => {
|
||||
expect(serviceASAny.patchData.patch).toHaveBeenCalledWith(qualityAssuranceEventObjectMissingPid, operation);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should return a RemoteData with HTTP 200', () => {
|
||||
const result = service.patchEvent(status, qualityAssuranceEventObjectMissingPid);
|
||||
const expected = cold('(a|)', {
|
||||
a: createSuccessfulRemoteDataObject(qualityAssuranceEventObjectMissingPid)
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('boundProject', () => {
|
||||
beforeEach(() => {
|
||||
serviceASAny.requestService.getByHref.and.returnValue(observableOf(responseCacheEntryB));
|
||||
serviceASAny.requestService.getByUUID.and.returnValue(observableOf(responseCacheEntryB));
|
||||
serviceASAny.rdbService.buildFromRequestUUID.and.returnValue(observableOf(qaEventObjectMissingProjectRD));
|
||||
});
|
||||
|
||||
it('should call postOnRelated', () => {
|
||||
service.boundProject(qualityAssuranceEventObjectMissingProjectFound.id, requestUUID).subscribe(
|
||||
(res) => {
|
||||
expect(serviceASAny.postOnRelated).toHaveBeenCalledWith(qualityAssuranceEventObjectMissingProjectFound.id, requestUUID);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should return a RestResponse with HTTP 201', () => {
|
||||
const result = service.boundProject(qualityAssuranceEventObjectMissingProjectFound.id, requestUUID);
|
||||
const expected = cold('(a|)', {
|
||||
a: createSuccessfulRemoteDataObject(qualityAssuranceEventObjectMissingProjectFound)
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('removeProject', () => {
|
||||
beforeEach(() => {
|
||||
serviceASAny.requestService.getByHref.and.returnValue(observableOf(responseCacheEntryC));
|
||||
serviceASAny.requestService.getByUUID.and.returnValue(observableOf(responseCacheEntryC));
|
||||
serviceASAny.rdbService.buildFromRequestUUID.and.returnValue(observableOf(createSuccessfulRemoteDataObject({})));
|
||||
});
|
||||
|
||||
it('should call deleteOnRelated', () => {
|
||||
service.removeProject(qualityAssuranceEventObjectMissingProjectFound.id).subscribe(
|
||||
(res) => {
|
||||
expect(serviceASAny.deleteOnRelated).toHaveBeenCalledWith(qualityAssuranceEventObjectMissingProjectFound.id);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should return a RestResponse with HTTP 204', () => {
|
||||
const result = service.removeProject(qualityAssuranceEventObjectMissingProjectFound.id);
|
||||
const expected = cold('(a|)', {
|
||||
a: createSuccessfulRemoteDataObject({})
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
@@ -0,0 +1,203 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { find, take } from 'rxjs/operators';
|
||||
import { ReplaceOperation } from 'fast-json-patch';
|
||||
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../cache/object-cache.service';
|
||||
import { dataService } from '../../../data/base/data-service.decorator';
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { RemoteData } from '../../../data/remote-data';
|
||||
import { QualityAssuranceEventObject } from '../models/quality-assurance-event.model';
|
||||
import { QUALITY_ASSURANCE_EVENT_OBJECT } from '../models/quality-assurance-event-object.resource-type';
|
||||
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model';
|
||||
import { PaginatedList } from '../../../data/paginated-list.model';
|
||||
import { NoContent } from '../../../shared/NoContent.model';
|
||||
import { FindListOptions } from '../../../data/find-list-options.model';
|
||||
import { IdentifiableDataService } from '../../../data/base/identifiable-data.service';
|
||||
import { CreateData, CreateDataImpl } from '../../../data/base/create-data';
|
||||
import { PatchData, PatchDataImpl } from '../../../data/base/patch-data';
|
||||
import { DeleteData, DeleteDataImpl } from '../../../data/base/delete-data';
|
||||
import { SearchData, SearchDataImpl } from '../../../data/base/search-data';
|
||||
import { DefaultChangeAnalyzer } from '../../../data/default-change-analyzer.service';
|
||||
import { hasValue } from '../../../../shared/empty.util';
|
||||
import { DeleteByIDRequest, PostRequest } from '../../../data/request.models';
|
||||
|
||||
/**
|
||||
* The service handling all Quality Assurance topic REST requests.
|
||||
*/
|
||||
@Injectable()
|
||||
@dataService(QUALITY_ASSURANCE_EVENT_OBJECT)
|
||||
export class QualityAssuranceEventDataService extends IdentifiableDataService<QualityAssuranceEventObject> {
|
||||
|
||||
private createData: CreateData<QualityAssuranceEventObject>;
|
||||
private searchData: SearchData<QualityAssuranceEventObject>;
|
||||
private patchData: PatchData<QualityAssuranceEventObject>;
|
||||
private deleteData: DeleteData<QualityAssuranceEventObject>;
|
||||
|
||||
/**
|
||||
* Initialize service variables
|
||||
* @param {RequestService} requestService
|
||||
* @param {RemoteDataBuildService} rdbService
|
||||
* @param {ObjectCacheService} objectCache
|
||||
* @param {HALEndpointService} halService
|
||||
* @param {NotificationsService} notificationsService
|
||||
* @param {DefaultChangeAnalyzer<QualityAssuranceEventObject>} comparator
|
||||
*/
|
||||
constructor(
|
||||
protected requestService: RequestService,
|
||||
protected rdbService: RemoteDataBuildService,
|
||||
protected objectCache: ObjectCacheService,
|
||||
protected halService: HALEndpointService,
|
||||
protected notificationsService: NotificationsService,
|
||||
protected comparator: DefaultChangeAnalyzer<QualityAssuranceEventObject>
|
||||
) {
|
||||
super('qualityassuranceevents', requestService, rdbService, objectCache, halService);
|
||||
this.createData = new CreateDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive);
|
||||
this.deleteData = new DeleteDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive, this.constructIdEndpoint);
|
||||
this.patchData = new PatchDataImpl<QualityAssuranceEventObject>(this.linkPath, requestService, rdbService, objectCache, halService, comparator, this.responseMsToLive, this.constructIdEndpoint);
|
||||
this.searchData = new SearchDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of Quality Assurance events by topic.
|
||||
*
|
||||
* @param topic
|
||||
* The Quality Assurance topic
|
||||
* @param options
|
||||
* Find list options object.
|
||||
* @param linksToFollow
|
||||
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
||||
* @return Observable<RemoteData<PaginatedList<QualityAssuranceEventObject>>>
|
||||
* The list of Quality Assurance events.
|
||||
*/
|
||||
public getEventsByTopic(topic: string, options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<QualityAssuranceEventObject>[]): Observable<RemoteData<PaginatedList<QualityAssuranceEventObject>>> {
|
||||
options.searchParams = [
|
||||
{
|
||||
fieldName: 'topic',
|
||||
fieldValue: topic
|
||||
}
|
||||
];
|
||||
return this.searchData.searchBy('findByTopic', options, true, true, ...linksToFollow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear findByTopic requests from cache
|
||||
*/
|
||||
public clearFindByTopicRequests() {
|
||||
this.requestService.setStaleByHrefSubstring('findByTopic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a single Quality Assurance event.
|
||||
*
|
||||
* @param id
|
||||
* The Quality Assurance event id
|
||||
* @param linksToFollow
|
||||
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
|
||||
* @return Observable<RemoteData<QualityAssuranceEventObject>>
|
||||
* The Quality Assurance event.
|
||||
*/
|
||||
public getEvent(id: string, ...linksToFollow: FollowLinkConfig<QualityAssuranceEventObject>[]): Observable<RemoteData<QualityAssuranceEventObject>> {
|
||||
return this.findById(id, true, true, ...linksToFollow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the new status of a Quality Assurance event.
|
||||
*
|
||||
* @param status
|
||||
* The new status
|
||||
* @param dso QualityAssuranceEventObject
|
||||
* The event item
|
||||
* @param reason
|
||||
* The optional reason (not used for now; for future implementation)
|
||||
* @return Observable<RestResponse>
|
||||
* The REST response.
|
||||
*/
|
||||
public patchEvent(status, dso, reason?: string): Observable<RemoteData<QualityAssuranceEventObject>> {
|
||||
const operation: ReplaceOperation<string>[] = [
|
||||
{
|
||||
path: '/status',
|
||||
op: 'replace',
|
||||
value: status
|
||||
}
|
||||
];
|
||||
return this.patchData.patch(dso, operation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bound a project to a Quality Assurance event publication.
|
||||
*
|
||||
* @param itemId
|
||||
* The Id of the Quality Assurance event
|
||||
* @param projectId
|
||||
* The project Id to bound
|
||||
* @return Observable<RestResponse>
|
||||
* The REST response.
|
||||
*/
|
||||
public boundProject(itemId: string, projectId: string): Observable<RemoteData<QualityAssuranceEventObject>> {
|
||||
return this.postOnRelated(itemId, projectId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a project from a Quality Assurance event publication.
|
||||
*
|
||||
* @param itemId
|
||||
* The Id of the Quality Assurance event
|
||||
* @return Observable<RestResponse>
|
||||
* The REST response.
|
||||
*/
|
||||
public removeProject(itemId: string): Observable<RemoteData<NoContent>> {
|
||||
return this.deleteOnRelated(itemId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a delete operation on an endpoint related item. Ex.: endpoint/<itemId>/related
|
||||
* @param objectId The item id
|
||||
* @return the RestResponse as an Observable
|
||||
*/
|
||||
private deleteOnRelated(objectId: string): Observable<RemoteData<NoContent>> {
|
||||
const requestId = this.requestService.generateRequestId();
|
||||
|
||||
const hrefObs = this.getIDHrefObs(objectId);
|
||||
|
||||
hrefObs.pipe(
|
||||
find((href: string) => hasValue(href)),
|
||||
).subscribe((href: string) => {
|
||||
const request = new DeleteByIDRequest(requestId, href + '/related', objectId);
|
||||
if (hasValue(this.responseMsToLive)) {
|
||||
request.responseMsToLive = this.responseMsToLive;
|
||||
}
|
||||
this.requestService.send(request);
|
||||
});
|
||||
|
||||
return this.rdbService.buildFromRequestUUID<QualityAssuranceEventObject>(requestId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a post on an endpoint related item with ID. Ex.: endpoint/<itemId>/related?item=<relatedItemId>
|
||||
* @param objectId The item id
|
||||
* @param relatedItemId The related item Id
|
||||
* @param body The optional POST body
|
||||
* @return the RestResponse as an Observable
|
||||
*/
|
||||
private postOnRelated(objectId: string, relatedItemId: string, body?: any) {
|
||||
const requestId = this.requestService.generateRequestId();
|
||||
const hrefObs = this.getIDHrefObs(objectId);
|
||||
|
||||
hrefObs.pipe(
|
||||
take(1)
|
||||
).subscribe((href: string) => {
|
||||
const request = new PostRequest(requestId, href + '/related?item=' + relatedItemId, body);
|
||||
if (hasValue(this.responseMsToLive)) {
|
||||
request.responseMsToLive = this.responseMsToLive;
|
||||
}
|
||||
this.requestService.send(request);
|
||||
});
|
||||
|
||||
return this.rdbService.buildFromRequestUUID<QualityAssuranceEventObject>(requestId);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from '../../../shared/resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for the Quality Assurance event
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const QUALITY_ASSURANCE_EVENT_OBJECT = new ResourceType('qualityassuranceevent');
|
@@ -0,0 +1,171 @@
|
||||
/* eslint-disable max-classes-per-file */
|
||||
import { Observable } from 'rxjs';
|
||||
import { autoserialize, autoserializeAs, deserialize } from 'cerialize';
|
||||
import { QUALITY_ASSURANCE_EVENT_OBJECT } from './quality-assurance-event-object.resource-type';
|
||||
import { excludeFromEquals } from '../../../utilities/equals.decorators';
|
||||
import { ResourceType } from '../../../shared/resource-type';
|
||||
import { HALLink } from '../../../shared/hal-link.model';
|
||||
import { Item } from '../../../shared/item.model';
|
||||
import { ITEM } from '../../../shared/item.resource-type';
|
||||
import { link, typedObject } from '../../../cache/builders/build-decorators';
|
||||
import { RemoteData } from '../../../data/remote-data';
|
||||
import {CacheableObject} from '../../../cache/cacheable-object.model';
|
||||
|
||||
/**
|
||||
* The interface representing the Quality Assurance event message
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface QualityAssuranceEventMessageObject {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface representing the Quality Assurance event message
|
||||
*/
|
||||
export interface SourceQualityAssuranceEventMessageObject {
|
||||
/**
|
||||
* The type of 'value'
|
||||
*/
|
||||
type: string;
|
||||
|
||||
/**
|
||||
* The value suggested by Notifications
|
||||
*/
|
||||
value: string;
|
||||
|
||||
/**
|
||||
* The abstract suggested by Notifications
|
||||
*/
|
||||
abstract: string;
|
||||
|
||||
/**
|
||||
* The project acronym suggested by Notifications
|
||||
*/
|
||||
acronym: string;
|
||||
|
||||
/**
|
||||
* The project code suggested by Notifications
|
||||
*/
|
||||
code: string;
|
||||
|
||||
/**
|
||||
* The project funder suggested by Notifications
|
||||
*/
|
||||
funder: string;
|
||||
|
||||
/**
|
||||
* The project program suggested by Notifications
|
||||
*/
|
||||
fundingProgram?: string;
|
||||
|
||||
/**
|
||||
* The project jurisdiction suggested by Notifications
|
||||
*/
|
||||
jurisdiction: string;
|
||||
|
||||
/**
|
||||
* The project title suggested by Notifications
|
||||
*/
|
||||
title: string;
|
||||
|
||||
/**
|
||||
* The Source ID.
|
||||
*/
|
||||
sourceId: string;
|
||||
|
||||
/**
|
||||
* The PID href.
|
||||
*/
|
||||
pidHref: string;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface representing the Quality Assurance event model
|
||||
*/
|
||||
@typedObject
|
||||
export class QualityAssuranceEventObject implements CacheableObject {
|
||||
/**
|
||||
* A string representing the kind of object, e.g. community, item, …
|
||||
*/
|
||||
static type = QUALITY_ASSURANCE_EVENT_OBJECT;
|
||||
|
||||
/**
|
||||
* The Quality Assurance event uuid inside DSpace
|
||||
*/
|
||||
@autoserialize
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The universally unique identifier of this Quality Assurance event
|
||||
*/
|
||||
@autoserializeAs(String, 'id')
|
||||
uuid: string;
|
||||
|
||||
/**
|
||||
* The Quality Assurance event original id (ex.: the source archive OAI-PMH identifier)
|
||||
*/
|
||||
@autoserialize
|
||||
originalId: string;
|
||||
|
||||
/**
|
||||
* The title of the article to which the suggestion refers
|
||||
*/
|
||||
@autoserialize
|
||||
title: string;
|
||||
|
||||
/**
|
||||
* Reliability of the suggestion (of the data inside 'message')
|
||||
*/
|
||||
@autoserialize
|
||||
trust: number;
|
||||
|
||||
/**
|
||||
* The timestamp Quality Assurance event was saved in DSpace
|
||||
*/
|
||||
@autoserialize
|
||||
eventDate: string;
|
||||
|
||||
/**
|
||||
* The Quality Assurance event status (ACCEPTED, REJECTED, DISCARDED, PENDING)
|
||||
*/
|
||||
@autoserialize
|
||||
status: string;
|
||||
|
||||
/**
|
||||
* The suggestion data. Data may vary depending on the source
|
||||
*/
|
||||
@autoserialize
|
||||
message: SourceQualityAssuranceEventMessageObject;
|
||||
|
||||
/**
|
||||
* The type of this ConfigObject
|
||||
*/
|
||||
@excludeFromEquals
|
||||
@autoserialize
|
||||
type: ResourceType;
|
||||
|
||||
/**
|
||||
* The links to all related resources returned by the rest api.
|
||||
*/
|
||||
@deserialize
|
||||
_links: {
|
||||
self: HALLink,
|
||||
target: HALLink,
|
||||
related: HALLink
|
||||
};
|
||||
|
||||
/**
|
||||
* The related publication DSpace item
|
||||
* Will be undefined unless the {@item HALLink} has been resolved.
|
||||
*/
|
||||
@link(ITEM)
|
||||
target?: Observable<RemoteData<Item>>;
|
||||
|
||||
/**
|
||||
* The related project for this Event
|
||||
* Will be undefined unless the {@related HALLink} has been resolved.
|
||||
*/
|
||||
@link(ITEM)
|
||||
related?: Observable<RemoteData<Item>>;
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from '../../../shared/resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for the Quality Assurance source
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const QUALITY_ASSURANCE_SOURCE_OBJECT = new ResourceType('qualityassurancesource');
|
@@ -0,0 +1,52 @@
|
||||
import { autoserialize, deserialize } from 'cerialize';
|
||||
|
||||
import { excludeFromEquals } from '../../../utilities/equals.decorators';
|
||||
import { ResourceType } from '../../../shared/resource-type';
|
||||
import { HALLink } from '../../../shared/hal-link.model';
|
||||
import { typedObject } from '../../../cache/builders/build-decorators';
|
||||
import { QUALITY_ASSURANCE_SOURCE_OBJECT } from './quality-assurance-source-object.resource-type';
|
||||
import {CacheableObject} from '../../../cache/cacheable-object.model';
|
||||
|
||||
/**
|
||||
* The interface representing the Quality Assurance source model
|
||||
*/
|
||||
@typedObject
|
||||
export class QualityAssuranceSourceObject implements CacheableObject {
|
||||
/**
|
||||
* A string representing the kind of object, e.g. community, item, …
|
||||
*/
|
||||
static type = QUALITY_ASSURANCE_SOURCE_OBJECT;
|
||||
|
||||
/**
|
||||
* The Quality Assurance source id
|
||||
*/
|
||||
@autoserialize
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The date of the last udate from Notifications
|
||||
*/
|
||||
@autoserialize
|
||||
lastEvent: string;
|
||||
|
||||
/**
|
||||
* The total number of suggestions provided by Notifications for this source
|
||||
*/
|
||||
@autoserialize
|
||||
totalEvents: number;
|
||||
|
||||
/**
|
||||
* The type of this ConfigObject
|
||||
*/
|
||||
@excludeFromEquals
|
||||
@autoserialize
|
||||
type: ResourceType;
|
||||
|
||||
/**
|
||||
* The links to all related resources returned by the rest api.
|
||||
*/
|
||||
@deserialize
|
||||
_links: {
|
||||
self: HALLink,
|
||||
};
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from '../../../shared/resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for the Quality Assurance topic
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const QUALITY_ASSURANCE_TOPIC_OBJECT = new ResourceType('qualityassurancetopic');
|
@@ -0,0 +1,58 @@
|
||||
import { autoserialize, deserialize } from 'cerialize';
|
||||
|
||||
import { QUALITY_ASSURANCE_TOPIC_OBJECT } from './quality-assurance-topic-object.resource-type';
|
||||
import { excludeFromEquals } from '../../../utilities/equals.decorators';
|
||||
import { ResourceType } from '../../../shared/resource-type';
|
||||
import { HALLink } from '../../../shared/hal-link.model';
|
||||
import { typedObject } from '../../../cache/builders/build-decorators';
|
||||
import {CacheableObject} from '../../../cache/cacheable-object.model';
|
||||
|
||||
/**
|
||||
* The interface representing the Quality Assurance topic model
|
||||
*/
|
||||
@typedObject
|
||||
export class QualityAssuranceTopicObject implements CacheableObject {
|
||||
/**
|
||||
* A string representing the kind of object, e.g. community, item, …
|
||||
*/
|
||||
static type = QUALITY_ASSURANCE_TOPIC_OBJECT;
|
||||
|
||||
/**
|
||||
* The Quality Assurance topic id
|
||||
*/
|
||||
@autoserialize
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The Quality Assurance topic name to display
|
||||
*/
|
||||
@autoserialize
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The date of the last udate from Notifications
|
||||
*/
|
||||
@autoserialize
|
||||
lastEvent: string;
|
||||
|
||||
/**
|
||||
* The total number of suggestions provided by Notifications for this topic
|
||||
*/
|
||||
@autoserialize
|
||||
totalEvents: number;
|
||||
|
||||
/**
|
||||
* The type of this ConfigObject
|
||||
*/
|
||||
@excludeFromEquals
|
||||
@autoserialize
|
||||
type: ResourceType;
|
||||
|
||||
/**
|
||||
* The links to all related resources returned by the rest api.
|
||||
*/
|
||||
@deserialize
|
||||
_links: {
|
||||
self: HALLink,
|
||||
};
|
||||
}
|
@@ -0,0 +1,125 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
|
||||
import { TestScheduler } from 'rxjs/testing';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { cold, getTestScheduler } from 'jasmine-marbles';
|
||||
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { buildPaginatedList } from '../../../data/paginated-list.model';
|
||||
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../cache/object-cache.service';
|
||||
import { RestResponse } from '../../../cache/response.models';
|
||||
import { PageInfo } from '../../../shared/page-info.model';
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
|
||||
import {
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
qualityAssuranceSourceObjectMorePid
|
||||
} from '../../../../shared/mocks/notifications.mock';
|
||||
import { RequestEntry } from '../../../data/request-entry.model';
|
||||
import { QualityAssuranceSourceDataService } from './quality-assurance-source-data.service';
|
||||
|
||||
describe('QualityAssuranceSourceDataService', () => {
|
||||
let scheduler: TestScheduler;
|
||||
let service: QualityAssuranceSourceDataService;
|
||||
let responseCacheEntry: RequestEntry;
|
||||
let requestService: RequestService;
|
||||
let rdbService: RemoteDataBuildService;
|
||||
let objectCache: ObjectCacheService;
|
||||
let halService: HALEndpointService;
|
||||
let notificationsService: NotificationsService;
|
||||
let http: HttpClient;
|
||||
let comparator: any;
|
||||
|
||||
const endpointURL = 'https://rest.api/rest/api/integration/qualityassurancesources';
|
||||
const requestUUID = '8b3c913a-5a4b-438b-9181-be1a5b4a1c8a';
|
||||
|
||||
const pageInfo = new PageInfo();
|
||||
const array = [qualityAssuranceSourceObjectMorePid, qualityAssuranceSourceObjectMoreAbstract];
|
||||
const paginatedList = buildPaginatedList(pageInfo, array);
|
||||
const qaSourceObjectRD = createSuccessfulRemoteDataObject(qualityAssuranceSourceObjectMorePid);
|
||||
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
|
||||
|
||||
beforeEach(() => {
|
||||
scheduler = getTestScheduler();
|
||||
|
||||
responseCacheEntry = new RequestEntry();
|
||||
responseCacheEntry.response = new RestResponse(true, 200, 'Success');
|
||||
requestService = jasmine.createSpyObj('requestService', {
|
||||
generateRequestId: requestUUID,
|
||||
send: true,
|
||||
removeByHrefSubstring: {},
|
||||
getByHref: observableOf(responseCacheEntry),
|
||||
getByUUID: observableOf(responseCacheEntry),
|
||||
});
|
||||
|
||||
rdbService = jasmine.createSpyObj('rdbService', {
|
||||
buildSingle: cold('(a)', {
|
||||
a: qaSourceObjectRD
|
||||
}),
|
||||
buildList: cold('(a)', {
|
||||
a: paginatedListRD
|
||||
}),
|
||||
});
|
||||
|
||||
objectCache = {} as ObjectCacheService;
|
||||
halService = jasmine.createSpyObj('halService', {
|
||||
getEndpoint: cold('a|', { a: endpointURL })
|
||||
});
|
||||
|
||||
notificationsService = {} as NotificationsService;
|
||||
http = {} as HttpClient;
|
||||
comparator = {} as any;
|
||||
|
||||
service = new QualityAssuranceSourceDataService(
|
||||
requestService,
|
||||
rdbService,
|
||||
objectCache,
|
||||
halService,
|
||||
notificationsService
|
||||
);
|
||||
|
||||
spyOn((service as any).findAllData, 'findAll').and.callThrough();
|
||||
spyOn((service as any), 'findById').and.callThrough();
|
||||
});
|
||||
|
||||
describe('getSources', () => {
|
||||
it('should call findAll', (done) => {
|
||||
service.getSources().subscribe(
|
||||
(res) => {
|
||||
expect((service as any).findAllData.findAll).toHaveBeenCalledWith({}, true, true);
|
||||
}
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should return a RemoteData<PaginatedList<QualityAssuranceSourceObject>> for the object with the given URL', () => {
|
||||
const result = service.getSources();
|
||||
const expected = cold('(a)', {
|
||||
a: paginatedListRD
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getSource', () => {
|
||||
it('should call findById', (done) => {
|
||||
service.getSource(qualityAssuranceSourceObjectMorePid.id).subscribe(
|
||||
(res) => {
|
||||
expect((service as any).findById).toHaveBeenCalledWith(qualityAssuranceSourceObjectMorePid.id, true, true);
|
||||
}
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should return a RemoteData<QualityAssuranceSourceObject> for the object with the given URL', () => {
|
||||
const result = service.getSource(qualityAssuranceSourceObjectMorePid.id);
|
||||
const expected = cold('(a)', {
|
||||
a: qaSourceObjectRD
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
@@ -0,0 +1,87 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../cache/object-cache.service';
|
||||
import { dataService } from '../../../data/base/data-service.decorator';
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { RemoteData } from '../../../data/remote-data';
|
||||
import { QualityAssuranceSourceObject } from '../models/quality-assurance-source.model';
|
||||
import { QUALITY_ASSURANCE_SOURCE_OBJECT } from '../models/quality-assurance-source-object.resource-type';
|
||||
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model';
|
||||
import { PaginatedList } from '../../../data/paginated-list.model';
|
||||
import { FindListOptions } from '../../../data/find-list-options.model';
|
||||
import { IdentifiableDataService } from '../../../data/base/identifiable-data.service';
|
||||
import { FindAllData, FindAllDataImpl } from '../../../data/base/find-all-data';
|
||||
|
||||
/**
|
||||
* The service handling all Quality Assurance source REST requests.
|
||||
*/
|
||||
@Injectable()
|
||||
@dataService(QUALITY_ASSURANCE_SOURCE_OBJECT)
|
||||
export class QualityAssuranceSourceDataService extends IdentifiableDataService<QualityAssuranceSourceObject> {
|
||||
|
||||
private findAllData: FindAllData<QualityAssuranceSourceObject>;
|
||||
|
||||
/**
|
||||
* Initialize service variables
|
||||
* @param {RequestService} requestService
|
||||
* @param {RemoteDataBuildService} rdbService
|
||||
* @param {ObjectCacheService} objectCache
|
||||
* @param {HALEndpointService} halService
|
||||
* @param {NotificationsService} notificationsService
|
||||
*/
|
||||
constructor(
|
||||
protected requestService: RequestService,
|
||||
protected rdbService: RemoteDataBuildService,
|
||||
protected objectCache: ObjectCacheService,
|
||||
protected halService: HALEndpointService,
|
||||
protected notificationsService: NotificationsService
|
||||
) {
|
||||
super('qualityassurancesources', requestService, rdbService, objectCache, halService);
|
||||
this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of Quality Assurance source.
|
||||
*
|
||||
* @param options Find list options object.
|
||||
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
|
||||
* no valid cached version. Defaults to true
|
||||
* @param reRequestOnStale Whether or not the request should automatically be re-
|
||||
* requested after the response becomes stale
|
||||
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
||||
*
|
||||
* @return Observable<RemoteData<PaginatedList<QualityAssuranceSourceObject>>>
|
||||
* The list of Quality Assurance source.
|
||||
*/
|
||||
public getSources(options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<QualityAssuranceSourceObject>[]): Observable<RemoteData<PaginatedList<QualityAssuranceSourceObject>>> {
|
||||
return this.findAllData.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear FindAll source requests from cache
|
||||
*/
|
||||
public clearFindAllSourceRequests() {
|
||||
this.requestService.setStaleByHrefSubstring('qualityassurancesources');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a single Quality Assurance source.
|
||||
*
|
||||
* @param id The Quality Assurance source id
|
||||
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
|
||||
* no valid cached version. Defaults to true
|
||||
* @param reRequestOnStale Whether or not the request should automatically be re-
|
||||
* requested after the response becomes stale
|
||||
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
||||
*
|
||||
* @return Observable<RemoteData<QualityAssuranceSourceObject>> The Quality Assurance source.
|
||||
*/
|
||||
public getSource(id: string, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<QualityAssuranceSourceObject>[]): Observable<RemoteData<QualityAssuranceSourceObject>> {
|
||||
return this.findById(id, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||
}
|
||||
}
|
@@ -0,0 +1,125 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
|
||||
import { TestScheduler } from 'rxjs/testing';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { cold, getTestScheduler } from 'jasmine-marbles';
|
||||
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { buildPaginatedList } from '../../../data/paginated-list.model';
|
||||
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../cache/object-cache.service';
|
||||
import { RestResponse } from '../../../cache/response.models';
|
||||
import { PageInfo } from '../../../shared/page-info.model';
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
|
||||
import { QualityAssuranceTopicDataService } from './quality-assurance-topic-data.service';
|
||||
import {
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
qualityAssuranceTopicObjectMorePid
|
||||
} from '../../../../shared/mocks/notifications.mock';
|
||||
import { RequestEntry } from '../../../data/request-entry.model';
|
||||
|
||||
describe('QualityAssuranceTopicDataService', () => {
|
||||
let scheduler: TestScheduler;
|
||||
let service: QualityAssuranceTopicDataService;
|
||||
let responseCacheEntry: RequestEntry;
|
||||
let requestService: RequestService;
|
||||
let rdbService: RemoteDataBuildService;
|
||||
let objectCache: ObjectCacheService;
|
||||
let halService: HALEndpointService;
|
||||
let notificationsService: NotificationsService;
|
||||
let http: HttpClient;
|
||||
let comparator: any;
|
||||
|
||||
const endpointURL = 'https://rest.api/rest/api/integration/qualityassurancetopics';
|
||||
const requestUUID = '8b3c913a-5a4b-438b-9181-be1a5b4a1c8a';
|
||||
|
||||
const pageInfo = new PageInfo();
|
||||
const array = [qualityAssuranceTopicObjectMorePid, qualityAssuranceTopicObjectMoreAbstract];
|
||||
const paginatedList = buildPaginatedList(pageInfo, array);
|
||||
const qaTopicObjectRD = createSuccessfulRemoteDataObject(qualityAssuranceTopicObjectMorePid);
|
||||
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
|
||||
|
||||
beforeEach(() => {
|
||||
scheduler = getTestScheduler();
|
||||
|
||||
responseCacheEntry = new RequestEntry();
|
||||
responseCacheEntry.response = new RestResponse(true, 200, 'Success');
|
||||
requestService = jasmine.createSpyObj('requestService', {
|
||||
generateRequestId: requestUUID,
|
||||
send: true,
|
||||
removeByHrefSubstring: {},
|
||||
getByHref: observableOf(responseCacheEntry),
|
||||
getByUUID: observableOf(responseCacheEntry),
|
||||
});
|
||||
|
||||
rdbService = jasmine.createSpyObj('rdbService', {
|
||||
buildSingle: cold('(a)', {
|
||||
a: qaTopicObjectRD
|
||||
}),
|
||||
buildList: cold('(a)', {
|
||||
a: paginatedListRD
|
||||
}),
|
||||
});
|
||||
|
||||
objectCache = {} as ObjectCacheService;
|
||||
halService = jasmine.createSpyObj('halService', {
|
||||
getEndpoint: cold('a|', { a: endpointURL })
|
||||
});
|
||||
|
||||
notificationsService = {} as NotificationsService;
|
||||
http = {} as HttpClient;
|
||||
comparator = {} as any;
|
||||
|
||||
service = new QualityAssuranceTopicDataService(
|
||||
requestService,
|
||||
rdbService,
|
||||
objectCache,
|
||||
halService,
|
||||
notificationsService
|
||||
);
|
||||
|
||||
spyOn((service as any).findAllData, 'findAll').and.callThrough();
|
||||
spyOn((service as any), 'findById').and.callThrough();
|
||||
});
|
||||
|
||||
describe('getTopics', () => {
|
||||
it('should call findListByHref', (done) => {
|
||||
service.getTopics().subscribe(
|
||||
(res) => {
|
||||
expect((service as any).findAllData.findAll).toHaveBeenCalledWith({}, true, true);
|
||||
}
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should return a RemoteData<PaginatedList<QualityAssuranceTopicObject>> for the object with the given URL', () => {
|
||||
const result = service.getTopics();
|
||||
const expected = cold('(a)', {
|
||||
a: paginatedListRD
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getTopic', () => {
|
||||
it('should call findByHref', (done) => {
|
||||
service.getTopic(qualityAssuranceTopicObjectMorePid.id).subscribe(
|
||||
(res) => {
|
||||
expect((service as any).findById).toHaveBeenCalledWith(qualityAssuranceTopicObjectMorePid.id, true, true);
|
||||
}
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should return a RemoteData<QualityAssuranceTopicObject> for the object with the given URL', () => {
|
||||
const result = service.getTopic(qualityAssuranceTopicObjectMorePid.id);
|
||||
const expected = cold('(a)', {
|
||||
a: qaTopicObjectRD
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
@@ -0,0 +1,88 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../cache/object-cache.service';
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { RemoteData } from '../../../data/remote-data';
|
||||
import { QualityAssuranceTopicObject } from '../models/quality-assurance-topic.model';
|
||||
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model';
|
||||
import { PaginatedList } from '../../../data/paginated-list.model';
|
||||
import { FindListOptions } from '../../../data/find-list-options.model';
|
||||
import { IdentifiableDataService } from '../../../data/base/identifiable-data.service';
|
||||
import { dataService } from '../../../data/base/data-service.decorator';
|
||||
import { QUALITY_ASSURANCE_TOPIC_OBJECT } from '../models/quality-assurance-topic-object.resource-type';
|
||||
import { FindAllData, FindAllDataImpl } from '../../../data/base/find-all-data';
|
||||
|
||||
/**
|
||||
* The service handling all Quality Assurance topic REST requests.
|
||||
*/
|
||||
@Injectable()
|
||||
@dataService(QUALITY_ASSURANCE_TOPIC_OBJECT)
|
||||
export class QualityAssuranceTopicDataService extends IdentifiableDataService<QualityAssuranceTopicObject> {
|
||||
|
||||
private findAllData: FindAllData<QualityAssuranceTopicObject>;
|
||||
|
||||
/**
|
||||
* Initialize service variables
|
||||
* @param {RequestService} requestService
|
||||
* @param {RemoteDataBuildService} rdbService
|
||||
* @param {ObjectCacheService} objectCache
|
||||
* @param {HALEndpointService} halService
|
||||
* @param {NotificationsService} notificationsService
|
||||
*/
|
||||
constructor(
|
||||
protected requestService: RequestService,
|
||||
protected rdbService: RemoteDataBuildService,
|
||||
protected objectCache: ObjectCacheService,
|
||||
protected halService: HALEndpointService,
|
||||
protected notificationsService: NotificationsService
|
||||
) {
|
||||
super('qualityassurancetopics', requestService, rdbService, objectCache, halService);
|
||||
this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of Quality Assurance topics.
|
||||
*
|
||||
* @param options Find list options object.
|
||||
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
|
||||
* no valid cached version. Defaults to true
|
||||
* @param reRequestOnStale Whether or not the request should automatically be re-
|
||||
* requested after the response becomes stale
|
||||
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
||||
*
|
||||
* @return Observable<RemoteData<PaginatedList<QualityAssuranceTopicObject>>>
|
||||
* The list of Quality Assurance topics.
|
||||
*/
|
||||
public getTopics(options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<QualityAssuranceTopicObject>[]): Observable<RemoteData<PaginatedList<QualityAssuranceTopicObject>>> {
|
||||
return this.findAllData.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear FindAll topics requests from cache
|
||||
*/
|
||||
public clearFindAllTopicsRequests() {
|
||||
this.requestService.setStaleByHrefSubstring('qualityassurancetopics');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a single Quality Assurance topic.
|
||||
*
|
||||
* @param id The Quality Assurance topic id
|
||||
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
|
||||
* no valid cached version. Defaults to true
|
||||
* @param reRequestOnStale Whether or not the request should automatically be re-
|
||||
* requested after the response becomes stale
|
||||
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
||||
*
|
||||
* @return Observable<RemoteData<QualityAssuranceTopicObject>>
|
||||
* The Quality Assurance topic.
|
||||
*/
|
||||
public getTopic(id: string, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<QualityAssuranceTopicObject>[]): Observable<RemoteData<QualityAssuranceTopicObject>> {
|
||||
return this.findById(id, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||
}
|
||||
}
|
@@ -4,6 +4,7 @@
|
||||
<div class="flex-grow-1 ds-flex-cell ds-value-cell d-flex align-items-center" *ngVar="(mdRepresentation$ | async) as mdRepresentation" role="cell">
|
||||
<div class="dont-break-out preserve-line-breaks" *ngIf="!mdValue.editing && !mdRepresentation">{{ mdValue.newValue.value }}</div>
|
||||
<textarea class="form-control" rows="5" *ngIf="mdValue.editing && !mdRepresentation" [(ngModel)]="mdValue.newValue.value"
|
||||
[attr.aria-label]="(dsoType + '.edit.metadata.edit.value') | translate"
|
||||
[dsDebounce]="300" (onDebounce)="confirm.emit(false)"></textarea>
|
||||
<div class="d-flex" *ngIf="mdRepresentation">
|
||||
<a class="mr-2" target="_blank" [routerLink]="mdRepresentationItemRoute$ | async">{{ mdRepresentationName$ | async }}</a>
|
||||
@@ -13,6 +14,7 @@
|
||||
<div class="ds-flex-cell ds-lang-cell" role="cell">
|
||||
<div class="dont-break-out preserve-line-breaks" *ngIf="!mdValue.editing">{{ mdValue.newValue.language }}</div>
|
||||
<input class="form-control" type="text" *ngIf="mdValue.editing" [(ngModel)]="mdValue.newValue.language"
|
||||
[attr.aria-label]="(dsoType + '.edit.metadata.edit.language') | translate"
|
||||
[dsDebounce]="300" (onDebounce)="confirm.emit(false)" />
|
||||
</div>
|
||||
<div class="text-center ds-flex-cell ds-edit-cell" role="cell">
|
||||
|
@@ -62,21 +62,22 @@
|
||||
<a class="text-white"
|
||||
href="https://www.lyrasis.org/">{{ 'footer.link.lyrasis' | translate}}</a>
|
||||
</p>
|
||||
<ul class="footer-info list-unstyled small d-flex justify-content-center mb-0">
|
||||
<ul class="footer-info list-unstyled d-flex justify-content-center mb-0">
|
||||
<li>
|
||||
<a class="text-white" href="javascript:void(0);"
|
||||
(click)="showCookieSettings()">{{ 'footer.link.cookies' | translate}}</a>
|
||||
<button class="btn btn-link text-white" type="button" (click)="showCookieSettings()">
|
||||
{{ 'footer.link.cookies' | translate}}
|
||||
</button>
|
||||
</li>
|
||||
<li *ngIf="showPrivacyPolicy">
|
||||
<a class="text-white"
|
||||
<a class="btn text-white"
|
||||
routerLink="info/privacy">{{ 'footer.link.privacy-policy' | translate}}</a>
|
||||
</li>
|
||||
<li *ngIf="showEndUserAgreement">
|
||||
<a class="text-white"
|
||||
<a class="btn text-white"
|
||||
routerLink="info/end-user-agreement">{{ 'footer.link.end-user-agreement' | translate}}</a>
|
||||
</li>
|
||||
<li *ngIf="showSendFeedback$ | async">
|
||||
<a class="text-white"
|
||||
<a class="btn text-white"
|
||||
routerLink="info/feedback">{{ 'footer.link.feedback' | translate}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@@ -26,9 +26,19 @@
|
||||
li {
|
||||
display: inline-flex;
|
||||
|
||||
a {
|
||||
a, .btn-link {
|
||||
padding: 0 calc(var(--bs-spacer) / 2);
|
||||
color: inherit
|
||||
color: inherit;
|
||||
font-size: .875em;
|
||||
|
||||
&:focus {
|
||||
box-shadow: none;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
&:not(:last-child) {
|
||||
|
@@ -45,6 +45,7 @@ describe('HeaderComponent', () => {
|
||||
HeaderComponent
|
||||
],
|
||||
providers: [
|
||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
||||
{ provide: MenuService, useValue: menuService },
|
||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub()},
|
||||
{ provide: LocaleService, useValue: mockLocaleService },
|
||||
|
@@ -1,16 +1,16 @@
|
||||
<div *ngFor="let entry of healthInfoComponent | dsObjNgFor" data-test="collapse">
|
||||
<div *ngIf="entry && !isPlainProperty(entry.value)" class="mb-3 border-bottom">
|
||||
<div class="w-100 d-flex justify-content-between collapse-toggle" (click)="collapse.toggle()">
|
||||
<div class="w-100 d-flex gap-3 justify-content-between collapse-toggle" (click)="collapse.toggle()">
|
||||
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="!collapse.collapsed"
|
||||
aria-controls="collapseExample">
|
||||
[attr.aria-controls]="'health-info-component-' + entry.key + '-content'">
|
||||
{{ entry.key | titlecase }}
|
||||
</button>
|
||||
<div class="d-inline-block">
|
||||
<div class="d-flex my-auto">
|
||||
<span *ngIf="collapse.collapsed" class="fas fa-chevron-down"></span>
|
||||
<span *ngIf="!collapse.collapsed" class="fas fa-chevron-up"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div #collapse="ngbCollapse" [ngbCollapse]="isCollapsed">
|
||||
<div #collapse="ngbCollapse" [id]="'health-info-component-' + entry.key + '-content'" [ngbCollapse]="isCollapsed">
|
||||
<div class="card border-0">
|
||||
<div class="card-body">
|
||||
<ds-health-info-component [healthInfoComponent]="entry.value"
|
||||
|
@@ -2,14 +2,14 @@
|
||||
<ngb-accordion #acc="ngbAccordion" [activeIds]="activeId">
|
||||
<ngb-panel [id]="entry.key" *ngFor="let entry of healthInfoResponse | dsObjNgFor">
|
||||
<ng-template ngbPanelHeader>
|
||||
<div class="w-100 d-flex justify-content-between collapse-toggle" ngbPanelToggle (click)="acc.toggle(entry.key)" data-test="info-component">
|
||||
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="!acc.isExpanded(entry.key)"
|
||||
aria-controls="collapsePanels">
|
||||
<div class="w-100 d-flex gap-3 justify-content-between collapse-toggle" ngbPanelToggle (click)="acc.toggle(entry.key)" data-test="info-component">
|
||||
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="acc.isExpanded(entry.key)"
|
||||
[attr.aria-controls]="'health-info-' + entry.key + '-content'">
|
||||
{{ getPanelLabel(entry.key) | titlecase }}
|
||||
</button>
|
||||
<div class="text-right d-flex">
|
||||
<div class="text-right d-flex gap-2">
|
||||
<ds-health-status [status]="entry.value?.status"></ds-health-status>
|
||||
<div class="ml-3 d-inline-block">
|
||||
<div class="d-flex my-auto">
|
||||
<span *ngIf="acc.isExpanded(entry.key)" class="fas fa-chevron-up fa-fw"></span>
|
||||
<span *ngIf="!acc.isExpanded(entry.key)" class="fas fa-chevron-down fa-fw"></span>
|
||||
</div>
|
||||
@@ -17,8 +17,9 @@
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template ngbPanelContent>
|
||||
<ds-health-info-component [healthInfoComponentName]="entry.key"
|
||||
[healthInfoComponent]="entry.value"></ds-health-info-component>
|
||||
<ds-health-info-component [healthInfoComponentName]="entry.key" [healthInfoComponent]="entry.value"
|
||||
[id]="'health-info-' + entry.key + '-content'">
|
||||
</ds-health-info-component>
|
||||
</ng-template>
|
||||
</ngb-panel>
|
||||
</ngb-accordion>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<h2>{{'health-page.heading' | translate}}</h2>
|
||||
<div *ngIf="(healthResponse | async) && (healthInfoResponse | async)">
|
||||
<ul ngbNav #nav="ngbNav" [activeId]="'status'" class="nav-tabs">
|
||||
<li [ngbNavItem]="'status'">
|
||||
<li [ngbNavItem]="'status'" role="presentation">
|
||||
<a ngbNavLink>{{'health-page.status-tab' | translate}}</a>
|
||||
<ng-template ngbNavContent>
|
||||
<div id="status">
|
||||
@@ -10,7 +10,7 @@
|
||||
</div>
|
||||
</ng-template>
|
||||
</li>
|
||||
<li [ngbNavItem]="'info'">
|
||||
<li [ngbNavItem]="'info'" role="presentation">
|
||||
<a ngbNavLink>{{'health-page.info-tab' | translate}}</a>
|
||||
<ng-template ngbNavContent>
|
||||
<div id="info">
|
||||
@@ -21,7 +21,7 @@
|
||||
</ul>
|
||||
<div [ngbNavOutlet]="nav" class="mt-2"></div>
|
||||
</div>
|
||||
<ds-alert *ngIf="!(healthResponse | async) || !(healthInfoResponse | async)" [type]="'alert-danger'" [content]="'health-page.error.msg'"></ds-alert>
|
||||
<ds-alert *ngIf="!(healthResponse | async) || !(healthInfoResponse | async)" [type]="AlertType.Error" [content]="'health-page.error.msg'"></ds-alert>
|
||||
</div>
|
||||
|
||||
|
||||
|
@@ -11,6 +11,7 @@ import { HealthInfoComponent } from './health-info/health-info.component';
|
||||
import { HealthPanelComponent } from './health-panel/health-panel.component';
|
||||
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { NgIf, AsyncPipe } from '@angular/common';
|
||||
import { AlertType } from '../shared/alert/alert-type';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-health-page',
|
||||
@@ -41,6 +42,8 @@ export class HealthPageComponent implements OnInit {
|
||||
*/
|
||||
healthInfoResponseInitialised: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
|
||||
readonly AlertType = AlertType;
|
||||
|
||||
constructor(private healthDataService: HealthService) {
|
||||
}
|
||||
|
||||
|
@@ -1,16 +1,16 @@
|
||||
<ng-container *ngIf="healthComponent?.components">
|
||||
<div *ngFor="let entry of healthComponent?.components | dsObjNgFor" class="mb-3 border-bottom" data-test="collapse">
|
||||
<div class="w-100 d-flex justify-content-between collapse-toggle" (click)="collapse.toggle()">
|
||||
<div class="w-100 d-flex gap-3 justify-content-between collapse-toggle" (click)="collapse.toggle()">
|
||||
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="!collapse.collapsed"
|
||||
aria-controls="collapseExample">
|
||||
[attr.aria-controls]="'health-component-' + entry.key + 'content'">
|
||||
{{ entry.key | titlecase }}
|
||||
</button>
|
||||
<div class="d-inline-block">
|
||||
<div class="d-flex my-auto">
|
||||
<span *ngIf="collapse.collapsed" class="fas fa-chevron-down"></span>
|
||||
<span *ngIf="!collapse.collapsed" class="fas fa-chevron-up"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div #collapse="ngbCollapse" [ngbCollapse]="isCollapsed">
|
||||
<div #collapse="ngbCollapse" [id]="'health-component-' + entry.key + 'content'" [ngbCollapse]="isCollapsed">
|
||||
<div class="card border-0">
|
||||
<div class="card-body">
|
||||
<ds-health-component [healthComponent]="entry.value"
|
||||
|
@@ -1,15 +1,18 @@
|
||||
<p class="h4">{{'health-page.status' | translate}} : <ds-health-status [status]="healthResponse.status"></ds-health-status></p>
|
||||
<p class="h4">
|
||||
{{'health-page.status' | translate}}:
|
||||
<ds-health-status [status]="healthResponse.status" class="d-inline-flex"></ds-health-status>
|
||||
</p>
|
||||
<ngb-accordion #acc="ngbAccordion" [activeIds]="activeId">
|
||||
<ngb-panel [id]="entry.key" *ngFor="let entry of healthResponse.components | dsObjNgFor">
|
||||
<ng-template ngbPanelHeader>
|
||||
<div class="w-100 d-flex justify-content-between collapse-toggle" ngbPanelToggle (click)="acc.toggle(entry.key)" data-test="component">
|
||||
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="!acc.isExpanded(entry.key)"
|
||||
aria-controls="collapsePanels">
|
||||
<div class="w-100 d-flex gap-3 justify-content-between collapse-toggle" ngbPanelToggle (click)="acc.toggle(entry.key)" data-test="component">
|
||||
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="acc.isExpanded(entry.key)"
|
||||
[attr.aria-controls]="'health-panel-' + entry.key + '-content'">
|
||||
{{ getPanelLabel(entry.key) | titlecase }}
|
||||
</button>
|
||||
<div class="text-right d-flex">
|
||||
<div class="text-right d-flex gap-2">
|
||||
<ds-health-status [status]="entry.value?.status"></ds-health-status>
|
||||
<div class="ml-3 d-inline-block">
|
||||
<div class="d-flex my-auto">
|
||||
<span *ngIf="acc.isExpanded(entry.key)" class="fas fa-chevron-up fa-fw"></span>
|
||||
<span *ngIf="!acc.isExpanded(entry.key)" class="fas fa-chevron-down fa-fw"></span>
|
||||
</div>
|
||||
@@ -17,9 +20,9 @@
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template ngbPanelContent>
|
||||
<ds-health-component [healthComponent]="entry.value" [healthComponentName]="entry.key"></ds-health-component>
|
||||
<ds-health-component [healthComponent]="entry.value" [healthComponentName]="entry.key"
|
||||
[id]="'health-panel-' + entry.key + '-content'" role="presentation">
|
||||
</ds-health-component>
|
||||
</ng-template>
|
||||
</ngb-panel>
|
||||
</ngb-accordion>
|
||||
|
||||
|
||||
|
@@ -1,12 +1,12 @@
|
||||
<ng-container [ngSwitch]="status">
|
||||
<i *ngSwitchCase="HealthStatus.UP"
|
||||
class="fa fa-check-circle text-success ml-2 mt-1"
|
||||
class="fa fa-check-circle text-success my-auto"
|
||||
ngbTooltip="{{'health-page.status.ok.info' | translate}}" container="body" ></i>
|
||||
<i *ngSwitchCase="HealthStatus.UP_WITH_ISSUES"
|
||||
class="fa fa-exclamation-triangle text-warning ml-2 mt-1"
|
||||
class="fa fa-exclamation-triangle text-warning my-auto"
|
||||
ngbTooltip="{{'health-page.status.warning.info' | translate}}" container="body"></i>
|
||||
<i *ngSwitchCase="HealthStatus.DOWN"
|
||||
class="fa fa-times-circle text-danger ml-2 mt-1"
|
||||
class="fa fa-times-circle text-danger my-auto"
|
||||
ngbTooltip="{{'health-page.status.error.info' | translate}}" container="body"></i>
|
||||
|
||||
</ng-container>
|
||||
|
@@ -0,0 +1,3 @@
|
||||
:host {
|
||||
display: flex;
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<div class="row row-offcanvas row-offcanvas-right">
|
||||
<div class="col-xs-12 col-sm-12 col-md-9">
|
||||
<form class="primary" [formGroup]="feedbackForm" (ngSubmit)="createFeedback()">
|
||||
<h2>{{ 'info.feedback.head' | translate }}</h2>
|
||||
<h1>{{ 'info.feedback.head' | translate }}</h1>
|
||||
<p>{{ 'info.feedback.info' | translate }}</p>
|
||||
<fieldset class="col p-0">
|
||||
<div class="row">
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<div class="container">
|
||||
<h3 class="mb-4">{{'bitstream-request-a-copy.header' | translate}}</h3>
|
||||
<h1 class="mb-4">{{'bitstream-request-a-copy.header' | translate}}</h1>
|
||||
<div *ngIf="canDownload$|async" class="alert alert-success">
|
||||
<span>{{'bitstream-request-a-copy.alert.canDownload1' | translate}}</span>
|
||||
<a [routerLink]="getBitstreamLink()">{{'bitstream-request-a-copy.alert.canDownload2'| translate}}</a>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<ng-container *ngIf="bundles">
|
||||
<div class="row">
|
||||
<div class="col-12 mb-2">
|
||||
<h2>{{'item.bitstreams.upload.title' | translate}}</h2>
|
||||
<h1>{{'item.bitstreams.upload.title' | translate}}</h1>
|
||||
<ng-container *ngVar="(itemRD$ | async)?.payload as item">
|
||||
<div *ngIf="item">
|
||||
<span class="font-weight-bold">{{'item.bitstreams.upload.item' | translate}}</span>
|
||||
|
@@ -1,14 +1,16 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h2 class="border-bottom">{{'item.edit.head' | translate}}</h2>
|
||||
<h1 class="border-bottom">{{'item.edit.head' | translate}}</h1>
|
||||
<div class="pt-2">
|
||||
<ul class="nav nav-tabs justify-content-start" role="tablist">
|
||||
<li *ngFor="let page of pages" class="nav-item" [attr.aria-selected]="page.page === currentPage" role="tab">
|
||||
<li *ngFor="let page of pages" class="nav-item" role="presentation">
|
||||
<a *ngIf="(page.enabled | async)"
|
||||
[attr.aria-selected]="page.page === currentPage"
|
||||
class="nav-link"
|
||||
[ngClass]="{'active' : page.page === currentPage}"
|
||||
[routerLink]="['./' + page.page]">
|
||||
[routerLink]="['./' + page.page]"
|
||||
role="tab">
|
||||
{{'item.edit.tabs.' + page.page + '.head' | translate}}
|
||||
</a>
|
||||
<span [ngbTooltip]="'item.edit.tabs.disabled.tooltip' | translate">
|
||||
|
@@ -1,21 +1,25 @@
|
||||
<div class="item-bitstreams" *ngVar="(bundles$ | async) as bundles">
|
||||
<div class="button-row top d-flex mt-2 space-children-mr">
|
||||
<button class="mr-auto btn btn-success"
|
||||
[attr.aria-label]="'item.edit.bitstreams.upload-button' | translate"
|
||||
[routerLink]="[itemPageRoute, 'bitstreams', 'new']"><i
|
||||
class="fas fa-upload"></i>
|
||||
<span class="d-none d-sm-inline"> {{"item.edit.bitstreams.upload-button" | translate}}</span>
|
||||
</button>
|
||||
<button class="btn btn-warning" *ngIf="isReinstatable() | async"
|
||||
[attr.aria-label]="'item.edit.bitstreams.reinstate-button' | translate"
|
||||
(click)="reinstate()"><i
|
||||
class="fas fa-undo-alt"></i>
|
||||
<span class="d-none d-sm-inline"> {{"item.edit.bitstreams.reinstate-button" | translate}}</span>
|
||||
</button>
|
||||
<button class="btn btn-primary" [disabled]="!(hasChanges() | async) || submitting"
|
||||
[attr.aria-label]="'item.edit.bitstreams.save-button' | translate"
|
||||
(click)="submit()"><i
|
||||
class="fas fa-save"></i>
|
||||
<span class="d-none d-sm-inline"> {{"item.edit.bitstreams.save-button" | translate}}</span>
|
||||
</button>
|
||||
<button class="btn btn-danger" *ngIf="!(isReinstatable() | async)"
|
||||
[attr.aria-label]="'item.edit.bitstreams.discard-button' | translate"
|
||||
[disabled]="!(hasChanges() | async) || submitting"
|
||||
(click)="discard()"><i
|
||||
class="fas fa-times"></i>
|
||||
@@ -49,16 +53,19 @@
|
||||
<div class="button-row bottom">
|
||||
<div class="mt-4 float-right space-children-mr ml-gap">
|
||||
<button class="btn btn-warning" *ngIf="isReinstatable() | async"
|
||||
[attr.aria-label]="'item.edit.bitstreams.reinstate-button' | translate"
|
||||
(click)="reinstate()"><i
|
||||
class="fas fa-undo-alt"></i>
|
||||
<span class="d-none d-sm-inline"> {{"item.edit.bitstreams.reinstate-button" | translate}}</span>
|
||||
</button>
|
||||
<button class="btn btn-primary" [disabled]="!(hasChanges() | async) || submitting"
|
||||
[attr.aria-label]="'item.edit.bitstreams.save-button' | translate"
|
||||
(click)="submit()"><i
|
||||
class="fas fa-save"></i>
|
||||
<span class="d-none d-sm-inline"> {{"item.edit.bitstreams.save-button" | translate}}</span>
|
||||
</button>
|
||||
<button class="btn btn-danger" *ngIf="!(isReinstatable() | async)"
|
||||
[attr.aria-label]="'item.edit.bitstreams.discard-button' | translate"
|
||||
[disabled]="!(hasChanges() | async) || submitting"
|
||||
(click)="discard()"><i
|
||||
class="fas fa-times"></i>
|
||||
|
@@ -10,6 +10,7 @@
|
||||
<div class="btn-group bundle-action-buttons">
|
||||
<button [routerLink]="[itemPageRoute, 'bitstreams', 'new']"
|
||||
[queryParams]="{bundle: bundle.id}"
|
||||
[attr.aria-label]="'item.edit.bitstreams.bundle.edit.buttons.upload' | translate"
|
||||
class="btn btn-outline-success btn-sm"
|
||||
title="{{'item.edit.bitstreams.bundle.edit.buttons.upload' | translate}}">
|
||||
<i class="fas fa-upload fa-fw"></i>
|
||||
|
@@ -26,21 +26,25 @@
|
||||
<div class="text-center w-100">
|
||||
<div class="btn-group relationship-action-buttons">
|
||||
<a *ngIf="bitstreamDownloadUrl != null" [routerLink]="bitstreamDownloadUrl"
|
||||
class="btn btn-outline-primary btn-sm"
|
||||
title="{{'item.edit.bitstreams.edit.buttons.download' | translate}}"
|
||||
[attr.data-test]="'download-button' | dsBrowserOnly">
|
||||
[attr.aria-label]="'item.edit.bitstreams.edit.buttons.download' | translate"
|
||||
class="btn btn-outline-primary btn-sm"
|
||||
title="{{'item.edit.bitstreams.edit.buttons.download' | translate}}"
|
||||
[attr.data-test]="'download-button' | dsBrowserOnly">
|
||||
<i class="fas fa-download fa-fw"></i>
|
||||
</a>
|
||||
<button [routerLink]="['/bitstreams/', bitstream.id, 'edit']" class="btn btn-outline-primary btn-sm"
|
||||
[attr.aria-label]="'item.edit.bitstreams.edit.buttons.edit' | translate"
|
||||
title="{{'item.edit.bitstreams.edit.buttons.edit' | translate}}">
|
||||
<i class="fas fa-edit fa-fw"></i>
|
||||
</button>
|
||||
<button [disabled]="!canRemove()" (click)="remove()"
|
||||
[attr.aria-label]="'item.edit.bitstreams.edit.buttons.remove' | translate"
|
||||
class="btn btn-outline-danger btn-sm"
|
||||
title="{{'item.edit.bitstreams.edit.buttons.remove' | translate}}">
|
||||
<i class="fas fa-trash-alt fa-fw"></i>
|
||||
</button>
|
||||
<button [disabled]="!canUndo()" (click)="undo()"
|
||||
[attr.aria-label]="'item.edit.bitstreams.edit.buttons.undo' | translate"
|
||||
class="btn btn-outline-warning btn-sm"
|
||||
title="{{'item.edit.bitstreams.edit.buttons.undo' | translate}}">
|
||||
<i class="fas fa-undo-alt fa-fw"></i>
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<p>{{'item.edit.item-mapper.description' | translate}}</p>
|
||||
|
||||
<ul ngbNav (navChange)="tabChange($event)" [destroyOnHide]="true" #tabs="ngbNav" class="nav-tabs">
|
||||
<li [ngbNavItem]="'browseTab'">
|
||||
<li [ngbNavItem]="'browseTab'" role="presentation">
|
||||
<a ngbNavLink>{{'item.edit.item-mapper.tabs.browse' | translate}}</a>
|
||||
<ng-template ngbNavContent>
|
||||
<div class="mt-2">
|
||||
@@ -22,7 +22,7 @@
|
||||
</div>
|
||||
</ng-template>
|
||||
</li>
|
||||
<li [ngbNavItem]="'mapTab'">
|
||||
<li [ngbNavItem]="'mapTab'" role="presentation">
|
||||
<a ngbNavLink>{{'item.edit.item-mapper.tabs.map' | translate}}</a>
|
||||
<ng-template ngbNavContent>
|
||||
<div class="row mt-2">
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<div class="container mt-3">
|
||||
<h3>{{'item.edit.curate.title' |translate:{item: (itemName$ |async)} }}</h3>
|
||||
<h2>{{'item.edit.curate.title' |translate:{item: (itemName$ |async)} }}</h2>
|
||||
<ds-curation-form
|
||||
*ngIf="dsoRD$ | async as dsoRD"
|
||||
[dsoHandle]="dsoRD?.payload.handle"
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
|
||||
<h2>{{headerMessage | translate: {id: item.handle} }}</h2>
|
||||
<h1>{{headerMessage | translate: {id: item.handle} }}</h1>
|
||||
<p>{{descriptionMessage | translate}}</p>
|
||||
<ds-modify-item-overview [item]="item"></ds-modify-item-overview>
|
||||
|
||||
|
@@ -181,7 +181,7 @@ describe('ItemDeleteComponent', () => {
|
||||
});
|
||||
|
||||
it('should render a page with messages based on the \'delete\' messageKey', () => {
|
||||
const header = fixture.debugElement.query(By.css('h2')).nativeElement;
|
||||
const header = fixture.debugElement.query(By.css('h1')).nativeElement;
|
||||
expect(header.innerHTML).toContain('item.edit.delete.header');
|
||||
const description = fixture.debugElement.query(By.css('p')).nativeElement;
|
||||
expect(description.innerHTML).toContain('item.edit.delete.description');
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h2>{{'item.edit.move.head' | translate: {id: (itemRD$ | async)?.payload?.handle} }}</h2>
|
||||
<h1>{{'item.edit.move.head' | translate: {id: (itemRD$ | async)?.payload?.handle} }}</h1>
|
||||
<p>{{'item.edit.move.description' | translate}}</p>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
|
@@ -79,7 +79,7 @@ describe('ItemPrivateComponent', () => {
|
||||
});
|
||||
|
||||
it('should render a page with messages based on the \'private\' messageKey', () => {
|
||||
const header = fixture.debugElement.query(By.css('h2')).nativeElement;
|
||||
const header = fixture.debugElement.query(By.css('h1')).nativeElement;
|
||||
expect(header.innerHTML).toContain('item.edit.private.header');
|
||||
const description = fixture.debugElement.query(By.css('p')).nativeElement;
|
||||
expect(description.innerHTML).toContain('item.edit.private.description');
|
||||
|
@@ -73,7 +73,7 @@ describe('ItemPublicComponent', () => {
|
||||
});
|
||||
|
||||
it('should render a page with messages based on the \'public\' messageKey', () => {
|
||||
const header = fixture.debugElement.query(By.css('h2')).nativeElement;
|
||||
const header = fixture.debugElement.query(By.css('h1')).nativeElement;
|
||||
expect(header.innerHTML).toContain('item.edit.public.header');
|
||||
const description = fixture.debugElement.query(By.css('p')).nativeElement;
|
||||
expect(description.innerHTML).toContain('item.edit.public.description');
|
||||
|
@@ -75,7 +75,7 @@ describe('ItemReinstateComponent', () => {
|
||||
});
|
||||
|
||||
it('should render a page with messages based on the \'reinstate\' messageKey', () => {
|
||||
const header = fixture.debugElement.query(By.css('h2')).nativeElement;
|
||||
const header = fixture.debugElement.query(By.css('h1')).nativeElement;
|
||||
expect(header.innerHTML).toContain('item.edit.reinstate.header');
|
||||
const description = fixture.debugElement.query(By.css('p')).nativeElement;
|
||||
expect(description.innerHTML).toContain('item.edit.reinstate.description');
|
||||
|
@@ -1,10 +1,10 @@
|
||||
<h5>
|
||||
<h2 class="h4">
|
||||
{{getRelationshipMessageKey() | async | translate}}
|
||||
<button class="ml-2 btn btn-success" [disabled]="(hasChanges | async)" (click)="openLookup()">
|
||||
<i class="fas fa-plus"></i>
|
||||
<span class="d-none d-sm-inline"> {{"item.edit.relationships.edit.buttons.add" | translate}}</span>
|
||||
</button>
|
||||
</h5>
|
||||
</h2>
|
||||
<ng-container *ngVar="updates$ | async as updates">
|
||||
<ng-container *ngIf="updates && !(loading$ | async)">
|
||||
<ng-container *ngVar="updates | dsObjectValues as updateValues">
|
||||
|
@@ -73,7 +73,7 @@ describe('ItemWithdrawComponent', () => {
|
||||
});
|
||||
|
||||
it('should render a page with messages based on the \'withdraw\' messageKey', () => {
|
||||
const header = fixture.debugElement.query(By.css('h2')).nativeElement;
|
||||
const header = fixture.debugElement.query(By.css('h1')).nativeElement;
|
||||
expect(header.innerHTML).toContain('item.edit.withdraw.header');
|
||||
const description = fixture.debugElement.query(By.css('p')).nativeElement;
|
||||
expect(description.innerHTML).toContain('item.edit.withdraw.description');
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user