Skip to content
Snippets Groups Projects
Commit d7b2089b authored by Yas Naoi's avatar Yas Naoi Committed by Yas Naoi
Browse files

Issue #3167112 by yas, Xiaohua Guan: Refactor Terraform admin settings form

parent fdc4d827
No related branches found
No related tags found
No related merge requests found
......@@ -83,38 +83,6 @@ class TerraformAdminSettings extends ConfigFormBase {
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this->config('terraform.settings');
$form['terraform_js_refresh_interval'] = [
'#type' => 'number',
'#title' => 'UI Refresh Interval',
'#description' => $this->t('Refresh UI (Logs and etc) at periodical intervals.'),
'#default_value' => $config->get('terraform_js_refresh_interval'),
'#min' => 1,
'#max' => 9999,
'#field_suffix' => 'seconds',
];
$form['terraform_update_resources_queue_cron_time'] = [
'#type' => 'number',
'#title' => 'Update Resources Queue Cron Time',
'#description' => $this->t('The cron time for queue update resources.'),
'#default_value' => $config->get('terraform_update_resources_queue_cron_time'),
'#min' => 1,
'#max' => 9999,
'#field_suffix' => 'seconds',
];
$form['terraform_cloud_config_icon'] = [
'#type' => 'managed_file',
'#title' => $this->t('Terraform Cloud Config Icon'),
'#default_value' => [
'fids' => $config->get('terraform_cloud_config_icon'),
],
'#description' => $this->t('Upload an image to represent Terraform.'),
'#upload_location' => 'public://images/icons',
'#upload_validators' => [
'file_validate_is_image' => [],
],
];
$form['views'] = [
'#type' => 'details',
......@@ -123,6 +91,16 @@ class TerraformAdminSettings extends ConfigFormBase {
'#description' => $this->t("Note that selecting the default option will overwrite View's settings."),
];
$form['views']['terraform_js_refresh_interval'] = [
'#type' => 'number',
'#title' => 'View refresh interval',
'#description' => $this->t('Refresh UI (Logs and etc) at periodical intervals.'),
'#default_value' => $config->get('terraform_js_refresh_interval'),
'#min' => 1,
'#max' => 9999,
'#field_suffix' => 'seconds',
];
$form['views']['pager_options'] = [
'#type' => 'details',
'#title' => $this->t('Pager options'),
......@@ -144,6 +122,41 @@ class TerraformAdminSettings extends ConfigFormBase {
'#default_value' => $config->get('terraform_view_items_per_page'),
];
$form['cron'] = [
'#type' => 'details',
'#title' => $this->t('Cron'),
'#open' => TRUE,
];
$form['cron']['terraform_update_resources_queue_cron_time'] = [
'#type' => 'number',
'#title' => 'Update resources every',
'#description' => $this->t('Run cron to process queue to update resources.'),
'#default_value' => $config->get('terraform_update_resources_queue_cron_time'),
'#min' => 1,
'#max' => 9999,
'#field_suffix' => 'seconds',
];
$form['icon'] = [
'#type' => 'details',
'#title' => $this->t('Icon'),
'#open' => TRUE,
];
$form['icon']['terraform_cloud_config_icon'] = [
'#type' => 'managed_file',
'#title' => $this->t('Terraform cloud service provider icon'),
'#default_value' => [
'fids' => $config->get('terraform_cloud_config_icon'),
],
'#description' => $this->t('Upload an image to represent Terraform.'),
'#upload_location' => 'public://images/icons',
'#upload_validators' => [
'file_validate_is_image' => [],
],
];
return parent::buildForm($form, $form_state);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment