Skip to content

Commit

Permalink
Merge pull request #2 from DriveWorks/1.2.0
Browse files Browse the repository at this point in the history
1.2.0 - Show Specification name in URL tab title.
  • Loading branch information
ConnorDriveWorks authored Dec 6, 2021
2 parents 08a1263 + c2f22f6 commit e5f9b13
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# DriveWorks Live - Integration Theme Example - Simple Login (DriveApps)
### Release: 1.1.0
### Release: 1.2.0
#### Minimum DriveWorks Version: 18.1

A simple distributable template that renders a predefined DriveApp after a valid login.
Expand All @@ -8,9 +8,10 @@ Please note: DriveWorks are not accepting pull requests for this example.
Join our [online community](https://my.driveworks.co.uk) for discussion, resources and to suggest other examples.

### This example:
- Shows a login screen - credentials attached to a config file
- Connects to the DriveWorks API
- After a successful login, renders a DriveApp with a basic external header
- Shows a login screen - credentials attached to a config file.
- Connects to the DriveWorks API.
- After a successful login, renders a DriveApp with a basic external header.
- Displays DriveApp Alias in tab title.

### To use:
1. Clone this repository, or download as a .zip
Expand Down Expand Up @@ -48,6 +49,7 @@ If you are unable to use the dynamic library loading demonstrated in this exampl
* Ensure you are running DriveWorks 18.2 or above
* Ensure HTTPS is enabled in DriveWorks Live's settings
* Ensure a valid SSL certificate has been configured via DriveWorksConfigUser.xml.
* Ensure if using an incognito/private window, third-party cookies are not blocked (see browser settings).
* See [Integration Theme Settings](https://docs.driveworkspro.com/Topic/IntegrationThemeSettings) for additional guidance.

---
Expand Down
2 changes: 1 addition & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ const config = {
driveAppPingInterval: 0,
// (Optional) Configure 'Run' view
run: {
showWarningOnExit: true, // Toggle warning dialog when exiting "Run" view with potentially unsaved changes (where supported)
showWarningOnExit: false, // Toggle warning dialog when exiting "Run" view with potentially unsaved changes (where supported)
},
};
16 changes: 13 additions & 3 deletions js/run.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Get config
const SERVER_URL = config.serverUrl;
const GROUP_ALIAS = config.groupAlias;
const DRIVEAPP_ALIAS = config.driveAppAlias;
const DRIVE_APP_ALIAS = config.driveAppAlias;

// Get session
const CURRENT_SESSION = localStorage.getItem("sessionId");
Expand Down Expand Up @@ -51,14 +51,15 @@ function dwClientLoaded() {
*/
async function run() {
showUsername();
setTabTitle(DRIVE_APP_ALIAS);

try {

// Run DriveApp
const driveApp = await DW_CLIENT.runDriveApp(GROUP_ALIAS, DRIVEAPP_ALIAS);
const driveApp = await DW_CLIENT.runDriveApp(GROUP_ALIAS, DRIVE_APP_ALIAS);

// Render DriveApp
const driveAppOutput = document.getElementById("driveapp-output");
const driveAppOutput = document.getElementById("drive-app-output");
await driveApp.render(driveAppOutput);

// Attach events
Expand Down Expand Up @@ -197,3 +198,12 @@ function beforeUnloadHandler(event) {
event.preventDefault();
event.returnValue = "Are you sure you want to leave this page?";
}

/**
* Set browser tab title
*
* @param {Object} text - The text to display in the title.
*/
function setTabTitle(text) {
document.title = `${text} | Run - DriveWorks`;
}
2 changes: 1 addition & 1 deletion run.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</header>

<!-- Render Area -->
<div id="driveapp-output" class="output is-loading"></div>
<div id="drive-app-output" class="output is-loading"></div>

<!-- Scripts -->
<script src="config.js"></script>
Expand Down

0 comments on commit e5f9b13

Please sign in to comment.