Skip to content
This repository has been archived by the owner on Apr 8, 2022. It is now read-only.

Issue #3040173: Checklist success description is not used correctly #16

Merged
merged 1 commit into from
Jul 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
options:
update-version: 'Update version for checklist collection'
update-description: 'Detailed update description for checklist entry'
success-message: 'Success message for checklist entry'
failure-message: 'Failure message for checklist entry'
questions:
update-version: 'Please enter a update version for checklist collection'
update-description: 'Please enter a detailed update description that will be used for checklist'
success-message: 'Please enter a message that will be displayed in checklist entry when the update is successful'
failure-message: 'Please enter a message that will be displayed in checklist entry when the update has failed'
defaults:
update-description: 'This configuration update will update site configuration to newly provided configuration'
success-message: 'Configuration is successfully updated.'
failure-message: 'Update of configuration has failed.'
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ class CommandGcuSubscriber implements EventSubscriberInterface {
*/
protected static $updateVersionName = 'update-version';

/**
* Key for update description.
*
* @var string
*/
protected static $updateDescription = 'update-description';

/**
* Key for success message command option.
*
Expand Down Expand Up @@ -112,6 +119,14 @@ public function onConfigure(CommandConfigureEvent $configure_event) {
''
);

$configure_event->addOption(
static::$updateDescription,
NULL,
InputOption::VALUE_REQUIRED,
$configure_event->getCommand()
->trans('commands.generate.configuration.update.checklist.options.update-description')
);

$configure_event->addOption(
static::$successMessageName,
NULL,
Expand Down Expand Up @@ -143,6 +158,7 @@ public function onInteract(CommandInteractEvent $interact_event) {
$output = $interact_event->getOutput();

$update_version = $input->getOption(static::$updateVersionName);
$update_description = $input->getOption(static::$updateDescription);
$success_message = $input->getOption(static::$successMessageName);
$failure_message = $input->getOption(static::$failureMessageName);

Expand All @@ -159,6 +175,15 @@ public function onInteract(CommandInteractEvent $interact_event) {
$input->setOption(static::$updateVersionName, $update_version);
}

// Get update description for checklist.
if (!$update_description) {
$update_description = $output->ask(
$command->trans('commands.generate.configuration.update.checklist.questions.update-description'),
$command->trans('commands.generate.configuration.update.checklist.defaults.update-description')
);
$input->setOption(static::$updateDescription, $update_description);
}

// Get success message for checklist.
if (!$success_message) {
$success_message = $output->ask(
Expand Down Expand Up @@ -199,6 +224,7 @@ public function onExecute(CommandExecuteEvent $execute_event) {
$execute_event->getUpdateNumber(),
$options[static::$updateVersionName],
$options['description'],
$options[static::$updateDescription],
$options[static::$successMessageName],
$options[static::$failureMessageName]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ protected function getUpdateFunctionName($module_name, $update_number) {
* Update version for module.
* @param string $description
* Checklist entry title.
* @param string $update_description
* Checklist update description.
* @param string $success_message
* Checklist success message.
* @param string $failure_message
* Checklist failed message.
*/
public function generate($module, $update_number, $update_version, $description, $success_message, $failure_message) {
public function generate($module, $update_number, $update_version, $description, $update_description, $success_message, $failure_message) {
$module_path = $this->moduleHandler->getModule($module)->getPath();
$checklist_file = $module_path . DIRECTORY_SEPARATOR . UpdateChecklist::$updateChecklistFileName;
$update_versions = $this->updateChecklist->getUpdateVersions($module);
Expand All @@ -82,6 +84,7 @@ public function generate($module, $update_number, $update_version, $description,
'update_hook_name' => $module . '_update_' . $update_number,
'file_exists' => file_exists($checklist_file),
'checklist_title' => $description,
'checklist_description' => $update_description,
'checklist_success' => $success_message,
'checklist_failed' => $failure_message,
'update_version' => ($update_version === $last_update_version) ? '' : $update_version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{% endif %}
{{ update_hook_name }}:
'#title': '{{ checklist_title }}'
'#description': '<p>{{ checklist_success }}</p>'
'#description': '<p>{{ checklist_description }}</p>'
'#description_successful': '<p>{{ checklist_success }}</p>'
'#description_failed': '<p><strong>{{ checklist_failed }}</strong><p>'
{% endblock %}