Skip to content

Commit 2feb8e7

Browse files
committed
refactor: rename some properties
1 parent 5e1ffb3 commit 2feb8e7

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

projects/wc/src/app/components/organization-management/organization-management.component.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
}}</ui5-label
1010
><br />
1111
<div class="organization-management-input">
12-
@let organizationToSwitchObj = organizationToSwitch();
12+
@let newOrganization = organizationToSwitch();
1313
<ui5-select
1414
id="select-switch"
15-
[value]="organizationToSwitchObj?.name"
15+
[value]="newOrganization?.name"
1616
(ui5Change)="setOrganizationToSwitch($event)"
1717
>
1818
@for (org of organizations(); track org.name) {
@@ -31,16 +31,16 @@
3131
}
3232

3333
<div slot="label" class="option">
34-
<span>{{organizationToSwitchObj?.name}}</span>
35-
@if(organizationToSwitchObj && !organizationToSwitchObj?.ready) {
34+
<span>{{newOrganization?.name}}</span>
35+
@if(newOrganization && !newOrganization?.ready) {
3636
<ui5-icon name="alert" design="Critical"></ui5-icon>
3737
}
3838
</div>
3939

4040
</ui5-select>
4141
<ui5-button
42-
[tooltip]="organizationToSwitchObj?.ready ? undefined : texts.switchOrganization.tooltip"
43-
[disabled]="!organizationToSwitchObj || !organizationToSwitchObj?.ready"
42+
[tooltip]="newOrganization?.ready ? undefined : texts.switchOrganization.tooltip"
43+
[disabled]="!newOrganization || !newOrganization?.ready"
4444
design="Emphasized"
4545
(ui5Click)="switchOrganization()"
4646
>{{
@@ -58,14 +58,14 @@
5858
<ui5-input
5959
id="input-onboard"
6060
placeholder="{{ texts.onboardOrganization.placeholder }}"
61-
[formControl]="newOrganization"
62-
[valueState]="getValueState(newOrganization)"
61+
[formControl]="newOrganizationControl"
62+
[valueState]="getValueState(newOrganizationControl)"
6363
>
6464
<div slot="valueStateMessage">
6565
<a href="{{ k8sMessages.RFC_1035.href }}" target="_blank">{{ k8sMessages.RFC_1035.message }}</a>
6666
</div>
6767
</ui5-input>
68-
<ui5-button [disabled]="newOrganization.invalid" design="Emphasized" (ui5Click)="onboardOrganization()">{{
68+
<ui5-button [disabled]="newOrganizationControl.invalid" design="Emphasized" (ui5Click)="onboardOrganization()">{{
6969
texts.onboardOrganization.button
7070
}}</ui5-button>
7171
</div>

projects/wc/src/app/components/organization-management/organization-management.component.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { OrganizationManagementComponent } from './organization-management.component';
21
import {
32
CUSTOM_ELEMENTS_SCHEMA,
43
NO_ERRORS_SCHEMA,
@@ -17,6 +16,7 @@ import {
1716
} from '@openmfp/portal-ui-lib';
1817
import { ResourceService } from '@platform-mesh/portal-ui-lib/services';
1918
import { of, throwError } from 'rxjs';
19+
import { OrganizationManagementComponent } from './organization-management.component';
2020

2121
describe('OrganizationManagementComponent', () => {
2222
let component: OrganizationManagementComponent;
@@ -143,7 +143,7 @@ describe('OrganizationManagementComponent', () => {
143143
reset: jest.fn(),
144144
};
145145
resourceServiceMock.create.mockReturnValue(of(mockResponse));
146-
component.newOrganization.setValue('newOrg');
146+
component.newOrganizationControl.setValue('newOrg');
147147
component.organizations.set([{ name: 'existingOrg', ready: false }]);
148148

149149
component.onboardOrganization();
@@ -153,15 +153,15 @@ describe('OrganizationManagementComponent', () => {
153153
name: 'newOrg',
154154
ready: false,
155155
});
156-
expect(component.newOrganization.value).toBe('');
156+
expect(component.newOrganizationControl.value).toBe('');
157157
expect(luigiClientMock.uxManager().showAlert).toHaveBeenCalled();
158158
});
159159

160160
it('should handle organization creation error', () => {
161161
resourceServiceMock.create.mockReturnValue(
162162
throwError(() => new Error('Creation failed')),
163163
);
164-
component.newOrganization.setValue('newOrg');
164+
component.newOrganizationControl.setValue('newOrg');
165165

166166
component.onboardOrganization();
167167

projects/wc/src/app/components/organization-management/organization-management.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export class OrganizationManagementComponent implements OnInit {
7272
texts: any = {};
7373
organizations = signal<{ name: string; ready: boolean }[]>([]);
7474
organizationToSwitch = signal<{ name: string; ready: boolean } | null>(null);
75-
newOrganization = new FormControl('', {
75+
newOrganizationControl = new FormControl('', {
7676
validators: [Validators.required, k8sNameValidator],
7777
nonNullable: true,
7878
});
@@ -147,7 +147,7 @@ export class OrganizationManagementComponent implements OnInit {
147147
onboardOrganization() {
148148
const resource: Resource = {
149149
spec: { type: 'org' },
150-
metadata: { name: this.newOrganization.value },
150+
metadata: { name: this.newOrganizationControl.value },
151151
};
152152
const resourceDefinition: ResourceDefinition = {
153153
group: 'core.platform-mesh.io',
@@ -163,10 +163,10 @@ export class OrganizationManagementComponent implements OnInit {
163163
next: (result) => {
164164
console.debug('Resource created', result);
165165
this.organizationToSwitch.set({
166-
name: this.newOrganization.value,
166+
name: this.newOrganizationControl.value,
167167
ready: false,
168168
});
169-
this.newOrganization.reset();
169+
this.newOrganizationControl.reset();
170170
this.LuigiClient()
171171
.uxManager()
172172
.showAlert({

0 commit comments

Comments
 (0)