Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add uniqueOperation params for new departments api #3331

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export class LuDepartmentFeederComponent extends ALuTreeOptionOperator<ILuDepart
this._service.filters = filters ?? [];
}

@Input() set uniqueOperation(uniqueOperation: number) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il faudrait pas que ce soit nullable pour pas faire de breaking ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L'input n'est pas marqué comme required donc l'attribut du composant n'est pas obligatoire. Pas de breaking

this._service.uniqueOperation = uniqueOperation;
}

constructor(
@Inject(ALuDepartmentService)
@Optional()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@

<lu-tree-option-picker-advanced [option-comparer]="byId">
<header class="lu-picker-header" [class.mod-multiple]="multiple">
<lu-department-feeder [appInstanceId]="appInstanceId" [operations]="operations" [filters]="filters"></lu-department-feeder>
<lu-department-feeder
[appInstanceId]="appInstanceId"
[operations]="operations"
[filters]="filters"
[uniqueOperation]="uniqueOperation"
></lu-department-feeder>
<lu-tree-option-searcher [searchFn]="searchFn"></lu-tree-option-searcher>
<lu-tree-option-select-all class="option-selector"></lu-tree-option-select-all>
</header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
LuOptionComparer,
LuTreeOptionItemComponent,
LuTreeOptionPickerAdvancedComponent,
LuTreeOptionPickerComponent,
LuTreeOptionSearcherComponent,
LuTreeOptionSelectAllComponent,
} from '@lucca-front/ng/option';
Expand All @@ -31,7 +30,6 @@ import { LU_DEPARTMENT_SELECT_INPUT_TRANSLATIONS } from './department-select-inp
OverlayModule,
A11yModule,
LuInputClearerComponent,
LuTreeOptionPickerComponent,
LuTreeOptionPickerAdvancedComponent,
LuDepartmentFeederComponent,
LuTreeOptionSearcherComponent,
Expand Down Expand Up @@ -60,6 +58,7 @@ export class LuDepartmentSelectInputComponent<
@Input() appInstanceId: number | string;
@Input() operations: number[];
@Input() filters: string[] = [];
@Input() uniqueOperation: number;

public intl = getIntl(LU_DEPARTMENT_SELECT_INPUT_TRANSLATIONS);

Expand Down
7 changes: 6 additions & 1 deletion packages/ng/department/service/department-v4.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ export class LuDepartmentV4Service {
this._operations = operations;
}

protected _uniqueOperation: number;
set uniqueOperation(uniqueOperation: number) {
this._uniqueOperation = uniqueOperation;
}

constructor(private _http: HttpClient) {}

getTrees() {
Expand All @@ -40,7 +45,7 @@ export class LuDepartmentV4Service {
>(`/api/v3/departments/scopedtree?fields=id,name&${[`appInstanceId=${this._appInstanceId}`, `operations=${this._operations.join(',')}`, this._filters.join(',')].filter((f) => !!f).join('&')}`)
.pipe(map((response) => response.data));
} else {
call = this._http.get<IApiDepartment>(`${this.api}/tree`);
call = this._http.get<IApiDepartment>(`${this.api}/tree`, { params: { uniqueOperation: this.uniqueOperation } });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
call = this._http.get<IApiDepartment>(`${this.api}/tree`, { params: { uniqueOperation: this.uniqueOperation } });
call = this._http.get<IApiDepartment>(`${this.api}/tree`, { params: { uniqueOperation: this._uniqueOperation } });

non?

}

return call.pipe(
Expand Down