Update UX for Storage administration

This commit is contained in:
Philipp 2021-07-24 18:57:29 +02:00
parent 1e4f9f62fe
commit 4be4498b13
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD
3 changed files with 34 additions and 11 deletions

View file

@ -116,6 +116,7 @@ class Storage extends BaseAdmin
'name' => $name, 'name' => $name,
'prefix' => $storage_form_prefix, 'prefix' => $storage_form_prefix,
'form' => $storage_form, 'form' => $storage_form,
'active' => $name === $current_storage_backend::getName(),
]; ];
} }
@ -125,8 +126,10 @@ class Storage extends BaseAdmin
'$title' => DI::l10n()->t('Administration'), '$title' => DI::l10n()->t('Administration'),
'$page' => DI::l10n()->t('Storage'), '$page' => DI::l10n()->t('Storage'),
'$save' => DI::l10n()->t('Save'), '$save' => DI::l10n()->t('Save'),
'$save_set' => DI::l10n()->t('Save & Activate'), '$save_activate' => DI::l10n()->t('Save & Activate'),
'$clear' => DI::l10n()->t('Clear'), '$activate' => DI::l10n()->t('Activate'),
'$save_reload' => DI::l10n()->t('Save & Reload'),
'$noconfig' => DI::l10n()->t('This backend doesn\'t have custom settings'),
'$baseurl' => DI::baseUrl()->get(true), '$baseurl' => DI::baseUrl()->get(true),
'$form_security_token' => self::getFormSecurityToken("admin_storage"), '$form_security_token' => self::getFormSecurityToken("admin_storage"),
'$storagebackend' => $current_storage_backend, '$storagebackend' => $current_storage_backend,

View file

@ -9,14 +9,24 @@
<form action="{{$baseurl}}/admin/storage/{{$storage.prefix}}" method="post"> <form action="{{$baseurl}}/admin/storage/{{$storage.prefix}}" method="post">
<input type='hidden' name='form_security_token' value="{{$form_security_token}}"> <input type='hidden' name='form_security_token' value="{{$form_security_token}}">
<h3>{{$storage.name}}</h3> <h3>{{$storage.name}}</h3>
{{foreach from=$storage.form item=$field}} {{if $storage.form}}
{{include file=$field.field field=$field}} {{foreach from=$storage.form item=$field}}
{{/foreach}} {{include file=$field.field field=$field}}
{{/foreach}}
{{else}}
{{$noconfig}}
{{/if}}
{{if $storage.form}} {{if $storage.form}}
<div class="submit"><input type="submit" name="submit_save" value="{{$save}}" /></div> <input type="submit" name="submit_save" value="{{$save}}"/>
{{if $storage.active}}
<input type="submit" name="submit_save_set" value="{{$save_reload}}"/>
{{else}}
<input type="submit" name="submit_save_set" value="{{$save_activate}}"/>
{{/if}}
{{else}}
<br /><input type="submit" name="submit_save_set" {{if $storage.active}}disabled="disabled"{{/if}} value="{{$activate}}"/>
{{/if}} {{/if}}
<div class="submit"><input type="submit" name="submit_save_set" value="{{$save_set}}" /></div>
</form> </form>
{{/foreach}} {{/foreach}}

View file

@ -22,15 +22,25 @@
</div> </div>
<div id="admin-settings-{{$storage.prefix}}-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="admin-settings-{{$storage.prefix}}"> <div id="admin-settings-{{$storage.prefix}}-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="admin-settings-{{$storage.prefix}}">
<div class="panel-body"> <div class="panel-body">
{{foreach from=$storage.form item=$field}} {{if $storage.form}}
{{include file=$field.field field=$field}} {{foreach from=$storage.form item=$field}}
{{/foreach}} {{include file=$field.field field=$field}}
{{/foreach}}
{{else}}
{{$noconfig}}
{{/if}}
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
{{if $storage.form}} {{if $storage.form}}
<input type="submit" name="submit_save" class="btn btn-primary" value="{{$save}}"/> <input type="submit" name="submit_save" class="btn btn-primary" value="{{$save}}"/>
{{if $storage.active}}
<input type="submit" name="submit_save_set" class="btn btn-primary" value="{{$save_reload}}"/>
{{else}}
<input type="submit" name="submit_save_set" class="btn btn-primary" value="{{$save_activate}}"/>
{{/if}}
{{else}}
<input type="submit" name="submit_save_set" class="btn btn-primary" {{if $storage.active}}disabled="disabled"{{/if}} value="{{$activate}}"/>
{{/if}} {{/if}}
<input type="submit" name="submit_save_set" class="btn btn-primary" value="{{$save_set}}"/>
</div> </div>
</div> </div>
</div> </div>