Skip to content

Commit

Permalink
Fix rebase
Browse files Browse the repository at this point in the history
feat(fix) not assigned mapping
  • Loading branch information
Pierre-Narcisi authored and jacquesfize committed Jul 25, 2024
1 parent c546b2a commit 80fdba6
Show file tree
Hide file tree
Showing 25 changed files with 799 additions and 382 deletions.
33 changes: 0 additions & 33 deletions backend/geonature/core/imports/config_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,6 @@
"filter": False,
},
{
<<<<<<< HEAD
=======
"prop": "taxa_count",
"name": "Nb de taxons",
"max_width": 120,
"show": True,
"filter": False,
},
{
>>>>>>> c1090e78a (add imports backend code from gn_module_import)
"prop": "import_count",
"name": "Nb de donnees",
"max_width": 120,
Expand Down Expand Up @@ -114,7 +104,6 @@ class ImportConfigSchema(Schema):
ALLOWED_EXTENSIONS = fields.List(fields.String, load_default=ALLOWED_EXTENSIONS)
DEFAULT_COUNT_VALUE = fields.Integer(load_default=DEFAULT_COUNT_VALUE)
ALLOW_VALUE_MAPPING = fields.Boolean(load_default=ALLOW_VALUE_MAPPING)
<<<<<<< HEAD
DEFAULT_VALUE_MAPPING_ID = fields.Integer(
load_default=DEFAULT_VALUE_MAPPING_ID
) # FIXME: unused
Expand All @@ -129,17 +118,6 @@ class ImportConfigSchema(Schema):
DEFAULT_FIELD_MAPPING_ID = fields.Integer(
load_default=DEFAULT_FIELD_MAPPING_ID
) # FIXME: unused
=======
DEFAULT_VALUE_MAPPING_ID = fields.Integer(load_default=DEFAULT_VALUE_MAPPING_ID)
FILL_MISSING_NOMENCLATURE_WITH_DEFAULT_VALUE = fields.Boolean(load_default=True)
# Parameter to define if the mapped fields are displayed or not.
DISPLAY_MAPPED_VALUES = fields.Boolean(load_default=True)
INSTANCE_BOUNDING_BOX = fields.List(fields.Float, load_default=INSTANCE_BOUNDING_BOX)
ENABLE_BOUNDING_BOX_CHECK = fields.Boolean(load_default=True)
ENABLE_SYNTHESE_UUID_CHECK = fields.Boolean(load_default=True)
ALLOW_FIELD_MAPPING = fields.Boolean(load_default=ALLOW_FIELD_MAPPING)
DEFAULT_FIELD_MAPPING_ID = fields.Integer(load_default=DEFAULT_FIELD_MAPPING_ID)
>>>>>>> c1090e78a (add imports backend code from gn_module_import)
DISPLAY_CHECK_BOX_MAPPED_FIELD = fields.Boolean(load_default=True)
CHECK_PRIVATE_JDD_BLURING = fields.Boolean(load_default=True)
CHECK_REF_BIBLIO_LITTERATURE = fields.Boolean(load_default=True)
Expand All @@ -161,21 +139,10 @@ class ImportConfigSchema(Schema):
]
),
)
<<<<<<< HEAD
ID_AREA_RESTRICTION = fields.Integer(load_default=None)
ID_LIST_TAXA_RESTRICTION = fields.Integer(load_default=None)
MODULE_URL = fields.String(load_default="/import")
DATAFRAME_BATCH_SIZE = fields.Integer(load_default=10000)
EXPORT_REPORT_PDF_FILENAME = fields.String(
load_default="import_{id_import}_{date_create_import}_report.pdf"
)
=======
# If ID is provided (!=-1) will take the geometry in ref_geo.l_areas
# and checks if all imported points are inside it. Otherwise throws an error
ID_AREA_RESTRICTION = fields.Integer(load_default=None)
# If an id of taxhub list is provided will check if the imported taxons
# are in the list. Otherwise throws an error
ID_LIST_TAXA_RESTRICTION = fields.Integer(load_default=None)
MODULE_URL = fields.String(load_default="/import")
DATAFRAME_BATCH_SIZE = fields.Integer(load_default=10000)
>>>>>>> c1090e78a (add imports backend code from gn_module_import)
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<div id="cover-spin" *ngIf="dataLoading"></div>
<div
id="cover-spin"
*ngIf="dataLoading"
></div>

<div class="float-btns">
<button
Expand All @@ -24,20 +27,27 @@
matBadgeColor="warn"
>
Filter
<i class="fa fa-sliders" aria-hidden="true"></i>
<i
class="fa fa-sliders"
aria-hidden="true"
></i>
</button>
</div>

