Skip to content

Commit

Permalink
New navigation toggle
Browse files Browse the repository at this point in the history
Implement latest post for magnz, on how to enable the new UI.
  • Loading branch information
rajyraman committed Nov 27, 2018
1 parent e503d99 commit f0b3c15
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 7 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ Action | What it does
**Org Settings** | Displays some useful information about the current "Organization" you are connected to in a popup.
**My Roles** | Displays the user roles, that you user record has.
**User & Roles** | Displays the users and their roles.
**Emojis** | Display the of emojis for copy pasting into CRM/Dynamics 365 Customer Engagement.
**Enable new navigation** | Enable the new UCI/modern interface navigation. Refer [UI updates in October release](https://community.dynamics.com/365/b/365teamblog/archive/2018/10/01/announcing-ui-updates-in-october-for-sitemap-and-command-bar) for the official announcement.
**Disable new navigation** | Disbles the new UCI/modern interface navigation.
## Functionality
Please watch this animation below for quick functionality intro.

Expand Down Expand Up @@ -108,3 +109,4 @@ if(process.env.NODE_ENV === 'development'){
* [Chrome extension kickstart yo generator by HaNdTrix](https://github.com/HaNdTriX/generator-chrome-extension-kickstart)
* [Unicode.org Emoji list v5](https://unicode.org/emoji/charts/full-emoji-list.html)
* [Copy Text to Clipboard by Sindre Sorhus](https://github.com/sindresorhus/copy-text-to-clipboard)
* [Enable/Disable new navigation by Jared Johnson](https://www.magnetismsolutions.com/blog/jaredjohnson/2018/11/27/dynamics-365-v9-1-enable-unified-interface-ui-updates-on-upgraded-organizations)
4 changes: 2 additions & 2 deletions app/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"https://*/*"
],
"web_accessible_resources" : ["Sdk.Soap.min.js","levelup.extension.js"],
"version" : "3.2.0",
"version_name" : "3.2.0",
"version" : "3.3.0",
"version_name" : "3.3.0",
"manifest_version" : 2
}
5 changes: 3 additions & 2 deletions app/pages/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,13 @@
<div class="links" id="openGrid">New window</div>
<div class="links" id="quickFindFields">Quick Find fields</div>
</div>
<p class="section">Misc</p>
<p class="section">Miscellaneous</p>
<div class="container" data-category='API'>
<div class="links" id="environmentDetails">Org Settings</div>
<div class="links" id="myRoles">My Roles</div>
<div class="links" id="allUserRoles">Users &amp; Roles</div>
<div class="links" id="emojis">Emojis</div>
<div class="links" id="lightUpNavigation">Enable new navigation</div>
<div class="links" id="classicNavigation">Disable new navigation</div>
</div>
</div>
<script src="options.js"></script>
Expand Down
6 changes: 6 additions & 0 deletions app/scripts/inject/levelup.common.utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module LevelUp {
export class Utility {
private _is2016OrGreater: boolean;
private _currentUserId: string;
private _version: string;

constructor(private _document: Document,
private _window: Window,
Expand All @@ -12,6 +13,7 @@ module LevelUp {
let version = _xrm.Page.context.getVersion ? _xrm.Page.context.getVersion() : <string>window["APPLICATION_VERSION"];
this._is2016OrGreater = version.startsWith('8') || version.startsWith('9');
this._currentUserId = _xrm.Page.context.getUserId().substr(1, 36);
this._version = version;
}

public get formDocument(): Document { return this._document; }
Expand All @@ -33,6 +35,10 @@ module LevelUp {
public get currentUserId(): string {
return this._currentUserId;
}

public get version(): string {
return this._version;
}

fetch(entityName: string, attributes?: string, filter?: string): Promise<Array<any>> {
let headers = new Headers({
Expand Down
3 changes: 2 additions & 1 deletion app/scripts/inject/levelup.navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ module LevelUp {
}

instancePicker() {
if (Xrm.Page.context.isOffice365()) {
if ((Xrm.Page.context.isOffice365 && Xrm.Page.context.isOffice365()) ||
(Xrm.Page.context.isOnPremises && !Xrm.Page.context.isOnPremises())) {
var clientUrl = Xrm.Page.context.getClientUrl();
window.open(`https://port${clientUrl.substr(clientUrl.indexOf('.'))}/G/Instances/InstancePicker.aspx?redirect=False`, '_blank');
}
Expand Down
36 changes: 36 additions & 0 deletions app/scripts/inject/levelup.servicecalls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,41 @@ module LevelUp {
this.utility.messageExtension(resultsArray, 'allUserRoles');
});
}
lightUpNavigation(){
this.toggleNavigation(true);
}

classicNavigation(){
this.toggleNavigation(false);
}

private toggleNavigation(isNewNavigation){
if(this.utility.version.startsWith('9.1')){
let organizationSettings = Xrm.Page.context.organizationSettings;
if(organizationSettings) {
Xrm.WebApi.updateRecord('organization', organizationSettings.organizationId, {
clientfeatureset:
`<clientfeatures>
<clientfeature xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-Instance\">
<name>FCB.ShellRefresh</name>
<value>${isNewNavigation}</value>
<location>Organization</location>
</clientfeature>
</clientfeatures>`
}).then(s=>{
if(Xrm.Internal.isUci || Xrm.Internal.isUci()){
alert(`New navigation has been ${isNewNavigation ? 'enabled' : 'disabled'}. The page will now reload.`);
location.reload();
}
else{
alert(`New navigation has been ${isNewNavigation ? 'enabled' : 'disabled'}.`);
}
});
}
}
else{
alert('New navigation is available only on orgs that are >= 9.1');
}
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Levelup-for-Dynamics-CRM-365",
"private": true,
"version": "3.2.0",
"version": "3.3.0",
"description": "Quickly perform advanced/hidden actions in Dynamics CRM/365, without bookmarklets.",
"scripts": {
"clean": "gulp clean --vendor=chrome & gulp clean --vendor=firefox & gulp clean --vendor=edge",
Expand Down

0 comments on commit f0b3c15

Please sign in to comment.