Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private/waabusea/move media to resources #2391

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion src/System Application/App/AI/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "e31ad830-3d46-472e-afeb-1d3d35247943",
"name": "BLOB Storage",
WaelAbuSeada marked this conversation as resolved.
Show resolved Hide resolved
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "c64d75f0-e9f1-4d0f-9949-cd453b9b1466",
"name": "Guided Experience",
Expand All @@ -95,4 +101,4 @@
],
"target": "OnPrem",
"contextSensitiveHelpUrl": "https://learn.microsoft.com/dynamics365/business-central/"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace System.AI;

using System.Environment;
using System.Environment.Configuration;

/// <summary>
/// Page for when copilot is unavailable due to various reasons. Fx capability disabled, cross region data movement is disabled.
Expand All @@ -27,7 +28,7 @@ page 7771 "Copilot Not Available"
ShowCaption = false;
Visible = BannerVisible;

field(Banner; MediaResources."Media Reference")
field(Banner; TenantMediaSet."Media ID")
{
ApplicationArea = All;
Editable = false;
Expand Down Expand Up @@ -86,7 +87,7 @@ page 7771 "Copilot Not Available"
end;

var
MediaResources: Record "Media Resources";
TenantMediaSet: Record "Tenant Media Set";
CopilotCapability: Enum "Copilot Capability";
BannerVisible: Boolean;
OpenCopilotLbl: Label 'Overview Copilot & AI Capabilities';
Expand All @@ -104,8 +105,14 @@ page 7771 "Copilot Not Available"
end;

local procedure LoadBanner()
var
GuidedExperience: Codeunit "Guided Experience";
begin
if MediaResources.Get('COPILOTNOTAVAILABLE.PNG') then
BannerVisible := MediaResources."Media Reference".HasValue;
BannerVisible := GuidedExperience.LoadFileFromTenantMediaSet(TenantMediaSet, 'CopilotNotAvailable.png');
Comment on lines -108 to +111
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand, why are we loading Media using procedures from GuidedExperience here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are loading wizard images from tenant media set, there is a fine line of ownership I agree. but it is the best place I could find


if not BannerVisible then begin
GuidedExperience.InsertSystemFileToTenantMediaSet(TenantMediaSet, 'images/', 'CopilotNotAvailable.png');
BannerVisible := TenantMediaSet."Media ID".HasValue;
end;
end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ permissionset 1481 "Edit in Excel - Read"

IncludedPermissionSets = "Edit in Excel - Objects";

Permissions = tabledata "Media Resources" = r;
Permissions = tabledata "Tenant Media Set" = r;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ page 1480 "Excel Centralized Depl. Wizard"
SourceTable = "Edit in Excel Settings";
Extensible = false;
AccessByPermission = tabledata "Edit in Excel Settings" = M;
Permissions = tabledata "Media Resources" = r;
Permissions = tabledata "Tenant Media Set" = r;
HelpLink = 'https://go.microsoft.com/fwlink/?linkid=2221526';

layout
Expand All @@ -33,7 +33,7 @@ page 1480 "Excel Centralized Depl. Wizard"
Editable = false;
ShowCaption = false;
Visible = TopBannerVisible;
field(NotDoneIcon; MediaResourcesStandard."Media Reference")
field(NotDoneIcon; TenantMediaSet."Media ID")
{
ApplicationArea = All;
Editable = false;
Expand Down Expand Up @@ -315,14 +315,15 @@ page 1480 "Excel Centralized Depl. Wizard"
end;

local procedure LoadTopBanners()
var
TenantMediaSetCompleted, TenantMediaSetInfo : Record "Tenant Media Set";
GuidedExperience: Codeunit "Guided Experience";
begin
if MediaResourcesStandard.Get('ASSISTEDSETUP-NOTEXT-400PX.PNG') and (CurrentClientType() = ClientType::Web)
then
TopBannerVisible := MediaResourcesStandard."Media Reference".HasValue();
TopBannerVisible := GuidedExperience.LoadTopBanners(TenantMediaSet, TenantMediaSetCompleted, TenantMediaSetInfo);
end;

var
MediaResourcesStandard: Record "Media Resources";
TenantMediaSet: Record "Tenant Media Set";
TopBannerVisible: Boolean;
Step: Option Start,Step2,Finish;
BackActionEnabled: Boolean;
Expand Down
8 changes: 7 additions & 1 deletion src/System Application/App/Email/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@
"name": "Data Compression",
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "c64d75f0-e9f1-4d0f-9949-cd453b9b1466",
"name": "Guided Experience",
"publisher": "Microsoft",
"version": "26.0.0.0"
}
],
"internalsVisibleTo": [
Expand All @@ -136,4 +142,4 @@
],
"target": "OnPrem",
"contextSensitiveHelpUrl": "https://go.microsoft.com/fwlink/?linkid=2134520"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ permissionset 8900 "Email - Read"
tabledata "Email View Policy" = r,
tabledata Field = r,
tabledata Media = r, // Email Account Wizard requires this
tabledata "Media Resources" = r,
tabledata "Tenant Media Set" = r,
tabledata "Sent Email" = r,
tabledata "Tenant Media" = r,
tabledata User = R;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace System.Email;

