Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
GuidoPreite committed Feb 20, 2022
1 parent fc83ae3 commit 5a9c292
Show file tree
Hide file tree
Showing 7 changed files with 1,280 additions and 60 deletions.
3 changes: 2 additions & 1 deletion js/drb.common.map.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ DRB.Common.MapPersonalViews = function (data, sortProperty) {
var id = record.userqueryid;
var name = record.name;
var tableLogicalName = record.returnedtypecode;
views.push(new DRB.Models.PersonalView(id, name, tableLogicalName));
var layoutXml = record.layoutxml;
views.push(new DRB.Models.PersonalView(id, name, tableLogicalName, layoutXml));
});
// sort the array based on the provided sortProperty
if (DRB.Utilities.HasValue(sortProperty)) { views.sort(DRB.Utilities.CustomSort(sortProperty)); }
Expand Down
18 changes: 18 additions & 0 deletions js/drb.dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,24 @@ DRB.DOM.PowerAutomate.RowCountSpan = { Id: "span_rowcount", Name: "Row count" };
DRB.DOM.PowerAutomate.RowCountInput = { Id: "txt_rowcount" };
// #endregion

// #region Power Query
DRB.DOM.PowerQuery = {};

DRB.DOM.PowerQuery.Table = { Id: "table_powerquery" };
DRB.DOM.PowerQuery.Tr = { Id: "tr_pq_" };
DRB.DOM.PowerQuery.TdLabel = { Id: "td_pq_label_" };
DRB.DOM.PowerQuery.TdValue = { Id: "td_pq_value_" };
DRB.DOM.PowerQuery.TdCopy = { Id: "td_pq_copy_" };

DRB.DOM.PowerQuery.ButtonCopy = { Id: "btn_pq_copy_", Name: "Copy", Class: "btn-secondary" };

DRB.DOM.PowerQuery.BaseUrlSpan = { Id: "span_baseurl", Name: "DataverseUrl" };
DRB.DOM.PowerQuery.BaseUrlInput = { Id: "txt_baseurl" };

DRB.DOM.PowerQuery.SpanOptionSetDropdown = { Id: "span_optionset", Name: "Columns with Options" };
DRB.DOM.PowerQuery.OptionSetDropdown = { Id: "cbx_optionset", Name: "Select Column" };
// #endregion

