Skip to content

Commit

Permalink
Merge pull request #429 from IntegratedBreedingPlatform/IBP-4098-Impo…
Browse files Browse the repository at this point in the history
…rtGermplasm

IBP-4098 import germplasm
  • Loading branch information
clarysabel authored Feb 8, 2021
2 parents 9271bea + f8f8c9a commit cce371c
Show file tree
Hide file tree
Showing 75 changed files with 3,467 additions and 974 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@
<goals>
<goal>yarn</goal>
</goals>
<phase>generate-resources</phase>
<phase>process-resources</phase>
<configuration>
<skip>${skipFrontEndBuild}</skip>
<workingDirectory>src/main/jhipster</workingDirectory>
Expand Down
49 changes: 26 additions & 23 deletions src/main/jhipster/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,28 @@
"node_modules"
],
"dependencies": {
"@angular/animations": "6.0.4",
"@angular/common": "6.0.4",
"@angular/compiler": "6.0.4",
"@angular/core": "6.0.4",
"@angular/forms": "6.0.4",
"@angular/platform-browser": "6.0.4",
"@angular/platform-browser-dynamic": "6.0.4",
"@angular/router": "6.0.4",
"@ng-bootstrap/ng-bootstrap": "3.2.0",
"@angular/animations": "7.0.4",
"@angular/cdk": "7.0.4",
"@angular/common": "7.0.4",
"@angular/compiler": "7.0.4",
"@angular/core": "7.0.4",
"@angular/forms": "7.0.4",
"@angular/platform-browser": "7.0.4",
"@angular/platform-browser-dynamic": "7.0.4",
"@angular/router": "7.0.4",
"@ng-bootstrap/ng-bootstrap": "4.2.2",
"bootstrap": "4.1.3",
"core-js": "2.5.7",
"font-awesome": "4.7.0",
"jquery": "3.2.1",
"ng-jhipster": "0.5.4",
"ng-select2": "^1.2.4",
"ngx-cookie": "2.0.1",
"ngx-infinite-scroll": "6.0.0",
"ngx-webstorage": "2.0.1",
"primeicons": "1.0.0",
"primeng": "7.0.0",
"primeng": "7.0.4",
"properties-reader": "1.0.0",
"reflect-metadata": "0.1.10",
"rxjs": "6.3.1",
"rxjs-compat": "6.1.0",
Expand All @@ -36,13 +39,13 @@
"zone.js": "0.8.26"
},
"devDependencies": {
"@angular/cli": "6.0.4",
"@angular/compiler-cli": "6.0.4",
"@ngtools/webpack": "6.0.4",
"@angular/cli": "7.0.4",
"@angular/compiler-cli": "7.0.4",
"@ngtools/webpack": "7.0.4",
"@types/jasmine": "2.5.53",
"@types/node": "8.10.0",
"angular-router-loader": "0.8.5",
"@types/selenium-webdriver": "3.0.8",
"angular-router-loader": "0.8.5",
"angular2-template-loader": "0.6.2",
"awesome-typescript-loader": "3.2.2",
"browser-sync": "2.18.13",
Expand Down Expand Up @@ -71,41 +74,41 @@
"karma-sourcemap-loader": "0.3.7",
"karma-webpack": "2.0.4",
"merge-jsons-webpack-plugin": "1.0.14",
"node-sass": "4.5.3",
"phantomjs-prebuilt": "2.1.16",
"postcss-loader": "2.1.1",
"protractor": "5.1.2",
"protractor-jasmine2-screenshot-reporter": "0.4.0",
"proxy-middleware": "0.15.0",
"puppeteer": "^1.20.0",
"raw-loader": "0.5.1",
"rimraf": "2.6.1",
"sass-loader": "6.0.6",
"simple-progress-webpack-plugin": "1.1.2",
"source-map": "0.6.1",
"sourcemap-istanbul-instrumenter-loader": "0.2.0",
"simple-progress-webpack-plugin": "1.1.2",
"style-loader": "0.18.2",
"tapable": "1.0.0",
"terser-webpack-plugin": "1.0.0",
"thread-loader": "1.1.5",
"to-string-loader": "1.1.5",
"ts-node": "5.0.1",
"ts-loader": "4.0.1",
"ts-node": "5.0.1",
"tslint": "5.9.1",
"tslint-config-prettier": "1.9.0",
"tslint-loader": "3.6.0",
"typescript": "2.7.2",
"sass-loader": "6.0.6",
"node-sass": "4.5.3",
"postcss-loader": "2.1.1",
"xml2js": "0.4.17",
"typescript": "3.1.1",
"uglifyjs-webpack-plugin": "1.1.5",
"web-app-manifest-loader": "0.1.1",
"webpack": "4.8.0",
"webpack-cli": "2.1.3",
"webpack-dev-server": "3.1.4",
"webpack-merge": "4.1.2",
"webpack-notifier": "1.6.0",
"webpack-visualizer-plugin": "0.1.11",
"web-app-manifest-loader": "0.1.1",
"workbox-webpack-plugin": "3.0.0-beta.1",
"write-file-webpack-plugin": "4.1.0",
"puppeteer": "^1.20.0"
"xml2js": "0.4.17"
},
"engines": {
"node": ">=8.11.3",
Expand Down
2 changes: 2 additions & 0 deletions src/main/jhipster/src/main/webapp/app/app.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export const DEBUG_INFO_ENABLED: boolean = !!process.env.DEBUG_INFO_ENABLED;
export const SERVER_API_URL = process.env.SERVER_API_URL;
export const BUILD_TIMESTAMP = process.env.BUILD_TIMESTAMP;
export const GERMPLASM_BROWSER_DEFAULT_URL = '/ibpworkbench/maingpsb/germplasm-';
export const BREEDING_METHODS_BROWSER_DEFAULT_URL = '/ibpworkbench/content/ProgramMethods';
export const MAX_PAGE_SIZE = process.env.MAX_PAGE_SIZE;

// HELP
export const HELP_BASE_URL = '/ibpworkbench/controller/help/getUrl/';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { DomSanitizer } from '@angular/platform-browser';
import { PopupService } from '../../shared/modal/popup.service';
import { ParamContext } from '../../shared/service/param.context';
import { BREEDING_METHODS_BROWSER_DEFAULT_URL } from '../../app.constants';
import { GermplasmComponent } from '../germplasm/germplasm.component';

@Component({
selector: 'jhi-breeding-method-manager',
template: `
<div class="modal-header">
<h4 class="modal-title font-weight-bold">
<span jhiTranslate="breeding-method.browser.title"></span>
</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"
(click)="close()">&times;
</button>
</div>
<div class="modal-body">
<iframe [src]="safeUrl" style="border: 0" width="100%" height="650"></iframe>
</div>
`
})
export class BreedingMethodManagerComponent implements OnInit {
safeUrl: string;

constructor(private route: ActivatedRoute,
public activeModal: NgbActiveModal,
private sanitizer: DomSanitizer) {
}

ngOnInit(): void {
}

close() {
this.activeModal.close();
}
}

@Component({
selector: 'jhi-breeding-method-manager-popup',
template: ``
})
export class BreedingMethodManagerPopupComponent implements OnInit {

constructor(private route: ActivatedRoute,
private popupService: PopupService,
private sanitizer: DomSanitizer,
private paramContext: ParamContext) {
}

ngOnInit(): void {
const params = '?programId=' + this.paramContext.selectedProjectId;

const modal = this.popupService.open(BreedingMethodManagerComponent as Component, { windowClass: 'modal-autofit' });
modal.then((modalRef) => {
modalRef.componentInstance.safeUrl =
this.sanitizer.bypassSecurityTrustResourceUrl(BREEDING_METHODS_BROWSER_DEFAULT_URL + params);
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { BmsjHipsterSharedModule } from '../../shared';
import { BreedingMethodComponent, BreedingMethodPopupComponent } from './breeding-method.component';
import { RouterModule } from '@angular/router';
import { breedingMethodRoutes } from './breeding-method.route';
import { BreedingMethodManagerComponent, BreedingMethodManagerPopupComponent } from './breeding-method-manager.component';

@NgModule({
imports: [
Expand All @@ -11,11 +12,15 @@ import { breedingMethodRoutes } from './breeding-method.route';
],
declarations: [
BreedingMethodComponent,
BreedingMethodPopupComponent
BreedingMethodPopupComponent,
BreedingMethodManagerComponent,
BreedingMethodManagerPopupComponent
],
entryComponents: [
BreedingMethodComponent,
BreedingMethodPopupComponent
BreedingMethodPopupComponent,
BreedingMethodManagerComponent,
BreedingMethodManagerPopupComponent
]
})
export class BreedingMethodModule {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { Routes } from '@angular/router';
import { BreedingMethodPopupComponent } from './breeding-method.component';
import { BreedingMethodManagerPopupComponent } from './breeding-method-manager.component';

export const breedingMethodRoutes: Routes = [
{
path: 'breeding-method/:breedingMethodId',
component: BreedingMethodPopupComponent,
outlet: 'popup'
},
{
path: 'breeding-method-browser',
component: BreedingMethodManagerPopupComponent,
outlet: 'popup'
}
];

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// TODO rename to GermplasmSearchResponse
// for a simplified entity see shared/germplasm/model/germplasm.model.ts
export class Germplasm {
constructor(
public gid: number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ <h4 class="modal-title font-weight-bold">
<br/>
<div class="row">
<div class="col-sm-4"></div>
<div class="col-sm-6"><input type="checkbox" [(ngModel)]="accessible" [checked]="accessible" disabled/> Accessible from all crop programs</div>
<div class="col-sm-6"><input type="checkbox" name="accessible" [(ngModel)]="accessible" [checked]="accessible" disabled/> Accessible from all crop programs</div>
</div>
</form>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ActivatedRoute } from '@angular/router';
import { PopupService } from '../../shared/modal/popup.service';
import { LocationService } from '../../shared/location/service/location.service';
import { BreedingLocationModel } from '../../shared/location/model/breeding-location.model';
import { LocationType } from '../../shared/location/model/location-type.model';
import { Location } from '../../shared/location/model/location';
import { LocationType } from '../../shared/location/model/location-type';
import { LocationModel, LocationTypeEnum } from '../../shared/location/model/location.model';

@Component({
Expand All @@ -14,7 +14,7 @@ import { LocationModel, LocationTypeEnum } from '../../shared/location/model/loc
export class LocationComponent implements OnInit {

@Input() public locationId: number;
breedingLocation: BreedingLocationModel = new BreedingLocationModel();
breedingLocation: Location = new Location();
locationTypes: LocationType[] = [];
countries: LocationModel[] = [];
provinces: LocationModel[] = [];
Expand All @@ -33,11 +33,13 @@ export class LocationComponent implements OnInit {
this.breedingLocation = breedingLocation;
this.accessible = breedingLocation.programUUID === '';
}).then(() => {
this.locationService.queryLocationsByType([LocationTypeEnum.COUNTRY], false).toPromise().then((locations) => {
this.locationService.queryLocationsByType([LocationTypeEnum.COUNTRY], false).toPromise().then((resp) => {
const locations = resp.body;
this.countries = locations;
this.selectedCountry = locations.find((e) => e.id === this.breedingLocation.countryId);
})
this.locationService.queryLocationsByType([LocationTypeEnum.PROVINCE], false).toPromise().then((locations) => {
this.locationService.queryLocationsByType([LocationTypeEnum.PROVINCE], false).toPromise().then((resp) => {
const locations = resp.body;
this.provinces = locations;
this.selectedProvince = locations.find((e) => e.id === this.breedingLocation.provinceId);
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot, Routes } from '@angular/router';
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot, Routes } from '@angular/router';
import { JhiPaginationUtil } from 'ng-jhipster';

import { SampleComponent, SampleManagerComponent } from './';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h4 class="modal-title font-weight-bold" id="importLotHeader" jhitranslate="germ
<div class="col-2"></div>
<div class="col-md-8">
<input type="file" class="custom-file-input" multiple="false" id="importFile" (change)="onFileChange($event)" accept="{{selectedFileType}}">
<label class="custom-file-label" #fileUpload for="importFile"><i class="fa fa-search"></i> Choose the file you would like to import with the format: Excel</label>
<label class="custom-file-label" #fileUpload for="importFile"><i class="fa fa-search"></i><span jhiTranslate="germplasm-manager.file.import.description"></span></label>
</div>
<span *ngIf="isProcessing" style="margin-left: 10px;" class="throbber throbber-2x"></span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { forkJoin, Observable } from 'rxjs';
import { parseFile, saveFile } from '../shared/util/file-utils';
import { AlertService } from '../shared/alert/alert.service';
import { Attribute } from '../shared/attributes/model/attribute.model';
import { GermplasmNameTypeModel } from '../entities/germplasm/germplasm-name-type.model';
import { NameType } from '../shared/germplasm/model/name-type.model';

@Component({
selector: 'jhi-germplasm-import-update-dialog',
Expand All @@ -26,7 +26,7 @@ export class GermplasmImportUpdateDialogComponent implements OnInit, OnDestroy {
fileName = '';
rawData: Array<Array<any>>;
data: Array<any>;
names: GermplasmNameTypeModel[] = [];
names: NameType[] = [];
attributes: Attribute[] = [];
importFormats = [
{ name: 'Excel', extension: '.xls,.xlsx' }
Expand Down Expand Up @@ -91,7 +91,7 @@ export class GermplasmImportUpdateDialogComponent implements OnInit, OnDestroy {
});
}

private transform(importData: Array<any>, names: GermplasmNameTypeModel[], attributes: Attribute[]): any[] {
private transform(importData: Array<any>, names: NameType[], attributes: Attribute[]): any[] {
// Transform file data to JSON
const germplasmUpdates = importData.map((row) => {
const namesValuesMap = {};
Expand Down Expand Up @@ -172,7 +172,7 @@ export class GermplasmImportUpdateDialogComponent implements OnInit, OnDestroy {
});
}

private validateHeader(fileHeader: string[], errorMessage: string[], codes: string[], names: GermplasmNameTypeModel[], attributes: Attribute[]) {
private validateHeader(fileHeader: string[], errorMessage: string[], codes: string[], names: NameType[], attributes: Attribute[]) {
// TODO: Add Method Abbr once implemented in the backend.

if (!(<any>Object).values(HEADER).every((header) => {
Expand Down Expand Up @@ -212,7 +212,7 @@ export class GermplasmImportUpdateDialogComponent implements OnInit, OnDestroy {
private onSaveSuccess(result: any) {
this.isProcessing = false;
this.alertService.success('germplasm-import-updates.import.success');
this.eventManager.broadcast({ name: 'germplasmUpdated', content: result });
this.eventManager.broadcast({ name: 'filterByGid', content: result });
this.activeModal.close(result);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ declare var $: any;
selector: 'jhi-germplasm-list-add',
templateUrl: './germplasm-list-add.component.html',
providers: [
{ provide: TreeService, useClass: GermplasmTreeTableService },
{ provide: GermplasmListService, useClass: GermplasmListService }
{ provide: TreeService, useClass: GermplasmTreeTableService }
]
})
export class GermplasmListAddComponent implements OnInit {
Expand Down
Loading

0 comments on commit cce371c

Please sign in to comment.