using System.Telemetry;
using System.Environment;
using System.Environment.Configuration;
using System.Apps;

/// <summary>
Expand All @@ -26,8 +27,7 @@ page 8886 "Email Account Wizard"
Editable = true;
ShowFilter = false;
LinksAllowed = false;
Permissions = tabledata Media = r,
tabledata "Media Resources" = r,
Permissions = tabledata "Tenant Media Set" = r,
tabledata "Email Rate Limit" = imd;

layout
Expand All @@ -40,7 +40,7 @@ page 8886 "Email Account Wizard"
Editable = false;
ShowCaption = false;
Visible = not DoneVisible and TopBannerVisible;
field(NotDoneIcon; MediaResourcesStandard."Media Reference")
field(NotDoneIcon; TenantMediaSetStandard."Media ID")
{
ApplicationArea = All;
Editable = false;
Expand All @@ -54,7 +54,7 @@ page 8886 "Email Account Wizard"
Editable = false;
ShowCaption = false;
Visible = DoneVisible and TopBannerVisible;
field(DoneIcon; MediaResourcesDone."Media Reference")
field(DoneIcon; TenantMediaSetCompleted."Media ID")
{
ApplicationArea = All;
Editable = false;
Expand Down Expand Up @@ -539,18 +539,16 @@ page 8886 "Email Account Wizard"
end;

local procedure LoadTopBanners()
var
GuidedExperience: Codeunit "Guided Experience";
begin
if MediaResourcesStandard.Get('ASSISTEDSETUP-NOTEXT-400PX.PNG') and
MediaResourcesDone.Get('ASSISTEDSETUPDONE-NOTEXT-400PX.PNG') and (CurrentClientType() = ClientType::Web)
then
TopBannerVisible := MediaResourcesDone."Media Reference".HasValue();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, are we taking dependency from Email module to Guided Experience to load Media?

I see we have a System Module called Image, might be more suitable for this purpose

TopBannerVisible := GuidedExperience.LoadTopBanners(TenantMediaSetStandard, TenantMediaSetCompleted, TenantMediaSetInfo);
end;

var
RegisteredAccount: Record "Email Account";
RegisteredRateLimit: Record "Email Rate Limit";
MediaResourcesStandard: Record "Media Resources";
MediaResourcesDone: Record "Media Resources";
TenantMediaSetStandard, TenantMediaSetCompleted, TenantMediaSetInfo : Record "Tenant Media Set";
[RunOnClient]
AppSource: DotNet AppSource;
Step: Option Welcome,"Choose Connector","Register Account",Done;
Expand Down
7 changes: 6 additions & 1 deletion src/System Application/App/Guided Experience/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
"id": "4af62c1c-2f6d-4574-ba34-bb5c149cdf93",
"name": "Guided Experience Test",
"publisher": "Microsoft"
},
{
"id": "d3433b68-4901-445f-9547-fdfeca57575a",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should encourage this, using internalsvisibleto can easily get out of hand.
Create an API in the GuidedExperience Facade and use ModuleInfo to block non-Microsoft from invoking it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, I was just considering if this is something we would like to make internal or not. Probably no need and I will switch it to public.

"name": "AI SDK",
"publisher": "Microsoft"
}
],
"screenshots": [],
Expand Down Expand Up @@ -136,4 +141,4 @@
],
"target": "OnPrem",
"contextSensitiveHelpUrl": "https://learn.microsoft.com/dynamics365/business-central/"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace System.Environment.Configuration;

