Skip to content

Commit

Permalink
fix: update route
Browse files Browse the repository at this point in the history
  • Loading branch information
edelclaux committed Jan 22, 2025
1 parent a53ddd6 commit 5342af3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
*ngIf="this.canImport"
color="primary"
class="btn-action uppercase float-right"
[routerLink]="['/import']"
[routerLink]="[importRoute]"
[queryParams]="this.getImportQueryParams()"
>
Importer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class MonitoringListComponent implements OnInit {

// get user cruved
const currentModule = this._moduleService.currentModule;
const userCruved = currentModule.module_objects.MONITORINGS_SITES.cruved;
const userCruved = this._cruvedStore.cruved[this.obj.moduleCode].module_objects.MONITORINGS_SITES.cruved;

let cruvedImport: any = {};
if (this._cruvedStore.cruved.IMPORT) {
Expand All @@ -75,6 +75,10 @@ export class MonitoringListComponent implements OnInit {
this.canImport = cruvedImport.C > 0 && userCruved.C > 0;
}

get importRoute(): string {
return `/import/${this.obj.moduleCode}/process/upload`
}

initDataTable() {
for (const key of Object.keys(this.obj.children)) {
this.queyParamsNewObject[key] = {};
Expand Down Expand Up @@ -147,22 +151,18 @@ export class MonitoringListComponent implements OnInit {
getImportQueryParams() {
if ('observation' in this.obj.children) {
return {
id_module: this.obj.properties['id_module'],
id_base_site: this.obj.properties['id_base_site'], // todo: is it useful ?
id_dataset: this.obj.properties['id_dataset'], // todo: is it useful ?
id_base_visit: this.obj.properties['id_base_visit'],
};
}
if ('visit' in this.obj.children) {
return {
id_module: this.obj.parents['module'].properties['id_module'],
id_base_site: this.obj.properties['id_base_site'],
};
}
if ('site' in this.obj.children) {
return {
id_module: this.obj.properties['id_module'],
};
return {};
}
return {};
}
Expand Down

0 comments on commit 5342af3

Please sign in to comment.