diff --git a/app/manifest.json b/app/manifest.json index 8bb6b45..bd6ec32 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -26,6 +26,6 @@ }, "permissions": ["activeTab", "tabs"], "web_accessible_resources": ["/scripts/Sdk.Soap.min.js", "/scripts/levelup.extension.js"], - "version": "3.5.2", + "version": "3.5.3", "manifest_version": 2 } diff --git a/app/pages/options.html b/app/pages/options.html index 6b27a9a..06016d6 100644 --- a/app/pages/options.html +++ b/app/pages/options.html @@ -433,6 +433,24 @@ Displays the quick find columns for the current view. +
+ +
+ Obscures all text fields for screenshot +
+
+
+ +
+ Resets blurred fields back to initial state +
+
diff --git a/app/scripts/inject/levelup.grid.ts b/app/scripts/inject/levelup.grid.ts index 7fa16ca..83670f5 100644 --- a/app/scripts/inject/levelup.grid.ts +++ b/app/scripts/inject/levelup.grid.ts @@ -4,81 +4,93 @@ import { Utility } from './levelup.common.utility'; import { IResultRow } from '../interfaces/types'; export class Grid { - constructor(private utility: Utility) {} + constructor(private utility: Utility) {} - quickFindFields() { - let currentView = this.utility.formDocument.querySelector('span.ms-crm-View-Name'), - resultsArray: IResultRow[] = [{ cells: ['Quick Find Attribute'] }], - etc = this.utility.Xrm.Page.context.getQueryStringParameters().etc, - // @ts-ignore - entityName = this.utility.Xrm.Internal.getEntityName(parseInt(etc)); - // @ts-ignore - if (!entityName && this.utility.Xrm.Utility.getPageContext) { - // @ts-ignore - let view = this.utility.Xrm.Utility.getPageContext().input; - entityName = view.entityName; - } - if (entityName) { - let attributes = 'FetchXml', - entitySetName = this.utility.is2016OrGreater ? 'savedqueries' : 'SavedQuerySet'; - if (this.utility.is2016OrGreater) { - attributes = attributes.toLowerCase(); - } - let filter = this.utility.is2016OrGreater - ? `isquickfindquery eq true and querytype eq 4 and returnedtypecode eq '${entityName}'` - : `IsQuickFindQuery eq true and QueryType eq 4 and ReturnedTypeCode eq '${entityName}'`; - this.utility.fetch(entitySetName, attributes, filter).then((view) => { - let quickFindFields = []; - if (this.utility.is2016OrGreater) { - quickFindFields = Array.from( - new DOMParser().parseFromString(view[0].fetchxml, 'text/html').querySelectorAll('condition') - ).map((x) => x.getAttribute('attribute')); - } else { - quickFindFields = Array.from( - new DOMParser().parseFromString(view[0].FetchXml, 'text/html').querySelectorAll('condition') - ).map((x) => x.getAttribute('attribute')); - } - quickFindFields.forEach((x) => resultsArray.push({ cells: [x] })); - this.utility.messageExtension(resultsArray, 'quickFindFields'); - }); - } else { - alert('The current page is not a grid'); - } - } + quickFindFields() { + let currentView = this.utility.formDocument.querySelector('span.ms-crm-View-Name'), + resultsArray: IResultRow[] = [{ cells: ['Quick Find Attribute'] }], + etc = this.utility.Xrm.Page.context.getQueryStringParameters().etc, + // @ts-ignore + entityName = this.utility.Xrm.Internal.getEntityName(parseInt(etc)); + // @ts-ignore + if (!entityName && this.utility.Xrm.Utility.getPageContext) { + // @ts-ignore + let view = this.utility.Xrm.Utility.getPageContext().input; + entityName = view.entityName; + } + if (entityName) { + let attributes = 'FetchXml', + entitySetName = this.utility.is2016OrGreater ? 'savedqueries' : 'SavedQuerySet'; + if (this.utility.is2016OrGreater) { + attributes = attributes.toLowerCase(); + } + let filter = this.utility.is2016OrGreater + ? `isquickfindquery eq true and querytype eq 4 and returnedtypecode eq '${entityName}'` + : `IsQuickFindQuery eq true and QueryType eq 4 and ReturnedTypeCode eq '${entityName}'`; + this.utility.fetch(entitySetName, attributes, filter).then((view) => { + let quickFindFields = []; + if (this.utility.is2016OrGreater) { + quickFindFields = Array.from( + new DOMParser().parseFromString(view[0].fetchxml, 'text/html').querySelectorAll('condition') + ).map((x) => x.getAttribute('attribute')); + } else { + quickFindFields = Array.from( + new DOMParser().parseFromString(view[0].FetchXml, 'text/html').querySelectorAll('condition') + ).map((x) => x.getAttribute('attribute')); + } + quickFindFields.forEach((x) => resultsArray.push({ cells: [x] })); + this.utility.messageExtension(resultsArray, 'quickFindFields'); + }); + } else { + alert('The current page is not a grid'); + } + } - openGrid() { - let currentView = this.utility.formDocument.querySelector('span.ms-crm-View-Name'), - etc = this.utility.Xrm.Page.context.getQueryStringParameters().etc, - etn, - viewId, - viewType; - // @ts-ignore - if ((!currentView || !etc) && this.utility.Xrm.Utility.getPageContext) { - // @ts-ignore - let view = this.utility.Xrm.Utility.getPageContext().input; - etn = view.entityName; - viewId = view.viewId; - viewType = view.viewType; - } - if (etn) { - if (!viewId) { - window.open(`${this.utility.clientUrlForParams}etn=${etn}&newWindow=true&pagetype=entitylist`, '_blank'); - } else { - let viewTypeCode; - if (viewType === 'savedquery') viewTypeCode = 1039; - if (viewType === 'userquery') viewTypeCode = 4230; - window.open( - `${this.utility.clientUrlForParams}pagetype=entitylist&etn=${etn}&viewid=${viewId}&viewType=${viewTypeCode}`, - '_blank' - ); - } - } else if (currentView && etc) { - let viewType = currentView.getAttribute('currentviewtype'), - viewId = currentView.getAttribute('currentview'), - viewUrl = `${this.utility.clientUrlForParams}etc=${etc}&viewtype=${viewType}&viewid=${viewId}&newWindow=true&pagetype=entitylist`; - window.open(viewUrl, '_blank'); - } else { - alert('The current page is not a grid'); - } - } + openGrid() { + let currentView = this.utility.formDocument.querySelector('span.ms-crm-View-Name'), + etc = this.utility.Xrm.Page.context.getQueryStringParameters().etc, + etn, + viewId, + viewType; + // @ts-ignore + if ((!currentView || !etc) && this.utility.Xrm.Utility.getPageContext) { + // @ts-ignore + let view = this.utility.Xrm.Utility.getPageContext().input; + etn = view.entityName; + viewId = view.viewId; + viewType = view.viewType; + } + if (etn) { + if (!viewId) { + window.open(`${this.utility.clientUrlForParams}etn=${etn}&newWindow=true&pagetype=entitylist`, '_blank'); + } else { + let viewTypeCode; + if (viewType === 'savedquery') viewTypeCode = 1039; + if (viewType === 'userquery') viewTypeCode = 4230; + window.open( + `${this.utility.clientUrlForParams}pagetype=entitylist&etn=${etn}&viewid=${viewId}&viewType=${viewTypeCode}`, + '_blank' + ); + } + } else if (currentView && etc) { + let viewType = currentView.getAttribute('currentviewtype'), + viewId = currentView.getAttribute('currentview'), + viewUrl = `${this.utility.clientUrlForParams}etc=${etc}&viewtype=${viewType}&viewid=${viewId}&newWindow=true&pagetype=entitylist`; + window.open(viewUrl, '_blank'); + } else { + alert('The current page is not a grid'); + } + } + + blurView() { + setFilter(this.utility.formDocument, 'blur(5px)'); + } + + resetViewBlur() { + setFilter(this.utility.formDocument, ''); + } + } + +function setFilter(formDocument: Document, filter: string) { + formDocument.querySelectorAll('.wj-row[aria-label="Data"]').forEach((e: HTMLElement) => (e.style.filter = filter)); } diff --git a/docker-compose.yml b/docker-compose.yml index f26ffaa..e2174a5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,6 @@ x-levelup: services: current: << : *default-levelup - image: levelup-for-dynamics-365-powerapps:3.5.2 + image: levelup-for-dynamics-365-powerapps:3.5.3 latest: *default-levelup \ No newline at end of file