Skip to content

Commit

Permalink
Improve a bit on UX when moving task and task groups around.
Browse files Browse the repository at this point in the history
  • Loading branch information
hptruong93 committed Jul 29, 2018
1 parent 79ef455 commit cb24f25
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/frontEnd/MainBackEndHolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -450,17 +450,16 @@ public void removeTaskGroup(int index) {
}

public void moveTaskGroupUp(int index) {
if (index < 0 || index >= taskGroups.size()) {
if (index < 1) {
return;
}
Collections.swap(taskGroups, index, index - 1);
}

public void moveTaskGroupDown(int index) {
if (index < 0 || index >= taskGroups.size()) {
return;
if (index >= 0 && index < taskGroups.size() - 1) {
Collections.swap(taskGroups, index, index + 1);
}
Collections.swap(taskGroups, index, index + 1);
}

/*************************************************************************************************************/
Expand Down
7 changes: 7 additions & 0 deletions src/staticResources/webui/static/js/repeat/table-tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ function refreshTasksWithDataAndIndex(data, index) {

function setSelectedTask(index) {
var rows = $('#table-tasks').find("tr").not(":first");
if (index < 0) {
index = 0;
}
if (index >= rows.length) {
index = rows.length - 1;
}

rows.each(function(i) {
if (i == index) {
rows.removeClass('table-highlight');
Expand Down
7 changes: 7 additions & 0 deletions src/staticResources/webui/static/js/repeat/task-groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ function refreshTaskGroupsWithDataAndIndex(data, index) {

function setSelectedTaskGroup(index) {
var rows = $('#table-task-groups').find("tr").not(":first");
if (index < 0) {
index = 0;
}
if (index >= rows.length) {
index = rows.length - 1;
}

rows.each(function(i) {
if (i == index) {
rows.removeClass('table-highlight');
Expand Down

0 comments on commit cb24f25

Please sign in to comment.