using System.Globalization;
using System.Apps;
using System.Environment;

permissionset 1993 "Guided Experience - Edit"
{
Expand All @@ -21,5 +22,7 @@ permissionset 1993 "Guided Experience - Edit"
tabledata "Checklist Item User" = IMD,
tabledata "Checklist Setup" = IMd,
tabledata "Published Application" = imd,
tabledata "Spotlight Tour Text" = imd;
tabledata "Spotlight Tour Text" = imd,
tabledata "Tenant Media" = imd,
tabledata "Tenant Media Set" = imd;
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,7 @@ permissionset 1991 "Guided Experience - Read"
tabledata "Spotlight Tour Text" = r,
tabledata User = r,
tabledata "User Checklist Status" = R,
tabledata "User Personalization" = r;
tabledata "User Personalization" = r,
tabledata "Tenant Media" = r,
tabledata "Tenant Media Set" = r;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace System.Environment.Configuration;

using System.Environment;
using System.Globalization;
using System.Reflection;

Expand All @@ -24,5 +25,7 @@ permissionset 1992 "Guided Experience - View"
tabledata "Guided Experience Item" = imd,
tabledata "Primary Guided Experience Item" = imd,
tabledata "Spotlight Tour Text" = imd,
tabledata "User Checklist Status" = im;
tabledata "User Checklist Status" = im,
tabledata "Tenant Media" = im,
tabledata "Tenant Media Set" = im;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace System.Environment.Configuration;

using System.Environment;
using System.Media;

/// <summary>
Expand Down Expand Up @@ -443,6 +444,37 @@ codeunit 1990 "Guided Experience"
GuidedExperienceItemCleanup.CleanupOldGuidedExperienceItems(OnlyFirstParty, Threshold);
end;

/// <summary> Loads Assisted Setup top banners from tenant media set.</summary>
/// <param name="TenantMediaSetStandard">Tenant Media set record by var for standard image.</param>
/// <param name="TenantMediaSetCompleted">Tenant Media set record by var for done image.</param>
/// <param name="TenantMediaSetInfo">Tenant Media set record by var for info image.</param>
/// <returns>True if the top banners are loaded successfuly</returns>
procedure LoadTopBanners(var TenantMediaSetStandard: Record "Tenant Media Set"; var TenantMediaSetCompleted: Record "Tenant Media Set"; var TenantMediaSetInfo: Record "Tenant Media Set"): Boolean
begin
exit(GuidedExperienceImpl.LoadTopBanners(TenantMediaSetStandard, TenantMediaSetCompleted, TenantMediaSetInfo));
end;

/// <summary> Loads an image from tenant media set.</summary>
/// <param name="TenantMediaSet">Tenant Media set record by var for standard image.</param>
/// <param name="FileName">Image name.</param>
/// <returns>True if the the image is loaded successfuly</returns>
procedure LoadFileFromTenantMediaSet(var TenantMediaSet: Record "Tenant Media Set"; FileName: Text[250]): Boolean
var
begin
exit(GuidedExperienceImpl.LoadFileFromTenantMediaSet(TenantMediaSet, FileName));
end;

/// <summary> Insert an image to tenant media set from system app resources.</summary>
/// <param name="TenantMediaSet">Tenant Media set record by var for standard image.</param>
/// <param name="FilePath">Path to file name.</param>
/// <param name="FileName">File name.</param>
/// <returns>True if the the image is loaded successfuly</returns>
internal procedure InsertSystemFileToTenantMediaSet(var TenantMediaSet: Record "Tenant Media Set"; FilePath: Text[100]; FileName: Text[250])
var
begin
GuidedExperienceImpl.InsertSystemFileToTenantMediaSet(TenantMediaSet, FilePath, FileName);
end;

Comment on lines +447 to +477
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how those procedures fit in Guided Experience, consider Image module per previous comment

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First one, is strictly for banners in a wizard, and should definitely be there. The problem with the rest is that they are not really only for images, as resources can be anything in the future

/// <summary>Notifies that the list of assisted setups is being gathered, and that new items might be added.</summary>
[IntegrationEvent(false, false)]
internal procedure OnRegisterAssistedSetup()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ codeunit 1991 "Guided Experience Impl."
Permissions = tabledata AllObj = r,
tabledata "Guided Experience Item" = rimd,
tabledata "Primary Guided Experience Item" = rimd,
tabledata "Spotlight Tour Text" = rimd;
tabledata "Spotlight Tour Text" = rimd,
tabledata "Tenant Media Set" = rim,
tabledata "Tenant Media" = rim;

var
TempBlob: Codeunit "Temp Blob";
Expand Down Expand Up @@ -569,6 +571,44 @@ codeunit 1991 "Guided Experience Impl."
InsertGuidedExperienceItemsInTempVar(GuidedExperienceItem, TempGuidedExperienceItem);
end;

procedure LoadTopBanners(var TenantMediaSetStandard: Record "Tenant Media Set"; var TenantMediaSetCompleted: Record "Tenant Media Set"; var TenantMediaSetInfo: Record "Tenant Media Set"): Boolean
begin
if not LoadFileFromTenantMediaSet(TenantMediaSetStandard, 'AssistedSetup-NoText-400px.png') then
InsertSystemFileToTenantMediaSet(TenantMediaSetStandard, 'images/', 'AssistedSetup-NoText-400px.png');

if not LoadFileFromTenantMediaSet(TenantMediaSetCompleted, 'AssistedSetupDone-NoText-400px.png') then
InsertSystemFileToTenantMediaSet(TenantMediaSetCompleted, 'images/', 'AssistedSetupDone-NoText-400px.png');

if not LoadFileFromTenantMediaSet(TenantMediaSetInfo, 'AssistedSetupInfo-NoText.png') then
InsertSystemFileToTenantMediaSet(TenantMediaSetInfo, 'images/', 'AssistedSetupInfo-NoText.png');

exit((TenantMediaSetStandard."Media ID".HasValue) and (TenantMediaSetCompleted."Media ID".HasValue) and (TenantMediaSetInfo."Media ID".HasValue));
end;

procedure LoadFileFromTenantMediaSet(var TenantMediaSet: Record "Tenant Media Set"; FileName: Text[250]): Boolean
var
TenantMedia: Record "Tenant Media";
begin
TenantMedia.SetFilter(Description, FileName);
if TenantMedia.FindFirst() then
if TenantMediaSet.Get(TenantMedia.ID, TenantMedia.ID) then
exit(TenantMediaSet."Media ID".HasValue);
end;

procedure InsertSystemFileToTenantMediaSet(var TenantMediaSet: Record "Tenant Media Set"; FilePath: Text[100]; FileName: Text[250])
var
BannerInStream: InStream;
begin
NavApp.GetResource(FilePath + FileName, BannerInStream);
if BannerInStream.Length = 0 then
exit;

TenantMediaSet.Init();
TenantMediaSet."Media ID".ImportStream(BannerInStream, FileName);
TenantMediaSet.ID := TenantMediaSet."Media ID".MediaId;
TenantMediaSet.Insert();
end;

local procedure InsertGuidedExperienceItemsInTempVar(var GuidedExperienceItem: Record "Guided Experience Item"; var TempGuidedExperienceItem: Record "Guided Experience Item" temporary)
var
PrevGuidedExperienceItem: Record "Guided Experience Item";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// ------------------------------------------------------------------------------------------------

namespace System.Integration;
using System.Environment;

permissionset 2718 "Page Summary - Admin"
{
Expand All @@ -13,5 +14,6 @@ permissionset 2718 "Page Summary - Admin"

IncludedPermissionSets = "Page Summary Provider - Read";

Permissions = tabledata "Page Summary Settings" = IMD;
Permissions = tabledata "Page Summary Settings" = IMD,
tabledata "Tenant Media Set" = i;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ permissionset 2715 "Page Summary Provider - Read"
IncludedPermissionSets = "Page Summary Provider - Obj.";

Permissions = tabledata Company = r,
tabledata Media = r,
tabledata "Media Resources" = r,
tabledata "Page Data Personalization" = R,
tabledata "Page Metadata" = r,
tabledata "Tenant Media Set" = r,
tabledata "Tenant Media Thumbnails" = r; // Page Summary Provider Settings Wizard requires this
tabledata "Tenant Media" = r,
tabledata "Tenant Media Set" = r; // Page Summary Provider Settings Wizard requires this
}
Loading
Loading