<div class="row row-sm map-list-container" data-qa="pnx-occhab-map-list">
<div
class="row row-sm map-list-container"
data-qa="pnx-occhab-map-list"
>
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 padding-sm">
<pnx-map-list height="88vh" idName="id_station"></pnx-map-list>
<pnx-map-list
height="88vh"
idName="id_station"
></pnx-map-list>
</div>

<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 padding-sm">
<div [(ngbCollapse)]="isCollapseFilter">
<pnx-occhab-map-list-filter
(onSearch)="searchData($event)"
></pnx-occhab-map-list-filter>
<pnx-occhab-map-list-filter (onSearch)="searchData($event)"></pnx-occhab-map-list-filter>
</div>
<div class="container">
<div class="row">
Expand All @@ -58,7 +68,10 @@
(select)="mapListService.onRowSelect($event)"
data-qa="pnx-occhab-map-list-datatable"
>
<ngx-datatable-row-detail #myDetailRow rowHeight="100">
<ngx-datatable-row-detail
#myDetailRow
rowHeight="100"
>
<ng-template
ngx-datatable-row-detail-template
let-row="row"
Expand All @@ -68,9 +81,7 @@
<strong>ID station :</strong>
{{ row.id_station }}
</div>
<ng-container
*ngIf="row.comment !== null && row?.comment.trim() !== ''"
>
<ng-container *ngIf="row.comment !== null && row?.comment.trim() !== ''">
<div>
<strong>Commentaire :</strong>
{{ row.comment }}
Expand All @@ -81,7 +92,7 @@
{{
row.altitude_min == row.altitude_max
? row.altitude_min
: row.altitude_min + " - " + row.altitude_max
: row.altitude_min + ' - ' + row.altitude_max
}}
</div>
<div><strong>Observé par:</strong></div>
Expand Down Expand Up @@ -119,53 +130,81 @@
></a>
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column maxWidth="10" [sortable]="false">
<ng-template let-row="row" ngx-datatable-cell-template>
<ngx-datatable-column
maxWidth="10"
[sortable]="false"
>
<ng-template
let-row="row"
ngx-datatable-cell-template
>
<button
[matTooltip]="row.id_station"
[routerLink]="['info', row.id_station]"
class="btn btn-outline-shadow btn-no-padding btn-ghost"
>
<i class="fa fa-info-circle" aria-hidden="true"></i>
<i
class="fa fa-info-circle"
aria-hidden="true"
></i>
{{ row.id_station }}
</button>
</ng-template>
</ngx-datatable-column>

<ngx-datatable-column maxWidth="10" [sortable]="false">
<ng-template let-row="row" ngx-datatable-cell-template>
<ngx-datatable-column
maxWidth="10"
[sortable]="false"
>
<ng-template
let-row="row"
ngx-datatable-cell-template
>
<button
class="btn btn-outline-shadow btn-no-padding btn-ghost"
[routerLink]="['edit', row.id_station]"
[disabled]="!row.cruved.U"
>
<i class="fa fa-pencil-square-o" aria-hidden="true"></i>
<i
class="fa fa-pencil-square-o"
aria-hidden="true"
></i>
</button>
</ng-template>
</ngx-datatable-column>

<ngx-datatable-column maxWidth="10" [sortable]="false">
<ng-template let-row="row" ngx-datatable-cell-template>
<ngx-datatable-column
maxWidth="10"
[sortable]="false"
>
<ng-template
let-row="row"
ngx-datatable-cell-template
>
<button
class="btn btn-outline-shadow btn-no-padding btn-ghost"
(click)="openDeleteModal(row, deleteModal)"
[disabled]="!row.cruved.D"
>
<i class="fa fa-trash-o" aria-hidden="true"></i>
<i
class="fa fa-trash-o"
aria-hidden="true"
></i>
</button>
</ng-template>
</ngx-datatable-column>

<ngx-datatable-column name="Habitat">
<ng-template ngx-datatable-cell-template let-row="row">
<ng-template
ngx-datatable-cell-template
let-row="row"
>
<span
[matTooltip]="displayHabTooltip(row).join('\n')"
matTooltipPosition="left"
>
<span>
<span class="badge badge-dark">{{
row.habitats?.length
}}</span>
<span class="badge badge-dark">{{ row.habitats?.length }}</span>
{{ displayHabTooltip(row) }}
</span>
</span>
Expand All @@ -178,14 +217,17 @@
let-row="row"
maxWidth="50"
>
<span matTooltip="{{ row.date_min | date : 'dd-MM-yyyy' }}">
{{ row.date_min | date : "dd-MM-yyyy" }}
<span matTooltip="{{ row.date_min | date: 'dd-MM-yyyy' }}">
{{ row.date_min | date: 'dd-MM-yyyy' }}
</span>
</ng-template>
</ngx-datatable-column>

