Commit 5bb5fcb9 by Daniel Barker

Pick Task Items mode from the task's category

GetTaskItem now returns t.TYPE and Task Items screen will now determine what mode to open in based upon that. Testing or Support open in Testing mode, all others including blank will open in Task mode. Testing mode checkbox is a temporary override. Updated SQL script.
parent 9cd9d1ea
...@@ -172,7 +172,6 @@ procedure TAuthService.Logout; ...@@ -172,7 +172,6 @@ procedure TAuthService.Logout;
begin begin
DeleteToken; DeleteToken;
DMConnection.currentTaskId := ''; DMConnection.currentTaskId := '';
DMConnection.taskItemsTestingMode := False;
DMConnection.timeEntriesWeekOf := ''; DMConnection.timeEntriesWeekOf := '';
DMConnection.timeEntriesStartDate := ''; DMConnection.timeEntriesStartDate := '';
DMConnection.timeEntriesEndDate := ''; DMConnection.timeEntriesEndDate := '';
......
...@@ -21,10 +21,6 @@ type ...@@ -21,10 +21,6 @@ type
public public
currentTaskId: string; currentTaskId: string;
// Task Items view: True = Testing Items mode (every column), False = Task Items mode
// (App, Version, Date and Testing Status hidden). Set by the screen's Testing Mode
// checkbox and kept until logout or refresh; a direct task_id link always opens in Testing mode.
taskItemsTestingMode: Boolean;
// Time Entries range saved when a row opens Task Items, restored by Back ('' = none) // Time Entries range saved when a row opens Task Items, restored by Back ('' = none)
timeEntriesWeekOf: string; timeEntriesWeekOf: string;
timeEntriesStartDate: string; timeEntriesStartDate: string;
......
...@@ -63,8 +63,8 @@ begin ...@@ -63,8 +63,8 @@ begin
end end
else else
begin begin
// A direct task_id link opens Task Items in Testing mode // Task Items sets the title from the task's category once the task loads
SetTaskItemsTitle(True); SetTaskItemsTitle(False);
ShowForm(TFTaskItems); ShowForm(TFTaskItems);
end; end;
end; end;
...@@ -83,15 +83,15 @@ begin ...@@ -83,15 +83,15 @@ begin
end; end;
// Opened from a Time Entries row; the URL is left as-is, so a refresh lands back on Time Entries. // Opened from a Time Entries row; the URL is left as-is, so a refresh lands back on Time Entries.
// Opens in the mode last picked with the screen's Testing Mode checkbox (Task Items at first). // Task Items sets the title from the task's category once the task loads.
procedure TFViewMain.ShowTaskItems(const ATaskId: string); procedure TFViewMain.ShowTaskItems(const ATaskId: string);
begin begin
DMConnection.currentTaskId := ATaskId; DMConnection.currentTaskId := ATaskId;
SetTaskItemsTitle(DMConnection.taskItemsTestingMode); SetTaskItemsTitle(False);
ShowForm(TFTaskItems); ShowForm(TFTaskItems);
end; end;
// Page title for the Task Items screen's mode; also called when its Testing Mode checkbox changes // Page title for the Task Items screen's mode; called when the task loads and when its Testing Mode checkbox changes
procedure TFViewMain.SetTaskItemsTitle(const ATestingMode: Boolean); procedure TFViewMain.SetTaskItemsTitle(const ATestingMode: Boolean);
begin begin
if ATestingMode then if ATestingMode then
......
...@@ -79,6 +79,10 @@ type ...@@ -79,6 +79,10 @@ type
FNameManager: TNameManager; FNameManager: TNameManager;
FCopyingRow: Boolean; FCopyingRow: Boolean;
FTaskMode: Boolean; FTaskMode: Boolean;
// The mode comes from the task's category on the first load only; later reloads
// (after add, move, delete) keep the current mode, so a checkbox override lasts
// until the screen is closed or refreshed
FModeSet: Boolean;
FUserId: string; FUserId: string;
// Selected filter values per column ('' list = no filter); FILTER_BLANK matches an empty value // Selected filter values per column ('' list = no filter); FILTER_BLANK matches an empty value
FAssignedFilter: TJSArray; FAssignedFilter: TJSArray;
...@@ -87,6 +91,7 @@ type ...@@ -87,6 +91,7 @@ type
[async] function CopyTaskRow: Boolean; [async] function CopyTaskRow: Boolean;
function FirstEditField: string; function FirstEditField: string;
procedure BindFilterControls; procedure BindFilterControls;
procedure SetTestingMode(const ATestingMode: Boolean);
procedure TestingItemsChanged(Event: TJSEvent); procedure TestingItemsChanged(Event: TJSEvent);
procedure FillFilterLists; procedure FillFilterLists;
procedure FilterCheckChange(Event: TJSEvent); procedure FilterCheckChange(Event: TJSEvent);
...@@ -181,15 +186,15 @@ begin ...@@ -181,15 +186,15 @@ begin
if FTaskId = '' then if FTaskId = '' then
FTaskId := DMConnection.currentTaskId; FTaskId := DMConnection.currentTaskId;
// From a Time Entries row: the mode last picked with the Testing Mode checkbox // Task mode until the task loads; LoadTasks then sets the mode from the task's
// (Task Items at first). A direct task_id link (emT3 desktop) opens in Testing mode. // category (tasks.TYPE), however the screen was opened
FTaskMode := (Application.Parameters.Values['task_id'] = '') and FTaskMode := True;
(not DMConnection.taskItemsTestingMode); FModeSet := False;
testingItems := TJSHTMLInputElement(document.getElementById('chk_testing_items')); testingItems := TJSHTMLInputElement(document.getElementById('chk_testing_items'));
if Assigned(testingItems) then if Assigned(testingItems) then
begin begin
testingItems.checked := not FTaskMode; testingItems.checked := False;
testingItems.addEventListener('change', TJSEventHandler(@TestingItemsChanged)); testingItems.addEventListener('change', TJSEventHandler(@TestingItemsChanged));
end; end;
...@@ -810,23 +815,32 @@ begin ...@@ -810,23 +815,32 @@ begin
end; end;
// Testing Mode checkbox: switches between Testing Items mode (every column) and // Sets Testing Items mode (every column) or Task Items mode (App, Version, Date and
// Task Items mode (App, Version, Date and Testing Status hidden). The rows are the // Testing Status hidden), with the checkbox and page title to match. Doesn't re-render.
// same in both, so this only re-renders; the choice is kept for the next time procedure TFTaskItems.SetTestingMode(const ATestingMode: Boolean);
// Task Items opens this session.
procedure TFTaskItems.TestingItemsChanged(Event: TJSEvent);
var var
testingMode: Boolean; testingItems: TJSHTMLInputElement;
begin begin
testingMode := TJSHTMLInputElement(Event.target).checked; FTaskMode := not ATestingMode;
FTaskMode := not testingMode;
DMConnection.taskItemsTestingMode := testingMode; testingItems := TJSHTMLInputElement(document.getElementById('chk_testing_items'));
if Assigned(testingItems) then
testingItems.checked := ATestingMode;
if Assigned(FViewMain) then if Assigned(FViewMain) then
FViewMain.SetTaskItemsTitle(testingMode); FViewMain.SetTaskItemsTitle(ATestingMode);
// Shows or hides the Testing Status filter; Task mode ignores any it has // Shows or hides the Testing Status filter; Task mode ignores any it has
FillFilterLists; FillFilterLists;
end;
// Testing Mode checkbox: a temporary override of the mode the task's category
// picked. The rows are the same in both, so this only re-renders. It lasts until
// the screen is closed or refreshed; the next open goes by the category again.
procedure TFTaskItems.TestingItemsChanged(Event: TJSEvent);
begin
SetTestingMode(TJSHTMLInputElement(Event.target).checked);
if xdwdsTasks.Active then if xdwdsTasks.Active then
begin begin
...@@ -1268,6 +1282,14 @@ begin ...@@ -1268,6 +1282,14 @@ begin
FStatusOptions := TJSArray(resultObj['statusOptions']); FStatusOptions := TJSArray(resultObj['statusOptions']);
FItemStatusOptions := TJSArray(resultObj['itemStatusOptions']); FItemStatusOptions := TJSArray(resultObj['itemStatusOptions']);
// Testing (TEST) and Support (SUPP) tasks open in Testing mode, any other
// category in Task mode (the server decides: task.testingMode)
if not FModeSet then
begin
FModeSet := True;
SetTestingMode(Assigned(taskObj) and (taskObj['testingMode'] = True));
end;
itemsArray := TJSArray(resultObj['items']); itemsArray := TJSArray(resultObj['items']);
if not Assigned(itemsArray) then if not Assigned(itemsArray) then
itemsArray := TJSArray.new; itemsArray := TJSArray.new;
......
...@@ -2682,8 +2682,8 @@ begin ...@@ -2682,8 +2682,8 @@ begin
Exit; Exit;
end; end;
// The mode isn't tied to the category: Task Items opens in the mode last picked // Task Items picks its mode from the task's own category (tasks.TYPE), not
// with its Testing Mode checkbox // from this time entry's category
taskId := ''; taskId := '';
GotoRowIndex(idx); GotoRowIndex(idx);
if not xdwdsTimeEntries.Eof then if not xdwdsTimeEntries.Eof then
......
...@@ -378,6 +378,7 @@ object ApiDatabase: TApiDatabase ...@@ -378,6 +378,7 @@ object ApiDatabase: TApiDatabase
' t.TASK_NUM_6,' ' t.TASK_NUM_6,'
' t.PROJECT_ID,' ' t.PROJECT_ID,'
' t.SUBJECT,' ' t.SUBJECT,'
' t.TYPE,'
' p.NAME as PROJECT_NAME' ' p.NAME as PROJECT_NAME'
'from tasks t' 'from tasks t'
'left join project p' 'left join project p'
...@@ -426,6 +427,10 @@ object ApiDatabase: TApiDatabase ...@@ -426,6 +427,10 @@ object ApiDatabase: TApiDatabase
FieldName = 'SUBJECT' FieldName = 'SUBJECT'
Size = 80 Size = 80
end end
object uqTaskHeaderTYPE: TStringField
FieldName = 'TYPE'
Size = 7
end
object uqTaskHeaderPROJECT_NAME: TStringField object uqTaskHeaderPROJECT_NAME: TStringField
FieldName = 'PROJECT_NAME' FieldName = 'PROJECT_NAME'
ReadOnly = True ReadOnly = True
......
...@@ -50,6 +50,7 @@ type ...@@ -50,6 +50,7 @@ type
uqTaskHeaderTASK_NUM_6: TIntegerField; uqTaskHeaderTASK_NUM_6: TIntegerField;
uqTaskHeaderPROJECT_ID: TStringField; uqTaskHeaderPROJECT_ID: TStringField;
uqTaskHeaderSUBJECT: TStringField; uqTaskHeaderSUBJECT: TStringField;
uqTaskHeaderTYPE: TStringField;
uqTaskHeaderPROJECT_NAME: TStringField; uqTaskHeaderPROJECT_NAME: TStringField;
uqTaskItemCodes: TUniQuery; uqTaskItemCodes: TUniQuery;
uqTaskItemCodesCODE: TStringField; uqTaskItemCodesCODE: TStringField;
......
...@@ -45,6 +45,10 @@ type ...@@ -45,6 +45,10 @@ type
projectName: string; projectName: string;
subject: string; subject: string;
title: string; title: string;
category: string; // tasks.TYPE (codes TASK / CATGRY)
// The task's own category is Testing (TEST) or Support (SUPP): Task Items opens
// in Testing mode; any other category, including blank, opens in Task mode
testingMode: Boolean;
end; end;
TTaskUserOption = class TTaskUserOption = class
......
...@@ -105,6 +105,12 @@ begin ...@@ -105,6 +105,12 @@ begin
taskHeader.subject taskHeader.subject
); );
// The task's own category decides the mode (a subtask doesn't inherit its parent's)
taskHeader.category := Trim(apiDB.uqTaskHeaderTYPE.AsString);
taskHeader.testingMode :=
SameText(taskHeader.category, 'TEST') or
SameText(taskHeader.category, 'SUPP');
Result.task := taskHeader; Result.task := taskHeader;
apiDB.uqProjectApplications.Close; apiDB.uqProjectApplications.Close;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
MemoLogLevel=5 MemoLogLevel=5
FileLogLevel=5 FileLogLevel=5
webClientVersion=0.9.5.0 webClientVersion=0.9.5.0
LogFileNum=270 LogFileNum=272
[Database] [Database]
--Server=192.168.102.131 --Server=192.168.102.131
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- To undo the status conversion, restore task_items from task_items_bak_20261126. -- To undo the status conversion, restore task_items from task_items_bak_20261126.
-- 1. Back up task_items before converting Testing Status values -- 1. Back up task_items before converting Testing Status values
CREATE TABLE IF NOT EXISTS task_items_bak_20261126 AS CREATE TABLE IF NOT EXISTS task_items_bak_20261127 AS
SELECT * FROM task_items; SELECT * FROM task_items;
-- 2. New columns -- 2. New columns
...@@ -18,10 +18,6 @@ ALTER TABLE task_items ...@@ -18,10 +18,6 @@ ALTER TABLE task_items
ALTER TABLE users ALTER TABLE users
ADD COLUMN IF NOT EXISTS HIDE_TIME_ENTRIES_FIELDS varchar(1) DEFAULT 'F' AFTER AUTO_LAUNCH_TASK_TRACKER; ADD COLUMN IF NOT EXISTS HIDE_TIME_ENTRIES_FIELDS varchar(1) DEFAULT 'F' AFTER AUTO_LAUNCH_TASK_TRACKER;
-- Time Entry Details offcanvas
ALTER TABLE time_items
ADD COLUMN IF NOT EXISTS DETAILS text DEFAULT NULL AFTER SUMMARY;
-- 3. Testing Status codes (codes TASK / STATUS2) -- 3. Testing Status codes (codes TASK / STATUS2)
INSERT IGNORE INTO codes (CATEGORY, CODE_TYPE, CODE, CODE_DESC, CREATE_DATE) VALUES INSERT IGNORE INTO codes (CATEGORY, CODE_TYPE, CODE, CODE_DESC, CREATE_DATE) VALUES
('TASK', 'STATUS2', 'CD', 'Cannot Duplicate', NOW()), ('TASK', 'STATUS2', 'CD', 'Cannot Duplicate', NOW()),
...@@ -34,6 +30,13 @@ INSERT IGNORE INTO codes (CATEGORY, CODE_TYPE, CODE, CODE_DESC, CREATE_DATE) VAL ...@@ -34,6 +30,13 @@ INSERT IGNORE INTO codes (CATEGORY, CODE_TYPE, CODE, CODE_DESC, CREATE_DATE) VAL
('TASK', 'STATUS2', 'NI', 'Non-Issue', NOW()), ('TASK', 'STATUS2', 'NI', 'Non-Issue', NOW()),
('TASK', 'STATUS2', 'PP', 'Possibly a Problem', NOW()); ('TASK', 'STATUS2', 'PP', 'Possibly a Problem', NOW());
-- 3b. Testing task category (codes TASK / CATGRY, stored in tasks.TYPE)
-- Tasks whose own category is Testing (TEST) or Support (SUPP) open Task Items in
-- Testing mode; every other category, including blank, opens in Task mode.
-- CATGRY is also the Time Entries Category list, so Testing shows there too.
INSERT IGNORE INTO codes (CATEGORY, CODE_TYPE, CODE, CODE_DESC, CREATE_DATE)
VALUES ('TASK', 'CATGRY', 'TEST', 'Testing', NOW());
-- 4. Convert existing Testing Status descriptions to their codes -- 4. Convert existing Testing Status descriptions to their codes
-- Only rows whose STATUS matches a STATUS2 description change. The filter is in -- Only rows whose STATUS matches a STATUS2 description change. The filter is in
-- WHERE (not just the JOIN) so HeidiSQL doesn't flag it as an unsafe UPDATE. -- WHERE (not just the JOIN) so HeidiSQL doesn't flag it as an unsafe UPDATE.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment