Commit 9cdecee0 by Mac Stephens

Refactor emT3 startup/config flow, compare server and client revisions, fix…

Refactor emT3 startup/config flow, compare server and client revisions, fix Common.Ini, cleanup and add-row append behavior, and centralize client modal handling
parent 7a4d7d63
...@@ -104,8 +104,8 @@ object fMain: TfMain ...@@ -104,8 +104,8 @@ object fMain: TfMain
'MySQL.HttpAuthenticationType=atBasic' 'MySQL.HttpAuthenticationType=atBasic'
'MySQL.HttpTrustServerCertificate=False' 'MySQL.HttpTrustServerCertificate=False'
'MySQL.ProxyPort=0') 'MySQL.ProxyPort=0')
Username = 'etask' Username = 'root'
Server = '192.168.116.131' Server = '192.168.102.131'
LoginPrompt = False LoginPrompt = False
Left = 390 Left = 390
Top = 342 Top = 342
......
...@@ -111,7 +111,7 @@ procedure TAuthService.Login(AUser, APassword, AClientVersion: string; ASuccess: ...@@ -111,7 +111,7 @@ procedure TAuthService.Login(AUser, APassword, AClientVersion: string; ASuccess:
begin begin
if (AUser = '') or (APassword = '') then if (AUser = '') or (APassword = '') then
begin begin
AError('Please enter a username and a password'); AError('Invalid or expired code, please try again.');
Exit; Exit;
end; end;
......
...@@ -20,7 +20,7 @@ type ...@@ -20,7 +20,7 @@ type
FUnauthorizedAccessProc: TUnauthorizedAccessProc; FUnauthorizedAccessProc: TUnauthorizedAccessProc;
public public
const clientVersion = '0.8.3'; const clientVersion = '0.8.5';
procedure InitApp(SuccessProc: TSuccessProc; procedure InitApp(SuccessProc: TSuccessProc;
UnauthorizedAccessProc: TUnauthorizedAccessProc); UnauthorizedAccessProc: TUnauthorizedAccessProc);
procedure SetClientConfig(Callback: TVersionCheckCallback); procedure SetClientConfig(Callback: TVersionCheckCallback);
......
...@@ -13,6 +13,7 @@ procedure ShowErrorModal(msg: string); ...@@ -13,6 +13,7 @@ procedure ShowErrorModal(msg: string);
procedure ShowToast(const MessageText: string; const ToastType: string = 'success'); procedure ShowToast(const MessageText: string; const ToastType: string = 'success');
procedure ShowConfirmationModal(msg, leftLabel, rightLabel: string; ConfirmProc: TProc<Boolean>); procedure ShowConfirmationModal(msg, leftLabel, rightLabel: string; ConfirmProc: TProc<Boolean>);
procedure ShowNotificationModal(msg: string); procedure ShowNotificationModal(msg: string);
procedure ShowAppDialog(const Msg: string; const Title: string = 'emT3 web app'; ReloadOnClose: Boolean = False; ButtonText: string = 'Close');
implementation implementation
...@@ -185,6 +186,37 @@ begin ...@@ -185,6 +186,37 @@ begin
end; end;
procedure ShowAppDialog(const Msg: string; const Title: string = 'emT3 web app'; ReloadOnClose: Boolean = False; ButtonText: string = 'Close');
begin
asm
var dlg = document.createElement("dialog");
dlg.classList.add("shadow", "rounded", "border", "p-4");
dlg.style.maxWidth = "500px";
dlg.style.width = "90%";
dlg.style.fontFamily = "system-ui, sans-serif";
dlg.innerHTML =
"<h5 class='fw-bold mb-3 text-danger'>" + Title + "</h5>" +
"<p class='mb-3' style='white-space: pre-wrap;'>" + Msg + "</p>" +
"<div class='text-end'>" +
"<button id='appDialogBtn' class='btn btn-primary'>" + ButtonText + "</button>" +
"</div>";
document.body.appendChild(dlg);
dlg.showModal();
document.getElementById("appDialogBtn").addEventListener("click", function () {
if (ReloadOnClose) {
location.reload();
} else {
dlg.close();
dlg.remove();
}
});
end;
end;
procedure ShowToast(const MessageText: string; const ToastType: string = 'success'); procedure ShowToast(const MessageText: string; const ToastType: string = 'success');
var var
ParsedText, ToastKind, MsgPrefix: string; ParsedText, ToastKind, MsgPrefix: string;
......
...@@ -35,8 +35,7 @@ implementation ...@@ -35,8 +35,7 @@ implementation
uses uses
Auth.Service, Auth.Service,
View.Test, View.TaskItems;
View.TasksHTML;
{$R *.dfm} {$R *.dfm}
...@@ -48,7 +47,7 @@ begin ...@@ -48,7 +47,7 @@ begin
lblUsername.Caption := userName; lblUsername.Caption := userName;
lblVersion.Caption := 'v' + DMConnection.clientVersion; lblVersion.Caption := 'v' + DMConnection.clientVersion;
ShowForm(TFTasksHTML); ShowForm(TFTaskItems);
end; end;
procedure TFViewMain.lblLogoutClick(Sender: TObject); procedure TFViewMain.lblLogoutClick(Sender: TObject);
......
object FTasksHTML: TFTasksHTML object FTaskItems: TFTaskItems
Width = 640 Width = 640
Height = 480 Height = 480
CSSLibrary = cssBootstrap CSSLibrary = cssBootstrap
......
unit View.TasksHTML; unit View.TaskItems;
interface interface
...@@ -11,7 +11,7 @@ uses ...@@ -11,7 +11,7 @@ uses
WEBLib.StdCtrls; WEBLib.StdCtrls;
type type
TFTasksHTML = class(TWebForm) TFTaskItems = class(TWebForm)
xdwcTasks: TXDataWebClient; xdwcTasks: TXDataWebClient;
xdwdsTasks: TXDataWebDataSet; xdwdsTasks: TXDataWebDataSet;
xdwdsTaskstaskId: TStringField; xdwdsTaskstaskId: TStringField;
...@@ -82,7 +82,7 @@ type ...@@ -82,7 +82,7 @@ type
end; end;
var var
FTasksHTML: TFTasksHTML; FTaskItems: TFTaskItems;
implementation implementation
...@@ -91,9 +91,9 @@ uses ...@@ -91,9 +91,9 @@ uses
{$R *.dfm} {$R *.dfm}
procedure TFTasksHTML.WebFormCreate(Sender: TObject); procedure TFTaskItems.WebFormCreate(Sender: TObject);
begin begin
console.log('TFTasksHTML.WebFormCreate fired'); console.log('TFTaskItems.WebFormCreate fired');
FTaskId := Application.Parameters.Values['task_id']; FTaskId := Application.Parameters.Values['task_id'];
FReportedByOptions := TJSArray.new; FReportedByOptions := TJSArray.new;
FAssignedToOptions := TJSArray.new; FAssignedToOptions := TJSArray.new;
...@@ -141,7 +141,7 @@ begin ...@@ -141,7 +141,7 @@ begin
end; end;
function TFTasksHTML.HtmlEncode(const s: string): string; function TFTaskItems.HtmlEncode(const s: string): string;
begin begin
Result := s; Result := s;
Result := StringReplace(Result, '&', '&amp;', [rfReplaceAll]); Result := StringReplace(Result, '&', '&amp;', [rfReplaceAll]);
...@@ -152,7 +152,7 @@ begin ...@@ -152,7 +152,7 @@ begin
end; end;
procedure TFTasksHTML.GotoRowIndex(AIndex: Integer); procedure TFTaskItems.GotoRowIndex(AIndex: Integer);
var var
i: Integer; i: Integer;
begin begin
...@@ -169,7 +169,7 @@ begin ...@@ -169,7 +169,7 @@ begin
end; end;
procedure TFTasksHTML.EditorInput(Event: TJSEvent); procedure TFTaskItems.EditorInput(Event: TJSEvent);
var var
el: TJSHTMLElement; el: TJSHTMLElement;
idx: Integer; idx: Integer;
...@@ -206,7 +206,7 @@ begin ...@@ -206,7 +206,7 @@ begin
end; end;
procedure TFTasksHTML.SelectChange(Event: TJSEvent); procedure TFTaskItems.SelectChange(Event: TJSEvent);
var var
el: TJSHTMLElement; el: TJSHTMLElement;
idx: Integer; idx: Integer;
...@@ -241,7 +241,7 @@ begin ...@@ -241,7 +241,7 @@ begin
end; end;
procedure TFTasksHTML.BindTableEditors; procedure TFTaskItems.BindTableEditors;
var var
nodes: TJSNodeList; nodes: TJSNodeList;
i: Integer; i: Integer;
...@@ -292,7 +292,7 @@ begin ...@@ -292,7 +292,7 @@ begin
end; end;
procedure TFTasksHTML.EditorKeyDown(Event: TJSEvent); procedure TFTaskItems.EditorKeyDown(Event: TJSEvent);
var var
el: TJSHTMLElement; el: TJSHTMLElement;
fieldName: string; fieldName: string;
...@@ -322,7 +322,7 @@ begin ...@@ -322,7 +322,7 @@ begin
end; end;
[async] procedure TFTasksHTML.btnAddRowClick(Sender: TObject); [async] procedure TFTaskItems.btnAddRowClick(Sender: TObject);
begin begin
Utils.ShowSpinner('spinner'); Utils.ShowSpinner('spinner');
try try
...@@ -336,7 +336,7 @@ begin ...@@ -336,7 +336,7 @@ begin
end; end;
end; end;
[async] procedure TFTasksHTML.btnDeleteRowClick(Sender: TObject); [async] procedure TFTaskItems.btnDeleteRowClick(Sender: TObject);
var var
deletedItemNum: Integer; deletedItemNum: Integer;
begin begin
...@@ -378,7 +378,7 @@ begin ...@@ -378,7 +378,7 @@ begin
end; end;
end; end;
procedure TFTasksHTML.RowClick(Event: TJSEvent); procedure TFTaskItems.RowClick(Event: TJSEvent);
var var
rowEl: TJSHTMLElement; rowEl: TJSHTMLElement;
taskItemIdStr: string; taskItemIdStr: string;
...@@ -398,7 +398,7 @@ begin ...@@ -398,7 +398,7 @@ begin
ApplySelectedRowState; ApplySelectedRowState;
end; end;
procedure TFTasksHTML.ApplySelectedRowState; procedure TFTaskItems.ApplySelectedRowState;
begin begin
asm asm
const selectedTaskItemId = this.FSelectedTaskItemId; const selectedTaskItemId = this.FSelectedTaskItemId;
...@@ -413,7 +413,7 @@ begin ...@@ -413,7 +413,7 @@ begin
end; end;
[async] function TFTasksHTML.AddTaskRow: Boolean; [async] function TFTaskItems.AddTaskRow: Boolean;
var var
response: TXDataClientResponse; response: TXDataClientResponse;
insertAfterItemNum: Integer; insertAfterItemNum: Integer;
...@@ -471,7 +471,7 @@ begin ...@@ -471,7 +471,7 @@ begin
end; end;
procedure TFTasksHTML.btnReloadClick(Sender: TObject); procedure TFTaskItems.btnReloadClick(Sender: TObject);
begin begin
if FTaskId = '' then if FTaskId = '' then
begin begin
...@@ -483,7 +483,7 @@ begin ...@@ -483,7 +483,7 @@ begin
end; end;
procedure TFTasksHTML.EnableAutoGrowTextAreas; procedure TFTaskItems.EnableAutoGrowTextAreas;
begin begin
asm asm
(function(){ (function(){
...@@ -499,7 +499,7 @@ begin ...@@ -499,7 +499,7 @@ begin
end; end;
procedure TFTasksHTML.SetTotalRowsLabel(ARowCount: Integer); procedure TFTaskItems.SetTotalRowsLabel(ARowCount: Integer);
var var
el: TJSHTMLElement; el: TJSHTMLElement;
begin begin
...@@ -509,7 +509,7 @@ begin ...@@ -509,7 +509,7 @@ begin
end; end;
procedure TFTasksHTML.SetTaskLabel(const ATitle: string); procedure TFTaskItems.SetTaskLabel(const ATitle: string);
var var
el: TJSHTMLElement; el: TJSHTMLElement;
begin begin
...@@ -519,7 +519,7 @@ begin ...@@ -519,7 +519,7 @@ begin
end; end;
[async] procedure TFTasksHTML.LoadTasks(const ATaskId: string); [async] procedure TFTaskItems.LoadTasks(const ATaskId: string);
var var
response: TXDataClientResponse; response: TXDataClientResponse;
resultObj, taskObj: TJSObject; resultObj, taskObj: TJSObject;
...@@ -581,7 +581,7 @@ begin ...@@ -581,7 +581,7 @@ begin
end; end;
procedure TFTasksHTML.RenderTable; procedure TFTaskItems.RenderTable;
var var
host: TJSHTMLElement; host: TJSHTMLElement;
html: string; html: string;
...@@ -798,7 +798,7 @@ begin ...@@ -798,7 +798,7 @@ begin
end; end;
procedure TFTasksHTML.EnableColumnResize; procedure TFTaskItems.EnableColumnResize;
begin begin
asm asm
(function(){ (function(){
...@@ -837,7 +837,7 @@ begin ...@@ -837,7 +837,7 @@ begin
end; end;
procedure TFTasksHTML.EditorBlur(Event: TJSEvent); procedure TFTaskItems.EditorBlur(Event: TJSEvent);
var var
el: TJSHTMLElement; el: TJSHTMLElement;
idx: Integer; idx: Integer;
...@@ -874,7 +874,7 @@ begin ...@@ -874,7 +874,7 @@ begin
end; end;
[async] procedure TFTasksHTML.MoveTaskRow(AIndex: Integer; const newItemNum: Integer); [async] procedure TFTaskItems.MoveTaskRow(AIndex: Integer; const newItemNum: Integer);
var var
response: TXDataClientResponse; response: TXDataClientResponse;
movedTaskItemId: Integer; movedTaskItemId: Integer;
...@@ -915,7 +915,7 @@ begin ...@@ -915,7 +915,7 @@ begin
end; end;
[async] procedure TFTasksHTML.SaveRow(AIndex: Integer); [async] procedure TFTaskItems.SaveRow(AIndex: Integer);
const const
// Note: Use this to manipulate saving to the server or not for testing // Note: Use this to manipulate saving to the server or not for testing
ENABLE_SERVER_SAVE = True; ENABLE_SERVER_SAVE = True;
...@@ -966,7 +966,7 @@ begin ...@@ -966,7 +966,7 @@ begin
end; end;
[async] function TFTasksHTML.DeleteTaskRow: Boolean; [async] function TFTaskItems.DeleteTaskRow: Boolean;
var var
response: TXDataClientResponse; response: TXDataClientResponse;
begin begin
...@@ -991,7 +991,7 @@ begin ...@@ -991,7 +991,7 @@ begin
end; end;
end; end;
function TFTasksHTML.ExtractOptionNames(const SourceArray: TJSArray): TJSArray; function TFTaskItems.ExtractOptionNames(const SourceArray: TJSArray): TJSArray;
var var
i: Integer; i: Integer;
optionObj: TJSObject; optionObj: TJSObject;
...@@ -1010,7 +1010,7 @@ begin ...@@ -1010,7 +1010,7 @@ begin
end; end;
function TFTasksHTML.ExtractCodeDescs(const SourceArray: TJSArray): TJSArray; function TFTaskItems.ExtractCodeDescs(const SourceArray: TJSArray): TJSArray;
var var
i: Integer; i: Integer;
optionObj: TJSObject; optionObj: TJSObject;
...@@ -1029,7 +1029,7 @@ begin ...@@ -1029,7 +1029,7 @@ begin
end; end;
function TFTasksHTML.GetOptionsForField(const AFieldName: string): TJSArray; function TFTaskItems.GetOptionsForField(const AFieldName: string): TJSArray;
begin begin
if SameText(AFieldName, 'reportedBy') then if SameText(AFieldName, 'reportedBy') then
Result := FReportedByOptions Result := FReportedByOptions
...@@ -1040,7 +1040,7 @@ begin ...@@ -1040,7 +1040,7 @@ begin
end; end;
procedure TFTasksHTML.FocusTrigger(const ATriggerId: string); procedure TFTaskItems.FocusTrigger(const ATriggerId: string);
var var
el: TJSHTMLElement; el: TJSHTMLElement;
begin begin
...@@ -1053,7 +1053,7 @@ begin ...@@ -1053,7 +1053,7 @@ begin
end; end;
procedure TFTasksHTML.DropdownItemClick(Event: TJSEvent); procedure TFTaskItems.DropdownItemClick(Event: TJSEvent);
var var
el: TJSHTMLElement; el: TJSHTMLElement;
idx: Integer; idx: Integer;
...@@ -1100,7 +1100,7 @@ begin ...@@ -1100,7 +1100,7 @@ begin
end; end;
procedure TFTasksHTML.DropdownEditClick(Event: TJSEvent); procedure TFTaskItems.DropdownEditClick(Event: TJSEvent);
var var
el: TJSHTMLElement; el: TJSHTMLElement;
idx: Integer; idx: Integer;
...@@ -1123,7 +1123,7 @@ begin ...@@ -1123,7 +1123,7 @@ begin
end; end;
procedure TFTasksHTML.ApplyPendingFocus; procedure TFTaskItems.ApplyPendingFocus;
var var
el: TJSHTMLElement; el: TJSHTMLElement;
selector: string; selector: string;
...@@ -1149,7 +1149,7 @@ begin ...@@ -1149,7 +1149,7 @@ begin
end; end;
procedure TFTasksHTML.ApplyPendingDeleteFocus; procedure TFTaskItems.ApplyPendingDeleteFocus;
var var
el: TJSHTMLElement; el: TJSHTMLElement;
rowEl: TJSHTMLElement; rowEl: TJSHTMLElement;
...@@ -1190,7 +1190,7 @@ begin ...@@ -1190,7 +1190,7 @@ begin
FPendingFocusTaskField := ''; FPendingFocusTaskField := '';
end; end;
procedure TFTasksHTML.CaptureTableScroll; procedure TFTaskItems.CaptureTableScroll;
begin begin
asm asm
const vscroll = document.querySelector('.tasks-vscroll'); const vscroll = document.querySelector('.tasks-vscroll');
...@@ -1201,7 +1201,7 @@ begin ...@@ -1201,7 +1201,7 @@ begin
end; end;
end; end;
procedure TFTasksHTML.RestoreTableScroll; procedure TFTaskItems.RestoreTableScroll;
begin begin
asm asm
const vscroll = document.querySelector('.tasks-vscroll'); const vscroll = document.querySelector('.tasks-vscroll');
......
object FTest: TFTest
Width = 640
Height = 480
CSSLibrary = cssBootstrap
ElementFont = efCSS
object lblTest: TWebLabel
Left = 280
Top = 204
Width = 52
Height = 15
Caption = 'Test Form'
ElementID = 'lbl_test'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnTestApi: TWebButton
Left = 266
Top = 240
Width = 96
Height = 25
Caption = 'Test Api'
ChildOrder = 1
ElementID = 'btn_test_api'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnTestApiClick
end
object memoTestDebug: TWebMemo
Left = 224
Top = 286
Width = 185
Height = 89
ElementClassName = 'form-control'
ElementID = 'memo_test_debug'
ElementFont = efCSS
HeightPercent = 100.000000000000000000
Lines.Strings = (
'')
SelLength = 0
SelStart = 2
ShowHint = False
WidthPercent = 100.000000000000000000
OnChange = memoTestDebugChange
end
object xdwcTest: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 464
Top = 208
end
end
<div class="container py-4">
<div class="d-flex flex-wrap align-items-center justify-content-between gap-3 mb-4">
<div>
<div id="lbl_test" class="h2 fw-semibold mb-1">Test Form</div>
<div class="text-muted">Quick API + JWT/version diagnostics</div>
</div>
<button id="btn_test_api" class="btn btn-primary">Test API</button>
</div>
<div class="card border-0 shadow-sm">
<div class="card-header bg-body-tertiary d-flex align-items-center justify-content-between">
<div class="fw-semibold">Debug Output</div>
</div>
<div class="card-body" style="min-height: 70vh;">
<textarea id="memo_test_debug"
class="form-control font-monospace h-100"
style="min-height: 65vh;"
rows="28"
placeholder="Click Test API to populate diagnostics..."></textarea>
</div>
</div>
</div>
unit View.Test;
interface
uses
System.SysUtils, System.Classes, JS, Web,
WEBLib.Graphics, WEBLib.Controls, WEBLib.Forms, WEBLib.StdCtrls,
XData.Web.Client,
App.Types, ConnectionModule, Vcl.StdCtrls, Vcl.Controls;
type
TFTest = class(TWebForm)
lblTest: TWebLabel;
btnTestApi: TWebButton;
memoTestDebug: TWebMemo;
xdwcTest: TXDataWebClient;
[async] procedure btnTestApiClick(Sender: TObject);
procedure memoTestDebugChange(Sender: TObject);
private
procedure AddLine(const s: string);
procedure DumpClaims;
public
end;
var
FTest: TFTest;
implementation
uses
Auth.Service;
procedure TFTest.AddLine(const s: string);
begin
memoTestDebug.Lines.Add(s);
end;
procedure TFTest.DumpClaims;
var
token: string;
payload: TJSObject;
begin
token := AuthService.GetToken;
AddLine('token:' + token);
//add null logic
AddLine('token present: ' + BoolToStr(token <> '', True));
if token = '' then
Exit;
AddLine('token expired: ' + BoolToStr(AuthService.TokenExpired, True));
AddLine('token exp (local): ' + DateTimeToStr(AuthService.TokenExpirationDate));
payload := TJSObject(AuthService.TokenPayload);
if not Assigned(payload) then
Exit;
asm
const p = payload;
const keys = Object.keys(p);
for (let i = 0; i < keys.length; i++) {
const k = keys[i];
const v = p[k];
this.AddLine('claim ' + k + ': ' + String(v));
}
end;
end;
[async] procedure TFTest.btnTestApiClick(Sender: TObject);
var
response: TXDataClientResponse;
resultObj: TJSObject;
messageText: string;
requiredVersion: string;
begin
memoTestDebug.Visible := True;
memoTestDebug.Lines.Clear;
AddLine('--- request ---');
AddLine('api url: ' + DMConnection.ApiConnection.URL);
AddLine('auth url: ' + DMConnection.AuthConnection.URL);
AddLine('clientVersion const: ' + DMConnection.clientVersion);
AddLine('');
AddLine('--- token / claims ---');
DumpClaims;
messageText := 'hello from TFTest @ ' + DateTimeToStr(Now);
AddLine('');
AddLine('calling IApiService.TestApi ...');
try
response := await(xdwcTest.RawInvokeAsync('IApiService.TestApi', [messageText]));
except
on E: Exception do
begin
AddLine('');
AddLine('--- api exception ---');
AddLine(E.Message);
Exit;
end;
end;
AddLine('');
AddLine('--- api response ---');
if not Assigned(response.Result) then
begin
AddLine('response.Result is nil');
Exit;
end;
resultObj := TJSObject(response.Result);
AddLine('messageEcho: ' + JS.toString(resultObj['messageEcho']));
AddLine('serverTime: ' + JS.toString(resultObj['serverTime']));
AddLine('requiredWebClientVersion: ' + JS.toString(resultObj['requiredWebClientVersion']));
AddLine('note: ' + JS.toString(resultObj['note']));
requiredVersion := JS.toString(resultObj['requiredWebClientVersion']);
AddLine('');
AddLine('--- version compare (client-side) ---');
AddLine('clientVersion const: ' + DMConnection.clientVersion);
AddLine('requiredWebClientVersion: ' + requiredVersion);
AddLine('match: ' + BoolToStr(DMConnection.clientVersion = requiredVersion, True));
end;
procedure TFTest.memoTestDebugChange(Sender: TObject);
begin
end;
end.
...@@ -11,8 +11,7 @@ uses ...@@ -11,8 +11,7 @@ uses
App.Config in 'App.Config.pas', App.Config in 'App.Config.pas',
View.Main in 'View.Main.pas' {FViewMain: TWebForm} {*.html}, View.Main in 'View.Main.pas' {FViewMain: TWebForm} {*.html},
Utils in 'Utils.pas', Utils in 'Utils.pas',
View.Test in 'View.Test.pas' {FTest: TWebForm} {*.html}, View.TaskItems in 'View.TaskItems.pas' {FTaskItems: TWebForm} {*.html},
View.TasksHTML in 'View.TasksHTML.pas' {FTasksHTML: TWebForm} {*.html},
uNameManager in 'uNameManager.pas'; uNameManager in 'uNameManager.pas';
{$R *.res} {$R *.res}
...@@ -42,7 +41,7 @@ procedure Login(userId: string; taskId: string; urlCode: string); ...@@ -42,7 +41,7 @@ procedure Login(userId: string; taskId: string; urlCode: string);
procedure LoginError(AMsg: string); procedure LoginError(AMsg: string);
begin begin
ShowMessage('Login Error: ' + AMsg); ShowAppDialog('' + AMsg);
end; end;
begin begin
...@@ -74,13 +73,13 @@ end; ...@@ -74,13 +73,13 @@ end;
procedure DoLogout(AMsg: string); procedure DoLogout(AMsg: string);
begin begin
AuthService.Logout; AuthService.Logout;
ShowMessage('Logout successful: ' + AMsg); ShowAppDialog('Logout successful ' + AMsg);
end; end;
procedure UnauthorizedAccessProc(AMessage: string); procedure UnauthorizedAccessProc(AMessage: string);
begin begin
ShowMessage('UnauthorizedAccessProc: ' + AMessage); ShowAppDialog('UnauthorizedAccessProc: ' + AMessage);
end; end;
...@@ -102,27 +101,7 @@ begin ...@@ -102,27 +101,7 @@ begin
end end
else else
begin begin
asm ShowAppDialog(ErrorMessage, 'emT3 web app', True, 'Reload');
var dlg = document.createElement("dialog");
dlg.classList.add("shadow", "rounded", "border", "p-4");
dlg.style.maxWidth = "500px";
dlg.style.width = "90%";
dlg.style.fontFamily = "system-ui, sans-serif";
dlg.innerHTML =
"<h5 class='fw-bold mb-3 text-danger'>emT3 web app</h5>" +
"<p class='mb-3' style='white-space: pre-wrap;'>" + ErrorMessage + "</p>" +
"<div class='text-end'>" +
"<button id='refreshBtn' class='btn btn-primary'>Reload</button></div>";
document.body.appendChild(dlg);
dlg.showModal();
document.getElementById("refreshBtn").addEventListener("click", function () {
var base = location.origin + location.pathname;
location.replace(base + "?ver=" + ClientVer + "&r=" + Date.now() + location.hash);
});
end;
end; end;
end); end);
end, end,
......
...@@ -94,16 +94,15 @@ ...@@ -94,16 +94,15 @@
<DCC_RemoteDebug>false</DCC_RemoteDebug> <DCC_RemoteDebug>false</DCC_RemoteDebug>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo> <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale> <VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=0.9.8.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=0.9.8.0;Comments=;LastCompiledTime=2018/08/27 15:18:29</VerInfo_Keys> <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=0.8.5.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=0.9.8.0;Comments=;LastCompiledTime=2018/08/27 15:18:29</VerInfo_Keys>
<AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode> <AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode>
<VerInfo_MajorVer>0</VerInfo_MajorVer> <VerInfo_MajorVer>0</VerInfo_MajorVer>
<VerInfo_MinorVer>9</VerInfo_MinorVer> <VerInfo_MinorVer>8</VerInfo_MinorVer>
<VerInfo_Release>8</VerInfo_Release> <VerInfo_Release>5</VerInfo_Release>
<TMSWebBrowser>1</TMSWebBrowser> <TMSWebBrowser>1</TMSWebBrowser>
<TMSWebOutputPath>..\emT3XDataServer\bin\static</TMSWebOutputPath>
<TMSWebSingleInstance>1</TMSWebSingleInstance>
<TMSURLParams>?user_id=1019&amp;task_id=4045&amp;url_code=123456</TMSURLParams>
<TMSUseJSDebugger>2</TMSUseJSDebugger> <TMSUseJSDebugger>2</TMSUseJSDebugger>
<TMSWebSingleInstance>1</TMSWebSingleInstance>
<TMSWebOutputPath>..\emT3XDataServer\bin\static</TMSWebOutputPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''"> <PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols> <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
...@@ -119,6 +118,8 @@ ...@@ -119,6 +118,8 @@
<VerInfo_Locale>1033</VerInfo_Locale> <VerInfo_Locale>1033</VerInfo_Locale>
<AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode> <AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode>
<TMSWebBrowser>1</TMSWebBrowser> <TMSWebBrowser>1</TMSWebBrowser>
<TMSWebObfuscation>2</TMSWebObfuscation>
<TMSWebOutputPath>..\emT3XDataServer\bin\static</TMSWebOutputPath>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<DelphiCompile Include="$(MainSource)"> <DelphiCompile Include="$(MainSource)">
...@@ -136,12 +137,8 @@ ...@@ -136,12 +137,8 @@
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
<DCCReference Include="Utils.pas"/> <DCCReference Include="Utils.pas"/>
<DCCReference Include="View.Test.pas"> <DCCReference Include="View.TaskItems.pas">
<Form>FTest</Form> <Form>FTaskItems</Form>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="View.TasksHTML.pas">
<Form>FTasksHTML</Form>
<FormType>dfm</FormType> <FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
...@@ -180,7 +177,7 @@ ...@@ -180,7 +177,7 @@
<Deployment Version="5"> <Deployment Version="5">
<DeployFile LocalName="Win32\Debug\emT3Web.exe" Configuration="Debug" Class="ProjectOutput"> <DeployFile LocalName="Win32\Debug\emT3Web.exe" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win32"> <Platform Name="Win32">
<RemoteName>emT3Web.exe</RemoteName> <RemoteName>emT3web.exe</RemoteName>
<Overwrite>true</Overwrite> <Overwrite>true</Overwrite>
</Platform> </Platform>
</DeployFile> </DeployFile>
......
...@@ -495,7 +495,7 @@ object ApiDatabase: TApiDatabase ...@@ -495,7 +495,7 @@ object ApiDatabase: TApiDatabase
' and ITEM_NUM > :OLD_ITEM_NUM' ' and ITEM_NUM > :OLD_ITEM_NUM'
' and ITEM_NUM <= :NEW_ITEM_NUM') ' and ITEM_NUM <= :NEW_ITEM_NUM')
Left = 236 Left = 236
Top = 184 Top = 186
ParamData = < ParamData = <
item item
DataType = ftUnknown DataType = ftUnknown
...@@ -554,10 +554,6 @@ object ApiDatabase: TApiDatabase ...@@ -554,10 +554,6 @@ object ApiDatabase: TApiDatabase
Name = 'TASK_ID' Name = 'TASK_ID'
Value = nil Value = nil
end> end>
object uqGetTaskMaxItemNumMAX_ITEM_NUM: TIntegerField
FieldName = 'MAX_ITEM_NUM'
ReadOnly = True
end
end end
object uqDeleteTaskRow: TUniQuery object uqDeleteTaskRow: TUniQuery
Connection = ucETaskApi Connection = ucETaskApi
......
...@@ -61,7 +61,6 @@ type ...@@ -61,7 +61,6 @@ type
uqGetTaskMaxItemNum: TUniQuery; uqGetTaskMaxItemNum: TUniQuery;
uqGetTaskRowPositionTASK_ID: TStringField; uqGetTaskRowPositionTASK_ID: TStringField;
uqGetTaskRowPositionITEM_NUM: TSmallintField; uqGetTaskRowPositionITEM_NUM: TSmallintField;
uqGetTaskMaxItemNumMAX_ITEM_NUM: TIntegerField;
uqTaskItemsTASK_ITEM_ID: TIntegerField; uqTaskItemsTASK_ITEM_ID: TIntegerField;
uqGetTaskRowPositionTASK_ITEM_ID: TIntegerField; uqGetTaskRowPositionTASK_ITEM_ID: TIntegerField;
uqDeleteTaskRow: TUniQuery; uqDeleteTaskRow: TUniQuery;
......
...@@ -187,7 +187,7 @@ begin ...@@ -187,7 +187,7 @@ begin
apiDB.uqGetTaskMaxItemNum.Close; apiDB.uqGetTaskMaxItemNum.Close;
apiDB.uqGetTaskMaxItemNum.ParamByName('TASK_ID').AsString := taskId; apiDB.uqGetTaskMaxItemNum.ParamByName('TASK_ID').AsString := taskId;
apiDB.uqGetTaskMaxItemNum.Open; apiDB.uqGetTaskMaxItemNum.Open;
maxItemNum := apiDB.uqGetTaskMaxItemNumMAX_ITEM_NUM.AsInteger; maxItemNum := apiDB.uqGetTaskMaxItemNum.FieldByName('MAX_ITEM_NUM').AsInteger;
if insertAfterItemNum < 0 then if insertAfterItemNum < 0 then
insertAfterItemNum := 0; insertAfterItemNum := 0;
...@@ -261,7 +261,7 @@ begin ...@@ -261,7 +261,7 @@ begin
apiDB.uqGetTaskMaxItemNum.ParamByName('TASK_ID').AsInteger := taskId; apiDB.uqGetTaskMaxItemNum.ParamByName('TASK_ID').AsInteger := taskId;
apiDB.uqGetTaskMaxItemNum.Open; apiDB.uqGetTaskMaxItemNum.Open;
maxItemNum := apiDB.uqGetTaskMaxItemNumMAX_ITEM_NUM.AsInteger; maxItemNum := apiDB.uqGetTaskMaxItemNum.FieldByName('MAX_ITEM_NUM').AsInteger;
finalItemNum := newItemNum; finalItemNum := newItemNum;
......
...@@ -92,7 +92,7 @@ begin ...@@ -92,7 +92,7 @@ begin
Result.AddPair('error', Result.AddPair('error',
'Your browser is running an old version of the app.' + sLineBreak + 'Your browser is running an old version of the app.' + sLineBreak +
'Please click button to reload.' + sLineBreak + sLineBreak + 'Please click button to reload.' + sLineBreak + sLineBreak +
'if Error continues, then you need to Empty Cache and Hard Reload!'); 'If error continues, empty cache and hard reload.');
end; end;
finally finally
iniFile.Free; iniFile.Free;
......
[Settings] [Settings]
MemoLogLevel=4 MemoLogLevel=4
FileLogLevel=4 FileLogLevel=4
webClientVersion=0.8.3 webClientVersion=0.8.5
LogFileNum=136 LogFileNum=146
[Database] [Database]
--Server=192.168.116.131 --Server=192.168.116.131
......
...@@ -114,10 +114,10 @@ ...@@ -114,10 +114,10 @@
<VerInfo_Locale>1033</VerInfo_Locale> <VerInfo_Locale>1033</VerInfo_Locale>
<DCC_ExeOutput>.\bin</DCC_ExeOutput> <DCC_ExeOutput>.\bin</DCC_ExeOutput>
<DCC_UnitSearchPath>C:\RADTOOLS\FastMM4;$(DCC_UnitSearchPath)</DCC_UnitSearchPath> <DCC_UnitSearchPath>C:\RADTOOLS\FastMM4;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<VerInfo_Keys>CompanyName=EM Systems;FileDescription=$(MSBuildProjectName);FileVersion=0.8.3.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=0.9.11;Comments=</VerInfo_Keys> <VerInfo_Keys>CompanyName=EM Systems;FileDescription=$(MSBuildProjectName);FileVersion=0.8.5.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=0.9.11;Comments=</VerInfo_Keys>
<VerInfo_MajorVer>0</VerInfo_MajorVer> <VerInfo_MajorVer>0</VerInfo_MajorVer>
<VerInfo_MinorVer>8</VerInfo_MinorVer> <VerInfo_MinorVer>8</VerInfo_MinorVer>
<VerInfo_Release>3</VerInfo_Release> <VerInfo_Release>5</VerInfo_Release>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''"> <PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode> <AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
......
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