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

Issue #3247118 by sekinet, yas: Refactor the K8s launch template edit form...

Issue #3247118 by sekinet, yas: Refactor the K8s launch template edit form (Show some warning status message)
parent a7bcae6d
No related branches found
No related tags found
No related merge requests found
......@@ -1464,6 +1464,29 @@ function k8s_form_cloud_launch_template_k8s_form_common_alter(array &$form, Form
],
];
$form['configuration']['source']['field_yml_warn_msg'] = [
'#type' => 'item',
'#empty_value' => '',
'#title' => t('You have already entered YAML in Details. Change the source type to YAML and check it.'),
'#states' => [
'invisible' => [
[
[
'textarea[name="field_detail[0][value]"]' => [['value' => '']],
],
'or',
[
'select[name="field_source_type"]' => [
['value' => 'yml'],
'or',
['value' => '_none'],
],
],
],
],
],
];
$form['time_scheduler']['field_startup_time_hour']['widget']['#title_display'] = 'invisible';
$form['time_scheduler']['field_startup_time_minute']['widget']['#title_display'] = 'invisible';
$form['time_scheduler']['field_stop_time_hour']['widget']['#title_display'] = 'invisible';
......@@ -1492,18 +1515,6 @@ function k8s_form_cloud_launch_template_k8s_form_common_alter(array &$form, Form
],
];
$form['time_scheduler']['k8s_startup_time_title']['#states'] = [
'invisible' => [
':input[name="field_enable_time_scheduler[value]"]' => ['checked' => FALSE],
],
];
$form['time_scheduler']['k8s_stop_time_title']['#states'] = [
'invisible' => [
':input[name="field_enable_time_scheduler[value]"]' => ['checked' => FALSE],
],
];
$form['time_scheduler']['field_startup_time_hour']['#states'] = [
'invisible' => [
':input[name="field_enable_time_scheduler[value]"]' => ['checked' => FALSE],
......@@ -3318,7 +3329,10 @@ function k8s_preprocess_table__k8s_costs(&$variables): void {
function k8s_ajax_callback_get_access_token_url(array $form, FormStateInterface $form_state): AttachmentsInterface {
$response = new AjaxResponse();
$source_type = $form_state->getValue('field_source_type')[0]['value'];
$source_type = !empty($form_state->getValue('field_source_type'))
? $form_state->getValue('field_source_type')[0]['value']
: '_none';
if (!empty($source_type) && str_contains($source_type, 'git')) {
// Alter what is needed.
......
......@@ -20,8 +20,10 @@ class YamlObjectSupportConstraintValidator extends YamlArrayDataConstraintValida
try {
$yamls = $this->k8sService->decodeMultipleDocYaml($item->value);
foreach ($yamls ?: [] as $yaml) {
$kind = $yaml['kind'];
if (isset($kind)) {
if (is_array($yaml)
&& array_key_exists('kind', $yaml)
&& !empty($yaml['kind'])) {
$kind = $yaml['kind'];
$object = array_search($kind, $templates);
if ($object === FALSE) {
$this->context->addViolation($constraint->unsupportedObjectType);
......
......@@ -32,7 +32,9 @@ class BehatCommands extends DrushCommands {
}
/**
* Preprocess behat test feature files. The path should be relative to /cloud.
* Preprocess behat test feature files.
*
* The path should be relative to e.g. modules/contrib/cloud.
*
* @param array $options
* An associative array of options whose values come from cli, config, etc.
......
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