Skip to content

CFM-291-refactor_form_code_structuring #187

Merged
merged 35 commits into from Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
96758a1
Decouple markup from FieldHelper.Move to elements.
Ioannis Apr 25, 2024
77205b7
CoSettings
Ioannis Apr 26, 2024
ddeb738
ApiUsers fields-generate.inc
Ioannis Apr 26, 2024
f03e0ad
Cos
Ioannis Apr 26, 2024
56c5f05
Addresses
Ioannis Apr 26, 2024
92a736e
EmailAddresses
Ioannis Apr 26, 2024
ea1d947
Groups
Ioannis Apr 26, 2024
e722c77
Urls, Types, Servers
Ioannis Apr 26, 2024
e8f5d67
Identifiers,HistoryRecords,TelephoneNumbers,Names,AdHocAttributes,Per…
Ioannis Apr 26, 2024
f47dd8d
ExternalIdentities,ExternalIdentityRoles,ExternalIdentitySources
Ioannis Apr 27, 2024
b146ddc
ExternalIdentitySourceRecords,IdentifierAssignments
Ioannis Apr 27, 2024
28a9aee
fixes
Ioannis Apr 27, 2024
2d7c922
update FieeldHelper
Ioannis Apr 27, 2024
a2dac6b
Jobs
Ioannis Apr 27, 2024
367b3da
JobHistoryRecords
Ioannis Apr 27, 2024
1808c07
CoreAssigne, CoreServer
Ioannis Apr 27, 2024
ab2f6a2
Pronouns,ProvisioningTargets,ProvisioningHistoryRecords
Ioannis Apr 27, 2024
5944be3
ProvisioningHistoryRecords
Ioannis Apr 27, 2024
16fe4c2
People
Ioannis Apr 27, 2024
6f87b15
Pipelines
Ioannis Apr 27, 2024
28fd8c7
Jobs
Ioannis Apr 27, 2024
7f63b4b
GroupNestings
Ioannis Apr 27, 2024
8e73da0
GroupMembers
Ioannis Apr 27, 2024
3432946
rename field parameters. Added prefix field.
Ioannis Apr 28, 2024
75f4f88
Available plugins.Alert to element.
Ioannis Apr 28, 2024
53ca43d
required field fix for nameDiv and infoDiv. Take fieldOptions into co…
Ioannis Apr 28, 2024
d69bb7c
cleanup
Ioannis Apr 28, 2024
73c0755
Add frozen and plugin configuration handling
Ioannis Apr 28, 2024
b0f4163
remove temp helper files
Ioannis Apr 28, 2024
99c73b5
minor improvements
Ioannis Apr 28, 2024
1ba5a7a
FieldHelper improvements
Ioannis Apr 28, 2024
28d10be
SmtpServers, MessageTemplates, Notifications
Ioannis Apr 29, 2024
437d130
revert FileProvisioner change
Ioannis Apr 29, 2024
874b9de
fix alert css classes calculation
Ioannis Apr 29, 2024
72e0ef6
fix review errors
Ioannis Apr 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -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().
Expand Down Expand Up @@ -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 = [
Expand Down Expand Up @@ -328,7 +328,7 @@ public function retrieve(
*/

public function search(
\App\Model\Entity\ExternalIdentitySource $source,
\App\Model\Entity\ExternalIdentitySource $source,
array $searchAttrs
): array {
$ret = [];
Expand Down
Expand Up @@ -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',
]
]);

}
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Expand Up @@ -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',
]
]);
}
Expand Up @@ -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,
]
]);
}
}
Expand Up @@ -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
Expand Up @@ -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=""
Expand Down
11 changes: 11 additions & 0 deletions app/config/app.php
Expand Up @@ -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),
]
],

/**
Expand Down
34 changes: 23 additions & 11 deletions app/plugins/CoreAssigner/templates/FormatAssigners/fields.inc
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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');
}
Expand Down Expand Up @@ -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');
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/Model/Table/AdHocAttributesTable.php
Expand Up @@ -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
*
Expand Down
3 changes: 2 additions & 1 deletion app/src/Model/Table/HistoryRecordsTable.php
Expand Up @@ -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.
*
Expand Down