I have created a merge request https://git.drupalcode.org/project/burndown/-/merge_requests/22
purencool → created an issue.
Hmmm this is confusing there seems to be a typo .
https://git.drupalcode.org/project/burndown/-/blob/99a0b75a692e5eb94cff7...
from_ticket_id: from_ticket_id,
to_ticket_id: to_ticket_id,
type: $('.add_relationship .add_relationship_selec').val() <-------- missing the "t" on the word select.
But on my local the commit looks correct. (git diff 2bc0f8256b3970baccdd76d83b78601b49fe88d9)
@ js/burndown.task_edit.js:176 @
data: {
from_ticket_id: from_ticket_id,
to_ticket_id: to_ticket_id,
type: $('.add_relationship .form-item-relationship-type select').val()
type: $('.add_relationship .add_relationship_select').val() <------ Doesn't seem to be missing the "t"
},
success: function (result) {
// On success, reload work and clear the form.
update_relationships('work');
$('.add_relationship .form-item-to-task input').val('');
$('.add_relationship .add_relationship_entity').val('');
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log("Could not post relationship.");
purencool → created an issue. See original summary → .
purencool → created an issue.
I think they have been created correctly. If I need to do something let me know.
https://git.drupalcode.org/project/burndown/-/merge_requests
I maybe missing something. Please let me know if you need me to do something else.
https://git.drupalcode.org/project/burndown/-/merge_requests
Could this be used in the code instead. As I am not sure how this can be fixed.
https://github.com/SortableJS/Sortable/pull/2245/commits/ee3cecef0346ea0...
getFallbackParent: null, // Getter function that returns the parent for the cloned DOM Element
@jeremylichtman do you what merge it into 1.0.x?
purencool → changed the visibility of the branch 3495934-cant-add-new-relationships-on-task-update to active.
@jeremylichtman you were correct. I have add classes to the PHP form and JS. However, I needed change % to @ as it was breaking the html when rendering as seen below.
$form['relationships']['add_new']['link'] = [
'#markup' => $this->t('<a href="#" class="button add_relationship" data-ticket-id="@id"> Add Relationship</a>', [
'@id' =>$task->getTicketId()
]),
The result below is using the GIN theme the form alignment issue not being caused by the module's CSS.
purencool → changed the visibility of the branch 3495934-cant-add-new-relationships-on-task-update to hidden.
purencool → created an issue.
purencool → changed the visibility of the branch 3494677-error-shows-in to active.
purencool → changed the visibility of the branch 3494677-error-shows-in to active.
purencool → changed the visibility of the branch 3494677-error-shows-in to hidden.
I will create some code and do some testing. Inline with comment #3
Would a redirect back to the project listing page, accompanied by a Drupal message, be an option? That would prevent users from altering the URL and creating the same result.
purencool → created an issue.
Interesting the class has the following logic.
class TaskWorkEvent extends Event {
const WORKED = 'burndown_event_task_work';
/**
* The task.
*
* @var Drupal\Core\Entity\EntityInterface
*/
public $task;
/**
* The comment.
*
* @var string
*/
public $comment;
/**
* The amount of work done.
*
* @var string
*/
public $workDone;
/**
* The user who did the work.
*
* @var int
*/
public $uid;
/**
* Constructs the object.
*
* @param Drupal\Core\Entity\EntityInterface $task
* The newly created task.
* @param string $comment
* The comment.
* @param string $workDone
* The mount of work done.
* @param int $uid
* The id of the user who did the work.
*
* @todo Provide more detailed/explanatory comments on parameters.
*/
public function __construct(EntityInterface $task, $comment, $workDone, $uid) {
// $created, $uid,
$this->task = $task;
$this->comment = $comment;
$this->workDone = $workDone;
$this->uid = $uid;
}
}
This worked.
// Instantiate our event.
$event = new TaskWorkEvent($task, $filtered_comment, $work_done, $uid);
// Dispatch the event.
$this->eventDispatcher->dispatch( $event,TaskWorkEvent::WORKED);
Changed the code to the following
// Instantiate our event.
$event = new TaskWorkEvent($task, $filtered_comment, $work_done, $uid);
// Dispatch the event.
$this->eventDispatcher->dispatch(TaskWorkEvent::WORKED, $event);
Got the following error
TypeError: Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::dispatch(): Argument #1 ($event) must be of type object, string given, called in /var/www/html/web/modules/contrib/burndown/src/Controller/TaskController.php on line 233 in Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (line 89 of /var/www/html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php).
So what change do you make so I can retest the issue?
Tested this is now working
Hey the following need be removed or commented out as it's throwing a 500. What is they do?
// Instantiate our event.
// $event = new TaskWorkEvent($task, $filtered_comment, $work_done, $uid);
// Dispatch the event.
//static::getContainer()->eventDispatcher->dispatch(TaskWorkEvent::WORKED, $event);
lol
purencool → created an issue.
purencool → created an issue.
purencool → created an issue.
purencool → created an issue.
Thank you for the credits. I am just happy to help. It makes Drupal more extensible for everyone.
purencool → created an issue.
Also this method I modified.
/**
* Check if this task is on the completed board.
*/
public function onCompletedBoard() {
$swimlane = $this->getSwimlane();
$project = $this->getProject();
$shortcode = $project->getShortcode();
$completed_lanes = Swimlane::getCompletedSwimlanes($shortcode);
if ($completed_lanes !== FALSE) {
foreach ($completed_lanes as $lane) {
if ($lane->id() == $swimlane->id()) { <---- I change this as well.
return TRUE;
}
}
}
return FALSE;
}
I changed and tested this locally as well.
/**
* Check if task is completed.
*/
public function isCompleted() {
// If the task is flagged as done, then just return TRUE.
$completed = $this->getCompleted();
if ($completed === TRUE) {
return TRUE;
}
// Check if in the final "done" lane of the board.
$project = $this->getProject();
$shortcode = $project->getShortcode();
$swimlane = $this->getSwimlane();
$done = Swimlane::getDoneSwimlane($shortcode);
if ($done !== FALSE) { <------ I added this if statement
if ($swimlane->id() == $done->id()) { <------ I changed this as well
return TRUE;
}
}
// The task is not yet completed.
return FALSE;
}
purencool → created an issue.
It wasn't really working before, but your changes sped it up. However, I managed to break it again. But I may have a solution. What do you think?
public function onBoard() {
$swimlane = $this->getSwimlane();
$project = $this->getProject();
$shortcode = $project->getShortcode();
$board_lanes = Swimlane::getBoardSwimlanes($shortcode);
if ($board_lanes !== FALSE) {
foreach ($board_lanes as $lane) {
if ($lane->id() == $swimlane->id()) { <---- I changed this line.
return TRUE;
}
}
}
return FALSE;
}
Okay I will look at the commit and see if I can break it =).
Hi @jeremylichtman
I have a one gig (1024M) allocation using DDEV.
As a thought, what field in the swimlane entity does the application need to work? Maybe calling it directly could reduce the memory overhead. Let me know, and I will do some testing for you.
purencool → created an issue.
purencool → created an issue.
Before upgrading, I tried adding an extra code to your commit locally. It was in the hope it would give form elements to give greater flexibility and less fragility when working with JQuery, It appears that the Drupal API needs an array and not a string in this case. Let me know what you think.
$form['log']['comment'] = [
'#type' => 'container',
'#title' => $this->t('Add a comment'),
'#attributes' => [
'class' => ['add_comment'], <---- Turned your strings into arrays
],
];
$form['log']['comment']['body'] = [
'#type' => 'textarea',
'#attributes' => [
'class' => ['add_comment_text'],
],
];
$form['log']['comment']['link'] = [
'#markup' => $this->t('<a href="#" class="button">%label</a>', [
'%label' => 'Add Comment',
]),
];
// Work log form.
$form['log']['work'] = [
'#type' => 'container',
'#title' => $this->t('Add a work log'),
'#attributes' => [
'class' => ['add_work'],
],
];
$form['log']['work']['body'] = [
'#type' => 'textarea',
'#title' => $this->t('Comment'),
'#attributes' => [
'class' => ['add_work_text'],
],
];
purencool → created an issue.
It seems to be a html class issue. Claro is rendering the html class .form-item--body, while jQuery is looking for a .form-item-body class.
Code that fails.
$.ajax({
url: "/burndown/api/task/add_comment",
method :'POST',
data: {
ticket_id: $('#burndown_task_log').data('ticket-id'),
comment: $('.add_comment .form-item-body textarea').val()
},
Code that works.
// Post data.
$.ajax({
url: "/burndown/api/task/add_comment",
method :'POST',
data: {
ticket_id: $('#burndown_task_log').data('ticket-id'),
comment: $('.add_comment .form-item--body textarea').val()
},
Possible solution could be.
data: {
ticket_id: $('#burndown_task_log').data('ticket-id'),
comment: $('.add_comment textarea').val()
},
purencool → created an issue.
Thanks @jeremylichtman,
I will look into your frontend suggestion to see if what is causing the problem.
purencool → created an issue.
I came across the same issue on a new build and narrowed it down to the configuration file burndown.field_type_categories.yml. Once this file was deleted from the burndown module configuration and the module was reinstalled, the burndown UI allowed me to start adding fields. Is there any reason the burndown.field_type_categories.yml configuration needs to be added during the original installation? However once installed, and under certain conditions, it breaks a developer's ability to add fields to any configuration entities through the Drupal UI.
I have attached the following to help replicate.
- Images showing examples of the features UI.
- My ability to add fields after removing the burndown.field_type_categories.yml and reinstalling the module.
- Drush pml showing what was installed on my local environment.
- Configuration after exporting the feature.
Hope this helps =)
gargsuchi → credited purencool → .
gargsuchi → credited purencool → .
griffynh → credited Purencool → .
gargsuchi → credited Purencool → .
Purencool → created an issue.
Purencool → created an issue.
Purencool → created an issue.
Purencool → created an issue.