Skip to content

Commit

Permalink
JobHistoryRecords
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Apr 27, 2024
1 parent 5b435d3 commit 6514233
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 50 deletions.
2 changes: 1 addition & 1 deletion app/src/Controller/ApiUsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function generate(string $id) {
'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords',
'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles', 'ExternalIdentities',
'ExternalIdentityRoles', 'ExternalIdentitySources', 'ExternalIdentitySourceRecords',
'IdentifierAssignments'
'IdentifierAssignments', 'Jobs', 'JobHistoryRecords'
])
) {
$this->render('/Standard/add-edit-view-new');
Expand Down
6 changes: 3 additions & 3 deletions app/src/Controller/StandardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function add() {
'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords',
'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles', 'ExternalIdentities',
'ExternalIdentityRoles', 'ExternalIdentitySources', 'ExternalIdentitySourceRecords',
'IdentifierAssignments'
'IdentifierAssignments', 'Jobs', 'JobHistoryRecords'
])
) {
$this->render('/Standard/add-edit-view-new');
Expand Down Expand Up @@ -437,7 +437,7 @@ public function edit(string $id) {
'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords',
'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles', 'ExternalIdentities',
'ExternalIdentityRoles', 'ExternalIdentitySources', 'ExternalIdentitySourceRecords',
'IdentifierAssignments'
'IdentifierAssignments', 'Jobs', 'JobHistoryRecords'
])
) {
$this->render('/Standard/add-edit-view-new');
Expand Down Expand Up @@ -896,7 +896,7 @@ public function view($id = null) {
'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords',
'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles', 'ExternalIdentities',
'ExternalIdentityRoles', 'ExternalIdentitySources', 'ExternalIdentitySourceRecords',
'IdentifierAssignments'
'IdentifierAssignments', 'Jobs', 'JobHistoryRecords'
])
) {
$this->render('/Standard/add-edit-view-new');
Expand Down
49 changes: 31 additions & 18 deletions app/templates/JobHistoryRecords/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,16 @@

// This view does not support add or edit
if($vv_action == 'view') {
print $this->Field->control('record_key');

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

print $this->Field->control('status');
foreach(['record_key',
'comment',
'status'
] as $field) {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => $field,
]
]);
}

// Rewrite these to always emit the column even if the field is blank
if(!empty($vv_obj->person->primary_name)) {
Expand All @@ -42,12 +47,14 @@ if($vv_action == 'view') {
$vv_obj->person->id
],
];

print $this->Field->statusControl(
'person_id',
$vv_obj->person->primary_name->full_name,
$viewLink
);

print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'person_id',
'status' => $vv_obj->person->primary_name->full_name,
'link' => $viewLink,
]
]);
}

if(!empty($vv_obj->external_identity->primary_name)) {
Expand All @@ -58,13 +65,19 @@ if($vv_action == 'view') {
$vv_obj->external_identity->id
],
];

print $this->Field->statusControl(
'external_identity_id',
$vv_obj->external_identity->primary_name->full_name,
$viewLink
);

print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'external_identity_id',
'status' => $vv_obj->external_identity->primary_name->full_name,
'link' => $viewLink,
]
]);
}

print $this->Field->control('created');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'created'
]
]);
}
5 changes: 2 additions & 3 deletions app/templates/Jobs/fields.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* COmanage Registry Jobs Fields
* COmanage Registry Job History Records Fields
*
* Portions licensed to the University Corporation for Advanced Internet
* Development, Inc. ("UCAID") under one or more contributor license agreements.
Expand Down Expand Up @@ -39,8 +39,7 @@ if($vv_action == 'view') {
]
]);
}

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

print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'parameters',
Expand Down
2 changes: 2 additions & 0 deletions app/templates/element/form/fieldDiv.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
print $this->element('form/infoDiv/grouped');
} elseif(isset($vv_field_arguments['entity'])) {
print $this->element('form/infoDiv/source');
} elseif(isset($vv_field_arguments['check']) && $vv_field_arguments['check']) {
print $this->element('form/infoDiv/check');
} else {
print $this->element('form/infoDiv/default');
}
Expand Down
42 changes: 22 additions & 20 deletions app/templates/element/form/infoDiv/check.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,26 @@

?>

<script>
parametersValue = $("#<?= $fieldName ?>").val();
parametersJSON = JSON.parse(parametersValue);
$("#format-toggle").click(function() {
if($(this).is(":checked")) {
$("#<?= $fieldName ?>").val(JSON.stringify(parametersJSON, null, 4));
paramsHeight = Object.keys(parametersJSON).length + 6 + "em";
$("#<?= $fieldName ?>").css("height",paramsHeight);
} else {
$("#<?= $fieldName ?>").val(parametersValue);
$("#<?= $fieldName ?>").css("height","4em");
}
});
</script>

<div class="field-suppliment">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="format-toggle">
<label class="form-check-label" for="format-toggle"><?= __d('field','format') ?></label>
<div class="field-info">
<div class="field-suppliment">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="format-toggle">
<label class="form-check-label" for="format-toggle"><?= __d('field','format') ?></label>
</div>
</div>
</div>
<?= $this->Fieeld->formField(...$vv_field_arguments) ?>
<script>
parametersValue = $("#<?= $fieldName ?>").val();
parametersJSON = JSON.parse(parametersValue);
$("#format-toggle").click(function() {
if($(this).is(":checked")) {
$("#<?= $fieldName ?>").val(JSON.stringify(parametersJSON, null, 4));
paramsHeight = Object.keys(parametersJSON).length + 6 + "em";
$("#<?= $fieldName ?>").css("height",paramsHeight);
} else {
$("#<?= $fieldName ?>").val(parametersValue);
$("#<?= $fieldName ?>").css("height","4em");
}
});
</script>
</div>
5 changes: 0 additions & 5 deletions app/templates/element/form/infoDiv/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,5 @@
declare(strict_types = 1);
?>
<div class="field-info">
<?php
if(isset($vv_field_arguments['check']) && $vv_field_arguments['check']) {
print $this->element('form/infoDiv/check');
}
?>
<?= $this->Fieeld->formField(...$vv_field_arguments) ?>
</div>

0 comments on commit 6514233

Please sign in to comment.