* [perf story #69666] Check parent name is not empty when has child task.

This commit is contained in:
wangyidong
2024-11-26 10:32:24 +08:00
committed by 孙广明
parent 40e49f228d
commit 53ce5964a0
7 changed files with 33 additions and 13 deletions
+9 -12
View File
@@ -204,24 +204,21 @@ window.handleClickBatchFormAction = function(action, $row, rowIndex)
if(action !== 'addSub' && action !== 'addSibling') return;
if(!this.nestedLevelMap) this.nestedLevelMap = {};
const level = this.nestedLevelMap[$row.attr('data-gid')] || 0;
const level = this.nestedLevelMap[$row.attr('data-gid')] || 0;
const nextGid = this._idSeed++;
this.nestedLevelMap[nextGid] = action === 'addSub' ? level + 1 : level;
if(action == 'addSibling')
const nextLevel = level + 1;
while(true)
{
$rawRow = $row;
while(true)
$nextRow = $row.next();
if($nextRow.length == 0 || $nextRow.attr('data-level') < nextLevel)
{
$nextRow = $row.next();
if($nextRow.length == 0 || $nextRow.attr('data-level') <= level)
{
rowIndex = $nextRow.length == 0 ? $row.index() : $nextRow.index() - 1;
break;
}
$row = $nextRow;
rowIndex = $nextRow.length == 0 ? $row.index() : $nextRow.index() - 1;
break;
}
$row = $nextRow;
}
this.addRow(rowIndex, nextGid);
};
+3
View File
@@ -74,6 +74,8 @@ $lang->task->codeRepo = 'Code Library';
$lang->task->relatedBranch = 'Related Branch';
$lang->task->keywords = 'Tags';
$lang->task->syncStory = 'Sync to task';
$lang->task->addSibling = 'Add Sibling';
$lang->task->addSub = 'Add Child';
$lang->task->common = 'Aufgabe';
$lang->task->id = 'ID';
@@ -334,6 +336,7 @@ $lang->task->error->endGtExecution = "The 'Deadline' of the task must be less
$lang->task->error->endLtExecution = "The 'Deadline' of the task must be greater than or equal the 'Planned Begin' of %s to %s.";
$lang->task->error->dateExceed = "Because the scheduled date of task %s exceeds the scheduled date of {$lang->execution->common}, it is automatically changed to the scheduled date of {$lang->execution->common}";
$lang->task->error->length = "Length exceeds the limit of %d characters, cannot be saved. Please modify it again.";
$lang->task->error->emptyParentName = "Contains subtasks, task names cannot be empty.";
/* Report. */
$lang->task->report = new stdclass();
+3
View File
@@ -74,6 +74,8 @@ $lang->task->codeRepo = 'Code Library';
$lang->task->relatedBranch = 'Related Branch';
$lang->task->keywords = 'Tags';
$lang->task->syncStory = 'Sync to task';
$lang->task->addSibling = 'Add Sibling';
$lang->task->addSub = 'Add Child';
$lang->task->common = 'Task';
$lang->task->id = 'ID';
@@ -334,6 +336,7 @@ $lang->task->error->endGtExecution = "The 'Deadline' of the task must be less
$lang->task->error->endLtExecution = "The 'Deadline' of the task must be greater than or equal the 'Planned Begin' of %s to %s.";
$lang->task->error->dateExceed = "Because the scheduled date of task %s exceeds the scheduled date of {$lang->execution->common}, it is automatically changed to the scheduled date of {$lang->execution->common}";
$lang->task->error->length = "Length exceeds the limit of %d characters, cannot be saved. Please modify it again.";
$lang->task->error->emptyParentName = "Contains subtasks, task names cannot be empty.";
/* Report. */
$lang->task->report = new stdclass();
+3
View File
@@ -74,6 +74,8 @@ $lang->task->codeRepo = 'Code Library';
$lang->task->relatedBranch = 'Related Branch';
$lang->task->keywords = 'Tags';
$lang->task->syncStory = 'Sync to task';
$lang->task->addSibling = 'Add Sibling';
$lang->task->addSub = 'Add Child';
$lang->task->common = 'Tâche';
$lang->task->id = 'ID';
@@ -334,6 +336,7 @@ $lang->task->error->endGtExecution = "The 'Deadline' of the task must be less
$lang->task->error->endLtExecution = "The 'Deadline' of the task must be greater than or equal the 'Planned Begin' of %s to %s.";
$lang->task->error->dateExceed = "Because the scheduled date of task %s exceeds the scheduled date of {$lang->execution->common}, it is automatically changed to the scheduled date of {$lang->execution->common}";
$lang->task->error->length = "Length exceeds the limit of %d characters, cannot be saved. Please modify it again.";
$lang->task->error->emptyParentName = "Contains subtasks, task names cannot be empty.";
/* Report. */
$lang->task->report = new stdclass();
+3
View File
@@ -74,6 +74,8 @@ $lang->task->codeRepo = '仓库名称';
$lang->task->relatedBranch = '相关分支';
$lang->task->keywords = '关键词';
$lang->task->syncStory = '同步至任务';
$lang->task->addSibling = '添加同级';
$lang->task->addSub = '添加子级';
$lang->task->common = '任务';
$lang->task->id = '编号';
@@ -334,6 +336,7 @@ $lang->task->error->endGtExecution = "任务截止日期应小于等于%s的
$lang->task->error->endLtExecution = "任务截止日期应大于等于%s的预计开始日期:%s。";
$lang->task->error->dateExceed = "任务%s的计划日期超过该{$lang->execution->common}计划日期,将自动改为{$lang->execution->common}的计划日期。";
$lang->task->error->length = "长度超过了%d个字符,无法保存,请修改后再试";
$lang->task->error->emptyParentName = "包含子任务,任务名称不能为空。";
/* Report. */
$lang->task->report = new stdclass();
+1 -1
View File
@@ -145,7 +145,7 @@ if($execution->type == 'kanban')
$batchFormOptions = array();
$batchFormOptions['fixedActions'] = true; // 滚动时固定操作列。
$batchFormOptions['actions'] = array(array('type' => 'addSibling', 'icon' => 'icon-plus', 'text' => '添加同级'), array('type' => 'addSub', 'icon' => 'icon-split', 'text' => '添加子级'), 'delete'); // 定义操作列按钮,在此处添加一个添加子级按钮。
$batchFormOptions['actions'] = array(array('type' => 'addSibling', 'icon' => 'icon-plus', 'text' => $lang->task->addSibling), array('type' => 'addSub', 'icon' => 'icon-split', 'text' => $lang->task->addSub), 'delete');
$batchFormOptions['onClickAction'] = jsRaw('window.handleClickBatchFormAction'); // 定义操作列按钮点击事件处理函数。
$batchFormOptions['onRenderRow'] = jsRaw('window.handleRenderRow'); // 定义行渲染事件处理函数。
+11
View File
@@ -589,6 +589,17 @@ class taskZen extends task
{
$this->loadModel('story');
/* Check parent name is not empty when has child task. */
$levelNames = array();
foreach($this->post->level as $i => $level)
{
$level = (int)$level;
$levelNames[$level]['name'] = trim($this->post->name[$i]);
$levelNames[$level]['index'] = $i;
if($level > 0 && empty($levelNames[$level - 1]['name'])) dao::$errors["name[" . $levelNames[$level - 1]['index'] . "]"] = $this->lang->task->error->emptyParentName;
}
if(dao::isError()) return false;
$tasks = form::batchData()->get();
foreach($tasks as $task)
{