Skip to content

Commit

Permalink
split app into versioned folders
Browse files Browse the repository at this point in the history
  • Loading branch information
WatsonCIQ authored and rikoe committed Dec 26, 2021
1 parent ce5a737 commit 2353787
Show file tree
Hide file tree
Showing 10 changed files with 605 additions and 32 deletions.
56 changes: 35 additions & 21 deletions toolbox/legacy.html → toolbox/fdc3-explained/1.0/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
FDC3 Explained v.2
</title>

<script language="javascript">
<script type=module>
import setVersionList from '../versions.js';

<!-- Various global stuff -->
// <!-- Various global stuff -->
var channelArray = [];

<!-- Check if FDC3 is avaialable -->
// <!-- Check if FDC3 is avaialable -->
function fdc3Init(callback){
let fdc3Tries = 10; //lets not check forever...
const onFDC3Ready = () => {
Expand All @@ -27,13 +28,13 @@
onFDC3Ready();
}

<!-- Enable application when FDC3 is available -->
// <!-- Enable application when FDC3 is available -->
document.addEventListener("DOMContentLoaded",() => {

fdc3Init(async () => {

const systemChannels = await fdc3.getSystemChannels();

systemChannels.forEach(channel => {
const thisChannel = channel;
channelArray.push(channel.id);
Expand All @@ -44,13 +45,16 @@
//populateChannels(channelArray);
enablePage();
});

// set the versions of FDC3 Explained in the dropdown
setVersionList()
});

function enablePage(){

console.log('FDC3 is available');
<!-- Special case for Openfin to read App Name -->

// <!-- Special case for Openfin to read App Name -->
if (window.FSBL){
window.FSBL.getFSBLInfo().then((info) => {
document.getElementById('providerDetails').innerHTML = 'Available - Finsemble ' + info.FSBLVersion;
Expand All @@ -62,17 +66,17 @@
document.getElementById('providerDetails').innerHTML = 'Available - Not specified';
}
document.getElementById('directoryDetails').innerHTML = 'TBD';
<!-- enable page obects -->

// <!-- enable page obects -->
document.getElementById('btnBroadcast').disabled = false;
document.getElementById('txtBroadcastData').disabled = false;
document.getElementById('selBroadcastChannel').disabled = false;
document.getElementById('btnFetchChannels').disabled = false;
document.getElementById('txtAvailableChannels').disabled = false;

}
<!-- Various poor examples of FDC3 functionality -->

// <!-- Various poor examples of FDC3 functionality -->

function populateChannels(channelArray){

Expand Down Expand Up @@ -101,34 +105,34 @@
}

function changeBroadcastChannel(){

alert('Not implemented yet!');
document.getElementById('selBroadcastChannel').selectedIndex = 0;

}

function appLoader(){

var myUrl = document.getElementById('appUrl').value;

if (myUrl.length>0){

window.open(myUrl);

}
}

</script>

<style>

textarea {width:400px;height:100px;}
textarea {width:400px;height:100px;}

select {width:238px;height:24px;}
select {width:238px;height:24px;}

.ctxInput {width:241px;height:24px;}
.ctxInput {width:241px;height:24px;}

.urlInput {width:400px;height:24px;}
.urlInput {width:400px;height:24px;}

.header {width:200px;height:40px;font-weight:700;}

Expand All @@ -143,6 +147,16 @@
<tr>
<td class="header">FDC3 Provider Service:</td>
<td><span id="providerDetails">FDC3 Not Available</span></td>

<tr>
<td class="header">FDC3 Supported Version:</td>
<td>1.1 </td>
<td>
<select id="versions" onchange="window.location.href=`../${this.value}`">
<option value="" disabled style="display:none;" selected>Change Version</option>
</select>

</td>
</tr>

<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta charset="UTF-8">
<link rel="stylesheet" href="./styles.css">
<script src="./main.js"></script>
<script type="module" src="./main.js" defer></script>

</head>

Expand All @@ -34,6 +34,17 @@
<td><span id="providerDetails">FDC3 Not Available</span></td>
</tr>

<tr>
<td class="header">FDC3 Supported Version:</td>
<td>1.1 </td>
<td>
<select id="versions" onchange="window.location.href=`../${this.value}`">
<option value="" disabled style="display:none;" selected>Change Version</option>
</select>

</td>
</tr>

<tr>
<td colspan="3">
<hr>
Expand Down Expand Up @@ -132,6 +143,7 @@
</table>
</div>


</body>

</html>
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
// check for FDC3 support
function fdc3OnReady(cb) {
if (window.fdc3) { cb() }
else { window.addEventListener('fdc3Ready', cb) }
import setVersionList from '../versions.js';

function fdc3OnReady(callback) {
let fdc3Tries = 10; //lets not check forever...
const checkFDC3Ready = () => {
if (window.fdc3) {
callback.call(this);
}
else {
if (fdc3Tries > 0) {
fdc3Tries--;
window.setTimeout(checkFDC3Ready, 2000);
}
}
};
checkFDC3Ready();
}


// Wait for the document to load
function documentLoaded(cb) {
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', cb)
} else { cb() }
}

// document and FDC3 have loaded start the main function
documentLoaded(() => fdc3OnReady(main))

// use this to keep track of context listener - one per system channel
let contextListener = null;
let appChannels = []
let appChannels = [];

// document and FDC3 have loaded start the main function
documentLoaded(() => fdc3OnReady(main));


function main() {
try {
Expand Down Expand Up @@ -60,6 +75,9 @@ async function populateHTML() {
getContext(contextType)
}
});

// set the versions of FDC3 Explained in the dropdown
setVersionList()
} catch (error) {
console.error("unable to populate the html for the page ", error);
}
Expand Down
File renamed without changes.
17 changes: 17 additions & 0 deletions toolbox/fdc3-explained/1.2/fdc3_explained_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
146 changes: 146 additions & 0 deletions toolbox/fdc3-explained/1.2/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<html>

<head>
<title>
FDC3 Explained v.2
</title>


<meta charset="UTF-8">
<link rel="stylesheet" href="./styles.css">
<script type="module" src="./main.js" defer></script>

</head>

<body>
<div class="main">
<img id="logo" src="./fdc3_explained_logo.svg">
<table border="1">

<tr>
<td class="header">FDC3 Supported </td>
<td><span id="fdc3-support">Checking</span></td>
</tr>

<tr>
<td class="header">FDC3 Provider Service:</td>
<td><span id="providerDetails">FDC3 Not Available</span></td>
</tr>

<tr>
<td class="header">FDC3 Supported Version:</td>
<td>1.2 </td>
<td>
<select id="versions" onchange="window.location.href=`../${this.value}`">
<option value="" disabled style="display:none;" selected>Change Version</option>
</select>

</td>
</tr>

<tr>
<td colspan="3">
<hr>
</td>
</tr>

<tr>
<td class="header">App Directory:</td>
<td><span id="directoryDetails">Not supported yet!</span></td>
<td><Button class="not-supported" type="button" disabled>Connect</Button></td>
</tr>

<tr>
<td class="header">Available Apps:</td>
<td>
<!-- <textarea disabled></textarea> -->
</td>
<td><Button class="not-supported" type="button" disabled>Fetch</Button></td>
</tr>
<tr>
<td colspan="3">
<hr>
</td>
</tr>

<tr>
<td class="header">Available Channels:</td>
<td>
System Channels:
<ul id="system-channel-list"></ul>
App Channels:
<ul id="app-channel-list"></ul>
</td>
</tr>


<tr>
<td class="header">Add App Channel:</td>
<td><input id="app-channel"></input></td>
<td><Button type="button" id="add-app-channel__btn" disabled>Add</Button></td>
</tr>

<tr>
<td class="header">Join Channel:</td>
<td>Channel: <select class="fdc3-channels" id="join-channel"></select>
<Button type="button" id="join-channel__btn" disabled>Join</Button>
</td>
<td><Button type="button" id="leave-channel__btn" disabled>Leave</Button></td>
</tr>

<tr>
<td colspan="3">
<hr>
</td>
</tr>

<tr>
<td class="header" rowspan="2">Broadcast Context:</td>
</tr>
<tr>
<td><textarea id="txtBroadcastData">{"id":{"ISIN":"US0378331005","SEDOL":"2046251","ticker":"AAPL"},"name":"Apple Inc.","type":"fdc3.instrument"}
</textarea></td>
<td rowspan="2"><Button type="button" id="broadcast__btn" disabled>Send</Button>
</td>
</tr>

<tr>
<td class="header" rowspan="3">Get Context:</td>
</tr>

<tr>
<td>Context Type: <input type="text" id="context-type"></td>
</tr>

<tr>
<td>
<div id="context-result">
<i>Context result will appear here.</i>
</div>
</td>
</tr>

<tr>
<td colspan="3">
<hr>
</td>
</tr>

<tr>
<td class="header" rowspan="3">Raise Intent:</td>
</tr>

<tr>
<td>Intent: <input type="text" id="intent" value="ViewChart"></td>
</tr>

<tr>
<td><textarea id="intent-context">{"id":{"ISIN":"US0378331005","SEDOL":"2046251","ticker":"AAPL"},"name":"Apple Inc.","type":"fdc3.instrument"}</textarea></td>
<td><Button id="raise-intent__btn" disabled>Raise Intent </Button></td>
</tr>

</table>
</div>
</body>

</html>
Loading

0 comments on commit 2353787

Please sign in to comment.