// #region Lookup
DRB.DOM.Lookup = {};
DRB.DOM.Lookup.Div = { Id: "div_lookup" };
Expand Down
571 changes: 569 additions & 2 deletions js/drb.generatecode.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion js/drb.initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ DRB.DefineOperations = function () {
// DRB.Settings.Tabs.push({ Id: "code_typescript", Name: "TypeScript", GenerateCode: true, ShowEditor: true, EditorMode: "typescript", CopyCode: true, ShowWarning: true, WarningClientUrl: true });
DRB.Settings.Tabs.push({ Id: "code_powerautomate", Name: "Power Automate", GenerateCode: true, EmptyDiv: true, EnabledRequests: ["retrievesingle", "retrievemultiple"] });
DRB.Settings.Tabs.push({ Id: "code_fetchxml", Name: "FetchXML", GenerateCode: true, ShowEditor: true, EditorMode: "xml", CopyCode: true, SendFetchXML: true, ShowWarning: true, WarningFetchXML: true, EnabledRequests: ["retrievesingle", "retrievemultiple"] });
DRB.Settings.Tabs.push({ Id: "code_powerquery", Name: "Power Query (M)", GenerateCode: true, EmptyDiv: true, EnabledRequests: ["retrievemultiple"] });

var tabs_Request = DRB.UI.CreateTabs(DRB.DOM.TabsRequest.Id, DRB.Settings.Tabs);
var tabs_Content = DRB.UI.CreateTabContents(DRB.DOM.TabsContent.Id, DRB.Settings.Tabs);
Expand Down Expand Up @@ -522,7 +523,7 @@ DRB.InsertMainBodyContent = function () {
*/
DRB.Initialize = async function () {
// DRB Version
var drbVersion = "1.0.0.34";
var drbVersion = "1.0.0.35";
document.title = document.title + " " + drbVersion;
$("#" + DRB.DOM.VersionSpan.Id).html(drbVersion);

Expand Down
70 changes: 46 additions & 24 deletions js/drb.logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,25 @@ DRB.Logic.MoveCodeToMainEditor = function (sectionName) {
$("#a_" + DRB.Settings.TabExecute).click();
}

/**
* Logic - Copy Code To Clipboard
* @param {string} codeValue Code Value
*/
DRB.Logic.CopyCodeToClipboard = function (codeValue) {
// copy to clipboard
if (DRB.Utilities.HasValue(navigator.clipboard)) {
// modern browser code
navigator.clipboard.writeText(codeValue);
} else {
// old code for IE
var $temp = $("<textarea>");
$("body").append($temp);
$temp.val(codeValue).select();
document.execCommand("copy");
$temp.remove();
}
}

/**
* Logic - Copy Code From Editor
* @param {string} sectionName Section Name
Expand All @@ -113,24 +132,27 @@ DRB.Logic.CopyCodeFromEditor = function (sectionName) {
if (checkTab.Results === true) { contentText = "Results"; }
}

// copy to clipboard
if (DRB.Utilities.HasValue(navigator.clipboard)) {
// modern browser code
navigator.clipboard.writeText(codeValue);
} else {
// old code for IE
var $temp = $("<textarea>");
$("body").append($temp);
$temp.val(codeValue).select();
document.execCommand("copy");
$temp.remove();
}
DRB.Logic.CopyCodeToClipboard(codeValue);

// show message to the user
DRB.UI.ShowMessage(contentText + " copied to Clipboard");
setTimeout(function () { DRB.UI.HideLoading(); }, DRB.Settings.TimeoutDelay * 1.5);
}

/**
* Logic - Copy Code From Editor
* @param {string} sectionName Section Name
*/
DRB.Logic.CopyCodeFromEditorByTabName = function (tabName) {
var codeValue = DRB.Settings.Editors[tabName].session.getValue();

DRB.Logic.CopyCodeToClipboard(codeValue);

// show message to the user
DRB.UI.ShowMessage("Code copied to Clipboard");
setTimeout(function () { DRB.UI.HideLoading(); }, DRB.Settings.TimeoutDelay * 1.5);
}

/**
* Logic - Send Code To FetchXML Builder
* @param {string} sectionName Section Name
Expand All @@ -152,18 +174,18 @@ DRB.Logic.SendCodeToFetchXMLBuilder = function (sectionName) {

DRB.Logic.CopyCodeForPowerAutomate = function (id, name) {
var codeValue = $("#" + DRB.DOM.PowerAutomate[id + "Input"].Id).val();
// copy to clipboard
if (DRB.Utilities.HasValue(navigator.clipboard)) {
// modern browser code
navigator.clipboard.writeText(codeValue);
} else {
// old code for IE
var $temp = $("<textarea>");
$("body").append($temp);
$temp.val(codeValue).select();
document.execCommand("copy");
$temp.remove();
}

DRB.Logic.CopyCodeToClipboard(codeValue);

// show message to the user
DRB.UI.ShowMessage(name + " copied to Clipboard");
setTimeout(function () { DRB.UI.HideLoading(); }, DRB.Settings.TimeoutDelay * 1.5);
}

DRB.Logic.CopyCodeForPowerQuery = function (id, name) {
var codeValue = $("#" + DRB.DOM.PowerQuery[id + "Input"].Id).val();

DRB.Logic.CopyCodeToClipboard(codeValue);

// show message to the user
DRB.UI.ShowMessage(name + " copied to Clipboard");
Expand Down
5 changes: 3 additions & 2 deletions js/drb.models.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,12 +429,13 @@ DRB.Models.SystemView = function (id, name, tableLogicalName, isDefault, layoutX
* @param {string} id Id
* @param {string} name Name
* @param {string} tableLogicalName Table Logical Name
*
* @param {string} layoutXml Layout XML
*/
DRB.Models.PersonalView = function (id, name, tableLogicalName) {
DRB.Models.PersonalView = function (id, name, tableLogicalName, layoutXml) {
this.Id = id;
this.Name = name;
this.TableLogicalName = tableLogicalName;
this.LayoutXml = layoutXml;

this.ToDropdownOption = function () { return new DRB.Models.DropdownOption(this.Id, this.Name, this.TableLogicalName); }
}
Expand Down

0 comments on commit 5a9c292

Please sign in to comment.