Merge branch 'feature/SUPPORT-8987_formfield_refactor' into develop
This commit is contained in:
commit
c17979c4c7
6 changed files with 77 additions and 87 deletions
|
|
@ -60,8 +60,10 @@ export class UserManagementService extends Behavior {
|
|||
if (!this.authService.hasRole('security_administrator') || !this.sendToErvu) {
|
||||
return;
|
||||
}
|
||||
let kind = this.applicationKind.getValue();
|
||||
let formJson = this.collectData();
|
||||
const kind = this.applicationKind.getValue();
|
||||
const formJson = this.collectData();
|
||||
const appNumber = formJson['appNumber'];
|
||||
const accountId = formJson['accountId'];
|
||||
let request;
|
||||
|
||||
switch (kind) {
|
||||
|
|
@ -80,30 +82,29 @@ export class UserManagementService extends Behavior {
|
|||
request = new CreateAccountRequest();
|
||||
request.data = createData;
|
||||
request.processKey = ProcessKey.CREATE;
|
||||
this.doRequest(request, formJson['appNumber']);
|
||||
this.doRequest(request, appNumber);
|
||||
break;
|
||||
case ApplicationKind.EDIT_USER_MAIN:
|
||||
let editPersonData = new EditPersonData();
|
||||
editPersonData.accountId = formJson['accountId'];
|
||||
editPersonData.accountId = accountId;
|
||||
editPersonData.personData = this.populateDto(new Person(), formJson);
|
||||
request = new EditPersonRequest();
|
||||
request.data = editPersonData;
|
||||
request.processKey = ProcessKey.EDIT_PERSON;
|
||||
this.doRequest(request, formJson['appNumber']);
|
||||
this.doRequest(request, appNumber);
|
||||
break;
|
||||
case ApplicationKind.EDIT_USER_ACCOUNT:
|
||||
let editAccountData = new EditAccountData();
|
||||
let account = this.populateDto(new Account(), formJson);
|
||||
account.id = formJson['accountId'];
|
||||
account.id = accountId;
|
||||
editAccountData.account = account;
|
||||
request = new EditAccountRequest();
|
||||
request.data = editAccountData;
|
||||
request.processKey = ProcessKey.EDIT_ACCOUNT;
|
||||
this.doRequest(request, formJson['appNumber']);
|
||||
this.doRequest(request, appNumber);
|
||||
break;
|
||||
case ApplicationKind.EDIT_USER_ROLES:
|
||||
let editRolesAccount = new EditRolesAccount();
|
||||
let accountId = formJson['accountId'];
|
||||
let rolesList = formJson['rolesList'];
|
||||
editRolesAccount.accountId = accountId;
|
||||
editRolesAccount.rolesList = rolesList.map(id => {
|
||||
|
|
@ -119,34 +120,34 @@ export class UserManagementService extends Behavior {
|
|||
request = new EditRolesRequest();
|
||||
request.data = editRolesData;
|
||||
request.processKey = ProcessKey.EDIT_ROLES;
|
||||
this.doRequest(request, formJson['appNumber']);
|
||||
this.doRequest(request, appNumber);
|
||||
});
|
||||
break;
|
||||
case ApplicationKind.BLOCK_USER:
|
||||
let deactivationData = new ChangeActivationData();
|
||||
deactivationData.accountIdList = [formJson['accountId']];
|
||||
deactivationData.accountIdList = [accountId];
|
||||
request = new ChangeActivationRequest();
|
||||
request.data = deactivationData;
|
||||
request.processKey = ProcessKey.DEACTIVATE;
|
||||
this.doRequest(request, formJson['appNumber']);
|
||||
this.doRequest(request, appNumber);
|
||||
break;
|
||||
case ApplicationKind.UNBLOCK_USER:
|
||||
let activationData = new ChangeActivationData();
|
||||
activationData.accountIdList = [formJson['accountId']];
|
||||
activationData.accountIdList = [accountId];
|
||||
request = new ChangeActivationRequest();
|
||||
request.data = activationData;
|
||||
request.processKey = ProcessKey.ACTIVATE;
|
||||
this.doRequest(request, formJson['appNumber']);
|
||||
this.doRequest(request, appNumber);
|
||||
break;
|
||||
case ApplicationKind.RESET_PASSWORD:
|
||||
let resetPasswordAccount = new ResetPasswordAccount();
|
||||
resetPasswordAccount.id = formJson['accountId'];
|
||||
resetPasswordAccount.id = accountId;
|
||||
let resetPasswordData = new ResetPasswordData();
|
||||
resetPasswordData.account = resetPasswordAccount;
|
||||
request = new ResetPasswordRequest();
|
||||
request.data = resetPasswordData;
|
||||
request.processKey = ProcessKey.RESET_PASSWORD;
|
||||
this.doRequest(request, formJson['appNumber']);
|
||||
this.doRequest(request, appNumber);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,31 +1,17 @@
|
|||
import {
|
||||
AnalyticalScope,
|
||||
Autocomplete,
|
||||
Behavior,
|
||||
Control,
|
||||
GridV2,
|
||||
NotNull
|
||||
} from "@webbpm/base-package";
|
||||
|
||||
@AnalyticalScope(Control)
|
||||
export class FormField extends Behavior {
|
||||
//TODO SUPPORT-8987
|
||||
|
||||
@NotNull()
|
||||
public name: string;
|
||||
|
||||
public gridValue: boolean = false;
|
||||
@NotNull("gridValue == true")
|
||||
public columnId: string;
|
||||
|
||||
public getValue(): any {
|
||||
if (this.gridValue) {
|
||||
let grid = this.getScript(GridV2);
|
||||
return grid.getAllRows().map(rowData => rowData[this.columnId])
|
||||
}
|
||||
|
||||
return this.context instanceof Autocomplete
|
||||
? this.getScript(Autocomplete).getBusinessId()
|
||||
: this.getScript('component.ControlWithValue').getValueForForm();
|
||||
return this.context.getValueForForm();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
import {FormField} from "./FormField";
|
||||
import {AnalyticalScope, GridV2, GridV2Column, NotNull, ObjectRef} from "@webbpm/base-package";
|
||||
|
||||
@AnalyticalScope(GridV2)
|
||||
export class GridFormField extends FormField {
|
||||
|
||||
@NotNull()
|
||||
@ObjectRef()
|
||||
public column: GridV2Column;
|
||||
|
||||
public getValue(): any[] {
|
||||
let grid: GridV2 = this.getScript(GridV2);
|
||||
return grid.getAllRows().map(rowData => rowData[this.column.getField()]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import {FormField} from "./FormField";
|
||||
import {AnalyticalScope, SelectBase} from "@webbpm/base-package";
|
||||
|
||||
@AnalyticalScope(SelectBase)
|
||||
export class SelectizeFormField extends FormField {
|
||||
|
||||
public getValue(): any {
|
||||
return this.context.getBusinessId();
|
||||
}
|
||||
}
|
||||
|
|
@ -2413,7 +2413,6 @@
|
|||
<componentRootId>eaaf9ba1-feca-4c41-9944-e321eee27a58</componentRootId>
|
||||
<name>Hbox</name>
|
||||
<container>true</container>
|
||||
<expanded>false</expanded>
|
||||
<childrenReordered>false</childrenReordered>
|
||||
<scripts id="bf098f19-480e-44e4-9084-aa42955c4d0f"/>
|
||||
<scripts id="b6068710-0f31-48ec-8e03-c0c1480a40c0"/>
|
||||
|
|
@ -3461,9 +3460,9 @@
|
|||
</entry>
|
||||
</properties>
|
||||
</scripts>
|
||||
<scripts id="93cced4c-2537-4583-95cf-db5937d58efd">
|
||||
<scripts id="d4ef441c-372e-49ba-8394-b7a99efea972">
|
||||
<classRef type="TS">
|
||||
<className>FormField</className>
|
||||
<className>SelectizeFormField</className>
|
||||
<packageName>account_applications.component.field</packageName>
|
||||
</classRef>
|
||||
<enabled>true</enabled>
|
||||
|
|
@ -3586,6 +3585,7 @@
|
|||
<componentRootId>62adbc2d-0be1-45de-bc44-b77d11b129d7</componentRootId>
|
||||
<name>Grid_groups</name>
|
||||
<container>true</container>
|
||||
<expanded>false</expanded>
|
||||
<childrenReordered>false</childrenReordered>
|
||||
<scripts id="07201df9-ff33-4c71-9aae-a2cfdd028234">
|
||||
<properties>
|
||||
|
|
@ -3665,24 +3665,18 @@
|
|||
</properties>
|
||||
</scripts>
|
||||
<scripts id="be8fe0e1-4909-4224-8664-be55168595c6"/>
|
||||
<scripts id="79126393-0edc-40b0-89d7-4238c392e3de">
|
||||
<scripts id="5f7dc87b-1b63-4832-b87a-488c1c127d64">
|
||||
<classRef type="TS">
|
||||
<className>FormField</className>
|
||||
<className>GridFormField</className>
|
||||
<packageName>account_applications.component.field</packageName>
|
||||
</classRef>
|
||||
<enabled>true</enabled>
|
||||
<expanded>true</expanded>
|
||||
<properties>
|
||||
<entry>
|
||||
<key>columnId</key>
|
||||
<key>column</key>
|
||||
<value>
|
||||
<simple>"user_application_role$user_role_id"</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>gridValue</key>
|
||||
<value>
|
||||
<simple>true</simple>
|
||||
<simple>{"objectId":"c8b2b349-588a-473a-bc1e-fb8cf5a03c0a","packageName":"component.grid","className":"GridV2Column","type":"TS"}</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
|
|
@ -3958,24 +3952,18 @@
|
|||
</properties>
|
||||
</scripts>
|
||||
<scripts id="be8fe0e1-4909-4224-8664-be55168595c6"/>
|
||||
<scripts id="e6845ea7-23e8-4042-b73b-255707d5c740">
|
||||
<scripts id="3f018695-895b-463b-9292-37d976a933b0">
|
||||
<classRef type="TS">
|
||||
<className>FormField</className>
|
||||
<className>GridFormField</className>
|
||||
<packageName>account_applications.component.field</packageName>
|
||||
</classRef>
|
||||
<enabled>true</enabled>
|
||||
<expanded>true</expanded>
|
||||
<properties>
|
||||
<entry>
|
||||
<key>columnId</key>
|
||||
<key>column</key>
|
||||
<value>
|
||||
<simple>"link_user_application_ip_address$ip_address"</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>gridValue</key>
|
||||
<value>
|
||||
<simple>true</simple>
|
||||
<simple>{"objectId":"a062f520-09a7-42bc-a331-7546913530e8","packageName":"component.grid","className":"GridV2Column","type":"TS"}</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
|
|
|
|||
|
|
@ -1768,24 +1768,18 @@
|
|||
</properties>
|
||||
</scripts>
|
||||
<scripts id="be8fe0e1-4909-4224-8664-be55168595c6"/>
|
||||
<scripts id="e6845ea7-23e8-4042-b73b-255707d5c740">
|
||||
<scripts id="91768a69-9949-4346-a63d-2df11c486dac">
|
||||
<classRef type="TS">
|
||||
<className>FormField</className>
|
||||
<className>GridFormField</className>
|
||||
<packageName>account_applications.component.field</packageName>
|
||||
</classRef>
|
||||
<enabled>true</enabled>
|
||||
<expanded>true</expanded>
|
||||
<properties>
|
||||
<entry>
|
||||
<key>columnId</key>
|
||||
<key>column</key>
|
||||
<value>
|
||||
<simple>"link_user_application_ip_address$ip_address"</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>gridValue</key>
|
||||
<value>
|
||||
<simple>true</simple>
|
||||
<simple>{"objectId":"a062f520-09a7-42bc-a331-7546913530e8","packageName":"component.grid","className":"GridV2Column","type":"TS"}</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
|
|
@ -2873,9 +2867,9 @@
|
|||
</entry>
|
||||
</properties>
|
||||
</scripts>
|
||||
<scripts id="93cced4c-2537-4583-95cf-db5937d58efd">
|
||||
<scripts id="f4a1c413-91a3-4124-8d6e-336c2b91cb65">
|
||||
<classRef type="TS">
|
||||
<className>FormField</className>
|
||||
<className>SelectizeFormField</className>
|
||||
<packageName>account_applications.component.field</packageName>
|
||||
</classRef>
|
||||
<enabled>true</enabled>
|
||||
|
|
@ -3004,6 +2998,7 @@
|
|||
<componentRootId>62adbc2d-0be1-45de-bc44-b77d11b129d7</componentRootId>
|
||||
<name>Grid_groups</name>
|
||||
<container>true</container>
|
||||
<expanded>false</expanded>
|
||||
<childrenReordered>false</childrenReordered>
|
||||
<scripts id="07201df9-ff33-4c71-9aae-a2cfdd028234">
|
||||
<properties>
|
||||
|
|
@ -3070,24 +3065,18 @@
|
|||
</properties>
|
||||
</scripts>
|
||||
<scripts id="be8fe0e1-4909-4224-8664-be55168595c6"/>
|
||||
<scripts id="79126393-0edc-40b0-89d7-4238c392e3de">
|
||||
<scripts id="31598adb-72ce-4c63-9a50-28a435dbaf8c">
|
||||
<classRef type="TS">
|
||||
<className>FormField</className>
|
||||
<className>GridFormField</className>
|
||||
<packageName>account_applications.component.field</packageName>
|
||||
</classRef>
|
||||
<enabled>true</enabled>
|
||||
<expanded>true</expanded>
|
||||
<properties>
|
||||
<entry>
|
||||
<key>columnId</key>
|
||||
<key>column</key>
|
||||
<value>
|
||||
<simple>"user_application_role$user_role_id"</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>gridValue</key>
|
||||
<value>
|
||||
<simple>true</simple>
|
||||
<simple>{"objectId":"c8b2b349-588a-473a-bc1e-fb8cf5a03c0a","packageName":"component.grid","className":"GridV2Column","type":"TS"}</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
|
|
@ -3133,6 +3122,7 @@
|
|||
<componentRootId>c8b2b349-588a-473a-bc1e-fb8cf5a03c0a</componentRootId>
|
||||
<name>Column role id</name>
|
||||
<container>false</container>
|
||||
<expanded>false</expanded>
|
||||
<childrenReordered>false</childrenReordered>
|
||||
<scripts id="9c5c7a86-dc40-4b30-a5a7-5e7b4c7ea1e1"/>
|
||||
<scripts id="fd653fca-12f9-4e35-baa4-b6b5dd3f6d59">
|
||||
|
|
@ -8076,12 +8066,6 @@
|
|||
<simple>"/app_list"</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>visible</key>
|
||||
<value>
|
||||
<simple>true</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>style</key>
|
||||
<value>
|
||||
|
|
@ -8095,6 +8079,12 @@
|
|||
</complex>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>visible</key>
|
||||
<value>
|
||||
<simple>true</simple>
|
||||
</value>
|
||||
</entry>
|
||||
</properties>
|
||||
</scripts>
|
||||
</children>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue