Commit 8ded9ab3 authored by rees_s's avatar rees_s
Browse files

Cleanup to make more consistent with ilkcs-command-tool.

parent b6929643
......@@ -108,7 +108,7 @@
'Footer Footer Footer';
}
#request, #response {
#http-request, #http-response {
width: 98.5%;
height: 100%;
background-color: var( --page-background-color );
......@@ -116,7 +116,7 @@
margin: 0.5rem;
}
#response {
#http-response {
/*noinspection CssInvalidPropertyValue*/
white-space: break-spaces;
overflow-y: auto;
......@@ -373,12 +373,12 @@
<div class="HttpRequest">
<h4>HTTP Request</h4>
<div id="request">&nbsp;</div>
<div id="http-request">&nbsp;</div>
</div>
<div class="HttpResponse">
<h4>HTTP Response</h4>
<div id="response">&nbsp;</div>
<div id="http-response">&nbsp;</div>
</div>
<div class="Footer">
......@@ -398,12 +398,12 @@
const serverUrl="https://gfa-ilk-dev.psi.ch:9443";
const facilitySelectorEle = document.getElementById( 'facility-select' );
const moduleSelectorEle = document.getElementById( 'module-select' );
const inputSelectorEle = document.getElementById( 'module-input-select');
const outputSelectorEle = document.getElementById( 'module-output-select');
const moduleInputSelectorEle = document.getElementById( 'module-input-select');
const moduleOutputSelectorEle = document.getElementById( 'module-output-select');
const sectionSelectorEle = document.getElementById( 'section-select');
const iocSelectorEle = document.getElementById( 'ioc-select' );
const requestEle = document.getElementById( 'request' );
const responseEle = document.getElementById( 'response' );
const requestEle = document.getElementById( 'http-request' );
const responseEle = document.getElementById( 'http-response' );
async function fetchInformation_( event )
{
......@@ -414,8 +414,8 @@
{
if ( event.target.selectedIndex === 0 )
{
removeSelectWidgetOptions( inputSelectorEle );
removeSelectWidgetOptions( outputSelectorEle );
removeSelectWidgetOptions( moduleInputSelectorEle );
removeSelectWidgetOptions( moduleOutputSelectorEle );
removeSelectWidgetOptions( moduleSelectorEle );
removeSelectWidgetOptions( sectionSelectorEle);
removeSelectWidgetOptions( iocSelectorEle );
......@@ -440,8 +440,8 @@
{
if ( event.target.selectedIndex === 0 ) {
removeSelectWidgetOptions( inputSelectorEle );
removeSelectWidgetOptions( outputSelectorEle );
removeSelectWidgetOptions( moduleInputSelectorEle );
removeSelectWidgetOptions( moduleOutputSelectorEle );
setButtonEnableState( "module-input query-button", false );
setButtonEnableState( "module-output query-button", false );
}
......@@ -450,10 +450,10 @@
const facility = facilitySelectorEle.value;
const module = moduleSelectorEle.value;
getFacilityData( facility, "/modules/" + module + "/inputs?detail=inputSignalNames", "Module Input" ).then( json => {
configureSelectWidget( extractJsonFieldToList( json, "ok" ), inputSelectorEle, "Input", facility, "Module Input" )
configureSelectWidget( extractJsonFieldToList( json, "ok" ), moduleInputSelectorEle, "Input", facility, "Module Input" )
} );
getFacilityData( facility, "/modules/" + module + "/outputs?detail=outputSignalNames", "Module Output" ).then( json => {
configureSelectWidget( extractJsonFieldToList( json, "ok" ), outputSelectorEle, "Output", facility, "Module Output" )
configureSelectWidget( extractJsonFieldToList( json, "ok" ), moduleOutputSelectorEle, "Output", facility, "Module Output" )
} );
setButtonEnableState( "module-input query-button", true );
setButtonEnableState( "module-output query-button", true );
......@@ -505,7 +505,7 @@
{
const moduleId = moduleSelectorEle.value;
const requestUrl = serverUrl + "/facilities/" + facilitySelectorEle.value + "/modules/" + moduleId + event.currentTarget.value;
requestEle.textContent = requestUrl;
requestEle.textContent = "GET=" + requestUrl;
fetch( requestUrl ).then( resp => { return resp.text() } )
.then( resp => {
console.log( resp );
......@@ -517,7 +517,7 @@
function getInputInfo( event )
{
const moduleId = moduleSelectorEle.value;
const inputId = inputSelectorEle.value;
const inputId = moduleInputSelectorEle.value;
const requestUrl = serverUrl + "/facilities/" + facilitySelectorEle.value + "/modules/" + moduleId + "/inputs/" + inputId + encodeURIComponent( event.currentTarget.value );
requestEle.textContent = requestUrl;
fetch( requestUrl ).then( resp => { return resp.text() } )
......@@ -531,7 +531,7 @@
function getOutputInfo( event )
{
const moduleId = moduleSelectorEle.value;
const outputId = outputSelectorEle.value;
const outputId = moduleOutputSelectorEle.value;
const requestUrl = serverUrl + "/facilities/" + facilitySelectorEle.value + "/modules/" + moduleId + "/outputs/" + outputId + encodeURIComponent( event.currentTarget.value );
requestEle.textContent = requestUrl;
fetch( requestUrl ).then( resp => { return resp.text() } )
......@@ -558,16 +558,6 @@
return fetch( requestUrl ).then( resp => resp.json() );
}
// function extractJsonFieldToMap( jsonDataObj, fieldName )
// {
// const outputObj = {};
// Object.keys( jsonDataObj ).forEach( key => {
// const newObj = extractFieldToList( jsonDataObj[ key] , fieldName );
// outputObj.push( newObj );
// } );
// return outputObj;
// }
function extractJsonFieldToList( jsonDataObj, fieldName )
{
const outputObj = [];
......@@ -662,8 +652,8 @@
addSelectWidgetButtonStateReflector( sectionSelectorEle, "section query-button" );
addSelectWidgetButtonStateReflector( iocSelectorEle, "ioc query-button" );
addSelectWidgetButtonStateReflector( moduleSelectorEle, "module query-button" );
addSelectWidgetButtonStateReflector( inputSelectorEle, "module-input query-button" );
addSelectWidgetButtonStateReflector( outputSelectorEle, "module-output query-button" );
addSelectWidgetButtonStateReflector( moduleInputSelectorEle, "module-input query-button" );
addSelectWidgetButtonStateReflector( moduleOutputSelectorEle, "module-output query-button" );
facilitySelectorEle.value = "Please select";
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment