Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into poc-eslint-plugin-aut…
Browse files Browse the repository at this point in the history
…ofix-selectors
  • Loading branch information
ybnd committed Apr 30, 2024
2 parents 3a0c964 + a8f65ce commit c9d9e12
Show file tree
Hide file tree
Showing 35 changed files with 180 additions and 90 deletions.
15 changes: 15 additions & 0 deletions cypress/e2e/item-template.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const ADD_TEMPLATE_ITEM_PAGE = '/collections/'.concat(Cypress.env('DSPACE_TEST_COLLECTION')).concat('/itemtemplate');

describe('Item Template', () => {
beforeEach(() => {
cy.visit(ADD_TEMPLATE_ITEM_PAGE);
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));
});

it('should load properly', () => {
cy.contains('.ds-header-row .lbl-cell', 'Field', { timeout: 10000 }).should('exist').should('be.visible');
cy.contains('.ds-header-row b', 'Value', { timeout: 10000 }).should('exist').should('be.visible');
cy.contains('.ds-header-row b', 'Lang', { timeout: 10000 }).should('exist').should('be.visible');
cy.contains('.ds-header-row b', 'Edit', { timeout: 10000 }).should('exist').should('be.visible');
});
});
26 changes: 13 additions & 13 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ the Docker compose scripts in this 'docker' folder.

### Dockerfile

This Dockerfile is used to build a *development* DSpace 7 Angular UI image, published as 'dspace/dspace-angular'
This Dockerfile is used to build a *development* DSpace Angular UI image, published as 'dspace/dspace-angular'

```
docker build -t dspace/dspace-angular:latest .
Expand All @@ -46,11 +46,11 @@ A default/demo version of this image is built *automatically*.

## 'docker' directory
- docker-compose.yml
- Starts DSpace Angular with Docker Compose from the current branch. This file assumes that a DSpace 7 REST instance will also be started in Docker.
- Starts DSpace Angular with Docker Compose from the current branch. This file assumes that a DSpace REST instance will also be started in Docker.
- docker-compose-rest.yml
- Runs a published instance of the DSpace 7 REST API - persists data in Docker volumes
- Runs a published instance of the DSpace REST API - persists data in Docker volumes
- docker-compose-ci.yml
- Runs a published instance of the DSpace 7 REST API for CI testing. The database is re-populated from a SQL dump on each startup.
- Runs a published instance of the DSpace REST API for CI testing. The database is re-populated from a SQL dump on each startup.
- cli.yml
- Docker compose file that provides a DSpace CLI container to work with a running DSpace REST container.
- cli.assetstore.yml
Expand All @@ -71,7 +71,7 @@ docker-compose -f docker/docker-compose.yml build

This command provides a quick way to start both the frontend & backend from this single codebase
```
docker-compose -p d7 -f docker/docker-compose.yml -f docker/docker-compose-rest.yml up -d
docker-compose -p d8 -f docker/docker-compose.yml -f docker/docker-compose-rest.yml up -d
```

Keep in mind, you may also start the backend by cloning the 'DSpace/DSpace' GitHub repository separately. See the next section.
Expand All @@ -86,14 +86,14 @@ _The system will be started in 2 steps. Each step shares the same docker network

From 'DSpace/DSpace' clone (build first as needed):
```
docker-compose -p d7 up -d
docker-compose -p d8 up -d
```

NOTE: More detailed instructions on starting the backend via Docker can be found in the [Docker Compose instructions for the Backend](https://github.com/DSpace/DSpace/blob/main/dspace/src/main/docker-compose/README.md).

From 'DSpace/dspace-angular' clone (build first as needed)
```
docker-compose -p d7 -f docker/docker-compose.yml up -d
docker-compose -p d8 -f docker/docker-compose.yml up -d
```

At this point, you should be able to access the UI from http://localhost:4000,
Expand All @@ -107,38 +107,38 @@ This allows you to run the Angular UI in *production* mode, pointing it at the d
```
docker-compose -f docker/docker-compose-dist.yml pull
docker-compose -f docker/docker-compose-dist.yml build
docker-compose -p d7 -f docker/docker-compose-dist.yml up -d
docker-compose -p d8 -f docker/docker-compose-dist.yml up -d
```

## Ingest test data from AIPDIR

Create an administrator
```
docker-compose -p d7 -f docker/cli.yml run --rm dspace-cli create-administrator -e [email protected] -f admin -l user -p admin -c en
docker-compose -p d8 -f docker/cli.yml run --rm dspace-cli create-administrator -e [email protected] -f admin -l user -p admin -c en
```

Load content from AIP files
```
docker-compose -p d7 -f docker/cli.yml -f ./docker/cli.ingest.yml run --rm dspace-cli
docker-compose -p d8 -f docker/cli.yml -f ./docker/cli.ingest.yml run --rm dspace-cli
```

## Alternative Ingest - Use Entities dataset
_Delete your docker volumes or use a unique project (-p) name_

Start DSpace with Database Content from a database dump
```
docker-compose -p d7 -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f docker/db.entities.yml up -d
docker-compose -p d8 -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f docker/db.entities.yml up -d
```

Load assetstore content and trigger a re-index of the repository
```
docker-compose -p d7 -f docker/cli.yml -f docker/cli.assetstore.yml run --rm dspace-cli
docker-compose -p d8 -f docker/cli.yml -f docker/cli.assetstore.yml run --rm dspace-cli
```

## End to end testing of the REST API (runs in GitHub Actions CI).
_In this instance, only the REST api runs in Docker using the Entities dataset. GitHub Actions will perform CI testing of Angular using Node to drive the tests. See `.github/workflows/build.yml` for more details._

This command is only really useful for testing our Continuous Integration process.
```
docker-compose -p d7ci -f docker/docker-compose-ci.yml up -d
docker-compose -p d8ci -f docker/docker-compose-ci.yml up -d
```
9 changes: 8 additions & 1 deletion docker/docker-compose-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ services:
# Tell Statistics to commit all views immediately instead of waiting on Solr's autocommit.
# This allows us to generate statistics in e2e tests so that statistics pages can be tested thoroughly.
solr__D__statistics__P__autoCommit: 'false'
LOGGING_CONFIG: /dspace/config/log4j2-container.xml
image: "${DOCKER_OWNER:-dspace}/dspace:${DSPACE_VER:-latest-test}"
depends_on:
- dspacedb
Expand Down Expand Up @@ -60,15 +61,19 @@ services:
# NOTE: This is customized to use our loadsql image, so that we are using a database with existing test data
dspacedb:
container_name: dspacedb
image: "${DOCKER_OWNER:-dspace}/dspace-postgres-pgcrypto:${DSPACE_VER:-latest-loadsql}"
environment:
# This LOADSQL should be kept in sync with the LOADSQL in
# https://github.com/DSpace/DSpace/blob/main/dspace/src/main/docker-compose/db.entities.yml
# This SQL is available from https://github.com/DSpace-Labs/AIP-Files/releases/tag/demo-entities-data
LOADSQL: https://github.com/DSpace-Labs/AIP-Files/releases/download/demo-entities-data/dspace7-entities-data.sql
PGDATA: /pgdata
image: dspace/dspace-postgres-pgcrypto:loadsql
POSTGRES_PASSWORD: dspace
networks:
- dspacenet
ports:
- published: 5432
target: 5432
stdin_open: true
tty: true
volumes:
Expand Down Expand Up @@ -105,6 +110,8 @@ services:
cp -r /opt/solr/server/solr/configsets/statistics/* statistics
precreate-core qaevent /opt/solr/server/solr/configsets/qaevent
cp -r /opt/solr/server/solr/configsets/qaevent/* qaevent
precreate-core suggestion /opt/solr/server/solr/configsets/suggestion
cp -r /opt/solr/server/solr/configsets/suggestion/* suggestion
exec solr -f
volumes:
assetstore:
Expand Down
13 changes: 10 additions & 3 deletions docker/docker-compose-rest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ services:
# __D__ => "-" (e.g. google__D__metadata => google-metadata)
# dspace.dir, dspace.server.url, dspace.ui.url and dspace.name
dspace__P__dir: /dspace
dspace__P__server__P__url: http://localhost:8080/server
dspace__P__ui__P__url: http://localhost:4000
# Uncomment to set a non-default value for dspace.server.url or dspace.ui.url
# dspace__P__server__P__url: http://localhost:8080/server
# dspace__P__ui__P__url: http://localhost:4000
dspace__P__name: 'DSpace Started with Docker Compose'
# db.url: Ensure we are using the 'dspacedb' image for our database
db__P__url: 'jdbc:postgresql://dspacedb:5432/dspace'
Expand All @@ -39,6 +40,7 @@ services:
# proxies.trusted.ipranges: This setting is required for a REST API running in Docker to trust requests
# from the host machine. This IP range MUST correspond to the 'dspacenet' subnet defined above.
proxies__P__trusted__P__ipranges: '172.23.0'
LOGGING_CONFIG: /dspace/config/log4j2-container.xml
image: "${DOCKER_OWNER:-dspace}/dspace:${DSPACE_VER:-latest-test}"
depends_on:
- dspacedb
Expand All @@ -50,6 +52,7 @@ services:
stdin_open: true
tty: true
volumes:
# Keep DSpace assetstore directory between reboots
- assetstore:/dspace/assetstore
# Ensure that the database is ready BEFORE starting tomcat
# 1. While a TCP connection to dspacedb port 5432 is not available, continue to sleep
Expand All @@ -65,9 +68,11 @@ services:
# DSpace database container
dspacedb:
container_name: dspacedb
# Uses a custom Postgres image with pgcrypto installed
image: "${DOCKER_OWNER:-dspace}/dspace-postgres-pgcrypto:${DSPACE_VER:-latest}"
environment:
PGDATA: /pgdata
image: "${DOCKER_OWNER:-dspace}/dspace-postgres-pgcrypto:${DSPACE_VER:-latest}"
POSTGRES_PASSWORD: dspace
networks:
- dspacenet
ports:
Expand Down Expand Up @@ -113,6 +118,8 @@ services:
cp -r /opt/solr/server/solr/configsets/statistics/* statistics
precreate-core qaevent /opt/solr/server/solr/configsets/qaevent
cp -r /opt/solr/server/solr/configsets/qaevent/* qaevent
precreate-core suggestion /opt/solr/server/solr/configsets/suggestion
cp -r /opt/solr/server/solr/configsets/suggestion/* suggestion
exec solr -f
volumes:
assetstore:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ describe('SubmissionJsonPatchOperationsService', () => {
const rdbService = {} as RemoteDataBuildService;
const halEndpointService = {} as HALEndpointService;

const uuid = '91ecbeda-99fe-42ac-9430-b9b75af56f78';
const href = 'https://rest.api/some/self/link?with=maybe&a=few&other=parameters';

function initTestService() {
return new SubmissionJsonPatchOperationsService(
requestService,
Expand All @@ -36,4 +39,16 @@ describe('SubmissionJsonPatchOperationsService', () => {
expect((service as any).patchRequestConstructor).toEqual(SubmissionPatchRequest);
});

describe(`getRequestInstance`, () => {
it(`should add a parameter to embed the item to the request URL`, () => {
const result = (service as any).getRequestInstance(uuid, href);
const resultURL = new URL(result.href);
expect(resultURL.searchParams.get('embed')).toEqual('item');

// if we delete the embed item param, it should be identical to the original url
resultURL.searchParams.delete('embed', 'item');
expect(href).toEqual(resultURL.toString());
});
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { RequestService } from '../data/request.service';
import { JsonPatchOperationsService } from '../json-patch/json-patch-operations.service';
import { HALEndpointService } from '../shared/hal-endpoint.service';
import { SubmitDataResponseDefinitionObject } from '../shared/submit-data-response-definition.model';
import { URLCombiner } from '../url-combiner/url-combiner';

/**
* A service that provides methods to make JSON Patch requests.
Expand All @@ -26,4 +27,20 @@ export class SubmissionJsonPatchOperationsService extends JsonPatchOperationsSer
super();
}

/**
* Return an instance for RestRequest class
*
* @param uuid
* The request uuid
* @param href
* The request href
* @param body
* The request body
* @return Object<PatchRequestDefinition>
* instance of PatchRequestDefinition
*/
protected getRequestInstance(uuid: string, href: string, body?: any): SubmissionPatchRequest {
return new this.patchRequestConstructor(uuid, new URLCombiner(href, '?embed=item').toString(), body);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import {
import {
BehaviorSubject,
combineLatest as observableCombineLatest,
EMPTY,
Observable,
of,
Subscription,
} from 'rxjs';
import {
Expand Down Expand Up @@ -188,7 +188,7 @@ export class DsoEditMetadataComponent implements OnInit, OnDestroy {
const lazyProvider$: Observable<UpdateDataService<DSpaceObject>> = lazyDataService(this.dataServiceMap, this.dsoType, this.parentInjector);
return lazyProvider$;
} else {
return EMPTY;
return of(this.updateDataService);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<a class="badge badge-primary mr-1 mb-1"
<a class="badge badge-primary mb-1"
[attr.aria-label]="'search.filters.remove' | translate:{ type: ('search.filters.applied.' + key) | translate, value: normalizeFilterValue(value) }"
[routerLink]="searchLink"
[queryParams]="(removeParameters | async)" queryParamsHandling="merge">
{{('search.filters.applied.' + key) | translate}}: {{'search.filters.' + filterName + '.' + value | translate: {default: normalizeFilterValue(value)} }}
<span aria-hidden="true"> ×</span>
<span class="d-flex">
<span class="flex-grow-1 text-left">{{('search.filters.applied.' + key) | translate}}: {{'search.filters.' + filterName + '.' + value | translate: {default: normalizeFilterValue(value)} }}</span>
<span class="pl-1" aria-hidden="true">×</span>
</span>
</a>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.badge {
white-space: inherit;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { stripOperatorFromFilterValue } from '../../search.utils';
@Component({
selector: 'ds-search-label',
templateUrl: './search-label.component.html',
styleUrls: ['./search-label.component.scss'],
standalone: true,
imports: [RouterLink, AsyncPipe, TranslateModule],
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
:host {
line-height: 1;
}
.labels {
margin: 0 calc(-1 * var(--bs-spacer)/8);
ds-search-label {
display: inline-block;
padding: 0 calc(var(--bs-spacer)/8);
}
}
}
4 changes: 2 additions & 2 deletions src/app/shared/search/search.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
[inPlaceSearch]="inPlaceSearch"
[searchPlaceholder]="searchFormPlaceholder | translate">
</ds-search-form>
<div class="row mb-3 mb-md-1">
<div class="labels col-sm-9">
<div class="mb-3 mb-md-1">
<div class="labels">
<ds-search-labels [inPlaceSearch]="inPlaceSearch"></ds-search-labels>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/robots.txt.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Disallow: /submit
Disallow: /workspaceitems
Disallow: /profile
Disallow: /workflowitems
# Crawlers should be able to access entity pages, but not the facet search links present on entity pages
Disallow: /entities/*?f

# Optionally uncomment the following line ONLY if sitemaps are working
# and you have verified that your site is being indexed correctly.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import {
NgIf,
} from '@angular/common';
import { Component } from '@angular/core';
import { RouterModule } from '@angular/router';
import { RouterLink } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core';

import { BrowseByTaxonomyComponent as BaseComponent } from '../../../../../app/browse-by/browse-by-taxonomy/browse-by-taxonomy.component';
import { BrowseByComponent } from '../../../../../app/shared/browse-by/browse-by.component';
import { ThemedBrowseByComponent } from '../../../../../app/shared/browse-by/themed-browse-by.component';
import { ThemedComcolPageBrowseByComponent } from '../../../../../app/shared/comcol/comcol-page-browse-by/themed-comcol-page-browse-by.component';
import { ComcolPageContentComponent } from '../../../../../app/shared/comcol/comcol-page-content/comcol-page-content.component';
Expand All @@ -31,15 +32,16 @@ import { VarDirective } from '../../../../../app/shared/utils/var.directive';
ComcolPageHeaderComponent,
ComcolPageLogoComponent,
NgIf,
RouterModule,
ThemedComcolPageHandleComponent,
ComcolPageContentComponent,
DsoEditMenuComponent,
ThemedComcolPageBrowseByComponent,
VocabularyTreeviewComponent,
BrowseByComponent,
TranslateModule,
ThemedLoadingComponent,
ThemedBrowseByComponent,
VocabularyTreeviewComponent,
RouterLink,
],
})
export class BrowseByTaxonomyComponent extends BaseComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import { ViewTrackerComponent } from '../../../../app/statistics/angulartics/dsp
ComcolPageContentComponent,
ErrorComponent,
NgIf,
RouterOutlet,
ThemedLoadingComponent,
TranslateModule,
ViewTrackerComponent,
Expand All @@ -55,6 +54,7 @@ import { ViewTrackerComponent } from '../../../../app/statistics/angulartics/dsp
DsoEditMenuComponent,
ThemedComcolPageBrowseByComponent,
ObjectCollectionComponent,
RouterOutlet,
],
})
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { ThemedDsoEditMetadataComponent } from '../../../../../app/dso-shared/ds
import { AlertComponent } from '../../../../../app/shared/alert/alert.component';
import { ThemedLoadingComponent } from '../../../../../app/shared/loading/themed-loading.component';
import { VarDirective } from '../../../../../app/shared/utils/var.directive';
import { DsoEditMetadataComponent } from '../../dso-shared/dso-edit-metadata/dso-edit-metadata.component';

@Component({
selector: 'ds-themed-edit-item-template-page',
Expand All @@ -20,6 +21,7 @@ import { VarDirective } from '../../../../../app/shared/utils/var.directive';
standalone: true,
imports: [
ThemedDsoEditMetadataComponent,
DsoEditMetadataComponent,
RouterLink,
AsyncPipe,
VarDirective,
Expand Down
Loading

0 comments on commit c9d9e12

Please sign in to comment.