Skip to content

Commit

Permalink
Make the field order on credentialsRead match the field order on cred…
Browse files Browse the repository at this point in the history
…entialsCreateForm.
  • Loading branch information
mark-unwin committed Mar 5, 2024
1 parent 6b308cd commit 0d847b9
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions app/Views/credentialsRead.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,33 @@
echo read_field('credentials.password', '', $dictionary->columns->password, $update, __('Key Password (optional)'), '', '', 'password');
echo read_field('credentials.sudo_password', '', $dictionary->columns->sudo_password, $update, __('Sudo Password (optional)'), '', '', 'password');
} else if ($resource->type === 'snmp_v3') {
echo read_field('credentials.authentication_passphrase', '', $dictionary->columns->authentication_passphrase, $update, __('Authentication Passphrase'), '', '', 'password'); ?>

echo read_field('credentials.security_name', $resource->credentials->security_name, $dictionary->columns->security_name, $update, __('Security Name')); ?>

<div class="row" style="padding-top:16px;">
<div class="offset-2 col-8" style="position:relative;">
<label for="authentication_protocol" class="form-label"><?= __('authentication_protocol') ?></label>
<label for="security_level" class="form-label"><?= __('Security Level') ?></label>
<div class="input-group">
<select class="form-select" id="credentials.security_level" name="credentials.security_level" data-original-value="<?= $resource->type ?>" disabled>
<option value="noAuthNoPriv" <?php if (!empty($resource->credentials->security_level) and $resource->credentials->security_level == 'noAuthNoPriv') { echo 'selected '; } ?>>noAuthNoPriv</option>
<option value="authNoPriv" <?php if (!empty($resource->credentials->security_level) and $resource->credentials->security_level == 'authNoPriv') { echo 'selected '; } ?>>authNoPriv</option>
<option value="authPriv" <?php if (!empty($resource->credentials->security_level) and $resource->credentials->security_level == 'authPriv') { echo 'selected '; } ?>>authPriv</option>
</select>
<?php if ($update) { ?>
<div class="float-end" style="padding-left:4px;">
<div data-attribute="credentials.security_level" class="btn btn-outline-secondary edit"><span style="font-size: 1.2rem;" class='fa fa-pencil'></span></div>
<div data-attribute="credentials.security_level" class="btn btn-outline-success submit" style="display: none;"><span style="font-size: 1.2rem;" class='fa fa-check'></span></div>
<div data-attribute="credentials.security_level" class="btn btn-outline-danger cancel" style="display: none;"><span style="font-size: 1.2rem;" class='fa fa-remove'></span></div>
</div>
<?php } ?>
</div>
<div class="form-text form-help float-end" style="position: absolute; right: 0;" data-attribute="credentials.security_level" data-dictionary="<?= $dictionary->columns->security_level ?>"><span><br></span></div>
</div>
</div>

<div class="row" style="padding-top:16px;">
<div class="offset-2 col-8" style="position:relative;">
<label for="authentication_protocol" class="form-label"><?= __('Authentication Protocol') ?></label>
<div class="input-group">
<select class="form-select" id="credentials.authentication_protocol" name="credentials.authentication_protocol" data-original-value="<?= $resource->type ?>" disabled>
<option value="MD5" <?php if (!empty($resource->credentials->authentication_protocol) and $resource->credentials->authentication_protocol == 'MD5') { echo 'selected '; } ?>>MD5</option>
Expand All @@ -65,7 +87,7 @@
</div>
</div>

<?php echo read_field('credentials.privacy_passphrase', '', $dictionary->columns->privacy_passphrase, $update, __('Privacy Passphrase'), '', '', 'password'); ?>
<?php echo read_field('credentials.authentication_passphrase', '', $dictionary->columns->authentication_passphrase, $update, __('Authentication Passphrase'), '', '', 'password'); ?>

<div class="row" style="padding-top:16px;">
<div class="offset-2 col-8" style="position:relative;">
Expand All @@ -86,29 +108,8 @@
<div class="form-text form-help float-end" style="position: absolute; right: 0;" data-attribute="credentials.privacy_protocol" data-dictionary="<?= $dictionary->columns->privacy_protocol ?>"><span><br></span></div>
</div>
</div>
<?php echo read_field('credentials.privacy_passphrase', '', $dictionary->columns->privacy_passphrase, $update, __('Privacy Passphrase'), '', '', 'password'); ?>

<div class="row" style="padding-top:16px;">
<div class="offset-2 col-8" style="position:relative;">
<label for="security_level" class="form-label"><?= __('Security Level') ?></label>
<div class="input-group">
<select class="form-select" id="credentials.security_level" name="credentials.security_level" data-original-value="<?= $resource->type ?>" disabled>
<option value="noAuthNoPriv" <?php if (!empty($resource->credentials->security_level) and $resource->credentials->security_level == 'noAuthNoPriv') { echo 'selected '; } ?>>noAuthNoPriv</option>
<option value="authNoPriv" <?php if (!empty($resource->credentials->security_level) and $resource->credentials->security_level == 'authNoPriv') { echo 'selected '; } ?>>authNoPriv</option>
<option value="authPriv" <?php if (!empty($resource->credentials->security_level) and $resource->credentials->security_level == 'authPriv') { echo 'selected '; } ?>>authPriv</option>
</select>
<?php if ($update) { ?>
<div class="float-end" style="padding-left:4px;">
<div data-attribute="credentials.security_level" class="btn btn-outline-secondary edit"><span style="font-size: 1.2rem;" class='fa fa-pencil'></span></div>
<div data-attribute="credentials.security_level" class="btn btn-outline-success submit" style="display: none;"><span style="font-size: 1.2rem;" class='fa fa-check'></span></div>
<div data-attribute="credentials.security_level" class="btn btn-outline-danger cancel" style="display: none;"><span style="font-size: 1.2rem;" class='fa fa-remove'></span></div>
</div>
<?php } ?>
</div>
<div class="form-text form-help float-end" style="position: absolute; right: 0;" data-attribute="credentials.security_level" data-dictionary="<?= $dictionary->columns->security_level ?>"><span><br></span></div>
</div>
</div>

<?php echo read_field('credentials.security_name', $resource->credentials->security_name, $dictionary->columns->security_name, $update, __('Security Name')); ?>
<?php } ?>
<?= read_field('edited_by', $resource->edited_by, $dictionary->columns->edited_by, false) ?>
<?= read_field('edited_date', $resource->edited_date, $dictionary->columns->edited_date, false) ?>
Expand Down

0 comments on commit 0d847b9

Please sign in to comment.