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

Merge main into major v26 #52

Merged
merged 19 commits into from Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
7a6fa1a
update manifest to autoShow: false for provider
adam-saland Jul 20, 2022
b263e02
Merge pull request #41 from built-on-openfin/dev/adam/hide-provider-w…
adam-saland Jul 20, 2022
0d29575
Only rerun GHA validation on PR changes or base branch edit
obany Jul 21, 2022
c5b9d2d
Apply same trigger fix to prettier
obany Jul 27, 2022
264e139
Merge pull request #42 from built-on-openfin/dev/martyn/gha-linting
obany Jul 27, 2022
cf53599
Improve the starter consistency
obany Jul 28, 2022
07bd5ae
Update client2 to secondclient
obany Jul 29, 2022
fa7dbc6
Merge pull request #43 from built-on-openfin/dev/martyn/code-consistency
obany Aug 1, 2022
3d7a20a
Use common fin.d.ts type definition for type import
obany Aug 5, 2022
bdf2078
Update quotes rule to avoid unnecessary templates
obany Aug 23, 2022
1ab294c
Merge pull request #45 from built-on-openfin/dev/martyn/eslint-quotes
obany Aug 30, 2022
df6dc99
Add importsNotUsedAsValues flag so types are imported correctly
obany Aug 30, 2022
241140e
FDC3 clarifications (#46)
openfin-johans Sep 5, 2022
cf92f09
Merge pull request #44 from built-on-openfin/dev/martyn/openfin-core-…
obany Sep 5, 2022
17cc8f3
Merge pull request #47 from built-on-openfin/dev/martyn/imports-as-types
obany Sep 5, 2022
fdfe4c2
Add a simple single page platform example (#49)
johnman Sep 5, 2022
1b280f4
Align app.css content
obany Sep 6, 2022
f7c9d73
Added an example of platform window and added timing (#48)
johnman Sep 6, 2022
233666f
Merge pull request #50 from built-on-openfin/dev/martyn/css-version-u…
obany Sep 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 3 additions & 8 deletions .eslintrc.js
Expand Up @@ -12,7 +12,8 @@ module.exports = {
'plugin:unicorn/recommended'
],
globals: {
fin: 'readonly'
fin: 'readonly',
OpenFin: 'readonly'
},
ignorePatterns: [
'**/dist/*',
Expand Down Expand Up @@ -521,13 +522,7 @@ module.exports = {
'@typescript-eslint/prefer-string-starts-ends-with': ['error'],
'@typescript-eslint/prefer-ts-expect-error': ['error'],
'@typescript-eslint/promise-function-async': ['error'],
'@typescript-eslint/quotes': [
'error',
'double',
{
allowTemplateLiterals: true
}
],
'@typescript-eslint/quotes': ['error', 'double'],
'@typescript-eslint/require-array-sort-compare': ['off'],
'@typescript-eslint/require-await': ['off'],
'@typescript-eslint/restrict-plus-operands': ['error'],
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
@@ -1,8 +1,8 @@
name: Check Linting has been applied

on:
push:
pull_request:
types: [opened, synchronize, reopened, edited]

jobs:
lint:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prettier.yml
@@ -1,8 +1,8 @@
name: Check Prettier formatting has been applied

on:
push:
pull_request:
types: [opened, synchronize, reopened, edited]

jobs:
prettier:
Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -25,6 +25,7 @@ This repository contains examples for common use cases and API implementations.
| [use-popup-window](./how-to/use-popup-window/) | This example contains various examples of how to use popup windows |
| [use-window-options](./how-to/use-window-options/) | This example demonstrates the options available for opening windows |
| [use-interop](./how-to/use-interop/) | This example contains various implementations and use cases for the Interop API |
| [use-a-manifest](./how-to/use-a-manifest/) | This example contains various examples of how to use the OpenFin manifest |

## Before you get started

Expand Down
24 changes: 19 additions & 5 deletions how-to/common/public/style/app.css
Expand Up @@ -194,7 +194,9 @@ footer a {
text-decoration: none;
outline: 0;
white-space: nowrap;
transition: all 200ms cubic-bezier(0.16, 1, 0.3, 1);
transition-property: background-color, color, opacity;
transition-duration: 200ms;
transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

a.button:hover,
Expand Down Expand Up @@ -333,7 +335,9 @@ textarea {
min-width: 200px;
padding: 8px 12px;
box-shadow: rgb(0 0 0 / 25%) 0px 4px 4px;
transition: all 200ms cubic-bezier(0.16, 1, 0.3, 1);
transition-property: background-color, color, opacity;
transition-duration: 200ms;
transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

textarea {
Expand Down Expand Up @@ -484,7 +488,9 @@ input[type='range']::-webkit-slider-runnable-track {
background-color: var(--brand-input-background);
border-radius: 5px;
box-shadow: rgb(0 0 0 / 25%) 0px 4px 4px;
transition: all 200ms cubic-bezier(0.16, 1, 0.3, 1);
transition-property: background-color, color, opacity;
transition-duration: 200ms;
transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

input[type='range']::-webkit-slider-thumb {
Expand All @@ -497,7 +503,9 @@ input[type='range']::-webkit-slider-thumb {
background: var(--brand-input-background);
cursor: pointer;
box-shadow: rgb(0 0 0 / 25%) 0px 4px 4px;
transition: all 200ms cubic-bezier(0.16, 1, 0.3, 1);
transition-property: background-color, color, opacity;
transition-duration: 200ms;
transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

input[type='range']:hover::-webkit-slider-runnable-track,
Expand Down Expand Up @@ -559,7 +567,9 @@ input[type='radio'] {
height: 20px;
margin: 2px;
box-shadow: rgb(0 0 0 / 25%) 0px 4px 4px;
transition: all 200ms cubic-bezier(0.16, 1, 0.3, 1);
transition-property: background-color, color, opacity;
transition-duration: 200ms;
transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

input[type='radio'] {
Expand Down Expand Up @@ -715,6 +725,10 @@ em {
padding: 20px;
}

.pad0 {
padding: 0px;
}

table {
width: 100%;
font-size: 10px;
Expand Down
5 changes: 5 additions & 0 deletions how-to/common/types/fin.d.ts
@@ -0,0 +1,5 @@
import type { fin as FinApi } from "@openfin/core";

declare global {
const fin: typeof FinApi;
}
17 changes: 15 additions & 2 deletions how-to/create-window/client/src/app.ts
@@ -1,5 +1,3 @@
import { fin } from "@openfin/core";

document.addEventListener("DOMContentLoaded", async () => {
try {
await init();
Expand Down Expand Up @@ -41,6 +39,18 @@ async function openDataWindow() {
return fin.Window.create(winOption);
}

async function openDataPlatformWindow() {
const viewOption = {
name: "childview-data",
url: "http://localhost:5050/html/window.html",
customData: {
dateNow: Date.now()
},
target: undefined
};
await fin.Platform.getCurrentSync().createView(viewOption);
}

async function init(): Promise<void> {
const btn = document.querySelector("#btn-open-dynamic-window");
btn.addEventListener("click", async (e: Event) => openDynamicApplicationWindow());
Expand All @@ -50,4 +60,7 @@ async function init(): Promise<void> {

const btn2 = document.querySelector("#btn-open-data-window");
btn2.addEventListener("click", async (e: Event) => openDataWindow());

const btn3 = document.querySelector("#btn-open-data-platform-window");
btn3.addEventListener("click", openDataPlatformWindow);
}
4 changes: 3 additions & 1 deletion how-to/create-window/client/tsconfig.json
Expand Up @@ -8,7 +8,9 @@
"skipLibCheck": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node"
"importsNotUsedAsValues": "error",
"moduleResolution": "node",
"types": ["../../common/types/fin"]
},
"include": ["./src/**/*.ts"]
}
3 changes: 3 additions & 0 deletions how-to/create-window/public/html/app.html
Expand Up @@ -28,6 +28,9 @@ <h1 class="tag">Demonstrate how to open windows.</h1>
<br />
<label>Open Window with Data</label>
<button id="btn-open-data-window">Open Window</button>
<br />
<label>Open Platform Window with Data</label>
<button id="btn-open-data-platform-window">Open Platform Window</button>
</main>
</body>
</html>
7 changes: 6 additions & 1 deletion how-to/create-window/public/html/window.html
Expand Up @@ -23,8 +23,13 @@ <h1 class="tag">Receiving Data from custom options.</h1>

<script>
(async () => {
const loaded = Date.now();
const viewOptions = await fin.me.getOptions();
document.querySelector('#custom-data').textContent = JSON.stringify(viewOptions.customData);
document.querySelector('#custom-data').textContent = `Request Timestamp: ${
viewOptions?.customData?.dateNow
} Load Timestamp: ${loaded} Total load time in milliseconds: ${
Number.parseInt(loaded, 10) - Number.parseInt(viewOptions?.customData?.dateNow)
});`;
})();
</script>
</main>
Expand Down
1 change: 1 addition & 0 deletions how-to/create-window/server/tsconfig.json
Expand Up @@ -8,6 +8,7 @@
"skipLibCheck": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"importsNotUsedAsValues": "error",
"moduleResolution": "node"
},
"include": ["./src/**/*.ts"]
Expand Down
2 changes: 0 additions & 2 deletions how-to/integration-excel/client/src/provider.ts
@@ -1,5 +1,3 @@
import { fin } from "@openfin/core";

async function init(): Promise<void> {
console.log("Platform Init");
}
Expand Down
4 changes: 3 additions & 1 deletion how-to/integration-excel/client/tsconfig.json
Expand Up @@ -8,7 +8,9 @@
"skipLibCheck": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node"
"importsNotUsedAsValues": "error",
"moduleResolution": "node",
"types": ["../../common/types/fin"]
},
"include": ["./src/**/*.ts"]
}
6 changes: 3 additions & 3 deletions how-to/integration-excel/public/views/excel.html
Expand Up @@ -23,10 +23,10 @@ <h1 class="tag">Demonstrate integration with Excel.</h1>
<main class="row gap20">
<div class="fill col gap10 scroll-vertical">
<h3>Excel</h3>
<p>Open any Workbook in Excel to start viewing changes to it's cells.</p>
<p>Open Excel and select Workbook and Worksheet below to start view changes to it's cells.</p>
<p>
After selecting a worksheet enter any of the known instruments into a cell e.g. TSLA, MSFT, APPL -
this should send an FDC message for that instrument.
This example application listens for cell changes and when the value is TSLA, MSFT or AAPL it will
create an fdc3.instrument context object with the value as the ticker and broadcast it.
</p>
<div class="error" id="error"></div>
<div class="col gap20">
Expand Down
2 changes: 1 addition & 1 deletion how-to/integration-excel/public/views/fdc3monitor.html
Expand Up @@ -21,7 +21,7 @@ <h1 class="tag">Demonstrate monitoring messages from Excel.</h1>
</header>

<main class="col gap10">
<p>When the Excel integration broadcasts an FDC3 Instrument, this view should see the change.</p>
<p>When an fdc3.instrument context is received the ticker value will be shown below.</p>

<fieldset>
<label for="received-instrument">Received Instrument</label>
Expand Down
1 change: 1 addition & 0 deletions how-to/integration-excel/server/tsconfig.json
Expand Up @@ -8,6 +8,7 @@
"skipLibCheck": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"importsNotUsedAsValues": "error",
"moduleResolution": "node"
},
"include": ["./src/**/*.ts"]
Expand Down
17 changes: 17 additions & 0 deletions how-to/use-a-manifest/README.md
@@ -0,0 +1,17 @@
# How To Use A Manifest

This directory contains information related to manifests and how you can use them to configure your application.

## What you can do with this repository

This repository contains examples showing how to configure your application differently based on what you are trying to do.

### Examples

| Example | Description |
| ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [How To - Create a single page platform](./create-a-single-page-platform) | This is an example of how to start your move to a platform by creating a basic platform manifest that defines a single view to load a site's primary url and hides the tab to make this platform app have a single frame. |

## Before you get started

Read more about our [recommended development environment](https://developers.openfin.co/of-docs/docs/set-up-your-dev-environment).
45 changes: 45 additions & 0 deletions how-to/use-a-manifest/create-a-single-page-platform/README.md
@@ -0,0 +1,45 @@
# Demonstrate launching a site as a single page platform

## How it Works

The manifest file [public/manifest.fin.json](public/manifest.fin.json) has a snapshot definition. We define a single url (our starter style guide as an example) and that the view should not show a tab (so you only see the main frame). The platform does not have a custom window template (it is using the default OpenFin template with minimize, maximize and close) and it doesn't specify a custom provider url (so it does not have an initial background page running background logic). This is a simple platform definition which can act as a first step with the potential of using platform capabilities in the future.

## Get Started

Follow the instructions below to get up and running.

### Set up the project

1. Install dependencies and do the initial build. Note that these examples assume you are in the sub-directory for the example.

```shell
npm run setup
```

2. Build the project.

```shell
npm run build
```

3. Start the test server in a new window.

```shell
npm run start
```

4. Start the Platform application.

```shell
npm run client
```

### What you will see

1. A single platform window show the starter style guide in a view with no tab.

![Single Page Platform](./single-page-platform.png)

### A note about this example

This is an example of how to use OpenFin manifests to configure OpenFin Container. Its purpose is to provide an example and suggestions. **DO NOT** assume that it contains production-ready code. Please use this as a guide and provide feedback. Thanks!
26 changes: 26 additions & 0 deletions how-to/use-a-manifest/create-a-single-page-platform/package.json
@@ -0,0 +1,26 @@
{
"name": "create-a-single-page-platform",
"version": "0.0.1",
"description": "A demonstration of a one page platform that can be used as a starting point.",
"main": "index.js",
"scripts": {
"build": "npm run build-server",
"build-server": "tsc --project ./server",
"start": "npm run server",
"client": "npm --prefix ../../common/ run client",
"server": "node ./server/build/index.js",
"kill": "npm --prefix ../../common/ run kill",
"setup": "cd ../../../ && npm install && cd how-to/use-a-manifest/create-a-single-page-platform && npm run build",
"validate": "npm --prefix ../../../ run validate"
},
"author": "john.mandia@openfin.co",
"license": "SEE LICENSE IN LICENSE.MD",
"devDependencies": {
"express": "^4.17.2",
"source-map-loader": "^3.0.1",
"ts-loader": "^9.2.6",
"typescript": "^4.5.4",
"webpack": "^5.65.0",
"webpack-cli": "^4.9.1"
}
}
Binary file not shown.
@@ -0,0 +1,45 @@
{
"licenseKey": "openfin-demo-license-key",
"runtime": {
"arguments": "--v=1 --inspect",
"version": "26.102.70.16",
"autoShow": false
},
"platform": {
"uuid": "how-to-use-a-manifest-create-a-single-page-platform",
"icon": "http://localhost:5050/favicon.ico"
},
"snapshot": {
"windows": [
{
"defaultWidth": 800,
"defaultHeight": 600,
"defaultLeft": 0,
"defaultTop": 0,
"saveWindowState": false,
"backgroundThrottling": true,
"layout": {
"content": [
{
"type": "stack",
"width": 100,
"isClosable": false,
"reorderEnabled": false,
"hasHeaders": false,
"content": [
{
"type": "component",
"componentName": "view",
"componentState": {
"url": "http://localhost:5050/common/style/style.html"
},
"title": "view"
}
]
}
]
}
}
]
}
}