mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Merge remote-tracking branch 'upstream/main' into w2p-111326_fix-status-code-object-not-found-7.4
This commit is contained in:
@@ -152,7 +152,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@angular-eslint/no-attribute-decorator": "error",
|
"@angular-eslint/no-attribute-decorator": "error",
|
||||||
"@angular-eslint/no-forward-ref": "error",
|
|
||||||
"@angular-eslint/no-output-native": "warn",
|
"@angular-eslint/no-output-native": "warn",
|
||||||
"@angular-eslint/no-output-on-prefix": "warn",
|
"@angular-eslint/no-output-on-prefix": "warn",
|
||||||
"@angular-eslint/no-conflicting-lifecycle": "warn",
|
"@angular-eslint/no-conflicting-lifecycle": "warn",
|
||||||
|
31
.github/workflows/build.yml
vendored
31
.github/workflows/build.yml
vendored
@@ -33,12 +33,12 @@ jobs:
|
|||||||
#CHROME_VERSION: "90.0.4430.212-1"
|
#CHROME_VERSION: "90.0.4430.212-1"
|
||||||
# Bump Node heap size (OOM in CI after upgrading to Angular 15)
|
# Bump Node heap size (OOM in CI after upgrading to Angular 15)
|
||||||
NODE_OPTIONS: '--max-old-space-size=4096'
|
NODE_OPTIONS: '--max-old-space-size=4096'
|
||||||
# Project name to use when running docker-compose prior to e2e tests
|
# Project name to use when running "docker compose" prior to e2e tests
|
||||||
COMPOSE_PROJECT_NAME: 'ci'
|
COMPOSE_PROJECT_NAME: 'ci'
|
||||||
strategy:
|
strategy:
|
||||||
# Create a matrix of Node versions to test against (in parallel)
|
# Create a matrix of Node versions to test against (in parallel)
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [16.x, 18.x]
|
node-version: [18.x, 20.x]
|
||||||
# Do NOT exit immediately if one matrix job fails
|
# Do NOT exit immediately if one matrix job fails
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
# These are the actual CI steps to perform per job
|
# These are the actual CI steps to perform per job
|
||||||
@@ -74,7 +74,7 @@ jobs:
|
|||||||
id: yarn-cache-dir-path
|
id: yarn-cache-dir-path
|
||||||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
||||||
- name: Cache Yarn dependencies
|
- name: Cache Yarn dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
# Cache entire Yarn cache directory (see previous step)
|
# Cache entire Yarn cache directory (see previous step)
|
||||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||||
@@ -101,19 +101,19 @@ jobs:
|
|||||||
# so that it can be shared with the 'codecov' job (see below)
|
# so that it can be shared with the 'codecov' job (see below)
|
||||||
# NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286
|
# NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286
|
||||||
- name: Upload code coverage report to Artifact
|
- name: Upload code coverage report to Artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
if: matrix.node-version == '18.x'
|
if: matrix.node-version == '18.x'
|
||||||
with:
|
with:
|
||||||
name: dspace-angular coverage report
|
name: coverage-report-${{ matrix.node-version }}
|
||||||
path: 'coverage/dspace-angular/lcov.info'
|
path: 'coverage/dspace-angular/lcov.info'
|
||||||
retention-days: 14
|
retention-days: 14
|
||||||
|
|
||||||
# Using docker-compose start backend using CI configuration
|
# Using "docker compose" start backend using CI configuration
|
||||||
# and load assetstore from a cached copy
|
# and load assetstore from a cached copy
|
||||||
- name: Start DSpace REST Backend via Docker (for e2e tests)
|
- name: Start DSpace REST Backend via Docker (for e2e tests)
|
||||||
run: |
|
run: |
|
||||||
docker-compose -f ./docker/docker-compose-ci.yml up -d
|
docker compose -f ./docker/docker-compose-ci.yml up -d
|
||||||
docker-compose -f ./docker/cli.yml -f ./docker/cli.assetstore.yml run --rm dspace-cli
|
docker compose -f ./docker/cli.yml -f ./docker/cli.assetstore.yml run --rm dspace-cli
|
||||||
docker container ls
|
docker container ls
|
||||||
|
|
||||||
# Run integration tests via Cypress.io
|
# Run integration tests via Cypress.io
|
||||||
@@ -135,19 +135,19 @@ jobs:
|
|||||||
# Cypress always creates a video of all e2e tests (whether they succeeded or failed)
|
# Cypress always creates a video of all e2e tests (whether they succeeded or failed)
|
||||||
# Save those in an Artifact
|
# Save those in an Artifact
|
||||||
- name: Upload e2e test videos to Artifacts
|
- name: Upload e2e test videos to Artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
name: e2e-test-videos
|
name: e2e-test-videos-${{ matrix.node-version }}
|
||||||
path: cypress/videos
|
path: cypress/videos
|
||||||
|
|
||||||
# If e2e tests fail, Cypress creates a screenshot of what happened
|
# If e2e tests fail, Cypress creates a screenshot of what happened
|
||||||
# Save those in an Artifact
|
# Save those in an Artifact
|
||||||
- name: Upload e2e test failure screenshots to Artifacts
|
- name: Upload e2e test failure screenshots to Artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
if: failure()
|
if: failure()
|
||||||
with:
|
with:
|
||||||
name: e2e-test-screenshots
|
name: e2e-test-screenshots-${{ matrix.node-version }}
|
||||||
path: cypress/screenshots
|
path: cypress/screenshots
|
||||||
|
|
||||||
- name: Stop app (in case it stays up after e2e tests)
|
- name: Stop app (in case it stays up after e2e tests)
|
||||||
@@ -182,7 +182,7 @@ jobs:
|
|||||||
run: kill -9 $(lsof -t -i:4000)
|
run: kill -9 $(lsof -t -i:4000)
|
||||||
|
|
||||||
- name: Shutdown Docker containers
|
- name: Shutdown Docker containers
|
||||||
run: docker-compose -f ./docker/docker-compose-ci.yml down
|
run: docker compose -f ./docker/docker-compose-ci.yml down
|
||||||
|
|
||||||
# Codecov upload is a separate job in order to allow us to restart this separate from the entire build/test
|
# Codecov upload is a separate job in order to allow us to restart this separate from the entire build/test
|
||||||
# job above. This is necessary because Codecov uploads seem to randomly fail at times.
|
# job above. This is necessary because Codecov uploads seem to randomly fail at times.
|
||||||
@@ -197,7 +197,7 @@ jobs:
|
|||||||
|
|
||||||
# Download artifacts from previous 'tests' job
|
# Download artifacts from previous 'tests' job
|
||||||
- name: Download coverage artifacts
|
- name: Download coverage artifacts
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
# Now attempt upload to Codecov using its action.
|
# Now attempt upload to Codecov using its action.
|
||||||
# NOTE: We use a retry action to retry the Codecov upload if it fails the first time.
|
# NOTE: We use a retry action to retry the Codecov upload if it fails the first time.
|
||||||
@@ -207,11 +207,12 @@ jobs:
|
|||||||
- name: Upload coverage to Codecov.io
|
- name: Upload coverage to Codecov.io
|
||||||
uses: Wandalen/wretry.action@v1.3.0
|
uses: Wandalen/wretry.action@v1.3.0
|
||||||
with:
|
with:
|
||||||
action: codecov/codecov-action@v3
|
action: codecov/codecov-action@v4
|
||||||
# Ensure codecov-action throws an error when it fails to upload
|
# Ensure codecov-action throws an error when it fails to upload
|
||||||
# This allows us to auto-restart the action if an error is thrown
|
# This allows us to auto-restart the action if an error is thrown
|
||||||
with: |
|
with: |
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
# Try re-running action 5 times max
|
# Try re-running action 5 times max
|
||||||
attempt_limit: 5
|
attempt_limit: 5
|
||||||
# Run again in 30 seconds
|
# Run again in 30 seconds
|
||||||
|
2
.github/workflows/docker.yml
vendored
2
.github/workflows/docker.yml
vendored
@@ -28,7 +28,7 @@ jobs:
|
|||||||
# Use the reusable-docker-build.yml script from DSpace/DSpace repo to build our Docker image
|
# 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
|
uses: DSpace/DSpace/.github/workflows/reusable-docker-build.yml@main
|
||||||
with:
|
with:
|
||||||
build_id: dspace-angular
|
build_id: dspace-angular-dev
|
||||||
image_name: dspace/dspace-angular
|
image_name: dspace/dspace-angular
|
||||||
dockerfile_path: ./Dockerfile
|
dockerfile_path: ./Dockerfile
|
||||||
secrets:
|
secrets:
|
||||||
|
2
.github/workflows/issue_opened.yml
vendored
2
.github/workflows/issue_opened.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
|||||||
# Only add to project board if issue is flagged as "needs triage" or has no labels
|
# Only add to project board if issue is flagged as "needs triage" or has no labels
|
||||||
# NOTE: By default we flag new issues as "needs triage" in our issue template
|
# NOTE: By default we flag new issues as "needs triage" in our issue template
|
||||||
if: (contains(github.event.issue.labels.*.name, 'needs triage') || join(github.event.issue.labels.*.name) == '')
|
if: (contains(github.event.issue.labels.*.name, 'needs triage') || join(github.event.issue.labels.*.name) == '')
|
||||||
uses: actions/add-to-project@v0.5.0
|
uses: actions/add-to-project@v1.0.0
|
||||||
# Note, the authentication token below is an ORG level Secret.
|
# Note, the authentication token below is an ORG level Secret.
|
||||||
# It must be created/recreated manually via a personal access token with admin:org, project, public_repo permissions
|
# It must be created/recreated manually via a personal access token with admin:org, project, public_repo permissions
|
||||||
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token#permissions-for-the-github_token
|
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token#permissions-for-the-github_token
|
||||||
|
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
|
# Assign the PR to whomever created it. This is useful for visualizing assignments on project boards
|
||||||
# See https://github.com/toshimaru/auto-author-assign
|
# See https://github.com/toshimaru/auto-author-assign
|
||||||
- name: Assign PR to creator
|
- name: Assign PR to creator
|
||||||
uses: toshimaru/auto-author-assign@v2.0.1
|
uses: toshimaru/auto-author-assign@v2.1.0
|
||||||
|
@@ -17,6 +17,13 @@ ui:
|
|||||||
# Trust X-FORWARDED-* headers from proxies (default = true)
|
# Trust X-FORWARDED-* headers from proxies (default = true)
|
||||||
useProxies: true
|
useProxies: true
|
||||||
|
|
||||||
|
universal:
|
||||||
|
# Whether to inline "critical" styles into the server-side rendered HTML.
|
||||||
|
# Determining which styles are critical is a relatively expensive operation;
|
||||||
|
# this option can be disabled to boost server performance at the expense of
|
||||||
|
# loading smoothness.
|
||||||
|
inlineCriticalCss: true
|
||||||
|
|
||||||
# The REST API server settings
|
# The REST API server settings
|
||||||
# NOTE: these settings define which (publicly available) REST API to use. They are usually
|
# NOTE: these settings define which (publicly available) REST API to use. They are usually
|
||||||
# 'synced' with the 'dspace.server.url' setting in your backend's local.cfg.
|
# 'synced' with the 'dspace.server.url' setting in your backend's local.cfg.
|
||||||
@@ -400,10 +407,11 @@ mediaViewer:
|
|||||||
|
|
||||||
# Whether the end user agreement is required before users use the repository.
|
# Whether the end user agreement is required before users use the repository.
|
||||||
# If enabled, the user will be required to accept the agreement before they can use the repository.
|
# If enabled, the user will be required to accept the agreement before they can use the repository.
|
||||||
# And whether the privacy statement should exist or not.
|
# And whether the privacy statement/COAR notify support page should exist or not.
|
||||||
info:
|
info:
|
||||||
enableEndUserAgreement: true
|
enableEndUserAgreement: true
|
||||||
enablePrivacyStatement: true
|
enablePrivacyStatement: true
|
||||||
|
enableCOARNotifySupport: true
|
||||||
|
|
||||||
# Whether to enable Markdown (https://commonmark.org/) and MathJax (https://www.mathjax.org/)
|
# Whether to enable Markdown (https://commonmark.org/) and MathJax (https://www.mathjax.org/)
|
||||||
# display in supported metadata fields. By default, only dc.description.abstract is supported.
|
# display in supported metadata fields. By default, only dc.description.abstract is supported.
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { Options } from 'cypress-axe';
|
|
||||||
import { testA11y } from 'cypress/support/utils';
|
import { testA11y } from 'cypress/support/utils';
|
||||||
|
import { Options } from 'cypress-axe';
|
||||||
|
|
||||||
describe('Admin Sidebar', () => {
|
describe('Admin Sidebar', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -22,7 +22,7 @@ describe('Admin Sidebar', () => {
|
|||||||
// Currently all expandable sections have nested interactive elements
|
// Currently all expandable sections have nested interactive elements
|
||||||
// See https://github.com/DSpace/dspace-angular/issues/2178
|
// See https://github.com/DSpace/dspace-angular/issues/2178
|
||||||
'nested-interactive': { enabled: false },
|
'nested-interactive': { enabled: false },
|
||||||
}
|
},
|
||||||
} as Options);
|
} as Options);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
|
import '../support/commands';
|
||||||
|
|
||||||
import { REGEX_MATCH_NON_EMPTY_TEXT } from 'cypress/support/e2e';
|
import { REGEX_MATCH_NON_EMPTY_TEXT } from 'cypress/support/e2e';
|
||||||
import { testA11y } from 'cypress/support/utils';
|
import { testA11y } from 'cypress/support/utils';
|
||||||
import '../support/commands';
|
|
||||||
|
|
||||||
describe('Site Statistics Page', () => {
|
describe('Site Statistics Page', () => {
|
||||||
it('should load if you click on "Statistics" from homepage', () => {
|
it('should load if you click on "Statistics" from homepage', () => {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { Options } from 'cypress-axe';
|
|
||||||
import { testA11y } from 'cypress/support/utils';
|
import { testA11y } from 'cypress/support/utils';
|
||||||
|
import { Options } from 'cypress-axe';
|
||||||
|
|
||||||
const ITEM_EDIT_PAGE = '/items/'.concat(Cypress.env('DSPACE_TEST_ENTITY_PUBLICATION')).concat('/edit');
|
const ITEM_EDIT_PAGE = '/items/'.concat(Cypress.env('DSPACE_TEST_ENTITY_PUBLICATION')).concat('/edit');
|
||||||
|
|
||||||
@@ -54,8 +54,8 @@ describe('Edit Item > Bitstreams tab', () => {
|
|||||||
// Currently Bitstreams page loads a pagination component per Bundle
|
// Currently Bitstreams page loads a pagination component per Bundle
|
||||||
// and they all use the same 'id="p-dad"'.
|
// and they all use the same 'id="p-dad"'.
|
||||||
'duplicate-id': { enabled: false },
|
'duplicate-id': { enabled: false },
|
||||||
}
|
},
|
||||||
} as Options
|
} as Options,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -31,7 +31,7 @@ const page = {
|
|||||||
// Wait until above POST command responds before continuing
|
// Wait until above POST command responds before continuing
|
||||||
// (This ensures next action waits until logout completes)
|
// (This ensures next action waits until logout completes)
|
||||||
cy.wait('@logout');
|
cy.wait('@logout');
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('Login Modal', () => {
|
describe('Login Modal', () => {
|
||||||
|
@@ -10,7 +10,7 @@ const page = {
|
|||||||
},
|
},
|
||||||
submitQueryByPressingIcon() {
|
submitQueryByPressingIcon() {
|
||||||
cy.get('ds-themed-header [data-test="header-search-icon"]').click();
|
cy.get('ds-themed-header [data-test="header-search-icon"]').click();
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('Search from Navigation Bar', () => {
|
describe('Search from Navigation Bar', () => {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { Options } from 'cypress-axe';
|
|
||||||
import { testA11y } from 'cypress/support/utils';
|
import { testA11y } from 'cypress/support/utils';
|
||||||
|
import { Options } from 'cypress-axe';
|
||||||
|
|
||||||
describe('Search Page', () => {
|
describe('Search Page', () => {
|
||||||
// NOTE: these tests currently assume this query will return results!
|
// NOTE: these tests currently assume this query will return results!
|
||||||
@@ -49,9 +49,9 @@ describe('Search Page', () => {
|
|||||||
{
|
{
|
||||||
rules: {
|
rules: {
|
||||||
// Card titles fail this test currently
|
// Card titles fail this test currently
|
||||||
'heading-order': { enabled: false }
|
'heading-order': { enabled: false },
|
||||||
}
|
},
|
||||||
} as Options
|
} as Options,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -41,9 +41,9 @@ describe('New Submission page', () => {
|
|||||||
// All select boxes fail to have a name / aria-label.
|
// All select boxes fail to have a name / aria-label.
|
||||||
// This is a bug in ng-dynamic-forms and may require https://github.com/DSpace/dspace-angular/issues/2216
|
// This is a bug in ng-dynamic-forms and may require https://github.com/DSpace/dspace-angular/issues/2216
|
||||||
'select-name': { enabled: false },
|
'select-name': { enabled: false },
|
||||||
}
|
},
|
||||||
|
|
||||||
} as Options
|
} as Options,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Discard button should work
|
// Discard button should work
|
||||||
@@ -138,7 +138,7 @@ describe('New Submission page', () => {
|
|||||||
// Upload our DSpace logo via drag & drop onto submission form
|
// Upload our DSpace logo via drag & drop onto submission form
|
||||||
// cy.get('div#section_upload')
|
// cy.get('div#section_upload')
|
||||||
cy.get('div.ds-document-drop-zone').selectFile('src/assets/images/dspace-logo.png', {
|
cy.get('div.ds-document-drop-zone').selectFile('src/assets/images/dspace-logo.png', {
|
||||||
action: 'drag-drop'
|
action: 'drag-drop',
|
||||||
});
|
});
|
||||||
|
|
||||||
// Wait for upload to complete before proceeding
|
// Wait for upload to complete before proceeding
|
||||||
@@ -196,9 +196,9 @@ describe('New Submission page', () => {
|
|||||||
// Seem to require updating ng-bootstrap and https://github.com/DSpace/dspace-angular/issues/2216
|
// Seem to require updating ng-bootstrap and https://github.com/DSpace/dspace-angular/issues/2216
|
||||||
'aria-required-children': { enabled: false },
|
'aria-required-children': { enabled: false },
|
||||||
'nested-interactive': { enabled: false },
|
'nested-interactive': { enabled: false },
|
||||||
}
|
},
|
||||||
|
|
||||||
} as Options
|
} as Options,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Click the lookup button next to "Publication" field
|
// Click the lookup button next to "Publication" field
|
||||||
@@ -212,7 +212,7 @@ describe('New Submission page', () => {
|
|||||||
testA11y({
|
testA11y({
|
||||||
include: ['ds-dynamic-lookup-relation-modal'],
|
include: ['ds-dynamic-lookup-relation-modal'],
|
||||||
exclude: [
|
exclude: [
|
||||||
['ul.nav-tabs'] // Tabs at top of model have several issues which seem to be caused by ng-bootstrap
|
['ul.nav-tabs'], // Tabs at top of model have several issues which seem to be caused by ng-bootstrap
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -54,6 +54,6 @@ module.exports = (on, config) => {
|
|||||||
// Retrieve currently saved value of REST Domain
|
// Retrieve currently saved value of REST Domain
|
||||||
getRestBaseDomain() {
|
getRestBaseDomain() {
|
||||||
return REST_DOMAIN ;
|
return REST_DOMAIN ;
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@@ -3,8 +3,14 @@
|
|||||||
// See docs at https://docs.cypress.io/api/cypress-api/custom-commands
|
// See docs at https://docs.cypress.io/api/cypress-api/custom-commands
|
||||||
// ***********************************************
|
// ***********************************************
|
||||||
|
|
||||||
import { AuthTokenInfo, TOKENITEM } from 'src/app/core/auth/models/auth-token-info.model';
|
import {
|
||||||
import { DSPACE_XSRF_COOKIE, XSRF_REQUEST_HEADER } from 'src/app/core/xsrf/xsrf.constants';
|
AuthTokenInfo,
|
||||||
|
TOKENITEM,
|
||||||
|
} from 'src/app/core/auth/models/auth-token-info.model';
|
||||||
|
import {
|
||||||
|
DSPACE_XSRF_COOKIE,
|
||||||
|
XSRF_REQUEST_HEADER,
|
||||||
|
} from 'src/app/core/xsrf/xsrf.constants';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
|
||||||
// Declare Cypress namespace to help with Intellisense & code completion in IDEs
|
// Declare Cypress namespace to help with Intellisense & code completion in IDEs
|
||||||
@@ -67,7 +73,7 @@ function login(email: string, password: string): void {
|
|||||||
url: baseRestUrl + '/api/authn/login',
|
url: baseRestUrl + '/api/authn/login',
|
||||||
headers: { [XSRF_REQUEST_HEADER]: csrfToken },
|
headers: { [XSRF_REQUEST_HEADER]: csrfToken },
|
||||||
form: true, // indicates the body should be form urlencoded
|
form: true, // indicates the body should be form urlencoded
|
||||||
body: { user: email, password: password }
|
body: { user: email, password: password },
|
||||||
}).then((resp) => {
|
}).then((resp) => {
|
||||||
// We expect a successful login
|
// We expect a successful login
|
||||||
expect(resp.status).to.eq(200);
|
expect(resp.status).to.eq(200);
|
||||||
|
@@ -15,10 +15,10 @@
|
|||||||
|
|
||||||
// Import all custom Commands (from commands.ts) for all tests
|
// Import all custom Commands (from commands.ts) for all tests
|
||||||
import './commands';
|
import './commands';
|
||||||
|
|
||||||
// Import Cypress Axe tools for all tests
|
// Import Cypress Axe tools for all tests
|
||||||
// https://github.com/component-driven/cypress-axe
|
// https://github.com/component-driven/cypress-axe
|
||||||
import 'cypress-axe';
|
import 'cypress-axe';
|
||||||
|
|
||||||
import { DSPACE_XSRF_COOKIE } from 'src/app/core/xsrf/xsrf.constants';
|
import { DSPACE_XSRF_COOKIE } from 'src/app/core/xsrf/xsrf.constants';
|
||||||
|
|
||||||
// Runs once before all tests
|
// Runs once before all tests
|
||||||
|
@@ -7,7 +7,7 @@ import { Options } from 'cypress-axe';
|
|||||||
function terminalLog(violations: Result[]) {
|
function terminalLog(violations: Result[]) {
|
||||||
cy.task(
|
cy.task(
|
||||||
'log',
|
'log',
|
||||||
`${violations.length} accessibility violation${violations.length === 1 ? '' : 's'} ${violations.length === 1 ? 'was' : 'were'} detected`
|
`${violations.length} accessibility violation${violations.length === 1 ? '' : 's'} ${violations.length === 1 ? 'was' : 'were'} detected`,
|
||||||
);
|
);
|
||||||
// pluck specific keys to keep the table readable
|
// pluck specific keys to keep the table readable
|
||||||
const violationData = violations.map(
|
const violationData = violations.map(
|
||||||
@@ -17,8 +17,8 @@ function terminalLog(violations: Result[]) {
|
|||||||
description,
|
description,
|
||||||
helpUrl,
|
helpUrl,
|
||||||
nodes: nodes.length,
|
nodes: nodes.length,
|
||||||
html: nodes.map(node => node.html)
|
html: nodes.map(node => node.html),
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Print violations as an array, since 'node.html' above often breaks table alignment
|
// Print violations as an array, since 'node.html' above often breaks table alignment
|
||||||
@@ -38,7 +38,7 @@ export const testA11y = (context?: any, options?: Options) => {
|
|||||||
// Disable color contrast checks as they are inaccurate / result in a lot of false positives
|
// Disable color contrast checks as they are inaccurate / result in a lot of false positives
|
||||||
// See also open issues in axe-core: https://github.com/dequelabs/axe-core/labels/color%20contrast
|
// See also open issues in axe-core: https://github.com/dequelabs/axe-core/labels/color%20contrast
|
||||||
{ id: 'color-contrast', enabled: false },
|
{ id: 'color-contrast', enabled: false },
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
cy.checkA11y(context, options, terminalLog);
|
cy.checkA11y(context, options, terminalLog);
|
||||||
};
|
};
|
||||||
|
74
package.json
74
package.json
@@ -55,28 +55,28 @@
|
|||||||
"ts-node": "10.2.1"
|
"ts-node": "10.2.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "^15.2.8",
|
"@angular/animations": "^16.2.12",
|
||||||
"@angular/cdk": "^15.2.8",
|
"@angular/cdk": "^16.2.12",
|
||||||
"@angular/common": "^15.2.8",
|
"@angular/common": "^16.2.12",
|
||||||
"@angular/compiler": "^15.2.8",
|
"@angular/compiler": "^16.2.12",
|
||||||
"@angular/core": "^15.2.8",
|
"@angular/core": "^16.2.12",
|
||||||
"@angular/forms": "^15.2.8",
|
"@angular/forms": "^16.2.12",
|
||||||
"@angular/localize": "15.2.8",
|
"@angular/localize": "16.2.12",
|
||||||
"@angular/platform-browser": "^15.2.8",
|
"@angular/platform-browser": "^16.2.12",
|
||||||
"@angular/platform-browser-dynamic": "^15.2.8",
|
"@angular/platform-browser-dynamic": "^16.2.12",
|
||||||
"@angular/platform-server": "^15.2.8",
|
"@angular/platform-server": "^16.2.12",
|
||||||
"@angular/router": "^15.2.8",
|
"@angular/router": "^16.2.12",
|
||||||
"@babel/runtime": "7.21.0",
|
"@babel/runtime": "7.21.0",
|
||||||
"@kolkov/ngx-gallery": "^2.0.1",
|
"@kolkov/ngx-gallery": "^2.0.1",
|
||||||
"@material-ui/core": "^4.11.0",
|
"@material-ui/core": "^4.11.0",
|
||||||
"@material-ui/icons": "^4.11.3",
|
"@material-ui/icons": "^4.11.3",
|
||||||
"@ng-bootstrap/ng-bootstrap": "^11.0.0",
|
"@ng-bootstrap/ng-bootstrap": "^11.0.0",
|
||||||
"@ng-dynamic-forms/core": "^15.0.0",
|
"@ng-dynamic-forms/core": "^16.0.0",
|
||||||
"@ng-dynamic-forms/ui-ng-bootstrap": "^15.0.0",
|
"@ng-dynamic-forms/ui-ng-bootstrap": "^16.0.0",
|
||||||
"@ngrx/effects": "^15.4.0",
|
"@ngrx/effects": "^16.3.0",
|
||||||
"@ngrx/router-store": "^15.4.0",
|
"@ngrx/router-store": "^16.3.0",
|
||||||
"@ngrx/store": "^15.4.0",
|
"@ngrx/store": "^16.3.0",
|
||||||
"@nguniversal/express-engine": "^15.2.1",
|
"@nguniversal/express-engine": "^16.2.0",
|
||||||
"@ngx-translate/core": "^14.0.0",
|
"@ngx-translate/core": "^14.0.0",
|
||||||
"@nicky-lenaers/ngx-scroll-to": "^14.0.0",
|
"@nicky-lenaers/ngx-scroll-to": "^14.0.0",
|
||||||
"@types/grecaptcha": "^3.0.4",
|
"@types/grecaptcha": "^3.0.4",
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
"date-fns-tz": "^1.3.7",
|
"date-fns-tz": "^1.3.7",
|
||||||
"deepmerge": "^4.3.1",
|
"deepmerge": "^4.3.1",
|
||||||
"ejs": "^3.1.9",
|
"ejs": "^3.1.9",
|
||||||
"express": "^4.18.2",
|
"express": "^4.19.2",
|
||||||
"express-rate-limit": "^5.1.3",
|
"express-rate-limit": "^5.1.3",
|
||||||
"fast-json-patch": "^3.1.1",
|
"fast-json-patch": "^3.1.1",
|
||||||
"filesize": "^6.1.0",
|
"filesize": "^6.1.0",
|
||||||
@@ -110,17 +110,15 @@
|
|||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"lru-cache": "^7.14.1",
|
"lru-cache": "^7.14.1",
|
||||||
"markdown-it": "^13.0.1",
|
"markdown-it": "^13.0.1",
|
||||||
"markdown-it-mathjax3": "^4.3.2",
|
|
||||||
"mirador": "^3.3.0",
|
"mirador": "^3.3.0",
|
||||||
"mirador-dl-plugin": "^0.13.0",
|
"mirador-dl-plugin": "^0.13.0",
|
||||||
"mirador-share-plugin": "^0.11.0",
|
"mirador-share-plugin": "^0.11.0",
|
||||||
"morgan": "^1.10.0",
|
"morgan": "^1.10.0",
|
||||||
"ng-mocks": "^14.10.0",
|
"ng-mocks": "^14.10.0",
|
||||||
"ng2-file-upload": "1.4.0",
|
"ng2-file-upload": "5.0.0",
|
||||||
"ng2-nouislider": "^2.0.0",
|
"ng2-nouislider": "^2.0.0",
|
||||||
"ngx-infinite-scroll": "^15.0.0",
|
"ngx-infinite-scroll": "^16.0.0",
|
||||||
"ngx-pagination": "6.0.3",
|
"ngx-pagination": "6.0.3",
|
||||||
"ngx-sortablejs": "^11.1.0",
|
|
||||||
"ngx-ui-switch": "^14.1.0",
|
"ngx-ui-switch": "^14.1.0",
|
||||||
"nouislider": "^15.7.1",
|
"nouislider": "^15.7.1",
|
||||||
"pem": "1.14.7",
|
"pem": "1.14.7",
|
||||||
@@ -132,24 +130,24 @@
|
|||||||
"sortablejs": "1.15.0",
|
"sortablejs": "1.15.0",
|
||||||
"uuid": "^8.3.2",
|
"uuid": "^8.3.2",
|
||||||
"webfontloader": "1.6.28",
|
"webfontloader": "1.6.28",
|
||||||
"zone.js": "~0.11.5"
|
"zone.js": "~0.13.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-builders/custom-webpack": "~15.0.0",
|
"@angular-builders/custom-webpack": "~16.0.0",
|
||||||
"@angular-devkit/build-angular": "^15.2.6",
|
"@angular-devkit/build-angular": "^16.2.12",
|
||||||
"@angular-eslint/builder": "15.2.1",
|
"@angular-eslint/builder": "16.3.1",
|
||||||
"@angular-eslint/eslint-plugin": "15.2.1",
|
"@angular-eslint/eslint-plugin": "16.3.1",
|
||||||
"@angular-eslint/eslint-plugin-template": "15.2.1",
|
"@angular-eslint/eslint-plugin-template": "16.3.1",
|
||||||
"@angular-eslint/schematics": "15.2.1",
|
"@angular-eslint/schematics": "16.3.1",
|
||||||
"@angular-eslint/template-parser": "15.2.1",
|
"@angular-eslint/template-parser": "16.3.1",
|
||||||
"@angular/cli": "^16.0.4",
|
"@angular/cli": "^16.2.12",
|
||||||
"@angular/compiler-cli": "^15.2.8",
|
"@angular/compiler-cli": "^16.2.12",
|
||||||
"@angular/language-service": "^15.2.8",
|
"@angular/language-service": "^16.2.12",
|
||||||
"@cypress/schematic": "^1.5.0",
|
"@cypress/schematic": "^1.5.0",
|
||||||
"@fortawesome/fontawesome-free": "^6.4.0",
|
"@fortawesome/fontawesome-free": "^6.4.0",
|
||||||
"@ngrx/store-devtools": "^15.4.0",
|
"@ngrx/store-devtools": "^16.3.0",
|
||||||
"@ngtools/webpack": "^15.2.6",
|
"@ngtools/webpack": "^16.2.12",
|
||||||
"@nguniversal/builders": "^15.2.1",
|
"@nguniversal/builders": "^16.2.0",
|
||||||
"@types/deep-freeze": "0.1.2",
|
"@types/deep-freeze": "0.1.2",
|
||||||
"@types/ejs": "^3.1.2",
|
"@types/ejs": "^3.1.2",
|
||||||
"@types/express": "^4.17.17",
|
"@types/express": "^4.17.17",
|
||||||
@@ -186,7 +184,7 @@
|
|||||||
"karma-jasmine": "~4.0.0",
|
"karma-jasmine": "~4.0.0",
|
||||||
"karma-jasmine-html-reporter": "^1.5.0",
|
"karma-jasmine-html-reporter": "^1.5.0",
|
||||||
"karma-mocha-reporter": "2.2.5",
|
"karma-mocha-reporter": "2.2.5",
|
||||||
"ngx-mask": "^13.1.7",
|
"ngx-mask": "14.2.4",
|
||||||
"nodemon": "^2.0.22",
|
"nodemon": "^2.0.22",
|
||||||
"postcss": "^8.4",
|
"postcss": "^8.4",
|
||||||
"postcss-apply": "0.12.0",
|
"postcss-apply": "0.12.0",
|
||||||
@@ -202,7 +200,7 @@
|
|||||||
"sass-loader": "^12.6.0",
|
"sass-loader": "^12.6.0",
|
||||||
"sass-resources-loader": "^2.2.5",
|
"sass-resources-loader": "^2.2.5",
|
||||||
"ts-node": "^8.10.2",
|
"ts-node": "^8.10.2",
|
||||||
"typescript": "~4.8.4",
|
"typescript": "~4.9.3",
|
||||||
"webpack": "5.76.1",
|
"webpack": "5.76.1",
|
||||||
"webpack-bundle-analyzer": "^4.8.0",
|
"webpack-bundle-analyzer": "^4.8.0",
|
||||||
"webpack-cli": "^4.2.0",
|
"webpack-cli": "^4.2.0",
|
||||||
|
35
server.ts
35
server.ts
@@ -48,7 +48,7 @@ import { hasNoValue, hasValue } from './src/app/shared/empty.util';
|
|||||||
|
|
||||||
import { UIServerConfig } from './src/config/ui-server-config.interface';
|
import { UIServerConfig } from './src/config/ui-server-config.interface';
|
||||||
|
|
||||||
import { ServerAppModule } from './src/main.server';
|
import bootstrap from './src/main.server';
|
||||||
|
|
||||||
import { buildAppConfig } from './src/config/config.server';
|
import { buildAppConfig } from './src/config/config.server';
|
||||||
import { APP_CONFIG, AppConfig } from './src/config/app-config.interface';
|
import { APP_CONFIG, AppConfig } from './src/config/app-config.interface';
|
||||||
@@ -130,7 +130,8 @@ export function app() {
|
|||||||
// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
|
// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
|
||||||
server.engine('html', (_, options, callback) =>
|
server.engine('html', (_, options, callback) =>
|
||||||
ngExpressEngine({
|
ngExpressEngine({
|
||||||
bootstrap: ServerAppModule,
|
bootstrap,
|
||||||
|
inlineCriticalCss: environment.universal.inlineCriticalCss,
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: REQUEST,
|
provide: REQUEST,
|
||||||
@@ -142,10 +143,10 @@ export function app() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
provide: APP_CONFIG,
|
provide: APP_CONFIG,
|
||||||
useValue: environment
|
useValue: environment,
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
})(_, (options as any), callback)
|
})(_, (options as any), callback),
|
||||||
);
|
);
|
||||||
|
|
||||||
server.engine('ejs', ejs.renderFile);
|
server.engine('ejs', ejs.renderFile);
|
||||||
@@ -162,7 +163,7 @@ export function app() {
|
|||||||
server.get('/robots.txt', (req, res) => {
|
server.get('/robots.txt', (req, res) => {
|
||||||
res.setHeader('content-type', 'text/plain');
|
res.setHeader('content-type', 'text/plain');
|
||||||
res.render('assets/robots.txt.ejs', {
|
res.render('assets/robots.txt.ejs', {
|
||||||
'origin': req.protocol + '://' + req.headers.host
|
'origin': req.protocol + '://' + req.headers.host,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -177,7 +178,7 @@ export function app() {
|
|||||||
router.use('/sitemap**', createProxyMiddleware({
|
router.use('/sitemap**', createProxyMiddleware({
|
||||||
target: `${environment.rest.baseUrl}/sitemaps`,
|
target: `${environment.rest.baseUrl}/sitemaps`,
|
||||||
pathRewrite: path => path.replace(environment.ui.nameSpace, '/'),
|
pathRewrite: path => path.replace(environment.ui.nameSpace, '/'),
|
||||||
changeOrigin: true
|
changeOrigin: true,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -186,7 +187,7 @@ export function app() {
|
|||||||
router.use('/signposting**', createProxyMiddleware({
|
router.use('/signposting**', createProxyMiddleware({
|
||||||
target: `${environment.rest.baseUrl}`,
|
target: `${environment.rest.baseUrl}`,
|
||||||
pathRewrite: path => path.replace(environment.ui.nameSpace, '/'),
|
pathRewrite: path => path.replace(environment.ui.nameSpace, '/'),
|
||||||
changeOrigin: true
|
changeOrigin: true,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -197,7 +198,7 @@ export function app() {
|
|||||||
const RateLimit = require('express-rate-limit');
|
const RateLimit = require('express-rate-limit');
|
||||||
const limiter = new RateLimit({
|
const limiter = new RateLimit({
|
||||||
windowMs: (environment.ui as UIServerConfig).rateLimiter.windowMs,
|
windowMs: (environment.ui as UIServerConfig).rateLimiter.windowMs,
|
||||||
max: (environment.ui as UIServerConfig).rateLimiter.max
|
max: (environment.ui as UIServerConfig).rateLimiter.max,
|
||||||
});
|
});
|
||||||
server.use(limiter);
|
server.use(limiter);
|
||||||
}
|
}
|
||||||
@@ -325,7 +326,7 @@ function initCache() {
|
|||||||
botCache = new LRU( {
|
botCache = new LRU( {
|
||||||
max: environment.cache.serverSide.botCache.max,
|
max: environment.cache.serverSide.botCache.max,
|
||||||
ttl: environment.cache.serverSide.botCache.timeToLive,
|
ttl: environment.cache.serverSide.botCache.timeToLive,
|
||||||
allowStale: environment.cache.serverSide.botCache.allowStale
|
allowStale: environment.cache.serverSide.botCache.allowStale,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,7 +338,7 @@ function initCache() {
|
|||||||
anonymousCache = new LRU( {
|
anonymousCache = new LRU( {
|
||||||
max: environment.cache.serverSide.anonymousCache.max,
|
max: environment.cache.serverSide.anonymousCache.max,
|
||||||
ttl: environment.cache.serverSide.anonymousCache.timeToLive,
|
ttl: environment.cache.serverSide.anonymousCache.timeToLive,
|
||||||
allowStale: environment.cache.serverSide.anonymousCache.allowStale
|
allowStale: environment.cache.serverSide.anonymousCache.allowStale,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -415,7 +416,7 @@ function checkCacheForRequest(cacheName: string, cache: LRU<string, any>, req, r
|
|||||||
const key = getCacheKey(req);
|
const key = getCacheKey(req);
|
||||||
|
|
||||||
// Check if this page is in our cache
|
// Check if this page is in our cache
|
||||||
let cachedCopy = cache.get(key);
|
const cachedCopy = cache.get(key);
|
||||||
if (cachedCopy) {
|
if (cachedCopy) {
|
||||||
if (environment.cache.serverSide.debug) { console.log(`CACHE HIT FOR ${key} in ${cacheName} cache`); }
|
if (environment.cache.serverSide.debug) { console.log(`CACHE HIT FOR ${key} in ${cacheName} cache`); }
|
||||||
|
|
||||||
@@ -529,7 +530,7 @@ function serverStarted() {
|
|||||||
function createHttpsServer(keys) {
|
function createHttpsServer(keys) {
|
||||||
const listener = createServer({
|
const listener = createServer({
|
||||||
key: keys.serviceKey,
|
key: keys.serviceKey,
|
||||||
cert: keys.certificate
|
cert: keys.certificate,
|
||||||
}, app).listen(environment.ui.port, environment.ui.host, () => {
|
}, app).listen(environment.ui.port, environment.ui.host, () => {
|
||||||
serverStarted();
|
serverStarted();
|
||||||
});
|
});
|
||||||
@@ -597,7 +598,7 @@ function start() {
|
|||||||
if (serviceKey && certificate) {
|
if (serviceKey && certificate) {
|
||||||
createHttpsServer({
|
createHttpsServer({
|
||||||
serviceKey: serviceKey,
|
serviceKey: serviceKey,
|
||||||
certificate: certificate
|
certificate: certificate,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.warn('Disabling certificate validation and proceeding with a self-signed certificate. If this is a production server, it is recommended that you configure a valid certificate instead.');
|
console.warn('Disabling certificate validation and proceeding with a self-signed certificate. If this is a production server, it is recommended that you configure a valid certificate instead.');
|
||||||
@@ -606,7 +607,7 @@ function start() {
|
|||||||
|
|
||||||
createCertificate({
|
createCertificate({
|
||||||
days: 1,
|
days: 1,
|
||||||
selfSigned: true
|
selfSigned: true,
|
||||||
}, (error, keys) => {
|
}, (error, keys) => {
|
||||||
createHttpsServer(keys);
|
createHttpsServer(keys);
|
||||||
});
|
});
|
||||||
@@ -627,7 +628,7 @@ function healthCheck(req, res) {
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
res.status(error.response.status).send({
|
res.status(error.response.status).send({
|
||||||
error: error.message
|
error: error.message,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
117
src/app/access-control/access-control-routes.ts
Normal file
117
src/app/access-control/access-control-routes.ts
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
import { AbstractControl } from '@angular/forms';
|
||||||
|
import {
|
||||||
|
mapToCanActivate,
|
||||||
|
Route,
|
||||||
|
} from '@angular/router';
|
||||||
|
import {
|
||||||
|
DYNAMIC_ERROR_MESSAGES_MATCHER,
|
||||||
|
DynamicErrorMessagesMatcher,
|
||||||
|
} from '@ng-dynamic-forms/core';
|
||||||
|
|
||||||
|
import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
|
import { GroupAdministratorGuard } from '../core/data/feature-authorization/feature-authorization-guard/group-administrator.guard';
|
||||||
|
import { SiteAdministratorGuard } from '../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
|
||||||
|
import {
|
||||||
|
EPERSON_PATH,
|
||||||
|
GROUP_PATH,
|
||||||
|
} from './access-control-routing-paths';
|
||||||
|
import { BulkAccessComponent } from './bulk-access/bulk-access.component';
|
||||||
|
import { EPeopleRegistryComponent } from './epeople-registry/epeople-registry.component';
|
||||||
|
import { EPersonFormComponent } from './epeople-registry/eperson-form/eperson-form.component';
|
||||||
|
import { EPersonResolver } from './epeople-registry/eperson-resolver.service';
|
||||||
|
import { GroupFormComponent } from './group-registry/group-form/group-form.component';
|
||||||
|
import { GroupPageGuard } from './group-registry/group-page.guard';
|
||||||
|
import { GroupsRegistryComponent } from './group-registry/groups-registry.component';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Condition for displaying error messages on email form field
|
||||||
|
*/
|
||||||
|
export const ValidateEmailErrorStateMatcher: DynamicErrorMessagesMatcher =
|
||||||
|
(control: AbstractControl, model: any, hasFocus: boolean) => {
|
||||||
|
return (control.touched && !hasFocus) || (control.errors?.emailTaken && hasFocus);
|
||||||
|
};
|
||||||
|
|
||||||
|
const providers = [
|
||||||
|
{
|
||||||
|
provide: DYNAMIC_ERROR_MESSAGES_MATCHER,
|
||||||
|
useValue: ValidateEmailErrorStateMatcher,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
export const ROUTES: Route[] = [
|
||||||
|
{
|
||||||
|
path: EPERSON_PATH,
|
||||||
|
component: EPeopleRegistryComponent,
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: i18nBreadcrumbResolver,
|
||||||
|
},
|
||||||
|
providers,
|
||||||
|
data: { title: 'admin.access-control.epeople.title', breadcrumbKey: 'admin.access-control.epeople' },
|
||||||
|
canActivate: mapToCanActivate([SiteAdministratorGuard]),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: `${EPERSON_PATH}/create`,
|
||||||
|
component: EPersonFormComponent,
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: i18nBreadcrumbResolver,
|
||||||
|
},
|
||||||
|
providers,
|
||||||
|
data: { title: 'admin.access-control.epeople.add.title', breadcrumbKey: 'admin.access-control.epeople.add' },
|
||||||
|
canActivate: mapToCanActivate([SiteAdministratorGuard]),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: `${EPERSON_PATH}/:id/edit`,
|
||||||
|
component: EPersonFormComponent,
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: i18nBreadcrumbResolver,
|
||||||
|
ePerson: EPersonResolver,
|
||||||
|
},
|
||||||
|
providers,
|
||||||
|
data: { title: 'admin.access-control.epeople.edit.title', breadcrumbKey: 'admin.access-control.epeople.edit' },
|
||||||
|
canActivate: mapToCanActivate([SiteAdministratorGuard]),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: GROUP_PATH,
|
||||||
|
component: GroupsRegistryComponent,
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: i18nBreadcrumbResolver,
|
||||||
|
},
|
||||||
|
providers,
|
||||||
|
data: { title: 'admin.access-control.groups.title', breadcrumbKey: 'admin.access-control.groups' },
|
||||||
|
canActivate: mapToCanActivate([GroupAdministratorGuard]),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: `${GROUP_PATH}/create`,
|
||||||
|
component: GroupFormComponent,
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: i18nBreadcrumbResolver,
|
||||||
|
},
|
||||||
|
providers,
|
||||||
|
data: {
|
||||||
|
title: 'admin.access-control.groups.title.addGroup',
|
||||||
|
breadcrumbKey: 'admin.access-control.groups.addGroup',
|
||||||
|
},
|
||||||
|
canActivate: mapToCanActivate([GroupAdministratorGuard]),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: `${GROUP_PATH}/:groupId/edit`,
|
||||||
|
component: GroupFormComponent,
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: i18nBreadcrumbResolver,
|
||||||
|
},
|
||||||
|
providers,
|
||||||
|
data: {
|
||||||
|
title: 'admin.access-control.groups.title.singleGroup',
|
||||||
|
breadcrumbKey: 'admin.access-control.groups.singleGroup',
|
||||||
|
},
|
||||||
|
canActivate: mapToCanActivate([GroupPageGuard]),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'bulk-access',
|
||||||
|
component: BulkAccessComponent,
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: i18nBreadcrumbResolver,
|
||||||
|
},
|
||||||
|
data: { title: 'admin.access-control.bulk-access.title', breadcrumbKey: 'admin.access-control.bulk-access' },
|
||||||
|
canActivate: mapToCanActivate([SiteAdministratorGuard]),
|
||||||
|
},
|
||||||
|
];
|
@@ -1,94 +0,0 @@
|
|||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { RouterModule } from '@angular/router';
|
|
||||||
|
|
||||||
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
|
||||||
import { GroupAdministratorGuard } from '../core/data/feature-authorization/feature-authorization-guard/group-administrator.guard';
|
|
||||||
import { SiteAdministratorGuard } from '../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
|
|
||||||
import {
|
|
||||||
EPERSON_PATH,
|
|
||||||
GROUP_PATH,
|
|
||||||
} from './access-control-routing-paths';
|
|
||||||
import { BulkAccessComponent } from './bulk-access/bulk-access.component';
|
|
||||||
import { EPeopleRegistryComponent } from './epeople-registry/epeople-registry.component';
|
|
||||||
import { EPersonFormComponent } from './epeople-registry/eperson-form/eperson-form.component';
|
|
||||||
import { EPersonResolver } from './epeople-registry/eperson-resolver.service';
|
|
||||||
import { GroupFormComponent } from './group-registry/group-form/group-form.component';
|
|
||||||
import { GroupPageGuard } from './group-registry/group-page.guard';
|
|
||||||
import { GroupsRegistryComponent } from './group-registry/groups-registry.component';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
RouterModule.forChild([
|
|
||||||
{
|
|
||||||
path: EPERSON_PATH,
|
|
||||||
component: EPeopleRegistryComponent,
|
|
||||||
resolve: {
|
|
||||||
breadcrumb: I18nBreadcrumbResolver,
|
|
||||||
},
|
|
||||||
data: { title: 'admin.access-control.epeople.title', breadcrumbKey: 'admin.access-control.epeople' },
|
|
||||||
canActivate: [SiteAdministratorGuard],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: `${EPERSON_PATH}/create`,
|
|
||||||
component: EPersonFormComponent,
|
|
||||||
resolve: {
|
|
||||||
breadcrumb: I18nBreadcrumbResolver,
|
|
||||||
},
|
|
||||||
data: { title: 'admin.access-control.epeople.add.title', breadcrumbKey: 'admin.access-control.epeople.add' },
|
|
||||||
canActivate: [SiteAdministratorGuard],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: `${EPERSON_PATH}/:id/edit`,
|
|
||||||
component: EPersonFormComponent,
|
|
||||||
resolve: {
|
|
||||||
breadcrumb: I18nBreadcrumbResolver,
|
|
||||||
ePerson: EPersonResolver,
|
|
||||||
},
|
|
||||||
data: { title: 'admin.access-control.epeople.edit.title', breadcrumbKey: 'admin.access-control.epeople.edit' },
|
|
||||||
canActivate: [SiteAdministratorGuard],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: GROUP_PATH,
|
|
||||||
component: GroupsRegistryComponent,
|
|
||||||
resolve: {
|
|
||||||
breadcrumb: I18nBreadcrumbResolver,
|
|
||||||
},
|
|
||||||
data: { title: 'admin.access-control.groups.title', breadcrumbKey: 'admin.access-control.groups' },
|
|
||||||
canActivate: [GroupAdministratorGuard],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: `${GROUP_PATH}/create`,
|
|
||||||
component: GroupFormComponent,
|
|
||||||
resolve: {
|
|
||||||
breadcrumb: I18nBreadcrumbResolver,
|
|
||||||
},
|
|
||||||
data: { title: 'admin.access-control.groups.title.addGroup', breadcrumbKey: 'admin.access-control.groups.addGroup' },
|
|
||||||
canActivate: [GroupAdministratorGuard],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: `${GROUP_PATH}/:groupId/edit`,
|
|
||||||
component: GroupFormComponent,
|
|
||||||
resolve: {
|
|
||||||
breadcrumb: I18nBreadcrumbResolver,
|
|
||||||
},
|
|
||||||
data: { title: 'admin.access-control.groups.title.singleGroup', breadcrumbKey: 'admin.access-control.groups.singleGroup' },
|
|
||||||
canActivate: [GroupPageGuard],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'bulk-access',
|
|
||||||
component: BulkAccessComponent,
|
|
||||||
resolve: {
|
|
||||||
breadcrumb: I18nBreadcrumbResolver,
|
|
||||||
},
|
|
||||||
data: { title: 'admin.access-control.bulk-access.title', breadcrumbKey: 'admin.access-control.bulk-access' },
|
|
||||||
canActivate: [SiteAdministratorGuard],
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
],
|
|
||||||
})
|
|
||||||
/**
|
|
||||||
* Routing module for the AccessControl section of the admin sidebar
|
|
||||||
*/
|
|
||||||
export class AccessControlRoutingModule {
|
|
||||||
|
|
||||||
}
|
|
@@ -1,71 +0,0 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
|
||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { AbstractControl } from '@angular/forms';
|
|
||||||
import { RouterModule } from '@angular/router';
|
|
||||||
import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap';
|
|
||||||
import {
|
|
||||||
DYNAMIC_ERROR_MESSAGES_MATCHER,
|
|
||||||
DynamicErrorMessagesMatcher,
|
|
||||||
} from '@ng-dynamic-forms/core';
|
|
||||||
|
|
||||||
import { AccessControlFormModule } from '../shared/access-control-form-container/access-control-form.module';
|
|
||||||
import { FormModule } from '../shared/form/form.module';
|
|
||||||
import { SearchModule } from '../shared/search/search.module';
|
|
||||||
import { SharedModule } from '../shared/shared.module';
|
|
||||||
import { AccessControlRoutingModule } from './access-control-routing.module';
|
|
||||||
import { BulkAccessBrowseComponent } from './bulk-access/browse/bulk-access-browse.component';
|
|
||||||
import { BulkAccessComponent } from './bulk-access/bulk-access.component';
|
|
||||||
import { BulkAccessSettingsComponent } from './bulk-access/settings/bulk-access-settings.component';
|
|
||||||
import { EPeopleRegistryComponent } from './epeople-registry/epeople-registry.component';
|
|
||||||
import { EPersonFormComponent } from './epeople-registry/eperson-form/eperson-form.component';
|
|
||||||
import { GroupFormComponent } from './group-registry/group-form/group-form.component';
|
|
||||||
import { MembersListComponent } from './group-registry/group-form/members-list/members-list.component';
|
|
||||||
import { SubgroupsListComponent } from './group-registry/group-form/subgroup-list/subgroups-list.component';
|
|
||||||
import { GroupsRegistryComponent } from './group-registry/groups-registry.component';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Condition for displaying error messages on email form field
|
|
||||||
*/
|
|
||||||
export const ValidateEmailErrorStateMatcher: DynamicErrorMessagesMatcher =
|
|
||||||
(control: AbstractControl, model: any, hasFocus: boolean) => {
|
|
||||||
return (control.touched && !hasFocus) || (control.errors?.emailTaken && hasFocus);
|
|
||||||
};
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
CommonModule,
|
|
||||||
SharedModule,
|
|
||||||
RouterModule,
|
|
||||||
AccessControlRoutingModule,
|
|
||||||
FormModule,
|
|
||||||
NgbAccordionModule,
|
|
||||||
SearchModule,
|
|
||||||
AccessControlFormModule,
|
|
||||||
],
|
|
||||||
exports: [
|
|
||||||
MembersListComponent,
|
|
||||||
],
|
|
||||||
declarations: [
|
|
||||||
EPeopleRegistryComponent,
|
|
||||||
EPersonFormComponent,
|
|
||||||
GroupsRegistryComponent,
|
|
||||||
GroupFormComponent,
|
|
||||||
SubgroupsListComponent,
|
|
||||||
MembersListComponent,
|
|
||||||
BulkAccessComponent,
|
|
||||||
BulkAccessBrowseComponent,
|
|
||||||
BulkAccessSettingsComponent,
|
|
||||||
],
|
|
||||||
providers: [
|
|
||||||
{
|
|
||||||
provide: DYNAMIC_ERROR_MESSAGES_MATCHER,
|
|
||||||
useValue: ValidateEmailErrorStateMatcher,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
/**
|
|
||||||
* This module handles all components related to the access control pages
|
|
||||||
*/
|
|
||||||
export class AccessControlModule {
|
|
||||||
|
|
||||||
}
|
|
@@ -13,9 +13,15 @@ import { of } from 'rxjs';
|
|||||||
|
|
||||||
import { buildPaginatedList } from '../../../core/data/paginated-list.model';
|
import { buildPaginatedList } from '../../../core/data/paginated-list.model';
|
||||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||||
|
import { getMockThemeService } from '../../../shared/mocks/theme-service.mock';
|
||||||
|
import { ListableObjectComponentLoaderComponent } from '../../../shared/object-collection/shared/listable-object/listable-object-component-loader.component';
|
||||||
|
import { SelectableListItemControlComponent } from '../../../shared/object-collection/shared/selectable-list-item-control/selectable-list-item-control.component';
|
||||||
import { SelectableListService } from '../../../shared/object-list/selectable-list/selectable-list.service';
|
import { SelectableListService } from '../../../shared/object-list/selectable-list/selectable-list.service';
|
||||||
import { SelectableObject } from '../../../shared/object-list/selectable-list/selectable-list.service.spec';
|
import { SelectableObject } from '../../../shared/object-list/selectable-list/selectable-list.service.spec';
|
||||||
|
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
||||||
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
||||||
|
import { ThemedSearchComponent } from '../../../shared/search/themed-search.component';
|
||||||
|
import { ThemeService } from '../../../shared/theme-support/theme.service';
|
||||||
import { BulkAccessBrowseComponent } from './bulk-access-browse.component';
|
import { BulkAccessBrowseComponent } from './bulk-access-browse.component';
|
||||||
|
|
||||||
describe('BulkAccessBrowseComponent', () => {
|
describe('BulkAccessBrowseComponent', () => {
|
||||||
@@ -38,13 +44,27 @@ describe('BulkAccessBrowseComponent', () => {
|
|||||||
NgbAccordionModule,
|
NgbAccordionModule,
|
||||||
NgbNavModule,
|
NgbNavModule,
|
||||||
TranslateModule.forRoot(),
|
TranslateModule.forRoot(),
|
||||||
|
BulkAccessBrowseComponent,
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
{ provide: SelectableListService, useValue: selectableListService },
|
||||||
|
{ provide: ThemeService, useValue: getMockThemeService() },
|
||||||
],
|
],
|
||||||
declarations: [BulkAccessBrowseComponent],
|
|
||||||
providers: [ { provide: SelectableListService, useValue: selectableListService } ],
|
|
||||||
schemas: [
|
schemas: [
|
||||||
NO_ERRORS_SCHEMA,
|
NO_ERRORS_SCHEMA,
|
||||||
],
|
],
|
||||||
}).compileComponents();
|
})
|
||||||
|
.overrideComponent(BulkAccessBrowseComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [
|
||||||
|
PaginationComponent,
|
||||||
|
ThemedSearchComponent,
|
||||||
|
SelectableListItemControlComponent,
|
||||||
|
ListableObjectComponentLoaderComponent,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@@ -1,9 +1,20 @@
|
|||||||
|
import {
|
||||||
|
AsyncPipe,
|
||||||
|
NgForOf,
|
||||||
|
NgIf,
|
||||||
|
} from '@angular/common';
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
Input,
|
Input,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
import {
|
||||||
|
NgbAccordionModule,
|
||||||
|
NgbNavModule,
|
||||||
|
} from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { NgxPaginationModule } from 'ngx-pagination';
|
||||||
import {
|
import {
|
||||||
BehaviorSubject,
|
BehaviorSubject,
|
||||||
Subscription,
|
Subscription,
|
||||||
@@ -20,13 +31,18 @@ import {
|
|||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||||
import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-page.component';
|
import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-configuration.service';
|
||||||
import { hasValue } from '../../../shared/empty.util';
|
import { hasValue } from '../../../shared/empty.util';
|
||||||
import { ListableObject } from '../../../shared/object-collection/shared/listable-object.model';
|
import { ListableObject } from '../../../shared/object-collection/shared/listable-object.model';
|
||||||
|
import { ListableObjectComponentLoaderComponent } from '../../../shared/object-collection/shared/listable-object/listable-object-component-loader.component';
|
||||||
|
import { SelectableListItemControlComponent } from '../../../shared/object-collection/shared/selectable-list-item-control/selectable-list-item-control.component';
|
||||||
import { SelectableListState } from '../../../shared/object-list/selectable-list/selectable-list.reducer';
|
import { SelectableListState } from '../../../shared/object-list/selectable-list/selectable-list.reducer';
|
||||||
import { SelectableListService } from '../../../shared/object-list/selectable-list/selectable-list.service';
|
import { SelectableListService } from '../../../shared/object-list/selectable-list/selectable-list.service';
|
||||||
|
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
||||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||||
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
||||||
|
import { ThemedSearchComponent } from '../../../shared/search/themed-search.component';
|
||||||
|
import { BrowserOnlyPipe } from '../../../shared/utils/browser-only.pipe';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-bulk-access-browse',
|
selector: 'ds-bulk-access-browse',
|
||||||
@@ -38,6 +54,21 @@ import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.ut
|
|||||||
useClass: SearchConfigurationService,
|
useClass: SearchConfigurationService,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
imports: [
|
||||||
|
PaginationComponent,
|
||||||
|
AsyncPipe,
|
||||||
|
NgbAccordionModule,
|
||||||
|
TranslateModule,
|
||||||
|
NgIf,
|
||||||
|
NgbNavModule,
|
||||||
|
ThemedSearchComponent,
|
||||||
|
BrowserOnlyPipe,
|
||||||
|
NgForOf,
|
||||||
|
NgxPaginationModule,
|
||||||
|
SelectableListItemControlComponent,
|
||||||
|
ListableObjectComponentLoaderComponent,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
export class BulkAccessBrowseComponent implements OnInit, OnDestroy {
|
export class BulkAccessBrowseComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
|
@@ -9,12 +9,15 @@ import { of } from 'rxjs';
|
|||||||
|
|
||||||
import { Process } from '../../process-page/processes/process.model';
|
import { Process } from '../../process-page/processes/process.model';
|
||||||
import { BulkAccessControlService } from '../../shared/access-control-form-container/bulk-access-control.service';
|
import { BulkAccessControlService } from '../../shared/access-control-form-container/bulk-access-control.service';
|
||||||
|
import { getMockThemeService } from '../../shared/mocks/theme-service.mock';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
import { SelectableListState } from '../../shared/object-list/selectable-list/selectable-list.reducer';
|
import { SelectableListState } from '../../shared/object-list/selectable-list/selectable-list.reducer';
|
||||||
import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service';
|
import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||||
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
||||||
|
import { ThemeService } from '../../shared/theme-support/theme.service';
|
||||||
import { BulkAccessComponent } from './bulk-access.component';
|
import { BulkAccessComponent } from './bulk-access.component';
|
||||||
|
import { BulkAccessSettingsComponent } from './settings/bulk-access-settings.component';
|
||||||
|
|
||||||
describe('BulkAccessComponent', () => {
|
describe('BulkAccessComponent', () => {
|
||||||
let component: BulkAccessComponent;
|
let component: BulkAccessComponent;
|
||||||
@@ -74,14 +77,22 @@ describe('BulkAccessComponent', () => {
|
|||||||
imports: [
|
imports: [
|
||||||
RouterTestingModule,
|
RouterTestingModule,
|
||||||
TranslateModule.forRoot(),
|
TranslateModule.forRoot(),
|
||||||
|
BulkAccessComponent,
|
||||||
],
|
],
|
||||||
declarations: [ BulkAccessComponent ],
|
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: BulkAccessControlService, useValue: bulkAccessControlServiceMock },
|
{ provide: BulkAccessControlService, useValue: bulkAccessControlServiceMock },
|
||||||
{ provide: NotificationsService, useValue: NotificationsServiceStub },
|
{ provide: NotificationsService, useValue: NotificationsServiceStub },
|
||||||
{ provide: SelectableListService, useValue: selectableListServiceMock },
|
{ provide: SelectableListService, useValue: selectableListServiceMock },
|
||||||
|
{ provide: ThemeService, useValue: getMockThemeService() },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
|
})
|
||||||
|
.overrideComponent(BulkAccessComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [
|
||||||
|
BulkAccessSettingsComponent,
|
||||||
|
],
|
||||||
|
},
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
});
|
});
|
||||||
|
@@ -3,6 +3,7 @@ import {
|
|||||||
OnInit,
|
OnInit,
|
||||||
ViewChild,
|
ViewChild,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import {
|
import {
|
||||||
BehaviorSubject,
|
BehaviorSubject,
|
||||||
Subscription,
|
Subscription,
|
||||||
@@ -15,12 +16,19 @@ import {
|
|||||||
import { BulkAccessControlService } from '../../shared/access-control-form-container/bulk-access-control.service';
|
import { BulkAccessControlService } from '../../shared/access-control-form-container/bulk-access-control.service';
|
||||||
import { SelectableListState } from '../../shared/object-list/selectable-list/selectable-list.reducer';
|
import { SelectableListState } from '../../shared/object-list/selectable-list/selectable-list.reducer';
|
||||||
import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service';
|
import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service';
|
||||||
|
import { BulkAccessBrowseComponent } from './browse/bulk-access-browse.component';
|
||||||
import { BulkAccessSettingsComponent } from './settings/bulk-access-settings.component';
|
import { BulkAccessSettingsComponent } from './settings/bulk-access-settings.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-bulk-access',
|
selector: 'ds-bulk-access',
|
||||||
templateUrl: './bulk-access.component.html',
|
templateUrl: './bulk-access.component.html',
|
||||||
styleUrls: ['./bulk-access.component.scss'],
|
styleUrls: ['./bulk-access.component.scss'],
|
||||||
|
imports: [
|
||||||
|
TranslateModule,
|
||||||
|
BulkAccessSettingsComponent,
|
||||||
|
BulkAccessBrowseComponent,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
export class BulkAccessComponent implements OnInit {
|
export class BulkAccessComponent implements OnInit {
|
||||||
|
|
||||||
|
@@ -6,6 +6,7 @@ import {
|
|||||||
import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
|
import { AccessControlFormContainerComponent } from '../../../shared/access-control-form-container/access-control-form-container.component';
|
||||||
import { BulkAccessSettingsComponent } from './bulk-access-settings.component';
|
import { BulkAccessSettingsComponent } from './bulk-access-settings.component';
|
||||||
|
|
||||||
describe('BulkAccessSettingsComponent', () => {
|
describe('BulkAccessSettingsComponent', () => {
|
||||||
@@ -45,10 +46,13 @@ describe('BulkAccessSettingsComponent', () => {
|
|||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [NgbAccordionModule, TranslateModule.forRoot()],
|
imports: [NgbAccordionModule, TranslateModule.forRoot(), BulkAccessSettingsComponent],
|
||||||
declarations: [BulkAccessSettingsComponent],
|
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
})
|
||||||
|
.overrideComponent(BulkAccessSettingsComponent, {
|
||||||
|
remove: { imports: [AccessControlFormContainerComponent] },
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@@ -1,7 +1,10 @@
|
|||||||
|
import { NgIf } from '@angular/common';
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
ViewChild,
|
ViewChild,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { AccessControlFormContainerComponent } from '../../../shared/access-control-form-container/access-control-form-container.component';
|
import { AccessControlFormContainerComponent } from '../../../shared/access-control-form-container/access-control-form-container.component';
|
||||||
|
|
||||||
@@ -10,6 +13,13 @@ import { AccessControlFormContainerComponent } from '../../../shared/access-cont
|
|||||||
templateUrl: 'bulk-access-settings.component.html',
|
templateUrl: 'bulk-access-settings.component.html',
|
||||||
styleUrls: ['./bulk-access-settings.component.scss'],
|
styleUrls: ['./bulk-access-settings.component.scss'],
|
||||||
exportAs: 'dsBulkSettings',
|
exportAs: 'dsBulkSettings',
|
||||||
|
imports: [
|
||||||
|
NgbAccordionModule,
|
||||||
|
TranslateModule,
|
||||||
|
NgIf,
|
||||||
|
AccessControlFormContainerComponent,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
export class BulkAccessSettingsComponent {
|
export class BulkAccessSettingsComponent {
|
||||||
|
|
||||||
|
@@ -19,6 +19,7 @@ import {
|
|||||||
By,
|
By,
|
||||||
} from '@angular/platform-browser';
|
} from '@angular/platform-browser';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import {
|
import {
|
||||||
NgbModal,
|
NgbModal,
|
||||||
NgbModule,
|
NgbModule,
|
||||||
@@ -42,8 +43,11 @@ import { EPerson } from '../../core/eperson/models/eperson.model';
|
|||||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||||
import { PageInfo } from '../../core/shared/page-info.model';
|
import { PageInfo } from '../../core/shared/page-info.model';
|
||||||
import { FormBuilderService } from '../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../shared/form/builder/form-builder.service';
|
||||||
|
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
|
||||||
import { getMockFormBuilderService } from '../../shared/mocks/form-builder-service.mock';
|
import { getMockFormBuilderService } from '../../shared/mocks/form-builder-service.mock';
|
||||||
|
import { RouterMock } from '../../shared/mocks/router.mock';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
|
import { PaginationComponent } from '../../shared/pagination/pagination.component';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||||
import {
|
import {
|
||||||
EPersonMock,
|
EPersonMock,
|
||||||
@@ -51,8 +55,8 @@ import {
|
|||||||
} from '../../shared/testing/eperson.mock';
|
} from '../../shared/testing/eperson.mock';
|
||||||
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
||||||
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
|
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
|
||||||
import { RouterStub } from '../../shared/testing/router.stub';
|
|
||||||
import { EPeopleRegistryComponent } from './epeople-registry.component';
|
import { EPeopleRegistryComponent } from './epeople-registry.component';
|
||||||
|
import { EPersonFormComponent } from './eperson-form/eperson-form.component';
|
||||||
|
|
||||||
describe('EPeopleRegistryComponent', () => {
|
describe('EPeopleRegistryComponent', () => {
|
||||||
let component: EPeopleRegistryComponent;
|
let component: EPeopleRegistryComponent;
|
||||||
@@ -145,22 +149,30 @@ describe('EPeopleRegistryComponent', () => {
|
|||||||
builderService = getMockFormBuilderService();
|
builderService = getMockFormBuilderService();
|
||||||
|
|
||||||
paginationService = new PaginationServiceStub();
|
paginationService = new PaginationServiceStub();
|
||||||
await TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule,
|
imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule, RouterTestingModule.withRoutes([]),
|
||||||
TranslateModule.forRoot(),
|
TranslateModule.forRoot(), EPeopleRegistryComponent],
|
||||||
],
|
|
||||||
declarations: [EPeopleRegistryComponent],
|
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: EPersonDataService, useValue: ePersonDataServiceStub },
|
{ provide: EPersonDataService, useValue: ePersonDataServiceStub },
|
||||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
||||||
{ provide: AuthorizationDataService, useValue: authorizationService },
|
{ provide: AuthorizationDataService, useValue: authorizationService },
|
||||||
{ provide: FormBuilderService, useValue: builderService },
|
{ provide: FormBuilderService, useValue: builderService },
|
||||||
{ provide: Router, useValue: new RouterStub() },
|
{ provide: Router, useValue: new RouterMock() },
|
||||||
{ provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) },
|
{ provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) },
|
||||||
{ provide: PaginationService, useValue: paginationService },
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
})
|
||||||
|
.overrideComponent(EPeopleRegistryComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [
|
||||||
|
EPersonFormComponent,
|
||||||
|
ThemedLoadingComponent,
|
||||||
|
PaginationComponent,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@@ -1,12 +1,27 @@
|
|||||||
|
import {
|
||||||
|
AsyncPipe,
|
||||||
|
NgClass,
|
||||||
|
NgForOf,
|
||||||
|
NgIf,
|
||||||
|
} from '@angular/common';
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { UntypedFormBuilder } from '@angular/forms';
|
import {
|
||||||
import { Router } from '@angular/router';
|
ReactiveFormsModule,
|
||||||
|
UntypedFormBuilder,
|
||||||
|
} from '@angular/forms';
|
||||||
|
import {
|
||||||
|
Router,
|
||||||
|
RouterModule,
|
||||||
|
} from '@angular/router';
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import {
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
import {
|
import {
|
||||||
BehaviorSubject,
|
BehaviorSubject,
|
||||||
combineLatest,
|
combineLatest,
|
||||||
@@ -40,16 +55,32 @@ import {
|
|||||||
import { PageInfo } from '../../core/shared/page-info.model';
|
import { PageInfo } from '../../core/shared/page-info.model';
|
||||||
import { ConfirmationModalComponent } from '../../shared/confirmation-modal/confirmation-modal.component';
|
import { ConfirmationModalComponent } from '../../shared/confirmation-modal/confirmation-modal.component';
|
||||||
import { hasValue } from '../../shared/empty.util';
|
import { hasValue } from '../../shared/empty.util';
|
||||||
|
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
|
import { PaginationComponent } from '../../shared/pagination/pagination.component';
|
||||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
||||||
import {
|
import {
|
||||||
getEPersonEditRoute,
|
getEPersonEditRoute,
|
||||||
getEPersonsRoute,
|
getEPersonsRoute,
|
||||||
} from '../access-control-routing-paths';
|
} from '../access-control-routing-paths';
|
||||||
|
import { EPersonFormComponent } from './eperson-form/eperson-form.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-epeople-registry',
|
selector: 'ds-epeople-registry',
|
||||||
templateUrl: './epeople-registry.component.html',
|
templateUrl: './epeople-registry.component.html',
|
||||||
|
imports: [
|
||||||
|
TranslateModule,
|
||||||
|
RouterModule,
|
||||||
|
AsyncPipe,
|
||||||
|
NgIf,
|
||||||
|
EPersonFormComponent,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
ThemedLoadingComponent,
|
||||||
|
PaginationComponent,
|
||||||
|
NgClass,
|
||||||
|
NgForOf,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* A component used for managing all existing epeople within the repository.
|
* A component used for managing all existing epeople within the repository.
|
||||||
|
@@ -46,9 +46,12 @@ import { EPerson } from '../../../core/eperson/models/eperson.model';
|
|||||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||||
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
||||||
|
import { FormComponent } from '../../../shared/form/form.component';
|
||||||
|
import { ThemedLoadingComponent } from '../../../shared/loading/themed-loading.component';
|
||||||
import { getMockFormBuilderService } from '../../../shared/mocks/form-builder-service.mock';
|
import { getMockFormBuilderService } from '../../../shared/mocks/form-builder-service.mock';
|
||||||
import { TranslateLoaderMock } from '../../../shared/mocks/translate-loader.mock';
|
import { TranslateLoaderMock } from '../../../shared/mocks/translate-loader.mock';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||||
import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub';
|
import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub';
|
||||||
import { AuthServiceStub } from '../../../shared/testing/auth-service.stub';
|
import { AuthServiceStub } from '../../../shared/testing/auth-service.stub';
|
||||||
@@ -231,8 +234,6 @@ describe('EPersonFormComponent', () => {
|
|||||||
useClass: TranslateLoaderMock,
|
useClass: TranslateLoaderMock,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
],
|
|
||||||
declarations: [
|
|
||||||
EPersonFormComponent,
|
EPersonFormComponent,
|
||||||
HasNoValuePipe,
|
HasNoValuePipe,
|
||||||
],
|
],
|
||||||
@@ -251,7 +252,11 @@ describe('EPersonFormComponent', () => {
|
|||||||
EPeopleRegistryComponent,
|
EPeopleRegistryComponent,
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
})
|
||||||
|
.overrideComponent(EPersonFormComponent, {
|
||||||
|
remove: { imports: [ ThemedLoadingComponent, PaginationComponent,FormComponent] },
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
epersonRegistrationService = jasmine.createSpyObj('epersonRegistrationService', {
|
epersonRegistrationService = jasmine.createSpyObj('epersonRegistrationService', {
|
||||||
|
@@ -1,3 +1,9 @@
|
|||||||
|
import {
|
||||||
|
AsyncPipe,
|
||||||
|
NgClass,
|
||||||
|
NgFor,
|
||||||
|
NgIf,
|
||||||
|
} from '@angular/common';
|
||||||
import {
|
import {
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
Component,
|
Component,
|
||||||
@@ -10,6 +16,7 @@ import { UntypedFormGroup } from '@angular/forms';
|
|||||||
import {
|
import {
|
||||||
ActivatedRoute,
|
ActivatedRoute,
|
||||||
Router,
|
Router,
|
||||||
|
RouterLink,
|
||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import {
|
import {
|
||||||
@@ -18,7 +25,10 @@ import {
|
|||||||
DynamicFormLayout,
|
DynamicFormLayout,
|
||||||
DynamicInputModel,
|
DynamicInputModel,
|
||||||
} from '@ng-dynamic-forms/core';
|
} from '@ng-dynamic-forms/core';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import {
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
import {
|
import {
|
||||||
combineLatest as observableCombineLatest,
|
combineLatest as observableCombineLatest,
|
||||||
Observable,
|
Observable,
|
||||||
@@ -58,15 +68,32 @@ import { TYPE_REQUEST_FORGOT } from '../../../register-email-form/register-email
|
|||||||
import { ConfirmationModalComponent } from '../../../shared/confirmation-modal/confirmation-modal.component';
|
import { ConfirmationModalComponent } from '../../../shared/confirmation-modal/confirmation-modal.component';
|
||||||
import { hasValue } from '../../../shared/empty.util';
|
import { hasValue } from '../../../shared/empty.util';
|
||||||
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
||||||
|
import { FormComponent } from '../../../shared/form/form.component';
|
||||||
|
import { ThemedLoadingComponent } from '../../../shared/loading/themed-loading.component';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
||||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||||
|
import { HasNoValuePipe } from '../../../shared/utils/has-no-value.pipe';
|
||||||
import { getEPersonsRoute } from '../../access-control-routing-paths';
|
import { getEPersonsRoute } from '../../access-control-routing-paths';
|
||||||
import { ValidateEmailNotTaken } from './validators/email-taken.validator';
|
import { ValidateEmailNotTaken } from './validators/email-taken.validator';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-eperson-form',
|
selector: 'ds-eperson-form',
|
||||||
templateUrl: './eperson-form.component.html',
|
templateUrl: './eperson-form.component.html',
|
||||||
|
imports: [
|
||||||
|
FormComponent,
|
||||||
|
NgIf,
|
||||||
|
NgFor,
|
||||||
|
AsyncPipe,
|
||||||
|
TranslateModule,
|
||||||
|
NgClass,
|
||||||
|
ThemedLoadingComponent,
|
||||||
|
PaginationComponent,
|
||||||
|
RouterLink,
|
||||||
|
HasNoValuePipe,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* A form used for creating and editing EPeople
|
* A form used for creating and editing EPeople
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
ActivatedRouteSnapshot,
|
ActivatedRouteSnapshot,
|
||||||
Resolve,
|
|
||||||
RouterStateSnapshot,
|
RouterStateSnapshot,
|
||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
@@ -27,7 +26,7 @@ export const EPERSON_EDIT_FOLLOW_LINKS: FollowLinkConfig<EPerson>[] = [
|
|||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class EPersonResolver implements Resolve<RemoteData<EPerson>> {
|
export class EPersonResolver {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected ePersonService: EPersonDataService,
|
protected ePersonService: EPersonDataService,
|
||||||
|
@@ -53,7 +53,11 @@ import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
|||||||
import { NoContent } from '../../../core/shared/NoContent.model';
|
import { NoContent } from '../../../core/shared/NoContent.model';
|
||||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||||
import { UUIDService } from '../../../core/shared/uuid.service';
|
import { UUIDService } from '../../../core/shared/uuid.service';
|
||||||
|
import { XSRFService } from '../../../core/xsrf/xsrf.service';
|
||||||
|
import { AlertComponent } from '../../../shared/alert/alert.component';
|
||||||
|
import { ContextHelpDirective } from '../../../shared/context-help.directive';
|
||||||
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
||||||
|
import { FormComponent } from '../../../shared/form/form.component';
|
||||||
import { DSONameServiceMock } from '../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../shared/mocks/dso-name.service.mock';
|
||||||
import { getMockFormBuilderService } from '../../../shared/mocks/form-builder-service.mock';
|
import { getMockFormBuilderService } from '../../../shared/mocks/form-builder-service.mock';
|
||||||
import { RouterMock } from '../../../shared/mocks/router.mock';
|
import { RouterMock } from '../../../shared/mocks/router.mock';
|
||||||
@@ -67,6 +71,8 @@ import {
|
|||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
import { TranslateLoaderMock } from '../../../shared/testing/translate-loader.mock';
|
import { TranslateLoaderMock } from '../../../shared/testing/translate-loader.mock';
|
||||||
import { GroupFormComponent } from './group-form.component';
|
import { GroupFormComponent } from './group-form.component';
|
||||||
|
import { MembersListComponent } from './members-list/members-list.component';
|
||||||
|
import { SubgroupsListComponent } from './subgroup-list/subgroups-list.component';
|
||||||
import { ValidateGroupExists } from './validators/group-exists.validator';
|
import { ValidateGroupExists } from './validators/group-exists.validator';
|
||||||
|
|
||||||
describe('GroupFormComponent', () => {
|
describe('GroupFormComponent', () => {
|
||||||
@@ -227,9 +233,7 @@ describe('GroupFormComponent', () => {
|
|||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
useClass: TranslateLoaderMock,
|
useClass: TranslateLoaderMock,
|
||||||
},
|
},
|
||||||
}),
|
}), GroupFormComponent],
|
||||||
],
|
|
||||||
declarations: [GroupFormComponent],
|
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: DSONameService, useValue: new DSONameServiceMock() },
|
{ provide: DSONameService, useValue: new DSONameServiceMock() },
|
||||||
{ provide: EPersonDataService, useValue: ePersonDataServiceStub },
|
{ provide: EPersonDataService, useValue: ePersonDataServiceStub },
|
||||||
@@ -241,6 +245,7 @@ describe('GroupFormComponent', () => {
|
|||||||
{ provide: HttpClient, useValue: {} },
|
{ provide: HttpClient, useValue: {} },
|
||||||
{ provide: ObjectCacheService, useValue: {} },
|
{ provide: ObjectCacheService, useValue: {} },
|
||||||
{ provide: UUIDService, useValue: {} },
|
{ provide: UUIDService, useValue: {} },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
{ provide: Store, useValue: {} },
|
{ provide: Store, useValue: {} },
|
||||||
{ provide: RemoteDataBuildService, useValue: {} },
|
{ provide: RemoteDataBuildService, useValue: {} },
|
||||||
{ provide: HALEndpointService, useValue: {} },
|
{ provide: HALEndpointService, useValue: {} },
|
||||||
@@ -252,7 +257,17 @@ describe('GroupFormComponent', () => {
|
|||||||
{ provide: AuthorizationDataService, useValue: authorizationService },
|
{ provide: AuthorizationDataService, useValue: authorizationService },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
})
|
||||||
|
.overrideComponent(GroupFormComponent, {
|
||||||
|
remove: { imports: [
|
||||||
|
FormComponent,
|
||||||
|
AlertComponent,
|
||||||
|
ContextHelpDirective,
|
||||||
|
MembersListComponent,
|
||||||
|
SubgroupsListComponent,
|
||||||
|
] },
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@@ -1,3 +1,7 @@
|
|||||||
|
import {
|
||||||
|
AsyncPipe,
|
||||||
|
NgIf,
|
||||||
|
} from '@angular/common';
|
||||||
import {
|
import {
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
Component,
|
Component,
|
||||||
@@ -19,7 +23,10 @@ import {
|
|||||||
DynamicInputModel,
|
DynamicInputModel,
|
||||||
DynamicTextAreaModel,
|
DynamicTextAreaModel,
|
||||||
} from '@ng-dynamic-forms/core';
|
} from '@ng-dynamic-forms/core';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import {
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
import { Operation } from 'fast-json-patch';
|
import { Operation } from 'fast-json-patch';
|
||||||
import {
|
import {
|
||||||
combineLatest as observableCombineLatest,
|
combineLatest as observableCombineLatest,
|
||||||
@@ -59,25 +66,41 @@ import {
|
|||||||
getFirstSucceededRemoteDataPayload,
|
getFirstSucceededRemoteDataPayload,
|
||||||
getRemoteDataPayload,
|
getRemoteDataPayload,
|
||||||
} from '../../../core/shared/operators';
|
} from '../../../core/shared/operators';
|
||||||
|
import { AlertComponent } from '../../../shared/alert/alert.component';
|
||||||
import { AlertType } from '../../../shared/alert/alert-type';
|
import { AlertType } from '../../../shared/alert/alert-type';
|
||||||
import { ConfirmationModalComponent } from '../../../shared/confirmation-modal/confirmation-modal.component';
|
import { ConfirmationModalComponent } from '../../../shared/confirmation-modal/confirmation-modal.component';
|
||||||
|
import { ContextHelpDirective } from '../../../shared/context-help.directive';
|
||||||
import {
|
import {
|
||||||
hasValue,
|
hasValue,
|
||||||
hasValueOperator,
|
hasValueOperator,
|
||||||
isNotEmpty,
|
isNotEmpty,
|
||||||
} from '../../../shared/empty.util';
|
} from '../../../shared/empty.util';
|
||||||
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
||||||
|
import { FormComponent } from '../../../shared/form/form.component';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||||
import {
|
import {
|
||||||
getGroupEditRoute,
|
getGroupEditRoute,
|
||||||
getGroupsRoute,
|
getGroupsRoute,
|
||||||
} from '../../access-control-routing-paths';
|
} from '../../access-control-routing-paths';
|
||||||
|
import { MembersListComponent } from './members-list/members-list.component';
|
||||||
|
import { SubgroupsListComponent } from './subgroup-list/subgroups-list.component';
|
||||||
import { ValidateGroupExists } from './validators/group-exists.validator';
|
import { ValidateGroupExists } from './validators/group-exists.validator';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-group-form',
|
selector: 'ds-group-form',
|
||||||
templateUrl: './group-form.component.html',
|
templateUrl: './group-form.component.html',
|
||||||
|
imports: [
|
||||||
|
FormComponent,
|
||||||
|
AlertComponent,
|
||||||
|
NgIf,
|
||||||
|
AsyncPipe,
|
||||||
|
TranslateModule,
|
||||||
|
ContextHelpDirective,
|
||||||
|
MembersListComponent,
|
||||||
|
SubgroupsListComponent,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* A form used for creating and editing groups
|
* A form used for creating and editing groups
|
||||||
|
@@ -20,7 +20,10 @@ import {
|
|||||||
BrowserModule,
|
BrowserModule,
|
||||||
By,
|
By,
|
||||||
} from '@angular/platform-browser';
|
} from '@angular/platform-browser';
|
||||||
import { Router } from '@angular/router';
|
import {
|
||||||
|
ActivatedRoute,
|
||||||
|
Router,
|
||||||
|
} from '@angular/router';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import {
|
import {
|
||||||
TranslateLoader,
|
TranslateLoader,
|
||||||
@@ -45,13 +48,16 @@ import { EPerson } from '../../../../core/eperson/models/eperson.model';
|
|||||||
import { Group } from '../../../../core/eperson/models/group.model';
|
import { Group } from '../../../../core/eperson/models/group.model';
|
||||||
import { PaginationService } from '../../../../core/pagination/pagination.service';
|
import { PaginationService } from '../../../../core/pagination/pagination.service';
|
||||||
import { PageInfo } from '../../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../../core/shared/page-info.model';
|
||||||
|
import { ContextHelpDirective } from '../../../../shared/context-help.directive';
|
||||||
import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service';
|
||||||
import { DSONameServiceMock } from '../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../shared/mocks/dso-name.service.mock';
|
||||||
import { getMockFormBuilderService } from '../../../../shared/mocks/form-builder-service.mock';
|
import { getMockFormBuilderService } from '../../../../shared/mocks/form-builder-service.mock';
|
||||||
import { RouterMock } from '../../../../shared/mocks/router.mock';
|
import { RouterMock } from '../../../../shared/mocks/router.mock';
|
||||||
import { getMockTranslateService } from '../../../../shared/mocks/translate.service.mock';
|
import { getMockTranslateService } from '../../../../shared/mocks/translate.service.mock';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
|
import { PaginationComponent } from '../../../../shared/pagination/pagination.component';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils';
|
||||||
|
import { ActivatedRouteStub } from '../../../../shared/testing/active-router.stub';
|
||||||
import {
|
import {
|
||||||
EPersonMock,
|
EPersonMock,
|
||||||
EPersonMock2,
|
EPersonMock2,
|
||||||
@@ -155,9 +161,7 @@ describe('MembersListComponent', () => {
|
|||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
useClass: TranslateLoaderMock,
|
useClass: TranslateLoaderMock,
|
||||||
},
|
},
|
||||||
}),
|
}), MembersListComponent],
|
||||||
],
|
|
||||||
declarations: [MembersListComponent],
|
|
||||||
providers: [MembersListComponent,
|
providers: [MembersListComponent,
|
||||||
{ provide: EPersonDataService, useValue: ePersonDataServiceStub },
|
{ provide: EPersonDataService, useValue: ePersonDataServiceStub },
|
||||||
{ provide: GroupDataService, useValue: groupsDataServiceStub },
|
{ provide: GroupDataService, useValue: groupsDataServiceStub },
|
||||||
@@ -166,9 +170,16 @@ describe('MembersListComponent', () => {
|
|||||||
{ provide: Router, useValue: new RouterMock() },
|
{ provide: Router, useValue: new RouterMock() },
|
||||||
{ provide: PaginationService, useValue: paginationService },
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
{ provide: DSONameService, useValue: new DSONameServiceMock() },
|
{ provide: DSONameService, useValue: new DSONameServiceMock() },
|
||||||
|
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
})
|
||||||
|
.overrideComponent(MembersListComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [PaginationComponent, ContextHelpDirective],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@@ -1,12 +1,27 @@
|
|||||||
|
import {
|
||||||
|
AsyncPipe,
|
||||||
|
NgClass,
|
||||||
|
NgForOf,
|
||||||
|
NgIf,
|
||||||
|
} from '@angular/common';
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
Input,
|
Input,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { UntypedFormBuilder } from '@angular/forms';
|
import {
|
||||||
import { Router } from '@angular/router';
|
ReactiveFormsModule,
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
UntypedFormBuilder,
|
||||||
|
} from '@angular/forms';
|
||||||
|
import {
|
||||||
|
Router,
|
||||||
|
RouterLink,
|
||||||
|
} from '@angular/router';
|
||||||
|
import {
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
import {
|
import {
|
||||||
BehaviorSubject,
|
BehaviorSubject,
|
||||||
Observable,
|
Observable,
|
||||||
@@ -31,7 +46,9 @@ import {
|
|||||||
getFirstCompletedRemoteData,
|
getFirstCompletedRemoteData,
|
||||||
getRemoteDataPayload,
|
getRemoteDataPayload,
|
||||||
} from '../../../../core/shared/operators';
|
} from '../../../../core/shared/operators';
|
||||||
|
import { ContextHelpDirective } from '../../../../shared/context-help.directive';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
|
import { PaginationComponent } from '../../../../shared/pagination/pagination.component';
|
||||||
import { PaginationComponentOptions } from '../../../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../../../shared/pagination/pagination-component-options.model';
|
||||||
import { getEPersonEditRoute } from '../../../access-control-routing-paths';
|
import { getEPersonEditRoute } from '../../../access-control-routing-paths';
|
||||||
|
|
||||||
@@ -78,6 +95,18 @@ export interface EPersonListActionConfig {
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-members-list',
|
selector: 'ds-members-list',
|
||||||
templateUrl: './members-list.component.html',
|
templateUrl: './members-list.component.html',
|
||||||
|
imports: [
|
||||||
|
TranslateModule,
|
||||||
|
ContextHelpDirective,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
PaginationComponent,
|
||||||
|
NgIf,
|
||||||
|
AsyncPipe,
|
||||||
|
RouterLink,
|
||||||
|
NgClass,
|
||||||
|
NgForOf,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* The list of members in the edit group page
|
* The list of members in the edit group page
|
||||||
|
@@ -19,7 +19,10 @@ import {
|
|||||||
BrowserModule,
|
BrowserModule,
|
||||||
By,
|
By,
|
||||||
} from '@angular/platform-browser';
|
} from '@angular/platform-browser';
|
||||||
import { Router } from '@angular/router';
|
import {
|
||||||
|
ActivatedRoute,
|
||||||
|
Router,
|
||||||
|
} from '@angular/router';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import {
|
import {
|
||||||
TranslateLoader,
|
TranslateLoader,
|
||||||
@@ -43,13 +46,16 @@ import { GroupDataService } from '../../../../core/eperson/group-data.service';
|
|||||||
import { Group } from '../../../../core/eperson/models/group.model';
|
import { Group } from '../../../../core/eperson/models/group.model';
|
||||||
import { PaginationService } from '../../../../core/pagination/pagination.service';
|
import { PaginationService } from '../../../../core/pagination/pagination.service';
|
||||||
import { PageInfo } from '../../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../../core/shared/page-info.model';
|
||||||
|
import { ContextHelpDirective } from '../../../../shared/context-help.directive';
|
||||||
import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service';
|
||||||
import { DSONameServiceMock } from '../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../shared/mocks/dso-name.service.mock';
|
||||||
import { getMockFormBuilderService } from '../../../../shared/mocks/form-builder-service.mock';
|
import { getMockFormBuilderService } from '../../../../shared/mocks/form-builder-service.mock';
|
||||||
import { RouterMock } from '../../../../shared/mocks/router.mock';
|
import { RouterMock } from '../../../../shared/mocks/router.mock';
|
||||||
import { getMockTranslateService } from '../../../../shared/mocks/translate.service.mock';
|
import { getMockTranslateService } from '../../../../shared/mocks/translate.service.mock';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
|
import { PaginationComponent } from '../../../../shared/pagination/pagination.component';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils';
|
||||||
|
import { ActivatedRouteStub } from '../../../../shared/testing/active-router.stub';
|
||||||
import {
|
import {
|
||||||
GroupMock,
|
GroupMock,
|
||||||
GroupMock2,
|
GroupMock2,
|
||||||
@@ -119,7 +125,9 @@ describe('SubgroupsListComponent', () => {
|
|||||||
if (query === '') {
|
if (query === '') {
|
||||||
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), groupNonMembers));
|
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), groupNonMembers));
|
||||||
}
|
}
|
||||||
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), []));
|
return createSuccessfulRemoteDataObject$(
|
||||||
|
buildPaginatedList(new PageInfo(), []),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
addSubGroupToGroup(parentGroup, subgroupToAdd: Group): Observable<RestResponse> {
|
addSubGroupToGroup(parentGroup, subgroupToAdd: Group): Observable<RestResponse> {
|
||||||
// Add group to list of subgroups
|
// Add group to list of subgroups
|
||||||
@@ -153,28 +161,44 @@ describe('SubgroupsListComponent', () => {
|
|||||||
routerStub = new RouterMock();
|
routerStub = new RouterMock();
|
||||||
builderService = getMockFormBuilderService();
|
builderService = getMockFormBuilderService();
|
||||||
translateService = getMockTranslateService();
|
translateService = getMockTranslateService();
|
||||||
|
|
||||||
paginationService = new PaginationServiceStub();
|
paginationService = new PaginationServiceStub();
|
||||||
return TestBed.configureTestingModule({
|
return TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule,
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
NgbModule,
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
BrowserModule,
|
||||||
|
// ContextHelpDirective,
|
||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
loader: {
|
loader: {
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
useClass: TranslateLoaderMock,
|
useClass: TranslateLoaderMock,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
SubgroupsListComponent,
|
||||||
],
|
],
|
||||||
declarations: [SubgroupsListComponent],
|
providers: [
|
||||||
providers: [SubgroupsListComponent,
|
SubgroupsListComponent,
|
||||||
{ provide: DSONameService, useValue: new DSONameServiceMock() },
|
{ provide: DSONameService, useValue: new DSONameServiceMock() },
|
||||||
{ provide: GroupDataService, useValue: groupsDataServiceStub },
|
{ provide: GroupDataService, useValue: groupsDataServiceStub },
|
||||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
{
|
||||||
|
provide: NotificationsService,
|
||||||
|
useValue: new NotificationsServiceStub(),
|
||||||
|
},
|
||||||
{ provide: FormBuilderService, useValue: builderService },
|
{ provide: FormBuilderService, useValue: builderService },
|
||||||
{ provide: Router, useValue: routerStub },
|
{ provide: Router, useValue: routerStub },
|
||||||
{ provide: PaginationService, useValue: paginationService },
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
|
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
})
|
||||||
|
.overrideComponent(SubgroupsListComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [ContextHelpDirective, PaginationComponent],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@@ -1,12 +1,26 @@
|
|||||||
|
import {
|
||||||
|
AsyncPipe,
|
||||||
|
NgForOf,
|
||||||
|
NgIf,
|
||||||
|
} from '@angular/common';
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
Input,
|
Input,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { UntypedFormBuilder } from '@angular/forms';
|
import {
|
||||||
import { Router } from '@angular/router';
|
ReactiveFormsModule,
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
UntypedFormBuilder,
|
||||||
|
} from '@angular/forms';
|
||||||
|
import {
|
||||||
|
Router,
|
||||||
|
RouterLink,
|
||||||
|
} from '@angular/router';
|
||||||
|
import {
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
import {
|
import {
|
||||||
BehaviorSubject,
|
BehaviorSubject,
|
||||||
Observable,
|
Observable,
|
||||||
@@ -30,7 +44,9 @@ import {
|
|||||||
getFirstCompletedRemoteData,
|
getFirstCompletedRemoteData,
|
||||||
} from '../../../../core/shared/operators';
|
} from '../../../../core/shared/operators';
|
||||||
import { PageInfo } from '../../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../../core/shared/page-info.model';
|
||||||
|
import { ContextHelpDirective } from '../../../../shared/context-help.directive';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
|
import { PaginationComponent } from '../../../../shared/pagination/pagination.component';
|
||||||
import { PaginationComponentOptions } from '../../../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../../../shared/pagination/pagination-component-options.model';
|
||||||
import { followLink } from '../../../../shared/utils/follow-link-config.model';
|
import { followLink } from '../../../../shared/utils/follow-link-config.model';
|
||||||
|
|
||||||
@@ -46,6 +62,17 @@ enum SubKey {
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-subgroups-list',
|
selector: 'ds-subgroups-list',
|
||||||
templateUrl: './subgroups-list.component.html',
|
templateUrl: './subgroups-list.component.html',
|
||||||
|
imports: [
|
||||||
|
RouterLink,
|
||||||
|
AsyncPipe,
|
||||||
|
NgForOf,
|
||||||
|
ContextHelpDirective,
|
||||||
|
TranslateModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
PaginationComponent,
|
||||||
|
NgIf,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* The list of subgroups in the edit group page
|
* The list of subgroups in the edit group page
|
||||||
|
@@ -16,8 +16,12 @@ import {
|
|||||||
BrowserModule,
|
BrowserModule,
|
||||||
By,
|
By,
|
||||||
} from '@angular/platform-browser';
|
} from '@angular/platform-browser';
|
||||||
import { Router } from '@angular/router';
|
import {
|
||||||
|
ActivatedRoute,
|
||||||
|
Router,
|
||||||
|
} from '@angular/router';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import { provideMockStore } from '@ngrx/store/testing';
|
||||||
import {
|
import {
|
||||||
TranslateLoader,
|
TranslateLoader,
|
||||||
TranslateModule,
|
TranslateModule,
|
||||||
@@ -25,9 +29,12 @@ import {
|
|||||||
import {
|
import {
|
||||||
Observable,
|
Observable,
|
||||||
of as observableOf,
|
of as observableOf,
|
||||||
|
of,
|
||||||
} from 'rxjs';
|
} from 'rxjs';
|
||||||
|
|
||||||
|
import { APP_DATA_SERVICES_MAP } from '../../../config/app-config.interface';
|
||||||
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
|
||||||
|
import { ConfigurationDataService } from '../../core/data/configuration-data.service';
|
||||||
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
||||||
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
|
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
|
||||||
import { FeatureID } from '../../core/data/feature-authorization/feature-id';
|
import { FeatureID } from '../../core/data/feature-authorization/feature-id';
|
||||||
@@ -53,6 +60,7 @@ import {
|
|||||||
import { RouterMock } from '../../shared/mocks/router.mock';
|
import { RouterMock } from '../../shared/mocks/router.mock';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||||
|
import { ActivatedRouteStub } from '../../shared/testing/active-router.stub';
|
||||||
import {
|
import {
|
||||||
EPersonMock,
|
EPersonMock,
|
||||||
EPersonMock2,
|
EPersonMock2,
|
||||||
@@ -74,6 +82,7 @@ describe('GroupsRegistryComponent', () => {
|
|||||||
let groupsDataServiceStub: any;
|
let groupsDataServiceStub: any;
|
||||||
let dsoDataServiceStub: any;
|
let dsoDataServiceStub: any;
|
||||||
let authorizationService: AuthorizationDataService;
|
let authorizationService: AuthorizationDataService;
|
||||||
|
let configurationDataService: jasmine.SpyObj<ConfigurationDataService>;
|
||||||
|
|
||||||
let mockGroups;
|
let mockGroups;
|
||||||
let mockEPeople;
|
let mockEPeople;
|
||||||
@@ -191,6 +200,10 @@ describe('GroupsRegistryComponent', () => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
configurationDataService = jasmine.createSpyObj('ConfigurationDataService', {
|
||||||
|
findByPropertyName: of({ payload: { value: 'test' } }),
|
||||||
|
});
|
||||||
|
|
||||||
authorizationService = jasmine.createSpyObj('authorizationService', ['isAuthorized']);
|
authorizationService = jasmine.createSpyObj('authorizationService', ['isAuthorized']);
|
||||||
setIsAuthorized(true, true);
|
setIsAuthorized(true, true);
|
||||||
paginationService = new PaginationServiceStub();
|
paginationService = new PaginationServiceStub();
|
||||||
@@ -201,20 +214,22 @@ describe('GroupsRegistryComponent', () => {
|
|||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
useClass: TranslateLoaderMock,
|
useClass: TranslateLoaderMock,
|
||||||
},
|
},
|
||||||
}),
|
}), GroupsRegistryComponent],
|
||||||
],
|
|
||||||
declarations: [GroupsRegistryComponent],
|
|
||||||
providers: [GroupsRegistryComponent,
|
providers: [GroupsRegistryComponent,
|
||||||
{ provide: DSONameService, useValue: new DSONameServiceMock() },
|
{ provide: DSONameService, useValue: new DSONameServiceMock() },
|
||||||
{ provide: EPersonDataService, useValue: ePersonDataServiceStub },
|
{ provide: EPersonDataService, useValue: ePersonDataServiceStub },
|
||||||
{ provide: GroupDataService, useValue: groupsDataServiceStub },
|
{ provide: GroupDataService, useValue: groupsDataServiceStub },
|
||||||
{ provide: DSpaceObjectDataService, useValue: dsoDataServiceStub },
|
{ provide: DSpaceObjectDataService, useValue: dsoDataServiceStub },
|
||||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
||||||
|
{ provide: ConfigurationDataService, useValue: configurationDataService },
|
||||||
{ provide: RouteService, useValue: routeServiceStub },
|
{ provide: RouteService, useValue: routeServiceStub },
|
||||||
|
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
|
||||||
{ provide: Router, useValue: new RouterMock() },
|
{ provide: Router, useValue: new RouterMock() },
|
||||||
{ provide: AuthorizationDataService, useValue: authorizationService },
|
{ provide: AuthorizationDataService, useValue: authorizationService },
|
||||||
{ provide: PaginationService, useValue: paginationService },
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
{ provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) },
|
{ provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) },
|
||||||
|
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||||
|
provideMockStore(),
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
|
@@ -1,11 +1,28 @@
|
|||||||
|
import {
|
||||||
|
AsyncPipe,
|
||||||
|
NgForOf,
|
||||||
|
NgIf,
|
||||||
|
NgSwitch,
|
||||||
|
NgSwitchCase,
|
||||||
|
} from '@angular/common';
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { UntypedFormBuilder } from '@angular/forms';
|
import {
|
||||||
import { Router } from '@angular/router';
|
ReactiveFormsModule,
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
UntypedFormBuilder,
|
||||||
|
} from '@angular/forms';
|
||||||
|
import {
|
||||||
|
Router,
|
||||||
|
RouterLink,
|
||||||
|
} from '@angular/router';
|
||||||
|
import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import {
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
import {
|
import {
|
||||||
BehaviorSubject,
|
BehaviorSubject,
|
||||||
combineLatest as observableCombineLatest,
|
combineLatest as observableCombineLatest,
|
||||||
@@ -49,13 +66,29 @@ import {
|
|||||||
} from '../../core/shared/operators';
|
} from '../../core/shared/operators';
|
||||||
import { PageInfo } from '../../core/shared/page-info.model';
|
import { PageInfo } from '../../core/shared/page-info.model';
|
||||||
import { hasValue } from '../../shared/empty.util';
|
import { hasValue } from '../../shared/empty.util';
|
||||||
|
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
|
import { PaginationComponent } from '../../shared/pagination/pagination.component';
|
||||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
||||||
import { followLink } from '../../shared/utils/follow-link-config.model';
|
import { followLink } from '../../shared/utils/follow-link-config.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-groups-registry',
|
selector: 'ds-groups-registry',
|
||||||
templateUrl: './groups-registry.component.html',
|
templateUrl: './groups-registry.component.html',
|
||||||
|
imports: [
|
||||||
|
ThemedLoadingComponent,
|
||||||
|
TranslateModule,
|
||||||
|
RouterLink,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
AsyncPipe,
|
||||||
|
NgIf,
|
||||||
|
PaginationComponent,
|
||||||
|
NgSwitch,
|
||||||
|
NgSwitchCase,
|
||||||
|
NgbTooltipModule,
|
||||||
|
NgForOf,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* A component used for managing all existing groups within the repository.
|
* A component used for managing all existing groups within the repository.
|
||||||
|
@@ -6,6 +6,7 @@ import {
|
|||||||
} from '@angular/core/testing';
|
} from '@angular/core/testing';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
|
import { CurationFormComponent } from '../../curation-form/curation-form.component';
|
||||||
import { AdminCurationTasksComponent } from './admin-curation-tasks.component';
|
import { AdminCurationTasksComponent } from './admin-curation-tasks.component';
|
||||||
|
|
||||||
describe('AdminCurationTasksComponent', () => {
|
describe('AdminCurationTasksComponent', () => {
|
||||||
@@ -14,10 +15,15 @@ describe('AdminCurationTasksComponent', () => {
|
|||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [TranslateModule.forRoot()],
|
imports: [TranslateModule.forRoot(), AdminCurationTasksComponent],
|
||||||
declarations: [AdminCurationTasksComponent],
|
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
}).compileComponents();
|
})
|
||||||
|
.overrideComponent(AdminCurationTasksComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [CurationFormComponent],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@@ -1,4 +1,7 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
|
import { CurationFormComponent } from '../../curation-form/curation-form.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component responsible for rendering the system wide Curation Task UI
|
* Component responsible for rendering the system wide Curation Task UI
|
||||||
@@ -6,6 +9,11 @@ import { Component } from '@angular/core';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-admin-curation-task',
|
selector: 'ds-admin-curation-task',
|
||||||
templateUrl: './admin-curation-tasks.component.html',
|
templateUrl: './admin-curation-tasks.component.html',
|
||||||
|
imports: [
|
||||||
|
CurationFormComponent,
|
||||||
|
TranslateModule,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
export class AdminCurationTasksComponent {
|
export class AdminCurationTasksComponent {
|
||||||
|
|
||||||
|
@@ -23,6 +23,7 @@ import {
|
|||||||
createSuccessfulRemoteDataObject$,
|
createSuccessfulRemoteDataObject$,
|
||||||
} from '../../shared/remote-data.utils';
|
} from '../../shared/remote-data.utils';
|
||||||
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
||||||
|
import { FileDropzoneNoUploaderComponent } from '../../shared/upload/file-dropzone-no-uploader/file-dropzone-no-uploader.component';
|
||||||
import { FileValueAccessorDirective } from '../../shared/utils/file-value-accessor.directive';
|
import { FileValueAccessorDirective } from '../../shared/utils/file-value-accessor.directive';
|
||||||
import { FileValidator } from '../../shared/utils/require-file.validator';
|
import { FileValidator } from '../../shared/utils/require-file.validator';
|
||||||
import { BatchImportPageComponent } from './batch-import-page.component';
|
import { BatchImportPageComponent } from './batch-import-page.component';
|
||||||
@@ -58,8 +59,8 @@ describe('BatchImportPageComponent', () => {
|
|||||||
FormsModule,
|
FormsModule,
|
||||||
TranslateModule.forRoot(),
|
TranslateModule.forRoot(),
|
||||||
RouterTestingModule.withRoutes([]),
|
RouterTestingModule.withRoutes([]),
|
||||||
|
BatchImportPageComponent, FileValueAccessorDirective, FileValidator,
|
||||||
],
|
],
|
||||||
declarations: [BatchImportPageComponent, FileValueAccessorDirective, FileValidator],
|
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: NotificationsService, useValue: notificationService },
|
{ provide: NotificationsService, useValue: notificationService },
|
||||||
{ provide: ScriptDataService, useValue: scriptService },
|
{ provide: ScriptDataService, useValue: scriptService },
|
||||||
@@ -67,7 +68,13 @@ describe('BatchImportPageComponent', () => {
|
|||||||
{ provide: Location, useValue: locationStub },
|
{ provide: Location, useValue: locationStub },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
})
|
||||||
|
.overrideComponent(BatchImportPageComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [FileDropzoneNoUploaderComponent],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@@ -1,8 +1,16 @@
|
|||||||
import { Location } from '@angular/common';
|
import {
|
||||||
|
Location,
|
||||||
|
NgIf,
|
||||||
|
} from '@angular/common';
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import {
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
|
import { UiSwitchModule } from 'ngx-ui-switch';
|
||||||
import { take } from 'rxjs/operators';
|
import { take } from 'rxjs/operators';
|
||||||
|
|
||||||
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
|
||||||
@@ -22,10 +30,19 @@ import {
|
|||||||
isNotEmpty,
|
isNotEmpty,
|
||||||
} from '../../shared/empty.util';
|
} from '../../shared/empty.util';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
|
import { FileDropzoneNoUploaderComponent } from '../../shared/upload/file-dropzone-no-uploader/file-dropzone-no-uploader.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-batch-import-page',
|
selector: 'ds-batch-import-page',
|
||||||
templateUrl: './batch-import-page.component.html',
|
templateUrl: './batch-import-page.component.html',
|
||||||
|
imports: [
|
||||||
|
NgIf,
|
||||||
|
TranslateModule,
|
||||||
|
FormsModule,
|
||||||
|
UiSwitchModule,
|
||||||
|
FileDropzoneNoUploaderComponent,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
export class BatchImportPageComponent {
|
export class BatchImportPageComponent {
|
||||||
/**
|
/**
|
||||||
|
@@ -23,6 +23,7 @@ import {
|
|||||||
createSuccessfulRemoteDataObject$,
|
createSuccessfulRemoteDataObject$,
|
||||||
} from '../../shared/remote-data.utils';
|
} from '../../shared/remote-data.utils';
|
||||||
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
||||||
|
import { FileDropzoneNoUploaderComponent } from '../../shared/upload/file-dropzone-no-uploader/file-dropzone-no-uploader.component';
|
||||||
import { FileValueAccessorDirective } from '../../shared/utils/file-value-accessor.directive';
|
import { FileValueAccessorDirective } from '../../shared/utils/file-value-accessor.directive';
|
||||||
import { FileValidator } from '../../shared/utils/require-file.validator';
|
import { FileValidator } from '../../shared/utils/require-file.validator';
|
||||||
import { MetadataImportPageComponent } from './metadata-import-page.component';
|
import { MetadataImportPageComponent } from './metadata-import-page.component';
|
||||||
@@ -58,8 +59,8 @@ describe('MetadataImportPageComponent', () => {
|
|||||||
FormsModule,
|
FormsModule,
|
||||||
TranslateModule.forRoot(),
|
TranslateModule.forRoot(),
|
||||||
RouterTestingModule.withRoutes([]),
|
RouterTestingModule.withRoutes([]),
|
||||||
|
MetadataImportPageComponent, FileValueAccessorDirective, FileValidator,
|
||||||
],
|
],
|
||||||
declarations: [MetadataImportPageComponent, FileValueAccessorDirective, FileValidator],
|
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: NotificationsService, useValue: notificationService },
|
{ provide: NotificationsService, useValue: notificationService },
|
||||||
{ provide: ScriptDataService, useValue: scriptService },
|
{ provide: ScriptDataService, useValue: scriptService },
|
||||||
@@ -67,7 +68,13 @@ describe('MetadataImportPageComponent', () => {
|
|||||||
{ provide: Location, useValue: locationStub },
|
{ provide: Location, useValue: locationStub },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
})
|
||||||
|
.overrideComponent(MetadataImportPageComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [FileDropzoneNoUploaderComponent],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@@ -1,7 +1,11 @@
|
|||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import {
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
METADATA_IMPORT_SCRIPT_NAME,
|
METADATA_IMPORT_SCRIPT_NAME,
|
||||||
@@ -14,10 +18,17 @@ import { Process } from '../../process-page/processes/process.model';
|
|||||||
import { ProcessParameter } from '../../process-page/processes/process-parameter.model';
|
import { ProcessParameter } from '../../process-page/processes/process-parameter.model';
|
||||||
import { isNotEmpty } from '../../shared/empty.util';
|
import { isNotEmpty } from '../../shared/empty.util';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
|
import { FileDropzoneNoUploaderComponent } from '../../shared/upload/file-dropzone-no-uploader/file-dropzone-no-uploader.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-metadata-import-page',
|
selector: 'ds-metadata-import-page',
|
||||||
templateUrl: './metadata-import-page.component.html',
|
templateUrl: './metadata-import-page.component.html',
|
||||||
|
imports: [
|
||||||
|
TranslateModule,
|
||||||
|
FormsModule,
|
||||||
|
FileDropzoneNoUploaderComponent,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -0,0 +1,38 @@
|
|||||||
|
import { Routes } from '@angular/router';
|
||||||
|
|
||||||
|
import { i18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
|
import { navigationBreadcrumbResolver } from '../../core/breadcrumbs/navigation-breadcrumb.resolver';
|
||||||
|
import { LdnServiceFormComponent } from './ldn-service-form/ldn-service-form.component';
|
||||||
|
import { LdnServicesOverviewComponent } from './ldn-services-directory/ldn-services-directory.component';
|
||||||
|
|
||||||
|
const moduleRoutes: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
pathMatch: 'full',
|
||||||
|
component: LdnServicesOverviewComponent,
|
||||||
|
resolve: { breadcrumb: i18nBreadcrumbResolver },
|
||||||
|
data: { title: 'ldn-registered-services.title', breadcrumbKey: 'ldn-registered-services.new' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'new',
|
||||||
|
resolve: { breadcrumb: navigationBreadcrumbResolver },
|
||||||
|
component: LdnServiceFormComponent,
|
||||||
|
data: { title: 'ldn-register-new-service.title', breadcrumbKey: 'ldn-register-new-service' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'edit/:serviceId',
|
||||||
|
resolve: { breadcrumb: navigationBreadcrumbResolver },
|
||||||
|
component: LdnServiceFormComponent,
|
||||||
|
data: { title: 'ldn-edit-service.title', breadcrumbKey: 'ldn-edit-service' },
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const ROUTES = moduleRoutes.map(route => {
|
||||||
|
return { ...route, data: {
|
||||||
|
...route.data,
|
||||||
|
relatedRoutes: moduleRoutes.filter(relatedRoute => relatedRoute.path !== route.path)
|
||||||
|
.map((relatedRoute) => {
|
||||||
|
return { path: relatedRoute.path, data: relatedRoute.data };
|
||||||
|
}),
|
||||||
|
} };
|
||||||
|
});
|
@@ -1,50 +0,0 @@
|
|||||||
import { NgModule } from '@angular/core';
|
|
||||||
import {
|
|
||||||
RouterModule,
|
|
||||||
Routes,
|
|
||||||
} from '@angular/router';
|
|
||||||
|
|
||||||
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
|
||||||
import { NavigationBreadcrumbResolver } from '../../core/breadcrumbs/navigation-breadcrumb.resolver';
|
|
||||||
import { LdnServiceFormComponent } from './ldn-service-form/ldn-service-form.component';
|
|
||||||
import { LdnServicesOverviewComponent } from './ldn-services-directory/ldn-services-directory.component';
|
|
||||||
|
|
||||||
const moduleRoutes: Routes = [
|
|
||||||
{
|
|
||||||
path: '',
|
|
||||||
pathMatch: 'full',
|
|
||||||
component: LdnServicesOverviewComponent,
|
|
||||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
|
||||||
data: { title: 'ldn-registered-services.title', breadcrumbKey: 'ldn-registered-services.new' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'new',
|
|
||||||
resolve: { breadcrumb: NavigationBreadcrumbResolver },
|
|
||||||
component: LdnServiceFormComponent,
|
|
||||||
data: { title: 'ldn-register-new-service.title', breadcrumbKey: 'ldn-register-new-service' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'edit/:serviceId',
|
|
||||||
resolve: { breadcrumb: NavigationBreadcrumbResolver },
|
|
||||||
component: LdnServiceFormComponent,
|
|
||||||
data: { title: 'ldn-edit-service.title', breadcrumbKey: 'ldn-edit-service' },
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
RouterModule.forChild(moduleRoutes.map(route => {
|
|
||||||
return { ...route, data: {
|
|
||||||
...route.data,
|
|
||||||
relatedRoutes: moduleRoutes.filter(relatedRoute => relatedRoute.path !== route.path)
|
|
||||||
.map((relatedRoute) => {
|
|
||||||
return { path: relatedRoute.path, data: relatedRoute.data };
|
|
||||||
}),
|
|
||||||
} };
|
|
||||||
})),
|
|
||||||
],
|
|
||||||
})
|
|
||||||
export class AdminLdnServicesRoutingModule {
|
|
||||||
|
|
||||||
}
|
|
@@ -1,25 +0,0 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
|
||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { FormsModule } from '@angular/forms';
|
|
||||||
|
|
||||||
import { SharedModule } from '../../shared/shared.module';
|
|
||||||
import { AdminLdnServicesRoutingModule } from './admin-ldn-services-routing.module';
|
|
||||||
import { LdnServiceFormComponent } from './ldn-service-form/ldn-service-form.component';
|
|
||||||
import { LdnItemfiltersService } from './ldn-services-data/ldn-itemfilters-data.service';
|
|
||||||
import { LdnServicesOverviewComponent } from './ldn-services-directory/ldn-services-directory.component';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
CommonModule,
|
|
||||||
SharedModule,
|
|
||||||
AdminLdnServicesRoutingModule,
|
|
||||||
FormsModule,
|
|
||||||
],
|
|
||||||
declarations: [
|
|
||||||
LdnServicesOverviewComponent,
|
|
||||||
LdnServiceFormComponent,
|
|
||||||
],
|
|
||||||
providers: [LdnItemfiltersService],
|
|
||||||
})
|
|
||||||
export class AdminLdnServicesModule {
|
|
||||||
}
|
|
@@ -114,8 +114,7 @@ describe('LdnServiceFormEditComponent', () => {
|
|||||||
activatedRoute = new MockActivatedRoute(routeParams, routeUrlSegments);
|
activatedRoute = new MockActivatedRoute(routeParams, routeUrlSegments);
|
||||||
|
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [ReactiveFormsModule, TranslateModule.forRoot(), NgbDropdownModule],
|
imports: [ReactiveFormsModule, TranslateModule.forRoot(), NgbDropdownModule, LdnServiceFormComponent],
|
||||||
declarations: [LdnServiceFormComponent],
|
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: LdnServicesService, useValue: ldnServicesService },
|
{ provide: LdnServicesService, useValue: ldnServicesService },
|
||||||
{ provide: LdnItemfiltersService, useValue: ldnItemfiltersService },
|
{ provide: LdnItemfiltersService, useValue: ldnItemfiltersService },
|
||||||
|
@@ -5,6 +5,11 @@ import {
|
|||||||
transition,
|
transition,
|
||||||
trigger,
|
trigger,
|
||||||
} from '@angular/animations';
|
} from '@angular/animations';
|
||||||
|
import {
|
||||||
|
AsyncPipe,
|
||||||
|
NgForOf,
|
||||||
|
NgIf,
|
||||||
|
} from '@angular/common';
|
||||||
import {
|
import {
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
Component,
|
Component,
|
||||||
@@ -17,14 +22,21 @@ import {
|
|||||||
FormArray,
|
FormArray,
|
||||||
FormBuilder,
|
FormBuilder,
|
||||||
FormGroup,
|
FormGroup,
|
||||||
|
ReactiveFormsModule,
|
||||||
Validators,
|
Validators,
|
||||||
} from '@angular/forms';
|
} from '@angular/forms';
|
||||||
import {
|
import {
|
||||||
ActivatedRoute,
|
ActivatedRoute,
|
||||||
Router,
|
Router,
|
||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import {
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
NgbDropdownModule,
|
||||||
|
NgbModal,
|
||||||
|
} from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import {
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
import { Operation } from 'fast-json-patch';
|
import { Operation } from 'fast-json-patch';
|
||||||
import {
|
import {
|
||||||
combineLatestWith,
|
combineLatestWith,
|
||||||
@@ -54,6 +66,7 @@ import { notifyPatterns } from '../ldn-services-patterns/ldn-service-coar-patter
|
|||||||
selector: 'ds-ldn-service-form',
|
selector: 'ds-ldn-service-form',
|
||||||
templateUrl: './ldn-service-form.component.html',
|
templateUrl: './ldn-service-form.component.html',
|
||||||
styleUrls: ['./ldn-service-form.component.scss'],
|
styleUrls: ['./ldn-service-form.component.scss'],
|
||||||
|
standalone: true,
|
||||||
animations: [
|
animations: [
|
||||||
trigger('toggleAnimation', [
|
trigger('toggleAnimation', [
|
||||||
state('true', style({})),
|
state('true', style({})),
|
||||||
@@ -61,6 +74,14 @@ import { notifyPatterns } from '../ldn-services-patterns/ldn-service-coar-patter
|
|||||||
transition('true <=> false', animate('300ms ease-in')),
|
transition('true <=> false', animate('300ms ease-in')),
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
|
imports: [
|
||||||
|
ReactiveFormsModule,
|
||||||
|
TranslateModule,
|
||||||
|
NgIf,
|
||||||
|
NgbDropdownModule,
|
||||||
|
NgForOf,
|
||||||
|
AsyncPipe,
|
||||||
|
],
|
||||||
})
|
})
|
||||||
export class LdnServiceFormComponent implements OnInit, OnDestroy {
|
export class LdnServiceFormComponent implements OnInit, OnDestroy {
|
||||||
formModel: FormGroup;
|
formModel: FormGroup;
|
||||||
|
@@ -3,7 +3,6 @@ import { Observable } from 'rxjs';
|
|||||||
|
|
||||||
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
||||||
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
||||||
import { dataService } from '../../../core/data/base/data-service.decorator';
|
|
||||||
import {
|
import {
|
||||||
FindAllData,
|
FindAllData,
|
||||||
FindAllDataImpl,
|
FindAllDataImpl,
|
||||||
@@ -16,14 +15,12 @@ import { RequestService } from '../../../core/data/request.service';
|
|||||||
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
|
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
|
||||||
import { LDN_SERVICE_CONSTRAINT_FILTERS } from '../ldn-services-model/ldn-service.resource-type';
|
|
||||||
import { Itemfilter } from '../ldn-services-model/ldn-service-itemfilters';
|
import { Itemfilter } from '../ldn-services-model/ldn-service-itemfilters';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A service responsible for fetching/sending data from/to the REST API on the itemfilters endpoint
|
* A service responsible for fetching/sending data from/to the REST API on the itemfilters endpoint
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable({ providedIn: 'root' })
|
||||||
@dataService(LDN_SERVICE_CONSTRAINT_FILTERS)
|
|
||||||
export class LdnItemfiltersService extends IdentifiableDataService<Itemfilter> implements FindAllData<Itemfilter> {
|
export class LdnItemfiltersService extends IdentifiableDataService<Itemfilter> implements FindAllData<Itemfilter> {
|
||||||
private findAllData: FindAllDataImpl<Itemfilter>;
|
private findAllData: FindAllDataImpl<Itemfilter>;
|
||||||
|
|
||||||
|
@@ -13,7 +13,6 @@ import {
|
|||||||
CreateData,
|
CreateData,
|
||||||
CreateDataImpl,
|
CreateDataImpl,
|
||||||
} from '../../../core/data/base/create-data';
|
} from '../../../core/data/base/create-data';
|
||||||
import { dataService } from '../../../core/data/base/data-service.decorator';
|
|
||||||
import {
|
import {
|
||||||
DeleteData,
|
DeleteData,
|
||||||
DeleteDataImpl,
|
DeleteDataImpl,
|
||||||
@@ -42,7 +41,6 @@ import { URLCombiner } from '../../../core/url-combiner/url-combiner';
|
|||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
|
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
|
||||||
import { LdnServiceConstrain } from '../ldn-services-model/ldn-service.constrain.model';
|
import { LdnServiceConstrain } from '../ldn-services-model/ldn-service.constrain.model';
|
||||||
import { LDN_SERVICE } from '../ldn-services-model/ldn-service.resource-type';
|
|
||||||
import { LdnService } from '../ldn-services-model/ldn-services.model';
|
import { LdnService } from '../ldn-services-model/ldn-services.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,8 +54,7 @@ import { LdnService } from '../ldn-services-model/ldn-services.model';
|
|||||||
* @implements {PatchData<LdnService>}
|
* @implements {PatchData<LdnService>}
|
||||||
* @implements {CreateData<LdnService>}
|
* @implements {CreateData<LdnService>}
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable({ providedIn: 'root' })
|
||||||
@dataService(LDN_SERVICE)
|
|
||||||
export class LdnServicesService extends IdentifiableDataService<LdnService> implements FindAllData<LdnService>, DeleteData<LdnService>, PatchData<LdnService>, CreateData<LdnService> {
|
export class LdnServicesService extends IdentifiableDataService<LdnService> implements FindAllData<LdnService>, DeleteData<LdnService>, PatchData<LdnService>, CreateData<LdnService> {
|
||||||
createData: CreateDataImpl<LdnService>;
|
createData: CreateDataImpl<LdnService>;
|
||||||
private findAllData: FindAllDataImpl<LdnService>;
|
private findAllData: FindAllDataImpl<LdnService>;
|
||||||
|
@@ -9,6 +9,7 @@ import {
|
|||||||
TestBed,
|
TestBed,
|
||||||
tick,
|
tick,
|
||||||
} from '@angular/core/testing';
|
} from '@angular/core/testing';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import {
|
import {
|
||||||
TranslateModule,
|
TranslateModule,
|
||||||
@@ -20,10 +21,14 @@ import { PaginatedList } from '../../../core/data/paginated-list.model';
|
|||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||||
|
import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub';
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||||
import { createPaginatedList } from '../../../shared/testing/utils.test';
|
import { createPaginatedList } from '../../../shared/testing/utils.test';
|
||||||
|
import { TruncatableComponent } from '../../../shared/truncatable/truncatable.component';
|
||||||
|
import { TruncatablePartComponent } from '../../../shared/truncatable/truncatable-part/truncatable-part.component';
|
||||||
import { LdnServicesService } from '../ldn-services-data/ldn-services-data.service';
|
import { LdnServicesService } from '../ldn-services-data/ldn-services-data.service';
|
||||||
import { LdnService } from '../ldn-services-model/ldn-services.model';
|
import { LdnService } from '../ldn-services-model/ldn-services.model';
|
||||||
import { LdnServicesOverviewComponent } from './ldn-services-directory.component';
|
import { LdnServicesOverviewComponent } from './ldn-services-directory.component';
|
||||||
@@ -50,8 +55,7 @@ describe('LdnServicesOverviewComponent', () => {
|
|||||||
'patch': createSuccessfulRemoteDataObject$({}),
|
'patch': createSuccessfulRemoteDataObject$({}),
|
||||||
});
|
});
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [TranslateModule.forRoot()],
|
imports: [TranslateModule.forRoot(), LdnServicesOverviewComponent],
|
||||||
declarations: [LdnServicesOverviewComponent],
|
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: LdnServicesService,
|
provide: LdnServicesService,
|
||||||
@@ -60,16 +64,28 @@ describe('LdnServicesOverviewComponent', () => {
|
|||||||
{ provide: PaginationService, useValue: paginationService },
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
{
|
{
|
||||||
provide: NgbModal, useValue: {
|
provide: NgbModal, useValue: {
|
||||||
open: () => { /*comment*/
|
open: () => {
|
||||||
|
//
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ provide: ChangeDetectorRef, useValue: {} },
|
{ provide: ChangeDetectorRef, useValue: {} },
|
||||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
||||||
{ provide: TranslateService, useValue: translateServiceStub },
|
{ provide: TranslateService, useValue: translateServiceStub },
|
||||||
|
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
})
|
||||||
|
.overrideComponent(LdnServicesOverviewComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [
|
||||||
|
PaginationComponent,
|
||||||
|
TruncatableComponent,
|
||||||
|
TruncatablePartComponent,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -107,11 +123,9 @@ describe('LdnServicesOverviewComponent', () => {
|
|||||||
component.ldnServicesRD$ = createSuccessfulRemoteDataObject$(mockLdnServicesRD);
|
component.ldnServicesRD$ = createSuccessfulRemoteDataObject$(mockLdnServicesRD);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
const tableRows = fixture.debugElement.nativeElement.querySelectorAll('tbody tr');
|
component.ldnServicesRD$.subscribe((rd) => {
|
||||||
expect(tableRows.length).toBe(testData.length);
|
expect(rd.payload.page).toEqual(mockLdnServicesRD.page);
|
||||||
const firstRowContent = tableRows[0].textContent;
|
});
|
||||||
expect(firstRowContent).toContain('Service 1');
|
|
||||||
expect(firstRowContent).toContain('Description 1');
|
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -1,3 +1,9 @@
|
|||||||
|
import {
|
||||||
|
AsyncPipe,
|
||||||
|
NgClass,
|
||||||
|
NgFor,
|
||||||
|
NgIf,
|
||||||
|
} from '@angular/common';
|
||||||
import {
|
import {
|
||||||
ChangeDetectionStrategy,
|
ChangeDetectionStrategy,
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
@@ -7,8 +13,12 @@ import {
|
|||||||
TemplateRef,
|
TemplateRef,
|
||||||
ViewChild,
|
ViewChild,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
import { RouterLink } from '@angular/router';
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import {
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
import { Operation } from 'fast-json-patch';
|
import { Operation } from 'fast-json-patch';
|
||||||
import {
|
import {
|
||||||
Observable,
|
Observable,
|
||||||
@@ -27,7 +37,10 @@ import { RemoteData } from '../../../core/data/remote-data';
|
|||||||
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||||
import { hasValue } from '../../../shared/empty.util';
|
import { hasValue } from '../../../shared/empty.util';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
||||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||||
|
import { TruncatableComponent } from '../../../shared/truncatable/truncatable.component';
|
||||||
|
import { TruncatablePartComponent } from '../../../shared/truncatable/truncatable-part/truncatable-part.component';
|
||||||
import { LdnService } from '../ldn-services-model/ldn-services.model';
|
import { LdnService } from '../ldn-services-model/ldn-services.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,6 +53,18 @@ import { LdnService } from '../ldn-services-model/ldn-services.model';
|
|||||||
templateUrl: './ldn-services-directory.component.html',
|
templateUrl: './ldn-services-directory.component.html',
|
||||||
styleUrls: ['./ldn-services-directory.component.scss'],
|
styleUrls: ['./ldn-services-directory.component.scss'],
|
||||||
changeDetection: ChangeDetectionStrategy.Default,
|
changeDetection: ChangeDetectionStrategy.Default,
|
||||||
|
imports: [
|
||||||
|
NgIf,
|
||||||
|
NgFor,
|
||||||
|
TranslateModule,
|
||||||
|
AsyncPipe,
|
||||||
|
PaginationComponent,
|
||||||
|
TruncatableComponent,
|
||||||
|
TruncatablePartComponent,
|
||||||
|
NgClass,
|
||||||
|
RouterLink,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
|
export class LdnServicesOverviewComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
ActivatedRouteSnapshot,
|
ActivatedRouteSnapshot,
|
||||||
Resolve,
|
|
||||||
RouterStateSnapshot,
|
RouterStateSnapshot,
|
||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
|
|
||||||
@@ -17,8 +16,8 @@ export interface NotificationsSuggestionTargetsPageParams {
|
|||||||
/**
|
/**
|
||||||
* This class represents a resolver that retrieve the route data before the route is activated.
|
* This class represents a resolver that retrieve the route data before the route is activated.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable({ providedIn: 'root' })
|
||||||
export class NotificationsSuggestionTargetsPageResolver implements Resolve<NotificationsSuggestionTargetsPageParams> {
|
export class NotificationsSuggestionTargetsPageResolver {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for resolving the parameters in the current route.
|
* Method for resolving the parameters in the current route.
|
||||||
|
@@ -1,37 +1,40 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
async,
|
|
||||||
ComponentFixture,
|
ComponentFixture,
|
||||||
TestBed,
|
TestBed,
|
||||||
|
waitForAsync,
|
||||||
} from '@angular/core/testing';
|
} from '@angular/core/testing';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { NotificationsSuggestionTargetsPageComponent } from '../../../quality-assurance-notifications-pages/notifications-suggestion-targets-page/notifications-suggestion-targets-page.component';
|
import { PublicationClaimComponent } from '../../../notifications/suggestion-targets/publication-claim/publication-claim.component';
|
||||||
|
import { AdminNotificationsPublicationClaimPageComponent } from './admin-notifications-publication-claim-page.component';
|
||||||
|
|
||||||
describe('NotificationsSuggestionTargetsPageComponent', () => {
|
describe('AdminNotificationsPublicationClaimPageComponent', () => {
|
||||||
let component: NotificationsSuggestionTargetsPageComponent;
|
let component: AdminNotificationsPublicationClaimPageComponent;
|
||||||
let fixture: ComponentFixture<NotificationsSuggestionTargetsPageComponent>;
|
let fixture: ComponentFixture<AdminNotificationsPublicationClaimPageComponent>;
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
TranslateModule.forRoot(),
|
TranslateModule.forRoot(),
|
||||||
],
|
AdminNotificationsPublicationClaimPageComponent,
|
||||||
declarations: [
|
|
||||||
NotificationsSuggestionTargetsPageComponent,
|
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
NotificationsSuggestionTargetsPageComponent,
|
AdminNotificationsPublicationClaimPageComponent,
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
|
}).overrideComponent(AdminNotificationsPublicationClaimPageComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [PublicationClaimComponent],
|
||||||
|
},
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fixture = TestBed.createComponent(NotificationsSuggestionTargetsPageComponent);
|
fixture = TestBed.createComponent(AdminNotificationsPublicationClaimPageComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
@@ -1,9 +1,15 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
import { PublicationClaimComponent } from '../../../notifications/suggestion-targets/publication-claim/publication-claim.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-admin-notifications-publication-claim-page',
|
selector: 'ds-admin-notifications-publication-claim-page',
|
||||||
templateUrl: './admin-notifications-publication-claim-page.component.html',
|
templateUrl: './admin-notifications-publication-claim-page.component.html',
|
||||||
styleUrls: ['./admin-notifications-publication-claim-page.component.scss'],
|
styleUrls: ['./admin-notifications-publication-claim-page.component.scss'],
|
||||||
|
imports: [
|
||||||
|
PublicationClaimComponent,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
export class AdminNotificationsPublicationClaimPageComponent {
|
export class AdminNotificationsPublicationClaimPageComponent {
|
||||||
|
|
||||||
|
@@ -0,0 +1,98 @@
|
|||||||
|
import { Route } from '@angular/router';
|
||||||
|
|
||||||
|
import { authenticatedGuard } from '../../core/auth/authenticated.guard';
|
||||||
|
import { i18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
|
import { qualityAssuranceBreadcrumbResolver } from '../../core/breadcrumbs/quality-assurance-breadcrumb.resolver';
|
||||||
|
import { AdminNotificationsPublicationClaimPageResolver } from '../../quality-assurance-notifications-pages/notifications-suggestion-targets-page/notifications-suggestion-targets-page-resolver.service';
|
||||||
|
import { QualityAssuranceEventsPageComponent } from '../../quality-assurance-notifications-pages/quality-assurance-events-page/quality-assurance-events-page.component';
|
||||||
|
import { qualityAssuranceEventsPageResolver } from '../../quality-assurance-notifications-pages/quality-assurance-events-page/quality-assurance-events-page.resolver';
|
||||||
|
import { qualityAssuranceSourceDataResolver } from '../../quality-assurance-notifications-pages/quality-assurance-source-page-component/quality-assurance-source-data.resolver';
|
||||||
|
import { QualityAssuranceSourcePageComponent } from '../../quality-assurance-notifications-pages/quality-assurance-source-page-component/quality-assurance-source-page.component';
|
||||||
|
import { QualityAssuranceSourcePageResolver } from '../../quality-assurance-notifications-pages/quality-assurance-source-page-component/quality-assurance-source-page-resolver.service';
|
||||||
|
import { QualityAssuranceTopicsPageComponent } from '../../quality-assurance-notifications-pages/quality-assurance-topics-page/quality-assurance-topics-page.component';
|
||||||
|
import { QualityAssuranceTopicsPageResolver } from '../../quality-assurance-notifications-pages/quality-assurance-topics-page/quality-assurance-topics-page-resolver.service';
|
||||||
|
import { AdminNotificationsPublicationClaimPageComponent } from './admin-notifications-publication-claim-page/admin-notifications-publication-claim-page.component';
|
||||||
|
import {
|
||||||
|
PUBLICATION_CLAIMS_PATH,
|
||||||
|
QUALITY_ASSURANCE_EDIT_PATH,
|
||||||
|
} from './admin-notifications-routing-paths';
|
||||||
|
|
||||||
|
export const ROUTES: Route[] = [
|
||||||
|
{
|
||||||
|
canActivate: [ authenticatedGuard ],
|
||||||
|
path: `${PUBLICATION_CLAIMS_PATH}`,
|
||||||
|
component: AdminNotificationsPublicationClaimPageComponent,
|
||||||
|
pathMatch: 'full',
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: i18nBreadcrumbResolver,
|
||||||
|
suggestionTargetParams: AdminNotificationsPublicationClaimPageResolver,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
title: 'admin.notifications.publicationclaim.page.title',
|
||||||
|
breadcrumbKey: 'admin.notifications.publicationclaim',
|
||||||
|
showBreadcrumbsFluid: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
canActivate: [authenticatedGuard],
|
||||||
|
path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId`,
|
||||||
|
component: QualityAssuranceTopicsPageComponent,
|
||||||
|
pathMatch: 'full',
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: qualityAssuranceBreadcrumbResolver,
|
||||||
|
openaireQualityAssuranceTopicsParams: QualityAssuranceTopicsPageResolver,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
title: 'admin.quality-assurance.page.title',
|
||||||
|
breadcrumbKey: 'admin.quality-assurance',
|
||||||
|
showBreadcrumbsFluid: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
canActivate: [ authenticatedGuard ],
|
||||||
|
path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId/target/:targetId`,
|
||||||
|
component: QualityAssuranceTopicsPageComponent,
|
||||||
|
pathMatch: 'full',
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: i18nBreadcrumbResolver,
|
||||||
|
openaireQualityAssuranceTopicsParams: QualityAssuranceTopicsPageResolver,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
title: 'admin.quality-assurance.page.title',
|
||||||
|
breadcrumbKey: 'admin.quality-assurance',
|
||||||
|
showBreadcrumbsFluid: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
canActivate: [authenticatedGuard],
|
||||||
|
path: `${QUALITY_ASSURANCE_EDIT_PATH}`,
|
||||||
|
component: QualityAssuranceSourcePageComponent,
|
||||||
|
pathMatch: 'full',
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: i18nBreadcrumbResolver,
|
||||||
|
openaireQualityAssuranceSourceParams: QualityAssuranceSourcePageResolver,
|
||||||
|
sourceData: qualityAssuranceSourceDataResolver,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
title: 'admin.notifications.source.breadcrumbs',
|
||||||
|
breadcrumbKey: 'admin.notifications.source',
|
||||||
|
showBreadcrumbsFluid: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
canActivate: [authenticatedGuard],
|
||||||
|
path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId/:topicId`,
|
||||||
|
component: QualityAssuranceEventsPageComponent,
|
||||||
|
pathMatch: 'full',
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: qualityAssuranceBreadcrumbResolver,
|
||||||
|
openaireQualityAssuranceEventsParams: qualityAssuranceEventsPageResolver,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
title: 'admin.notifications.event.page.title',
|
||||||
|
breadcrumbKey: 'admin.notifications.event',
|
||||||
|
showBreadcrumbsFluid: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
@@ -1,123 +0,0 @@
|
|||||||
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 { QualityAssuranceBreadcrumbResolver } from '../../core/breadcrumbs/quality-assurance-breadcrumb.resolver';
|
|
||||||
import { QualityAssuranceBreadcrumbService } from '../../core/breadcrumbs/quality-assurance-breadcrumb.service';
|
|
||||||
import { SiteAdministratorGuard } from '../../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
|
|
||||||
import { AdminNotificationsPublicationClaimPageResolver } from '../../quality-assurance-notifications-pages/notifications-suggestion-targets-page/notifications-suggestion-targets-page-resolver.service';
|
|
||||||
import { QualityAssuranceEventsPageComponent } from '../../quality-assurance-notifications-pages/quality-assurance-events-page/quality-assurance-events-page.component';
|
|
||||||
import { QualityAssuranceEventsPageResolver } from '../../quality-assurance-notifications-pages/quality-assurance-events-page/quality-assurance-events-page.resolver';
|
|
||||||
import { SourceDataResolver } from '../../quality-assurance-notifications-pages/quality-assurance-source-page-component/quality-assurance-source-data.resolver';
|
|
||||||
import { QualityAssuranceSourcePageComponent } from '../../quality-assurance-notifications-pages/quality-assurance-source-page-component/quality-assurance-source-page.component';
|
|
||||||
import { QualityAssuranceSourcePageResolver } from '../../quality-assurance-notifications-pages/quality-assurance-source-page-component/quality-assurance-source-page-resolver.service';
|
|
||||||
import { QualityAssuranceTopicsPageComponent } from '../../quality-assurance-notifications-pages/quality-assurance-topics-page/quality-assurance-topics-page.component';
|
|
||||||
import { QualityAssuranceTopicsPageResolver } from '../../quality-assurance-notifications-pages/quality-assurance-topics-page/quality-assurance-topics-page-resolver.service';
|
|
||||||
import { AdminNotificationsPublicationClaimPageComponent } from './admin-notifications-publication-claim-page/admin-notifications-publication-claim-page.component';
|
|
||||||
import {
|
|
||||||
PUBLICATION_CLAIMS_PATH,
|
|
||||||
QUALITY_ASSURANCE_EDIT_PATH,
|
|
||||||
} from './admin-notifications-routing-paths';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
RouterModule.forChild([
|
|
||||||
{
|
|
||||||
canActivate: [ AuthenticatedGuard ],
|
|
||||||
path: `${PUBLICATION_CLAIMS_PATH}`,
|
|
||||||
component: AdminNotificationsPublicationClaimPageComponent,
|
|
||||||
pathMatch: 'full',
|
|
||||||
resolve: {
|
|
||||||
breadcrumb: I18nBreadcrumbResolver,
|
|
||||||
suggestionTargetParams: AdminNotificationsPublicationClaimPageResolver,
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
title: 'admin.notifications.publicationclaim.page.title',
|
|
||||||
breadcrumbKey: 'admin.notifications.publicationclaim',
|
|
||||||
showBreadcrumbsFluid: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
canActivate: [ AuthenticatedGuard ],
|
|
||||||
path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId`,
|
|
||||||
component: QualityAssuranceTopicsPageComponent,
|
|
||||||
pathMatch: 'full',
|
|
||||||
resolve: {
|
|
||||||
breadcrumb: QualityAssuranceBreadcrumbResolver,
|
|
||||||
openaireQualityAssuranceTopicsParams: QualityAssuranceTopicsPageResolver,
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
title: 'admin.quality-assurance.page.title',
|
|
||||||
breadcrumbKey: 'admin.quality-assurance',
|
|
||||||
showBreadcrumbsFluid: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
canActivate: [ AuthenticatedGuard ],
|
|
||||||
path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId/target/:targetId`,
|
|
||||||
component: QualityAssuranceTopicsPageComponent,
|
|
||||||
pathMatch: 'full',
|
|
||||||
resolve: {
|
|
||||||
breadcrumb: I18nBreadcrumbResolver,
|
|
||||||
openaireQualityAssuranceTopicsParams: QualityAssuranceTopicsPageResolver,
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
title: 'admin.quality-assurance.page.title',
|
|
||||||
breadcrumbKey: 'admin.quality-assurance',
|
|
||||||
showBreadcrumbsFluid: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
canActivate: [ SiteAdministratorGuard ],
|
|
||||||
path: `${QUALITY_ASSURANCE_EDIT_PATH}`,
|
|
||||||
component: QualityAssuranceSourcePageComponent,
|
|
||||||
pathMatch: 'full',
|
|
||||||
resolve: {
|
|
||||||
breadcrumb: I18nBreadcrumbResolver,
|
|
||||||
openaireQualityAssuranceSourceParams: QualityAssuranceSourcePageResolver,
|
|
||||||
sourceData: SourceDataResolver,
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
title: 'admin.notifications.source.breadcrumbs',
|
|
||||||
breadcrumbKey: 'admin.notifications.source',
|
|
||||||
showBreadcrumbsFluid: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
canActivate: [ AuthenticatedGuard ],
|
|
||||||
path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId/:topicId`,
|
|
||||||
component: QualityAssuranceEventsPageComponent,
|
|
||||||
pathMatch: 'full',
|
|
||||||
resolve: {
|
|
||||||
breadcrumb: QualityAssuranceBreadcrumbResolver,
|
|
||||||
openaireQualityAssuranceEventsParams: QualityAssuranceEventsPageResolver,
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
title: 'admin.notifications.event.page.title',
|
|
||||||
breadcrumbKey: 'admin.notifications.event',
|
|
||||||
showBreadcrumbsFluid: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
],
|
|
||||||
providers: [
|
|
||||||
I18nBreadcrumbResolver,
|
|
||||||
I18nBreadcrumbsService,
|
|
||||||
AdminNotificationsPublicationClaimPageResolver,
|
|
||||||
SourceDataResolver,
|
|
||||||
QualityAssuranceSourcePageResolver,
|
|
||||||
QualityAssuranceTopicsPageResolver,
|
|
||||||
QualityAssuranceEventsPageResolver,
|
|
||||||
QualityAssuranceSourcePageResolver,
|
|
||||||
QualityAssuranceBreadcrumbResolver,
|
|
||||||
QualityAssuranceBreadcrumbService,
|
|
||||||
],
|
|
||||||
})
|
|
||||||
/**
|
|
||||||
* Routing module for the Notifications section of the admin sidebar
|
|
||||||
*/
|
|
||||||
export class AdminNotificationsRoutingModule {
|
|
||||||
|
|
||||||
}
|
|
@@ -1,28 +0,0 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
|
||||||
import { NgModule } from '@angular/core';
|
|
||||||
|
|
||||||
import { CoreModule } from '../../core/core.module';
|
|
||||||
import { NotificationsModule } from '../../notifications/notifications.module';
|
|
||||||
import { SharedModule } from '../../shared/shared.module';
|
|
||||||
import { AdminNotificationsPublicationClaimPageComponent } from './admin-notifications-publication-claim-page/admin-notifications-publication-claim-page.component';
|
|
||||||
import { AdminNotificationsRoutingModule } from './admin-notifications-routing.module';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
CommonModule,
|
|
||||||
SharedModule,
|
|
||||||
CoreModule.forRoot(),
|
|
||||||
AdminNotificationsRoutingModule,
|
|
||||||
NotificationsModule,
|
|
||||||
],
|
|
||||||
declarations: [
|
|
||||||
AdminNotificationsPublicationClaimPageComponent,
|
|
||||||
],
|
|
||||||
entryComponents: [],
|
|
||||||
})
|
|
||||||
/**
|
|
||||||
* This module handles all components related to the notifications pages
|
|
||||||
*/
|
|
||||||
export class AdminNotificationsModule {
|
|
||||||
|
|
||||||
}
|
|
@@ -0,0 +1,51 @@
|
|||||||
|
import {
|
||||||
|
mapToCanActivate,
|
||||||
|
Route,
|
||||||
|
} from '@angular/router';
|
||||||
|
|
||||||
|
import { i18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
|
import { notifyInfoGuard } from '../../core/coar-notify/notify-info/notify-info.guard';
|
||||||
|
import { SiteAdministratorGuard } from '../../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
|
||||||
|
import { AdminNotifyDashboardComponent } from './admin-notify-dashboard.component';
|
||||||
|
import { AdminNotifyIncomingComponent } from './admin-notify-logs/admin-notify-incoming/admin-notify-incoming.component';
|
||||||
|
import { AdminNotifyOutgoingComponent } from './admin-notify-logs/admin-notify-outgoing/admin-notify-outgoing.component';
|
||||||
|
|
||||||
|
export const ROUTES: Route[] = [
|
||||||
|
{
|
||||||
|
canActivate: [...mapToCanActivate([SiteAdministratorGuard]), notifyInfoGuard],
|
||||||
|
path: '',
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: i18nBreadcrumbResolver,
|
||||||
|
},
|
||||||
|
component: AdminNotifyDashboardComponent,
|
||||||
|
pathMatch: 'full',
|
||||||
|
data: {
|
||||||
|
title: 'admin.notify.dashboard.page.title',
|
||||||
|
breadcrumbKey: 'admin.notify.dashboard',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'inbound',
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: i18nBreadcrumbResolver,
|
||||||
|
},
|
||||||
|
component: AdminNotifyIncomingComponent,
|
||||||
|
canActivate: [...mapToCanActivate([SiteAdministratorGuard]), notifyInfoGuard],
|
||||||
|
data: {
|
||||||
|
title: 'admin.notify.dashboard.page.title',
|
||||||
|
breadcrumbKey: 'admin.notify.dashboard',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'outbound',
|
||||||
|
resolve: {
|
||||||
|
breadcrumb: i18nBreadcrumbResolver,
|
||||||
|
},
|
||||||
|
component: AdminNotifyOutgoingComponent,
|
||||||
|
canActivate: [...mapToCanActivate([SiteAdministratorGuard]), notifyInfoGuard],
|
||||||
|
data: {
|
||||||
|
title: 'admin.notify.dashboard.page.title',
|
||||||
|
breadcrumbKey: 'admin.notify.dashboard',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
@@ -1,59 +0,0 @@
|
|||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { RouterModule } from '@angular/router';
|
|
||||||
|
|
||||||
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
|
||||||
import { NotifyInfoGuard } from '../../core/coar-notify/notify-info/notify-info.guard';
|
|
||||||
import { SiteAdministratorGuard } from '../../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
|
|
||||||
import { AdminNotifyDashboardComponent } from './admin-notify-dashboard.component';
|
|
||||||
import { AdminNotifyIncomingComponent } from './admin-notify-logs/admin-notify-incoming/admin-notify-incoming.component';
|
|
||||||
import { AdminNotifyOutgoingComponent } from './admin-notify-logs/admin-notify-outgoing/admin-notify-outgoing.component';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
RouterModule.forChild([
|
|
||||||
{
|
|
||||||
canActivate: [SiteAdministratorGuard, NotifyInfoGuard],
|
|
||||||
path: '',
|
|
||||||
resolve: {
|
|
||||||
breadcrumb: I18nBreadcrumbResolver,
|
|
||||||
},
|
|
||||||
component: AdminNotifyDashboardComponent,
|
|
||||||
pathMatch: 'full',
|
|
||||||
data: {
|
|
||||||
title: 'admin.notify.dashboard.page.title',
|
|
||||||
breadcrumbKey: 'admin.notify.dashboard',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'inbound',
|
|
||||||
resolve: {
|
|
||||||
breadcrumb: I18nBreadcrumbResolver,
|
|
||||||
},
|
|
||||||
component: AdminNotifyIncomingComponent,
|
|
||||||
canActivate: [SiteAdministratorGuard, NotifyInfoGuard],
|
|
||||||
data: {
|
|
||||||
title: 'admin.notify.dashboard.page.title',
|
|
||||||
breadcrumbKey: 'admin.notify.dashboard',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'outbound',
|
|
||||||
resolve: {
|
|
||||||
breadcrumb: I18nBreadcrumbResolver,
|
|
||||||
},
|
|
||||||
component: AdminNotifyOutgoingComponent,
|
|
||||||
canActivate: [SiteAdministratorGuard, NotifyInfoGuard],
|
|
||||||
data: {
|
|
||||||
title: 'admin.notify.dashboard.page.title',
|
|
||||||
breadcrumbKey: 'admin.notify.dashboard',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
],
|
|
||||||
})
|
|
||||||
/**
|
|
||||||
* Routing module for the Notifications section of the admin sidebar
|
|
||||||
*/
|
|
||||||
export class AdminNotifyDashboardRoutingModule {
|
|
||||||
|
|
||||||
}
|
|
@@ -1,14 +1,18 @@
|
|||||||
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
ComponentFixture,
|
ComponentFixture,
|
||||||
TestBed,
|
TestBed,
|
||||||
} from '@angular/core/testing';
|
} from '@angular/core/testing';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { buildPaginatedList } from '../../core/data/paginated-list.model';
|
import { buildPaginatedList } from '../../core/data/paginated-list.model';
|
||||||
import { SearchService } from '../../core/shared/search/search.service';
|
import { SearchService } from '../../core/shared/search/search.service';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||||
|
import { ActivatedRouteStub } from '../../shared/testing/active-router.stub';
|
||||||
import { AdminNotifyDashboardComponent } from './admin-notify-dashboard.component';
|
import { AdminNotifyDashboardComponent } from './admin-notify-dashboard.component';
|
||||||
|
import { AdminNotifyMetricsComponent } from './admin-notify-metrics/admin-notify-metrics.component';
|
||||||
import { AdminNotifyMessage } from './models/admin-notify-message.model';
|
import { AdminNotifyMessage } from './models/admin-notify-message.model';
|
||||||
import { AdminNotifySearchResult } from './models/admin-notify-message-search-result.model';
|
import { AdminNotifySearchResult } from './models/admin-notify-message-search-result.model';
|
||||||
|
|
||||||
@@ -39,9 +43,16 @@ describe('AdminNotifyDashboardComponent', () => {
|
|||||||
results = buildPaginatedList(undefined, [searchResult1, searchResult2, searchResult3]);
|
results = buildPaginatedList(undefined, [searchResult1, searchResult2, searchResult3]);
|
||||||
|
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [TranslateModule.forRoot(), NgbNavModule],
|
imports: [TranslateModule.forRoot(), NgbNavModule, AdminNotifyDashboardComponent],
|
||||||
declarations: [ AdminNotifyDashboardComponent ],
|
providers: [
|
||||||
providers: [{ provide: SearchService, useValue: { search: () => createSuccessfulRemoteDataObject$(results) } }],
|
{ provide: SearchService, useValue: { search: () => createSuccessfulRemoteDataObject$(results) } },
|
||||||
|
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
|
||||||
|
],
|
||||||
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
|
}).overrideComponent(AdminNotifyDashboardComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [AdminNotifyMetricsComponent],
|
||||||
|
},
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
|
@@ -1,7 +1,13 @@
|
|||||||
|
import {
|
||||||
|
AsyncPipe,
|
||||||
|
NgIf,
|
||||||
|
} from '@angular/common';
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
OnInit,
|
OnInit,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
import { RouterLink } from '@angular/router';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import {
|
import {
|
||||||
forkJoin,
|
forkJoin,
|
||||||
Observable,
|
Observable,
|
||||||
@@ -13,10 +19,11 @@ import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
|||||||
import { getFirstCompletedRemoteData } from '../../core/shared/operators';
|
import { getFirstCompletedRemoteData } from '../../core/shared/operators';
|
||||||
import { SearchService } from '../../core/shared/search/search.service';
|
import { SearchService } from '../../core/shared/search/search.service';
|
||||||
import { SearchConfigurationService } from '../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../core/shared/search/search-configuration.service';
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../my-dspace-page/my-dspace-page.component';
|
import { SEARCH_CONFIG_SERVICE } from '../../my-dspace-page/my-dspace-configuration.service';
|
||||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
||||||
import { PaginatedSearchOptions } from '../../shared/search/models/paginated-search-options.model';
|
import { PaginatedSearchOptions } from '../../shared/search/models/paginated-search-options.model';
|
||||||
import { SearchObjects } from '../../shared/search/models/search-objects.model';
|
import { SearchObjects } from '../../shared/search/models/search-objects.model';
|
||||||
|
import { AdminNotifyMetricsComponent } from './admin-notify-metrics/admin-notify-metrics.component';
|
||||||
import {
|
import {
|
||||||
AdminNotifyMetricsBox,
|
AdminNotifyMetricsBox,
|
||||||
AdminNotifyMetricsRow,
|
AdminNotifyMetricsRow,
|
||||||
@@ -31,6 +38,14 @@ import {
|
|||||||
useClass: SearchConfigurationService,
|
useClass: SearchConfigurationService,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
AdminNotifyMetricsComponent,
|
||||||
|
RouterLink,
|
||||||
|
NgIf,
|
||||||
|
TranslateModule,
|
||||||
|
AsyncPipe,
|
||||||
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,55 +0,0 @@
|
|||||||
import {
|
|
||||||
CommonModule,
|
|
||||||
DatePipe,
|
|
||||||
} from '@angular/common';
|
|
||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { RouterModule } from '@angular/router';
|
|
||||||
|
|
||||||
import { SearchPageModule } from '../../search-page/search-page.module';
|
|
||||||
import { SearchModule } from '../../shared/search/search.module';
|
|
||||||
import { SharedModule } from '../../shared/shared.module';
|
|
||||||
import { AdminNotifyDashboardComponent } from './admin-notify-dashboard.component';
|
|
||||||
import { AdminNotifyDashboardRoutingModule } from './admin-notify-dashboard-routing.module';
|
|
||||||
import { AdminNotifyDetailModalComponent } from './admin-notify-detail-modal/admin-notify-detail-modal.component';
|
|
||||||
import { AdminNotifyIncomingComponent } from './admin-notify-logs/admin-notify-incoming/admin-notify-incoming.component';
|
|
||||||
import { AdminNotifyLogsResultComponent } from './admin-notify-logs/admin-notify-logs-result/admin-notify-logs-result.component';
|
|
||||||
import { AdminNotifyOutgoingComponent } from './admin-notify-logs/admin-notify-outgoing/admin-notify-outgoing.component';
|
|
||||||
import { AdminNotifyMetricsComponent } from './admin-notify-metrics/admin-notify-metrics.component';
|
|
||||||
import { AdminNotifySearchResultComponent } from './admin-notify-search-result/admin-notify-search-result.component';
|
|
||||||
import { AdminNotifyMessagesService } from './services/admin-notify-messages.service';
|
|
||||||
|
|
||||||
const ENTRY_COMPONENTS = [
|
|
||||||
AdminNotifySearchResultComponent,
|
|
||||||
];
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
CommonModule,
|
|
||||||
RouterModule,
|
|
||||||
SharedModule,
|
|
||||||
AdminNotifyDashboardRoutingModule,
|
|
||||||
SearchModule,
|
|
||||||
SearchPageModule,
|
|
||||||
],
|
|
||||||
providers: [
|
|
||||||
AdminNotifyMessagesService,
|
|
||||||
DatePipe,
|
|
||||||
],
|
|
||||||
declarations: [
|
|
||||||
...ENTRY_COMPONENTS,
|
|
||||||
AdminNotifyDashboardComponent,
|
|
||||||
AdminNotifyMetricsComponent,
|
|
||||||
AdminNotifyIncomingComponent,
|
|
||||||
AdminNotifyOutgoingComponent,
|
|
||||||
AdminNotifyDetailModalComponent,
|
|
||||||
AdminNotifySearchResultComponent,
|
|
||||||
AdminNotifyLogsResultComponent,
|
|
||||||
],
|
|
||||||
})
|
|
||||||
export class AdminNotifyDashboardModule {
|
|
||||||
static withEntryComponents() {
|
|
||||||
return {
|
|
||||||
ngModule: AdminNotifyDashboardModule,
|
|
||||||
providers: ENTRY_COMPONENTS.map((component) => ({ provide: component })),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@@ -15,8 +15,7 @@ describe('AdminNotifyDetailModalComponent', () => {
|
|||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [TranslateModule.forRoot()],
|
imports: [TranslateModule.forRoot(), AdminNotifyDetailModalComponent],
|
||||||
declarations: [ AdminNotifyDetailModalComponent ],
|
|
||||||
providers: [{ provide: NgbActiveModal, useValue: modalStub }],
|
providers: [{ provide: NgbActiveModal, useValue: modalStub }],
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
@@ -1,3 +1,7 @@
|
|||||||
|
import {
|
||||||
|
NgForOf,
|
||||||
|
NgIf,
|
||||||
|
} from '@angular/common';
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
@@ -5,7 +9,10 @@ import {
|
|||||||
Output,
|
Output,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import {
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
|
|
||||||
import { fadeIn } from '../../../shared/animations/fade';
|
import { fadeIn } from '../../../shared/animations/fade';
|
||||||
import { MissingTranslationHelper } from '../../../shared/translate/missing-translation.helper';
|
import { MissingTranslationHelper } from '../../../shared/translate/missing-translation.helper';
|
||||||
@@ -17,6 +24,12 @@ import { AdminNotifyMessage } from '../models/admin-notify-message.model';
|
|||||||
animations: [
|
animations: [
|
||||||
fadeIn,
|
fadeIn,
|
||||||
],
|
],
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
NgForOf,
|
||||||
|
TranslateModule,
|
||||||
|
NgIf,
|
||||||
|
],
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* Component for detailed view of LDN messages displayed in search result in AdminNotifyDashboardComponent
|
* Component for detailed view of LDN messages displayed in search result in AdminNotifyDashboardComponent
|
||||||
|
@@ -6,15 +6,17 @@ import { ActivatedRoute } from '@angular/router';
|
|||||||
import { provideMockStore } from '@ngrx/store/testing';
|
import { provideMockStore } from '@ngrx/store/testing';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
|
import { APP_DATA_SERVICES_MAP } from '../../../../../config/app-config.interface';
|
||||||
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
|
||||||
import { RequestService } from '../../../../core/data/request.service';
|
import { RequestService } from '../../../../core/data/request.service';
|
||||||
import { RouteService } from '../../../../core/services/route.service';
|
import { RouteService } from '../../../../core/services/route.service';
|
||||||
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
||||||
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-configuration.service';
|
||||||
import { MockActivatedRoute } from '../../../../shared/mocks/active-router.mock';
|
import { MockActivatedRoute } from '../../../../shared/mocks/active-router.mock';
|
||||||
import { getMockRemoteDataBuildService } from '../../../../shared/mocks/remote-data-build.service.mock';
|
import { getMockRemoteDataBuildService } from '../../../../shared/mocks/remote-data-build.service.mock';
|
||||||
import { routeServiceStub } from '../../../../shared/testing/route-service.stub';
|
import { routeServiceStub } from '../../../../shared/testing/route-service.stub';
|
||||||
|
import { AdminNotifyLogsResultComponent } from '../admin-notify-logs-result/admin-notify-logs-result.component';
|
||||||
import { AdminNotifyIncomingComponent } from './admin-notify-incoming.component';
|
import { AdminNotifyIncomingComponent } from './admin-notify-incoming.component';
|
||||||
|
|
||||||
describe('AdminNotifyIncomingComponent', () => {
|
describe('AdminNotifyIncomingComponent', () => {
|
||||||
@@ -36,8 +38,7 @@ describe('AdminNotifyIncomingComponent', () => {
|
|||||||
'send': '',
|
'send': '',
|
||||||
});
|
});
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [TranslateModule.forRoot()],
|
imports: [TranslateModule.forRoot(), AdminNotifyIncomingComponent],
|
||||||
declarations: [ AdminNotifyIncomingComponent ],
|
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: SEARCH_CONFIG_SERVICE, useValue: SearchConfigurationService },
|
{ provide: SEARCH_CONFIG_SERVICE, useValue: SearchConfigurationService },
|
||||||
{ provide: RouteService, useValue: routeServiceStub },
|
{ provide: RouteService, useValue: routeServiceStub },
|
||||||
@@ -45,8 +46,11 @@ describe('AdminNotifyIncomingComponent', () => {
|
|||||||
{ provide: HALEndpointService, useValue: halService },
|
{ provide: HALEndpointService, useValue: halService },
|
||||||
{ provide: RequestService, useValue: requestService },
|
{ provide: RequestService, useValue: requestService },
|
||||||
{ provide: RemoteDataBuildService, useValue: rdbService },
|
{ provide: RemoteDataBuildService, useValue: rdbService },
|
||||||
|
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||||
provideMockStore({}),
|
provideMockStore({}),
|
||||||
],
|
],
|
||||||
|
}).overrideComponent(AdminNotifyIncomingComponent, {
|
||||||
|
remove: { imports: [AdminNotifyLogsResultComponent] },
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
|
@@ -2,9 +2,12 @@ import {
|
|||||||
Component,
|
Component,
|
||||||
Inject,
|
Inject,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
import { RouterLink } from '@angular/router';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-configuration.service';
|
||||||
|
import { AdminNotifyLogsResultComponent } from '../admin-notify-logs-result/admin-notify-logs-result.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-admin-notify-incoming',
|
selector: 'ds-admin-notify-incoming',
|
||||||
@@ -15,6 +18,12 @@ import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page
|
|||||||
useClass: SearchConfigurationService,
|
useClass: SearchConfigurationService,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
RouterLink,
|
||||||
|
AdminNotifyLogsResultComponent,
|
||||||
|
TranslateModule,
|
||||||
|
],
|
||||||
})
|
})
|
||||||
export class AdminNotifyIncomingComponent {
|
export class AdminNotifyIncomingComponent {
|
||||||
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService) {
|
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService) {
|
||||||
|
@@ -9,12 +9,15 @@ import {
|
|||||||
import { provideMockStore } from '@ngrx/store/testing';
|
import { provideMockStore } from '@ngrx/store/testing';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
|
import { APP_DATA_SERVICES_MAP } from '../../../../../config/app-config.interface';
|
||||||
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
|
||||||
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
|
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
|
||||||
import { RequestService } from '../../../../core/data/request.service';
|
import { RequestService } from '../../../../core/data/request.service';
|
||||||
import { RouteService } from '../../../../core/services/route.service';
|
import { RouteService } from '../../../../core/services/route.service';
|
||||||
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
||||||
import { MockActivatedRoute } from '../../../../shared/mocks/active-router.mock';
|
import { MockActivatedRoute } from '../../../../shared/mocks/active-router.mock';
|
||||||
|
import { SearchLabelsComponent } from '../../../../shared/search/search-labels/search-labels.component';
|
||||||
|
import { ThemedSearchComponent } from '../../../../shared/search/themed-search.component';
|
||||||
import { routeServiceStub } from '../../../../shared/testing/route-service.stub';
|
import { routeServiceStub } from '../../../../shared/testing/route-service.stub';
|
||||||
import { RouterStub } from '../../../../shared/testing/router.stub';
|
import { RouterStub } from '../../../../shared/testing/router.stub';
|
||||||
import { AdminNotifyLogsResultComponent } from './admin-notify-logs-result.component';
|
import { AdminNotifyLogsResultComponent } from './admin-notify-logs-result.component';
|
||||||
@@ -29,8 +32,7 @@ describe('AdminNotifyLogsResultComponent', () => {
|
|||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [TranslateModule.forRoot()],
|
imports: [TranslateModule.forRoot(), AdminNotifyLogsResultComponent],
|
||||||
declarations: [ AdminNotifyLogsResultComponent ],
|
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: RouteService, useValue: routeServiceStub },
|
{ provide: RouteService, useValue: routeServiceStub },
|
||||||
{ provide: Router, useValue: new RouterStub() },
|
{ provide: Router, useValue: new RouterStub() },
|
||||||
@@ -38,9 +40,18 @@ describe('AdminNotifyLogsResultComponent', () => {
|
|||||||
{ provide: HALEndpointService, useValue: halService },
|
{ provide: HALEndpointService, useValue: halService },
|
||||||
{ provide: ObjectCacheService, useValue: objectCache },
|
{ provide: ObjectCacheService, useValue: objectCache },
|
||||||
{ provide: RequestService, useValue: requestService },
|
{ provide: RequestService, useValue: requestService },
|
||||||
|
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||||
{ provide: RemoteDataBuildService, useValue: rdbService },
|
{ provide: RemoteDataBuildService, useValue: rdbService },
|
||||||
provideMockStore({}),
|
provideMockStore({}),
|
||||||
],
|
],
|
||||||
|
})
|
||||||
|
.overrideComponent(AdminNotifyLogsResultComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [
|
||||||
|
SearchLabelsComponent,
|
||||||
|
ThemedSearchComponent,
|
||||||
|
],
|
||||||
|
},
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
|
@@ -1,3 +1,7 @@
|
|||||||
|
import {
|
||||||
|
AsyncPipe,
|
||||||
|
NgIf,
|
||||||
|
} from '@angular/common';
|
||||||
import {
|
import {
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
Component,
|
Component,
|
||||||
@@ -10,13 +14,16 @@ import {
|
|||||||
ActivatedRouteSnapshot,
|
ActivatedRouteSnapshot,
|
||||||
Router,
|
Router,
|
||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
import { Context } from '../../../../core/shared/context.model';
|
import { Context } from '../../../../core/shared/context.model';
|
||||||
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-configuration.service';
|
||||||
|
import { SearchLabelsComponent } from '../../../../shared/search/search-labels/search-labels.component';
|
||||||
|
import { ThemedSearchComponent } from '../../../../shared/search/themed-search.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-admin-notify-logs-result',
|
selector: 'ds-admin-notify-logs-result',
|
||||||
@@ -27,6 +34,14 @@ import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page
|
|||||||
useClass: SearchConfigurationService,
|
useClass: SearchConfigurationService,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
SearchLabelsComponent,
|
||||||
|
ThemedSearchComponent,
|
||||||
|
AsyncPipe,
|
||||||
|
TranslateModule,
|
||||||
|
NgIf,
|
||||||
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -6,15 +6,17 @@ import { ActivatedRoute } from '@angular/router';
|
|||||||
import { provideMockStore } from '@ngrx/store/testing';
|
import { provideMockStore } from '@ngrx/store/testing';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
|
import { APP_DATA_SERVICES_MAP } from '../../../../../config/app-config.interface';
|
||||||
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
|
||||||
import { RequestService } from '../../../../core/data/request.service';
|
import { RequestService } from '../../../../core/data/request.service';
|
||||||
import { RouteService } from '../../../../core/services/route.service';
|
import { RouteService } from '../../../../core/services/route.service';
|
||||||
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
||||||
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-configuration.service';
|
||||||
import { MockActivatedRoute } from '../../../../shared/mocks/active-router.mock';
|
import { MockActivatedRoute } from '../../../../shared/mocks/active-router.mock';
|
||||||
import { getMockRemoteDataBuildService } from '../../../../shared/mocks/remote-data-build.service.mock';
|
import { getMockRemoteDataBuildService } from '../../../../shared/mocks/remote-data-build.service.mock';
|
||||||
import { routeServiceStub } from '../../../../shared/testing/route-service.stub';
|
import { routeServiceStub } from '../../../../shared/testing/route-service.stub';
|
||||||
|
import { AdminNotifyLogsResultComponent } from '../admin-notify-logs-result/admin-notify-logs-result.component';
|
||||||
import { AdminNotifyOutgoingComponent } from './admin-notify-outgoing.component';
|
import { AdminNotifyOutgoingComponent } from './admin-notify-outgoing.component';
|
||||||
|
|
||||||
describe('AdminNotifyOutgoingComponent', () => {
|
describe('AdminNotifyOutgoingComponent', () => {
|
||||||
@@ -36,9 +38,9 @@ describe('AdminNotifyOutgoingComponent', () => {
|
|||||||
});
|
});
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [TranslateModule.forRoot()],
|
imports: [TranslateModule.forRoot()],
|
||||||
declarations: [ AdminNotifyOutgoingComponent ],
|
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: SEARCH_CONFIG_SERVICE, useValue: SearchConfigurationService },
|
{ provide: SEARCH_CONFIG_SERVICE, useValue: SearchConfigurationService },
|
||||||
|
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||||
{ provide: RouteService, useValue: routeServiceStub },
|
{ provide: RouteService, useValue: routeServiceStub },
|
||||||
{ provide: ActivatedRoute, useValue: new MockActivatedRoute() },
|
{ provide: ActivatedRoute, useValue: new MockActivatedRoute() },
|
||||||
{ provide: HALEndpointService, useValue: halService },
|
{ provide: HALEndpointService, useValue: halService },
|
||||||
@@ -46,6 +48,9 @@ describe('AdminNotifyOutgoingComponent', () => {
|
|||||||
{ provide: RemoteDataBuildService, useValue: rdbService },
|
{ provide: RemoteDataBuildService, useValue: rdbService },
|
||||||
provideMockStore({}),
|
provideMockStore({}),
|
||||||
],
|
],
|
||||||
|
})
|
||||||
|
.overrideComponent(AdminNotifyOutgoingComponent, {
|
||||||
|
remove: { imports: [AdminNotifyLogsResultComponent] },
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
|
@@ -2,9 +2,12 @@ import {
|
|||||||
Component,
|
Component,
|
||||||
Inject,
|
Inject,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
import { RouterLink } from '@angular/router';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-configuration.service';
|
||||||
|
import { AdminNotifyLogsResultComponent } from '../admin-notify-logs-result/admin-notify-logs-result.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-admin-notify-outgoing',
|
selector: 'ds-admin-notify-outgoing',
|
||||||
@@ -15,6 +18,12 @@ import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page
|
|||||||
useClass: SearchConfigurationService,
|
useClass: SearchConfigurationService,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
RouterLink,
|
||||||
|
AdminNotifyLogsResultComponent,
|
||||||
|
TranslateModule,
|
||||||
|
],
|
||||||
})
|
})
|
||||||
export class AdminNotifyOutgoingComponent {
|
export class AdminNotifyOutgoingComponent {
|
||||||
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService) {
|
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService) {
|
||||||
|
@@ -21,8 +21,7 @@ describe('AdminNotifyMetricsComponent', () => {
|
|||||||
|
|
||||||
|
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [TranslateModule.forRoot()],
|
imports: [TranslateModule.forRoot(), AdminNotifyMetricsComponent],
|
||||||
declarations: [ AdminNotifyMetricsComponent ],
|
|
||||||
providers: [{ provide: Router, useValue: router }],
|
providers: [{ provide: Router, useValue: router }],
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
@@ -1,15 +1,24 @@
|
|||||||
|
import { NgForOf } from '@angular/common';
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
Input,
|
Input,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../core/shared/view-mode.model';
|
||||||
|
import { NotificationBoxComponent } from '../../../shared/notification-box/notification-box.component';
|
||||||
import { AdminNotifyMetricsRow } from './admin-notify-metrics.model';
|
import { AdminNotifyMetricsRow } from './admin-notify-metrics.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-admin-notify-metrics',
|
selector: 'ds-admin-notify-metrics',
|
||||||
templateUrl: './admin-notify-metrics.component.html',
|
templateUrl: './admin-notify-metrics.component.html',
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
NotificationBoxComponent,
|
||||||
|
TranslateModule,
|
||||||
|
NgForOf,
|
||||||
|
],
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* Component used to display the number of notification for each configured box in the notifyMetrics section
|
* Component used to display the number of notification for each configured box in the notifyMetrics section
|
||||||
|
@@ -13,6 +13,7 @@ import {
|
|||||||
of,
|
of,
|
||||||
} from 'rxjs';
|
} from 'rxjs';
|
||||||
|
|
||||||
|
import { APP_DATA_SERVICES_MAP } from '../../../../config/app-config.interface';
|
||||||
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
||||||
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
||||||
import { RequestService } from '../../../core/data/request.service';
|
import { RequestService } from '../../../core/data/request.service';
|
||||||
@@ -20,9 +21,11 @@ import { RouteService } from '../../../core/services/route.service';
|
|||||||
import { ConfigurationProperty } from '../../../core/shared/configuration-property.model';
|
import { ConfigurationProperty } from '../../../core/shared/configuration-property.model';
|
||||||
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
||||||
import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-page.component';
|
import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-configuration.service';
|
||||||
import { routeServiceStub } from '../../../shared/testing/route-service.stub';
|
import { routeServiceStub } from '../../../shared/testing/route-service.stub';
|
||||||
import { RouterStub } from '../../../shared/testing/router.stub';
|
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||||
|
import { TruncatableComponent } from '../../../shared/truncatable/truncatable.component';
|
||||||
|
import { TruncatablePartComponent } from '../../../shared/truncatable/truncatable-part/truncatable-part.component';
|
||||||
import { AdminNotifyDetailModalComponent } from '../admin-notify-detail-modal/admin-notify-detail-modal.component';
|
import { AdminNotifyDetailModalComponent } from '../admin-notify-detail-modal/admin-notify-detail-modal.component';
|
||||||
import { AdminNotifyMessage } from '../models/admin-notify-message.model';
|
import { AdminNotifyMessage } from '../models/admin-notify-message.model';
|
||||||
import { AdminNotifyMessagesService } from '../services/admin-notify-messages.service';
|
import { AdminNotifyMessagesService } from '../services/admin-notify-messages.service';
|
||||||
@@ -128,8 +131,7 @@ describe('AdminNotifySearchResultComponent', () => {
|
|||||||
|
|
||||||
|
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [TranslateModule.forRoot()],
|
imports: [TranslateModule.forRoot(), AdminNotifySearchResultComponent, AdminNotifyDetailModalComponent],
|
||||||
declarations: [ AdminNotifySearchResultComponent, AdminNotifyDetailModalComponent ],
|
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: AdminNotifyMessagesService, useValue: adminNotifyMessageService },
|
{ provide: AdminNotifyMessagesService, useValue: adminNotifyMessageService },
|
||||||
{ provide: RouteService, useValue: routeServiceStub },
|
{ provide: RouteService, useValue: routeServiceStub },
|
||||||
@@ -139,9 +141,18 @@ describe('AdminNotifySearchResultComponent', () => {
|
|||||||
{ provide: RequestService, useValue: requestService },
|
{ provide: RequestService, useValue: requestService },
|
||||||
{ provide: RemoteDataBuildService, useValue: rdbService },
|
{ provide: RemoteDataBuildService, useValue: rdbService },
|
||||||
{ provide: SEARCH_CONFIG_SERVICE, useValue: searchConfigService },
|
{ provide: SEARCH_CONFIG_SERVICE, useValue: searchConfigService },
|
||||||
|
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||||
DatePipe,
|
DatePipe,
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
|
})
|
||||||
|
.overrideComponent(AdminNotifySearchResultComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [
|
||||||
|
TruncatableComponent,
|
||||||
|
TruncatablePartComponent,
|
||||||
|
],
|
||||||
|
},
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
|
@@ -1,44 +1,59 @@
|
|||||||
import { DatePipe } from '@angular/common';
|
import {
|
||||||
|
AsyncPipe,
|
||||||
|
DatePipe,
|
||||||
|
NgForOf,
|
||||||
|
NgIf,
|
||||||
|
} from '@angular/common';
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
Inject,
|
Inject,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
import { RouterLink } from '@angular/router';
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import {
|
import {
|
||||||
BehaviorSubject,
|
BehaviorSubject,
|
||||||
Subscription,
|
Subscription,
|
||||||
} from 'rxjs';
|
} from 'rxjs';
|
||||||
|
|
||||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||||
import { Context } from '../../../core/shared/context.model';
|
|
||||||
import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
|
||||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-configuration.service';
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-page.component';
|
|
||||||
import { tabulatableObjectsComponent } from '../../../shared/object-collection/shared/tabulatable-objects/tabulatable-objects.decorator';
|
|
||||||
import { TabulatableResultListElementsComponent } from '../../../shared/object-list/search-result-list-element/tabulatable-search-result/tabulatable-result-list-elements.component';
|
import { TabulatableResultListElementsComponent } from '../../../shared/object-list/search-result-list-element/tabulatable-search-result/tabulatable-result-list-elements.component';
|
||||||
|
import { TruncatableComponent } from '../../../shared/truncatable/truncatable.component';
|
||||||
|
import { TruncatablePartComponent } from '../../../shared/truncatable/truncatable-part/truncatable-part.component';
|
||||||
import { AdminNotifyDetailModalComponent } from '../admin-notify-detail-modal/admin-notify-detail-modal.component';
|
import { AdminNotifyDetailModalComponent } from '../admin-notify-detail-modal/admin-notify-detail-modal.component';
|
||||||
import { AdminNotifyMessage } from '../models/admin-notify-message.model';
|
import { AdminNotifyMessage } from '../models/admin-notify-message.model';
|
||||||
import { AdminNotifySearchResult } from '../models/admin-notify-message-search-result.model';
|
import { AdminNotifySearchResult } from '../models/admin-notify-message-search-result.model';
|
||||||
import { AdminNotifyMessagesService } from '../services/admin-notify-messages.service';
|
import { AdminNotifyMessagesService } from '../services/admin-notify-messages.service';
|
||||||
|
|
||||||
@tabulatableObjectsComponent(PaginatedList<AdminNotifySearchResult>, ViewMode.Table, Context.CoarNotify)
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-admin-notify-search-result',
|
selector: 'ds-admin-notify-search-result',
|
||||||
templateUrl: './admin-notify-search-result.component.html',
|
templateUrl: './admin-notify-search-result.component.html',
|
||||||
providers: [
|
providers: [
|
||||||
|
DatePipe,
|
||||||
{
|
{
|
||||||
provide: SEARCH_CONFIG_SERVICE,
|
provide: SEARCH_CONFIG_SERVICE,
|
||||||
useClass: SearchConfigurationService,
|
useClass: SearchConfigurationService,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
TranslateModule,
|
||||||
|
NgForOf,
|
||||||
|
NgIf,
|
||||||
|
DatePipe,
|
||||||
|
AsyncPipe,
|
||||||
|
TruncatableComponent,
|
||||||
|
TruncatablePartComponent,
|
||||||
|
RouterLink,
|
||||||
|
],
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* Component for visualization in table format of the search results related to the AdminNotifyDashboardComponent
|
* Component for visualization in table format of the search results related to the AdminNotifyDashboardComponent
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
export class AdminNotifySearchResultComponent extends TabulatableResultListElementsComponent<PaginatedList<AdminNotifySearchResult>, AdminNotifySearchResult> implements OnInit, OnDestroy{
|
export class AdminNotifySearchResultComponent extends TabulatableResultListElementsComponent<PaginatedList<AdminNotifySearchResult>, AdminNotifySearchResult> implements OnInit, OnDestroy{
|
||||||
public messagesSubject$: BehaviorSubject<AdminNotifyMessage[]> = new BehaviorSubject([]);
|
public messagesSubject$: BehaviorSubject<AdminNotifyMessage[]> = new BehaviorSubject([]);
|
||||||
public reprocessStatus = 'QUEUE_STATUS_QUEUED_FOR_RETRY';
|
public reprocessStatus = 'QUEUE_STATUS_QUEUED_FOR_RETRY';
|
||||||
|
@@ -1,7 +1,5 @@
|
|||||||
import { SearchResult } from '../../../shared/search/models/search-result.model';
|
import { SearchResult } from '../../../shared/search/models/search-result.model';
|
||||||
import { searchResultFor } from '../../../shared/search/search-result-element-decorator';
|
|
||||||
import { AdminNotifyMessage } from './admin-notify-message.model';
|
import { AdminNotifyMessage } from './admin-notify-message.model';
|
||||||
|
|
||||||
@searchResultFor(AdminNotifyMessage)
|
|
||||||
export class AdminNotifySearchResult extends SearchResult<AdminNotifyMessage> {
|
export class AdminNotifySearchResult extends SearchResult<AdminNotifyMessage> {
|
||||||
}
|
}
|
||||||
|
@@ -15,7 +15,6 @@ import {
|
|||||||
|
|
||||||
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
||||||
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
||||||
import { dataService } from '../../../core/data/base/data-service.decorator';
|
|
||||||
import { IdentifiableDataService } from '../../../core/data/base/identifiable-data.service';
|
import { IdentifiableDataService } from '../../../core/data/base/identifiable-data.service';
|
||||||
import { ItemDataService } from '../../../core/data/item-data.service';
|
import { ItemDataService } from '../../../core/data/item-data.service';
|
||||||
import { PostRequest } from '../../../core/data/request.models';
|
import { PostRequest } from '../../../core/data/request.models';
|
||||||
@@ -29,17 +28,15 @@ import {
|
|||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { LdnServicesService } from '../../admin-ldn-services/ldn-services-data/ldn-services-data.service';
|
import { LdnServicesService } from '../../admin-ldn-services/ldn-services-data/ldn-services-data.service';
|
||||||
import { AdminNotifyMessage } from '../models/admin-notify-message.model';
|
import { AdminNotifyMessage } from '../models/admin-notify-message.model';
|
||||||
import { ADMIN_NOTIFY_MESSAGE } from '../models/admin-notify-message.resource-type';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Injectable service responsible for fetching/sending data from/to the REST API on the messages endpoint.
|
* Injectable service responsible for fetching/sending data from/to the REST API on the messages' endpoint.
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @class AdminNotifyMessagesService
|
* @class AdminNotifyMessagesService
|
||||||
* @extends {IdentifiableDataService<AdminNotifyMessage>}
|
* @extends {IdentifiableDataService<AdminNotifyMessage>}
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable({ providedIn: 'root' })
|
||||||
@dataService(ADMIN_NOTIFY_MESSAGE)
|
|
||||||
export class AdminNotifyMessagesService extends IdentifiableDataService<AdminNotifyMessage> {
|
export class AdminNotifyMessagesService extends IdentifiableDataService<AdminNotifyMessage> {
|
||||||
|
|
||||||
protected reprocessEndpoint = 'enqueueretry';
|
protected reprocessEndpoint = 'enqueueretry';
|
||||||
|
33
src/app/admin/admin-registries/admin-registries-routes.ts
Normal file
33
src/app/admin/admin-registries/admin-registries-routes.ts
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import { Route } from '@angular/router';
|
||||||
|
|
||||||
|
import { i18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
|
import { BITSTREAMFORMATS_MODULE_PATH } from './admin-registries-routing-paths';
|
||||||
|
import { MetadataRegistryComponent } from './metadata-registry/metadata-registry.component';
|
||||||
|
import { MetadataSchemaComponent } from './metadata-schema/metadata-schema.component';
|
||||||
|
|
||||||
|
export const ROUTES: Route[] = [
|
||||||
|
{
|
||||||
|
path: 'metadata',
|
||||||
|
resolve: { breadcrumb: i18nBreadcrumbResolver },
|
||||||
|
data: { title: 'admin.registries.metadata.title', breadcrumbKey: 'admin.registries.metadata' },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: MetadataRegistryComponent,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: ':schemaName',
|
||||||
|
resolve: { breadcrumb: i18nBreadcrumbResolver },
|
||||||
|
component: MetadataSchemaComponent,
|
||||||
|
data: { title: 'admin.registries.schema.title', breadcrumbKey: 'admin.registries.schema' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: BITSTREAMFORMATS_MODULE_PATH,
|
||||||
|
resolve: { breadcrumb: i18nBreadcrumbResolver },
|
||||||
|
loadChildren: () => import('./bitstream-formats/bitstream-formats-routes')
|
||||||
|
.then((m) => m.ROUTES),
|
||||||
|
data: { title: 'admin.registries.bitstream-formats.title', breadcrumbKey: 'admin.registries.bitstream-formats' },
|
||||||
|
},
|
||||||
|
];
|
@@ -1,41 +0,0 @@
|
|||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { RouterModule } from '@angular/router';
|
|
||||||
|
|
||||||
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
|
||||||
import { BITSTREAMFORMATS_MODULE_PATH } from './admin-registries-routing-paths';
|
|
||||||
import { MetadataRegistryComponent } from './metadata-registry/metadata-registry.component';
|
|
||||||
import { MetadataSchemaComponent } from './metadata-schema/metadata-schema.component';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
RouterModule.forChild([
|
|
||||||
{
|
|
||||||
path: 'metadata',
|
|
||||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
|
||||||
data: { title: 'admin.registries.metadata.title', breadcrumbKey: 'admin.registries.metadata' },
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: '',
|
|
||||||
component: MetadataRegistryComponent,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: ':schemaName',
|
|
||||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
|
||||||
component: MetadataSchemaComponent,
|
|
||||||
data: { title: 'admin.registries.schema.title', breadcrumbKey: 'admin.registries.schema' },
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: BITSTREAMFORMATS_MODULE_PATH,
|
|
||||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
|
||||||
loadChildren: () => import('./bitstream-formats/bitstream-formats.module')
|
|
||||||
.then((m) => m.BitstreamFormatsModule),
|
|
||||||
data: { title: 'admin.registries.bitstream-formats.title', breadcrumbKey: 'admin.registries.bitstream-formats' },
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
],
|
|
||||||
})
|
|
||||||
export class AdminRegistriesRoutingModule {
|
|
||||||
|
|
||||||
}
|
|
@@ -1,32 +0,0 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
|
||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { RouterModule } from '@angular/router';
|
|
||||||
|
|
||||||
import { FormModule } from '../../shared/form/form.module';
|
|
||||||
import { SharedModule } from '../../shared/shared.module';
|
|
||||||
import { AdminRegistriesRoutingModule } from './admin-registries-routing.module';
|
|
||||||
import { BitstreamFormatsModule } from './bitstream-formats/bitstream-formats.module';
|
|
||||||
import { MetadataRegistryComponent } from './metadata-registry/metadata-registry.component';
|
|
||||||
import { MetadataSchemaFormComponent } from './metadata-registry/metadata-schema-form/metadata-schema-form.component';
|
|
||||||
import { MetadataFieldFormComponent } from './metadata-schema/metadata-field-form/metadata-field-form.component';
|
|
||||||
import { MetadataSchemaComponent } from './metadata-schema/metadata-schema.component';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
CommonModule,
|
|
||||||
SharedModule,
|
|
||||||
RouterModule,
|
|
||||||
BitstreamFormatsModule,
|
|
||||||
AdminRegistriesRoutingModule,
|
|
||||||
FormModule,
|
|
||||||
],
|
|
||||||
declarations: [
|
|
||||||
MetadataRegistryComponent,
|
|
||||||
MetadataSchemaComponent,
|
|
||||||
MetadataSchemaFormComponent,
|
|
||||||
MetadataFieldFormComponent,
|
|
||||||
],
|
|
||||||
})
|
|
||||||
export class AdminRegistriesModule {
|
|
||||||
|
|
||||||
}
|
|
@@ -14,6 +14,10 @@ import { of as observableOf } from 'rxjs';
|
|||||||
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
||||||
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
||||||
import { BitstreamFormatSupportLevel } from '../../../../core/shared/bitstream-format-support-level';
|
import { BitstreamFormatSupportLevel } from '../../../../core/shared/bitstream-format-support-level';
|
||||||
|
import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service';
|
||||||
|
import { FormService } from '../../../../shared/form/form.service';
|
||||||
|
import { getMockFormBuilderService } from '../../../../shared/mocks/form-builder-service.mock';
|
||||||
|
import { getMockFormService } from '../../../../shared/mocks/form-service.mock';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
import {
|
import {
|
||||||
createFailedRemoteDataObject$,
|
createFailedRemoteDataObject$,
|
||||||
@@ -21,6 +25,7 @@ import {
|
|||||||
} from '../../../../shared/remote-data.utils';
|
} from '../../../../shared/remote-data.utils';
|
||||||
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub';
|
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub';
|
||||||
import { RouterStub } from '../../../../shared/testing/router.stub';
|
import { RouterStub } from '../../../../shared/testing/router.stub';
|
||||||
|
import { FormatFormComponent } from '../format-form/format-form.component';
|
||||||
import { AddBitstreamFormatComponent } from './add-bitstream-format.component';
|
import { AddBitstreamFormatComponent } from './add-bitstream-format.component';
|
||||||
|
|
||||||
describe('AddBitstreamFormatComponent', () => {
|
describe('AddBitstreamFormatComponent', () => {
|
||||||
@@ -50,15 +55,22 @@ describe('AddBitstreamFormatComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
|
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, AddBitstreamFormatComponent],
|
||||||
declarations: [AddBitstreamFormatComponent],
|
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: Router, useValue: router },
|
{ provide: Router, useValue: router },
|
||||||
{ provide: NotificationsService, useValue: notificationService },
|
{ provide: NotificationsService, useValue: notificationService },
|
||||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
||||||
|
{ provide: FormService, useValue: getMockFormService() },
|
||||||
|
{ provide: FormBuilderService, useValue: getMockFormBuilderService() },
|
||||||
],
|
],
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
}).compileComponents();
|
})
|
||||||
|
.overrideComponent(AddBitstreamFormatComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [FormatFormComponent],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
};
|
};
|
||||||
|
|
||||||
const initBeforeEach = () => {
|
const initBeforeEach = () => {
|
||||||
@@ -90,15 +102,22 @@ describe('AddBitstreamFormatComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
|
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, AddBitstreamFormatComponent],
|
||||||
declarations: [AddBitstreamFormatComponent],
|
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: Router, useValue: router },
|
{ provide: Router, useValue: router },
|
||||||
{ provide: NotificationsService, useValue: notificationService },
|
{ provide: NotificationsService, useValue: notificationService },
|
||||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
||||||
|
{ provide: FormService, useValue: getMockFormService() },
|
||||||
|
{ provide: FormBuilderService, useValue: getMockFormBuilderService() },
|
||||||
],
|
],
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
}).compileComponents();
|
})
|
||||||
|
.overrideComponent(AddBitstreamFormatComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [FormatFormComponent],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
}));
|
}));
|
||||||
beforeEach(initBeforeEach);
|
beforeEach(initBeforeEach);
|
||||||
it('should send the updated form to the service, show a notification and navigate to ', () => {
|
it('should send the updated form to the service, show a notification and navigate to ', () => {
|
||||||
|
@@ -1,6 +1,9 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import {
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
|
|
||||||
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
@@ -8,6 +11,7 @@ import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model'
|
|||||||
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
|
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-paths';
|
import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-paths';
|
||||||
|
import { FormatFormComponent } from '../format-form/format-form.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders the page to create a new bitstream format.
|
* This component renders the page to create a new bitstream format.
|
||||||
@@ -15,6 +19,11 @@ import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-p
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-add-bitstream-format',
|
selector: 'ds-add-bitstream-format',
|
||||||
templateUrl: './add-bitstream-format.component.html',
|
templateUrl: './add-bitstream-format.component.html',
|
||||||
|
imports: [
|
||||||
|
FormatFormComponent,
|
||||||
|
TranslateModule,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
export class AddBitstreamFormatComponent {
|
export class AddBitstreamFormatComponent {
|
||||||
|
|
||||||
|
@@ -0,0 +1,37 @@
|
|||||||
|
import { Route } from '@angular/router';
|
||||||
|
|
||||||
|
import { i18nBreadcrumbResolver } from '../../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
|
import { AddBitstreamFormatComponent } from './add-bitstream-format/add-bitstream-format.component';
|
||||||
|
import { BitstreamFormatsComponent } from './bitstream-formats.component';
|
||||||
|
import { bitstreamFormatsResolver } from './bitstream-formats.resolver';
|
||||||
|
import { EditBitstreamFormatComponent } from './edit-bitstream-format/edit-bitstream-format.component';
|
||||||
|
|
||||||
|
const BITSTREAMFORMAT_EDIT_PATH = ':id/edit';
|
||||||
|
const BITSTREAMFORMAT_ADD_PATH = 'add';
|
||||||
|
|
||||||
|
const providers = [];
|
||||||
|
|
||||||
|
export const ROUTES: Route[] = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
providers,
|
||||||
|
component: BitstreamFormatsComponent,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: BITSTREAMFORMAT_ADD_PATH,
|
||||||
|
resolve: { breadcrumb: i18nBreadcrumbResolver },
|
||||||
|
providers,
|
||||||
|
component: AddBitstreamFormatComponent,
|
||||||
|
data: { breadcrumbKey: 'admin.registries.bitstream-formats.create' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: BITSTREAMFORMAT_EDIT_PATH,
|
||||||
|
providers,
|
||||||
|
component: EditBitstreamFormatComponent,
|
||||||
|
resolve: {
|
||||||
|
bitstreamFormat: bitstreamFormatsResolver,
|
||||||
|
breadcrumb: i18nBreadcrumbResolver,
|
||||||
|
},
|
||||||
|
data: { breadcrumbKey: 'admin.registries.bitstream-formats.edit' },
|
||||||
|
},
|
||||||
|
];
|
@@ -1,43 +0,0 @@
|
|||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { RouterModule } from '@angular/router';
|
|
||||||
|
|
||||||
import { I18nBreadcrumbResolver } from '../../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
|
||||||
import { AddBitstreamFormatComponent } from './add-bitstream-format/add-bitstream-format.component';
|
|
||||||
import { BitstreamFormatsComponent } from './bitstream-formats.component';
|
|
||||||
import { BitstreamFormatsResolver } from './bitstream-formats.resolver';
|
|
||||||
import { EditBitstreamFormatComponent } from './edit-bitstream-format/edit-bitstream-format.component';
|
|
||||||
|
|
||||||
const BITSTREAMFORMAT_EDIT_PATH = ':id/edit';
|
|
||||||
const BITSTREAMFORMAT_ADD_PATH = 'add';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
RouterModule.forChild([
|
|
||||||
{
|
|
||||||
path: '',
|
|
||||||
component: BitstreamFormatsComponent,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: BITSTREAMFORMAT_ADD_PATH,
|
|
||||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
|
||||||
component: AddBitstreamFormatComponent,
|
|
||||||
data: { breadcrumbKey: 'admin.registries.bitstream-formats.create' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: BITSTREAMFORMAT_EDIT_PATH,
|
|
||||||
component: EditBitstreamFormatComponent,
|
|
||||||
resolve: {
|
|
||||||
bitstreamFormat: BitstreamFormatsResolver,
|
|
||||||
breadcrumb: I18nBreadcrumbResolver,
|
|
||||||
},
|
|
||||||
data: { breadcrumbKey: 'admin.registries.bitstream-formats.edit' },
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
],
|
|
||||||
providers: [
|
|
||||||
BitstreamFormatsResolver,
|
|
||||||
],
|
|
||||||
})
|
|
||||||
export class BitstreamFormatsRoutingModule {
|
|
||||||
|
|
||||||
}
|
|
@@ -1,4 +1,8 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
|
import {
|
||||||
|
Component,
|
||||||
|
NO_ERRORS_SCHEMA,
|
||||||
|
} from '@angular/core';
|
||||||
import {
|
import {
|
||||||
ComponentFixture,
|
ComponentFixture,
|
||||||
TestBed,
|
TestBed,
|
||||||
@@ -7,19 +11,27 @@ import {
|
|||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import { provideMockStore } from '@ngrx/store/testing';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import {
|
import {
|
||||||
cold,
|
cold,
|
||||||
getTestScheduler,
|
getTestScheduler,
|
||||||
hot,
|
hot,
|
||||||
} from 'jasmine-marbles';
|
} from 'jasmine-marbles';
|
||||||
import { of as observableOf } from 'rxjs';
|
import {
|
||||||
|
of as observableOf,
|
||||||
|
of,
|
||||||
|
} from 'rxjs';
|
||||||
import { TestScheduler } from 'rxjs/testing';
|
import { TestScheduler } from 'rxjs/testing';
|
||||||
|
|
||||||
|
import { APP_DATA_SERVICES_MAP } from '../../../../config/app-config.interface';
|
||||||
import { BitstreamFormatDataService } from '../../../core/data/bitstream-format-data.service';
|
import { BitstreamFormatDataService } from '../../../core/data/bitstream-format-data.service';
|
||||||
|
import { ConfigurationDataService } from '../../../core/data/configuration-data.service';
|
||||||
|
import { GroupDataService } from '../../../core/eperson/group-data.service';
|
||||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||||
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
||||||
import { BitstreamFormatSupportLevel } from '../../../core/shared/bitstream-format-support-level';
|
import { BitstreamFormatSupportLevel } from '../../../core/shared/bitstream-format-support-level';
|
||||||
|
import { XSRFService } from '../../../core/xsrf/xsrf.service';
|
||||||
import { HostWindowService } from '../../../shared/host-window.service';
|
import { HostWindowService } from '../../../shared/host-window.service';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
||||||
@@ -108,17 +120,33 @@ describe('BitstreamFormatsComponent', () => {
|
|||||||
clearBitStreamFormatRequests: observableOf('cleared'),
|
clearBitStreamFormatRequests: observableOf('cleared'),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const groupDataService = jasmine.createSpyObj('groupsDataService', {
|
||||||
|
findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
|
||||||
|
getGroupRegistryRouterLink: '',
|
||||||
|
getUUIDFromString: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const configurationDataService = jasmine.createSpyObj('ConfigurationDataService', {
|
||||||
|
findByPropertyName: of({ payload: { value: 'test' } }),
|
||||||
|
});
|
||||||
|
|
||||||
paginationService = new PaginationServiceStub();
|
paginationService = new PaginationServiceStub();
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
|
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
|
||||||
declarations: [BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
|
|
||||||
providers: [
|
providers: [
|
||||||
|
provideMockStore(),
|
||||||
|
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
|
||||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
|
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
|
||||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
||||||
{ provide: NotificationsService, useValue: notificationsServiceStub },
|
{ provide: NotificationsService, useValue: notificationsServiceStub },
|
||||||
{ provide: PaginationService, useValue: paginationService },
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
|
{ provide: GroupDataService, useValue: groupDataService },
|
||||||
|
{ provide: ConfigurationDataService, useValue: configurationDataService },
|
||||||
|
{ provide: XSRFService, useValue: {} },
|
||||||
],
|
],
|
||||||
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -236,18 +264,39 @@ describe('BitstreamFormatsComponent', () => {
|
|||||||
clearBitStreamFormatRequests: observableOf('cleared'),
|
clearBitStreamFormatRequests: observableOf('cleared'),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const groupDataService = jasmine.createSpyObj('groupsDataService', {
|
||||||
|
findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
|
||||||
|
getGroupRegistryRouterLink: '',
|
||||||
|
getUUIDFromString: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
const configurationDataService = jasmine.createSpyObj('ConfigurationDataService', {
|
||||||
|
findByPropertyName: of({ payload: { value: 'test' } }),
|
||||||
|
});
|
||||||
|
|
||||||
paginationService = new PaginationServiceStub();
|
paginationService = new PaginationServiceStub();
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
|
imports: [
|
||||||
declarations: [BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
|
CommonModule,
|
||||||
|
RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule,
|
||||||
|
BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
|
||||||
providers: [
|
providers: [
|
||||||
|
provideMockStore(),
|
||||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
|
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
|
||||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
||||||
{ provide: NotificationsService, useValue: notificationsServiceStub },
|
{ provide: NotificationsService, useValue: notificationsServiceStub },
|
||||||
{ provide: PaginationService, useValue: paginationService },
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
|
{ provide: GroupDataService, useValue: groupDataService },
|
||||||
|
{ provide: ConfigurationDataService, useValue: configurationDataService },
|
||||||
],
|
],
|
||||||
}).compileComponents();
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
|
})
|
||||||
|
.overrideComponent(BitstreamFormatsComponent, {
|
||||||
|
remove: { imports: [PaginationComponent] },
|
||||||
|
add: { imports: [TestPaginationComponent] },
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -285,18 +334,37 @@ describe('BitstreamFormatsComponent', () => {
|
|||||||
clearBitStreamFormatRequests: observableOf('cleared'),
|
clearBitStreamFormatRequests: observableOf('cleared'),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const groupDataService = jasmine.createSpyObj('groupsDataService', {
|
||||||
|
findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
|
||||||
|
getGroupRegistryRouterLink: '',
|
||||||
|
getUUIDFromString: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
const configurationDataService = jasmine.createSpyObj('ConfigurationDataService', {
|
||||||
|
findByPropertyName: of({ payload: { value: 'test' } }),
|
||||||
|
});
|
||||||
|
|
||||||
paginationService = new PaginationServiceStub();
|
paginationService = new PaginationServiceStub();
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
|
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
|
||||||
declarations: [BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
|
|
||||||
providers: [
|
providers: [
|
||||||
|
provideMockStore(),
|
||||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
|
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
|
||||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
||||||
{ provide: NotificationsService, useValue: notificationsServiceStub },
|
{ provide: NotificationsService, useValue: notificationsServiceStub },
|
||||||
{ provide: PaginationService, useValue: paginationService },
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
|
{ provide: GroupDataService, useValue: groupDataService },
|
||||||
|
{ provide: ConfigurationDataService, useValue: configurationDataService },
|
||||||
],
|
],
|
||||||
}).compileComponents();
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
|
})
|
||||||
|
.overrideComponent(BitstreamFormatsComponent, {
|
||||||
|
remove: { imports: [PaginationComponent] },
|
||||||
|
add: { imports: [TestPaginationComponent] },
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -316,3 +384,12 @@ describe('BitstreamFormatsComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
exportAs: 'paginationComponent',
|
||||||
|
selector: 'ds-pagination',
|
||||||
|
template: ``,
|
||||||
|
standalone: true,
|
||||||
|
})
|
||||||
|
export class TestPaginationComponent {
|
||||||
|
}
|
||||||
|
@@ -1,10 +1,21 @@
|
|||||||
|
import {
|
||||||
|
AsyncPipe,
|
||||||
|
NgForOf,
|
||||||
|
NgIf,
|
||||||
|
} from '@angular/common';
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import {
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
Router,
|
||||||
|
RouterLink,
|
||||||
|
} from '@angular/router';
|
||||||
|
import {
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
import {
|
import {
|
||||||
combineLatest as observableCombineLatest,
|
combineLatest as observableCombineLatest,
|
||||||
Observable,
|
Observable,
|
||||||
@@ -26,6 +37,7 @@ import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
|||||||
import { NoContent } from '../../../core/shared/NoContent.model';
|
import { NoContent } from '../../../core/shared/NoContent.model';
|
||||||
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
||||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,6 +46,15 @@ import { PaginationComponentOptions } from '../../../shared/pagination/paginatio
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-bitstream-formats',
|
selector: 'ds-bitstream-formats',
|
||||||
templateUrl: './bitstream-formats.component.html',
|
templateUrl: './bitstream-formats.component.html',
|
||||||
|
imports: [
|
||||||
|
NgIf,
|
||||||
|
AsyncPipe,
|
||||||
|
RouterLink,
|
||||||
|
TranslateModule,
|
||||||
|
PaginationComponent,
|
||||||
|
NgForOf,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
export class BitstreamFormatsComponent implements OnInit, OnDestroy {
|
export class BitstreamFormatsComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
|
@@ -1,30 +0,0 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
|
||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { RouterModule } from '@angular/router';
|
|
||||||
|
|
||||||
import { FormModule } from '../../../shared/form/form.module';
|
|
||||||
import { SharedModule } from '../../../shared/shared.module';
|
|
||||||
import { AddBitstreamFormatComponent } from './add-bitstream-format/add-bitstream-format.component';
|
|
||||||
import { BitstreamFormatsComponent } from './bitstream-formats.component';
|
|
||||||
import { BitstreamFormatsRoutingModule } from './bitstream-formats-routing.module';
|
|
||||||
import { EditBitstreamFormatComponent } from './edit-bitstream-format/edit-bitstream-format.component';
|
|
||||||
import { FormatFormComponent } from './format-form/format-form.component';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
CommonModule,
|
|
||||||
SharedModule,
|
|
||||||
RouterModule,
|
|
||||||
BitstreamFormatsRoutingModule,
|
|
||||||
FormModule,
|
|
||||||
],
|
|
||||||
declarations: [
|
|
||||||
BitstreamFormatsComponent,
|
|
||||||
EditBitstreamFormatComponent,
|
|
||||||
AddBitstreamFormatComponent,
|
|
||||||
FormatFormComponent,
|
|
||||||
],
|
|
||||||
})
|
|
||||||
export class BitstreamFormatsModule {
|
|
||||||
|
|
||||||
}
|
|
@@ -1,7 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { inject } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
ActivatedRouteSnapshot,
|
ActivatedRouteSnapshot,
|
||||||
Resolve,
|
ResolveFn,
|
||||||
RouterStateSnapshot,
|
RouterStateSnapshot,
|
||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
@@ -11,25 +11,21 @@ import { RemoteData } from '../../../core/data/remote-data';
|
|||||||
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
||||||
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||||
|
|
||||||
/**
|
|
||||||
* This class represents a resolver that requests a specific bitstreamFormat before the route is activated
|
|
||||||
*/
|
|
||||||
@Injectable()
|
|
||||||
export class BitstreamFormatsResolver implements Resolve<RemoteData<BitstreamFormat>> {
|
|
||||||
constructor(private bitstreamFormatDataService: BitstreamFormatDataService) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for resolving an bitstreamFormat based on the parameters in the current route
|
* Method for resolving an bitstreamFormat based on the parameters in the current route
|
||||||
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
|
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
|
||||||
* @param {RouterStateSnapshot} state The current RouterStateSnapshot
|
* @param {RouterStateSnapshot} state
|
||||||
|
* @param {BitstreamFormatDataService} bitstreamFormatDataService The BitstreamFormatDataService
|
||||||
* @returns Observable<<RemoteData<BitstreamFormat>> Emits the found bitstreamFormat based on the parameters in the current route,
|
* @returns Observable<<RemoteData<BitstreamFormat>> Emits the found bitstreamFormat based on the parameters in the current route,
|
||||||
* or an error if something went wrong
|
* or an error if something went wrong
|
||||||
*/
|
*/
|
||||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<RemoteData<BitstreamFormat>> {
|
export const bitstreamFormatsResolver: ResolveFn<RemoteData<BitstreamFormat>> = (
|
||||||
return this.bitstreamFormatDataService.findById(route.params.id)
|
route: ActivatedRouteSnapshot,
|
||||||
|
state: RouterStateSnapshot,
|
||||||
|
bitstreamFormatDataService: BitstreamFormatDataService = inject(BitstreamFormatDataService),
|
||||||
|
): Observable<RemoteData<BitstreamFormat>> => {
|
||||||
|
return bitstreamFormatDataService.findById(route.params.id)
|
||||||
.pipe(
|
.pipe(
|
||||||
getFirstCompletedRemoteData(),
|
getFirstCompletedRemoteData(),
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
|
||||||
|
@@ -26,6 +26,7 @@ import {
|
|||||||
} from '../../../../shared/remote-data.utils';
|
} from '../../../../shared/remote-data.utils';
|
||||||
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub';
|
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub';
|
||||||
import { RouterStub } from '../../../../shared/testing/router.stub';
|
import { RouterStub } from '../../../../shared/testing/router.stub';
|
||||||
|
import { FormatFormComponent } from '../format-form/format-form.component';
|
||||||
import { EditBitstreamFormatComponent } from './edit-bitstream-format.component';
|
import { EditBitstreamFormatComponent } from './edit-bitstream-format.component';
|
||||||
|
|
||||||
describe('EditBitstreamFormatComponent', () => {
|
describe('EditBitstreamFormatComponent', () => {
|
||||||
@@ -60,16 +61,22 @@ describe('EditBitstreamFormatComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
|
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, EditBitstreamFormatComponent],
|
||||||
declarations: [EditBitstreamFormatComponent],
|
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: ActivatedRoute, useValue: routeStub },
|
{ provide: ActivatedRoute, useValue: routeStub },
|
||||||
{ provide: Router, useValue: router },
|
{ provide: Router, useValue: router },
|
||||||
{ provide: NotificationsService, useValue: notificationService },
|
{ provide: NotificationsService, useValue: notificationService },
|
||||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
||||||
|
|
||||||
],
|
],
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
}).compileComponents();
|
})
|
||||||
|
.overrideComponent(EditBitstreamFormatComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [FormatFormComponent],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
};
|
};
|
||||||
|
|
||||||
const initBeforeEach = () => {
|
const initBeforeEach = () => {
|
||||||
@@ -111,8 +118,7 @@ describe('EditBitstreamFormatComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
|
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, EditBitstreamFormatComponent],
|
||||||
declarations: [EditBitstreamFormatComponent],
|
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: ActivatedRoute, useValue: routeStub },
|
{ provide: ActivatedRoute, useValue: routeStub },
|
||||||
{ provide: Router, useValue: router },
|
{ provide: Router, useValue: router },
|
||||||
@@ -120,7 +126,13 @@ describe('EditBitstreamFormatComponent', () => {
|
|||||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
||||||
],
|
],
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
}).compileComponents();
|
})
|
||||||
|
.overrideComponent(EditBitstreamFormatComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [FormatFormComponent],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
}));
|
}));
|
||||||
beforeEach(initBeforeEach);
|
beforeEach(initBeforeEach);
|
||||||
it('should send the updated form to the service, show a notification and navigate to ', () => {
|
it('should send the updated form to the service, show a notification and navigate to ', () => {
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import { AsyncPipe } from '@angular/common';
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
OnInit,
|
OnInit,
|
||||||
@@ -6,7 +7,10 @@ import {
|
|||||||
ActivatedRoute,
|
ActivatedRoute,
|
||||||
Router,
|
Router,
|
||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import {
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
@@ -16,6 +20,7 @@ import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model'
|
|||||||
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
|
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-paths';
|
import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-paths';
|
||||||
|
import { FormatFormComponent } from '../format-form/format-form.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders the edit page of a bitstream format.
|
* This component renders the edit page of a bitstream format.
|
||||||
@@ -24,6 +29,12 @@ import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-p
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-edit-bitstream-format',
|
selector: 'ds-edit-bitstream-format',
|
||||||
templateUrl: './edit-bitstream-format.component.html',
|
templateUrl: './edit-bitstream-format.component.html',
|
||||||
|
imports: [
|
||||||
|
FormatFormComponent,
|
||||||
|
TranslateModule,
|
||||||
|
AsyncPipe,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
export class EditBitstreamFormatComponent implements OnInit {
|
export class EditBitstreamFormatComponent implements OnInit {
|
||||||
|
|
||||||
|
@@ -22,6 +22,7 @@ import { TranslateModule } from '@ngx-translate/core';
|
|||||||
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
||||||
import { BitstreamFormatSupportLevel } from '../../../../core/shared/bitstream-format-support-level';
|
import { BitstreamFormatSupportLevel } from '../../../../core/shared/bitstream-format-support-level';
|
||||||
import { isEmpty } from '../../../../shared/empty.util';
|
import { isEmpty } from '../../../../shared/empty.util';
|
||||||
|
import { FormComponent } from '../../../../shared/form/form.component';
|
||||||
import { RouterStub } from '../../../../shared/testing/router.stub';
|
import { RouterStub } from '../../../../shared/testing/router.stub';
|
||||||
import { FormatFormComponent } from './format-form.component';
|
import { FormatFormComponent } from './format-form.component';
|
||||||
|
|
||||||
@@ -52,13 +53,24 @@ describe('FormatFormComponent', () => {
|
|||||||
|
|
||||||
const initAsync = () => {
|
const initAsync = () => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), ReactiveFormsModule, FormsModule, TranslateModule.forRoot(), NgbModule],
|
imports: [
|
||||||
declarations: [FormatFormComponent],
|
CommonModule,
|
||||||
providers: [
|
RouterTestingModule.withRoutes([]),
|
||||||
{ provide: Router, useValue: router },
|
ReactiveFormsModule,
|
||||||
|
FormsModule,
|
||||||
|
TranslateModule.forRoot(),
|
||||||
|
NgbModule,
|
||||||
|
FormatFormComponent,
|
||||||
],
|
],
|
||||||
|
providers: [{ provide: Router, useValue: router }],
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||||
}).compileComponents();
|
})
|
||||||
|
.overrideComponent(FormatFormComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [FormComponent],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
};
|
};
|
||||||
|
|
||||||
const initBeforeEach = () => {
|
const initBeforeEach = () => {
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import { NgIf } from '@angular/common';
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
@@ -11,12 +12,10 @@ import {
|
|||||||
DynamicFormArrayModel,
|
DynamicFormArrayModel,
|
||||||
DynamicFormControlLayout,
|
DynamicFormControlLayout,
|
||||||
DynamicFormControlModel,
|
DynamicFormControlModel,
|
||||||
DynamicFormService,
|
|
||||||
DynamicInputModel,
|
DynamicInputModel,
|
||||||
DynamicSelectModel,
|
DynamicSelectModel,
|
||||||
DynamicTextAreaModel,
|
DynamicTextAreaModel,
|
||||||
} from '@ng-dynamic-forms/core';
|
} from '@ng-dynamic-forms/core';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
|
||||||
|
|
||||||
import { environment } from '../../../../../environments/environment';
|
import { environment } from '../../../../../environments/environment';
|
||||||
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
||||||
@@ -25,6 +24,7 @@ import {
|
|||||||
hasValue,
|
hasValue,
|
||||||
isEmpty,
|
isEmpty,
|
||||||
} from '../../../../shared/empty.util';
|
} from '../../../../shared/empty.util';
|
||||||
|
import { FormComponent } from '../../../../shared/form/form.component';
|
||||||
import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-paths';
|
import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-paths';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,6 +33,11 @@ import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-p
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-bitstream-format-form',
|
selector: 'ds-bitstream-format-form',
|
||||||
templateUrl: './format-form.component.html',
|
templateUrl: './format-form.component.html',
|
||||||
|
imports: [
|
||||||
|
FormComponent,
|
||||||
|
NgIf,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
export class FormatFormComponent implements OnInit {
|
export class FormatFormComponent implements OnInit {
|
||||||
|
|
||||||
@@ -132,9 +137,7 @@ export class FormatFormComponent implements OnInit {
|
|||||||
}, this.arrayElementLayout),
|
}, this.arrayElementLayout),
|
||||||
];
|
];
|
||||||
|
|
||||||
constructor(private dynamicFormService: DynamicFormService,
|
constructor(private router: Router) {
|
||||||
private translateService: TranslateService,
|
|
||||||
private router: Router) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,25 +10,36 @@ import {
|
|||||||
waitForAsync,
|
waitForAsync,
|
||||||
} from '@angular/core/testing';
|
} from '@angular/core/testing';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
|
import { RouterLink } from '@angular/router';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
|
import { FormBuilderService } from 'src/app/shared/form/builder/form-builder.service';
|
||||||
|
|
||||||
import { RestResponse } from '../../../core/cache/response.models';
|
import { RestResponse } from '../../../core/cache/response.models';
|
||||||
|
import { ConfigurationDataService } from '../../../core/data/configuration-data.service';
|
||||||
import { buildPaginatedList } from '../../../core/data/paginated-list.model';
|
import { buildPaginatedList } from '../../../core/data/paginated-list.model';
|
||||||
|
import { GroupDataService } from '../../../core/eperson/group-data.service';
|
||||||
import { MetadataSchema } from '../../../core/metadata/metadata-schema.model';
|
import { MetadataSchema } from '../../../core/metadata/metadata-schema.model';
|
||||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||||
import { RegistryService } from '../../../core/registry/registry.service';
|
import { RegistryService } from '../../../core/registry/registry.service';
|
||||||
|
import { ConfigurationProperty } from '../../../core/shared/configuration-property.model';
|
||||||
|
import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
|
||||||
|
import { FormService } from '../../../shared/form/form.service';
|
||||||
import { HostWindowService } from '../../../shared/host-window.service';
|
import { HostWindowService } from '../../../shared/host-window.service';
|
||||||
|
import { getMockFormBuilderService } from '../../../shared/mocks/form-builder-service.mock';
|
||||||
|
import { getMockFormService } from '../../../shared/mocks/form-service.mock';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||||
import { HostWindowServiceStub } from '../../../shared/testing/host-window-service.stub';
|
import { HostWindowServiceStub } from '../../../shared/testing/host-window-service.stub';
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||||
|
import { SearchConfigurationServiceStub } from '../../../shared/testing/search-configuration-service.stub';
|
||||||
import { EnumKeysPipe } from '../../../shared/utils/enum-keys-pipe';
|
import { EnumKeysPipe } from '../../../shared/utils/enum-keys-pipe';
|
||||||
import { MetadataRegistryComponent } from './metadata-registry.component';
|
import { MetadataRegistryComponent } from './metadata-registry.component';
|
||||||
|
import { MetadataSchemaFormComponent } from './metadata-schema-form/metadata-schema-form.component';
|
||||||
|
|
||||||
describe('MetadataRegistryComponent', () => {
|
describe('MetadataRegistryComponent', () => {
|
||||||
let comp: MetadataRegistryComponent;
|
let comp: MetadataRegistryComponent;
|
||||||
@@ -76,20 +87,67 @@ describe('MetadataRegistryComponent', () => {
|
|||||||
|
|
||||||
paginationService = new PaginationServiceStub();
|
paginationService = new PaginationServiceStub();
|
||||||
|
|
||||||
|
const configurationDataService = jasmine.createSpyObj('configurationDataService', {
|
||||||
|
findByPropertyName: createSuccessfulRemoteDataObject$(Object.assign(new ConfigurationProperty(), {
|
||||||
|
name: 'test',
|
||||||
|
values: [
|
||||||
|
'org.dspace.ctask.general.ProfileFormats = test',
|
||||||
|
],
|
||||||
|
})),
|
||||||
|
});
|
||||||
|
|
||||||
|
const mockGroupService = jasmine.createSpyObj('groupService',
|
||||||
|
{
|
||||||
|
// findByHref: jasmine.createSpy('findByHref'),
|
||||||
|
// findAll: jasmine.createSpy('findAll'),
|
||||||
|
// searchGroups: jasmine.createSpy('searchGroups'),
|
||||||
|
getUUIDFromString: jasmine.createSpy('getUUIDFromString'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
linkPath: 'groups',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
|
imports: [
|
||||||
declarations: [MetadataRegistryComponent, PaginationComponent, EnumKeysPipe],
|
CommonModule,
|
||||||
|
RouterTestingModule.withRoutes([]),
|
||||||
|
TranslateModule.forRoot(),
|
||||||
|
NgbModule,
|
||||||
|
MetadataRegistryComponent,
|
||||||
|
PaginationComponent,
|
||||||
|
EnumKeysPipe,
|
||||||
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: RegistryService, useValue: registryServiceStub },
|
{ provide: RegistryService, useValue: registryServiceStub },
|
||||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
||||||
{ provide: PaginationService, useValue: paginationService },
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
{
|
||||||
|
provide: NotificationsService,
|
||||||
|
useValue: new NotificationsServiceStub(),
|
||||||
|
},
|
||||||
|
{ provide: FormService, useValue: getMockFormService() },
|
||||||
|
{ provide: GroupDataService, useValue: mockGroupService },
|
||||||
|
{
|
||||||
|
provide: ConfigurationDataService,
|
||||||
|
useValue: configurationDataService,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: SearchConfigurationService,
|
||||||
|
useValue: new SearchConfigurationServiceStub(),
|
||||||
|
},
|
||||||
|
{ provide: FormBuilderService, useValue: getMockFormBuilderService() },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).overrideComponent(MetadataRegistryComponent, {
|
})
|
||||||
set: { changeDetection: ChangeDetectionStrategy.Default },
|
.overrideComponent(MetadataRegistryComponent, {
|
||||||
}).compileComponents();
|
remove: {
|
||||||
|
imports: [MetadataSchemaFormComponent, RouterLink],
|
||||||
|
},
|
||||||
|
add: { changeDetection: ChangeDetectionStrategy.Default },
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@@ -1,6 +1,18 @@
|
|||||||
|
import {
|
||||||
|
AsyncPipe,
|
||||||
|
NgClass,
|
||||||
|
NgForOf,
|
||||||
|
NgIf,
|
||||||
|
} from '@angular/common';
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import {
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
Router,
|
||||||
|
RouterLink,
|
||||||
|
} from '@angular/router';
|
||||||
|
import {
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
import {
|
import {
|
||||||
BehaviorSubject,
|
BehaviorSubject,
|
||||||
combineLatest as observableCombineLatest,
|
combineLatest as observableCombineLatest,
|
||||||
@@ -23,13 +35,26 @@ import { NoContent } from '../../../core/shared/NoContent.model';
|
|||||||
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||||
import { hasValue } from '../../../shared/empty.util';
|
import { hasValue } from '../../../shared/empty.util';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
|
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
||||||
import { toFindListOptions } from '../../../shared/pagination/pagination.utils';
|
import { toFindListOptions } from '../../../shared/pagination/pagination.utils';
|
||||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||||
|
import { MetadataSchemaFormComponent } from './metadata-schema-form/metadata-schema-form.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-metadata-registry',
|
selector: 'ds-metadata-registry',
|
||||||
templateUrl: './metadata-registry.component.html',
|
templateUrl: './metadata-registry.component.html',
|
||||||
styleUrls: ['./metadata-registry.component.scss'],
|
styleUrls: ['./metadata-registry.component.scss'],
|
||||||
|
imports: [
|
||||||
|
MetadataSchemaFormComponent,
|
||||||
|
TranslateModule,
|
||||||
|
AsyncPipe,
|
||||||
|
PaginationComponent,
|
||||||
|
NgIf,
|
||||||
|
NgForOf,
|
||||||
|
NgClass,
|
||||||
|
RouterLink,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* A component used for managing all existing metadata schemas within the repository.
|
* A component used for managing all existing metadata schemas within the repository.
|
||||||
|
@@ -14,6 +14,8 @@ import { of as observableOf } from 'rxjs';
|
|||||||
import { MetadataSchema } from '../../../../core/metadata/metadata-schema.model';
|
import { MetadataSchema } from '../../../../core/metadata/metadata-schema.model';
|
||||||
import { RegistryService } from '../../../../core/registry/registry.service';
|
import { RegistryService } from '../../../../core/registry/registry.service';
|
||||||
import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service';
|
||||||
|
import { FormComponent } from '../../../../shared/form/form.component';
|
||||||
|
import { getMockFormBuilderService } from '../../../../shared/mocks/form-builder-service.mock';
|
||||||
import { EnumKeysPipe } from '../../../../shared/utils/enum-keys-pipe';
|
import { EnumKeysPipe } from '../../../../shared/utils/enum-keys-pipe';
|
||||||
import { MetadataSchemaFormComponent } from './metadata-schema-form.component';
|
import { MetadataSchemaFormComponent } from './metadata-schema-form.component';
|
||||||
|
|
||||||
@@ -44,14 +46,19 @@ describe('MetadataSchemaFormComponent', () => {
|
|||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
return TestBed.configureTestingModule({
|
return TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
|
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, MetadataSchemaFormComponent, EnumKeysPipe],
|
||||||
declarations: [MetadataSchemaFormComponent, EnumKeysPipe],
|
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: RegistryService, useValue: registryServiceStub },
|
{ provide: RegistryService, useValue: registryServiceStub },
|
||||||
{ provide: FormBuilderService, useValue: formBuilderServiceStub },
|
{ provide: FormBuilderService, useValue: getMockFormBuilderService() },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
})
|
||||||
|
.overrideComponent(MetadataSchemaFormComponent, {
|
||||||
|
remove: {
|
||||||
|
imports: [FormComponent],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@@ -1,3 +1,7 @@
|
|||||||
|
import {
|
||||||
|
AsyncPipe,
|
||||||
|
NgIf,
|
||||||
|
} from '@angular/common';
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
@@ -12,7 +16,10 @@ import {
|
|||||||
DynamicFormLayout,
|
DynamicFormLayout,
|
||||||
DynamicInputModel,
|
DynamicInputModel,
|
||||||
} from '@ng-dynamic-forms/core';
|
} from '@ng-dynamic-forms/core';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import {
|
||||||
|
TranslateModule,
|
||||||
|
TranslateService,
|
||||||
|
} from '@ngx-translate/core';
|
||||||
import {
|
import {
|
||||||
combineLatest,
|
combineLatest,
|
||||||
Observable,
|
Observable,
|
||||||
@@ -26,10 +33,18 @@ import {
|
|||||||
import { MetadataSchema } from '../../../../core/metadata/metadata-schema.model';
|
import { MetadataSchema } from '../../../../core/metadata/metadata-schema.model';
|
||||||
import { RegistryService } from '../../../../core/registry/registry.service';
|
import { RegistryService } from '../../../../core/registry/registry.service';
|
||||||
import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service';
|
||||||
|
import { FormComponent } from '../../../../shared/form/form.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-metadata-schema-form',
|
selector: 'ds-metadata-schema-form',
|
||||||
templateUrl: './metadata-schema-form.component.html',
|
templateUrl: './metadata-schema-form.component.html',
|
||||||
|
imports: [
|
||||||
|
NgIf,
|
||||||
|
AsyncPipe,
|
||||||
|
TranslateModule,
|
||||||
|
FormComponent,
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* A form used for creating and editing metadata schemas
|
* A form used for creating and editing metadata schemas
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user