Skip to content

Commit

Permalink
Add review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
IceOnly committed Jan 7, 2025
1 parent abdb1e3 commit c14da3b
Show file tree
Hide file tree
Showing 18 changed files with 80 additions and 113 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,31 @@ page 80100 "Blob Storage Account"
Extensible = false;
InsertAllowed = false;
DataCaptionExpression = Rec.Name;
UsageCategory = None;
ApplicationArea = All;

layout
{
area(Content)
{
field(NameField; Rec.Name)
{
ApplicationArea = All;
Caption = 'Account Name';
ToolTip = 'Specifies the name of the Storage account connection.';
ShowMandatory = true;
NotBlank = true;
}

field(StorageAccountNameField; Rec."Storage Account Name")
{
ApplicationArea = All;
Caption = 'Storage Account Name';
ToolTip = 'Specifies the Azure Storage name.';
}

field("Authorization Type"; Rec."Authorization Type")
{
ApplicationArea = All;
ToolTip = 'The way of authorizing used to access the Blob Storage.';
}

field(SecretField; Secret)
{
ApplicationArea = All;
Caption = 'Password';
Editable = SecretEditable;
ExtendedDatatype = Masked;
Expand All @@ -60,16 +55,16 @@ page 80100 "Blob Storage Account"

field(ContainerNameField; Rec."Container Name")
{
ApplicationArea = All;
Caption = 'Container Name';
ToolTip = 'Specifies the Azure Storage Container name.';

trigger OnLookup(var Text: Text): Boolean
var
BlobStorageConnectorImpl: Codeunit "Blob Storage Connector Impl.";
NewContainerName: Text[2048];
begin
CurrPage.Update();
BlobStorageConnectorImpl.LookUpContainer(Rec, Rec."Authorization Type", Rec.GetSecret(Rec."Secret Key"), Text);
NewContainerName := CopyStr(Text, 1, MaxStrLen(NewContainerName));
BlobStorageConnectorImpl.LookUpContainer(Rec, Rec."Authorization Type", Rec.GetSecret(Rec."Secret Key"), NewContainerName);
Text := NewContainerName;
exit(true);
end;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,22 @@ table 80100 "Blob Storage Account"
{
DataClassification = CustomerContent;
Caption = 'Name of account';
ToolTip = 'Specifies the name of the Storage account connection.';
}
field(3; "Storage Account Name"; Text[2048])
{
Caption = 'Storage Account Name';
ToolTip = 'Specifies the Azure Storage name.';
}
field(4; "Container Name"; Text[2048])
{
Caption = 'Container Name';
ToolTip = 'Specifies the Azure Storage Container name.';
}
field(7; "Authorization Type"; Enum "Blob Storage Auth. Type")
{
Caption = 'Authorization Type';
ToolTip = 'The way of authorizing used to access the Blob Storage.';
}
field(8; "Secret Key"; Guid)
{
Expand All @@ -63,7 +67,7 @@ table 80100 "Blob Storage Account"
if IsolatedStorage.Delete(Rec."Secret Key") then;
end;

procedure SetSecret(Secret: Text)
procedure SetSecret(Secret: SecretText)
begin
if IsNullGuid(Rec."Secret Key") then
Rec."Secret Key" := CreateGuid();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ page 80101 "Blob Storage Account Wizard"
PageType = NavigatePage;
Extensible = false;
Editable = true;
ApplicationArea = All;

layout
{
Expand All @@ -31,7 +32,6 @@ page 80101 "Blob Storage Account Wizard"
Visible = TopBannerVisible;
field(NotDoneIcon; MediaResources."Media Reference")
{
ApplicationArea = All;
Editable = false;
ShowCaption = false;
ToolTip = ' ';
Expand All @@ -41,7 +41,6 @@ page 80101 "Blob Storage Account Wizard"

field(NameField; Rec.Name)
{
ApplicationArea = All;
Caption = 'Account Name';
ToolTip = 'Specifies the name of the Azure Blob Storage account.';
ShowMandatory = true;
Expand All @@ -55,9 +54,7 @@ page 80101 "Blob Storage Account Wizard"

field(StorageAccountNameField; Rec."Storage Account Name")
{
ApplicationArea = All;
Caption = 'Storage Account Name';
ToolTip = 'Specifies the Azure Storage name.';
ShowMandatory = true;

trigger OnValidate()
Expand All @@ -68,13 +65,10 @@ page 80101 "Blob Storage Account Wizard"

field("Authorization Type"; Rec."Authorization Type")
{
ApplicationArea = All;
ToolTip = 'The way of authorizing used to access the Blob Storage.';
}

field(SecretField; Secret)
{
ApplicationArea = All;
Caption = 'Secret';
ExtendedDatatype = Masked;
ToolTip = 'Specifies the Shared access signature Token or SharedKey.';
Expand All @@ -83,17 +77,19 @@ page 80101 "Blob Storage Account Wizard"

field(ContainerNameField; Rec."Container Name")
{
ApplicationArea = All;
Caption = 'Container Name';
ToolTip = 'Specifies the container to use of the Storage Blob.';
ShowMandatory = true;

trigger OnLookup(var Text: Text): Boolean
var
BlobStorageConnectorImpl: Codeunit "Blob Storage Connector Impl.";
NewContainerName: Text[2048];
begin
CurrPage.Update();
BlobStorageConnectorImpl.LookUpContainer(Rec, Rec."Authorization Type", Secret, Text);
NewContainerName := CopyStr(Text, 1, MaxStrLen(NewContainerName));
BlobStorageConnectorImpl.LookUpContainer(Rec, Rec."Authorization Type", Secret, NewContainerName);
Text := NewContainerName;
exit(true);
end;

Expand All @@ -111,7 +107,6 @@ page 80101 "Blob Storage Account Wizard"
{
action(Back)
{
ApplicationArea = All;
Caption = 'Back';
ToolTip = 'Back';
Image = Cancel;
Expand All @@ -125,7 +120,6 @@ page 80101 "Blob Storage Account Wizard"

action(Next)
{
ApplicationArea = All;
Caption = 'Next';
Image = NextRecord;
Enabled = IsNextEnabled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace System.ExternalFileStorage;

using System.Text;
using System.Utilities;
using System.Azure.Storage;

Expand All @@ -16,7 +17,6 @@ codeunit 80100 "Blob Storage Connector Impl." implements "External File Storage
var
ConnectorDescriptionTxt: Label 'Use Azure Blob Storage to store and retrieve files.';
NotRegisteredAccountErr: Label 'We could not find the account. Typically, this is because the account has been deleted.';
ConnectorBase64LogoTxt: Label 'iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAAAXNSR0IArs4c6QAACBZJREFUeJzt3d+LXGcZB/DnPTO7290k21VbUtrU+CNqraYV/FFBa6WKF13aUlrbO6XiP1GK1BtBrwS90CsFi4h6YdsgeCNqoWCrhQiFYkEQktDUNg2Ju5tNujOvF17J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jQJFbg331fR+Jz954c/xz7Xycu7TZdzmwa0vDuXjv/uU4cmCl71L+ryIDICLi1n0H4tZ9B/ouA2ZacSMA0J5r7i4A0J3itgYD2qMDAHYkAKBiLgLCDDMCADsSAFAxIwBUTAcAFZv2U+BzOedbOqkEaF3O+dyk49M6gL+1WAvQsZTSxDU8MQBSSsfbLQfo2MQ1PO0i4M/G4/G3U0qL7dYE7LWc81rTNE9POmdiB7C6unq6aZon2y0L6ELTNE+urq6ennTO1OcBrK+v/2BxcfHxiDjaWmXAXntldXX1h9NOmnob8NFHHx0NBoMvRcRzrZQF7LXnBoPBvSmlqT/kuaL/+h47duyxiHgiIu7cbWXAnjkeEd+9//77f3m5L9j1n/2fffbZI03THNrt64Grl3POw+Hw5H333fePvmsBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIA6/AeyXHTtib4x0gAAAABJRU5ErkJggg==', Locked = true;
MarkerFileNameTok: Label 'BusinessCentral.FileSystem.txt', Locked = true;

/// <summary>
Expand Down Expand Up @@ -143,8 +143,8 @@ codeunit 80100 "Blob Storage Connector Impl." implements "External File Storage
/// <returns>Returns true if the file exists</returns>
procedure FileExists(AccountId: Guid; Path: Text): Boolean
var
ABSBlobClient: Codeunit "ABS Blob Client";
ABSContainerContent: Record "ABS Container Content";
ABSBlobClient: Codeunit "ABS Blob Client";
ABSOperationResponse: Codeunit "ABS Operation Response";
ABSOptionalParameters: Codeunit "ABS Optional Parameters";
begin
Expand Down Expand Up @@ -221,7 +221,6 @@ codeunit 80100 "Blob Storage Connector Impl." implements "External File Storage
procedure CreateDirectory(AccountId: Guid; Path: Text)
var
TempBlob: Codeunit "Temp Blob";
ExternalFileStorage: Codeunit "External File Storage";
IStream: InStream;
OStream: OutStream;
DirectoryAlreadyExistsErr: Label 'Directory already exists.';
Expand All @@ -246,8 +245,8 @@ codeunit 80100 "Blob Storage Connector Impl." implements "External File Storage
/// <returns>Returns true if the directory exists</returns>
procedure DirectoryExists(AccountId: Guid; Path: Text): Boolean
var
ABSBlobClient: Codeunit "ABS Blob Client";
ABSContainerContent: Record "ABS Container Content";
ABSBlobClient: Codeunit "ABS Blob Client";
ABSOperationResponse: Codeunit "ABS Operation Response";
ABSOptionalParameters: Codeunit "ABS Optional Parameters";
begin
Expand Down Expand Up @@ -361,8 +360,12 @@ codeunit 80100 "Blob Storage Connector Impl." implements "External File Storage
/// </summary>
/// <returns>A base64-formatted image to be used as logo.</returns>
procedure GetLogoAsBase64(): Text
var
Base64Convert: Codeunit "Base64 Convert";
Stream: InStream;
begin
exit(ConnectorBase64LogoTxt);
NavApp.GetResource('connector-logo.png', Stream);
exit(Base64Convert.ToBase64(Stream));
end;

internal procedure IsAccountValid(var TempAccount: Record "Blob Storage Account" temporary): Boolean
Expand All @@ -379,8 +382,7 @@ codeunit 80100 "Blob Storage Connector Impl." implements "External File Storage
exit(true);
end;

[NonDebuggable]
internal procedure CreateAccount(var AccountToCopy: Record "Blob Storage Account"; Password: Text; var FileAccount: Record "File Account")
internal procedure CreateAccount(var AccountToCopy: Record "Blob Storage Account"; Password: SecretText; var FileAccount: Record "File Account")
var
NewBlobStorageAccount: Record "Blob Storage Account";
begin
Expand Down Expand Up @@ -459,7 +461,7 @@ codeunit 80100 "Blob Storage Connector Impl." implements "External File Storage
exit(Path + ChildPath);
end;

local procedure InitOptionalParameters(var Path: Text; var FilePaginationData: Codeunit "File Pagination Data"; var ABSOptionalParameters: Codeunit "ABS Optional Parameters")
local procedure InitOptionalParameters(Path: Text; var FilePaginationData: Codeunit "File Pagination Data"; var ABSOptionalParameters: Codeunit "ABS Optional Parameters")
begin
ABSOptionalParameters.Prefix(Path);
ABSOptionalParameters.MaxResults(500);
Expand All @@ -475,7 +477,6 @@ codeunit 80100 "Blob Storage Connector Impl." implements "External File Storage
FilePaginationData.SetEndOfListing(ABSOperationResponse.GetNextMarker() = '');
end;

[NonDebuggable]
local procedure SetReadySAS(var StorageServiceAuthorization: Codeunit "Storage Service Authorization"; Secret: SecretText): Interface System.Azure.Storage."Storage Service Authorization"
begin
exit(StorageServiceAuthorization.UseReadySAS(Secret));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ page 80102 "Blob Storage Container Lookup"
SourceTable = "ABS Container";
Editable = false;
Extensible = false;
ApplicationArea = All;
UsageCategory = None;

layout
{
Expand All @@ -23,7 +25,6 @@ page 80102 "Blob Storage Container Lookup"
{
field(Name; Rec.Name)
{
ApplicationArea = All;
ToolTip = 'Specifies the Name of the container.';
}
}
Expand Down
3 changes: 2 additions & 1 deletion Apps/W1/File - Azure File Service Connector/app/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
"allowDownloadingSource": true,
"includeSourceInSymbolFile": true
},
"contextSensitiveHelpUrl": "https://go.microsoft.com/fwlink/?linkid=2134520"
"contextSensitiveHelpUrl": "https://go.microsoft.com/fwlink/?linkid=2134520",
"resourceFolders": ["data"]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,31 @@ page 80200 "File Share Account"
Extensible = false;
InsertAllowed = false;
DataCaptionExpression = Rec.Name;
ApplicationArea = All;
UsageCategory = None;

layout
{
area(Content)
{
field(NameField; Rec.Name)
{
ApplicationArea = All;
Caption = 'Account Name';
ToolTip = 'Specifies the name of the storage account connection.';
ShowMandatory = true;
NotBlank = true;
}

field(StorageAccountNameField; Rec."Storage Account Name")
{
ApplicationArea = All;
Caption = 'Storage Account Name';
ToolTip = 'Specifies the Azure Storage name.';
}

field("Authorization Type"; Rec."Authorization Type")
{
ApplicationArea = All;
ToolTip = 'The way of authorizing used to access the Blob Storage.';
}

field(SecretField; Secret)
{
ApplicationArea = All;
Caption = 'Password';
Editable = SecretEditable;
ExtendedDatatype = Masked;
Expand All @@ -60,9 +55,7 @@ page 80200 "File Share Account"

field(FileShareNameField; Rec."File Share Name")
{
ApplicationArea = All;
Caption = 'File Share Name';
ToolTip = 'Specifies the Azure File Share name.';
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace System.ExternalFileStorage;
table 80200 "File Share Account"
{
Access = Internal;

DataClassification = CustomerContent;
Caption = 'Azure File Share Account';

fields
Expand All @@ -24,20 +24,23 @@ table 80200 "File Share Account"

field(2; Name; Text[250])
{
DataClassification = CustomerContent;
Caption = 'Name of account';
ToolTip = 'Specifies the name of the storage account connection.';
}
field(3; "Storage Account Name"; Text[2048])
{
Caption = 'Storage Account Name';
ToolTip = 'Specifies the Azure Storage name.';
}
field(4; "File Share Name"; Text[2048])
{
Caption = 'File Share Name';
ToolTip = 'Specifies the Azure File Share name.';
}
field(7; "Authorization Type"; Enum "File Share Auth. Type")
{
Caption = 'Authorization Type';
ToolTip = 'The way of authorizing used to access the Blob Storage.';
}
field(8; "Secret Key"; Guid)
{
Expand Down
Loading

0 comments on commit c14da3b

Please sign in to comment.