Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
CFM-291-refactor_form_code_structuring (#187)
* Decouple markup from FieldHelper.Move to elements.

* CoSettings

* ApiUsers fields-generate.inc

* Cos

* Addresses

* EmailAddresses

* Groups

* Urls, Types, Servers

* Identifiers,HistoryRecords,TelephoneNumbers,Names,AdHocAttributes,PersonRoles

* ExternalIdentities,ExternalIdentityRoles,ExternalIdentitySources

* ExternalIdentitySourceRecords,IdentifierAssignments

* fixes

* update FieeldHelper

* Jobs

* JobHistoryRecords

* CoreAssigne, CoreServer

* Pronouns,ProvisioningTargets,ProvisioningHistoryRecords

* ProvisioningHistoryRecords

* People

* Pipelines

* Jobs

* GroupNestings

* GroupMembers

* rename field parameters. Added prefix field.

* Available plugins.Alert to element.

* required field fix for nameDiv and infoDiv. Take fieldOptions into consideration.

* cleanup

* Add frozen and plugin configuration handling

* remove temp helper files

* minor improvements

* FieldHelper improvements

* SmtpServers, MessageTemplates, Notifications

* revert FileProvisioner change

* fix alert css classes calculation

* fix review errors
Ioannis committed Apr 30, 2024
1 parent dff56a5 commit e84d730
Showing 91 changed files with 2,677 additions and 1,529 deletions.
@@ -189,7 +189,7 @@ protected function mapApiToRegistry(string $model, array $attributes): array {
*/

public function remove(
\App\Model\Entity\ExternalIdentitySource $source,
\App\Model\Entity\ExternalIdentitySource $source,
string $sorId
): array {
// We call this remove() so as not to interfere with the default table::delete().
@@ -293,7 +293,7 @@ protected function resultToEntityData(array $result): array {
*/

public function retrieve(
\App\Model\Entity\ExternalIdentitySource $source,
\App\Model\Entity\ExternalIdentitySource $source,
string $source_key
): array {
$ret = [
@@ -328,7 +328,7 @@ public function retrieve(
*/

public function search(
\App\Model\Entity\ExternalIdentitySource $source,
\App\Model\Entity\ExternalIdentitySource $source,
array $searchAttrs
): array {
$ret = [];
@@ -30,8 +30,15 @@ if($vv_action == 'add' || $vv_action == 'edit') {

print '<li class="info-title"><h3>' . __d('api_connector', 'field.ApiSources.push_mode') . '</h3></li>';

print $this->Field->banner(__d('api_connector', 'information.endpoint.push', [$vv_push_endpoint]));
print $this->element('banner', [
'info' => __d('api_connector', 'information.endpoint.push', [$vv_push_endpoint])
]);

print $this->Field->control('api_user_id');

print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'api_user_id',
]
]);

}
@@ -349,7 +349,7 @@ protected function resultToEntityData(array $result): array {
*/

public function retrieve(
\App\Model\Entity\ExternalIdentitySource $source,
\App\Model\Entity\ExternalIdentitySource $source,
string $source_key
): array {
// Read the field configuration (for resultToEntity)
@@ -423,7 +423,7 @@ public function ruleIsFileReadable($entity, array $options): string|bool {
*/

public function search(
\App\Model\Entity\ExternalIdentitySource $source,
\App\Model\Entity\ExternalIdentitySource $source,
array $searchAttrs
): array {
// Read the field configuration (for resultToEntity)
@@ -27,5 +27,9 @@

// This view does currently not support read-only
if($vv_action == 'add' || $vv_action == 'edit') {
print $this->Field->control('filename');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'filename',
]
]);
}
@@ -27,13 +27,17 @@

// This view does currently not support read-only
if($vv_action == 'add' || $vv_action == 'edit') {
print $this->Field->control('filename');

print $this->Field->control('format');

print $this->Field->control('archivedir');

print $this->Field->control('threshold_warn');

print $this->Field->control('threshold_override');
foreach([
'filename',
'format',
'archivedir',
'threshold_warn',
'threshold_override',
] as $field) {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => $field,
]
]);
}
}
@@ -27,7 +27,18 @@

// This view does currently not support read-only
if($vv_action == 'add' || $vv_action == 'edit') {
print $this->Field->control('server_id');

print $this->Field->control('table_prefix', ['default' => 'sp_']);
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'server_id',
]
]);

print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'table_prefix',
'options' => [
'default' => 'sp_'
]
]
]);
}
2 changes: 2 additions & 0 deletions app/config/.env.example
@@ -25,6 +25,8 @@ export SECURITY_SALT="__SALT__"
#export CACHE_DEFAULT_URL="file://tmp/cache/?prefix=${APP_NAME}_default&duration=${CACHE_DURATION}"
#export CACHE_CAKECORE_URL="file://tmp/cache/persistent?prefix=${APP_NAME}_cake_core&serialize=true&duration=${CACHE_DURATION}"
#export CACHE_CAKEMODEL_URL="file://tmp/cache/models?prefix=${APP_NAME}_cake_model&serialize=true&duration=${CACHE_DURATION}"
#export CACHE_CAKEROUTE_URL="file://tmp/cache/routes?prefix=${APP_NAME}_cake_routes&serialize=true&duration=${CACHE_DURATION}"
#export CACHE_HTMLELEMENT_URL="file://tmp/cache/elements?prefix=${APP_NAME}_html_elements&serialize=true&duration=${CACHE_DURATION}"

# Uncomment these to define email transport configuration via environment variables.
#export EMAIL_TRANSPORT_DEFAULT_URL=""
11 changes: 11 additions & 0 deletions app/config/app.php
@@ -171,6 +171,17 @@
'duration' => '+1 years',
'url' => env('CACHE_CAKEROUTES_URL', null),
],
/**
* Configure the cache for html elements.
* Duration will be set to '+2 seconds' in bootstrap.php when debug = true
*/
'_html_elements' => [
'className' => 'Cake\Cache\Engine\FileEngine',
'prefix' => 'myapp_cake_elements_',
'duration' => '+1 week',
'probability' => 100,
'url' => env('CACHE_HTMLELEMENT_URL', null),
]
],

/**
34 changes: 23 additions & 11 deletions app/plugins/CoreAssigner/templates/FormatAssigners/fields.inc
@@ -47,18 +47,30 @@
<?php
// This view does currently not support read-only, and add is not used
if($vv_action == 'edit') {
print $this->Field->control('format');

print $this->Field->control(
fieldName: 'collision_mode',
options: [
'onChange' => 'updateGadgets()'
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'format'
]
);

print $this->Field->control('permitted_characters');
]);

print $this->Field->control('minimum');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'collision_mode',
'options' => [
'onChange' => 'updateGadgets()'
]
]
]);

print $this->Field->control('maximum');
foreach([
'permitted_characters',
'minimum',
'maximum',
] as $field) {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => $field,
]
]);
}
}
16 changes: 11 additions & 5 deletions app/plugins/CoreAssigner/templates/SqlAssigners/fields.inc
@@ -27,9 +27,15 @@

// This view does currently not support read-only, and add is not used
if($vv_action == 'edit') {
print $this->Field->control('server_id');

print $this->Field->control('source_table');

print $this->Field->control('type_id');
foreach([
'server_id',
'source_table',
'type_id',
] as $field) {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => $field,
]
]);
}
}
49 changes: 39 additions & 10 deletions app/plugins/CoreServer/templates/SmtpServers/fields.inc
@@ -27,19 +27,48 @@

// This view does currently not support read-only, and add is not used
if($vv_action == 'edit') {
print $this->Field->control('hostname');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'hostname',
]
]);

print $this->Field->control('port', ['default' => 587]);
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'port',
'fieldOptions' => [
'default' => 587
]
]]);

print $this->Field->control('username');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'username',
]
]);

print $this->Field->control('password');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'password',
]
]);

print $this->Field->control('use_tls', ['default' => true]);
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'use_tls',
'fieldOptions' => [
'default' => true
]
]]);

print $this->Field->control('default_from');

print $this->Field->control('default_reply_to');

print $this->Field->control('override_to');
foreach ([
'default_from',
'default_reply_to',
'override_to',
] as $field) {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => $field
]]);
}
}
25 changes: 14 additions & 11 deletions app/plugins/CoreServer/templates/SqlServers/fields.inc
@@ -27,15 +27,18 @@

// This view does currently not support read-only, and add is not used
if($vv_action == 'edit') {
print $this->Field->control('type');

print $this->Field->control('hostname');

print $this->Field->control('port');

print $this->Field->control('databas');

print $this->Field->control('username');

print $this->Field->control('password');
foreach([
'type',
'hostname',
'port',
'databas',
'username',
'password',
] as $field) {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => $field,
]
]);
}
}
3 changes: 2 additions & 1 deletion app/src/Controller/ApiUsersController.php
@@ -62,7 +62,8 @@ public function generate(string $id) {
'api.key',
$this->request->getParam('action'));
$this->set('vv_title', $title);


// Let the view render
$this->render('/Standard/add-edit-view');
}
}
4 changes: 2 additions & 2 deletions app/src/Controller/StandardController.php
@@ -423,7 +423,7 @@ public function edit(string $id) {
$this->set('vv_title', $title);
$this->set('vv_supertitle', $supertitle);
$this->set('vv_subtitle', $subtitle);

// Let the view render
$this->render('/Standard/add-edit-view');
}
@@ -870,7 +870,7 @@ public function view($id = null) {
$this->set('vv_title', $title);
$this->set('vv_supertitle', $supertitle);
$this->set('vv_subtitle', $subtitle);

// Let the view render
$this->render('/Standard/add-edit-view');
}
3 changes: 2 additions & 1 deletion app/src/Model/Table/AdHocAttributesTable.php
@@ -43,7 +43,8 @@ class AdHocAttributesTable extends Table {
use \App\Lib\Traits\ValidationTrait;
use \App\Lib\Traits\SearchFilterTrait;
use \App\Lib\Traits\QueryModificationTrait;

use \App\Lib\Traits\AutoViewVarsTrait;

/**
* Provide the default layout
*
3 changes: 2 additions & 1 deletion app/src/Model/Table/HistoryRecordsTable.php
@@ -41,7 +41,8 @@ class HistoryRecordsTable extends Table {
use \App\Lib\Traits\TableMetaTrait;
use \App\Lib\Traits\ValidationTrait;
use \App\Lib\Traits\SearchFilterTrait;

use \App\Lib\Traits\AutoViewVarsTrait;

/**
* Perform Cake Model initialization.
*

0 comments on commit e84d730

Please sign in to comment.