Skip to content

Commit

Permalink
Merge branch 'advance-search-search-page' of https://github.com/Gaura…
Browse files Browse the repository at this point in the history
…vD2t/Advanced-search into advance-search-search-page
  • Loading branch information
GauravD2t committed Feb 12, 2024
2 parents c225941 + 7282b44 commit b918413
Show file tree
Hide file tree
Showing 100 changed files with 842 additions and 906 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
#CHROME_VERSION: "90.0.4430.212-1"
# Bump Node heap size (OOM in CI after upgrading to Angular 15)
NODE_OPTIONS: '--max-old-space-size=4096'
# Project name to use when running docker-compose prior to e2e tests
COMPOSE_PROJECT_NAME: 'ci'
strategy:
# Create a matrix of Node versions to test against (in parallel)
matrix:
Expand Down
5 changes: 0 additions & 5 deletions docker/cli.assetstore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@
# Therefore, it should be kept in sync with that file
version: "3.7"

networks:
dspacenet:

services:
dspace-cli:
networks:
dspacenet: {}
environment:
# This assetstore zip is available from https://github.com/DSpace-Labs/AIP-Files/releases/tag/demo-entities-data
- LOADASSETS=https://github.com/DSpace-Labs/AIP-Files/releases/download/demo-entities-data/assetstore.tar.gz
Expand Down
16 changes: 9 additions & 7 deletions docker/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
#
# Therefore, it should be kept in sync with that file
version: "3.7"

networks:
# Default to using network named 'dspacenet' from docker-compose-rest.yml.
# Its full name will be prepended with the project name (e.g. "-p d7" means it will be named "d7_dspacenet")
# If COMPOSITE_PROJECT_NAME is missing, default value will be "docker" (name of folder this file is in)
default:
name: ${COMPOSE_PROJECT_NAME:-docker}_dspacenet
external: true
services:
dspace-cli:
image: "${DOCKER_OWNER:-dspace}/dspace-cli:${DSPACE_VER:-latest}"
Expand All @@ -30,16 +36,12 @@ services:
# solr.server: Ensure we are using the 'dspacesolr' image for Solr
solr__P__server: http://dspacesolr:8983/solr
volumes:
- "assetstore:/dspace/assetstore"
# Keep DSpace assetstore directory between reboots
- assetstore:/dspace/assetstore
entrypoint: /dspace/bin/dspace
command: help
networks:
- dspacenet
tty: true
stdin_open: true

volumes:
assetstore:

networks:
dspacenet:
36 changes: 16 additions & 20 deletions docker/docker-compose-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,18 @@ 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'
image: "${DOCKER_OWNER:-dspace}/dspace:${DSPACE_VER:-latest-test}"
depends_on:
- dspacedb
image: dspace/dspace:latest-test
networks:
dspacenet:
- dspacenet
ports:
- published: 8080
target: 8080
stdin_open: true
tty: true
volumes:
- assetstore:/dspace/assetstore
# Mount DSpace's solr configs to a volume, so that we can share to 'dspacesolr' container (see below)
- solr_configs:/dspace/solr
# Ensure that the database is ready BEFORE starting tomcat
# 1. While a TCP connection to dspacedb port 5432 is not available, continue to sleep
# 2. Then, run database migration to init database tables (including any out-of-order ignored migrations, if any)
Expand All @@ -70,31 +68,25 @@ services:
PGDATA: /pgdata
image: dspace/dspace-postgres-pgcrypto:loadsql
networks:
dspacenet:
- dspacenet
stdin_open: true
tty: true
volumes:
# Keep Postgres data directory between reboots
- pgdata:/pgdata
# DSpace Solr container
dspacesolr:
container_name: dspacesolr
# Uses official Solr image at https://hub.docker.com/_/solr/
image: solr:8.11-slim
# Needs main 'dspace' container to start first to guarantee access to solr_configs
depends_on:
- dspace
image: "${DOCKER_OWNER:-dspace}/dspace-solr:${DSPACE_VER:-latest}"
networks:
dspacenet:
- dspacenet
ports:
- published: 8983
target: 8983
stdin_open: true
tty: true
working_dir: /var/solr/data
volumes:
# Mount our "solr_configs" volume available under the Solr's configsets folder (in a 'dspace' subfolder)
# This copies the Solr configs from main 'dspace' container into 'dspacesolr' via that volume
- solr_configs:/opt/solr/server/solr/configsets/dspace
# Keep Solr data directory between reboots
- solr_data:/var/solr/data
# Initialize all DSpace Solr cores using the mounted configsets (see above), then start Solr
Expand All @@ -103,14 +95,18 @@ services:
- '-c'
- |
init-var-solr
precreate-core authority /opt/solr/server/solr/configsets/dspace/authority
precreate-core oai /opt/solr/server/solr/configsets/dspace/oai
precreate-core search /opt/solr/server/solr/configsets/dspace/search
precreate-core statistics /opt/solr/server/solr/configsets/dspace/statistics
precreate-core authority /opt/solr/server/solr/configsets/authority
cp -r /opt/solr/server/solr/configsets/authority/* authority
precreate-core oai /opt/solr/server/solr/configsets/oai
cp -r /opt/solr/server/solr/configsets/oai/* oai
precreate-core search /opt/solr/server/solr/configsets/search
cp -r /opt/solr/server/solr/configsets/search/* search
precreate-core statistics /opt/solr/server/solr/configsets/statistics
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
exec solr -f
volumes:
assetstore:
pgdata:
solr_data:
# Special volume used to share Solr configs from 'dspace' to 'dspacesolr' container (see above)
solr_configs:
18 changes: 7 additions & 11 deletions docker/docker-compose-rest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,14 @@ services:
depends_on:
- dspacedb
networks:
dspacenet:
- dspacenet
ports:
- published: 8080
target: 8080
stdin_open: true
tty: true
volumes:
- assetstore:/dspace/assetstore
# Mount DSpace's solr configs to a volume, so that we can share to 'dspacesolr' container (see below)
- solr_configs:/dspace/solr
# Ensure that the database is ready BEFORE starting tomcat
# 1. While a TCP connection to dspacedb port 5432 is not available, continue to sleep
# 2. Then, run database migration to init database tables
Expand All @@ -69,25 +67,23 @@ services:
container_name: dspacedb
environment:
PGDATA: /pgdata
image: dspace/dspace-postgres-pgcrypto
image: "${DOCKER_OWNER:-dspace}/dspace-postgres-pgcrypto:${DSPACE_VER:-latest}"
networks:
dspacenet:
- dspacenet
ports:
- published: 5432
target: 5432
stdin_open: true
tty: true
volumes:
# Keep Postgres data directory between reboots
- pgdata:/pgdata
# DSpace Solr container
dspacesolr:
container_name: dspacesolr
image: "${DOCKER_OWNER:-dspace}/dspace-solr:${DSPACE_VER:-latest}"
# Needs main 'dspace' container to start first to guarantee access to solr_configs
depends_on:
- dspace
networks:
dspacenet:
- dspacenet
ports:
- published: 8983
target: 8983
Expand Down Expand Up @@ -115,10 +111,10 @@ services:
cp -r /opt/solr/server/solr/configsets/search/* search
precreate-core statistics /opt/solr/server/solr/configsets/statistics
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
exec solr -f
volumes:
assetstore:
pgdata:
solr_data:
# Special volume used to share Solr configs from 'dspace' to 'dspacesolr' container (see above)
solr_configs:
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ng-template dsListableObject>
<ng-template dsDynamicComponentLoader>
</ng-template>
<div #badges>
<ng-content></ng-content>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, ComponentFactoryResolver, ElementRef, OnInit, ViewChild } from '@angular/core';
import { Component, ComponentRef, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { Item } from '../../../../../core/shared/item.model';
import { ViewMode } from '../../../../../core/shared/view-mode.model';
import {
Expand All @@ -11,9 +11,10 @@ import { SearchResultGridElementComponent } from '../../../../../shared/object-g
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
import { BitstreamDataService } from '../../../../../core/data/bitstream-data.service';
import { GenericConstructor } from '../../../../../core/shared/generic-constructor';
import { ListableObjectDirective } from '../../../../../shared/object-collection/shared/listable-object/listable-object.directive';
import { DynamicComponentLoaderDirective } from '../../../../../shared/abstract-component-loader/dynamic-component-loader.directive';
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
import { hasValue } from '../../../../../shared/empty.util';

@listableObjectComponent(ItemSearchResult, ViewMode.GridElement, Context.AdminSearch)
@Component({
Expand All @@ -24,17 +25,18 @@ import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service
/**
* The component for displaying a list element for an item search result on the admin search page
*/
export class ItemAdminSearchResultGridElementComponent extends SearchResultGridElementComponent<ItemSearchResult, Item> implements OnInit {
@ViewChild(ListableObjectDirective, { static: true }) listableObjectDirective: ListableObjectDirective;
export class ItemAdminSearchResultGridElementComponent extends SearchResultGridElementComponent<ItemSearchResult, Item> implements OnDestroy, OnInit {
@ViewChild(DynamicComponentLoaderDirective, { static: true }) dynamicComponentLoaderDirective: DynamicComponentLoaderDirective;
@ViewChild('badges', { static: true }) badges: ElementRef;
@ViewChild('buttons', { static: true }) buttons: ElementRef;

protected compRef: ComponentRef<Component>;

constructor(
public dsoNameService: DSONameService,
protected truncatableService: TruncatableService,
protected bitstreamDataService: BitstreamDataService,
private themeService: ThemeService,
private componentFactoryResolver: ComponentFactoryResolver,
) {
super(dsoNameService, truncatableService, bitstreamDataService);
}
Expand All @@ -44,23 +46,32 @@ export class ItemAdminSearchResultGridElementComponent extends SearchResultGridE
*/
ngOnInit(): void {
super.ngOnInit();
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.getComponent());
const component: GenericConstructor<Component> = this.getComponent();

const viewContainerRef = this.listableObjectDirective.viewContainerRef;
const viewContainerRef = this.dynamicComponentLoaderDirective.viewContainerRef;
viewContainerRef.clear();

const componentRef = viewContainerRef.createComponent(
componentFactory,
0,
undefined,
[
[this.badges.nativeElement],
[this.buttons.nativeElement]
]);
(componentRef.instance as any).object = this.object;
(componentRef.instance as any).index = this.index;
(componentRef.instance as any).linkType = this.linkType;
(componentRef.instance as any).listID = this.listID;
this.compRef = viewContainerRef.createComponent(
component, {
index: 0,
injector: undefined,
projectableNodes: [
[this.badges.nativeElement],
[this.buttons.nativeElement],
],
},
);
this.compRef.setInput('object',this.object);
this.compRef.setInput('index', this.index);
this.compRef.setInput('linkType', this.linkType);
this.compRef.setInput('listID', this.listID);
}

ngOnDestroy(): void {
if (hasValue(this.compRef)) {
this.compRef.destroy();
this.compRef = undefined;
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ng-template dsListableObject>
<ng-template dsDynamicComponentLoader>
</ng-template>
<div #badges class="position-absolute ml-1">
<div class="workflow-badge">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import {
ItemGridElementComponent
} from '../../../../../shared/object-grid/item-grid-element/item-types/item/item-grid-element.component';
import {
ListableObjectDirective
} from '../../../../../shared/object-collection/shared/listable-object/listable-object.directive';
DynamicComponentLoaderDirective
} from '../../../../../shared/abstract-component-loader/dynamic-component-loader.directive';
import {
WorkflowItemSearchResult
} from '../../../../../shared/object-collection/shared/workflow-item-search-result.model';
Expand All @@ -38,7 +38,7 @@ describe('WorkflowItemSearchResultAdminWorkflowGridElementComponent', () => {
let itemRD$;
let linkService;
let object;
let themeService;
let themeService: ThemeService;

function init() {
itemRD$ = createSuccessfulRemoteDataObject$(new Item());
Expand All @@ -55,7 +55,11 @@ describe('WorkflowItemSearchResultAdminWorkflowGridElementComponent', () => {
init();
TestBed.configureTestingModule(
{
declarations: [WorkflowItemSearchResultAdminWorkflowGridElementComponent, ItemGridElementComponent, ListableObjectDirective],
declarations: [
WorkflowItemSearchResultAdminWorkflowGridElementComponent,
ItemGridElementComponent,
DynamicComponentLoaderDirective,
],
imports: [
NoopAnimationsModule,
TranslateModule.forRoot(),
Expand Down
Loading

0 comments on commit b918413

Please sign in to comment.