<ngx-datatable-column name="Jeu de données">
<ng-template ngx-datatable-cell-template let-row="row">
<ng-template
ngx-datatable-cell-template
let-row="row"
>
<span matTooltip="{{ row.dataset.dataset_name }}">
{{ row.dataset.dataset_name }}
</span>
Expand All @@ -202,14 +244,9 @@
mat-raised-button
color="primary"
class="btn-action uppercase"
[routerLink]="[
'/import',
destinationImportCode,
'process',
'upload'
]"
[routerLink]="['/import', destinationImportCode, 'process', 'upload']"
>
{{ "Upload" | translate }}
{{ 'Upload' | translate }}
<mat-icon>file_upload</mat-icon>
</button>
</div>
Expand All @@ -221,7 +258,7 @@
class="btn-action uppercase"
(click)="openModal()"
>
{{ "Download" | translate }}
{{ 'Download' | translate }}
<mat-icon>file_download</mat-icon>
</button>
</div>
Expand All @@ -230,7 +267,11 @@
</div>
</div>

<ng-template #deleteModal let-c="close " let-d="dismiss">
<ng-template
#deleteModal
let-c="close "
let-d="dismiss"
>
<pnx-occhab-delete
[c]="c"
[idStation]="deleteOne.id_station"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import * as moment from 'moment';
import { ConfigService } from '@geonature/services/config.service';
import { OccHabMapListService } from '../../services/occhab-map-list.service';
import { ModuleService } from '@geonature/services/module.service';
<<<<<<< HEAD
import { CruvedStoreService } from '@geonature_common/service/cruved-store.service';
=======
>>>>>>> 66050cdf4 (refact: use different way to use module_code)

@Component({
selector: 'pnx-occhab-map-list',
Expand Down Expand Up @@ -42,7 +39,6 @@ export class OccHabMapListComponent implements OnInit {
private _commonService: CommonService,
public config: ConfigService,
public mapListFormService: OccHabMapListService,
<<<<<<< HEAD
private _moduleService: ModuleService,
public cruvedStore: CruvedStoreService
) {}
Expand All @@ -58,14 +54,6 @@ export class OccHabMapListComponent implements OnInit {
this.canImport = canCreateImport && canCreateOcchab;
this.destinationImportCode = currentModule.destination[0]?.code;

=======
private _moduleService: ModuleService
) {}

ngOnInit() {
const currentModule = this._moduleService.currentModule;
this.destinationImportCode = currentModule.module_code.toLowerCase();
>>>>>>> 66050cdf4 (refact: use different way to use module_code)
if (this.storeService.firstMessageMapList) {
this._commonService.regularToaster('info', 'Les 50 dernières stations saisies');
this.storeService.firstMessageMapList = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
<p>field-mapping-modal works!</p>
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ describe('FieldMappingModalComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ FieldMappingModalComponent ]
})
.compileComponents();
declarations: [FieldMappingModalComponent],
}).compileComponents();

fixture = TestBed.createComponent(FieldMappingModalComponent);
component = fixture.componentInstance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,52 @@
import { Component } from '@angular/core';
import { Component, Input, ViewChild } from '@angular/core';
import { FieldMappingService } from '@geonature/modules/imports/services/mappings/field-mapping.service';
import { ConfigService } from '@geonature/services/config.service';
import { ImportProcessService } from '../../import-process.service';
import { ImportDataService } from '@geonature/modules/imports/services/data.service';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { FormControl } from '@angular/forms';

@Component({
selector: 'pnx-field-mapping-modal',
templateUrl: './field-mapping-modal.component.html',
styleUrls: ['./field-mapping-modal.component.scss']
styleUrls: ['./field-mapping-modal.component.scss'],
})
export class FieldMappingModalComponent {
@Input() updateAvailable: boolean;
@ViewChild('saveMappingModal') saveMappingModal;

public modalCreateMappingForm = new FormControl('');
constructor(
private _fm: FieldMappingService,
private config: ConfigService,
private _importProcessService: ImportProcessService,
private _importDataService: ImportDataService,
private _modalService: NgbModal
) {}

/**
* Open the modal
*/
open() {
this._modalService.open(this.saveMappingModal, { size: 'lg' });
}

updateMapping() {
// this.spinner = true;
let name = '';
// if (this.modalCreateMappingForm.value != this.fieldMappingForm.value.label) {
// name = this.modalCreateMappingForm.value;
// }
// this._importDataService
// .updateFieldMapping(this.fieldMappingForm.value.id, this.getFieldMappingValues(), name)
// .pipe()
// .subscribe(
// () => {
// this.processNextStep();
// },
// () => {
// this.spinner = false;
// }
// );
}
}
Loading

0 comments on commit 80fdba6

Please sign in to comment.