From 21ae62c85887926aa9db9eda80e5e0e79ae7e8de Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Mon, 13 Feb 2023 17:49:01 +0100 Subject: [PATCH 01/33] Update of optoboard_felix pointer --- itk_demo_optoboard/optoboard_felix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itk_demo_optoboard/optoboard_felix b/itk_demo_optoboard/optoboard_felix index 4280793..902042b 160000 --- a/itk_demo_optoboard/optoboard_felix +++ b/itk_demo_optoboard/optoboard_felix @@ -1 +1 @@ -Subproject commit 4280793829fe7d6d95c257cce08131f3e4be22ed +Subproject commit 902042b5f200b6fe09305feebacad9ee0b4f4629 -- GitLab From 8a7ba414757bb5b00d60f22751dbd11e5d13fa4f Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Tue, 14 Feb 2023 09:56:03 +0100 Subject: [PATCH 02/33] WIP: major GUI change and code simplification --- itk_demo_optoboard/app_factory.py | 45 +- itk_demo_optoboard/celeryTasks.py | 166 +++++- itk_demo_optoboard/routes.py | 28 +- openapi/openapi.yaml | 84 ++- ui/package.json | 1 + ui/src/Controls/Config.js | 19 +- ui/src/Controls/Diagnosis.js | 892 +++++++++++++++------------- ui/src/Controls/OptoStatus.js | 14 +- ui/src/Controls/WriteRead.js | 4 +- ui/src/Controls/WriteReadBox.js | 519 +++++++++------- ui/src/SimpleTabs/AddOptoboard.js | 369 ++++++++++++ ui/src/SimpleTabs/Configurations.js | 150 ++++- ui/src/SimpleTabs/MyContext.js | 32 +- ui/src/SimpleTabs/OptoboardList.js | 648 +++++++++----------- ui/src/SimpleTabs/SimplePanel.js | 92 ++- ui/src/SimpleTabs/SimpleTabs.js | 202 ++++--- ui/src/SimpleTabs/lpGBT_pannel.js | 606 +++++++++++-------- 17 files changed, 2391 insertions(+), 1480 deletions(-) create mode 100644 ui/src/SimpleTabs/AddOptoboard.js diff --git a/itk_demo_optoboard/app_factory.py b/itk_demo_optoboard/app_factory.py index 559a40e..b76627d 100644 --- a/itk_demo_optoboard/app_factory.py +++ b/itk_demo_optoboard/app_factory.py @@ -7,6 +7,7 @@ from flask_cors import CORS ### from flask import after_this_request, jsonify from celery import Celery + ### @@ -36,29 +37,28 @@ def create_app(): ProblemException, connexion_error_response ) # validation-errors + # create the app flask_app = app.app CORS(flask_app) - - # @flask_app.route("/", defaults={"path": ""}) - #@flask_app.route("/<path:path>") -# def catch_all(path): -# return flask_app.send_static_file("index.html") + # @flask_app.route("/<path:path>") + #@flask_app.route("/", defaults={"path": ""}) + #def catch_all(path): + # return flask_app.send_static_file("index.html") with app.app.app_context(): app.add_api("openapi.yaml") flask_app.config.update( - CELERY_BROKER_URL='amqp://guest@localhost//', - CELERY_RESULT_BACKEND='rpc://guest@localhost//' + CELERY_BROKER_URL="amqp://guest@localhost//", + CELERY_RESULT_BACKEND="rpc://guest@localhost//", ) - proxied = ReverseProxied(flask_app.wsgi_app, script_name="/optoboard/api/") + proxied = ReverseProxied(flask_app.wsgi_app, script_name="/optoboard/api/") flask_app.wsgi_app = proxied - -### -### + ### + ### # with app.app.app_context(): # @flask_app.route("/testCelery", methods=['GET','POST']) # def testCelery(): @@ -69,27 +69,31 @@ def create_app(): # resultWait = result.wait() # print("After wait") # return resultWait - -### + + ### return app -#celery = make_celery(flask_app) + + +# celery = make_celery(flask_app) + def make_celery(): celery = Celery( __name__, - backend='rpc://guest@localhost//', - broker='amqp://guest@localhost//', - include = ["itk_demo_optoboard.celeryTasks"] + backend="rpc://guest@localhost//", + broker="amqp://guest@localhost//", + include=["itk_demo_optoboard.celeryTasks"], ) return celery + def init_celery(celery, app): - #celery = Celery( + # celery = Celery( # app.import_name, # backend=app.config['CELERY_RESULT_BACKEND'], # broker=app.config['CELERY_BROKER_URL'] - #) + # ) celery.conf.update(app.config) class ContextTask(celery.Task): @@ -161,6 +165,3 @@ class ReverseProxied: if server: environ["HTTP_HOST"] = server return self.app(environ, start_response) - - - diff --git a/itk_demo_optoboard/celeryTasks.py b/itk_demo_optoboard/celeryTasks.py index 9093739..34135a5 100644 --- a/itk_demo_optoboard/celeryTasks.py +++ b/itk_demo_optoboard/celeryTasks.py @@ -4,8 +4,12 @@ import json import sys from collections import OrderedDict -sys.path.append(os.getcwd() + '/itk_demo_optoboard/optoboard_felix') -from additional_driver.DB_access import configDbUnavailable, getConfigDataset, checkAvailableDatasetInDB +sys.path.append(os.getcwd() + "/itk_demo_optoboard/optoboard_felix") +from additional_driver.DB_access import ( + configDbUnavailable, + getConfigDataset, + checkAvailableDatasetInDB, +) from driver.Optoboard import Optoboard from driver.log import logger, ch from driver.Comm_wrapper import Comm_wrapper @@ -13,9 +17,84 @@ from driver.components import components ### initialize the optoboard object + @celery.task() -def initializeOptoboardTasks(optoboard_serial, config_path, vtrx_v, flx_G, flx_d, woflxcore, CONFIGDB_ADDRESS, configInDB, debug, testmode): +def initOptoListTask(optoboard_list): + global optoboard_dic + global opto_info_dic + optoboard_dic = {} + opto_info_dic = {} + for x in optoboard_list["optoList"]: + + if x["serialNumber"] in components.keys(): + + opto_info_dic[x["Position"]] = {} + + ######### Provide the component dataset + components_opto = OrderedDict(components[x["serialNumber"]]) + opto_info_dic[x["Position"]]["components"] = components_opto + + if not x["inDBCheckBox"]: + if x["ConfigurationPath"]!="": + configuration_path = os.getcwd() + "/itk_demo_optoboard/optoboard_felix/configs/optoboard"+ str(components_opto["optoboard_v"]) + "_lpgbtv" + str(components_opto["lpgbt_v"]) + "_gbcr" + str(components_opto["gbcr_v"]) + "_vtrxv" + vtrx_v_string + "_default.json" + else: + configuration_path = os.getcwd() + x["ConfigurationPath"] + with open(configuration_path) as f: + try: + config_file = json.load(f) + logger.info("Initialising config from %s", x["ConfigurationPath"]) + except: + raise Exception("Unavailable local configuration file!") + else: + if configDbUnavailable(x["ConfigurationDB"]): + raise Exception("Unavailable configuration database") + else: + config_file = getConfigDataset() + + ######### Initialize the communication wrapper + Communication_wrapper = Comm_wrapper( + flx_G=x["flx_G"], + flx_d=x["flx_d"], + lpgbt_master_addr=components_opto["lpgbt_master_addr"], + lpgbt_v=components_opto["lpgbt_v"], + woflxcore=x["withoutFelixcore"], + test_mode=x["testmode"], + ) + + ######### Initialize the optoboard + optoboard_dic[x["Position"]] = Optoboard( + config_file, + x["serialNumber"], + x["vtrxVersion"], + components_opto, + Communication_wrapper, + x["debugCheckBox"], + ) + logger.info("Optoboard in position " + x["Position"] + " has been added!") + logger.warn(optoboard_dic) + return opto_info_dic + +@celery.task() +def statusCheckTasks(optoboardPosition): + optoboard_dic[optoboardPosition].opto_doc() + return {"status": "1111"} + + +@celery.task() +def initializeOptoboardTasks( + optoboard_serial, + config_path, + vtrx_v, + flx_G, + flx_d, + woflxcore, + CONFIGDB_ADDRESS, + configInDB, + debug, + testmode, +): + ######### Provide the configuration file global glob_config_path glob_config_path = config_path @@ -24,13 +103,14 @@ def initializeOptoboardTasks(optoboard_serial, config_path, vtrx_v, flx_G, flx_d with open(os.getcwd() + config_path) as f: try: config_file = json.load(f) - logger.info('Initialising config from %s', config_path) + logger.info("Initialising config from %s", config_path) except: raise Exception("Unavailable local configuration file!") else: if configDbUnavailable(CONFIGDB_ADDRESS): - raise Exception('Unavailable configuration database') - else: config_file = getConfigDataset() + raise Exception("Unavailable configuration database") + else: + config_file = getConfigDataset() if optoboard_serial in components.keys(): @@ -40,51 +120,78 @@ def initializeOptoboardTasks(optoboard_serial, config_path, vtrx_v, flx_G, flx_d ######### Initialize the communication wrapper global Communication_wrapper - Communication_wrapper = Comm_wrapper(flx_G=flx_G, flx_d=flx_d, lpgbt_master_addr=components_opto['lpgbt_master_addr'], lpgbt_v=components_opto["lpgbt_v"], - woflxcore=woflxcore, test_mode=testmode) + Communication_wrapper = Comm_wrapper( + flx_G=flx_G, + flx_d=flx_d, + lpgbt_master_addr=components_opto["lpgbt_master_addr"], + lpgbt_v=components_opto["lpgbt_v"], + woflxcore=woflxcore, + test_mode=testmode, + ) ######### Initialize the optoboard global optoObject - optoObject = Optoboard(config_file, optoboard_serial, vtrx_v, components_opto, Communication_wrapper, debug) + optoObject = Optoboard( + config_file, + optoboard_serial, + vtrx_v, + components_opto, + Communication_wrapper, + debug, + ) logger.info("The optoboard object 'optoObject' is now available!") return True, optoObject.lpgbt_v, optoObject.activeLpgbt, optoObject.activeGbcr - else: + else: return False, "", "", "" + @celery.task() -def writeReadTasks(device, registerName, fieldName, newValue): +def writeReadTasks(optoboardPosition, device, registerName, fieldName, newValue): RequestStatus = 200 - replyTasks = '' - replyTasks = eval("optoObject." + device).write_read(registerName, fieldName, newValue) - #except Exception as inst: + replyTasks = "" + try: + replyTasks = eval( + 'optoboard_dic["' + optoboardPosition + '"].' + device + ).write_read(registerName, fieldName, newValue) + return replyTasks + except: + return -1 + # except Exception as inst: # if 'Resourses locked: felixcore is probably running!' in inst.args: # RequestStatus = 404 # else: # RequestStatus = 500 - return replyTasks#, RequestStatus + # , RequestStatus + @celery.task() -def readTasks(device, registerName, fieldName): - replyTasks = eval("optoObject." + device).read(registerName, fieldName) - return replyTasks +def readTasks(optoboardPosition, device, registerName, fieldName): + try: + replyTasks = eval('optoboard_dic["' + optoboardPosition + '"].' + device).read( + registerName, fieldName + ) + return replyTasks + except: + return -1 + @celery.task() def sendRegisterNoReadBackTasks(device, registerName, fieldName, newValue): eval("optoObject." + device).write(registerName, fieldName, newValue) + ### configuration tasks + @celery.task() -def configureTasks(config_path, activeLpgbt, activeGbcr, configInDB): - global optoObject - if config_path != glob_config_path: - optoObject = Optoboard(config_file, optoObject.optoboard_serial, optoObject.vtrx_v, components_opto, Communication_wrapper, optoObject.debug) +def configureTasks(optoboardPosition, activeLpgbt, activeGbcr): try: - optoObject.configure(activeLpgbt, activeGbcr) + optoboard_dic[optoboardPosition].configure(activeLpgbt, activeGbcr) return "Optoboard configuration completed" - except: + except: + logger.warn("Failed configuring!") return "Optoboard configuration failed" @@ -92,13 +199,18 @@ def configureTasks(config_path, activeLpgbt, activeGbcr, configInDB): def set_I2C_settingsTasks(): optoObject.lpgbt1.configure_I2C_controller() + ### task for BER test + @celery.task() def BERT_Tasks(device, BERTSOURCE_G, BERTSOURCE_C, BERTMEASTIME): - BERT_result = eval('optoObject.' + device).bert(BERTSOURCE_G, BERTSOURCE_C, BERTMEASTIME) + BERT_result = eval("optoObject." + device).bert( + BERTSOURCE_G, BERTSOURCE_C, BERTMEASTIME + ) return BERT_result + ### read current state of sensors on the optoboard """ @@ -109,10 +221,12 @@ def testCharacteristicsTasks(device): return replyTasks """ + @celery.task() def configDbUnavailableTasks(CONFIGDB_ADDRESS): return configDbUnavailable(CONFIGDB_ADDRESS) - + + @celery.task() def checkAvailableDatasetInDBTasks(path, inDB, CONFIGDB_ADDRESS): return checkAvailableDatasetInDB(path, inDB, CONFIGDB_ADDRESS) diff --git a/itk_demo_optoboard/routes.py b/itk_demo_optoboard/routes.py index 80a53ef..25512f6 100644 --- a/itk_demo_optoboard/routes.py +++ b/itk_demo_optoboard/routes.py @@ -29,7 +29,20 @@ def health(): con = {"status": 200} return con, 200, {'content-type': 'application/json'} +def sendOptoList(): + payload = request.get_json() + opto_info_dic = initOptoListTask.delay(payload).wait() + + return opto_info_dic, 200, {'content-type': 'application/json'} + +def statuscheck(): + payload = request.get_json() + optoboardPosition = payload[optoboardPosition] + status = statusCheckTask.delay(optoboardPosition).wait() + return status, 200, {'content-type': 'application/json'} + + def initializeOptoboard_wrapper(): payload = request.get_json() @@ -129,22 +142,24 @@ def write_read_wrapper(): payload = request.get_json() + optoboardPosition = str(payload["optoboardPosition"]) device = str(payload["device"]) register = str(payload["register"]) newValue = int(payload["newValue"], 16) - read_back = writeReadTasks.delay(device, register.upper(), None, newValue).wait() - #print("AAA", RequestStatus) + read_back = writeReadTasks.delay(optoboardPosition, device, register.upper(), None, newValue).wait() return read_back, {'content-type': 'application/json'} def read_wrapper(): payload = request.get_json() + optoboardPosition = str(payload["optoboardPosition"]) device = str(payload["device"]) register = str(payload["register"]) - - read_back = readTasks.delay(device, register.upper(), None).wait() + + read_back = readTasks.delay(optoboardPosition, device, register.upper(), None).wait() + #read_back = readTasks.delay("OB0", "lpgbt1", "ROM", None).wait() return read_back, 200, {'content-type': 'application/json'} @@ -165,14 +180,13 @@ def set_I2C_settings_wrapper(): def configure_wrapper(): payload = request.get_json() - config_path = str(payload["config_path"]) + optoboardPosition = str(payload["optoboardPosition"]) activeLpgbt = str(payload["activeLpgbt"]) activeGbcr = str(payload["activeGbcr"]) - configInDB = bool(payload["loadFromConfigDB"]) if activeLpgbt=="None": activeLpgbt=None if activeGbcr=="None": activeGbcr=None - reply = configureTasks.delay(config_path, activeLpgbt, activeGbcr, configInDB).wait() + reply = configureTasks.delay(optoboardPosition, activeLpgbt, activeGbcr).wait() return reply, 200, {'content-type': 'application/json'} #{"reply": reply} diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index 09af242..cda1ccb 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -8,7 +8,7 @@ info: email: dalsanto.daniele@cern.ch/roman.mueller@cern.ch servers: - - url: http://localhost:5000 + - url: http://localhost:5009 description: This is a dummy value describing the base URL for the API. paths: @@ -29,6 +29,58 @@ paths: type: object allOf: - $ref: '#/components/schemas/standard_model' + + /sendOptoList: + post: + summary: Endpoint which defines the list of optoboards + x-openapi-router-controller: itk_demo_optoboard.routes + operationId: sendOptoList + requestBody: + description: json serialized object containing data to specify the requested component + content: + application/json: + schema: + type: object + properties: + optoList: + type: array + items: {} + responses: + 200: + description: Returns a value that signals if successful + content: + application/json: + schema: + type: object + + /statuscheck: + post: + summary: Endpoint which provides information about the status of the optoboard + x-openapi-router-controller: itk_demo_optoboard.routes + operationId: statuscheck + requestBody: + description: json serialized object containing data to specify the requested component + content: + application/json: + schema: + type: object + properties: + optoboardPosition: + type: string + example: "OB0" + description: Unique optoboard position + required: + - optoboardPosition + responses: + 200: + description: Returns a value that signals if successful + content: + application/json: + schema: + type: object + allOf: + - $ref: '#/components/schemas/standard_model' + /testCharacteristics_wrapper: @@ -166,7 +218,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/path_model' + $ref: '#/components/schemas/configure' responses: 200: $ref: '#/components/responses/config_response' @@ -416,35 +468,31 @@ components: required: - device - path_model: + configure: type: object properties: - config_path: + optoboardPosition: type: string - example: "/itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json" + example: "OB0" activeLpgbt: type: string example: "1111" activeGbcr: type: string example: "1111" - ConfigDB: - type: string - example: "localhost/5010" - loadFromConfigDB: - type: boolean - example: false required: - - config_path + - optoboardPosition - activeLpgbt - activeGbcr - - ConfigDB - - loadFromConfigDB sendWriteRequest: type: object properties: + optoboardPosition: + type: string + example: "OB0" + description: Unique position of the optoboard device: type: string example: "lpgbt1master" @@ -458,6 +506,7 @@ components: example: "0" description: New value for the considered setting of the register required: + - optoboardPosition - register - device - newValue @@ -465,15 +514,20 @@ components: sendReadRequest: type: object properties: + optoboardPosition: + type: string + example: "OB0" + description: Unique position of the optoboard device: type: string - example: "lpgbt1master" + example: "lpgbt1" description: Name of the device to which the read/write request is sent register: type: string example: "SomeName" description: Register name required: + - optoboardPosition - register - device diff --git a/ui/package.json b/ui/package.json index 20887f9..6f36b31 100644 --- a/ui/package.json +++ b/ui/package.json @@ -14,6 +14,7 @@ "@types/node": "^12.20.37", "@types/react": "^17.0.37", "@types/react-dom": "^17.0.11", + "json-loader": "^0.5.7", "react": "^17.0.2", "react-dom": "^17.0.2", "react-scripts": "4.0.3", diff --git a/ui/src/Controls/Config.js b/ui/src/Controls/Config.js index 6b08986..f8bb6ff 100644 --- a/ui/src/Controls/Config.js +++ b/ui/src/Controls/Config.js @@ -12,7 +12,7 @@ import { } from "@patternfly/react-core"; import { getPostBody, checkResponse } from '../utils/utility-functions' -function Config(){ +function Config({backendUrl, optoboardPosition}){ const [isLoading, setisLoading] = useState(false); const [switchState, setswitchState] = useState(false); const [CheckBox_lpgbt1, toggleBox_lpgbt1] = useState(true); @@ -23,26 +23,29 @@ function Config(){ const [CheckBox_gbcr2, toggleBox_gbcr2] = useState(true); const [CheckBox_gbcr3, toggleBox_gbcr3] = useState(true); const [CheckBox_gbcr4, toggleBox_gbcr4] = useState(true); + const [buttonVariant, setbuttonVariant] = useState("primary"); const configure = () => { - console.log("Starting configuration of the Optoboard!") let body={} if (switchState) { body = { - activeLpgbt: (this.state.CheckBox_lpgbt1 ? "1":"0") + (this.state.CheckBox_lpgbt2 ? "1":"0") + (this.state.CheckBox_lpgbt3 ? "1":"0") + (this.state.CheckBox_lpgbt4 ? "1":"0"), - activeGbcr: (this.state.CheckBox_gbcr1 ? "1":"0") + (this.state.CheckBox_gbcr2 ? "1":"0") + (this.state.CheckBox_gbcr3 ? "1":"0") + (this.state.CheckBox_gbcr4 ? "1":"0"), + optoboardPosition: optoboardPosition, + activeLpgbt: (CheckBox_lpgbt1 ? "1":"0") + (CheckBox_lpgbt2 ? "1":"0") + (CheckBox_lpgbt3 ? "1":"0") + (CheckBox_lpgbt4 ? "1":"0"), + activeGbcr: (CheckBox_gbcr1 ? "1":"0") + (CheckBox_gbcr2 ? "1":"0") + (CheckBox_gbcr3 ? "1":"0") + (CheckBox_gbcr4 ? "1":"0"), } } else { body = { + optoboardPosition: optoboardPosition, activeLpgbt: "None", activeGbcr: "None", } }; setisLoading(true); + console.log("Starting configuration of the Optoboard!"); console.log(body); - fetch(`${this.props.backendUrl}/configure`, getPostBody(body)).then( - (response) => checkResponse(response)).then((data) => {console.log(data); setisLoading(false);}); + fetch(`${backendUrl}/configure`, getPostBody(body)).then( + (response) => checkResponse(response)).then((data) => {console.log(data); setisLoading(false); if (data === "Optoboard configuration failed") {setbuttonVariant("warning")} else {setbuttonVariant("primary")}}); //if (data == "Optoboard configuration completed") { EnableI2C(); DataSet(this.state.pathToJson, this.state.vtrxVersionValue, this.state.inDBCheckBox) }; //});.catch(err => {this.setState({isLoading: false});}); @@ -61,7 +64,7 @@ function Config(){ <React.Fragment> <Flex direction={{ default: 'column' }}> - <Panel variant="raised"> + <Panel variant=""> <PanelMain> <PanelMainBody> @@ -71,7 +74,7 @@ function Config(){ spinnerAriaValueText={isLoading ? 'Loading' : undefined} isLoading={isLoading} id="readCharacteristics" - variant={"primary"} + variant={buttonVariant} onClick={(event) => { configure(); }} diff --git a/ui/src/Controls/Diagnosis.js b/ui/src/Controls/Diagnosis.js index d8b1e38..00a5e33 100644 --- a/ui/src/Controls/Diagnosis.js +++ b/ui/src/Controls/Diagnosis.js @@ -7,8 +7,8 @@ import { Dropdown, DropdownToggle, DropdownItem, - FormSelect, - FormSelectOption, + FormSelect, + FormSelectOption, FormSelectOptionGroup, Text, TextInput, @@ -22,7 +22,7 @@ import { PanelHeader, SidebarContent, Sidebar, - Flex, + Flex, FlexItem, Grid, GridItem, @@ -30,269 +30,329 @@ import { Tooltip, } from "@patternfly/react-core"; -import { getPostBody, checkResponse } from '../utils/utility-functions' +import { getPostBody, checkResponse } from "../utils/utility-functions"; import { FormSelectInputNewer } from "../Widgets/FormSelectInput"; - class WriteRead4User extends React.Component { - constructor(props) { - super(props); - this.state = { - - device_val : 0, - device : [ - { label: 'lpgbt1', disabled: false, value: '0'}, - { label: 'lpgbt2', disabled: false, value: '1'}, - { label: 'lpgbt3', disabled: false, value: '2'}, - { label: 'lpgbt4', disabled: false, value: '3'}, - { label: 'gbcr1', disabled: false, value: '4'}, - { label: 'gbcr2', disabled: false, value: '5'}, - { label: 'gbcr3', disabled: false, value: '6'}, - { label: 'gbcr4', disabled: false, value: '7'}, - ], - - value_read : "", - reg_write : "", - value_write : "", - read_back_read: "", - read_back_write: "", - }; - - this.onChange_device = (device_val) => { - this.setState({ device_val : device_val }); - console.log(device_val); - }; - - this.handleTextInputChange = value_read => { - this.setState({ value_read }); - }; - this.handleTextInputChange2 = reg_write => { - this.setState({ reg_write }); - }; - this.handleTextInputChange3 = value_write => { - this.setState({ value_write }); - }; - this.handleReadBack = data => { - this.setState({...this.state, read_back_read : data}); - }; - this.handleWriteReadBack = data => { - this.setState({...this.state, read_back_write : data}); - }; - this.read_device = (reg_address) => { - //var re = /[0-9A-Fa-f]{6}/g; - const requestData = { - register: reg_address, - device: this.state.device[this.state.device_val].label, - } - - console.log(requestData) - fetch(`${this.props.backendUrl}/sendReadRequest`, getPostBody(requestData)).then((response) => checkResponse(response)).then((data) => {console.log(data); this.handleReadBack(data)} - ).catch(err => {console.log(err)}); - }; - this.write_device = (reg_address,new_reg_value) => { - const requestData = { - device: this.state.device[this.state.device_val].label, - register: reg_address, - newValue: new_reg_value, - } - - console.log(requestData) - fetch(`${this.props.backendUrl}/sendWriteRequest`, getPostBody(requestData)).then((response) => checkResponse(response)).then((data) => {console.log(data); this.handleWriteReadBack(data)} - ).catch(err => {console.log(err)}); - }; - }; - - - render (){ - - return( - <React.Fragment> - - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Grid> - <Bullseye> - <GridItem span={7}> - <Bullseye> - <h4> Select the device: </h4> - </Bullseye> - </GridItem> - - <GridItem span={5}> - <Bullseye> - <FormSelectInputNewer id={"selectDeviceSimplePanelRead"} items={this.state.device} value={this.state.device_val} onChange={this.onChange_device}/> - </Bullseye> - </GridItem> - </Bullseye> - </Grid> - - </PanelMainBody> - </PanelMain> - </Panel> - - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Grid> - - <Bullseye> - <GridItem span={8}> - <Bullseye> - <Tooltip content={ <div>Use rom register for testing. In lpgbt v1 the return has to be 166. </div> }> - <Button id="read_reg_send_command" variant="primary" onClick={() => this.read_device(this.state.value_read)}> - <h3> Read register </h3> - </Button> - </Tooltip> - </Bullseye> - </GridItem> - </Bullseye> - - - <GridItem span={6}> - <Bullseye> - <h4>Address (hex)</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextInput id="read_input" name="read_input" value={this.state.value_read} onChange={this.handleTextInputChange}/> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <h4>Read back value:</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h5}>{this.state.read_back_read}</Text> - </TextContent> - </Bullseye> - </GridItem> - - </Grid> - - </PanelMainBody> - </PanelMain> - </Panel> - - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Grid> - - <Bullseye> - <GridItem span={8} rowSpan={1}> - <Bullseye> - <Button id="write_pri_send_command" variant="primary" onClick={() => this.write_device(this.state.reg_write, this.state.value_write)}> - <h3> Write register </h3> - </Button> - </Bullseye> - </GridItem> - </Bullseye> - - <GridItem span={6}> - <Bullseye> - <h4>Address</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextInput id="write_address" name="write_address" value={this.state.reg_write} onChange={this.handleTextInputChange2}/> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <h4>Value (hex)</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextInput id="write_value" name="write_value" value={this.state.value_write} onChange={this.handleTextInputChange3}/> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <h4>Read back value</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h5}>{this.state.read_back_write}</Text> - </TextContent> - </Bullseye> - </GridItem> - </Grid> - - </PanelMainBody> - </PanelMain> - </Panel> - </React.Fragment> -);}; + constructor(props) { + super(props); + this.state = { + device_val: 0, + device: [ + { label: "lpgbt1", disabled: false, value: "0" }, + { label: "lpgbt2", disabled: false, value: "1" }, + { label: "lpgbt3", disabled: false, value: "2" }, + { label: "lpgbt4", disabled: false, value: "3" }, + { label: "gbcr1", disabled: false, value: "4" }, + { label: "gbcr2", disabled: false, value: "5" }, + { label: "gbcr3", disabled: false, value: "6" }, + { label: "gbcr4", disabled: false, value: "7" }, + ], + + value_read: "", + reg_write: "", + value_write: "", + read_back_read: "", + read_back_write: "", + }; + + this.onChange_device = (device_val) => { + this.setState({ device_val: device_val }); + console.log(device_val); + }; + + this.handleTextInputChange = (value_read) => { + this.setState({ value_read }); + }; + this.handleTextInputChange2 = (reg_write) => { + this.setState({ reg_write }); + }; + this.handleTextInputChange3 = (value_write) => { + this.setState({ value_write }); + }; + this.handleReadBack = (data) => { + this.setState({ ...this.state, read_back_read: data }); + }; + this.handleWriteReadBack = (data) => { + this.setState({ ...this.state, read_back_write: data }); + }; + this.read_device = (reg_address) => { + //var re = /[0-9A-Fa-f]{6}/g; + const requestData = { + register: reg_address, + device: this.state.device[this.state.device_val].label, + }; + + console.log(requestData); + fetch( + `${this.props.backendUrl}/sendReadRequest`, + getPostBody(requestData) + ) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + this.handleReadBack(data); + }) + .catch((err) => { + console.log(err); + }); + }; + this.write_device = (reg_address, new_reg_value) => { + const requestData = { + device: this.state.device[this.state.device_val].label, + register: reg_address, + newValue: new_reg_value, + }; + + console.log(requestData); + fetch( + `${this.props.backendUrl}/sendWriteRequest`, + getPostBody(requestData) + ) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + this.handleWriteReadBack(data); + }) + .catch((err) => { + console.log(err); + }); + }; + } + + render() { + return ( + <React.Fragment> + <Panel variant="bordered"> + <PanelMain> + <PanelMainBody> + <Grid> + <Bullseye> + <GridItem span={7}> + <Bullseye> + <h4> Select the device: </h4> + </Bullseye> + </GridItem> + + <GridItem span={5}> + <Bullseye> + <FormSelectInputNewer + id={"selectDeviceSimplePanelRead"} + items={this.state.device} + value={this.state.device_val} + onChange={this.onChange_device} + /> + </Bullseye> + </GridItem> + </Bullseye> + </Grid> + </PanelMainBody> + </PanelMain> + </Panel> + + <Panel variant="bordered"> + <PanelMain> + <PanelMainBody> + <Grid> + <Bullseye> + <GridItem span={8}> + <Bullseye> + <Tooltip + content={ + <div> + Use rom register for testing. In lpgbt v1 the return + has to be 166.{" "} + </div> + } + > + <Button + id="read_reg_send_command" + variant="primary" + onClick={() => + this.read_device(this.state.value_read) + } + > + <h3> Read register </h3> + </Button> + </Tooltip> + </Bullseye> + </GridItem> + </Bullseye> + + <GridItem span={6}> + <Bullseye> + <h4>Address (hex)</h4> + </Bullseye> + </GridItem> + + <GridItem span={6}> + <Bullseye> + <TextInput + id="read_input" + name="read_input" + value={this.state.value_read} + onChange={this.handleTextInputChange} + /> + </Bullseye> + </GridItem> + + <GridItem span={6}> + <Bullseye> + <h4>Read back value:</h4> + </Bullseye> + </GridItem> + + <GridItem span={6}> + <Bullseye> + <TextContent> + <Text component={TextVariants.h5}> + {this.state.read_back_read} + </Text> + </TextContent> + </Bullseye> + </GridItem> + </Grid> + </PanelMainBody> + </PanelMain> + </Panel> + + <Panel variant="bordered"> + <PanelMain> + <PanelMainBody> + <Grid> + <Bullseye> + <GridItem span={8} rowSpan={1}> + <Bullseye> + <Button + id="write_pri_send_command" + variant="primary" + onClick={() => + this.write_device( + this.state.reg_write, + this.state.value_write + ) + } + > + <h3> Write register </h3> + </Button> + </Bullseye> + </GridItem> + </Bullseye> + + <GridItem span={6}> + <Bullseye> + <h4>Address</h4> + </Bullseye> + </GridItem> + + <GridItem span={6}> + <Bullseye> + <TextInput + id="write_address" + name="write_address" + value={this.state.reg_write} + onChange={this.handleTextInputChange2} + /> + </Bullseye> + </GridItem> + + <GridItem span={6}> + <Bullseye> + <h4>Value (hex)</h4> + </Bullseye> + </GridItem> + + <GridItem span={6}> + <Bullseye> + <TextInput + id="write_value" + name="write_value" + value={this.state.value_write} + onChange={this.handleTextInputChange3} + /> + </Bullseye> + </GridItem> + + <GridItem span={6}> + <Bullseye> + <h4>Read back value</h4> + </Bullseye> + </GridItem> + + <GridItem span={6}> + <Bullseye> + <TextContent> + <Text component={TextVariants.h5}> + {this.state.read_back_write} + </Text> + </TextContent> + </Bullseye> + </GridItem> + </Grid> + </PanelMainBody> + </PanelMain> + </Panel> + </React.Fragment> + ); + } } - - class WriteReadHorizontal extends React.Component { - constructor(props) { - super(props); - this.state = { - value_read : "", - reg_write : "", - value_write : "", - read_back_read: "-_-", - read_back_write: "-_-", - }; - this.handleTextInputChange = value_read => { - this.setState({ value_read }); - }; - this.handleTextInputChange2 = reg_write => { - this.setState({ reg_write }); - }; - this.handleTextInputChange3 = value_write => { - this.setState({ value_write }); - }; - this.handleReadBack = data => { - this.setState({...this.state, read_back_read : data}); - }; - this.handleWriteReadBack = data => { - this.setState({...this.state, read_back_write : data}); - }; - this.read_device = (reg_address) => { - //var re = /[0-9A-Fa-f]{6}/g; - const requestData = { - //fice_G: this.props.fice_g, - //fice_d: this.props.fice_d, - //fice_i: this.props.fice_i, - //fice_I: this.props.fice_I, - //optoboard_serial: this.props.serial, - register: reg_address, - device: this.props.device, - //isMaster: this.props.isMaster, - //i2c_master_val: this.props.i2c_master_val, - } - - console.log(requestData) - fetch(`${this.props.backendUrl}/sendReadRequest`, getPostBody(requestData)).then((response) => checkResponse(response)).then((data) => {console.log(data); this.handleReadBack(data)} - ).catch(err => {console.log(err)}); - }; - this.write_device = (reg_address,new_reg_value) => { - const requestData = { -/* fice_G: this.props.fice_g, + constructor(props) { + super(props); + this.state = { + value_read: "", + reg_write: "", + value_write: "", + read_back_read: "-_-", + read_back_write: "-_-", + }; + this.handleTextInputChange = (value_read) => { + this.setState({ value_read }); + }; + this.handleTextInputChange2 = (reg_write) => { + this.setState({ reg_write }); + }; + this.handleTextInputChange3 = (value_write) => { + this.setState({ value_write }); + }; + this.handleReadBack = (data) => { + this.setState({ ...this.state, read_back_read: data }); + }; + this.handleWriteReadBack = (data) => { + this.setState({ ...this.state, read_back_write: data }); + }; + this.read_device = (reg_address) => { + //var re = /[0-9A-Fa-f]{6}/g; + const requestData = { + //fice_G: this.props.fice_g, + //fice_d: this.props.fice_d, + //fice_i: this.props.fice_i, + //fice_I: this.props.fice_I, + //optoboard_serial: this.props.serial, + register: reg_address, + device: this.props.device, + //isMaster: this.props.isMaster, + //i2c_master_val: this.props.i2c_master_val, + }; + + console.log(requestData); + fetch( + `${this.props.backendUrl}/sendReadRequest`, + getPostBody(requestData) + ) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + this.handleReadBack(data); + }) + .catch((err) => { + console.log(err); + }); + }; + this.write_device = (reg_address, new_reg_value) => { + const requestData = { + /* fice_G: this.props.fice_g, fice_d: this.props.fice_d, fice_i: this.props.fice_i, fice_I: this.props.fice_I, @@ -300,143 +360,179 @@ class WriteReadHorizontal extends React.Component { reg_addr: reg_address, isMaster: this.props.isMaster, i2c_master_val: this.props.i2c_master_val,*/ - device: this.props.device, - register: reg_address, - newValue: new_reg_value, - } - - console.log(requestData) - fetch(`${this.props.backendUrl}/sendWriteRequest`, getPostBody(requestData)).then((response) => checkResponse(response)).then((data) => {console.log(data); this.handleWriteReadBack(data)} - ).catch(err => {console.log(err)}); - }; - }; - - render (){ - const VariableReadBack = "hex_value" - return( - <React.Fragment> - - <Flex> - <FlexItem flex={{ default: 'flex_1' }}> - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Bullseye> - <Flex> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Button id="read_reg_send_command" variant="primary" onClick={() => this.read_device(this.state.value_read)}> - <h3> Read register </h3> - </Button> - </Bullseye> - </FlexItem> - </Flex> - </Bullseye> - - <Flex> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>Address </h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextInput id="read_input" name="read_input" value={this.state.value_read} onChange={this.handleTextInputChange}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_2' }}> - <Bullseye> - <h4>Read back value:</h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h5}>{this.state.read_back_read}</Text> - </TextContent> - </Bullseye> - </FlexItem> - - </Flex> - - </PanelMainBody> - </PanelMain> - </Panel> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Bullseye> - <Flex> - <Bullseye> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Button id="write_pri_send_command" variant="primary" onClick={() => this.write_device(this.state.reg_write, this.state.value_write)}> - <h3> Write register </h3> - </Button> - </Bullseye> - </FlexItem> - </Bullseye> - </Flex> - </Bullseye> - - <Flex> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>Address </h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextInput id="write_address" name="write_address" value={this.state.reg_write} onChange={this.handleTextInputChange2}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>Value </h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextInput id="write_value" name="write_value" value={this.state.value_write} onChange={this.handleTextInputChange3}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_2' }}> - <Bullseye> - <h4>Read back value</h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h5}>{this.state.read_back_write}</Text> - </TextContent> - </Bullseye> - </FlexItem> - </Flex> - - </PanelMainBody> - </PanelMain> - </Panel> - </FlexItem> - - </Flex> - </React.Fragment> -);}; + device: this.props.device, + register: reg_address, + newValue: new_reg_value, + }; + + console.log(requestData); + fetch( + `${this.props.backendUrl}/sendWriteRequest`, + getPostBody(requestData) + ) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + this.handleWriteReadBack(data); + }) + .catch((err) => { + console.log(err); + }); + }; + } + + render() { + const VariableReadBack = "hex_value"; + return ( + <React.Fragment> + <Flex> + <FlexItem flex={{ default: "flex_1" }}> + <Panel variant="bordered"> + <PanelMain> + <PanelMainBody> + <Bullseye> + <Flex> + <FlexItem flex={{ default: "flex_1" }}> + <Bullseye> + <Button + id="read_reg_send_command" + variant="primary" + onClick={() => + this.read_device(this.state.value_read) + } + > + <h3> Read register </h3> + </Button> + </Bullseye> + </FlexItem> + </Flex> + </Bullseye> + + <Flex> + <FlexItem flex={{ default: "flex_1" }}> + <Bullseye> + <h4>Address </h4> + </Bullseye> + </FlexItem> + + <FlexItem flex={{ default: "flex_1" }}> + <Bullseye> + <TextInput + id="read_input" + name="read_input" + value={this.state.value_read} + onChange={this.handleTextInputChange} + /> + </Bullseye> + </FlexItem> + + <FlexItem flex={{ default: "flex_2" }}> + <Bullseye> + <h4>Read back value:</h4> + </Bullseye> + </FlexItem> + + <FlexItem flex={{ default: "flex_1" }}> + <Bullseye> + <TextContent> + <Text component={TextVariants.h5}> + {this.state.read_back_read} + </Text> + </TextContent> + </Bullseye> + </FlexItem> + </Flex> + </PanelMainBody> + </PanelMain> + </Panel> + </FlexItem> + + <FlexItem flex={{ default: "flex_1" }}> + <Panel variant="bordered"> + <PanelMain> + <PanelMainBody> + <Bullseye> + <Flex> + <Bullseye> + <FlexItem flex={{ default: "flex_1" }}> + <Bullseye> + <Button + id="write_pri_send_command" + variant="primary" + onClick={() => + this.write_device( + this.state.reg_write, + this.state.value_write + ) + } + > + <h3> Write register </h3> + </Button> + </Bullseye> + </FlexItem> + </Bullseye> + </Flex> + </Bullseye> + + <Flex> + <FlexItem flex={{ default: "flex_1" }}> + <Bullseye> + <h4>Address </h4> + </Bullseye> + </FlexItem> + + <FlexItem flex={{ default: "flex_1" }}> + <Bullseye> + <TextInput + id="write_address" + name="write_address" + value={this.state.reg_write} + onChange={this.handleTextInputChange2} + /> + </Bullseye> + </FlexItem> + + <FlexItem flex={{ default: "flex_1" }}> + <Bullseye> + <h4>Value </h4> + </Bullseye> + </FlexItem> + + <FlexItem flex={{ default: "flex_1" }}> + <Bullseye> + <TextInput + id="write_value" + name="write_value" + value={this.state.value_write} + onChange={this.handleTextInputChange3} + /> + </Bullseye> + </FlexItem> + + <FlexItem flex={{ default: "flex_2" }}> + <Bullseye> + <h4>Read back value</h4> + </Bullseye> + </FlexItem> + + <FlexItem flex={{ default: "flex_1" }}> + <Bullseye> + <TextContent> + <Text component={TextVariants.h5}> + {this.state.read_back_write} + </Text> + </TextContent> + </Bullseye> + </FlexItem> + </Flex> + </PanelMainBody> + </PanelMain> + </Panel> + </FlexItem> + </Flex> + </React.Fragment> + ); + } } -export {WriteRead4User, WriteReadHorizontal}; +export { WriteRead4User, WriteReadHorizontal }; diff --git a/ui/src/Controls/OptoStatus.js b/ui/src/Controls/OptoStatus.js index 80c11ff..53fbdf0 100644 --- a/ui/src/Controls/OptoStatus.js +++ b/ui/src/Controls/OptoStatus.js @@ -19,7 +19,7 @@ import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclam import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon'; -export function OptoStatus() { +export function OptoStatus({backendUrl, optoboardPosition}) { const [lpgbt1Status, setlpgbt1Status] = useState(0); const [lpgbt2Status, setlpgbt2Status] = useState(0); const [lpgbt3Status, setlpgbt3Status] = useState(0); @@ -55,8 +55,12 @@ export function OptoStatus() { <ExclamationCircleIcon /> </Icon>; - const HealthCheck = () => { - setlpgbt1Status(1); setlpgbt2Status(1); setlpgbt3Status(1); setlpgbt4Status(1); + const StatusCheck = () => { + const requestData = { + optoboardPosition: optoboardPosition + } + fetch(`${backendUrl}/statuscheck`, getPostBody(requestData)).then((response) => checkResponse(response)).then((data) => {console.log(data); setlpgbt1Status(1); setlpgbt2Status(1); setlpgbt3Status(1); setlpgbt4Status(1);} + ).catch(err => {console.log(err)}); }; @@ -96,7 +100,7 @@ export function OptoStatus() { <React.Fragment> <Flex direction={{ default: 'column' }}> - <Panel variant="raised"> + <Panel variant=""> <PanelMain> <PanelMainBody> @@ -107,7 +111,7 @@ export function OptoStatus() { isLoading={isLoading} id="readstatus" variant={"primary"} - onClick={(event) => HealthCheck()} + onClick={(event) => StatusCheck()} > {isLoading ? "Reading..." : "Read Status" } </Button> diff --git a/ui/src/Controls/WriteRead.js b/ui/src/Controls/WriteRead.js index 649392a..3d28f0e 100644 --- a/ui/src/Controls/WriteRead.js +++ b/ui/src/Controls/WriteRead.js @@ -38,8 +38,8 @@ class WriteRead extends React.Component { value_read : "", reg_write : "", value_write : "", - read_back_read: "-_-", - read_back_write: "-_-", + read_back_read: "", + read_back_write: "", }; this.handleTextInputChange = value_read => { this.setState({ value_read }); diff --git a/ui/src/Controls/WriteReadBox.js b/ui/src/Controls/WriteReadBox.js index dd53494..ef98b3c 100644 --- a/ui/src/Controls/WriteReadBox.js +++ b/ui/src/Controls/WriteReadBox.js @@ -1,220 +1,333 @@ import React, { useState, useEffect } from "react"; import { Button, - Checkbox, - InputGroup, - InputGroupText, - Dropdown, - DropdownToggle, - DropdownItem, - FormSelect, - FormSelectOption, - FormSelectOptionGroup, - Text, TextInput, - TextContent, - TextVariants, - Form, - FormGroup, PanelMainBody, PanelMain, Panel, - PanelHeader, - SidebarContent, - Sidebar, - Flex, + Flex, FlexItem, - Grid, - GridItem, Bullseye, Tooltip, + Select, + SelectOption, + SelectVariant, } from "@patternfly/react-core"; -import { getPostBody, checkResponse } from '../utils/utility-functions' +import { getPostBody, checkResponse } from "../utils/utility-functions"; import { FormSelectInputNewer } from "../Widgets/FormSelectInput"; -function WriteReadBox(){ - const [device_val, setdevice_val] = useState(0); - const device = [ - { label: 'lpgbt1', disabled: false, value: '0'}, - { label: 'lpgbt2', disabled: false, value: '1'}, - { label: 'lpgbt3', disabled: false, value: '2'}, - { label: 'lpgbt4', disabled: false, value: '3'}, - { label: 'gbcr1', disabled: false, value: '4'}, - { label: 'gbcr2', disabled: false, value: '5'}, - { label: 'gbcr3', disabled: false, value: '6'}, - { label: 'gbcr4', disabled: false, value: '7'}, - ]; - const [value_read, setvalue_read] = useState(""); - const [reg_write, setreg_write] = useState(""); - const [value_write, setvalue_write] = useState(""); - const [read_back_read, setread_back_read] = useState(""); - const [read_back_write, setread_back_write] = useState(""); - - const read_device = (reg_address) => { - //var re = /[0-9A-Fa-f]{6}/g; - const requestData = { - register: reg_address, - device: device[device_val].label, - } - fetch(`${this.props.backendUrl}/sendReadRequest`, getPostBody(requestData)).then((response) => checkResponse(response)).then((data) => {console.log(data); this.handleReadBack(data)} - ).catch(err => {console.log(err)}); - }; - const write_device = (reg_address,new_reg_value) => { - const requestData = { - device: device[device_val].label, - register: reg_address, - newValue: new_reg_value, - } - fetch(`${this.props.backendUrl}/sendWriteRequest`, getPostBody(requestData)).then((response) => checkResponse(response)).then((data) => {console.log(data); this.handleWriteReadBack(data)} - ).catch(err => {console.log(err)}); - }; - - return( - <React.Fragment> - - <Panel variant="raised"> - <PanelMain> - <PanelMainBody> - - <Bullseye> - <Flex> - <Bullseye> - <FlexItem> - <Bullseye> - <h4> Select the device: </h4> - </Bullseye> - </FlexItem> - - <FlexItem> - <Bullseye> - <FormSelectInputNewer id={"selectDeviceSimplePanelRead"} items={device} value={device_val} onChange={x => setdevice_val(x)}/> - </Bullseye> - </FlexItem> - </Bullseye> - </Flex> - </Bullseye> - - </PanelMainBody> - </PanelMain> - </Panel> - - <Panel variant="raised"> - <PanelMain> - <PanelMainBody> - - <Bullseye> - <Flex> - - <Bullseye> - <FlexItem> - <Bullseye> - <Tooltip content={ <div>Use rom register for testing. In lpgbt v1 the return has to be 166. </div> }> - <Button id="read_reg_send_command" variant="primary" onClick={() => read_device(value_read)}> - <h3> Read register </h3> - </Button> - </Tooltip> - </Bullseye> - </FlexItem> - </Bullseye> - - <FlexItem> - <Bullseye> - <h4>Read back: {read_back_read}</h4> - </Bullseye> - </FlexItem> - - </Flex> - </Bullseye> - <Bullseye> - <Flex> - <FlexItem> - <Bullseye> - <h4>Address (hex)</h4> - </Bullseye> - </FlexItem> - - <FlexItem> - <Bullseye> - <TextInput id="read_input" name="read_input" value={value_read} onChange={x => setvalue_read(x)}/> - </Bullseye> - </FlexItem> - - - </Flex> - </Bullseye> - - </PanelMainBody> - </PanelMain> - </Panel> - - <Panel variant="raised"> - <PanelMain> - <PanelMainBody> - - <Bullseye> - <Flex> - - <Bullseye> - <FlexItem> - <Bullseye> - <Button id="write_pri_send_command" variant="primary" onClick={() => write_device(reg_write, value_write)}> - <h3> Write register </h3> - </Button> - </Bullseye> - </FlexItem> - </Bullseye> - - <FlexItem> - <Bullseye> - <h4>Read back: {read_back_write}</h4> - </Bullseye> - </FlexItem> - - </Flex> - </Bullseye> - <Bullseye> - <Flex> - <FlexItem> - <Bullseye> - <h4>Address</h4> - </Bullseye> - </FlexItem> - - <FlexItem> - <Bullseye> - <TextInput id="write_address" name="write_address" value={reg_write} onChange={x => setreg_write(x)}/> - </Bullseye> - </FlexItem> - - </Flex> - </Bullseye> - <Bullseye> - <Flex> - - <FlexItem> - <Bullseye> - <h4>Value (hex)</h4> - </Bullseye> - </FlexItem> - - <FlexItem> - <Bullseye> - <TextInput id="write_value" name="write_value" value={value_write} onChange={x => setvalue_write(x)}/> - </Bullseye> - </FlexItem> - - </Flex> - </Bullseye> - - </PanelMainBody> - </PanelMain> - </Panel> - </React.Fragment> -) -}; - -export {WriteReadBox}; +export function WriteReadBox({ backendUrl, optoboardPosition }) { + + const [device_val, setdevice_val] = useState(0); + const device = [ + { label: "lpgbt1", disabled: false, value: "0" }, + { label: "lpgbt2", disabled: false, value: "1" }, + { label: "lpgbt3", disabled: false, value: "2" }, + { label: "lpgbt4", disabled: false, value: "3" }, + { label: "gbcr1", disabled: false, value: "4" }, + { label: "gbcr2", disabled: false, value: "5" }, + { label: "gbcr3", disabled: false, value: "6" }, + { label: "gbcr4", disabled: false, value: "7" }, + ]; + // functions to read a register from the Optoboard + const [reg_read, setreg_read] = useState(""); + const [read_back_read, setread_back_read] = useState(""); + const [isOpenRead, setisOpenRead] = useState(false); + const onSelectRead = (event, select, isPlaceholder) => { + if (isPlaceholder) { + clearSelectionRead(); + } else { + setreg_read(select); + setisOpenRead(false); + console.log("selected:", select); + } + }; + const clearSelectionRead = () => { + console.log("cancel input/selection"); + setreg_read(""); + setisOpenRead(false); + }; + + // function to implement the filter of the registers + const optionsRead = [ + <SelectOption key={0} value="Alabama" />, + <SelectOption key={1} value="Florida" />, + <SelectOption key={2} value="New Jersey" />, + <SelectOption key={3} value="New Mexico" />, + <SelectOption key={4} value="New York" />, + <SelectOption key={5} value="North Carolina" />, + ]; + + const customFilterRead = (_, value) => { + if (!value) { + return optionsRead; + } + const input = new RegExp(value, "i"); + return optionsRead.filter((child) => input.test(child.props.value)); + }; + + const read_device = (reg_address) => { + //var re = /[0-9A-Fa-f]{6}/g; + const requestData = { + optoboardPosition: optoboardPosition, + register: reg_address, + device: device[device_val].label, + }; + fetch(`${backendUrl}/sendReadRequest`, getPostBody(requestData)) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + if (data !== -1) { + setbuttonVariantRead("primary"); + setread_back_read(data); + } else { + setbuttonVariantRead("warning"); + } + }) + .catch((err) => { + console.log(err); + }); + }; + + // functions to write a register on the Optoboard + + const [reg_write, setreg_write] = useState(""); + const [value_write, setvalue_write] = useState(""); + const [read_back_write, setread_back_write] = useState(""); + const [isOpenWrite, setisOpenWrite] = useState(false); + + const [buttonVariantRead, setbuttonVariantRead] = useState("primary"); + const [buttonVariantWrite, setbuttonVariantWrite] = useState("primary"); + + const onSelectWrite = (event, select, isPlaceholder) => { + if (isPlaceholder) { + clearSelectionWrite(); + } else { + setreg_write(select); + setisOpenWrite(false); + console.log("selected:", select); + } + }; + + const clearSelectionWrite = () => { + console.log("cancel input/selection"); + setreg_write(""); + setisOpenWrite(false); + }; + + // function to implement the filter of the registers + const optionsWrite = [ + <SelectOption key={0} value="Alabama" />, + <SelectOption key={1} value="Florida" />, + <SelectOption key={2} value="New Jersey" />, + <SelectOption key={3} value="New Mexico" />, + <SelectOption key={4} value="New York" />, + <SelectOption key={5} value="North Carolina" />, + ]; + + const customFilterWrite = (_, value) => { + if (!value) { + return optionsWrite; + } + const input = new RegExp(value, "i"); + return optionsWrite.filter((child) => input.test(child.props.value)); + }; + + const write_device = (reg_address, new_reg_value) => { + const requestData = { + optoboardPosition: optoboardPosition, + device: device[device_val].label, + register: reg_address, + newValue: new_reg_value, + }; + fetch(`${backendUrl}/sendWriteRequest`, getPostBody(requestData)) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + if (data !== -1) { + setbuttonVariantWrite("primary"); + setread_back_write(data); + } else { + setbuttonVariantWrite("warning"); + } + }) + .catch((err) => { + console.log(err); + }); + }; + + return ( + <React.Fragment> + <Panel> + <PanelMain> + <PanelMainBody> + <Bullseye> + <Flex> + <Bullseye> + <FlexItem> + <Bullseye> + <h4> Select device: </h4> + </Bullseye> + </FlexItem> + + <FlexItem> + <Bullseye> + <FormSelectInputNewer + id={"selectDeviceSimplePanelRead"} + items={device} + value={device_val} + onChange={(x) => setdevice_val(x)} + /> + </Bullseye> + </FlexItem> + </Bullseye> + </Flex> + </Bullseye> + </PanelMainBody> + </PanelMain> + </Panel> + + <Panel> + <PanelMain> + <PanelMainBody> + <Bullseye> + <Flex> + <Bullseye> + <FlexItem> + <Bullseye> + <Tooltip + content={ + <div> + Use rom register for testing. In lpgbt v1 the return + has to be 166.{" "} + </div> + } + > + <Button + id="read_reg_send_command" + variant={buttonVariantRead} + onClick={() => read_device(reg_read)} + > + <h3> Read register </h3> + </Button> + </Tooltip> + </Bullseye> + </FlexItem> + </Bullseye> + + <FlexItem> + <Bullseye> + <h4>Read back: {read_back_read}</h4> + </Bullseye> + </FlexItem> + </Flex> + </Bullseye> + <Bullseye> + <Flex> + <FlexItem> + <Select + variant={SelectVariant.typeahead} + direction={"down"} + typeAheadAriaLabel="Select a register" + onToggle={() => setisOpenRead(!isOpenRead)} + onTypeaheadInputChanged={(value) => setreg_read(value)} + onSelect={onSelectRead} + onClear={clearSelectionRead} + onFilter={customFilterRead} + selections={reg_read} + isOpen={isOpenRead} + aria-labelledby={"typeahead-select-id-2"} + placeholderText="Select a register" + noResultsFoundText={"No results found"} + > + {optionsRead} + </Select> + </FlexItem> + </Flex> + </Bullseye> + </PanelMainBody> + </PanelMain> + </Panel> + + <Panel> + <PanelMain> + <PanelMainBody> + <Bullseye> + <Flex> + <Bullseye> + <FlexItem> + <Bullseye> + <Button + id="write_pri_send_command" + variant={buttonVariantWrite} + onClick={() => write_device(reg_write, value_write)} + > + <h3> Write register </h3> + </Button> + </Bullseye> + </FlexItem> + </Bullseye> + + <FlexItem> + <Bullseye> + <h4>Read back: {read_back_write}</h4> + </Bullseye> + </FlexItem> + </Flex> + </Bullseye> + <Bullseye> + <Flex> + + <FlexItem> + <Bullseye> + <Select + variant={SelectVariant.typeahead} + direction={"down"} + typeAheadAriaLabel="Select a register write" + onToggle={() => setisOpenWrite(!isOpenWrite)} + onTypeaheadInputChanged={(value) => setreg_write(value)} + onSelect={onSelectWrite} + onClear={clearSelectionWrite} + onFilter={customFilterWrite} + selections={reg_write} + isOpen={isOpenWrite} + aria-labelledby={"typeahead-select-id-2-write"} + placeholderText="Select a register" + noResultsFoundText={"No results found"} + > + {optionsWrite} + </Select> + </Bullseye> + </FlexItem> + </Flex> + </Bullseye> + <Bullseye> + <Flex> + <FlexItem> + <Bullseye> + <h4>Value (hex)</h4> + </Bullseye> + </FlexItem> + + <FlexItem> + <Bullseye> + <TextInput + id="write_value" + name="write_value" + value={value_write} + onChange={(x) => setvalue_write(x)} + /> + </Bullseye> + </FlexItem> + </Flex> + </Bullseye> + </PanelMainBody> + </PanelMain> + </Panel> + </React.Fragment> + ); +} diff --git a/ui/src/SimpleTabs/AddOptoboard.js b/ui/src/SimpleTabs/AddOptoboard.js new file mode 100644 index 0000000..d3e8db6 --- /dev/null +++ b/ui/src/SimpleTabs/AddOptoboard.js @@ -0,0 +1,369 @@ +import React, { useState, useEffect } from "react"; +import { getPostBody, checkResponse } from "../utils/utility-functions"; + +import { + Bullseye, + Button, + Flex, + FlexItem, + Modal, + ModalVariant, + Text, + TextContent, + TextVariants, + Tooltip, + TextInput, + FormSelect, + FormSelectOption, + Checkbox, + } from "@patternfly/react-core"; + +export function AddOptoboard({ + url, + optoList, + setoptoList, + isOpen, + setisOpen, + modify, + setmodify, + currentOpto, + indexcurrentOpto, + setcurrentOpto, +}) { + const [Serial, setSerial] = useState( + modify ? currentOpto["serialNumber"] : "00000000" + ); + const [Position, setPosition] = useState( + modify ? currentOpto["Position"] : "OB1" + ); + const [vtrx, setVtrx] = useState(modify ? currentOpto["vtrxVersion"] : "1.3"); + const vtrxOptions = [ + { value: "1.2", label: "1.2", disabled: false }, + { value: "1.3", label: "1.3", disabled: false }, + ]; + const [flx_G, setflx_G] = useState(modify ? currentOpto["flx_G"] : "0"); + const [flx_d, setflx_d] = useState(modify ? currentOpto["flx_d"] : "0"); + const [withoutFelixcore, setwithoutFelixcore] = useState( + modify ? currentOpto["withoutFelixcore"] : false + ); + const [ConfigurationPath, setConfigurationPath] = useState( + modify + ? currentOpto["ConfigurationPath"] + : "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json" + ); + const [validConfigPath, validConfigPathChange] = useState("success"); + const [inDBCheckBox, setinDBCheckBox] = useState( + modify ? currentOpto["inDBCheckBox"] : false + ); + const [configDBAvailable, setconfigDBAvailable] = useState("warning"); + const [ConfigurationDB, setConfigurationDB] = useState( + modify ? currentOpto["ConfigurationDB"] : "http://localhost:5000" + ); + const [debugCheckBox, setdebugCheckBox] = useState( + modify ? currentOpto["debugCheckBox"] : false + ); + const [testmode, SwitchTestModeChange] = useState( + modify ? currentOpto["testmode"] : false + ); + const [ButtonVariant, setButtonVariant] = useState("primary"); + + function addToList(x) { + let tempArr = optoList; + tempArr.push(x); + return setoptoList(tempArr); + } + + const deleteItem = (index) => { + /*still need to be adjusted*/ + let temp = optoList.filter((item, i) => i !== index); + setoptoList(temp); + }; + + /*modify this function to account for when the serial or path to file are not valid*/ + const onClickAdd = () => { + let uniquePosition = true; + for (var x of optoList) { + if (x["Position"] === Position) { + uniquePosition = false; + } + } + if (Serial !== "") { + if (!modify) { + if (uniquePosition) { + const newoptoList = addToList({ + serialNumber: Serial, + Position: Position, + vtrxVersion: vtrx, + flx_G: flx_G, + flx_d: flx_d, + withoutFelixcore: withoutFelixcore, + ConfigurationPath: ConfigurationPath, + inDBCheckBox: inDBCheckBox, + ConfigurationDB: ConfigurationDB, + debugCheckBox: debugCheckBox, + testmode: testmode, + }); + } + } else { + console.log("Modify"); + optoList[indexcurrentOpto] = { + serialNumber: Serial, + Position: Position, + vtrxVersion: vtrx, + flx_G: flx_G, + flx_d: flx_d, + withoutFelixcore: withoutFelixcore, + ConfigurationPath: ConfigurationPath, + inDBCheckBox: inDBCheckBox, + ConfigurationDB: ConfigurationDB, + debugCheckBox: debugCheckBox, + testmode: testmode, + }; + } + console.log(optoList); + fetch(`${url}/sendOptoList`, getPostBody({ optoList: optoList })) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + setisOpen(!isOpen); + }) + .catch((err) => { + console.log(err); + }); + setSerial(""); + } + }; + + const onChangeConfigurationPath = (x) => { + setConfigurationPath(x); + fetch( + `${url}/checkAvailableDatasetInDB`, + getPostBody({ + path: x, + inDB: inDBCheckBox, + CONFIGDB_ADDRESS: ConfigurationDB, + }) + ) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + if (data === 1) { + validConfigPathChange("success"); + setButtonVariant("primary"); + } else { + validConfigPathChange("error"); + setButtonVariant("danger"); + } + }); + }; + + const onChangeConfigurationDB = (newname) => { + setConfigurationDB(newname); + fetch( + `${url}/configDbUnavailable_wrapper`, + getPostBody({ CONFIGDB_ADDRESS: newname }) + ) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + if (data) { + setconfigDBAvailable("error"); + setButtonVariant("danger"); + } else { + setconfigDBAvailable("success"); + setButtonVariant("primary"); + } + }); + }; + + return ( + <React.Fragment> + <Modal + variant={ModalVariant.medium} + title="Initialize the Optoboard" + isOpen={isOpen} + showClose={true} + onClose={() => setisOpen(!isOpen)} + actions={[ + <Button key="close" variant={ButtonVariant} onClick={onClickAdd}> + Add Optoboard to your setup + </Button>, + <Button + key="cancel" + variant="link" + onClick={() => { + setisOpen(!isOpen); + setmodify(false); + }} + > + Cancel + </Button>, + ]} + > + <Flex> + <FlexItem flex={{ default: "flex_1" }}> + <TextContent> + <Text component={TextVariants.h3}>Serial Number</Text> + </TextContent> + </FlexItem> + <FlexItem flex={{ default: "flex_1" }}> + <Bullseye> + <TextInput + id="optoserial" + name="Optoboard Serial Number" + value={Serial} + type="text" + onChange={(X) => setSerial(X)} + aria-label="text input example" + /> + </Bullseye> + </FlexItem> + <FlexItem flex={{ default: "flex_1" }}> + <TextContent> + <Text component={TextVariants.h3}>Position</Text> + </TextContent> + </FlexItem> + <FlexItem flex={{ default: "flex_1" }}> + <Bullseye> + <TextInput + id="position" + name="position" + value={Position} + type="text" + onChange={(X) => setPosition(X)} + aria-label="text input example" + /> + </Bullseye> + </FlexItem> + <FlexItem flex={{ default: "flex_1" }}> + <Bullseye> + <TextContent> + <Text component={TextVariants.h3}>Vtrx</Text> + </TextContent> + </Bullseye> + </FlexItem> + <FlexItem flex={{ default: "flex_1" }}> + <Bullseye> + <FormSelect + value={vtrx} + onChange={(X) => setVtrx(X)} + aria-label="FormSelect Input" + > + {vtrxOptions.map((option, index) => ( + <FormSelectOption + isDisabled={option.disabled} + key={index} + value={option.value} + label={option.label} + /> + ))} + </FormSelect> + </Bullseye> + </FlexItem> + </Flex> + <Flex> + <FlexItem flex={{ default: "flex_1" }}> + <TextContent> + <Text component={TextVariants.h3}>flx_G</Text> + </TextContent> + </FlexItem> + <FlexItem flex={{ default: "flex_1" }}> + <TextInput + id="flx_G_id" + name="flx_G" + value={flx_G} + onChange={(x) => setflx_G(x)} + /> + </FlexItem> + <FlexItem flex={{ default: "flex_1" }}> + <Bullseye> + <TextContent> + <Text component={TextVariants.h3}>flx_d</Text> + </TextContent> + </Bullseye> + </FlexItem> + <FlexItem flex={{ default: "flex_1" }}> + <Bullseye> + <TextInput + id="flx_d" + name="flx_d" + value={flx_d} + onChange={(x) => setflx_d(x)} + /> + </Bullseye> + </FlexItem> + <FlexItem flex={{ default: "flex_2" }}> + <Bullseye> + <Checkbox + label={"without felixcore"} + isChecked={withoutFelixcore} + onChange={() => setwithoutFelixcore(!withoutFelixcore)} + id={"without felixcore"} + name={"without felixcore"} + /> + </Bullseye> + </FlexItem> + </Flex> + <Flex> + <FlexItem flex={{ default: "flex_1" }}> + <TextContent> + <Text component={TextVariants.h3}>Configuration File</Text> + </TextContent> + </FlexItem> + <FlexItem flex={{ default: "flex_1" }}> + <TextInput + id="ConfFile" + name="ConfFile" + value={ConfigurationPath} + onChange={onChangeConfigurationPath} + validated={validConfigPath} + /> + </FlexItem> + <FlexItem flex={{ default: "flex_1" }}> + <Checkbox + label={"Search in ConfigDB"} + isChecked={inDBCheckBox} + onChange={() => setinDBCheckBox(!inDBCheckBox)} + id={"Search in the database"} + name={"Search in the database"} + /> + </FlexItem> + </Flex> + <Flex> + <FlexItem flex={{ default: "flex_2" }}> + <TextContent> + <Text component={TextVariants.h3}>ConfigDB</Text> + </TextContent> + </FlexItem> + <FlexItem flex={{ default: "flex_2" }}> + <TextInput + id="ConfigDB" + name="ConfigDB" + value={ConfigurationDB} + onChange={onChangeConfigurationDB} + isDisabled={inDBCheckBox ? false : true} + validated={configDBAvailable} + /> + </FlexItem> + <FlexItem flex={{ default: "flex_1" }}> + <Checkbox + label={"debug"} + isChecked={debugCheckBox} + onChange={() => setdebugCheckBox(!debugCheckBox)} + id={"debug"} + name={"debug"} + /> + </FlexItem> + <FlexItem flex={{ default: "flex_1" }}> + <Checkbox + id="test_mod" + label="test mode" + isChecked={testmode} + onChange={() => SwitchTestModeChange(!testmode)} + /> + </FlexItem> + </Flex> + </Modal> + </React.Fragment> + ); +}; diff --git a/ui/src/SimpleTabs/Configurations.js b/ui/src/SimpleTabs/Configurations.js index 9428981..b747f90 100644 --- a/ui/src/SimpleTabs/Configurations.js +++ b/ui/src/SimpleTabs/Configurations.js @@ -1,34 +1,120 @@ - -const Configurations = { - - "Basic": [ - {"serialNumber": "00000000", "Position": "OB0", "vtrxVersion": "1.3", "flx_G": "0", "flx_d": "0", - "withoutFelixcore": false, "ConfigurationPath": '/itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json', "inDBCheckBox": false, - "ConfigurationDB": "http://localhost:5000", "debugCheckBox": false, "testmode": false} - ], - "SR1": [ - {"serialNumber": "00000000", "Position": "OB0", "vtrxVersion": "1.3", "flx_G": "0", "flx_d": "0", - "withoutFelixcore": false, "ConfigurationPath": '/itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json', "inDBCheckBox": false, - "ConfigurationDB": "http://localhost:5000", "debugCheckBox": false, "testmode": false}, - {"serialNumber": "01000000", "Position": "OB1", "vtrxVersion": "1.3", "flx_G": "0", "flx_d": "0", - "withoutFelixcore": false, "ConfigurationPath": '/itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json', "inDBCheckBox": false, - "ConfigurationDB": "http://localhost:5000", "debugCheckBox": false, "testmode": false}, - {"serialNumber": "02000000", "Position": "OB2", "vtrxVersion": "1.3", "flx_G": "0", "flx_d": "0", - "withoutFelixcore": false, "ConfigurationPath": '/itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json', "inDBCheckBox": false, - "ConfigurationDB": "http://localhost:5000", "debugCheckBox": false, "testmode": false}, - {"serialNumber": "03000000", "Position": "OB3", "vtrxVersion": "1.3", "flx_G": "0", "flx_d": "0", - "withoutFelixcore": false, "ConfigurationPath": '/itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json', "inDBCheckBox": false, - "ConfigurationDB": "http://localhost:5000", "debugCheckBox": false, "testmode": false}, - {"serialNumber": "04000000", "Position": "OB4", "vtrxVersion": "1.3", "flx_G": "0", "flx_d": "0", - "withoutFelixcore": false, "ConfigurationPath": '/itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json', "inDBCheckBox": false, - "ConfigurationDB": "http://localhost:5000", "debugCheckBox": false, "testmode": false}, - {"serialNumber": "05000000", "Position": "OB5", "vtrxVersion": "1.3", "flx_G": "0", "flx_d": "0", - "withoutFelixcore": false, "ConfigurationPath": '/itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json', "inDBCheckBox": false, - "ConfigurationDB": "http://localhost:5000", "debugCheckBox": false, "testmode": false}, - {"serialNumber": "06000000", "Position": "OB6", "vtrxVersion": "1.3", "flx_G": "0", "flx_d": "0", - "withoutFelixcore": false, "ConfigurationPath": '/itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json', "inDBCheckBox": false, - "ConfigurationDB": "http://localhost:5000", "debugCheckBox": false, "testmode": false} - ] - } +const Configurations = { + Basic: [ + { + serialNumber: "00000000", + Position: "OB0", + vtrxVersion: "1.3", + flx_G: "0", + flx_d: "0", + withoutFelixcore: false, + ConfigurationPath: + "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + inDBCheckBox: false, + ConfigurationDB: "http://localhost:5000", + debugCheckBox: false, + testmode: false, + }, + ], + SR1: [ + { + serialNumber: "00000000", + Position: "OB0", + vtrxVersion: "1.3", + flx_G: "0", + flx_d: "0", + withoutFelixcore: false, + ConfigurationPath: + "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + inDBCheckBox: false, + ConfigurationDB: "http://localhost:5000", + debugCheckBox: false, + testmode: false, + }, + { + serialNumber: "00000000", + Position: "OB1", + vtrxVersion: "1.3", + flx_G: "0", + flx_d: "0", + withoutFelixcore: false, + ConfigurationPath: + "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + inDBCheckBox: false, + ConfigurationDB: "http://localhost:5000", + debugCheckBox: false, + testmode: false, + }, + { + serialNumber: "00000000", + Position: "OB2", + vtrxVersion: "1.3", + flx_G: "0", + flx_d: "0", + withoutFelixcore: false, + ConfigurationPath: + "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + inDBCheckBox: false, + ConfigurationDB: "http://localhost:5000", + debugCheckBox: false, + testmode: false, + }, + { + serialNumber: "00000000", + Position: "OB3", + vtrxVersion: "1.3", + flx_G: "0", + flx_d: "0", + withoutFelixcore: false, + ConfigurationPath: + "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + inDBCheckBox: false, + ConfigurationDB: "http://localhost:5000", + debugCheckBox: false, + testmode: false, + }, + { + serialNumber: "00000000", + Position: "OB4", + vtrxVersion: "1.3", + flx_G: "0", + flx_d: "0", + withoutFelixcore: false, + ConfigurationPath: + "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + inDBCheckBox: false, + ConfigurationDB: "http://localhost:5000", + debugCheckBox: false, + testmode: false, + }, + { + serialNumber: "00000000", + Position: "OB5", + vtrxVersion: "1.3", + flx_G: "0", + flx_d: "0", + withoutFelixcore: false, + ConfigurationPath: + "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + inDBCheckBox: false, + ConfigurationDB: "http://localhost:5000", + debugCheckBox: false, + testmode: false, + }, + { + serialNumber: "00000000", + Position: "OB6", + vtrxVersion: "1.3", + flx_G: "0", + flx_d: "0", + withoutFelixcore: false, + ConfigurationPath: + "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + inDBCheckBox: false, + ConfigurationDB: "http://localhost:5000", + debugCheckBox: false, + testmode: false, + }, + ], +}; export { Configurations }; diff --git a/ui/src/SimpleTabs/MyContext.js b/ui/src/SimpleTabs/MyContext.js index 660b4dd..497790d 100644 --- a/ui/src/SimpleTabs/MyContext.js +++ b/ui/src/SimpleTabs/MyContext.js @@ -1,20 +1,18 @@ import React from "react"; -import myFile from '../Config/00000000_test_v1.json'; +import myFile from "../Config/00000000_test_v1.json"; -export const isI2C_On = false -export const OptoSerialContext = "00000000" -export const myFileCon = myFile -export const MyContext = React.createContext({ isI2C_On: isI2C_On, - isI2C_On_Check : () => {}, - OptoSerialContext: OptoSerialContext, - handleModalToggleOpen : () => {}, - optoVersion : "", - lpgbtVersion : "", - fetchDataSet : () => {}, - myFileConfig : myFileCon, - }) +export const isI2C_On = false; +export const OptoSerialContext = "00000000"; +export const myFileCon = myFile; +export const MyContext = React.createContext({ + isI2C_On: isI2C_On, + isI2C_On_Check: () => {}, + OptoSerialContext: OptoSerialContext, + handleModalToggleOpen: () => {}, + optoVersion: "", + lpgbtVersion: "", + fetchDataSet: () => {}, + myFileConfig: myFileCon, +}); -export const MyContextTestPattern = React.createContext({ isI2C_On: isI2C_On, - - }) - +export const MyContextTestPattern = React.createContext({ isI2C_On: isI2C_On }); diff --git a/ui/src/SimpleTabs/OptoboardList.js b/ui/src/SimpleTabs/OptoboardList.js index 25c6dad..c62525e 100644 --- a/ui/src/SimpleTabs/OptoboardList.js +++ b/ui/src/SimpleTabs/OptoboardList.js @@ -1,14 +1,15 @@ import React, { useState, useEffect } from "react"; -import { SimpleList, SimpleListItem } from '@patternfly/react-core'; +import { SimpleList, SimpleListItem } from "@patternfly/react-core"; import { WriteReadBox } from "../Controls/WriteReadBox"; import { Config } from "../Controls/Config"; -import {Configurations} from '../SimpleTabs/Configurations'; -import {OptoStatus} from '../Controls/OptoStatus'; -import {DevelPanel} from "../SimpleTabs/DevelPanel"; +import { Configurations } from "../SimpleTabs/Configurations"; +import { OptoStatus } from "../Controls/OptoStatus"; +import { DevelPanel } from "../SimpleTabs/DevelPanel"; +import { AddOptoboard } from "../SimpleTabs/AddOptoboard"; import { Bullseye, - Button, + Button, Flex, FlexItem, Modal, @@ -24,6 +25,7 @@ import { PanelHeader, Page, PageSection, + PageSectionVariants, Switch, FormSelect, FormSelectOption, @@ -36,398 +38,278 @@ import { DrawerHead, DrawerActions, DrawerCloseButton, -} from '@patternfly/react-core' -import { - CheckedTextInput, - ConfigSelection, - IntegerInput, - TypeaheadSelectInput -} from '@itk-demo-sw/components' -import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon'; -import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon'; - -import { getPostBody, checkResponse } from '../utils/utility-functions' - - -const TextInputBasic2 = () => { - const [value3, setValue3] = useState('10000000'); - return <TextInput value={value3} type="text" onChange={x => setValue3(x)} aria-label="text input example" />; -}; +} from "@patternfly/react-core"; -const items = [ - <SimpleListItem key="item1" isActive> - List item 1 - </SimpleListItem>, - <SimpleListItem key="item2" component="a" href="#"> - List item 2 - </SimpleListItem>, - <SimpleListItem key="item3"> - List item 3 - </SimpleListItem> -]; +import CogIcon from "@patternfly/react-icons/dist/esm/icons/cog-icon"; +import PlusCircleIcon from "@patternfly/react-icons/dist/esm/icons/plus-circle-icon"; -const print= ( -<SimpleList aria-label="Simple List Example"> - {items} -</SimpleList> -) +import { getPostBody, checkResponse } from "../utils/utility-functions"; -const TextInputBasic = () => { - const [value1, setValue1] = useState('00000000'); - return <TextInput value={value1} type="text" onChange={value => setValue1(value)} aria-label="text input example" />; -}; +export function OptoboardList({ url }) { + const [optoList, setoptoList] = useState(Configurations["SR1"]); + const [isOpen, setisOpen] = useState(false); + const [OpenDevel, setOpenDevel] = useState(false); + const [modify, setmodify] = useState(false); + const [currentOpto, setcurrentOpto] = useState({ + serialNumber: "00000000", + Position: "OB0", + vtrxVersion: "1.3", + flx_G: "0", + flx_d: "0", + withoutFelixcore: false, + ConfigurationPath: + "/itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json", + inDBCheckBox: false, + ConfigurationDB: "http://localhost:5000", + debugCheckBox: false, + testmode: false, + }); + const [indexcurrentOpto, setindexcurrentOpto] = useState(); + const ConfigurationOptions = [ + { + value: "Load Configuration", + label: "Load Configuration", + disabled: true, + }, + ]; + for (var key in Configurations) { + ConfigurationOptions.push({ value: key, label: key, disabled: false }); + } + const [DefaultConfig, setDefaultConfig] = useState("SR1"); + function optoListChange(x) { + setoptoList(x); + fetch(`${url}/sendOptoList`, getPostBody({ optoList: x })) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + }) + .catch((err) => { + console.log(err); + }); + } + const [firstLoad, setfirstLoad] = useState(true); -/*-----------------------------------------------------------------------------------*/ + useEffect(() => { + if (firstLoad) { + console.log("Load!"); + setfirstLoad(false); + fetch(`${url}/sendOptoList`, getPostBody({ optoList: optoList })) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + }) + .catch((err) => { + console.log(err); + }); + } + }); -export function OptoboardList(url) { - const [optoList, setoptoList] = useState(Configurations["SR1"]); - const [isOpen, setisOpen] = useState(false); - const [OpenDevel, setOpenDevel] = useState(false); - const [modify, setmodify] = useState(false); - const [currentOpto, setcurrentOpto] = useState({"serialNumber": "00000000", "Position": "OB0", "vtrxVersion": "1.3", "flx_G": "0", "flx_d": "0", - "withoutFelixcore": false, "ConfigurationPath": '/itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json', "inDBCheckBox": false, - "ConfigurationDB": "http://localhost:5000", "debugCheckBox": false, "testmode": false}); - const ConfigurationOptions = [{value: "Load Configuration", label: "Load Configuration", disabled: true}] - for (var key in Configurations) { - ConfigurationOptions.push({value: key, label: key, disabled:false}); - } - const [DefaultConfig, setDefaultConfig] = useState("SR1"); - - /* + /* url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto const AddOptoboardModal = AddOptoboard(url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto); */ -/* + /* <AddOptoboard url={url} optoList={optoList} setoptoList={setoptoList} isOpen={isOpen} setisOpen={setisOpen} modify={modify} setmodify={setmodify} currentOpto={currentOpto} setcurrentOpto={setcurrentOpto}/> */ -function AddOptoboard({url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto}) { - const [Serial, setSerial] = useState(modify ? currentOpto["serialNumber"] : "00000000"); - const [Position, setPosition] = useState(modify ? currentOpto["Position"] : "OB1"); - const [vtrx, setVtrx] = useState(modify ? currentOpto["vtrxVersion"] : "1.3"); - const vtrxOptions = [{value: "1.2", label: "1.2", disabled: false},{value: "1.3", label: "1.3", disabled:false}] - const [flx_G, setflx_G] = useState(modify ? currentOpto["flx_G"] : "0"); - const [flx_d, setflx_d] = useState(modify ? currentOpto["flx_d"] : "0"); - const [withoutFelixcore, setwithoutFelixcore] = useState(modify ? currentOpto["withoutFelixcore"] : false); - const [ConfigurationPath, setConfigurationPath] = useState(modify ? currentOpto["ConfigurationPath"] : '/itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json'); - const [validConfigPath, validConfigPathChange] = useState("success"); - const [inDBCheckBox, setinDBCheckBox] = useState(modify ? currentOpto["inDBCheckBox"] : false); - const [configDBAvailable, setconfigDBAvailable] = useState("warning"); - const [ConfigurationDB, setConfigurationDB] = useState(modify ? currentOpto["ConfigurationDB"] : "http://localhost:5000"); - const [debugCheckBox, setdebugCheckBox] = useState(modify ? currentOpto["debugCheckBox"] : false); - const [testmode, SwitchTestModeChange] = useState(modify ? currentOpto["testmode"] : false); - const [ButtonVariant, setButtonVariant] = useState("primary"); - - - - const addToList = (x) => { - let tempArr = optoList; - tempArr.push(x); - setoptoList(tempArr); - }; - - const deleteItem = (index) => { - /*still need to be adjusted*/ - let temp = optoList.filter((item, i) => i !== index); - setoptoList(temp); - }; - - /*modify this function to account for when the serial or path to file are not valid*/ - const onClickAdd = () => { - setisOpen(!isOpen); - let uniquePosition = true; - for (var x of optoList) { - if (x["Position"]===Position){ - uniquePosition = false; - } - } - if ((Serial !== "") && (uniquePosition)) { - addToList({"serialNumber": Serial, "Position": Position, "vtrxVersion": vtrx, "flx_G": flx_G, "flx_d": flx_d, - "withoutFelixcore": withoutFelixcore, "ConfigurationPath": ConfigurationPath, "inDBCheckBox": inDBCheckBox, - "ConfigurationDB": ConfigurationDB, "debugCheckBox": debugCheckBox, "testmode": testmode}); - console.log(optoList); - setSerial("") - } - }; - - const onChangeConfigurationPath = (x) => { - setConfigurationPath(x) - fetch(`${url}/checkAvailableDatasetInDB`, getPostBody({path: x, inDB: inDBCheckBox, CONFIGDB_ADDRESS: ConfigurationDB})).then( - (response) => checkResponse(response)).then( - (data) => {console.log(data); - if (data===1) {validConfigPathChange('success'); setButtonVariant("primary") - } else {validConfigPathChange('error'); setButtonVariant("danger") } - }); - }; - - const onChangeConfigurationDB = (newname) => { - setConfigurationDB(newname); - fetch(`${url}/configDbUnavailable_wrapper`, getPostBody({CONFIGDB_ADDRESS: newname})).then( - (response) => checkResponse(response)).then( - (data) => {console.log(data); - if (data) {setconfigDBAvailable('error'); setButtonVariant("danger") - } else {setconfigDBAvailable('success'); setButtonVariant("primary")} - }); - }; - - return( - <React.Fragment> - <Modal - variant={ModalVariant.medium} - title="Initialize the Optoboard" - isOpen={isOpen} - showClose = {true} - onClose={() => setisOpen(!isOpen)} - actions={[ - <Button key="close" variant={ButtonVariant} onClick={onClickAdd}> - Add Optoboard to your setup - </Button>, - <Button key="cancel" variant="link" onClick={() => {setisOpen(!isOpen); setmodify(false)}}> - Cancel - </Button>, - ]} - > - <Flex> - <FlexItem flex={{ default: 'flex_1' }}> - <TextContent> - <Text component={TextVariants.h3}>Serial Number</Text> - </TextContent> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextInput id="optoserial" name="Optoboard Serial Number" value={Serial} type="text" onChange={X => setSerial(X)} aria-label="text input example" /> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <TextContent> - <Text component={TextVariants.h3}>Position</Text> - </TextContent> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextInput id="position" name="position" value={Position} type="text" onChange={X => setPosition(X)} aria-label="text input example" /> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>Vtrx</Text> - </TextContent> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelect value={vtrx} onChange={X => setVtrx(X)} aria-label="FormSelect Input"> - {vtrxOptions.map((option, index) => ( - <FormSelectOption isDisabled={option.disabled} key={index} value={option.value} label={option.label} /> - ))} - </FormSelect> - </Bullseye> - </FlexItem> - </Flex> - <Flex> - <FlexItem flex={{ default: 'flex_1' }} > - <TextContent> - <Text component={TextVariants.h3}>flx_G</Text> - </TextContent> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <TextInput id="flx_G_id" name="flx_G" value={flx_G} onChange={x => setflx_G(x)}/> - </FlexItem> - <FlexItem flex={{ default: "flex_1" }}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>flx_d</Text> - </TextContent> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: "flex_1" }}> - <Bullseye> - <TextInput id="flx_d" name="flx_d" value={flx_d} onChange={x => setflx_d(x)}/> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: "flex_2" }}> - <Bullseye> - <Checkbox label={"without felixcore"} isChecked={withoutFelixcore} onChange={() => setwithoutFelixcore(!withoutFelixcore)} id={"without felixcore"} name={"without felixcore"}/> - </Bullseye> - </FlexItem> - </Flex> - <Flex> - <FlexItem flex={{ default: "flex_1" }}> - <TextContent> - <Text component={TextVariants.h3}>Configuration File</Text> - </TextContent> - </FlexItem> - <FlexItem flex={{ default: "flex_1" }}> - <TextInput id="ConfFile" name="ConfFile" value={ConfigurationPath} onChange={onChangeConfigurationPath} validated={validConfigPath}/> - </FlexItem> - <FlexItem flex={{ default: "flex_1" }}> - <Checkbox label={"Search in ConfigDB"} isChecked={inDBCheckBox} onChange={() => setinDBCheckBox(!inDBCheckBox)} id={"Search in the database"} name={"Search in the database"}/> - </FlexItem> - </Flex> - <Flex> - <FlexItem flex={{ default: "flex_2" }}> - <TextContent> - <Text component={TextVariants.h3}>ConfigDB</Text> - </TextContent> - </FlexItem> - <FlexItem flex={{ default: "flex_2" }}> - <TextInput id="ConfigDB" name="ConfigDB" value={ConfigurationDB} onChange={onChangeConfigurationDB} isDisabled={inDBCheckBox ? false : true} validated={configDBAvailable}/> - </FlexItem> - <FlexItem flex={{ default: "flex_1" }}> - <Checkbox label={"debug"} isChecked={debugCheckBox} onChange={() => setdebugCheckBox(!debugCheckBox)} id={"debug"} name={"debug"}/> - </FlexItem> - <FlexItem flex={{ default: "flex_1"}}> - <Checkbox id="test_mod" label="test mode" isChecked={testmode} onChange={() => SwitchTestModeChange(!testmode)} /> - </FlexItem> - </Flex> - </Modal> - </React.Fragment> - ); -}; - - const example =( - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - <Flex key={'scan config flex'}> - <FlexItem key={'scan config title item'}> - <TextContent - style={{ width: '250px' }} - key={'scan config title textcon'} - > - <Text - component="h3" - key={'scan config title text'} - > - {'Scan Config'} - </Text> - </TextContent> - </FlexItem> - <FlexItem key={'test1'}> - <TextInputBasic /> - </FlexItem> - <FlexItem key={'test2'}> - <TextInputBasic2 /> - </FlexItem> - <FlexItem key={'print'}> - {print} - </FlexItem> - </Flex> - </PanelMainBody> - </PanelMain> - </Panel> - ); - -/* useEffect(() => {console.log(currentOpto); + /* useEffect(() => {console.log(currentOpto); const AddOptoboardModal = AddOptoboard(url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto); })*/ - return ( - <React.Fragment> - <AddOptoboard url={url} optoList={optoList} setoptoList={setoptoList} isOpen={isOpen} setisOpen={setisOpen} modify={modify} setmodify={setmodify} currentOpto={currentOpto} setcurrentOpto={setcurrentOpto}/> - <DevelPanel url={url} OpenDevel={OpenDevel} setOpenDevel={setOpenDevel} /> - <Page> - <PageSection> - <Panel> - <PanelMain> - <PanelMainBody> - <Flex> - <FlexItem key={'add optoboard'}> - <Button variant="primary" isLarge onClick={() => {setisOpen(!isOpen); setmodify(false)}}> - <h3> Add Optoboard </h3> - </Button> - </FlexItem> - <FlexItem key={'add configuration'}> - <Button variant="secondary" isLarge onClick={() => setisOpen(!isOpen)}> - <h3> Add Configuration </h3> - </Button> - </FlexItem> - <FlexItem> - <FormSelect value={DefaultConfig} onChange={X => {setDefaultConfig(X); setoptoList(Configurations[X])}} aria-label="FormSelect Input"> - {ConfigurationOptions.map((option, index) => ( - <FormSelectOption isDisabled={option.disabled} key={index} value={option.value} label={option.label} /> - ))} - </FormSelect> - </FlexItem> - </Flex> - </PanelMainBody> - </PanelMain> - </Panel> - <Panel> - <PanelMain> - <PanelMainBody> - <Flex > - {optoList.map((opto, index) => { - return ( - <Panel> - <PanelMain> - <PanelMainBody> - <FlexItem > - <Panel variant="raised"> - <PanelMain> - <PanelMainBody> - <Flex> - <FlexItem flex={{ default: 'flex_1' }}> - <TextContent> - <Text component={TextVariants.h3}>{opto.Position}</Text> - </TextContent> - </FlexItem> - <FlexItem align={{ defautl: "alignRight"}}> - <Tooltip content={"Enable advanced mode"}> - <Button aria-label="modify" variant="plain" id="tt-ref" onClick={() => {setOpenDevel(!OpenDevel)}}> - <Icon> - <PlusCircleIcon/> - </Icon> - </Button> - </Tooltip> - <Tooltip content={ - <div> - <h4>Serial Number: {opto.serialNumber} Vtrx: {opto.vtrxVersion} </h4> - <h4>testmode: {opto.testmode.toString()} Debug: {opto.debugCheckBox.toString()}</h4> - <h4>flx_G: {opto.flx_G} flx_d: {opto.flx_d} woflxcore: {opto.withoutFelixcore.toString()} </h4> - <h4>inConfigDB: {opto.inDBCheckBox.toString()} Configuration File: {opto.ConfigurationPath}</h4> - <h4>ConfigDB: {opto.ConfigurationDB} </h4> - </div> - }> - <Button aria-label="drawer" variant="plain" id="tt-ref" - onClick={() => {setcurrentOpto(opto); setmodify(true); setisOpen(true);}}> - <Icon> - <CogIcon/> - </Icon> - </Button> - </Tooltip> - </FlexItem> - </Flex> - <Flex> - <FlexItem > - <WriteReadBox backendUrl={url}/> - </FlexItem> - <FlexItem> - <Config backendUrl={url}/> - <OptoStatus backendUrl={url}/> - </FlexItem> - </Flex> - </PanelMainBody> - </PanelMain> - </Panel> - </FlexItem> - </PanelMainBody> - </PanelMain> - </Panel> - ); - }) - } - </Flex> - - </PanelMainBody> - </PanelMain> - </Panel> - </PageSection> - </Page> - </React.Fragment> - ); + /* + <AddOptoboard + url={url} + optoList={optoList} + setoptoList={setoptoList} + isOpen={isOpen} + setisOpen={setisOpen} + modify={modify} + setmodify={setmodify} + currentOpto={currentOpto} + indexcurrentOpto={indexcurrentOpto} + setcurrentOpto={setcurrentOpto} + /> + + <DevelPanel url={url} OpenDevel={OpenDevel} setOpenDevel={setOpenDevel} /> + */ + return ( + <React.Fragment> + + <Page> + <PageSection> + <Panel> + <PanelMain> + <PanelMainBody> + <Flex> + <FlexItem key={"add_configuration"}> + <Button + variant="secondary" + isLarge + onClick={() => setisOpen(!isOpen)} + > + <h3> Add Configuration </h3> + </Button> + </FlexItem> + <FlexItem> + <FormSelect + value={DefaultConfig} + onChange={(X) => { + setDefaultConfig(X); + optoListChange(Configurations[X]); + }} + aria-label="FormSelect Input" + > + {ConfigurationOptions.map((option, index) => ( + <FormSelectOption + isDisabled={option.disabled} + key={index} + value={option.value} + label={option.label} + /> + ))} + </FormSelect> + </FlexItem> + <FlexItem key={"add configuration"}> + <Button + variant="link" + onClick={() => { + fetch(`${url}/health`) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + }) + .catch((err) => { + console.log(err); + }); + }} + > + <h3> Health </h3> + </Button> + </FlexItem> + </Flex> + </PanelMainBody> + </PanelMain> + </Panel> -}; \ No newline at end of file + <Panel> + <PanelMain> + <PanelMainBody> + <Flex> + {optoList.map((opto, index) => { + return ( + <FlexItem> + <Panel variant="bordered"> + <PanelMain> + <PanelMainBody> + <Flex> + <FlexItem flex={{ default: "flex_1" }}> + <TextContent> + <Text component={TextVariants.h3}> + {opto.Position} + </Text> + </TextContent> + </FlexItem> + <FlexItem + align={{ defautl: "alignRight" }} + > + <Tooltip + content={"Enable advanced mode"} + > + <Button + aria-label="modify" + variant="plain" + id="tt-ref" + onClick={() => { + setOpenDevel(!OpenDevel); + }} + > + <Icon> + <PlusCircleIcon /> + </Icon> + </Button> + </Tooltip> + <Tooltip + content={ + <div> + <h4> + Serial Number:{" "} + {opto.serialNumber} Vtrx:{" "} + {opto.vtrxVersion}{" "} + </h4> + <h4> + testmode:{" "} + {opto.testmode.toString()}{" "} + Debug:{" "} + {opto.debugCheckBox.toString()} + </h4> + <h4> + flx_G: {opto.flx_G} flx_d:{" "} + {opto.flx_d} woflxcore:{" "} + {opto.withoutFelixcore.toString()}{" "} + </h4> + <h4> + inConfigDB:{" "} + {opto.inDBCheckBox.toString()}{" "} + Configuration File:{" "} + {opto.ConfigurationPath} + </h4> + <h4> + ConfigDB: {opto.ConfigurationDB}{" "} + </h4> + </div> + } + > + <Button + aria-label="drawer" + variant="plain" + id="tt-ref" + onClick={() => { + setcurrentOpto(opto); + setindexcurrentOpto(index); + setmodify(true); + setisOpen(true); + }} + > + <Icon> + <CogIcon /> + </Icon> + </Button> + </Tooltip> + </FlexItem> + </Flex> + <Flex> + <FlexItem> + <WriteReadBox + backendUrl={url} + optoboardPosition={opto.Position} + /> + </FlexItem> + <FlexItem> + <Config + backendUrl={url} + optoboardPosition={opto.Position} + /> + <OptoStatus + backendUrl={url} + optoboardPosition={opto.Position} + /> + </FlexItem> + </Flex> + </PanelMainBody> + </PanelMain> + </Panel> + </FlexItem> + ); + })} + </Flex> + </PanelMainBody> + </PanelMain> + </Panel> + </PageSection> + </Page> + + </React.Fragment> + ); +} \ No newline at end of file diff --git a/ui/src/SimpleTabs/SimplePanel.js b/ui/src/SimpleTabs/SimplePanel.js index c1b5fd5..8e96893 100644 --- a/ui/src/SimpleTabs/SimplePanel.js +++ b/ui/src/SimpleTabs/SimplePanel.js @@ -16,54 +16,52 @@ import { Grid, GridItem, PageSection, - Page,Bullseye,TextInput, Panel, PanelHeader, Button, Flex, FlexItem, Tooltip, Modal,ModalVariant, - PanelMainBody, PanelMain, PanelBody + Page, + Bullseye, + TextInput, + Panel, + PanelHeader, + Button, + Flex, + FlexItem, + Tooltip, + Modal, + ModalVariant, + PanelMainBody, + PanelMain, + PanelBody, } from "@patternfly/react-core"; - -import { getPostBody, checkResponse } from '../utils/utility-functions' - - +import { getPostBody, checkResponse } from "../utils/utility-functions"; class SimplePanel extends React.Component { - constructor(props) { - super(props); - - - }; - - render() { - return( - - <React.Fragment> - <Page> - <PageSection> - - <Flex> - - <FlexItem flex={{ default: 'flex_2' }}> - - <QuickCommands backendUrl={this.props.backendUrl} /> - - </FlexItem> - - <FlexItem flex={{ default: 'flex_2' }}> - - <WriteRead4User backendUrl={this.props.backendUrl}/> - - </FlexItem> - - <FlexItem flex={{ default: 'flex_2' }}> - - <MinConfig backendUrl={this.props.backendUrl}/> - - </FlexItem> - - </Flex> - </PageSection> - </Page> - </React.Fragment> - );}; - }; - -export { SimplePanel }; \ No newline at end of file + constructor(props) { + super(props); + } + + render() { + return ( + <React.Fragment> + <Page> + <PageSection> + <Flex> + <FlexItem flex={{ default: "flex_2" }}> + <QuickCommands backendUrl={this.props.backendUrl} /> + </FlexItem> + + <FlexItem flex={{ default: "flex_2" }}> + <WriteRead4User backendUrl={this.props.backendUrl} /> + </FlexItem> + + <FlexItem flex={{ default: "flex_2" }}> + <MinConfig backendUrl={this.props.backendUrl} /> + </FlexItem> + </Flex> + </PageSection> + </Page> + </React.Fragment> + ); + } +} + +export { SimplePanel }; diff --git a/ui/src/SimpleTabs/SimpleTabs.js b/ui/src/SimpleTabs/SimpleTabs.js index 4eef3cb..620ce6f 100644 --- a/ui/src/SimpleTabs/SimpleTabs.js +++ b/ui/src/SimpleTabs/SimpleTabs.js @@ -12,98 +12,149 @@ import { Grid, GridItem, PageSection, - Page,Bullseye,TextInput, Panel, PanelHeader, Button, Modal, ModalVariant, ValidatedOptions, + Page, + Bullseye, + TextInput, + Panel, + PanelHeader, + Button, + Modal, + ModalVariant, + ValidatedOptions, Switch, } from "@patternfly/react-core"; -import {CommonlpGBT, MasterlpGBT, Placeholder} from "../SimpleTabs/lpGBT_pannel"; -import {ELinks} from "../SimpleTabs/eLinks"; +import { + CommonlpGBT, + MasterlpGBT, + Placeholder, +} from "../SimpleTabs/lpGBT_pannel"; +import { ELinks } from "../SimpleTabs/eLinks"; import { GBCRpannel } from "../SimpleTabs/GBCR"; -import { getPostBody, checkResponse } from '../utils/utility-functions' -import { MyContext, isI2C_On, OptoSerialContext, myFileCon } from '../SimpleTabs/MyContext'; +import { getPostBody, checkResponse } from "../utils/utility-functions"; +import { + MyContext, + isI2C_On, + OptoSerialContext, + myFileCon, +} from "../SimpleTabs/MyContext"; import { FormSelectInputNewer } from "../Widgets/FormSelectInput"; -import { SimplePanel } from '../SimpleTabs/SimplePanel'; - -import { LoggingViewer } from '@itk-demo-sw/components'; -import { useLoggingViewer } from '@itk-demo-sw/hooks'; +import { SimplePanel } from "../SimpleTabs/SimplePanel"; +import { LoggingViewer } from "@itk-demo-sw/components"; +import { useLoggingViewer } from "@itk-demo-sw/hooks"; function SimpleTabs(props) { - - const [activeTabKey, handleTabClick] = useState(0); - const [vtrx_v_val, onChange_vtrx_v] = useState(0); - const [flx_G, onChange_flx_G] = useState(0); - const [flx_d, onChange_flx_d] = useState(0); - const [withoutFelixcore, onChange_withoutFelixcore] = useState(false); - const [CheckisBox_debug, toggleBox_debug] = useState(false); - const [developermode, SwitchChange] = useState(false); - const [testmode, SwitchTestModeChange] = useState(); - const [isModalOpen, handleModalToggleOpen] = useState(); - const [isI2C_On, isI2C_On_Checked] = useState(isI2C_On); - const [optoVersion, optoVersionChange] = useState(""); - const [lpgbtVersion, lpgbtVersionChange] = useState(""); - const [validSerial, validSerialChange] = useState("success"); - const [ButtonVariant, ButtonVariantChange] = useState("primary"); - const [optoSerial, optoSerialChange] = useState(OptoSerialContext); - const [activeGbcr, activeGbcrChange] = useState("0000"); - const [activeLpgbt, activeLpgbtChange] = useState("0000"); - const [CheckisBox, CheckisBoxChange] = useState(false); - const [validConfigPath, validConfigPathChange] = useState("success"); - const [configDBAvailable, configDBAvailableChange] = useState("warning"); - const [ConfigurationDB, ConfigurationDBChange] = useState("http://localhost:5000"); - const [ConfigurationPath, ConfigurationPathChange] = useState('/itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json'); - - const CheckbuttonLabel = "Check in the database"; - const ConfigurationFile = myFileCon; - const vtrx_v = [ {label: "1.2", disabled: false, value: 0}, - {label: "1.3", disabled: false, value: 1}]; + const [activeTabKey, handleTabClick] = useState(0); + const [vtrx_v_val, onChange_vtrx_v] = useState(0); + const [flx_G, onChange_flx_G] = useState(0); + const [flx_d, onChange_flx_d] = useState(0); + const [withoutFelixcore, onChange_withoutFelixcore] = useState(false); + const [CheckisBox_debug, toggleBox_debug] = useState(false); + const [developermode, SwitchChange] = useState(false); + const [testmode, SwitchTestModeChange] = useState(); + const [isModalOpen, handleModalToggleOpen] = useState(); + const [isI2C_On, isI2C_On_Checked] = useState(isI2C_On); + const [optoVersion, optoVersionChange] = useState(""); + const [lpgbtVersion, lpgbtVersionChange] = useState(""); + const [validSerial, validSerialChange] = useState("success"); + const [ButtonVariant, ButtonVariantChange] = useState("primary"); + const [optoSerial, optoSerialChange] = useState(OptoSerialContext); + const [activeGbcr, activeGbcrChange] = useState("0000"); + const [activeLpgbt, activeLpgbtChange] = useState("0000"); + const [CheckisBox, CheckisBoxChange] = useState(false); + const [validConfigPath, validConfigPathChange] = useState("success"); + const [configDBAvailable, configDBAvailableChange] = useState("warning"); + const [ConfigurationDB, ConfigurationDBChange] = useState( + "http://localhost:5000" + ); + const [ConfigurationPath, ConfigurationPathChange] = useState( + "/itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json" + ); + + const CheckbuttonLabel = "Check in the database"; + const ConfigurationFile = myFileCon; + const vtrx_v = [ + { label: "1.2", disabled: false, value: 0 }, + { label: "1.3", disabled: false, value: 1 }, + ]; const isI2C_On_Check = () => { - isI2C_On_Checked(true); - console.log("Enabling I2C bus!!"); + isI2C_On_Checked(true); + console.log("Enabling I2C bus!!"); }; - const fetchDataSet = (name, vtrx_v, inDB) => { - const requestData = { - name: name, - vtrx_v: vtrx_v, - inDB: inDB ? 1 : 0, - } - fetch(`${props.backendUrl}/config_file_provider`, getPostBody(requestData)).then((response) => checkResponse(response)).then((data) => { this.setState({ ConfigurationFile : JSON.parse(data)}); console.log(JSON.parse(data)); }); - }; + const fetchDataSet = (name, vtrx_v, inDB) => { + const requestData = { + name: name, + vtrx_v: vtrx_v, + inDB: inDB ? 1 : 0, + }; + fetch(`${props.backendUrl}/config_file_provider`, getPostBody(requestData)) + .then((response) => checkResponse(response)) + .then((data) => { + this.setState({ ConfigurationFile: JSON.parse(data) }); + console.log(JSON.parse(data)); + }); + }; - const onChange_ConfigurationDB = (newname) => { - ConfigurationDBChange(newname); - fetch(`${this.props.backendUrl}/configDbUnavailable_wrapper`, getPostBody({CONFIGDB_ADDRESS: newname})).then( - (response) => checkResponse(response)).then( - (data) => {console.log(data); - if (data) {configDBAvailableChange('error'); ButtonVariantChange("danger") - } else {configDBAvailableChange('success'); ButtonVariantChange("primary")} - }); - }; - - const toggleBox = (checked) => { - CheckisBoxChange(checked); - if (checked) {onChange_ConfigurationDB(ConfigurationDB); - } else {if ((validSerial == 'success') && (validConfigPath == 'success')) {ButtonVariantChange("primary")} } - }; + const onChange_ConfigurationDB = (newname) => { + ConfigurationDBChange(newname); + fetch( + `${this.props.backendUrl}/configDbUnavailable_wrapper`, + getPostBody({ CONFIGDB_ADDRESS: newname }) + ) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + if (data) { + configDBAvailableChange("error"); + ButtonVariantChange("danger"); + } else { + configDBAvailableChange("success"); + ButtonVariantChange("primary"); + } + }); + }; - const onChange_ConfigurationPath = (newConfigurationPath) => { - ConfigurationPathChange(newConfigurationPath) - fetch(`${this.props.backendUrl}/checkAvailableDatasetInDB`, getPostBody({path: newConfigurationPath, inDB: CheckisBox, CONFIGDB_ADDRESS: ConfigurationDB})).then( - (response) => checkResponse(response)).then( - (data) => {console.log(data); - if (data==1) {validConfigPathChange('success'); ButtonVariantChange("primary") - } else {validConfigPathChange('error'); ButtonVariantChange("danger") } - }); - }; + const toggleBox = (checked) => { + CheckisBoxChange(checked); + if (checked) { + onChange_ConfigurationDB(ConfigurationDB); + } else { + if (validSerial == "success" && validConfigPath == "success") { + ButtonVariantChange("primary"); + } + } + }; -return ( - <p>You clicked 55 times</p> - ); + const onChange_ConfigurationPath = (newConfigurationPath) => { + ConfigurationPathChange(newConfigurationPath); + fetch( + `${this.props.backendUrl}/checkAvailableDatasetInDB`, + getPostBody({ + path: newConfigurationPath, + inDB: CheckisBox, + CONFIGDB_ADDRESS: ConfigurationDB, + }) + ) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + if (data == 1) { + validConfigPathChange("success"); + ButtonVariantChange("primary"); + } else { + validConfigPathChange("error"); + ButtonVariantChange("danger"); + } + }); + }; -/* + return <p>You clicked 55 times</p>; + + /* const handleModalToggleLaunch = () => { optoSerChanger(optoSerial); (ButtonVariant == 'primary') ? ( handleModalToggleOpen(false) ) : ( handleModalToggleOpen(true) ); @@ -188,7 +239,6 @@ return ( ################################################ */ - /* return ( <React.Fragment> diff --git a/ui/src/SimpleTabs/lpGBT_pannel.js b/ui/src/SimpleTabs/lpGBT_pannel.js index 483d272..e4324b9 100644 --- a/ui/src/SimpleTabs/lpGBT_pannel.js +++ b/ui/src/SimpleTabs/lpGBT_pannel.js @@ -11,10 +11,20 @@ import { Grid, GridItem, PageSection, - Page,Bullseye,TextInput, Panel, PanelHeader, Button, Flex, FlexItem, Tooltip, Modal,ModalVariant, - } from "@patternfly/react-core"; - -import { getPostBody, checkResponse } from '../utils/utility-functions' + Page, + Bullseye, + TextInput, + Panel, + PanelHeader, + Button, + Flex, + FlexItem, + Tooltip, + Modal, + ModalVariant, +} from "@patternfly/react-core"; + +import { getPostBody, checkResponse } from "../utils/utility-functions"; import { EPRXControl } from "../Controls/EPRXControl"; import { QuickCommands, QuickCommandsSlaves } from "../Controls/QuickCommands"; @@ -26,248 +36,366 @@ import { EPRXDllConfig } from "../Controls/EPRXDllConfig"; import { TestPatterns } from "../Controls/TestPatterns"; import { TestPatternsSlave } from "../Controls/TestPatternsSlave"; import { MinConfig } from "../Controls/MinConfig"; -import { MyContext } from '../SimpleTabs/MyContext'; +import { MyContext } from "../SimpleTabs/MyContext"; //<DownlinkEnable /> -//<Characteristics_lpGBT backendUrl={this.props.backendUrl} device={'lpgbt' + this.props.lpGBTNum} /> +//<Characteristics_lpGBT backendUrl={this.props.backendUrl} device={'lpgbt' + this.props.lpGBTNum} /> class MasterlpGBT extends React.Component { - constructor(props) { - super(props); - - this.state = { - i2c_master : [{value: "0", disabled: false},{value: "1", disabled: false},{value: "2", disabled: false}], - fice_g : [{value:"0", disabled: false}, {value:"1", disabled: false}, {value:"2", disabled: false}, {value:"3", disabled: false}], - fice_i : [{value:"0", disabled: false}, {value:"1", disabled: false}, {value:"2", disabled: false}, {value:"3", disabled: false}], - fice_d : [{value:"0", disabled: false}, {value:"1", disabled: false}, {value:"2", disabled: false}, {value:"3", disabled: false}], - fice_I : "0x074", - isSwitched : false, switchLabel: "i2c_start", - serial: "08000000", version: "2", - fice_g_val: "0", fice_i_val: "0", fice_d_val: "0", i2c_master_val: "0", - }; - this.switchBox = checked => {if (this.state.isSwitched==false) {this.setState({isSwitched: checked});}}; - this.handleTextAddress = fice_I => {this.setState({ fice_I });}; - this.handleTextInputChange = serial => {this.setState({ serial });}; - this.handleTextVersion = version => {this.setState({ version });}; - this.onChange_fice_g = (fice_g_val, event) => {this.setState({ fice_g_val });}; - this.onChange_fice_i = (fice_i_val, event) => {this.setState({ fice_i_val });}; - this.onChange_fice_d = (fice_d_val, event) => {this.setState({ fice_d_val });}; - this.onChange_i2c_master = (i2c_master_val, event) => {this.setState({ i2c_master_val });}; - - this.sendSetting = (registerName,settingName,newValue) => { - const body = { - device: 'lpgbt' + props.lpGBTNum, - registerName: registerName, - settingName: settingName, - newValue: newValue, - }; - console.log(body); - return fetch(`${this.props.backendUrl}/sendRegister`, getPostBody(body)).then((response) => checkResponse(response)).then((data) => {console.log(data)}); - }; - - }; - - - - render (){ - return( - - <React.Fragment> - - <Page> - <PageSection> - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - <FlexItem flex={{ default: 'flex_2' }}> - - <QuickCommands backendUrl={this.props.backendUrl} - serial={this.state.serial} i2c_master={this.state.i2c_master} version={this.state.version} - fice_g={this.state.fice_g} fice_i={this.state.fice_i} fice_I={this.state.fice_I} fice_d={this.state.fice_d} - handleTextInputChange={this.handleTextInputChange} handleTextAddress={this.handleTextAddress} handleTextVersion={this.handleTextVersion} onChange_i2c_master={this.onChange_i2c_master} - isSwitched={this.state.isSwitched} switchLabel={this.state.switchLabel} switchBox={this.switchBox} - onChange_fice_g={this.onChange_fice_g} onChange_fice_i={this.onChange_fice_i} onChange_fice_d={this.onChange_fice_d} - fice_g_val={this.state.fice_g_val} fice_i_val={this.state.fice_i_val} fice_d_val={this.state.fice_d_val} - i2c_master_val={this.state.i2c_master_val}/> - - <WriteRead backendUrl={this.props.backendUrl} device={'lpgbt' + this.props.lpGBTNum} - fice_g={this.state.fice_g_val} fice_i={this.state.fice_i_val} fice_d={this.state.fice_d_val} fice_I={this.state.fice_I} - serial={this.state.serial} i2c_master_val={this.state.i2c_master_val} isMaster="true"/> - - - <Characteristics_lpGBT backendUrl={this.props.backendUrl} device={'lpgbt' + this.props.lpGBTNum} /> - - <MinConfig backendUrl={this.props.backendUrl}/> - - </FlexItem> - - <FlexItem flex={{ default: 'flex_4' }}> - <Panel variant="bordered"> - - <PanelHeader> - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - <FlexItem flex={{ default: 'flex_4' }}> - <Bullseye> - <TextContent > - <Text component={TextVariants.h3}>Uplink settings</Text> - </TextContent> - </Bullseye> - </FlexItem> - </Flex> - </PanelHeader> - - <Flex spaceItems={{default: 'spaceItemsNone'}}> - <FlexItem flex={{ default: 'flex_4' }}> - <TestPatterns sendSetting={this.sendSetting} backendUrl={this.props.backendUrl} device={'lpgbt' + this.props.lpGBTNum} lpGBTNum={this.props.lpGBTNum} ConfigurationFile={this.props.ConfigurationFile}/> - </FlexItem> - </Flex> - - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - <FlexItem flex={{ default: 'flex_3' }}> - {[0,1,2,3,4,5].map((num) => ( - <EPRXControl id={num} sendSetting={this.sendSetting} backendUrl={this.props.backendUrl} lpGBTNum={this.props.lpGBTNum} ConfigurationFile={this.props.ConfigurationFile}/> - ))} - </FlexItem> - <FlexItem flex={{ default: 'flex_4' }}> - {[0,1,2,3,4,5].map((num) => ( - <EPRXChnCntr id={num} sendSetting={this.sendSetting} backendUrl={this.props.backendUrl} lpGBTNum={this.props.lpGBTNum} ConfigurationFile={this.props.ConfigurationFile}/> - ))} - </FlexItem> - </Flex> - </Panel> - - <EPRXDllConfig id={"CHANGE"} lpGBTNum={this.props.lpGBTNum} sendSetting={this.sendSetting} backendUrl={this.props.backendUrl} ConfigurationFile={this.props.ConfigurationFile}/> - </FlexItem> - - <FlexItem flex={{ default: 'flex_2' }}> - <Panel variant="bordered"> - <PanelHeader> - <Bullseye> - <TextContent > - <Text component={TextVariants.h3}>Configure downlink pre-emphasis settings </Text> - </TextContent> - </Bullseye> - </PanelHeader> - {[{id: "00", id_reg: '10'},{id: "02", id_reg: '10'},{id: "10", id_reg: '10'},{id: "12", id_reg: '10'}, - {id: "20", id_reg: '32'},{id: "22", id_reg: '32'},{id: "30", id_reg: '32'},{id: "32", id_reg: '32'}].map((num) => ( - <Downlinks_master id={num.id} id_reg={num.id_reg} sendSetting={this.sendSetting} backendUrl={this.props.backendUrl} lpGBTNum={this.props.lpGBTNum} ConfigurationFile={this.props.ConfigurationFile}/>))} - </Panel> - </FlexItem> - - </Flex> - - </PageSection> - </Page> - </React.Fragment> - -);}; + constructor(props) { + super(props); + + this.state = { + i2c_master: [ + { value: "0", disabled: false }, + { value: "1", disabled: false }, + { value: "2", disabled: false }, + ], + fice_g: [ + { value: "0", disabled: false }, + { value: "1", disabled: false }, + { value: "2", disabled: false }, + { value: "3", disabled: false }, + ], + fice_i: [ + { value: "0", disabled: false }, + { value: "1", disabled: false }, + { value: "2", disabled: false }, + { value: "3", disabled: false }, + ], + fice_d: [ + { value: "0", disabled: false }, + { value: "1", disabled: false }, + { value: "2", disabled: false }, + { value: "3", disabled: false }, + ], + fice_I: "0x074", + isSwitched: false, + switchLabel: "i2c_start", + serial: "08000000", + version: "2", + fice_g_val: "0", + fice_i_val: "0", + fice_d_val: "0", + i2c_master_val: "0", + }; + this.switchBox = (checked) => { + if (this.state.isSwitched == false) { + this.setState({ isSwitched: checked }); + } + }; + this.handleTextAddress = (fice_I) => { + this.setState({ fice_I }); + }; + this.handleTextInputChange = (serial) => { + this.setState({ serial }); + }; + this.handleTextVersion = (version) => { + this.setState({ version }); + }; + this.onChange_fice_g = (fice_g_val, event) => { + this.setState({ fice_g_val }); + }; + this.onChange_fice_i = (fice_i_val, event) => { + this.setState({ fice_i_val }); + }; + this.onChange_fice_d = (fice_d_val, event) => { + this.setState({ fice_d_val }); + }; + this.onChange_i2c_master = (i2c_master_val, event) => { + this.setState({ i2c_master_val }); + }; + + this.sendSetting = (registerName, settingName, newValue) => { + const body = { + device: "lpgbt" + props.lpGBTNum, + registerName: registerName, + settingName: settingName, + newValue: newValue, + }; + console.log(body); + return fetch(`${this.props.backendUrl}/sendRegister`, getPostBody(body)) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + }); + }; + } + + /* +<MinConfig backendUrl={this.props.backendUrl}/> +*/ + render() { + return ( + <React.Fragment> + <Page> + <PageSection> + <Flex spaceItems={{ default: "spaceItemsNone" }}> + <FlexItem flex={{ default: "flex_2" }}> + <QuickCommands + backendUrl={this.props.backendUrl} + serial={this.state.serial} + i2c_master={this.state.i2c_master} + version={this.state.version} + fice_g={this.state.fice_g} + fice_i={this.state.fice_i} + fice_I={this.state.fice_I} + fice_d={this.state.fice_d} + handleTextInputChange={this.handleTextInputChange} + handleTextAddress={this.handleTextAddress} + handleTextVersion={this.handleTextVersion} + onChange_i2c_master={this.onChange_i2c_master} + isSwitched={this.state.isSwitched} + switchLabel={this.state.switchLabel} + switchBox={this.switchBox} + onChange_fice_g={this.onChange_fice_g} + onChange_fice_i={this.onChange_fice_i} + onChange_fice_d={this.onChange_fice_d} + fice_g_val={this.state.fice_g_val} + fice_i_val={this.state.fice_i_val} + fice_d_val={this.state.fice_d_val} + i2c_master_val={this.state.i2c_master_val} + /> + + <WriteRead + backendUrl={this.props.backendUrl} + device={"lpgbt" + this.props.lpGBTNum} + fice_g={this.state.fice_g_val} + fice_i={this.state.fice_i_val} + fice_d={this.state.fice_d_val} + fice_I={this.state.fice_I} + serial={this.state.serial} + i2c_master_val={this.state.i2c_master_val} + isMaster="true" + /> + + <Characteristics_lpGBT + backendUrl={this.props.backendUrl} + device={"lpgbt" + this.props.lpGBTNum} + /> + </FlexItem> + + <FlexItem flex={{ default: "flex_4" }}> + <Panel variant="bordered"> + <PanelHeader> + <Flex spaceItems={{ default: "spaceItemsNone" }}> + <FlexItem flex={{ default: "flex_4" }}> + <Bullseye> + <TextContent> + <Text component={TextVariants.h3}> + Uplink settings + </Text> + </TextContent> + </Bullseye> + </FlexItem> + </Flex> + </PanelHeader> + + <Flex spaceItems={{ default: "spaceItemsNone" }}> + <FlexItem flex={{ default: "flex_4" }}> + <TestPatterns + sendSetting={this.sendSetting} + backendUrl={this.props.backendUrl} + device={"lpgbt" + this.props.lpGBTNum} + lpGBTNum={this.props.lpGBTNum} + ConfigurationFile={this.props.ConfigurationFile} + /> + </FlexItem> + </Flex> + + <Flex spaceItems={{ default: "spaceItemsNone" }}> + <FlexItem flex={{ default: "flex_3" }}> + {[0, 1, 2, 3, 4, 5].map((num) => ( + <EPRXControl + id={num} + sendSetting={this.sendSetting} + backendUrl={this.props.backendUrl} + lpGBTNum={this.props.lpGBTNum} + ConfigurationFile={this.props.ConfigurationFile} + /> + ))} + </FlexItem> + <FlexItem flex={{ default: "flex_4" }}> + {[0, 1, 2, 3, 4, 5].map((num) => ( + <EPRXChnCntr + id={num} + sendSetting={this.sendSetting} + backendUrl={this.props.backendUrl} + lpGBTNum={this.props.lpGBTNum} + ConfigurationFile={this.props.ConfigurationFile} + /> + ))} + </FlexItem> + </Flex> + </Panel> + + <EPRXDllConfig + id={"CHANGE"} + lpGBTNum={this.props.lpGBTNum} + sendSetting={this.sendSetting} + backendUrl={this.props.backendUrl} + ConfigurationFile={this.props.ConfigurationFile} + /> + </FlexItem> + + <FlexItem flex={{ default: "flex_2" }}> + <Panel variant="bordered"> + <PanelHeader> + <Bullseye> + <TextContent> + <Text component={TextVariants.h3}> + Configure downlink pre-emphasis settings{" "} + </Text> + </TextContent> + </Bullseye> + </PanelHeader> + {[ + { id: "00", id_reg: "10" }, + { id: "02", id_reg: "10" }, + { id: "10", id_reg: "10" }, + { id: "12", id_reg: "10" }, + { id: "20", id_reg: "32" }, + { id: "22", id_reg: "32" }, + { id: "30", id_reg: "32" }, + { id: "32", id_reg: "32" }, + ].map((num) => ( + <Downlinks_master + id={num.id} + id_reg={num.id_reg} + sendSetting={this.sendSetting} + backendUrl={this.props.backendUrl} + lpGBTNum={this.props.lpGBTNum} + ConfigurationFile={this.props.ConfigurationFile} + /> + ))} + </Panel> + </FlexItem> + </Flex> + </PageSection> + </Page> + </React.Fragment> + ); + } } - class CommonlpGBT extends React.Component { - constructor(props) { - super(props); - - this.state = { - isModalOpen:false, - } - - - this.sendSetting = (registerName,settingName,newValue) => { - const body = { - device: 'lpgbt' + props.lpGBTNum, - registerName: registerName, - settingName: settingName, - newValue: newValue, - }; - console.log(body); - return fetch(`${this.props.backendUrl}/sendRegister`, getPostBody(body)).then((response) => checkResponse(response)).then((data) => {console.log(data)}); - }; - - }; - -//<QuickCommandsSlaves /> -//<Characteristics_lpGBT backendUrl={this.props.backendUrl} device={'lpgbt' + this.props.lpGBTNum}/> - render (){ - return( - - <React.Fragment> - <Page> - <PageSection> - - <Flex> - - <FlexItem flex={{ default: 'flex_2' }}> - - <WriteRead backendUrl={this.props.backendUrl} device={'lpgbt' + this.props.lpGBTNum}/> - - - <FlexItem flex={{ default: 'flex_1' }}> - <TestPatternsSlave sendSetting={this.sendSetting} backendUrl={this.props.backendUrl} lpGBTNum={this.props.lpGBTNum} sendSettingTESTPATTERN={this.sendSettingTESTPATTERN}/> - </FlexItem> - - <Characteristics_lpGBT backendUrl={this.props.backendUrl} device={'lpgbt' + this.props.lpGBTNum}/> - - </FlexItem> - - - <FlexItem flex={{ default: 'flex_4' }}> - <Flex> - <FlexItem flex={{ default: 'flex_2' }}> - {[1,2,3,4,5].map((num) => ( - <EPRXControl id={num} sendSetting={this.sendSetting} backendUrl={this.props.backendUrl} lpGBTNum={this.props.lpGBTNum} ConfigurationFile={this.props.ConfigurationFile}/> - ))} - </FlexItem> - - <FlexItem flex={{ default: 'flex_2' }}> - {[1,2,3,4,5].map((num) => ( - <EPRXChnCntr id={num} sendSetting={this.sendSetting} backendUrl={this.props.backendUrl} lpGBTNum={this.props.lpGBTNum} ConfigurationFile={this.props.ConfigurationFile}/> - ))} - </FlexItem> - </Flex> - - </FlexItem> - - - </Flex> - - </PageSection> - </Page> - </React.Fragment> -);}; + constructor(props) { + super(props); + + this.state = { + isModalOpen: false, + }; + + this.sendSetting = (registerName, settingName, newValue) => { + const body = { + device: "lpgbt" + props.lpGBTNum, + registerName: registerName, + settingName: settingName, + newValue: newValue, + }; + console.log(body); + return fetch(`${this.props.backendUrl}/sendRegister`, getPostBody(body)) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + }); + }; + } + + //<QuickCommandsSlaves /> + //<Characteristics_lpGBT backendUrl={this.props.backendUrl} device={'lpgbt' + this.props.lpGBTNum}/> + render() { + return ( + <React.Fragment> + <Page> + <PageSection> + <Flex> + <FlexItem flex={{ default: "flex_2" }}> + <WriteRead + backendUrl={this.props.backendUrl} + device={"lpgbt" + this.props.lpGBTNum} + /> + + <FlexItem flex={{ default: "flex_1" }}> + <TestPatternsSlave + sendSetting={this.sendSetting} + backendUrl={this.props.backendUrl} + lpGBTNum={this.props.lpGBTNum} + sendSettingTESTPATTERN={this.sendSettingTESTPATTERN} + /> + </FlexItem> + + <Characteristics_lpGBT + backendUrl={this.props.backendUrl} + device={"lpgbt" + this.props.lpGBTNum} + /> + </FlexItem> + + <FlexItem flex={{ default: "flex_4" }}> + <Flex> + <FlexItem flex={{ default: "flex_2" }}> + {[1, 2, 3, 4, 5].map((num) => ( + <EPRXControl + id={num} + sendSetting={this.sendSetting} + backendUrl={this.props.backendUrl} + lpGBTNum={this.props.lpGBTNum} + ConfigurationFile={this.props.ConfigurationFile} + /> + ))} + </FlexItem> + + <FlexItem flex={{ default: "flex_2" }}> + {[1, 2, 3, 4, 5].map((num) => ( + <EPRXChnCntr + id={num} + sendSetting={this.sendSetting} + backendUrl={this.props.backendUrl} + lpGBTNum={this.props.lpGBTNum} + ConfigurationFile={this.props.ConfigurationFile} + /> + ))} + </FlexItem> + </Flex> + </FlexItem> + </Flex> + </PageSection> + </Page> + </React.Fragment> + ); + } } class Placeholder extends React.Component { - constructor(props) { - super(props); - }; - render (){ - return( - <React.Fragment> - <Page> - <PageSection> - - <Grid hasGutter> - - <GridItem span={2}> - {[1,2,3,4,5].map((num) => ( - <TextContent> - <Text component={TextVariants.h3}>EPRX Control</Text> - </TextContent> - ))} - </GridItem> - - <GridItem span={3}> - {[1,2,3,4,5].map((num) => ( - <TextContent> - <Text component={TextVariants.h3}>EPRX Control</Text> - </TextContent> - ))} - </GridItem> - - </Grid> - </PageSection> - </Page> - </React.Fragment> -);};} - - -export {MasterlpGBT, CommonlpGBT, Placeholder}; + constructor(props) { + super(props); + } + render() { + return ( + <React.Fragment> + <Page> + <PageSection> + <Grid hasGutter> + <GridItem span={2}> + {[1, 2, 3, 4, 5].map((num) => ( + <TextContent> + <Text component={TextVariants.h3}>EPRX Control</Text> + </TextContent> + ))} + </GridItem> + + <GridItem span={3}> + {[1, 2, 3, 4, 5].map((num) => ( + <TextContent> + <Text component={TextVariants.h3}>EPRX Control</Text> + </TextContent> + ))} + </GridItem> + </Grid> + </PageSection> + </Page> + </React.Fragment> + ); + } +} +export { MasterlpGBT, CommonlpGBT, Placeholder }; -- GitLab From 3a53bd30e48bb33acb24e159f219691278fca4a4 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Tue, 14 Feb 2023 10:56:58 +0100 Subject: [PATCH 03/33] Small bug in celeryTasks --- itk_demo_optoboard/celeryTasks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/itk_demo_optoboard/celeryTasks.py b/itk_demo_optoboard/celeryTasks.py index 34135a5..d6c53ea 100644 --- a/itk_demo_optoboard/celeryTasks.py +++ b/itk_demo_optoboard/celeryTasks.py @@ -12,7 +12,7 @@ from additional_driver.DB_access import ( ) from driver.Optoboard import Optoboard from driver.log import logger, ch -from driver.Comm_wrapper import Comm_wrapper +from driver.CommWrapper import CommWrapper from driver.components import components ### initialize the optoboard object @@ -53,7 +53,7 @@ def initOptoListTask(optoboard_list): config_file = getConfigDataset() ######### Initialize the communication wrapper - Communication_wrapper = Comm_wrapper( + Communication_wrapper = CommWrapper( flx_G=x["flx_G"], flx_d=x["flx_d"], lpgbt_master_addr=components_opto["lpgbt_master_addr"], @@ -120,7 +120,7 @@ def initializeOptoboardTasks( ######### Initialize the communication wrapper global Communication_wrapper - Communication_wrapper = Comm_wrapper( + Communication_wrapper = CommWrapper( flx_G=flx_G, flx_d=flx_d, lpgbt_master_addr=components_opto["lpgbt_master_addr"], -- GitLab From d687ba897f6c60a87e1c86df96443de863f9752e Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Tue, 14 Feb 2023 16:30:34 +0100 Subject: [PATCH 04/33] WIP: found issue with unmounted component --- itk_demo_optoboard/celeryTasks.py | 7 + ui/src/Controls/Config.js | 17 ++- ui/src/Controls/OptoStatus.js | 2 +- ui/src/SimpleTabs/Configurations.js | 136 ++++++++++++++++- ui/src/SimpleTabs/OptoboardList.js | 227 +++++++++++++--------------- 5 files changed, 260 insertions(+), 129 deletions(-) diff --git a/itk_demo_optoboard/celeryTasks.py b/itk_demo_optoboard/celeryTasks.py index d6c53ea..e410ee3 100644 --- a/itk_demo_optoboard/celeryTasks.py +++ b/itk_demo_optoboard/celeryTasks.py @@ -35,6 +35,13 @@ def initOptoListTask(optoboard_list): components_opto = OrderedDict(components[x["serialNumber"]]) opto_info_dic[x["Position"]]["components"] = components_opto + if x["vtrxVersion"] == "1.2": + vtrx_v_string = "1_2" + elif x["vtrxVersion"] == "1.3": + vtrx_v_string = "1_3" + else: + raise ValueError("Invalid vtrx version provided!") + if not x["inDBCheckBox"]: if x["ConfigurationPath"]!="": configuration_path = os.getcwd() + "/itk_demo_optoboard/optoboard_felix/configs/optoboard"+ str(components_opto["optoboard_v"]) + "_lpgbtv" + str(components_opto["lpgbt_v"]) + "_gbcr" + str(components_opto["gbcr_v"]) + "_vtrxv" + vtrx_v_string + "_default.json" diff --git a/ui/src/Controls/Config.js b/ui/src/Controls/Config.js index f8bb6ff..c4046bc 100644 --- a/ui/src/Controls/Config.js +++ b/ui/src/Controls/Config.js @@ -12,7 +12,7 @@ import { } from "@patternfly/react-core"; import { getPostBody, checkResponse } from '../utils/utility-functions' -function Config({backendUrl, optoboardPosition}){ +function Config({backendUrl, optoboardPosition, optoComponents}){ const [isLoading, setisLoading] = useState(false); const [switchState, setswitchState] = useState(false); const [CheckBox_lpgbt1, toggleBox_lpgbt1] = useState(true); @@ -25,6 +25,7 @@ function Config({backendUrl, optoboardPosition}){ const [CheckBox_gbcr4, toggleBox_gbcr4] = useState(true); const [buttonVariant, setbuttonVariant] = useState("primary"); + const configure = () => { let body={} if (switchState) { @@ -43,7 +44,7 @@ function Config({backendUrl, optoboardPosition}){ setisLoading(true); console.log("Starting configuration of the Optoboard!"); console.log(body); - + fetch(`${backendUrl}/configure`, getPostBody(body)).then( (response) => checkResponse(response)).then((data) => {console.log(data); setisLoading(false); if (data === "Optoboard configuration failed") {setbuttonVariant("warning")} else {setbuttonVariant("primary")}}); //if (data == "Optoboard configuration completed") { EnableI2C(); DataSet(this.state.pathToJson, this.state.vtrxVersionValue, this.state.inDBCheckBox) }; @@ -55,8 +56,8 @@ function Config({backendUrl, optoboardPosition}){ const stringGBCR = (switchState) ? <h4> gbcr to configure</h4> : <h4 style={{color:"grey"}}> gbcr to configure</h4> useEffect(() => { - const stringLPGBT = (switchState) ? <h4>lpgbt to configure</h4> : <h4 style={{color:"grey"}}>lpgbt to configure</h4> - const stringGBCR = (switchState) ? <h4> gbcr to configure</h4> : <h4 style={{color:"grey"}}> gbcr to configure</h4> + const stringLPGBT = (switchState) ? <h4>lpgbt to configure</h4> : <h4 style={{color:"grey"}}>lpgbt to configure</h4>; + const stringGBCR = (switchState) ? <h4> gbcr to configure</h4> : <h4 style={{color:"grey"}}> gbcr to configure</h4>; } ); @@ -126,10 +127,10 @@ function Config({backendUrl, optoboardPosition}){ </FlexItem> <FlexItem> <Bullseye> - <Checkbox label={""} isChecked={CheckBox_gbcr1} onChange={() => toggleBox_gbcr1(!CheckBox_gbcr1)} id={"gbcr_config_1"} name={"gbcr_config_1"} isDisabled={!switchState}/> - <Checkbox label={""} isChecked={CheckBox_gbcr2} onChange={() => toggleBox_gbcr2(!CheckBox_gbcr2)} id={"gbcr_config_2"} name={"gbcr_config_2"} isDisabled={!switchState}/> - <Checkbox label={""} isChecked={CheckBox_gbcr3} onChange={() => toggleBox_gbcr3(!CheckBox_gbcr3)} id={"gbcr_config_3"} name={"gbcr_config_3"} isDisabled={!switchState}/> - <Checkbox label={""} isChecked={CheckBox_gbcr4} onChange={() => toggleBox_gbcr4(!CheckBox_gbcr4)} id={"gbcr_config_4"} name={"gbcr_config_4"} isDisabled={!switchState}/> + <Checkbox label={""} isChecked={CheckBox_gbcr1} onChange={() => toggleBox_gbcr1(!CheckBox_gbcr1)} id={"gbcr_config_1"} name={"gbcr_config_1"} isDisabled={!(switchState && optoComponents.gbcr1)}/> + <Checkbox label={""} isChecked={CheckBox_gbcr2} onChange={() => toggleBox_gbcr2(!CheckBox_gbcr2)} id={"gbcr_config_2"} name={"gbcr_config_2"} isDisabled={!(switchState && optoComponents.gbcr2)}/> + <Checkbox label={""} isChecked={CheckBox_gbcr3} onChange={() => toggleBox_gbcr3(!CheckBox_gbcr3)} id={"gbcr_config_3"} name={"gbcr_config_3"} isDisabled={!(switchState && optoComponents.gbcr3)}/> + <Checkbox label={""} isChecked={CheckBox_gbcr4} onChange={() => toggleBox_gbcr4(!CheckBox_gbcr4)} id={"gbcr_config_4"} name={"gbcr_config_4"} isDisabled={!(switchState && optoComponents.gbcr4)}/> </Bullseye> </FlexItem> </Flex> diff --git a/ui/src/Controls/OptoStatus.js b/ui/src/Controls/OptoStatus.js index 53fbdf0..1b1306d 100644 --- a/ui/src/Controls/OptoStatus.js +++ b/ui/src/Controls/OptoStatus.js @@ -19,7 +19,7 @@ import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclam import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon'; -export function OptoStatus({backendUrl, optoboardPosition}) { +export function OptoStatus({backendUrl, optoboardPosition, optoComponents}) { const [lpgbt1Status, setlpgbt1Status] = useState(0); const [lpgbt2Status, setlpgbt2Status] = useState(0); const [lpgbt3Status, setlpgbt3Status] = useState(0); diff --git a/ui/src/SimpleTabs/Configurations.js b/ui/src/SimpleTabs/Configurations.js index b747f90..080c7f7 100644 --- a/ui/src/SimpleTabs/Configurations.js +++ b/ui/src/SimpleTabs/Configurations.js @@ -1,3 +1,5 @@ +const defaultConfig = "SR1"; + const Configurations = { Basic: [ { @@ -117,4 +119,136 @@ const Configurations = { ], }; -export { Configurations }; +const OptoInfo = { + SR1 : + { + "OB0": { + "components": { + "I2C_master": 0, + "efused": 0, + "gbcr1": 1, + "gbcr2": 1, + "gbcr3": 1, + "gbcr4": 1, + "gbcr_v": 2, + "lpgbt1": 1, + "lpgbt2": 1, + "lpgbt3": 1, + "lpgbt4": 1, + "lpgbt_master_addr": 116, + "lpgbt_v": 1, + "optoboard_v": 2 + } + }, + "OB1": { + "components": { + "I2C_master": 0, + "efused": 0, + "gbcr1": 1, + "gbcr2": 1, + "gbcr3": 1, + "gbcr4": 1, + "gbcr_v": 2, + "lpgbt1": 1, + "lpgbt2": 1, + "lpgbt3": 1, + "lpgbt4": 1, + "lpgbt_master_addr": 116, + "lpgbt_v": 1, + "optoboard_v": 2 + } + }, + "OB2": { + "components": { + "I2C_master": 0, + "efused": 0, + "gbcr1": 1, + "gbcr2": 1, + "gbcr3": 1, + "gbcr4": 1, + "gbcr_v": 2, + "lpgbt1": 1, + "lpgbt2": 1, + "lpgbt3": 1, + "lpgbt4": 1, + "lpgbt_master_addr": 116, + "lpgbt_v": 1, + "optoboard_v": 2 + } + }, + "OB3": { + "components": { + "I2C_master": 0, + "efused": 0, + "gbcr1": 1, + "gbcr2": 1, + "gbcr3": 1, + "gbcr4": 1, + "gbcr_v": 2, + "lpgbt1": 1, + "lpgbt2": 1, + "lpgbt3": 1, + "lpgbt4": 1, + "lpgbt_master_addr": 116, + "lpgbt_v": 1, + "optoboard_v": 2 + } + }, + "OB4": { + "components": { + "I2C_master": 0, + "efused": 0, + "gbcr1": 1, + "gbcr2": 1, + "gbcr3": 1, + "gbcr4": 1, + "gbcr_v": 2, + "lpgbt1": 1, + "lpgbt2": 1, + "lpgbt3": 1, + "lpgbt4": 1, + "lpgbt_master_addr": 116, + "lpgbt_v": 1, + "optoboard_v": 2 + } + }, + "OB5": { + "components": { + "I2C_master": 0, + "efused": 0, + "gbcr1": 1, + "gbcr2": 1, + "gbcr3": 1, + "gbcr4": 1, + "gbcr_v": 2, + "lpgbt1": 1, + "lpgbt2": 1, + "lpgbt3": 1, + "lpgbt4": 1, + "lpgbt_master_addr": 116, + "lpgbt_v": 1, + "optoboard_v": 2 + } + }, + "OB6": { + "components": { + "I2C_master": 0, + "efused": 0, + "gbcr1": 1, + "gbcr2": 1, + "gbcr3": 1, + "gbcr4": 1, + "gbcr_v": 2, + "lpgbt1": 1, + "lpgbt2": 1, + "lpgbt3": 1, + "lpgbt4": 1, + "lpgbt_master_addr": 116, + "lpgbt_v": 1, + "optoboard_v": 2 + } + } + } +} + +export { defaultConfig, Configurations, OptoInfo }; diff --git a/ui/src/SimpleTabs/OptoboardList.js b/ui/src/SimpleTabs/OptoboardList.js index c62525e..54c82f9 100644 --- a/ui/src/SimpleTabs/OptoboardList.js +++ b/ui/src/SimpleTabs/OptoboardList.js @@ -2,7 +2,7 @@ import React, { useState, useEffect } from "react"; import { SimpleList, SimpleListItem } from "@patternfly/react-core"; import { WriteReadBox } from "../Controls/WriteReadBox"; import { Config } from "../Controls/Config"; -import { Configurations } from "../SimpleTabs/Configurations"; +import { defaultConfig, Configurations, OptoInfo } from "../SimpleTabs/Configurations"; import { OptoStatus } from "../Controls/OptoStatus"; import { DevelPanel } from "../SimpleTabs/DevelPanel"; import { AddOptoboard } from "../SimpleTabs/AddOptoboard"; @@ -46,7 +46,10 @@ import PlusCircleIcon from "@patternfly/react-icons/dist/esm/icons/plus-circle-i import { getPostBody, checkResponse } from "../utils/utility-functions"; export function OptoboardList({ url }) { - const [optoList, setoptoList] = useState(Configurations["SR1"]); + const [DefaultConfig, setDefaultConfig] = useState(defaultConfig); + const [optoList, setoptoList] = useState(Configurations[DefaultConfig]); + const [optoListInfo, setoptoListInfo] = useState(OptoInfo[DefaultConfig]); + const [isOpen, setisOpen] = useState(false); const [OpenDevel, setOpenDevel] = useState(false); const [modify, setmodify] = useState(false); @@ -75,18 +78,18 @@ export function OptoboardList({ url }) { for (var key in Configurations) { ConfigurationOptions.push({ value: key, label: key, disabled: false }); } - const [DefaultConfig, setDefaultConfig] = useState("SR1"); - function optoListChange(x) { - setoptoList(x); - fetch(`${url}/sendOptoList`, getPostBody({ optoList: x })) + function optoListChange(newOptoList) { + fetch(`${url}/sendOptoList`, getPostBody({ optoList: newOptoList })) .then((response) => checkResponse(response)) .then((data) => { + setoptoListInfo(data); console.log(data); }) .catch((err) => { console.log(err); }); + setoptoList(newOptoList); } const [firstLoad, setfirstLoad] = useState(true); @@ -95,14 +98,7 @@ export function OptoboardList({ url }) { if (firstLoad) { console.log("Load!"); setfirstLoad(false); - fetch(`${url}/sendOptoList`, getPostBody({ optoList: optoList })) - .then((response) => checkResponse(response)) - .then((data) => { - console.log(data); - }) - .catch((err) => { - console.log(err); - }); + optoListChange(optoList); } }); @@ -136,7 +132,6 @@ export function OptoboardList({ url }) { */ return ( <React.Fragment> - <Page> <PageSection> <Panel> @@ -199,108 +194,103 @@ export function OptoboardList({ url }) { <Flex> {optoList.map((opto, index) => { return ( - <FlexItem> - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - <Flex> - <FlexItem flex={{ default: "flex_1" }}> - <TextContent> - <Text component={TextVariants.h3}> - {opto.Position} - </Text> - </TextContent> - </FlexItem> - <FlexItem - align={{ defautl: "alignRight" }} - > - <Tooltip - content={"Enable advanced mode"} - > - <Button - aria-label="modify" - variant="plain" - id="tt-ref" - onClick={() => { - setOpenDevel(!OpenDevel); - }} - > - <Icon> - <PlusCircleIcon /> - </Icon> - </Button> - </Tooltip> - <Tooltip - content={ - <div> - <h4> - Serial Number:{" "} - {opto.serialNumber} Vtrx:{" "} - {opto.vtrxVersion}{" "} - </h4> - <h4> - testmode:{" "} - {opto.testmode.toString()}{" "} - Debug:{" "} - {opto.debugCheckBox.toString()} - </h4> - <h4> - flx_G: {opto.flx_G} flx_d:{" "} - {opto.flx_d} woflxcore:{" "} - {opto.withoutFelixcore.toString()}{" "} - </h4> - <h4> - inConfigDB:{" "} - {opto.inDBCheckBox.toString()}{" "} - Configuration File:{" "} - {opto.ConfigurationPath} - </h4> - <h4> - ConfigDB: {opto.ConfigurationDB}{" "} - </h4> - </div> - } - > - <Button - aria-label="drawer" - variant="plain" - id="tt-ref" - onClick={() => { - setcurrentOpto(opto); - setindexcurrentOpto(index); - setmodify(true); - setisOpen(true); - }} - > - <Icon> - <CogIcon /> - </Icon> - </Button> - </Tooltip> - </FlexItem> - </Flex> - <Flex> - <FlexItem> - <WriteReadBox - backendUrl={url} - optoboardPosition={opto.Position} - /> - </FlexItem> - <FlexItem> - <Config - backendUrl={url} - optoboardPosition={opto.Position} - /> - <OptoStatus - backendUrl={url} - optoboardPosition={opto.Position} - /> - </FlexItem> - </Flex> - </PanelMainBody> - </PanelMain> - </Panel> - </FlexItem> + <FlexItem key={index + "optoInList"}> + <Panel variant="bordered"> + <PanelMain> + <PanelMainBody> + <Flex> + <FlexItem flex={{ default: "flex_1" }}> + <TextContent> + <Text component={TextVariants.h3}> + {opto.Position} + </Text> + </TextContent> + </FlexItem> + <FlexItem align={{ defautl: "alignRight" }}> + <Tooltip content={"Enable advanced mode"}> + <Button + aria-label="modify" + variant="plain" + id="tt-ref" + onClick={() => { + setOpenDevel(!OpenDevel); + }} + > + <Icon> + <PlusCircleIcon /> + </Icon> + </Button> + </Tooltip> + <Tooltip + content={ + <div> + <h4> + Serial Number: {opto.serialNumber}{" "} + Vtrx: {opto.vtrxVersion}{" "} + </h4> + <h4> + testmode: {opto.testmode.toString()}{" "} + Debug: {opto.debugCheckBox.toString()} + </h4> + <h4> + flx_G: {opto.flx_G} flx_d:{" "} + {opto.flx_d} woflxcore:{" "} + {opto.withoutFelixcore.toString()}{" "} + </h4> + <h4> + inConfigDB:{" "} + {opto.inDBCheckBox.toString()}{" "} + Configuration File:{" "} + {opto.ConfigurationPath} + </h4> + <h4> + ConfigDB: {opto.ConfigurationDB}{" "} + </h4> + </div> + } + > + <Button + aria-label="drawer" + variant="plain" + id="tt-ref2" + onClick={() => { + setcurrentOpto(opto); + setindexcurrentOpto(index); + setmodify(true); + setisOpen(true); + }} + > + <Icon> + <CogIcon /> + </Icon> + </Button> + </Tooltip> + </FlexItem> + </Flex> + <Flex> + <FlexItem> + <WriteReadBox + backendUrl={url} + optoboardPosition={opto.Position} + /> + </FlexItem> + <FlexItem> + <Config + backendUrl={url} + optoboardPosition={opto.Position} + optoComponents={optoListInfo[opto.Position].components} + /> + <OptoStatus + backendUrl={url} + optoboardPosition={opto.Position} + optoComponents={optoListInfo[opto.Position].components} + /> + </FlexItem> + </Flex> + </PanelMainBody> + </PanelMain> + </Panel> + </FlexItem> ); })} </Flex> @@ -309,7 +299,6 @@ export function OptoboardList({ url }) { </Panel> </PageSection> </Page> - </React.Fragment> ); -} \ No newline at end of file +} -- GitLab From 0a9078720ebe20ecea1817ef6d7135e395beca02 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Wed, 15 Feb 2023 17:09:01 +0100 Subject: [PATCH 05/33] Solved issue with infinite loop --- ui/src/Controls/Config.js | 340 +++++++++++++++++----------- ui/src/Controls/OptoStatus.js | 2 +- ui/src/SimpleTabs/Configurations.js | 249 ++++++++++---------- ui/src/SimpleTabs/OptoboardList.js | 313 +++++++++++++------------ 4 files changed, 503 insertions(+), 401 deletions(-) diff --git a/ui/src/Controls/Config.js b/ui/src/Controls/Config.js index c4046bc..f25e13a 100644 --- a/ui/src/Controls/Config.js +++ b/ui/src/Controls/Config.js @@ -8,144 +8,222 @@ import { Flex, FlexItem, Checkbox, - Switch + Switch, } from "@patternfly/react-core"; -import { getPostBody, checkResponse } from '../utils/utility-functions' +import { getPostBody, checkResponse } from "../utils/utility-functions"; -function Config({backendUrl, optoboardPosition, optoComponents}){ - const [isLoading, setisLoading] = useState(false); - const [switchState, setswitchState] = useState(false); - const [CheckBox_lpgbt1, toggleBox_lpgbt1] = useState(true); - const [CheckBox_lpgbt2, toggleBox_lpgbt2] = useState(true); - const [CheckBox_lpgbt3, toggleBox_lpgbt3] = useState(true); - const [CheckBox_lpgbt4, toggleBox_lpgbt4] = useState(true); - const [CheckBox_gbcr1, toggleBox_gbcr1] = useState(true); - const [CheckBox_gbcr2, toggleBox_gbcr2] = useState(true); - const [CheckBox_gbcr3, toggleBox_gbcr3] = useState(true); - const [CheckBox_gbcr4, toggleBox_gbcr4] = useState(true); - const [buttonVariant, setbuttonVariant] = useState("primary"); +function Config({ backendUrl, optoboardPosition, optoComponents }) { + const [isLoading, setisLoading] = useState(false); + const [switchState, setswitchState] = useState(false); + const [CheckBox_lpgbt1, toggleBox_lpgbt1] = useState(true); + const [CheckBox_lpgbt2, toggleBox_lpgbt2] = useState(true); + const [CheckBox_lpgbt3, toggleBox_lpgbt3] = useState(true); + const [CheckBox_lpgbt4, toggleBox_lpgbt4] = useState(true); + const [CheckBox_gbcr1, toggleBox_gbcr1] = useState(true); + const [CheckBox_gbcr2, toggleBox_gbcr2] = useState(true); + const [CheckBox_gbcr3, toggleBox_gbcr3] = useState(true); + const [CheckBox_gbcr4, toggleBox_gbcr4] = useState(true); + const [buttonVariant, setbuttonVariant] = useState("primary"); + const configure = () => { + let body = {}; + if (switchState) { + body = { + optoboardPosition: optoboardPosition, + activeLpgbt: + (CheckBox_lpgbt1 ? "1" : "0") + + (CheckBox_lpgbt2 ? "1" : "0") + + (CheckBox_lpgbt3 ? "1" : "0") + + (CheckBox_lpgbt4 ? "1" : "0"), + activeGbcr: + (CheckBox_gbcr1 ? "1" : "0") + + (CheckBox_gbcr2 ? "1" : "0") + + (CheckBox_gbcr3 ? "1" : "0") + + (CheckBox_gbcr4 ? "1" : "0"), + }; + } else { + body = { + optoboardPosition: optoboardPosition, + activeLpgbt: "None", + activeGbcr: "None", + }; + } + setisLoading(true); + console.log("Starting configuration of the Optoboard!"); + console.log(body); - const configure = () => { - let body={} - if (switchState) { - body = { - optoboardPosition: optoboardPosition, - activeLpgbt: (CheckBox_lpgbt1 ? "1":"0") + (CheckBox_lpgbt2 ? "1":"0") + (CheckBox_lpgbt3 ? "1":"0") + (CheckBox_lpgbt4 ? "1":"0"), - activeGbcr: (CheckBox_gbcr1 ? "1":"0") + (CheckBox_gbcr2 ? "1":"0") + (CheckBox_gbcr3 ? "1":"0") + (CheckBox_gbcr4 ? "1":"0"), - } - } else { - body = { - optoboardPosition: optoboardPosition, - activeLpgbt: "None", - activeGbcr: "None", - } - }; - setisLoading(true); - console.log("Starting configuration of the Optoboard!"); - console.log(body); - - fetch(`${backendUrl}/configure`, getPostBody(body)).then( - (response) => checkResponse(response)).then((data) => {console.log(data); setisLoading(false); if (data === "Optoboard configuration failed") {setbuttonVariant("warning")} else {setbuttonVariant("primary")}}); - //if (data == "Optoboard configuration completed") { EnableI2C(); DataSet(this.state.pathToJson, this.state.vtrxVersionValue, this.state.inDBCheckBox) }; - //});.catch(err => {this.setState({isLoading: false});}); - + fetch(`${backendUrl}/configure`, getPostBody(body)) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + setisLoading(false); + if (data === "Optoboard configuration failed") { + setbuttonVariant("warning"); + } else { + setbuttonVariant("primary"); + } + }) + .finally(setisLoading(true)); + //if (data == "Optoboard configuration completed") { EnableI2C(); DataSet(this.state.pathToJson, this.state.vtrxVersionValue, this.state.inDBCheckBox) }; + //});.catch(err => {this.setState({isLoading: false});}); + }; + const stringLPGBT = switchState ? ( + <h4>lpgbt to configure</h4> + ) : ( + <h4 style={{ color: "grey" }}>lpgbt to configure</h4> + ); + const stringGBCR = switchState ? ( + <h4> gbcr to configure</h4> + ) : ( + <h4 style={{ color: "grey" }}> gbcr to configure</h4> + ); - }; - const stringLPGBT = (switchState) ? <h4>lpgbt to configure</h4> : <h4 style={{color:"grey"}}>lpgbt to configure</h4> - const stringGBCR = (switchState) ? <h4> gbcr to configure</h4> : <h4 style={{color:"grey"}}> gbcr to configure</h4> + useEffect(() => { + const stringLPGBT = switchState ? ( + <h4>lpgbt to configure</h4> + ) : ( + <h4 style={{ color: "grey" }}>lpgbt to configure</h4> + ); + const stringGBCR = switchState ? ( + <h4> gbcr to configure</h4> + ) : ( + <h4 style={{ color: "grey" }}> gbcr to configure</h4> + ); + }); - useEffect(() => { - const stringLPGBT = (switchState) ? <h4>lpgbt to configure</h4> : <h4 style={{color:"grey"}}>lpgbt to configure</h4>; - const stringGBCR = (switchState) ? <h4> gbcr to configure</h4> : <h4 style={{color:"grey"}}> gbcr to configure</h4>; - } - ); - - return( - <React.Fragment> - - <Flex direction={{ default: 'column' }}> - <Panel variant=""> - <PanelMain> - <PanelMainBody> - - - <Bullseye> - <Button - spinnerAriaValueText={isLoading ? 'Loading' : undefined} - isLoading={isLoading} - id="readCharacteristics" - variant={buttonVariant} - onClick={(event) => { - configure(); - }} - > - {isLoading ? "Configuring..." : "Configure Optoboard" } - </Button> - </Bullseye> - - <Bullseye> - <Flex> - <FlexItem> - <Bullseye> - <h3>Manual selection</h3> - </Bullseye> - </FlexItem> - <FlexItem> - <Switch - id="no-label-switch-off" - aria-label="Message when on" - //labelOff="Message when off" - isChecked={switchState} - onChange={() => setswitchState(!switchState)} - //isReversed - /> - </FlexItem> - </Flex> - </Bullseye> - - <Bullseye> - <Flex> - <FlexItem> - {stringLPGBT} - </FlexItem> - <FlexItem> - <Bullseye> - <Checkbox label={""} isChecked={CheckBox_lpgbt1} onChange={() => {toggleBox_lpgbt1(!CheckBox_lpgbt1)}} id={"lpgbt_config_1"} name={"lpgbt_config_1"} isDisabled={!switchState}/> - <Checkbox label={""} isChecked={CheckBox_lpgbt2} onChange={() => {toggleBox_lpgbt2(!CheckBox_lpgbt2)}} id={"lpgbt_config_2"} name={"lpgbt_config_2"} isDisabled={!switchState}/> - <Checkbox label={""} isChecked={CheckBox_lpgbt3} onChange={() => toggleBox_lpgbt3(!CheckBox_lpgbt3)} id={"lpgbt_config_3"} name={"lpgbt_config_3"} isDisabled={!switchState}/> - <Checkbox label={""} isChecked={CheckBox_lpgbt4} onChange={() => toggleBox_lpgbt4(!CheckBox_lpgbt4)} id={"lpgbt_config_4"} name={"lpgbt_config_4"} isDisabled={!switchState}/> - </Bullseye> - </FlexItem> - </Flex> - </Bullseye> - - <Bullseye> - <Flex> - <FlexItem > - {stringGBCR} - </FlexItem> - <FlexItem> - <Bullseye> - <Checkbox label={""} isChecked={CheckBox_gbcr1} onChange={() => toggleBox_gbcr1(!CheckBox_gbcr1)} id={"gbcr_config_1"} name={"gbcr_config_1"} isDisabled={!(switchState && optoComponents.gbcr1)}/> - <Checkbox label={""} isChecked={CheckBox_gbcr2} onChange={() => toggleBox_gbcr2(!CheckBox_gbcr2)} id={"gbcr_config_2"} name={"gbcr_config_2"} isDisabled={!(switchState && optoComponents.gbcr2)}/> - <Checkbox label={""} isChecked={CheckBox_gbcr3} onChange={() => toggleBox_gbcr3(!CheckBox_gbcr3)} id={"gbcr_config_3"} name={"gbcr_config_3"} isDisabled={!(switchState && optoComponents.gbcr3)}/> - <Checkbox label={""} isChecked={CheckBox_gbcr4} onChange={() => toggleBox_gbcr4(!CheckBox_gbcr4)} id={"gbcr_config_4"} name={"gbcr_config_4"} isDisabled={!(switchState && optoComponents.gbcr4)}/> - </Bullseye> - </FlexItem> - </Flex> - </Bullseye> - - </PanelMainBody> - </PanelMain> - </Panel> - </Flex> - - </React.Fragment> - ) -} + return ( + <React.Fragment> + <Flex direction={{ default: "column" }}> + <Panel variant=""> + <PanelMain> + <PanelMainBody> + <Bullseye> + <Button + spinnerAriaValueText={isLoading ? "Loading" : undefined} + isLoading={isLoading} + id="readCharacteristics" + variant={buttonVariant} + onClick={(event) => { + configure(); + }} + > + {isLoading ? "Configuring..." : "Configure Optoboard"} + </Button> + </Bullseye> + <Bullseye> + <Flex> + <FlexItem> + <Bullseye> + <h3>Manual selection</h3> + </Bullseye> + </FlexItem> + <FlexItem> + <Switch + id="no-label-switch-off" + aria-label="Message when on" + //labelOff="Message when off" + isChecked={switchState} + onChange={() => setswitchState(!switchState)} + //isReversed + /> + </FlexItem> + </Flex> + </Bullseye> + <Bullseye> + <Flex> + <FlexItem>{stringLPGBT}</FlexItem> + <FlexItem> + <Bullseye> + <Checkbox + label={""} + isChecked={CheckBox_lpgbt1} + onChange={() => { + toggleBox_lpgbt1(!CheckBox_lpgbt1); + }} + id={"lpgbt_config_1"} + name={"lpgbt_config_1"} + isDisabled={!switchState} + /> + <Checkbox + label={""} + isChecked={CheckBox_lpgbt2} + onChange={() => { + toggleBox_lpgbt2(!CheckBox_lpgbt2); + }} + id={"lpgbt_config_2"} + name={"lpgbt_config_2"} + isDisabled={!switchState} + /> + <Checkbox + label={""} + isChecked={CheckBox_lpgbt3} + onChange={() => toggleBox_lpgbt3(!CheckBox_lpgbt3)} + id={"lpgbt_config_3"} + name={"lpgbt_config_3"} + isDisabled={!switchState} + /> + <Checkbox + label={""} + isChecked={CheckBox_lpgbt4} + onChange={() => toggleBox_lpgbt4(!CheckBox_lpgbt4)} + id={"lpgbt_config_4"} + name={"lpgbt_config_4"} + isDisabled={!switchState} + /> + </Bullseye> + </FlexItem> + </Flex> + </Bullseye> + <Bullseye> + <Flex> + <FlexItem>{stringGBCR}</FlexItem> + <FlexItem> + <Bullseye> + <Checkbox + label={""} + isChecked={CheckBox_gbcr1} + onChange={() => toggleBox_gbcr1(!CheckBox_gbcr1)} + id={"gbcr_config_1"} + name={"gbcr_config_1"} + isDisabled={!(switchState && optoComponents.gbcr1)} + /> + <Checkbox + label={""} + isChecked={CheckBox_gbcr2} + onChange={() => toggleBox_gbcr2(!CheckBox_gbcr2)} + id={"gbcr_config_2"} + name={"gbcr_config_2"} + isDisabled={!(switchState && optoComponents.gbcr2)} + /> + <Checkbox + label={""} + isChecked={CheckBox_gbcr3} + onChange={() => toggleBox_gbcr3(!CheckBox_gbcr3)} + id={"gbcr_config_3"} + name={"gbcr_config_3"} + isDisabled={!(switchState && optoComponents.gbcr3)} + /> + <Checkbox + label={""} + isChecked={CheckBox_gbcr4} + onChange={() => toggleBox_gbcr4(!CheckBox_gbcr4)} + id={"gbcr_config_4"} + name={"gbcr_config_4"} + isDisabled={!(switchState && optoComponents.gbcr4)} + /> + </Bullseye> + </FlexItem> + </Flex> + </Bullseye> + </PanelMainBody> + </PanelMain> + </Panel> + </Flex> + </React.Fragment> + ); +} -export {Config}; \ No newline at end of file +export { Config }; diff --git a/ui/src/Controls/OptoStatus.js b/ui/src/Controls/OptoStatus.js index 1b1306d..53fbdf0 100644 --- a/ui/src/Controls/OptoStatus.js +++ b/ui/src/Controls/OptoStatus.js @@ -19,7 +19,7 @@ import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclam import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon'; -export function OptoStatus({backendUrl, optoboardPosition, optoComponents}) { +export function OptoStatus({backendUrl, optoboardPosition}) { const [lpgbt1Status, setlpgbt1Status] = useState(0); const [lpgbt2Status, setlpgbt2Status] = useState(0); const [lpgbt3Status, setlpgbt3Status] = useState(0); diff --git a/ui/src/SimpleTabs/Configurations.js b/ui/src/SimpleTabs/Configurations.js index 080c7f7..444db2f 100644 --- a/ui/src/SimpleTabs/Configurations.js +++ b/ui/src/SimpleTabs/Configurations.js @@ -3,7 +3,7 @@ const defaultConfig = "SR1"; const Configurations = { Basic: [ { - serialNumber: "00000000", + serialNumber: "30000000", Position: "OB0", vtrxVersion: "1.3", flx_G: "0", @@ -120,135 +120,134 @@ const Configurations = { }; const OptoInfo = { - SR1 : - { - "OB0": { - "components": { - "I2C_master": 0, - "efused": 0, - "gbcr1": 1, - "gbcr2": 1, - "gbcr3": 1, - "gbcr4": 1, - "gbcr_v": 2, - "lpgbt1": 1, - "lpgbt2": 1, - "lpgbt3": 1, - "lpgbt4": 1, - "lpgbt_master_addr": 116, - "lpgbt_v": 1, - "optoboard_v": 2 - } + SR1: { + OB0: { + components: { + I2C_master: 0, + efused: 0, + gbcr1: 1, + gbcr2: 1, + gbcr3: 1, + gbcr4: 1, + gbcr_v: 2, + lpgbt1: 1, + lpgbt2: 1, + lpgbt3: 1, + lpgbt4: 1, + lpgbt_master_addr: 116, + lpgbt_v: 1, + optoboard_v: 2, + }, }, - "OB1": { - "components": { - "I2C_master": 0, - "efused": 0, - "gbcr1": 1, - "gbcr2": 1, - "gbcr3": 1, - "gbcr4": 1, - "gbcr_v": 2, - "lpgbt1": 1, - "lpgbt2": 1, - "lpgbt3": 1, - "lpgbt4": 1, - "lpgbt_master_addr": 116, - "lpgbt_v": 1, - "optoboard_v": 2 - } + OB1: { + components: { + I2C_master: 0, + efused: 0, + gbcr1: 1, + gbcr2: 1, + gbcr3: 1, + gbcr4: 1, + gbcr_v: 2, + lpgbt1: 1, + lpgbt2: 1, + lpgbt3: 1, + lpgbt4: 1, + lpgbt_master_addr: 116, + lpgbt_v: 1, + optoboard_v: 2, + }, }, - "OB2": { - "components": { - "I2C_master": 0, - "efused": 0, - "gbcr1": 1, - "gbcr2": 1, - "gbcr3": 1, - "gbcr4": 1, - "gbcr_v": 2, - "lpgbt1": 1, - "lpgbt2": 1, - "lpgbt3": 1, - "lpgbt4": 1, - "lpgbt_master_addr": 116, - "lpgbt_v": 1, - "optoboard_v": 2 - } + OB2: { + components: { + I2C_master: 0, + efused: 0, + gbcr1: 1, + gbcr2: 1, + gbcr3: 1, + gbcr4: 1, + gbcr_v: 2, + lpgbt1: 1, + lpgbt2: 1, + lpgbt3: 1, + lpgbt4: 1, + lpgbt_master_addr: 116, + lpgbt_v: 1, + optoboard_v: 2, + }, }, - "OB3": { - "components": { - "I2C_master": 0, - "efused": 0, - "gbcr1": 1, - "gbcr2": 1, - "gbcr3": 1, - "gbcr4": 1, - "gbcr_v": 2, - "lpgbt1": 1, - "lpgbt2": 1, - "lpgbt3": 1, - "lpgbt4": 1, - "lpgbt_master_addr": 116, - "lpgbt_v": 1, - "optoboard_v": 2 - } + OB3: { + components: { + I2C_master: 0, + efused: 0, + gbcr1: 1, + gbcr2: 1, + gbcr3: 1, + gbcr4: 1, + gbcr_v: 2, + lpgbt1: 1, + lpgbt2: 1, + lpgbt3: 1, + lpgbt4: 1, + lpgbt_master_addr: 116, + lpgbt_v: 1, + optoboard_v: 2, + }, }, - "OB4": { - "components": { - "I2C_master": 0, - "efused": 0, - "gbcr1": 1, - "gbcr2": 1, - "gbcr3": 1, - "gbcr4": 1, - "gbcr_v": 2, - "lpgbt1": 1, - "lpgbt2": 1, - "lpgbt3": 1, - "lpgbt4": 1, - "lpgbt_master_addr": 116, - "lpgbt_v": 1, - "optoboard_v": 2 - } + OB4: { + components: { + I2C_master: 0, + efused: 0, + gbcr1: 1, + gbcr2: 1, + gbcr3: 1, + gbcr4: 1, + gbcr_v: 2, + lpgbt1: 1, + lpgbt2: 1, + lpgbt3: 1, + lpgbt4: 1, + lpgbt_master_addr: 116, + lpgbt_v: 1, + optoboard_v: 2, + }, }, - "OB5": { - "components": { - "I2C_master": 0, - "efused": 0, - "gbcr1": 1, - "gbcr2": 1, - "gbcr3": 1, - "gbcr4": 1, - "gbcr_v": 2, - "lpgbt1": 1, - "lpgbt2": 1, - "lpgbt3": 1, - "lpgbt4": 1, - "lpgbt_master_addr": 116, - "lpgbt_v": 1, - "optoboard_v": 2 - } + OB5: { + components: { + I2C_master: 0, + efused: 0, + gbcr1: 1, + gbcr2: 1, + gbcr3: 1, + gbcr4: 1, + gbcr_v: 2, + lpgbt1: 1, + lpgbt2: 1, + lpgbt3: 1, + lpgbt4: 1, + lpgbt_master_addr: 116, + lpgbt_v: 1, + optoboard_v: 2, + }, }, - "OB6": { - "components": { - "I2C_master": 0, - "efused": 0, - "gbcr1": 1, - "gbcr2": 1, - "gbcr3": 1, - "gbcr4": 1, - "gbcr_v": 2, - "lpgbt1": 1, - "lpgbt2": 1, - "lpgbt3": 1, - "lpgbt4": 1, - "lpgbt_master_addr": 116, - "lpgbt_v": 1, - "optoboard_v": 2 - } - } - } -} + OB6: { + components: { + I2C_master: 0, + efused: 0, + gbcr1: 1, + gbcr2: 1, + gbcr3: 1, + gbcr4: 1, + gbcr_v: 2, + lpgbt1: 1, + lpgbt2: 1, + lpgbt3: 1, + lpgbt4: 1, + lpgbt_master_addr: 116, + lpgbt_v: 1, + optoboard_v: 2, + }, + }, + }, +}; export { defaultConfig, Configurations, OptoInfo }; diff --git a/ui/src/SimpleTabs/OptoboardList.js b/ui/src/SimpleTabs/OptoboardList.js index 54c82f9..6a65e9e 100644 --- a/ui/src/SimpleTabs/OptoboardList.js +++ b/ui/src/SimpleTabs/OptoboardList.js @@ -2,7 +2,11 @@ import React, { useState, useEffect } from "react"; import { SimpleList, SimpleListItem } from "@patternfly/react-core"; import { WriteReadBox } from "../Controls/WriteReadBox"; import { Config } from "../Controls/Config"; -import { defaultConfig, Configurations, OptoInfo } from "../SimpleTabs/Configurations"; +import { + defaultConfig, + Configurations, + OptoInfo, +} from "../SimpleTabs/Configurations"; import { OptoStatus } from "../Controls/OptoStatus"; import { DevelPanel } from "../SimpleTabs/DevelPanel"; import { AddOptoboard } from "../SimpleTabs/AddOptoboard"; @@ -49,25 +53,9 @@ export function OptoboardList({ url }) { const [DefaultConfig, setDefaultConfig] = useState(defaultConfig); const [optoList, setoptoList] = useState(Configurations[DefaultConfig]); const [optoListInfo, setoptoListInfo] = useState(OptoInfo[DefaultConfig]); + const [loadingData, setloadingData] = useState(false); + const [isOpenConfig, setisOpenConfig] = useState(false); - const [isOpen, setisOpen] = useState(false); - const [OpenDevel, setOpenDevel] = useState(false); - const [modify, setmodify] = useState(false); - const [currentOpto, setcurrentOpto] = useState({ - serialNumber: "00000000", - Position: "OB0", - vtrxVersion: "1.3", - flx_G: "0", - flx_d: "0", - withoutFelixcore: false, - ConfigurationPath: - "/itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json", - inDBCheckBox: false, - ConfigurationDB: "http://localhost:5000", - debugCheckBox: false, - testmode: false, - }); - const [indexcurrentOpto, setindexcurrentOpto] = useState(); const ConfigurationOptions = [ { value: "Load Configuration", @@ -80,39 +68,26 @@ export function OptoboardList({ url }) { } function optoListChange(newOptoList) { - fetch(`${url}/sendOptoList`, getPostBody({ optoList: newOptoList })) - .then((response) => checkResponse(response)) - .then((data) => { - setoptoListInfo(data); - console.log(data); - }) - .catch((err) => { - console.log(err); - }); - setoptoList(newOptoList); + setoptoList(newOptoList); + console.log("New optolist"); } - const [firstLoad, setfirstLoad] = useState(true); - useEffect(() => { - if (firstLoad) { - console.log("Load!"); - setfirstLoad(false); - optoListChange(optoList); - } - }); + console.log("Load!"); + optoListChange(optoList); + }, []); /* - url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto - const AddOptoboardModal = AddOptoboard(url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto); - */ + url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto + const AddOptoboardModal = AddOptoboard(url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto); + */ /* <AddOptoboard url={url} optoList={optoList} setoptoList={setoptoList} isOpen={isOpen} setisOpen={setisOpen} modify={modify} setmodify={setmodify} currentOpto={currentOpto} setcurrentOpto={setcurrentOpto}/> */ /* useEffect(() => {console.log(currentOpto); - const AddOptoboardModal = AddOptoboard(url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto); - })*/ + const AddOptoboardModal = AddOptoboard(url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto); + })*/ /* <AddOptoboard @@ -130,6 +105,7 @@ export function OptoboardList({ url }) { <DevelPanel url={url} OpenDevel={OpenDevel} setOpenDevel={setOpenDevel} /> */ + return ( <React.Fragment> <Page> @@ -142,7 +118,7 @@ export function OptoboardList({ url }) { <Button variant="secondary" isLarge - onClick={() => setisOpen(!isOpen)} + onClick={() => setisOpenConfig(!isOpenConfig)} > <h3> Add Configuration </h3> </Button> @@ -152,6 +128,7 @@ export function OptoboardList({ url }) { value={DefaultConfig} onChange={(X) => { setDefaultConfig(X); + setloadingData(true); optoListChange(Configurations[X]); }} aria-label="FormSelect Input" @@ -192,107 +169,16 @@ export function OptoboardList({ url }) { <PanelMain> <PanelMainBody> <Flex> - {optoList.map((opto, index) => { - return ( - <FlexItem key={index + "optoInList"}> - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - <Flex> - <FlexItem flex={{ default: "flex_1" }}> - <TextContent> - <Text component={TextVariants.h3}> - {opto.Position} - </Text> - </TextContent> - </FlexItem> - <FlexItem align={{ defautl: "alignRight" }}> - <Tooltip content={"Enable advanced mode"}> - <Button - aria-label="modify" - variant="plain" - id="tt-ref" - onClick={() => { - setOpenDevel(!OpenDevel); - }} - > - <Icon> - <PlusCircleIcon /> - </Icon> - </Button> - </Tooltip> - <Tooltip - content={ - <div> - <h4> - Serial Number: {opto.serialNumber}{" "} - Vtrx: {opto.vtrxVersion}{" "} - </h4> - <h4> - testmode: {opto.testmode.toString()}{" "} - Debug: {opto.debugCheckBox.toString()} - </h4> - <h4> - flx_G: {opto.flx_G} flx_d:{" "} - {opto.flx_d} woflxcore:{" "} - {opto.withoutFelixcore.toString()}{" "} - </h4> - <h4> - inConfigDB:{" "} - {opto.inDBCheckBox.toString()}{" "} - Configuration File:{" "} - {opto.ConfigurationPath} - </h4> - <h4> - ConfigDB: {opto.ConfigurationDB}{" "} - </h4> - </div> - } - > - <Button - aria-label="drawer" - variant="plain" - id="tt-ref2" - onClick={() => { - setcurrentOpto(opto); - setindexcurrentOpto(index); - setmodify(true); - setisOpen(true); - }} - > - <Icon> - <CogIcon /> - </Icon> - </Button> - </Tooltip> - </FlexItem> - </Flex> - <Flex> - <FlexItem> - <WriteReadBox - backendUrl={url} - optoboardPosition={opto.Position} - /> - </FlexItem> - <FlexItem> - <Config - backendUrl={url} - optoboardPosition={opto.Position} - optoComponents={optoListInfo[opto.Position].components} - /> - <OptoStatus - backendUrl={url} - optoboardPosition={opto.Position} - optoComponents={optoListInfo[opto.Position].components} - /> - </FlexItem> - </Flex> - </PanelMainBody> - </PanelMain> - </Panel> - </FlexItem> - ); - })} + <ListDisplay + url={url} + optoList={optoList} + optoListInfo={optoListInfo} + setoptoList={setoptoList} + setoptoListInfo={setoptoListInfo} + DefaultConfig={DefaultConfig} + loadingData={loadingData} + setloadingData={setloadingData} + /> </Flex> </PanelMainBody> </PanelMain> @@ -302,3 +188,142 @@ export function OptoboardList({ url }) { </React.Fragment> ); } + +function ListDisplay({ + url, + optoList, + optoListInfo, + setoptoList, + setoptoListInfo, + DefaultConfig, + loadingData, + setloadingData, +}) { + const [OpenDevel, setOpenDevel] = useState(false); + const [modify, setmodify] = useState(false); + const [isOpen, setisOpen] = useState(false); + const [currentOpto, setcurrentOpto] = useState({ + serialNumber: "00000000", + Position: "OB0", + vtrxVersion: "1.3", + flx_G: "0", + flx_d: "0", + withoutFelixcore: false, + ConfigurationPath: + "/itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json", + inDBCheckBox: false, + ConfigurationDB: "http://localhost:5000", + debugCheckBox: false, + testmode: false, + }); + const [indexcurrentOpto, setindexcurrentOpto] = useState(); + + useEffect(() => { + fetch(`${url}/sendOptoList`, getPostBody({ optoList: optoList })) + .then((response) => checkResponse(response)) + .then((data) => { + setoptoList(optoList); + setoptoListInfo(data); + console.log(data); + console.log(DefaultConfig); + console.log("from function useEffect"); + }) + .catch((err) => { + console.log(err); + }); + }, [DefaultConfig]); + + return optoList.map((opto, index) => { + return ( + <FlexItem key={index + "optoInList"}> + <Panel variant="bordered"> + <PanelMain> + <PanelMainBody> + <Flex> + <FlexItem flex={{ default: "flex_1" }}> + <TextContent> + <Text component={TextVariants.h3}>{opto.Position}</Text> + </TextContent> + </FlexItem> + <FlexItem align={{ defautl: "alignRight" }}> + <Tooltip content={"Enable advanced mode"}> + <Button + aria-label="modify" + variant="plain" + id="tt-ref" + onClick={() => { + setOpenDevel(!OpenDevel); + }} + > + <Icon> + <PlusCircleIcon /> + </Icon> + </Button> + </Tooltip> + <Tooltip + content={ + <div> + <h4> + Serial Number: {opto.serialNumber} Vtrx:{" "} + {opto.vtrxVersion}{" "} + </h4> + <h4> + testmode: {opto.testmode.toString()} Debug:{" "} + {opto.debugCheckBox.toString()} + </h4> + <h4> + flx_G: {opto.flx_G} flx_d: {opto.flx_d} woflxcore:{" "} + {opto.withoutFelixcore.toString()}{" "} + </h4> + <h4> + inConfigDB: {opto.inDBCheckBox.toString()}{" "} + Configuration File: {opto.ConfigurationPath} + </h4> + <h4>ConfigDB: {opto.ConfigurationDB} </h4> + </div> + } + > + <Button + aria-label="drawer" + variant="plain" + id="tt-ref2" + onClick={() => { + setcurrentOpto(opto); + setindexcurrentOpto(index); + setmodify(true); + setisOpen(true); + }} + > + <Icon> + <CogIcon /> + </Icon> + </Button> + </Tooltip> + </FlexItem> + </Flex> + <Flex> + <FlexItem> + <WriteReadBox + backendUrl={url} + optoboardPosition={opto.Position} + /> + </FlexItem> + <FlexItem> + {/* <Config + backendUrl={url} + optoboardPosition={opto.Position} + optoComponents={optoListInfo[opto.Position].components} + /> */} + <OptoStatus + backendUrl={url} + optoboardPosition={opto.Position} + /> + </FlexItem> + </Flex> + </PanelMainBody> + </PanelMain> + </Panel> + </FlexItem> + ); + }); +} -- GitLab From a1dad4ebf8cc1f16cc11af6d32cf44759336a047 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Thu, 16 Feb 2023 10:04:48 +0100 Subject: [PATCH 06/33] Solved issue with access of components information in .map func --- .gitignore | 4 +- ui/src/SimpleTabs/OptoboardList.js | 275 +++++++++++++++-------------- 2 files changed, 148 insertions(+), 131 deletions(-) diff --git a/.gitignore b/.gitignore index 7000f2c..a6d1217 100644 --- a/.gitignore +++ b/.gitignore @@ -163,7 +163,7 @@ package-lock.json poetry.lock -felixclass.log -optoboard.log +*felixclass.log +*optoboard.log .AFTER ui/.AFTER diff --git a/ui/src/SimpleTabs/OptoboardList.js b/ui/src/SimpleTabs/OptoboardList.js index 6a65e9e..2218118 100644 --- a/ui/src/SimpleTabs/OptoboardList.js +++ b/ui/src/SimpleTabs/OptoboardList.js @@ -51,9 +51,8 @@ import { getPostBody, checkResponse } from "../utils/utility-functions"; export function OptoboardList({ url }) { const [DefaultConfig, setDefaultConfig] = useState(defaultConfig); - const [optoList, setoptoList] = useState(Configurations[DefaultConfig]); - const [optoListInfo, setoptoListInfo] = useState(OptoInfo[DefaultConfig]); - const [loadingData, setloadingData] = useState(false); + // const [optoList, setoptoList] = useState(Configurations[DefaultConfig]); + // const [optoListInfo, setoptoListInfo] = useState(OptoInfo[DefaultConfig]); const [isOpenConfig, setisOpenConfig] = useState(false); const ConfigurationOptions = [ @@ -67,15 +66,15 @@ export function OptoboardList({ url }) { ConfigurationOptions.push({ value: key, label: key, disabled: false }); } - function optoListChange(newOptoList) { - setoptoList(newOptoList); - console.log("New optolist"); - } + // function optoListChange(newOptoList) { + // setoptoList(newOptoList); + // console.log("New optolist"); + // } - useEffect(() => { - console.log("Load!"); - optoListChange(optoList); - }, []); + // useEffect(() => { + // console.log("Load!"); + // optoListChange(optoList); + // }, []); /* url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto @@ -128,8 +127,7 @@ export function OptoboardList({ url }) { value={DefaultConfig} onChange={(X) => { setDefaultConfig(X); - setloadingData(true); - optoListChange(Configurations[X]); + // optoListChange(Configurations[X]); }} aria-label="FormSelect Input" > @@ -169,16 +167,7 @@ export function OptoboardList({ url }) { <PanelMain> <PanelMainBody> <Flex> - <ListDisplay - url={url} - optoList={optoList} - optoListInfo={optoListInfo} - setoptoList={setoptoList} - setoptoListInfo={setoptoListInfo} - DefaultConfig={DefaultConfig} - loadingData={loadingData} - setloadingData={setloadingData} - /> + <ListDisplay url={url} DefaultConfig={DefaultConfig} /> </Flex> </PanelMainBody> </PanelMain> @@ -189,17 +178,11 @@ export function OptoboardList({ url }) { ); } -function ListDisplay({ - url, - optoList, - optoListInfo, - setoptoList, - setoptoListInfo, - DefaultConfig, - loadingData, - setloadingData, -}) { +function ListDisplay({ url, DefaultConfig }) { + const [optoList, setoptoList] = useState(Configurations[DefaultConfig]); + const [optoListInfo, setoptoListInfo] = useState(OptoInfo[DefaultConfig]); const [OpenDevel, setOpenDevel] = useState(false); + const [loadingData, setloadingData] = useState(false); const [modify, setmodify] = useState(false); const [isOpen, setisOpen] = useState(false); const [currentOpto, setcurrentOpto] = useState({ @@ -219,111 +202,145 @@ function ListDisplay({ const [indexcurrentOpto, setindexcurrentOpto] = useState(); useEffect(() => { - fetch(`${url}/sendOptoList`, getPostBody({ optoList: optoList })) + setloadingData(true); + fetch( + `${url}/sendOptoList`, + getPostBody({ optoList: Configurations[DefaultConfig] }) + ) .then((response) => checkResponse(response)) .then((data) => { - setoptoList(optoList); + setoptoList(Configurations[DefaultConfig]); setoptoListInfo(data); - console.log(data); - console.log(DefaultConfig); - console.log("from function useEffect"); + console.log(DefaultConfig + " from function useEffect"); }) .catch((err) => { console.log(err); + }) + .finally(() => { + setloadingData(false); }); }, [DefaultConfig]); - return optoList.map((opto, index) => { + // useEffect(() => { + // if (loadingData) { + // setoptoList(Configurations[DefaultConfig]); + // fetch( + // `${url}/sendOptoList`, + // getPostBody({ optoList: Configurations[DefaultConfig] }) + // ) + // .then((response) => checkResponse(response)) + // .then((data) => { + // setoptoListInfo(data); + // console.log(DefaultConfig + " from function useEffect"); + // }) + // .catch((err) => { + // console.log(err); + // }) + // .finally(setloadingData(false)); + // } + // }); + + if (loadingData) { return ( - <FlexItem key={index + "optoInList"}> - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - <Flex> - <FlexItem flex={{ default: "flex_1" }}> - <TextContent> - <Text component={TextVariants.h3}>{opto.Position}</Text> - </TextContent> - </FlexItem> - <FlexItem align={{ defautl: "alignRight" }}> - <Tooltip content={"Enable advanced mode"}> - <Button - aria-label="modify" - variant="plain" - id="tt-ref" - onClick={() => { - setOpenDevel(!OpenDevel); - }} - > - <Icon> - <PlusCircleIcon /> - </Icon> - </Button> - </Tooltip> - <Tooltip - content={ - <div> - <h4> - Serial Number: {opto.serialNumber} Vtrx:{" "} - {opto.vtrxVersion}{" "} - </h4> - <h4> - testmode: {opto.testmode.toString()} Debug:{" "} - {opto.debugCheckBox.toString()} - </h4> - <h4> - flx_G: {opto.flx_G} flx_d: {opto.flx_d} woflxcore:{" "} - {opto.withoutFelixcore.toString()}{" "} - </h4> - <h4> - inConfigDB: {opto.inDBCheckBox.toString()}{" "} - Configuration File: {opto.ConfigurationPath} - </h4> - <h4>ConfigDB: {opto.ConfigurationDB} </h4> - </div> - } - > - <Button - aria-label="drawer" - variant="plain" - id="tt-ref2" - onClick={() => { - setcurrentOpto(opto); - setindexcurrentOpto(index); - setmodify(true); - setisOpen(true); - }} - > - <Icon> - <CogIcon /> - </Icon> - </Button> - </Tooltip> - </FlexItem> - </Flex> - <Flex> - <FlexItem> - <WriteReadBox - backendUrl={url} - optoboardPosition={opto.Position} - /> - </FlexItem> - <FlexItem> - {/* <Config - backendUrl={url} - optoboardPosition={opto.Position} - optoComponents={optoListInfo[opto.Position].components} - /> */} - <OptoStatus - backendUrl={url} - optoboardPosition={opto.Position} - /> - </FlexItem> - </Flex> - </PanelMainBody> - </PanelMain> - </Panel> - </FlexItem> + <TextContent> + <Text component={TextVariants.h3}>"Loading..."</Text> + </TextContent> ); - }); + } else { + console.log(optoList); + console.log(optoListInfo); + return optoList.map((opto, index) => { + return ( + <FlexItem key={index + "optoInList"}> + <Panel variant="bordered"> + <PanelMain> + <PanelMainBody> + <Flex> + <FlexItem flex={{ default: "flex_1" }}> + <TextContent> + <Text component={TextVariants.h3}>{opto.Position}</Text> + </TextContent> + </FlexItem> + <FlexItem align={{ defautl: "alignRight" }}> + <Tooltip content={"Enable advanced mode"}> + <Button + aria-label="modify" + variant="plain" + id="tt-ref" + onClick={() => { + setOpenDevel(!OpenDevel); + }} + > + <Icon> + <PlusCircleIcon /> + </Icon> + </Button> + </Tooltip> + <Tooltip + content={ + <div> + <h4> + Serial Number: {opto.serialNumber} Vtrx:{" "} + {opto.vtrxVersion}{" "} + </h4> + <h4> + testmode: {opto.testmode.toString()} Debug:{" "} + {opto.debugCheckBox.toString()} + </h4> + <h4> + flx_G: {opto.flx_G} flx_d: {opto.flx_d} woflxcore:{" "} + {opto.withoutFelixcore.toString()}{" "} + </h4> + <h4> + inConfigDB: {opto.inDBCheckBox.toString()}{" "} + Configuration File: {opto.ConfigurationPath} + </h4> + <h4>ConfigDB: {opto.ConfigurationDB} </h4> + </div> + } + > + <Button + aria-label="drawer" + variant="plain" + id="tt-ref2" + onClick={() => { + setcurrentOpto(opto); + setindexcurrentOpto(index); + setmodify(true); + setisOpen(true); + }} + > + <Icon> + <CogIcon /> + </Icon> + </Button> + </Tooltip> + </FlexItem> + </Flex> + <Flex> + <FlexItem> + <WriteReadBox + backendUrl={url} + optoboardPosition={opto.Position} + /> + </FlexItem> + <FlexItem> + <Config + backendUrl={url} + optoboardPosition={opto.Position} + optoComponents={optoListInfo[opto.Position].components} + /> + <OptoStatus + backendUrl={url} + optoboardPosition={opto.Position} + /> + </FlexItem> + </Flex> + </PanelMainBody> + </PanelMain> + </Panel> + </FlexItem> + ); + }); + } } -- GitLab From 0430738172463407821f0f22b841a5774a8a47b9 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Thu, 16 Feb 2023 10:49:02 +0100 Subject: [PATCH 07/33] Add OptoboardGUI.js --- ui/src/SimpleTabs/OptoboardGUI.js | 178 ++++++++++++++++++++++++++++ ui/src/SimpleTabs/OptoboardList.js | 179 +++-------------------------- ui/src/index.tsx | 9 +- 3 files changed, 202 insertions(+), 164 deletions(-) create mode 100644 ui/src/SimpleTabs/OptoboardGUI.js diff --git a/ui/src/SimpleTabs/OptoboardGUI.js b/ui/src/SimpleTabs/OptoboardGUI.js new file mode 100644 index 0000000..65c0fed --- /dev/null +++ b/ui/src/SimpleTabs/OptoboardGUI.js @@ -0,0 +1,178 @@ +import React, { useState, useEffect } from "react"; +import { SimpleList, SimpleListItem } from "@patternfly/react-core"; +import { WriteReadBox } from "../Controls/WriteReadBox"; +import { Config } from "../Controls/Config"; +import { + defaultConfig, + Configurations, + OptoInfo, +} from "../SimpleTabs/Configurations"; +import { OptoboardList } from "../SimpleTabs/OptoboardList"; +import { OptoStatus } from "../Controls/OptoStatus"; +import { DevelPanel } from "../SimpleTabs/DevelPanel"; +import { AddOptoboard } from "../SimpleTabs/AddOptoboard"; + +import { + Bullseye, + Button, + Flex, + FlexItem, + Modal, + ModalVariant, + Text, + TextContent, + TextVariants, + Tooltip, + TextInput, + Panel, + PanelMain, + PanelMainBody, + PanelHeader, + Page, + PageSection, + PageSectionVariants, + Switch, + FormSelect, + FormSelectOption, + Checkbox, + Icon, + Drawer, + DrawerPanelContent, + DrawerContent, + DrawerContentBody, + DrawerHead, + DrawerActions, + DrawerCloseButton, + Spinner, +} from "@patternfly/react-core"; + +import CogIcon from "@patternfly/react-icons/dist/esm/icons/cog-icon"; +import PlusCircleIcon from "@patternfly/react-icons/dist/esm/icons/plus-circle-icon"; + +import { getPostBody, checkResponse } from "../utils/utility-functions"; + +export function OptoboardGUI({ url }) { + const [DefaultConfig, setDefaultConfig] = useState(defaultConfig); + const [isOpenConfig, setisOpenConfig] = useState(false); + + const ConfigurationOptions = [ + { + value: "Load Configuration", + label: "Load Configuration", + disabled: true, + }, + ]; + for (var key in Configurations) { + ConfigurationOptions.push({ value: key, label: key, disabled: false }); + } + + // function optoListChange(newOptoList) { + // setoptoList(newOptoList); + // console.log("New optolist"); + // } + + // useEffect(() => { + // console.log("Load!"); + // optoListChange(optoList); + // }, []); + + /* + url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto + const AddOptoboardModal = AddOptoboard(url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto); + */ + /* +<AddOptoboard url={url} optoList={optoList} setoptoList={setoptoList} isOpen={isOpen} setisOpen={setisOpen} modify={modify} setmodify={setmodify} currentOpto={currentOpto} setcurrentOpto={setcurrentOpto}/> +*/ + + /* useEffect(() => {console.log(currentOpto); + const AddOptoboardModal = AddOptoboard(url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto); + })*/ + + /* + <AddOptoboard + url={url} + optoList={optoList} + setoptoList={setoptoList} + isOpen={isOpen} + setisOpen={setisOpen} + modify={modify} + setmodify={setmodify} + currentOpto={currentOpto} + indexcurrentOpto={indexcurrentOpto} + setcurrentOpto={setcurrentOpto} + /> + + <DevelPanel url={url} OpenDevel={OpenDevel} setOpenDevel={setOpenDevel} /> + */ + + return ( + <React.Fragment> + <Page> + <PageSection> + <Panel> + <PanelMain> + <PanelMainBody> + <Flex> + <FlexItem key={"add_configuration"}> + <Button + variant="secondary" + isLarge + onClick={() => setisOpenConfig(!isOpenConfig)} + > + <h3> Add Configuration </h3> + </Button> + </FlexItem> + <FlexItem> + <FormSelect + value={DefaultConfig} + onChange={(X) => { + setDefaultConfig(X); + }} + aria-label="FormSelect Input" + > + {ConfigurationOptions.map((option, index) => ( + <FormSelectOption + isDisabled={option.disabled} + key={index} + value={option.value} + label={option.label} + /> + ))} + </FormSelect> + </FlexItem> + <FlexItem key={"add configuration"}> + <Button + variant="link" + onClick={() => { + fetch(`${url}/health`) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + }) + .catch((err) => { + console.log(err); + }); + }} + > + <h3> Health </h3> + </Button> + </FlexItem> + </Flex> + </PanelMainBody> + </PanelMain> + </Panel> + + <Panel> + <PanelMain> + <PanelMainBody> + <Flex> + <OptoboardList url={url} DefaultConfig={DefaultConfig} /> + </Flex> + </PanelMainBody> + </PanelMain> + </Panel> + </PageSection> + </Page> + </React.Fragment> + ); +} diff --git a/ui/src/SimpleTabs/OptoboardList.js b/ui/src/SimpleTabs/OptoboardList.js index 2218118..0021f19 100644 --- a/ui/src/SimpleTabs/OptoboardList.js +++ b/ui/src/SimpleTabs/OptoboardList.js @@ -42,6 +42,7 @@ import { DrawerHead, DrawerActions, DrawerCloseButton, + Spinner, } from "@patternfly/react-core"; import CogIcon from "@patternfly/react-icons/dist/esm/icons/cog-icon"; @@ -49,140 +50,11 @@ import PlusCircleIcon from "@patternfly/react-icons/dist/esm/icons/plus-circle-i import { getPostBody, checkResponse } from "../utils/utility-functions"; -export function OptoboardList({ url }) { - const [DefaultConfig, setDefaultConfig] = useState(defaultConfig); - // const [optoList, setoptoList] = useState(Configurations[DefaultConfig]); - // const [optoListInfo, setoptoListInfo] = useState(OptoInfo[DefaultConfig]); - const [isOpenConfig, setisOpenConfig] = useState(false); - - const ConfigurationOptions = [ - { - value: "Load Configuration", - label: "Load Configuration", - disabled: true, - }, - ]; - for (var key in Configurations) { - ConfigurationOptions.push({ value: key, label: key, disabled: false }); - } - - // function optoListChange(newOptoList) { - // setoptoList(newOptoList); - // console.log("New optolist"); - // } - - // useEffect(() => { - // console.log("Load!"); - // optoListChange(optoList); - // }, []); - - /* - url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto - const AddOptoboardModal = AddOptoboard(url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto); - */ - /* -<AddOptoboard url={url} optoList={optoList} setoptoList={setoptoList} isOpen={isOpen} setisOpen={setisOpen} modify={modify} setmodify={setmodify} currentOpto={currentOpto} setcurrentOpto={setcurrentOpto}/> -*/ - - /* useEffect(() => {console.log(currentOpto); - const AddOptoboardModal = AddOptoboard(url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto); - })*/ - - /* - <AddOptoboard - url={url} - optoList={optoList} - setoptoList={setoptoList} - isOpen={isOpen} - setisOpen={setisOpen} - modify={modify} - setmodify={setmodify} - currentOpto={currentOpto} - indexcurrentOpto={indexcurrentOpto} - setcurrentOpto={setcurrentOpto} - /> - - <DevelPanel url={url} OpenDevel={OpenDevel} setOpenDevel={setOpenDevel} /> - */ - - return ( - <React.Fragment> - <Page> - <PageSection> - <Panel> - <PanelMain> - <PanelMainBody> - <Flex> - <FlexItem key={"add_configuration"}> - <Button - variant="secondary" - isLarge - onClick={() => setisOpenConfig(!isOpenConfig)} - > - <h3> Add Configuration </h3> - </Button> - </FlexItem> - <FlexItem> - <FormSelect - value={DefaultConfig} - onChange={(X) => { - setDefaultConfig(X); - // optoListChange(Configurations[X]); - }} - aria-label="FormSelect Input" - > - {ConfigurationOptions.map((option, index) => ( - <FormSelectOption - isDisabled={option.disabled} - key={index} - value={option.value} - label={option.label} - /> - ))} - </FormSelect> - </FlexItem> - <FlexItem key={"add configuration"}> - <Button - variant="link" - onClick={() => { - fetch(`${url}/health`) - .then((response) => checkResponse(response)) - .then((data) => { - console.log(data); - }) - .catch((err) => { - console.log(err); - }); - }} - > - <h3> Health </h3> - </Button> - </FlexItem> - </Flex> - </PanelMainBody> - </PanelMain> - </Panel> - - <Panel> - <PanelMain> - <PanelMainBody> - <Flex> - <ListDisplay url={url} DefaultConfig={DefaultConfig} /> - </Flex> - </PanelMainBody> - </PanelMain> - </Panel> - </PageSection> - </Page> - </React.Fragment> - ); -} - -function ListDisplay({ url, DefaultConfig }) { - const [optoList, setoptoList] = useState(Configurations[DefaultConfig]); - const [optoListInfo, setoptoListInfo] = useState(OptoInfo[DefaultConfig]); +export function OptoboardList({ url, DefaultConfig }) { + const [optoList, setoptoList] = useState({}); //Configurations[DefaultConfig] + const [optoListInfo, setoptoListInfo] = useState({}); const [OpenDevel, setOpenDevel] = useState(false); - const [loadingData, setloadingData] = useState(false); + const [loadingData, setloadingData] = useState(true); const [modify, setmodify] = useState(false); const [isOpen, setisOpen] = useState(false); const [currentOpto, setcurrentOpto] = useState({ @@ -203,52 +75,37 @@ function ListDisplay({ url, DefaultConfig }) { useEffect(() => { setloadingData(true); + console.log("Asking for data!"); fetch( `${url}/sendOptoList`, getPostBody({ optoList: Configurations[DefaultConfig] }) ) .then((response) => checkResponse(response)) .then((data) => { - setoptoList(Configurations[DefaultConfig]); setoptoListInfo(data); + setoptoList(Configurations[DefaultConfig]); console.log(DefaultConfig + " from function useEffect"); + setloadingData(false); }) .catch((err) => { console.log(err); - }) - .finally(() => { - setloadingData(false); }); }, [DefaultConfig]); - // useEffect(() => { - // if (loadingData) { - // setoptoList(Configurations[DefaultConfig]); - // fetch( - // `${url}/sendOptoList`, - // getPostBody({ optoList: Configurations[DefaultConfig] }) - // ) - // .then((response) => checkResponse(response)) - // .then((data) => { - // setoptoListInfo(data); - // console.log(DefaultConfig + " from function useEffect"); - // }) - // .catch((err) => { - // console.log(err); - // }) - // .finally(setloadingData(false)); - // } - // }); - if (loadingData) { + console.log("Loading!"); return ( - <TextContent> - <Text component={TextVariants.h3}>"Loading..."</Text> - </TextContent> + <FlexItem key={"optoInListLoad"}> + <Bullseye> + <Spinner + isSVG + diameter="120px" + aria-label="spinner for loading data" + /> + </Bullseye> + </FlexItem> ); } else { - console.log(optoList); - console.log(optoListInfo); return optoList.map((opto, index) => { return ( <FlexItem key={index + "optoInList"}> diff --git a/ui/src/index.tsx b/ui/src/index.tsx index 5c43935..1cab9d1 100644 --- a/ui/src/index.tsx +++ b/ui/src/index.tsx @@ -8,15 +8,16 @@ import { Text, TextVariants, } from "@patternfly/react-core"; -import { OptoboardList } from "./SimpleTabs/OptoboardList"; +import { OptoboardGUI } from "./SimpleTabs/OptoboardGUI"; +// the url provided in the ReactDOM is used inside the gui for the fetch commands ReactDOM.render( <Page> <PageSection> <TextContent> <Text component={TextVariants.h1}>Optoboard GUI</Text> </TextContent> - <OptoboardList backendUrl="/optoboard/api" /> + <OptoboardGUI url="/optoboard/api" /> </PageSection> </Page>, @@ -24,4 +25,6 @@ ReactDOM.render( //document.getElementById("root") as HTMLElement ); - // <SimpleTabs backendUrl="http://localhost:5009" /> \ No newline at end of file +// /optoboard/api +// http://localhost:5009/optoboard/api +// <SimpleTabs backendUrl="http://localhost:5009" /> -- GitLab From 7e5aae58dfefaaaadda2050be8774e389d7f3cc7 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Thu, 16 Feb 2023 11:47:37 +0100 Subject: [PATCH 08/33] Small fix to OptoStatus --- itk_demo_optoboard/celeryTasks.py | 41 +++-- itk_demo_optoboard/routes.py | 4 +- ui/src/Controls/Config.js | 60 +++++--- ui/src/Controls/OptoStatus.js | 238 +++++++++++++++-------------- ui/src/SimpleTabs/OptoboardList.js | 4 +- 5 files changed, 180 insertions(+), 167 deletions(-) diff --git a/itk_demo_optoboard/celeryTasks.py b/itk_demo_optoboard/celeryTasks.py index e410ee3..abd34bc 100644 --- a/itk_demo_optoboard/celeryTasks.py +++ b/itk_demo_optoboard/celeryTasks.py @@ -59,27 +59,26 @@ def initOptoListTask(optoboard_list): else: config_file = getConfigDataset() - ######### Initialize the communication wrapper - Communication_wrapper = CommWrapper( - flx_G=x["flx_G"], - flx_d=x["flx_d"], - lpgbt_master_addr=components_opto["lpgbt_master_addr"], - lpgbt_v=components_opto["lpgbt_v"], - woflxcore=x["withoutFelixcore"], - test_mode=x["testmode"], - ) - - ######### Initialize the optoboard - optoboard_dic[x["Position"]] = Optoboard( - config_file, - x["serialNumber"], - x["vtrxVersion"], - components_opto, - Communication_wrapper, - x["debugCheckBox"], - ) - logger.info("Optoboard in position " + x["Position"] + " has been added!") - logger.warn(optoboard_dic) + ######### Initialize the communication wrapper + Communication_wrapper = CommWrapper( + flx_G=x["flx_G"], + flx_d=x["flx_d"], + lpgbt_master_addr=components_opto["lpgbt_master_addr"], + lpgbt_v=components_opto["lpgbt_v"], + woflxcore=x["withoutFelixcore"], + test_mode=x["testmode"], + ) + + ######### Initialize the optoboard + optoboard_dic[x["Position"]] = Optoboard( + config_file, + x["serialNumber"], + x["vtrxVersion"], + components_opto, + Communication_wrapper, + x["debugCheckBox"], + ) + logger.info("Optoboard in position " + x["Position"] + " has been added!") return opto_info_dic @celery.task() diff --git a/itk_demo_optoboard/routes.py b/itk_demo_optoboard/routes.py index 25512f6..48ec45f 100644 --- a/itk_demo_optoboard/routes.py +++ b/itk_demo_optoboard/routes.py @@ -37,8 +37,8 @@ def sendOptoList(): def statuscheck(): payload = request.get_json() - optoboardPosition = payload[optoboardPosition] - status = statusCheckTask.delay(optoboardPosition).wait() + optoboardPosition = str(payload["optoboardPosition"]) + status = statusCheckTasks.delay(optoboardPosition).wait() return status, 200, {'content-type': 'application/json'} diff --git a/ui/src/Controls/Config.js b/ui/src/Controls/Config.js index f25e13a..3a79135 100644 --- a/ui/src/Controls/Config.js +++ b/ui/src/Controls/Config.js @@ -15,14 +15,30 @@ import { getPostBody, checkResponse } from "../utils/utility-functions"; function Config({ backendUrl, optoboardPosition, optoComponents }) { const [isLoading, setisLoading] = useState(false); const [switchState, setswitchState] = useState(false); - const [CheckBox_lpgbt1, toggleBox_lpgbt1] = useState(true); - const [CheckBox_lpgbt2, toggleBox_lpgbt2] = useState(true); - const [CheckBox_lpgbt3, toggleBox_lpgbt3] = useState(true); - const [CheckBox_lpgbt4, toggleBox_lpgbt4] = useState(true); - const [CheckBox_gbcr1, toggleBox_gbcr1] = useState(true); - const [CheckBox_gbcr2, toggleBox_gbcr2] = useState(true); - const [CheckBox_gbcr3, toggleBox_gbcr3] = useState(true); - const [CheckBox_gbcr4, toggleBox_gbcr4] = useState(true); + const [CheckBox_lpgbt1, toggleBox_lpgbt1] = useState( + optoComponents.lpgbt1 ? true : null + ); + const [CheckBox_lpgbt2, toggleBox_lpgbt2] = useState( + optoComponents.lpgbt2 ? true : null + ); + const [CheckBox_lpgbt3, toggleBox_lpgbt3] = useState( + optoComponents.lpgbt3 ? true : null + ); + const [CheckBox_lpgbt4, toggleBox_lpgbt4] = useState( + optoComponents.lpgbt4 ? true : null + ); + const [CheckBox_gbcr1, toggleBox_gbcr1] = useState( + optoComponents.gbcr1 ? true : null + ); + const [CheckBox_gbcr2, toggleBox_gbcr2] = useState( + optoComponents.gbcr2 ? true : null + ); + const [CheckBox_gbcr3, toggleBox_gbcr3] = useState( + optoComponents.gbcr3 ? true : null + ); + const [CheckBox_gbcr4, toggleBox_gbcr4] = useState( + optoComponents.gbcr4 ? true : null + ); const [buttonVariant, setbuttonVariant] = useState("primary"); const configure = () => { @@ -58,25 +74,19 @@ function Config({ backendUrl, optoboardPosition, optoComponents }) { console.log(data); setisLoading(false); if (data === "Optoboard configuration failed") { - setbuttonVariant("warning"); + setbuttonVariant("danger"); } else { setbuttonVariant("primary"); } }) - .finally(setisLoading(true)); + .finally(() => { + setisLoading(false); + }); //if (data == "Optoboard configuration completed") { EnableI2C(); DataSet(this.state.pathToJson, this.state.vtrxVersionValue, this.state.inDBCheckBox) }; //});.catch(err => {this.setState({isLoading: false});}); }; - const stringLPGBT = switchState ? ( - <h4>lpgbt to configure</h4> - ) : ( - <h4 style={{ color: "grey" }}>lpgbt to configure</h4> - ); - const stringGBCR = switchState ? ( - <h4> gbcr to configure</h4> - ) : ( - <h4 style={{ color: "grey" }}> gbcr to configure</h4> - ); + const stringLPGBT = <h4 style={{ color: "grey" }}>lpgbt to configure</h4>; + const stringGBCR = <h4 style={{ color: "grey" }}> gbcr to configure</h4>; useEffect(() => { const stringLPGBT = switchState ? ( @@ -89,7 +99,7 @@ function Config({ backendUrl, optoboardPosition, optoComponents }) { ) : ( <h4 style={{ color: "grey" }}> gbcr to configure</h4> ); - }); + }, [switchState]); return ( <React.Fragment> @@ -144,7 +154,7 @@ function Config({ backendUrl, optoboardPosition, optoComponents }) { }} id={"lpgbt_config_1"} name={"lpgbt_config_1"} - isDisabled={!switchState} + isDisabled={!(switchState && optoComponents.lpgbt1)} /> <Checkbox label={""} @@ -154,7 +164,7 @@ function Config({ backendUrl, optoboardPosition, optoComponents }) { }} id={"lpgbt_config_2"} name={"lpgbt_config_2"} - isDisabled={!switchState} + isDisabled={!(switchState && optoComponents.lpgbt2)} /> <Checkbox label={""} @@ -162,7 +172,7 @@ function Config({ backendUrl, optoboardPosition, optoComponents }) { onChange={() => toggleBox_lpgbt3(!CheckBox_lpgbt3)} id={"lpgbt_config_3"} name={"lpgbt_config_3"} - isDisabled={!switchState} + isDisabled={!(switchState && optoComponents.lpgbt3)} /> <Checkbox label={""} @@ -170,7 +180,7 @@ function Config({ backendUrl, optoboardPosition, optoComponents }) { onChange={() => toggleBox_lpgbt4(!CheckBox_lpgbt4)} id={"lpgbt_config_4"} name={"lpgbt_config_4"} - isDisabled={!switchState} + isDisabled={!(switchState && optoComponents.lpgbt4)} /> </Bullseye> </FlexItem> diff --git a/ui/src/Controls/OptoStatus.js b/ui/src/Controls/OptoStatus.js index 53fbdf0..fd967a9 100644 --- a/ui/src/Controls/OptoStatus.js +++ b/ui/src/Controls/OptoStatus.js @@ -10,132 +10,134 @@ import { FlexItem, Checkbox, Switch, - Icon + Icon, } from "@patternfly/react-core"; -import { getPostBody, checkResponse } from '../utils/utility-functions' +import { getPostBody, checkResponse } from "../utils/utility-functions"; import { FormSelectInput } from "../Widgets/FormSelectInput"; -import {MyContext} from '../SimpleTabs/MyContext'; -import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon'; -import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon'; +import { MyContext } from "../SimpleTabs/MyContext"; +import ExclamationCircleIcon from "@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon"; +import CheckCircleIcon from "@patternfly/react-icons/dist/esm/icons/check-circle-icon"; +import BanIcon from "@patternfly/react-icons/dist/esm/icons/ban-icon"; - -export function OptoStatus({backendUrl, optoboardPosition}) { - const [lpgbt1Status, setlpgbt1Status] = useState(0); - const [lpgbt2Status, setlpgbt2Status] = useState(0); - const [lpgbt3Status, setlpgbt3Status] = useState(0); - const [lpgbt4Status, setlpgbt4Status] = useState(0); +export function OptoStatus({ backendUrl, optoboardPosition, optoComponents }) { const [isLoading, setisLoading] = useState(false); - const Status1 = (lpgbt1Status === 1) ? - <Icon status="success"> - <CheckCircleIcon /> - </Icon> : - <Icon status="danger"> - <ExclamationCircleIcon /> - </Icon>; - const Status2 = (lpgbt2Status === 1) ? - <Icon status="success"> - <CheckCircleIcon /> - </Icon> : - <Icon status="danger"> - <ExclamationCircleIcon /> - </Icon>; - const Status3 = (lpgbt3Status === 1) ? - <Icon status="success"> - <CheckCircleIcon /> - </Icon> : - <Icon status="danger"> - <ExclamationCircleIcon /> - </Icon>; - const Status4 = (lpgbt4Status === 1) ? - <Icon status="success"> - <CheckCircleIcon /> - </Icon> : - <Icon status="danger"> - <ExclamationCircleIcon /> - </Icon>; + const [Status1, setStatus1] = useState( + <Icon status={optoComponents.lpgbt1 ? "info" : ""}> + <BanIcon /> + </Icon> + ); + const [Status2, setStatus2] = useState( + <Icon status={optoComponents.lpgbt2 ? "info" : ""}> + <BanIcon /> + </Icon> + ); + const [Status3, setStatus3] = useState( + <Icon status={optoComponents.lpgbt3 ? "info" : ""}> + <BanIcon /> + </Icon> + ); + const [Status4, setStatus4] = useState( + <Icon status={optoComponents.lpgbt4 ? "info" : ""}> + <BanIcon /> + </Icon> + ); const StatusCheck = () => { - const requestData = { - optoboardPosition: optoboardPosition - } - fetch(`${backendUrl}/statuscheck`, getPostBody(requestData)).then((response) => checkResponse(response)).then((data) => {console.log(data); setlpgbt1Status(1); setlpgbt2Status(1); setlpgbt3Status(1); setlpgbt4Status(1);} - ).catch(err => {console.log(err)}); + const requestData = { + optoboardPosition: optoboardPosition, + }; + fetch(`${backendUrl}/statuscheck`, getPostBody(requestData)) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + setStatus1( + 1 === 1 ? ( + <Icon status="success"> + <CheckCircleIcon /> + </Icon> + ) : ( + <Icon status="danger"> + <ExclamationCircleIcon /> + </Icon> + ) + ); + setStatus2( + 1 === 1 ? ( + <Icon status="success"> + <CheckCircleIcon /> + </Icon> + ) : ( + <Icon status="danger"> + <ExclamationCircleIcon /> + </Icon> + ) + ); + setStatus3( + 1 === 1 ? ( + <Icon status="success"> + <CheckCircleIcon /> + </Icon> + ) : ( + <Icon status="danger"> + <ExclamationCircleIcon /> + </Icon> + ) + ); + setStatus4( + 1 === 1 ? ( + <Icon status="success"> + <CheckCircleIcon /> + </Icon> + ) : ( + <Icon status="danger"> + <ExclamationCircleIcon /> + </Icon> + ) + ); + }) + .catch((err) => { + console.log(err); + }); }; + return ( + <React.Fragment> + <Flex direction={{ default: "column" }}> + <Panel variant=""> + <PanelMain> + <PanelMainBody> + <Bullseye> + <Button + spinnerAriaValueText={isLoading ? "Loading" : undefined} + isLoading={isLoading} + id="readstatus" + variant={"primary"} + onClick={(event) => StatusCheck()} + > + {isLoading ? "Reading..." : "Read Status"} + </Button> + </Bullseye> - useEffect(() => { - const Status1 = (lpgbt1Status === 1) ? - <Icon status="success"> - <CheckCircleIcon /> - </Icon> : - <Icon status="danger"> - <ExclamationCircleIcon /> - </Icon>; - const Status2 = (lpgbt2Status === 1) ? - <Icon status="success"> - <CheckCircleIcon /> - </Icon> : - <Icon status="danger"> - <ExclamationCircleIcon /> - </Icon>; - const Status3 = (lpgbt3Status === 1) ? - <Icon status="success"> - <CheckCircleIcon /> - </Icon> : - <Icon status="danger"> - <ExclamationCircleIcon /> - </Icon>; - const Status4 = (lpgbt4Status === 1) ? - <Icon status="success"> - <CheckCircleIcon /> - </Icon> : - <Icon status="danger"> - <ExclamationCircleIcon /> - </Icon>; - } + <Bullseye> + <Flex> + <FlexItem> + <h3>lpGBT status</h3> + </FlexItem> + <FlexItem> + <Bullseye> + {Status1} + {Status2} + {Status3} + {Status4} + </Bullseye> + </FlexItem> + </Flex> + </Bullseye> + </PanelMainBody> + </PanelMain> + </Panel> + </Flex> + </React.Fragment> ); - - return( - <React.Fragment> - - <Flex direction={{ default: 'column' }}> - <Panel variant=""> - <PanelMain> - <PanelMainBody> - - - <Bullseye> - <Button - spinnerAriaValueText={isLoading ? 'Loading' : undefined} - isLoading={isLoading} - id="readstatus" - variant={"primary"} - onClick={(event) => StatusCheck()} - > - {isLoading ? "Reading..." : "Read Status" } - </Button> - </Bullseye> - - <Bullseye> - <Flex> - <FlexItem> - <h3>lpGBT status</h3> - </FlexItem> - <FlexItem> - <Bullseye> - {Status1}{Status2}{Status3}{Status4} - </Bullseye> - </FlexItem> - </Flex> - </Bullseye> - - - </PanelMainBody> - </PanelMain> - </Panel> - </Flex> - - </React.Fragment> - ) -}; \ No newline at end of file +} diff --git a/ui/src/SimpleTabs/OptoboardList.js b/ui/src/SimpleTabs/OptoboardList.js index 0021f19..caf35cf 100644 --- a/ui/src/SimpleTabs/OptoboardList.js +++ b/ui/src/SimpleTabs/OptoboardList.js @@ -47,6 +47,7 @@ import { import CogIcon from "@patternfly/react-icons/dist/esm/icons/cog-icon"; import PlusCircleIcon from "@patternfly/react-icons/dist/esm/icons/plus-circle-icon"; +import InfoCircleIcon from "@patternfly/react-icons/dist/esm/icons/info-circle-icon"; import { getPostBody, checkResponse } from "../utils/utility-functions"; @@ -168,7 +169,7 @@ export function OptoboardList({ url, DefaultConfig }) { }} > <Icon> - <CogIcon /> + <InfoCircleIcon /> </Icon> </Button> </Tooltip> @@ -190,6 +191,7 @@ export function OptoboardList({ url, DefaultConfig }) { <OptoStatus backendUrl={url} optoboardPosition={opto.Position} + optoComponents={optoListInfo[opto.Position].components} /> </FlexItem> </Flex> -- GitLab From 6e5fd96f4b7b264294212b1df39f20d25cd66970 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Thu, 16 Feb 2023 12:14:46 +0100 Subject: [PATCH 09/33] Minor change --- ui/src/SimpleTabs/OptoboardGUI.js | 126 +++++++++++++++--------------- ui/src/index.tsx | 20 +++-- 2 files changed, 75 insertions(+), 71 deletions(-) diff --git a/ui/src/SimpleTabs/OptoboardGUI.js b/ui/src/SimpleTabs/OptoboardGUI.js index 65c0fed..1956e51 100644 --- a/ui/src/SimpleTabs/OptoboardGUI.js +++ b/ui/src/SimpleTabs/OptoboardGUI.js @@ -107,72 +107,68 @@ export function OptoboardGUI({ url }) { return ( <React.Fragment> - <Page> - <PageSection> - <Panel> - <PanelMain> - <PanelMainBody> - <Flex> - <FlexItem key={"add_configuration"}> - <Button - variant="secondary" - isLarge - onClick={() => setisOpenConfig(!isOpenConfig)} - > - <h3> Add Configuration </h3> - </Button> - </FlexItem> - <FlexItem> - <FormSelect - value={DefaultConfig} - onChange={(X) => { - setDefaultConfig(X); - }} - aria-label="FormSelect Input" - > - {ConfigurationOptions.map((option, index) => ( - <FormSelectOption - isDisabled={option.disabled} - key={index} - value={option.value} - label={option.label} - /> - ))} - </FormSelect> - </FlexItem> - <FlexItem key={"add configuration"}> - <Button - variant="link" - onClick={() => { - fetch(`${url}/health`) - .then((response) => checkResponse(response)) - .then((data) => { - console.log(data); - }) - .catch((err) => { - console.log(err); - }); - }} - > - <h3> Health </h3> - </Button> - </FlexItem> - </Flex> - </PanelMainBody> - </PanelMain> - </Panel> + <Panel> + <PanelMain> + <PanelMainBody> + <Flex> + <FlexItem key={"add_configuration"}> + <Button + variant="secondary" + isLarge + onClick={() => setisOpenConfig(!isOpenConfig)} + > + <h3> Add Configuration </h3> + </Button> + </FlexItem> + <FlexItem> + <FormSelect + value={DefaultConfig} + onChange={(X) => { + setDefaultConfig(X); + }} + aria-label="FormSelect Input" + > + {ConfigurationOptions.map((option, index) => ( + <FormSelectOption + isDisabled={option.disabled} + key={index} + value={option.value} + label={option.label} + /> + ))} + </FormSelect> + </FlexItem> + <FlexItem key={"add configuration"}> + <Button + variant="link" + onClick={() => { + fetch(`${url}/health`) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + }) + .catch((err) => { + console.log(err); + }); + }} + > + <h3> Health </h3> + </Button> + </FlexItem> + </Flex> + </PanelMainBody> + </PanelMain> + </Panel> - <Panel> - <PanelMain> - <PanelMainBody> - <Flex> - <OptoboardList url={url} DefaultConfig={DefaultConfig} /> - </Flex> - </PanelMainBody> - </PanelMain> - </Panel> - </PageSection> - </Page> + <Panel> + <PanelMain> + <PanelMainBody> + <Flex> + <OptoboardList url={url} DefaultConfig={DefaultConfig} /> + </Flex> + </PanelMainBody> + </PanelMain> + </Panel> </React.Fragment> ); } diff --git a/ui/src/index.tsx b/ui/src/index.tsx index 1cab9d1..378ef59 100644 --- a/ui/src/index.tsx +++ b/ui/src/index.tsx @@ -7,18 +7,26 @@ import { TextContent, Text, TextVariants, + PageHeader, + Panel, + PanelMain, + PanelMainBody, } from "@patternfly/react-core"; import { OptoboardGUI } from "./SimpleTabs/OptoboardGUI"; // the url provided in the ReactDOM is used inside the gui for the fetch commands ReactDOM.render( <Page> - <PageSection> - <TextContent> - <Text component={TextVariants.h1}>Optoboard GUI</Text> - </TextContent> - <OptoboardGUI url="/optoboard/api" /> - </PageSection> + <Panel> + <PanelMain> + <PanelMainBody> + <TextContent> + <Text component={TextVariants.h1}>Optoboard GUI</Text> + </TextContent> + </PanelMainBody> + </PanelMain> + </Panel> + <OptoboardGUI url="/optoboard/api" /> </Page>, document.getElementById("root") -- GitLab From f79e04bd34d4e100d79a50d446c99d3ae606b178 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Thu, 16 Feb 2023 23:18:46 +0100 Subject: [PATCH 10/33] Added notification drawer --- ui/src/SimpleTabs/OptoboardGUI.js | 180 ++++++++++++++++++++---------- 1 file changed, 119 insertions(+), 61 deletions(-) diff --git a/ui/src/SimpleTabs/OptoboardGUI.js b/ui/src/SimpleTabs/OptoboardGUI.js index 1956e51..c3a88af 100644 --- a/ui/src/SimpleTabs/OptoboardGUI.js +++ b/ui/src/SimpleTabs/OptoboardGUI.js @@ -44,7 +44,15 @@ import { DrawerActions, DrawerCloseButton, Spinner, + NotificationDrawer, + NotificationDrawerHeader, + NotificationDrawerBody, + NotificationDrawerList, + NotificationDrawerListItem, + NotificationDrawerListItemBody, + NotificationDrawerListItemHeader, } from "@patternfly/react-core"; +// import { LogViewer } from "@patternfly/react-log-viewer"; import CogIcon from "@patternfly/react-icons/dist/esm/icons/cog-icon"; import PlusCircleIcon from "@patternfly/react-icons/dist/esm/icons/plus-circle-icon"; @@ -54,6 +62,7 @@ import { getPostBody, checkResponse } from "../utils/utility-functions"; export function OptoboardGUI({ url }) { const [DefaultConfig, setDefaultConfig] = useState(defaultConfig); const [isOpenConfig, setisOpenConfig] = useState(false); + const [isNotDrawerOpen, setisNotDrawerOpen] = useState(true); const ConfigurationOptions = [ { @@ -66,6 +75,23 @@ export function OptoboardGUI({ url }) { ConfigurationOptions.push({ value: key, label: key, disabled: false }); } + useEffect(() => { + const interval = setInterval(() => { + console.log("Periodic effect"); + fetch(`${url}/health`) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + }) + .catch((err) => { + console.log(err); + }); + }, 20000); + return () => { + clearInterval(interval); + }; + }, []); + // function optoListChange(newOptoList) { // setoptoList(newOptoList); // console.log("New optolist"); @@ -104,71 +130,103 @@ export function OptoboardGUI({ url }) { <DevelPanel url={url} OpenDevel={OpenDevel} setOpenDevel={setOpenDevel} /> */ + const notificationDrawer = ( + <NotificationDrawer> + <NotificationDrawerHeader> </NotificationDrawerHeader> + <NotificationDrawerBody> + <NotificationDrawerList> + <NotificationDrawerListItem variant="info"> + <NotificationDrawerListItemHeader + variant="info" + title="Unread info notification title" + srTitle="Info notification:" + ></NotificationDrawerListItemHeader> + <NotificationDrawerListItemBody timestamp="5 minutes ago"> + This is an info notification description. + </NotificationDrawerListItemBody> + </NotificationDrawerListItem> + </NotificationDrawerList> + </NotificationDrawerBody> + </NotificationDrawer> + ); return ( <React.Fragment> - <Panel> - <PanelMain> - <PanelMainBody> - <Flex> - <FlexItem key={"add_configuration"}> - <Button - variant="secondary" - isLarge - onClick={() => setisOpenConfig(!isOpenConfig)} - > - <h3> Add Configuration </h3> - </Button> - </FlexItem> - <FlexItem> - <FormSelect - value={DefaultConfig} - onChange={(X) => { - setDefaultConfig(X); - }} - aria-label="FormSelect Input" - > - {ConfigurationOptions.map((option, index) => ( - <FormSelectOption - isDisabled={option.disabled} - key={index} - value={option.value} - label={option.label} - /> - ))} - </FormSelect> - </FlexItem> - <FlexItem key={"add configuration"}> - <Button - variant="link" - onClick={() => { - fetch(`${url}/health`) - .then((response) => checkResponse(response)) - .then((data) => { - console.log(data); - }) - .catch((err) => { - console.log(err); - }); - }} - > - <h3> Health </h3> - </Button> - </FlexItem> - </Flex> - </PanelMainBody> - </PanelMain> - </Panel> + <Page + notificationDrawer={notificationDrawer} + isNotificationDrawerExpanded={isNotDrawerOpen} + > + <Panel> + <PanelMain> + <PanelMainBody> + <Flex> + <FlexItem key={"add_configuration"}> + <Button + variant="secondary" + isLarge + onClick={() => setisOpenConfig(!isOpenConfig)} + > + <h3> Add Configuration </h3> + </Button> + </FlexItem> + <FlexItem> + <FormSelect + value={DefaultConfig} + onChange={(X) => { + setDefaultConfig(X); + }} + aria-label="FormSelect Input" + > + {ConfigurationOptions.map((option, index) => ( + <FormSelectOption + isDisabled={option.disabled} + key={index} + value={option.value} + label={option.label} + /> + ))} + </FormSelect> + </FlexItem> + <FlexItem key={"add configuration"}> + <Button + variant="link" + onClick={() => { + fetch(`${url}/health`) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + }) + .catch((err) => { + console.log(err); + }); + }} + > + <h3> Health </h3> + </Button> + </FlexItem> + </Flex> + </PanelMainBody> + </PanelMain> + </Panel> + + <Panel> + <PanelMain> + <PanelMainBody> + <Flex> + <OptoboardList url={url} DefaultConfig={DefaultConfig} /> + </Flex> + </PanelMainBody> + </PanelMain> + </Panel> + </Page> - <Panel> - <PanelMain> - <PanelMainBody> - <Flex> - <OptoboardList url={url} DefaultConfig={DefaultConfig} /> - </Flex> - </PanelMainBody> - </PanelMain> - </Panel> + {/* <LogViewer + hasLineNumbers={false} + height={300} + data={data.data} + theme="dark" + header={<Banner>5019 lines</Banner>} + /> */} </React.Fragment> ); } -- GitLab From ca9f5b2c32f01a6c4ea3570bd307ff4bb880a3a0 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Thu, 16 Feb 2023 23:21:24 +0100 Subject: [PATCH 11/33] Minor --- ui/src/SimpleTabs/OptoboardGUI.js | 10 +++++++++- ui/src/index.tsx | 13 +------------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/ui/src/SimpleTabs/OptoboardGUI.js b/ui/src/SimpleTabs/OptoboardGUI.js index c3a88af..ad2a9bc 100644 --- a/ui/src/SimpleTabs/OptoboardGUI.js +++ b/ui/src/SimpleTabs/OptoboardGUI.js @@ -156,6 +156,15 @@ export function OptoboardGUI({ url }) { notificationDrawer={notificationDrawer} isNotificationDrawerExpanded={isNotDrawerOpen} > + <Panel> + <PanelMain> + <PanelMainBody> + <TextContent> + <Text component={TextVariants.h1}>Optoboard GUI</Text> + </TextContent> + </PanelMainBody> + </PanelMain> + </Panel> <Panel> <PanelMain> <PanelMainBody> @@ -208,7 +217,6 @@ export function OptoboardGUI({ url }) { </PanelMainBody> </PanelMain> </Panel> - <Panel> <PanelMain> <PanelMainBody> diff --git a/ui/src/index.tsx b/ui/src/index.tsx index 378ef59..6218ef2 100644 --- a/ui/src/index.tsx +++ b/ui/src/index.tsx @@ -16,18 +16,7 @@ import { OptoboardGUI } from "./SimpleTabs/OptoboardGUI"; // the url provided in the ReactDOM is used inside the gui for the fetch commands ReactDOM.render( - <Page> - <Panel> - <PanelMain> - <PanelMainBody> - <TextContent> - <Text component={TextVariants.h1}>Optoboard GUI</Text> - </TextContent> - </PanelMainBody> - </PanelMain> - </Panel> - <OptoboardGUI url="/optoboard/api" /> - </Page>, + <OptoboardGUI url="/optoboard/api" />, document.getElementById("root") //document.getElementById("root") as HTMLElement -- GitLab From 602ffdb1cbb4eedeab422a20c84b46d4c9c95335 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Thu, 16 Feb 2023 23:38:52 +0100 Subject: [PATCH 12/33] Add Modal for Configuration input --- ui/src/SimpleTabs/OptoboardGUI.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/ui/src/SimpleTabs/OptoboardGUI.js b/ui/src/SimpleTabs/OptoboardGUI.js index ad2a9bc..44e58eb 100644 --- a/ui/src/SimpleTabs/OptoboardGUI.js +++ b/ui/src/SimpleTabs/OptoboardGUI.js @@ -62,7 +62,7 @@ import { getPostBody, checkResponse } from "../utils/utility-functions"; export function OptoboardGUI({ url }) { const [DefaultConfig, setDefaultConfig] = useState(defaultConfig); const [isOpenConfig, setisOpenConfig] = useState(false); - const [isNotDrawerOpen, setisNotDrawerOpen] = useState(true); + const [isNotDrawerOpen, setisNotDrawerOpen] = useState(false); const ConfigurationOptions = [ { @@ -235,6 +235,27 @@ export function OptoboardGUI({ url }) { theme="dark" header={<Banner>5019 lines</Banner>} /> */} + + <Modal + bodyAriaLabel="Scrollable modal content" + tabIndex={0} + variant={ModalVariant.small} + title="Modal with overflowing content" + isOpen={isOpenConfig} + onClose={() => { + setisOpenConfig(false); + }} + /* actions={[ + <Button key="confirm" variant="primary" onClick={handleModalToggle}> + Confirm + </Button>, + <Button key="cancel" variant="link" onClick={handleModalToggle}> + Cancel + </Button>, + ]} */ + > + Catilina + </Modal> </React.Fragment> ); } -- GitLab From 954a433751ed489875f31265259fe832c00f493c Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Tue, 21 Feb 2023 18:37:14 +0100 Subject: [PATCH 13/33] Search tool for write and read --- ui/src/Controls/WriteReadBox.js | 154 +++++++++++----- ui/src/SimpleTabs/OptoboardGUI.js | 2 +- ui/src/SimpleTabs/OptoboardList.js | 34 ++-- ui/src/SimpleTabs/Registers.js | 285 +++++++++++++++++++++++++++++ 4 files changed, 408 insertions(+), 67 deletions(-) create mode 100644 ui/src/SimpleTabs/Registers.js diff --git a/ui/src/Controls/WriteReadBox.js b/ui/src/Controls/WriteReadBox.js index ef98b3c..45ef8ba 100644 --- a/ui/src/Controls/WriteReadBox.js +++ b/ui/src/Controls/WriteReadBox.js @@ -16,22 +16,31 @@ import { import { getPostBody, checkResponse } from "../utils/utility-functions"; import { FormSelectInputNewer } from "../Widgets/FormSelectInput"; +import { Registers } from "../SimpleTabs/Registers"; -export function WriteReadBox({ backendUrl, optoboardPosition }) { - - const [device_val, setdevice_val] = useState(0); +export function WriteReadBox({ + backendUrl, + optoboardPosition, + optoComponents, + vtrxVersion, +}) { + const [device_val, setdevice_val] = useState("lpgbt1"); const device = [ - { label: "lpgbt1", disabled: false, value: "0" }, - { label: "lpgbt2", disabled: false, value: "1" }, - { label: "lpgbt3", disabled: false, value: "2" }, - { label: "lpgbt4", disabled: false, value: "3" }, - { label: "gbcr1", disabled: false, value: "4" }, - { label: "gbcr2", disabled: false, value: "5" }, - { label: "gbcr3", disabled: false, value: "6" }, - { label: "gbcr4", disabled: false, value: "7" }, + { label: "lpgbt1", disabled: false, value: "lpgbt1" }, + { label: "lpgbt2", disabled: false, value: "lpgbt2" }, + { label: "lpgbt3", disabled: false, value: "lpgbt3" }, + { label: "lpgbt4", disabled: false, value: "lpgbt4" }, + { label: "gbcr1", disabled: false, value: "gbcr1" }, + { label: "gbcr2", disabled: false, value: "gbcr2" }, + { label: "gbcr3", disabled: false, value: "gbcr3" }, + { label: "gbcr4", disabled: false, value: "gbcr4" }, + { label: "vtrx", disabled: false, value: "vtrx" }, ]; // functions to read a register from the Optoboard + // functions to read a register from the Optoboard + // functions to read a register from the Optoboard + const [reg_read, setreg_read] = useState(""); const [read_back_read, setread_back_read] = useState(""); const [isOpenRead, setisOpenRead] = useState(false); @@ -53,15 +62,8 @@ export function WriteReadBox({ backendUrl, optoboardPosition }) { }; // function to implement the filter of the registers - const optionsRead = [ - <SelectOption key={0} value="Alabama" />, - <SelectOption key={1} value="Florida" />, - <SelectOption key={2} value="New Jersey" />, - <SelectOption key={3} value="New Mexico" />, - <SelectOption key={4} value="New York" />, - <SelectOption key={5} value="North Carolina" />, - ]; - + const [optionsRead, setoptionsRead] = useState([]); + const customFilterRead = (_, value) => { if (!value) { return optionsRead; @@ -69,7 +71,7 @@ export function WriteReadBox({ backendUrl, optoboardPosition }) { const input = new RegExp(value, "i"); return optionsRead.filter((child) => input.test(child.props.value)); }; - + const read_device = (reg_address) => { //var re = /[0-9A-Fa-f]{6}/g; const requestData = { @@ -93,6 +95,8 @@ export function WriteReadBox({ backendUrl, optoboardPosition }) { }); }; + // functions to write a register on the Optoboard + // functions to write a register on the Optoboard // functions to write a register on the Optoboard const [reg_write, setreg_write] = useState(""); @@ -120,14 +124,17 @@ export function WriteReadBox({ backendUrl, optoboardPosition }) { }; // function to implement the filter of the registers - const optionsWrite = [ - <SelectOption key={0} value="Alabama" />, - <SelectOption key={1} value="Florida" />, - <SelectOption key={2} value="New Jersey" />, - <SelectOption key={3} value="New Mexico" />, - <SelectOption key={4} value="New York" />, - <SelectOption key={5} value="North Carolina" />, - ]; + + const [optionsWrite, setoptionsWrite] = useState([]); + + // const optionsWrite = [ + // <SelectOption key={0} value="Alabama" />, + // <SelectOption key={1} value="Florida" />, + // <SelectOption key={2} value="New Jersey" />, + // <SelectOption key={3} value="New Mexico" />, + // <SelectOption key={4} value="New York" />, + // <SelectOption key={5} value="North Carolina" />, + // ]; const customFilterWrite = (_, value) => { if (!value) { @@ -160,6 +167,58 @@ export function WriteReadBox({ backendUrl, optoboardPosition }) { }); }; + const optionsChange = () => { + setoptionsRead([]); + setoptionsWrite([]); + let keyRegRead = "", + keyRegWrite = ""; + + if (device_val.includes("lpgbt")) { + keyRegRead = "lpgbt" + (optoComponents.lpgbt_v ? "v1" : "v0") + "Read"; + keyRegWrite = "lpgbt" + (optoComponents.lpgbt_v ? "v1" : "v0") + "Write"; + } else if (device_val.includes("gbcr")) { + keyRegRead = "gbcr" + (optoComponents.gbcr_v == 2 ? "v2" : "v3"); + keyRegWrite = "gbcr" + (optoComponents.gbcr_v == 2 ? "v2" : "v3"); + } else if (device_val.includes("vtrx")) { + keyRegRead = "vtrx" + (vtrxVersion == "1.2" ? "v12" : "v13"); + keyRegWrite = "vtrx" + (vtrxVersion == "1.2" ? "v12" : "v13"); + } + + let x = []; + Object.keys(Registers[keyRegRead]).map((register, index) => { + x.push(<SelectOption key={register} value={register} />); + Registers[keyRegRead][register].map((subreg) => { + x.push( + <SelectOption + key={register + " " + subreg} + value={register + " " + subreg} + /> + ); + }); + }); + setoptionsRead(x); + + let y = []; + Object.keys(Registers[keyRegWrite]).map((register, index) => { + y.push(<SelectOption key={register} value={register} />); + Registers[keyRegWrite][register].map((subreg) => { + y.push( + <SelectOption + key={register + " " + subreg} + value={register + " " + subreg} + /> + ); + }); + }); + + setoptionsRead(x); + setoptionsWrite(x); + }; + + useEffect(() => { + optionsChange(); + }, [device_val]); + return ( <React.Fragment> <Panel> @@ -230,6 +289,7 @@ export function WriteReadBox({ backendUrl, optoboardPosition }) { <Flex> <FlexItem> <Select + maxHeight={300} variant={SelectVariant.typeahead} direction={"down"} typeAheadAriaLabel="Select a register" @@ -281,26 +341,26 @@ export function WriteReadBox({ backendUrl, optoboardPosition }) { </Bullseye> <Bullseye> <Flex> - <FlexItem> <Bullseye> - <Select - variant={SelectVariant.typeahead} - direction={"down"} - typeAheadAriaLabel="Select a register write" - onToggle={() => setisOpenWrite(!isOpenWrite)} - onTypeaheadInputChanged={(value) => setreg_write(value)} - onSelect={onSelectWrite} - onClear={clearSelectionWrite} - onFilter={customFilterWrite} - selections={reg_write} - isOpen={isOpenWrite} - aria-labelledby={"typeahead-select-id-2-write"} - placeholderText="Select a register" - noResultsFoundText={"No results found"} - > - {optionsWrite} - </Select> + <Select + maxHeight={300} + variant={SelectVariant.typeahead} + direction={"down"} + typeAheadAriaLabel="Select a register write" + onToggle={() => setisOpenWrite(!isOpenWrite)} + onTypeaheadInputChanged={(value) => setreg_write(value)} + onSelect={onSelectWrite} + onClear={clearSelectionWrite} + onFilter={customFilterWrite} + selections={reg_write} + isOpen={isOpenWrite} + aria-labelledby={"typeahead-select-id-2-write"} + placeholderText="Select a register" + noResultsFoundText={"No results found"} + > + {optionsWrite} + </Select> </Bullseye> </FlexItem> </Flex> diff --git a/ui/src/SimpleTabs/OptoboardGUI.js b/ui/src/SimpleTabs/OptoboardGUI.js index 44e58eb..21b2dfc 100644 --- a/ui/src/SimpleTabs/OptoboardGUI.js +++ b/ui/src/SimpleTabs/OptoboardGUI.js @@ -86,7 +86,7 @@ export function OptoboardGUI({ url }) { .catch((err) => { console.log(err); }); - }, 20000); + }, 200000); return () => { clearInterval(interval); }; diff --git a/ui/src/SimpleTabs/OptoboardList.js b/ui/src/SimpleTabs/OptoboardList.js index caf35cf..d6352f5 100644 --- a/ui/src/SimpleTabs/OptoboardList.js +++ b/ui/src/SimpleTabs/OptoboardList.js @@ -135,39 +135,33 @@ export function OptoboardList({ url, DefaultConfig }) { </Button> </Tooltip> <Tooltip + entryDelay={150} + exitDelay={200} content={ <div> <h4> - Serial Number: {opto.serialNumber} Vtrx:{" "} + Serial Number: {opto.serialNumber} / Vtrx:{" "} {opto.vtrxVersion}{" "} </h4> <h4> - testmode: {opto.testmode.toString()} Debug:{" "} - {opto.debugCheckBox.toString()} + testmode: {opto.testmode.toString()} / debug:{" "} + {opto.debugCheckBox.toString()} / test:{" "} + {opto.testmode.toString()} </h4> <h4> - flx_G: {opto.flx_G} flx_d: {opto.flx_d} woflxcore:{" "} - {opto.withoutFelixcore.toString()}{" "} + flx_G: {opto.flx_G} / flx_d: {opto.flx_d} / + woflxcore: {opto.withoutFelixcore.toString()}{" "} </h4> + <h4>inConfigDB: {opto.inDBCheckBox.toString()}</h4> + <h4>Configuration File: {opto.ConfigurationPath}</h4> <h4> - inConfigDB: {opto.inDBCheckBox.toString()}{" "} - Configuration File: {opto.ConfigurationPath} + inDBCheckBox: {opto.inDBCheckBox} / ConfigDB:{" "} + {opto.ConfigurationDB}{" "} </h4> - <h4>ConfigDB: {opto.ConfigurationDB} </h4> </div> } > - <Button - aria-label="drawer" - variant="plain" - id="tt-ref2" - onClick={() => { - setcurrentOpto(opto); - setindexcurrentOpto(index); - setmodify(true); - setisOpen(true); - }} - > + <Button aria-label="drawer" variant="plain" id="tt-ref2"> <Icon> <InfoCircleIcon /> </Icon> @@ -180,6 +174,8 @@ export function OptoboardList({ url, DefaultConfig }) { <WriteReadBox backendUrl={url} optoboardPosition={opto.Position} + optoComponents={optoListInfo[opto.Position].components} + vtrxVersion={opto.vtrxVersion} /> </FlexItem> <FlexItem> diff --git a/ui/src/SimpleTabs/Registers.js b/ui/src/SimpleTabs/Registers.js new file mode 100644 index 0000000..7e22540 --- /dev/null +++ b/ui/src/SimpleTabs/Registers.js @@ -0,0 +1,285 @@ +const lpgbtv0Write = {}; + +const lpgbtv1Write = { + EPRXDLLCONFIG: [ + "EPRXDLLCURRENT", + "EPRXDLLCONFIRMCOUNT", + "EPRXDLLFSMCLKALWAYSON", + "EPRXDLLCOARSELOCKDETECTION", + "EPRXENABLEREINIT", + "EPRXDATAGATINGDISABLE", + ], + LDCONFIGH: ["LDEMPHASISENABLE", "LDMODULATIONCURRENT"], + EPRX0CONTROL: [ + "EPRX03ENABLE", + "EPRX02ENABLE", + "EPRX01ENABLE", + "EPRX00ENABLE", + "EPRX0DATARATE", + "EPRX0TRACKMODE", + ], + EPRX00CHNCNTR: [ + "EPRX00PHASESELECT", + "EPRX00INVERT", + "EPRX00ACBIAS", + "EPRX00TERM", + "EPRX00EQ", + ], + EPRX1CONTROL: [ + "EPRX13ENABLE", + "EPRX12ENABLE", + "EPRX11ENABLE", + "EPRX10ENABLE", + "EPRX1DATARATE", + "EPRX1TRACKMODE", + ], + EPRX10CHNCNTR: [ + "EPRX10PHASESELECT", + "EPRX10INVERT", + "EPRX10ACBIAS", + "EPRX10TERM", + "EPRX10EQ", + ], + EPRX2CONTROL: [ + "EPRX23ENABLE", + "EPRX22ENABLE", + "EPRX21ENABLE", + "EPRX20ENABLE", + "EPRX2DATARATE", + "EPRX2TRACKMODE", + ], + EPRX20CHNCNTR: [ + "EPRX20PHASESELECT", + "EPRX20INVERT", + "EPRX20ACBIAS", + "EPRX20TERM", + "EPRX20EQ", + ], + EPRX3CONTROL: [ + "EPRX33ENABLE", + "EPRX32ENABLE", + "EPRX31ENABLE", + "EPRX30ENABLE", + "EPRX3DATARATE", + "EPRX3TRACKMODE", + ], + EPRX30CHNCNTR: [ + "EPRX30PHASESELECT", + "EPRX30INVERT", + "EPRX30ACBIAS", + "EPRX30TERM", + "EPRX30EQ", + ], + EPRX4CONTROL: [ + "EPRX43ENABLE", + "EPRX42ENABLE", + "EPRX41ENABLE", + "EPRX40ENABLE", + "EPRX4DATARATE", + "EPRX4TRACKMODE", + ], + EPRX40CHNCNTR: [ + "EPRX40PHASESELECT", + "EPRX40INVERT", + "EPRX40ACBIAS", + "EPRX40TERM", + "EPRX40EQ", + ], + EPRX5CONTROL: [ + "EPRX53ENABLE", + "EPRX52ENABLE", + "EPRX51ENABLE", + "EPRX50ENABLE", + "EPRX5DATARATE", + "EPRX5TRACKMODE", + ], + EPRX50CHNCNTR: [ + "EPRX50PHASESELECT", + "EPRX50INVERT", + "EPRX50ACBIAS", + "EPRX50TERM", + "EPRX50EQ", + ], + EPTXDATARATE: [ + "EPTX0DATARATE", + "EPTX1DATARATE", + "EPTX2DATARATE", + "EPTX3DATARATE", + ], + EPTX10ENABLE: [ + "EPTX13ENABLE", + "EPTX12ENABLE", + "EPTX11ENABLE", + "EPTX10ENABLE", + "EPTX03ENABLE", + "EPTX02ENABLE", + "EPTX01ENABLE", + "EPTX00ENABLE", + ], + EPTX32ENABLE: [ + "EPTX33ENABLE", + "EPTX32ENABLE", + "EPTX31ENABLE", + "EPTX30ENABLE", + "EPTX23ENABLE", + "EPTX22ENABLE", + "EPTX21ENABLE", + "EPTX20ENABLE", + ], + EPTX00CHNCNTR: [ + "EPTX00PREEMPHASISSTRENGTH", + "EPTX00PREEMPHASISMODE", + "EPTX00DRIVESTRENGTH", + ], + EPTX01_00CHNCNTR: [ + "EPTX01INVERT", + "EPTX01PREEMPHASISWIDTH", + "EPTX00INVERT", + "EPTX00PREEMPHASISWIDTH", + ], + EPTX02CHNCNTR: [ + "EPTX02PREEMPHASISSTRENGTH", + "EPTX02PREEMPHASISMODE", + "EPTX02DRIVESTRENGTH", + ], + EPTX03_02CHNCNTR: [ + "EPTX03INVERT", + "EPTX03PREEMPHASISWIDTH", + "EPTX02INVERT", + "EPTX02PREEMPHASISWIDTH", + ], + EPTX10CHNCNTR: [ + "EPTX10PREEMPHASISSTRENGTH", + "EPTX10PREEMPHASISMODE", + "EPTX10DRIVESTRENGTH", + ], + EPTX11_10CHNCNTR: [ + "EPTX11INVERT", + "EPTX11PREEMPHASISWIDTH", + "EPTX10INVERT", + "EPTX10PREEMPHASISWIDTH", + ], + EPTX12CHNCNTR: [ + "EPTX12PREEMPHASISSTRENGTH", + "EPTX12PREEMPHASISMODE", + "EPTX12DRIVESTRENGTH", + ], + EPTX13_12CHNCNTR: [ + "EPTX13INVERT", + "EPTX13PREEMPHASISWIDTH", + "EPTX12INVERT", + "EPTX12PREEMPHASISWIDTH", + ], + EPTX20CHNCNTR: [ + "EPTX20PREEMPHASISSTRENGTH", + "EPTX20PREEMPHASISMODE", + "EPTX20DRIVESTRENGTH", + ], + EPTX21_20CHNCNTR: [ + "EPTX21INVERT", + "EPTX21PREEMPHASISWIDTH", + "EPTX20INVERT", + "EPTX20PREEMPHASISWIDTH", + ], + EPTX22CHNCNTR: [ + "EPTX22PREEMPHASISSTRENGTH", + "EPTX22PREEMPHASISMODE", + "EPTX22DRIVESTRENGTH", + ], + EPTX23_22CHNCNTR: [ + "EPTX23INVERT", + "EPTX23PREEMPHASISWIDTH", + "EPTX22INVERT", + "EPTX22PREEMPHASISWIDTH", + ], + EPTX30CHNCNTR: [ + "EPTX30PREEMPHASISSTRENGTH", + "EPTX30PREEMPHASISMODE", + "EPTX30DRIVESTRENGTH", + ], + EPTX31_30CHNCNTR: [ + "EPTX31INVERT", + "EPTX31PREEMPHASISWIDTH", + "EPTX30INVERT", + "EPTX30PREEMPHASISWIDTH", + ], + EPTX32CHNCNTR: [ + "EPTX32PREEMPHASISSTRENGTH", + "EPTX32PREEMPHASISMODE", + "EPTX32DRIVESTRENGTH", + ], + EPTX33_32CHNCNTR: [ + "EPTX33INVERT", + "EPTX33PREEMPHASISWIDTH", + "EPTX32INVERT", + "EPTX32PREEMPHASISWIDTH", + ], +}; + +const lpgbtv0Read = { ...lpgbtv0Write, ...{ ROM: ["ROMREG"] } }; + +const lpgbtv1Read = { ...lpgbtv1Write, ...{ ROM: ["ROMREG"] } }; + +const gbcrv2 = { + CH1UPLINK0: ["CH1DISEQLF", "CH1EQATT", "CH1CMLAMPLSEL"], + CH1UPLINK1: ["CH1CTLEHFSR", "CH1CTLEMFSR"], + CH1UPLINK2: ["CH1DIS", "CH1DISDFF", "CH1DISLPF"], + CH2UPLINK0: ["CH2DISEQLF", "CH2EQATT", "CH2CMLAMPLSEL"], + CH2UPLINK1: ["CH2CTLEHFSR", "CH2CTLEMFSR"], + CH2UPLINK2: ["CH2DIS", "CH2DISDFF", "CH2DISLPF"], + CH3UPLINK0: ["CH3DISEQLF", "CH3EQATT", "CH3CMLAMPLSEL"], + CH3UPLINK1: ["CH3CTLEHFSR", "CH3CTLEMFSR"], + CH3UPLINK2: ["CH3DIS", "CH3DISDFF", "CH3DISLPF"], + CH4UPLINK0: ["CH4DISEQLF", "CH4EQATT", "CH4CMLAMPLSEL"], + CH4UPLINK1: ["CH4CTLEHFSR", "CH4CTLEMFSR"], + CH4UPLINK2: ["CH4DIS", "CH4DISDFF", "CH4DISLPF"], + CH5UPLINK0: ["CH5DISEQLF", "CH5EQATT", "CH5CMLAMPLSEL"], + CH5UPLINK1: ["CH5CTLEHFSR", "CH5CTLEMFSR"], + CH5UPLINK2: ["CH5DIS", "CH5DISDFF", "CH5DISLPF"], + CH6UPLINK0: ["CH6DISEQLF", "CH6EQATT", "CH6CMLAMPLSEL"], + CH6UPLINK1: ["CH6CTLEHFSR", "CH6CTLEMFSR"], + CH6UPLINK2: ["CH6DIS", "CH6DISDFF", "CH6DISLPF"], + CH7UPLINK0: ["CH7DISEQLF", "CH7EQATT", "CH7CMLAMPLSEL"], + CH7UPLINK1: ["CH7CTLEHFSR", "CH7CTLEMFSR"], + CH7UPLINK2: ["CH7DIS", "CH7DISDFF", "CH7DISLPF"], + CH1DOWNLINK0: ["TX1DLATT", "TX1DISDLEMP", "TX1DLSR"], + CH1DOWNLINK1: ["TX1DISDLBIAS", "TX1DISDLLPFBIAS"], + CH2DOWNLINK0: ["TX2DLATT", "TX2DISDLEMP", "TX2DLSR"], + CH2DOWNLINK1: ["TX2DISDLBIAS", "TX2DISDLLPFBIAS"], + PHASESHIFTER0: ["DLLENABLE", "DLLCAPRESET"], + PHASESHIFTER1: ["DLLFORCEDOWN", "DLLCHARGEPUMPCURRENT"], + PHASESHIFTER2: ["DLLCLOCKDELAYCH7", "DLLCLOCKDELAYCH6"], + PHASESHIFTER3: ["DLLCLOCKDELAYCH5", "DLLCLOCKDELAYCH4"], + PHASESHIFTER4: ["DLLCLOCKDELAYCH3", "DLLCLOCKDELAYCH2"], + PHASESHIFTER5: ["DLLCLOCKDELAYCH1", "DLLCLOCKDELAYCHTEST"], + LVDSRXTX: [ + "RXEN", + "RXSETCM", + "RXENTERMINATION", + "RXINVDATA", + "RXEQ", + "DISTX", + ], +}; + +const gbcrv3 = {}; + +const vtrxv12 = { + C0CR: ["C0FEP", "C0REP", "C0MEN", "C0BEN", "C0LAEN", "C0CEN"], + C1CR: ["C1FEP", "C1REP", "C1MEN", "C1BEN", "C1LAEN", "C1CEN"], + C2CR: ["C2FEP", "C2REP", "C2MEN", "C2BEN", "C2LAEN", "C2CEN"], + C3CR: ["C3FEP", "C3REP", "C3MEN", "C3BEN", "C3LAEN", "C3CEN"], +}; + +const vtrxv13 = { GCR: ["CH1EN", "CH2EN", "CH3EN", "CH4EN"] }; + +export const Registers = { + lpgbtv0Write: lpgbtv0Write, + lpgbtv1Write: lpgbtv1Write, + lpgbtv0Read: lpgbtv0Read, + lpgbtv1Read: lpgbtv1Read, + gbcrv2: gbcrv2, + gbcrv3: gbcrv3, + vtrxv12: vtrxv12, + vtrxv13: vtrxv13, +}; -- GitLab From 1639484960c0e73cb817c973047f06b095194c46 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Tue, 21 Feb 2023 19:03:33 +0100 Subject: [PATCH 14/33] Partial code clean-up --- ui/src/Config/00000000_test_v0.json | 2318 ---------------- ui/src/Config/00000000_test_v1.json | 2334 ----------------- .../{SimpleTabs => Config}/Configurations.js | 0 ui/src/{SimpleTabs => Config}/Registers.js | 0 ui/src/Controls/Diagnosis.js | 538 ---- ui/src/Controls/MinConfig.js | 369 --- ui/src/Controls/OptoStatus.js | 2 - ui/src/Controls/QuickCommands.js | 296 --- ui/src/Controls/WriteRead.js | 406 --- ui/src/Controls/WriteRead4User.js | 442 ---- ui/src/Controls/WriteReadBox.js | 19 +- ui/src/SimpleTabs/DevelPanel.js | 72 - ui/src/SimpleTabs/MyContext.js | 18 - ui/src/SimpleTabs/OptoboardGUI.js | 15 +- ui/src/SimpleTabs/OptoboardList.js | 4 +- ui/src/SimpleTabs/SimplePanel.js | 67 - ui/src/SimpleTabs/SimpleTabs.js | 411 --- ui/src/SimpleTabs/lpGBT_pannel.js | 401 --- ui/src/Widgets/FormSelectInput.js | 89 - ui/src/Widgets/LabelledDropdown.js | 73 - 20 files changed, 16 insertions(+), 7858 deletions(-) delete mode 100644 ui/src/Config/00000000_test_v0.json delete mode 100644 ui/src/Config/00000000_test_v1.json rename ui/src/{SimpleTabs => Config}/Configurations.js (100%) rename ui/src/{SimpleTabs => Config}/Registers.js (100%) delete mode 100644 ui/src/Controls/Diagnosis.js delete mode 100644 ui/src/Controls/MinConfig.js delete mode 100644 ui/src/Controls/QuickCommands.js delete mode 100644 ui/src/Controls/WriteRead.js delete mode 100644 ui/src/Controls/WriteRead4User.js delete mode 100644 ui/src/SimpleTabs/DevelPanel.js delete mode 100644 ui/src/SimpleTabs/MyContext.js delete mode 100644 ui/src/SimpleTabs/SimplePanel.js delete mode 100644 ui/src/SimpleTabs/SimpleTabs.js delete mode 100644 ui/src/SimpleTabs/lpGBT_pannel.js delete mode 100644 ui/src/Widgets/FormSelectInput.js delete mode 100644 ui/src/Widgets/LabelledDropdown.js diff --git a/ui/src/Config/00000000_test_v0.json b/ui/src/Config/00000000_test_v0.json deleted file mode 100644 index 0c01440..0000000 --- a/ui/src/Config/00000000_test_v0.json +++ /dev/null @@ -1,2318 +0,0 @@ -{ - "Optoboard": - { - "serial": "08000000", - "flx_G": 0, - "flx_i": 0, - "flx_d": 0 - }, - - "power_up_registers_master": - [ - "CLKGCONFIG0", - "CLKGCONFIG1", - "CLKGPLLRES", - "CLKGPLLINTCUR", - "CLKGPLLPROPCUR", - "CLKGCDRPROPCUR", - "CLKGCDRINTCUR", - "CLKGCDRFFPROPCUR", - "CLKGFLLINTCUR", - "CLKGFFCAP", - "CLKGCNTOVERRIDE", - "CLKGOVERRIDECAPBANK", - "CLKGWAITTIME", - "CLKGLFCONFIG0", - "CLKGLFCONFIG1", - "EPRXDLLCONFIG", - "EPRXLOCKFILTER", - "LDCONFIGH", - "EPRX0CONTROL", - "EPRX00CHNCNTR", - "EPRX1CONTROL", - "EPRX10CHNCNTR", - "EPRX2CONTROL", - "EPRX20CHNCNTR", - "EPRX3CONTROL", - "EPRX30CHNCNTR", - "EPRX4CONTROL", - "EPRX40CHNCNTR", - "EPRX5CONTROL", - "EPRX50CHNCNTR", - "EQCONFIG", - "FAMAXHEADERFOUNDCOUNT", - "FAMAXHEADERFOUNDCOUNTAFTERNF", - "FAMAXHEADERNOTFOUNDCOUNT", - "EPTXDATARATE", - "EPTX10ENABLE", - "EPTX32ENABLE", - "EPTX00CHNCNTR", - "EPTX02CHNCNTR", - "EPTX10CHNCNTR", - "EPTX12CHNCNTR", - "EPTX20CHNCNTR", - "EPTX22CHNCNTR", - "EPTX30CHNCNTR", - "EPTX32CHNCNTR", - "EPCLK5CHNCNTRH", - "EPCLK5CHNCNTRL", - "EPCLK2CHNCNTRH", - "EPCLK26CHNCNTRH", - "EPCLK19CHNCNTRH", - "POWERUP2" - ], - - "power_up_registers_slave": - [ - "REFCLK", - "CLKGCONFIG0", - "CLKGCONFIG1", - "CLKGPLLRES", - "CLKGPLLINTCUR", - "CLKGCDRINTCUR", - "CLKGCDRFFPROPCUR", - "CLKGFLLINTCUR", - "CLKGFFCAP", - "CLKGCNTOVERRIDE", - "CLKGOVERRIDECAPBANK", - "CLKGWAITTIME", - "CLKGLFCONFIG0", - "CLKGLFCONFIG1", - "PSDLLCONFIG", - "EPRXDLLCONFIG", - "EPRXLOCKFILTER", - "LDCONFIGH", - "EPRX0CONTROL", - "EPRX00CHNCNTR", - "EPRX1CONTROL", - "EPRX10CHNCNTR", - "EPRX2CONTROL", - "EPRX20CHNCNTR", - "EPRX3CONTROL", - "EPRX30CHNCNTR", - "EPRX4CONTROL", - "EPRX40CHNCNTR", - "EPRX5CONTROL", - "EPRX50CHNCNTR", - "EPCLK5CHNCNTRH", - "EPCLK5CHNCNTRL", - "POWERUP2" - ], - - "lpgbt": - { - "ADCCAL0": - { - "ADCCALGAIN2SEHIGH": [0, 0, 0, 0] - }, - "ADCCAL1": - { - "ADCCALGAIN2SELOW": [0, 0, 0, 0] - }, - "ADCCAL10": - { - "ADCCALGAIN8DIFLOW": [0, 0, 0, 0] - }, - "ADCCAL11": - { - "ADCCALGAIN8DIFHIGH": [0, 0, 0, 0], - "ADCCALGAIN8DIRFLOW": [0, 0, 0, 0] - }, - "ADCCAL12": - { - "ADCCALGAIN16DIFHIGH": [0, 0, 0, 0] - }, - "ADCCAL13": - { - "ADCCALGAIN16DIFLOW": [0, 0, 0, 0] - }, - "ADCCAL14": - { - "ADCCALGAIN16DIFHIGH": [0, 0, 0, 0], - "ADCCALGAIN16DIRFLOW": [0, 0, 0, 0] - }, - "ADCCAL2": - { - "ADCCALGAIN2SEHIGH": [0, 0, 0, 0], - "ADCCALGAIN2SELOW": [0, 0, 0, 0] - }, - "ADCCAL3": - { - "ADCCALGAIN2DIFHIGH": [0, 0, 0, 0] - }, - "ADCCAL4": - { - "ADCCALGAIN2DIFLOW": [0, 0, 0, 0] - }, - "ADCCAL5": - { - "ADCCALGAIN2DIFHIGH": [0, 0, 0, 0], - "ADCCALGAIN2DIRFLOW": [0, 0, 0, 0] - }, - "ADCCAL6": - { - "ADCCALGAIN4DIFHIGH": [0, 0, 0, 0] - }, - "ADCCAL7": - { - "ADCCALGAIN4DIFLOW": [0, 0, 0, 0] - }, - "ADCCAL8": - { - "ADCCALGAIN4DIFHIGH": [0, 0, 0, 0], - "ADCCALGAIN4DIRFLOW": [0, 0, 0, 0] - }, - "ADCCAL9": - { - "ADCCALGAIN8DIFHIGH": [0, 0, 0, 0] - }, - "ADCCONFIG": - { - "ADCCONVERT": [0, 0, 0, 0], - "ADCENABLE": [0, 0, 0, 0], - "ADCGAINSELECT": [0, 0, 0, 0] - }, - "ADCMON": - { - "TEMPSENSRESET": [0, 0, 0, 0], - "VDDANMONENA": [0, 0, 0, 0], - "VDDMONENA": [0, 0, 0, 0], - "VDDPSTMONENA": [0, 0, 0, 0], - "VDDRXMONENA": [0, 0, 0, 0], - "VDDTXMONENA": [0, 0, 0, 0] - }, - "ADCSELECT": - { - "ADCINNSELECT": [0, 0, 0, 0], - "ADCINPSELECT": [0, 0, 0, 0] - }, - "BERTCONFIG": - { - "BERTMEASTIME": [0, 0, 0, 0], - "BERTSTART": [0, 0, 0, 0], - "SKIPDISABLE": [0, 0, 0, 0] - }, - "BERTDATAPATTERN0": - { - "BERTDATAPATTERN": [0, 0, 0, 0] - }, - "BERTDATAPATTERN1": - { - "BERTDATAPATTERN": [0, 0, 0, 0] - }, - "BERTDATAPATTERN2": - { - "BERTDATAPATTERN": [0, 0, 0, 0] - }, - "BERTDATAPATTERN3": - { - "BERTDATAPATTERN": [0, 0, 0, 0] - }, - "BERTSOURCE": - { - "BERTSOURCE": [0, 0, 0, 0] - }, - "CHIPCONFIG": - { - "CHIPADDRESSBAR": [0, 0, 0, 0], - "HIGHSPEEDDATAININVERT": [0, 0, 0, 0], - "HIGHSPEEDDATAOUTINVERT": [0, 0, 0, 0] - }, - "CHIPID0": - { - "CHIPID": [0, 0, 0, 0] - }, - "CHIPID1": - { - "CHIPID": [0, 0, 0, 0] - }, - "CHIPID2": - { - "CHIPID": [0, 0, 0, 0] - }, - "CHIPID3": - { - "CHIPID": [0, 0, 0, 0] - }, - "CLKGCDRFFPROPCUR": - { - "CLKGCDRFEEDFORWARDPROPCUR": [5, 5, 5, 5], - "CLKGCDRFEEDFORWARDPROPCURWHENLOCKED": [5, 5, 5, 5] - }, - "CLKGCDRINTCUR": - { - "CLKGCDRINTCUR": [0, 0, 0, 0], - "CLKGCDRINTCURWHENLOCKED": [0, 0, 0, 0] - }, - "CLKGCDRPROPCUR": - { - "CLKGCDRPROPCUR": [5, 5, 5, 5], - "CLKGCDRPROPCURWHENLOCKED": [5, 5, 5, 5] - }, - "CLKGCNTOVERRIDE": - { - "CDRCOCONNECTPLL": [0, 0, 0, 0], - "CDRCODISDATACOUNTERREF": [0, 0, 0, 0], - "CDRCODISDESVBIASGEN": [0, 0, 0, 0], - "CDRCOENABLECDR": [0, 0, 0, 0], - "CDRCOENABLEFD": [0, 0, 0, 0], - "CDRCOENABLEPLL": [0, 0, 0, 0], - "CDRCOREFCLKSEL": [0, 0, 0, 0], - "CLKGCOOVERRIDEVC": [0, 0, 0, 0] - }, - "CLKGCONFIG0": - { - "CLKGBIASGENCONFIG": [8, 8, 8, 8], - "CLKGCALIBRATIONENDOFCOUNT": [12, 12, 12, 12] - }, - "CLKGCONFIG1": - { - "CDRCONTROLOVERRIDEENABLE": [0, 0, 0, 0], - "CLKGCDRRES": [1, 1, 1, 1], - "CLKGDISABLEFRAMEALIGNERLOCKCONTROL": [0, 0, 0, 0], - "CLKGVCODAC": [8, 8, 8, 8], - "CLKGVCORAILMODE": [1, 1, 1, 1] - }, - "CLKGFFCAP": - { - "CDRCOCONNECTCDR": [0, 0, 0, 0], - "CLKGCAPBANKOVERRIDEENABLE": [0, 0, 0, 0], - "CLKGFEEDFORWARDCAP": [3, 3, 3, 3], - "CLKGFEEDFORWARDCAPWHENLOCKED": [3, 3, 3, 3] - }, - "CLKGFLLINTCUR": - { - "CLKGFLLINTCUR": [5, 5, 5, 5], - "CLKGFLLINTCURWHENLOCKED": [0, 0, 0, 0] - }, - "CLKGLFCONFIG0": - { - "CLKGCAPBANKSELECT": [0, 1, 1, 1], - "CLKGLOCKFILTERENABLE": [0, 0, 0, 0], - "CLKGLOCKFILTERLOCKTHRCOUNTER": [0, 15, 15, 15] - }, - "CLKGLFCONFIG1": - { - "CLKGLOCKFILTERRELOCKTHRCOUNTER": [9, 9, 9, 9], - "CLKGLOCKFILTERUNLOCKTHRCOUNTER": [9, 9, 9, 9] - }, - "CLKGOVERRIDECAPBANK": - { - "CLKGCAPBANKSELECT": [0, 0, 0, 0] - }, - "CLKGPLLINTCUR": - { - "CLKGPLLINTCUR": [5, 5, 5, 5], - "CLKGPLLINTCURWHENLOCKED": [5, 5, 5, 5] - }, - "CLKGPLLPROPCUR": - { - "CLKGPLLPROPCUR": [5, 5, 5, 5], - "CLKGPLLPROPCURWHENLOCKED": [5, 5, 5, 5] - }, - "CLKGPLLRES": - { - "CLKGPLLRES": [0, 4, 4, 4], - "CLKGPLLRESWHENLOCKED": [0, 4, 4, 4] - }, - "CLKGWAITTIME": - { - "CLKGWAITCDRTIME": [8, 8, 8, 8], - "CLKGWAITPLLTIME": [8, 8, 8, 8] - }, - "CLKTREE": - { - "CLKTREEADISABLE": [0, 0, 0, 0], - "CLKTREEBDISABLE": [0, 0, 0, 0], - "CLKTREECDISABLE": [0, 0, 0, 0], - "CLKTREEMAGICNUMBER": [0, 0, 0, 0] - }, - "CONFIGPINS": - { - "CONFIGSELECT": [0, 0, 0, 0], - "LOCKMODE": [0, 0, 0, 0], - "LPGBTMODE": [0, 0, 0, 0], - "STATEOVERRIDE": [0, 0, 0, 0], - "VCOBYPASS": [0, 0, 0, 0] - }, - "CURDACCALH": - { - "CURDACCAL": [0, 0, 0, 0] - }, - "CURDACCALL": - { - "CURDACCAL": [0, 0, 0, 0] - }, - "CURDACCHN": - { - "CURDACCHNENABLE": [0, 0, 0, 0] - }, - "CURDACVALUE": - { - "CURDACSELECT": [0, 0, 0, 0] - }, - "DACCAL0": - { - "DACCALMINCODE": [0, 0, 0, 0] - }, - "DACCAL1": - { - "DACCALMAXCODE": [0, 0, 0, 0] - }, - "DACCAL2": - { - "DACCALMAXCODE": [0, 0, 0, 0], - "DACCALMINCODE": [0, 0, 0, 0] - }, - "DACCONFIGH": - { - "CURDACENABLE": [0, 0, 0, 0], - "VOLDACENABLE": [0, 0, 0, 0], - "VOLDACVALUE": [0, 0, 0, 0] - }, - "DACCONFIGL": - { - "VOLDACVALUE": [0, 0, 0, 0] - }, - "DATAPATH": - { - "DLDPBYPASDEINTERLEVEAR": [0, 0, 0, 0], - "DLDPBYPASFECDECODER": [0, 0, 0, 0], - "DLDPBYPASSDESCRAMBLER": [0, 0, 0, 0], - "DLDPFECERRCNTENA": [0, 0, 0, 0], - "ULDPBYPASSFECCODER": [0, 0, 0, 0], - "ULDPBYPASSINTERLEAVER": [0, 0, 0, 0], - "ULDPBYPASSSCRAMBLER": [0, 0, 0, 0] - }, - "DPDATAPATTERN0": - { - "DPDATAPATTERN": [0, 0, 0, 0] - }, - "DPDATAPATTERN1": - { - "DPDATAPATTERN": [0, 0, 0, 0] - }, - "DPDATAPATTERN2": - { - "DPDATAPATTERN": [0, 0, 0, 0] - }, - "DPDATAPATTERN3": - { - "DPDATAPATTERN": [0, 0, 0, 0] - }, - "EOMCONFIGH": - { - "EOMBYPASSPHASEINTERPOLATOR": [0, 0, 0, 0], - "EOMENABLE": [0, 0, 0, 0], - "EOMENDOFCOUNTSEL": [0, 0, 0, 0], - "EOMSTART": [0, 0, 0, 0] - }, - "EOMCONFIGL": - { - "EOMPHASESEL": [0, 0, 0, 0] - }, - "EOMVOFSEL": - { - "EOMVOFSEL": [0, 0, 0, 0] - }, - "EPCLK0CHNCNTRH": - { - "EPCLK0DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK0FREQ": [0, 0, 0, 0], - "EPCLK0INVERT": [0, 0, 0, 0] - }, - "EPCLK0CHNCNTRL": - { - "EPCLK0PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK0PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK0PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK10CHNCNTRH": - { - "EPCLK10DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK10FREQ": [0, 0, 0, 0], - "EPCLK10INVERT": [0, 0, 0, 0] - }, - "EPCLK10CHNCNTRL": - { - "EPCLK10PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK10PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK10PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK11CHNCNTRH": - { - "EPCLK11DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK11FREQ": [0, 0, 0, 0], - "EPCLK11INVERT": [0, 0, 0, 0] - }, - "EPCLK11CHNCNTRL": - { - "EPCLK11PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK11PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK11PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK12CHNCNTRH": - { - "EPCLK12DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK12FREQ": [0, 0, 0, 0], - "EPCLK12INVERT": [0, 0, 0, 0] - }, - "EPCLK12CHNCNTRL": - { - "EPCLK12PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK12PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK12PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK13CHNCNTRH": - { - "EPCLK13DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK13FREQ": [0, 0, 0, 0], - "EPCLK13INVERT": [0, 0, 0, 0] - }, - "EPCLK13CHNCNTRL": - { - "EPCLK13PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK13PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK13PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK14CHNCNTRH": - { - "EPCLK14DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK14FREQ": [0, 0, 0, 0], - "EPCLK14INVERT": [0, 0, 0, 0] - }, - "EPCLK14CHNCNTRL": - { - "EPCLK14PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK14PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK14PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK15CHNCNTRH": - { - "EPCLK15DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK15FREQ": [0, 0, 0, 0], - "EPCLK15INVERT": [0, 0, 0, 0] - }, - "EPCLK15CHNCNTRL": - { - "EPCLK15PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK15PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK15PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK16CHNCNTRH": - { - "EPCLK16DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK16FREQ": [0, 0, 0, 0], - "EPCLK16INVERT": [0, 0, 0, 0] - }, - "EPCLK16CHNCNTRL": - { - "EPCLK16PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK16PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK16PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK17CHNCNTRH": - { - "EPCLK17DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK17FREQ": [0, 0, 0, 0], - "EPCLK17INVERT": [0, 0, 0, 0] - }, - "EPCLK17CHNCNTRL": - { - "EPCLK17PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK17PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK17PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK18CHNCNTRH": - { - "EPCLK18DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK18FREQ": [0, 0, 0, 0], - "EPCLK18INVERT": [0, 0, 0, 0] - }, - "EPCLK18CHNCNTRL": - { - "EPCLK18PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK18PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK18PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK19CHNCNTRH": - { - "EPCLK19DRIVESTRENGTH": [3, 0, 0, 0], - "EPCLK19FREQ": [1, 0, 0, 0], - "EPCLK19INVERT": [0, 0, 0, 0] - }, - "EPCLK19CHNCNTRL": - { - "EPCLK19PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK19PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK19PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK1CHNCNTRH": - { - "EPCLK1DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK1FREQ": [0, 0, 0, 0], - "EPCLK1INVERT": [0, 0, 0, 0] - }, - "EPCLK1CHNCNTRL": - { - "EPCLK1PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK1PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK1PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK20CHNCNTRH": - { - "EPCLK20DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK20FREQ": [0, 0, 0, 0], - "EPCLK20INVERT": [0, 0, 0, 0] - }, - "EPCLK20CHNCNTRL": - { - "EPCLK20PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK20PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK20PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK21CHNCNTRH": - { - "EPCLK21DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK21FREQ": [0, 0, 0, 0], - "EPCLK21INVERT": [0, 0, 0, 0] - }, - "EPCLK21CHNCNTRL": - { - "EPCLK21PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK21PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK21PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK22CHNCNTRH": - { - "EPCLK22DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK22FREQ": [0, 0, 0, 0], - "EPCLK22INVERT": [0, 0, 0, 0] - }, - "EPCLK22CHNCNTRL": - { - "EPCLK22PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK22PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK22PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK23CHNCNTRH": - { - "EPCLK23DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK23FREQ": [0, 0, 0, 0], - "EPCLK23INVERT": [0, 0, 0, 0] - }, - "EPCLK23CHNCNTRL": - { - "EPCLK23PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK23PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK23PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK24CHNCNTRH": - { - "EPCLK24DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK24FREQ": [0, 0, 0, 0], - "EPCLK24INVERT": [0, 0, 0, 0] - }, - "EPCLK24CHNCNTRL": - { - "EPCLK24PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK24PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK24PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK25CHNCNTRH": - { - "EPCLK25DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK25FREQ": [0, 0, 0, 0], - "EPCLK25INVERT": [0, 0, 0, 0] - }, - "EPCLK25CHNCNTRL": - { - "EPCLK25PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK25PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK25PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK26CHNCNTRH": - { - "EPCLK26DRIVESTRENGTH": [3, 0, 0, 0], - "EPCLK26FREQ": [1, 0, 0, 0], - "EPCLK26INVERT": [1, 0, 0, 0] - }, - "EPCLK26CHNCNTRL": - { - "EPCLK26PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK26PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK26PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK27CHNCNTRH": - { - "EPCLK27DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK27FREQ": [0, 0, 0, 0], - "EPCLK27INVERT": [0, 0, 0, 0] - }, - "EPCLK27CHNCNTRL": - { - "EPCLK27PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK27PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK27PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK28CHNCNTRH": - { - "EPCLK28DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK28FREQ": [0, 0, 0, 0], - "EPCLK28INVERT": [0, 0, 0, 0] - }, - "EPCLK28CHNCNTRL": - { - "EPCLK28PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK28PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK28PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK2CHNCNTRH": - { - "EPCLK2DRIVESTRENGTH": [3, 0, 0, 0], - "EPCLK2FREQ": [1, 0, 0, 0], - "EPCLK2INVERT": [1, 0, 0, 0] - }, - "EPCLK2CHNCNTRL": - { - "EPCLK2PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK2PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK2PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK3CHNCNTRH": - { - "EPCLK3DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK3FREQ": [0, 0, 0, 0], - "EPCLK3INVERT": [0, 0, 0, 0] - }, - "EPCLK3CHNCNTRL": - { - "EPCLK3PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK3PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK3PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK4CHNCNTRH": - { - "EPCLK4DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK4FREQ": [0, 0, 0, 0], - "EPCLK4INVERT": [0, 0, 0, 0] - }, - "EPCLK4CHNCNTRL": - { - "EPCLK4PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK4PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK4PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK5CHNCNTRH": - { - "EPCLK5DRIVESTRENGTH": [7, 7, 7, 7], - "EPCLK5FREQ": [5, 5, 5, 5], - "EPCLK5INVERT": [0, 0, 0, 0] - }, - "EPCLK5CHNCNTRL": - { - "EPCLK5PREEMPHASISMODE": [3, 3, 3, 3], - "EPCLK5PREEMPHASISSTRENGTH": [3, 3, 3, 3], - "EPCLK5PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK6CHNCNTRH": - { - "EPCLK6DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK6FREQ": [0, 0, 0, 0], - "EPCLK6INVERT": [0, 0, 0, 0] - }, - "EPCLK6CHNCNTRL": - { - "EPCLK6PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK6PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK6PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK7CHNCNTRH": - { - "EPCLK7DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK7FREQ": [0, 0, 0, 0], - "EPCLK7INVERT": [0, 0, 0, 0] - }, - "EPCLK7CHNCNTRL": - { - "EPCLK7PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK7PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK7PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK8CHNCNTRH": - { - "EPCLK8DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK8FREQ": [0, 0, 0, 0], - "EPCLK8INVERT": [0, 0, 0, 0] - }, - "EPCLK8CHNCNTRL": - { - "EPCLK8PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK8PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK8PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK9CHNCNTRH": - { - "EPCLK9DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK9FREQ": [0, 0, 0, 0], - "EPCLK9INVERT": [0, 0, 0, 0] - }, - "EPCLK9CHNCNTRL": - { - "EPCLK9PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK9PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK9PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPRX00CHNCNTR": - { - "EPRX00ACBIAS": [0, 0, 0, 0], - "EPRX00EQ": [0, 0, 0, 0], - "EPRX00INVERT": [1, 1, 1, 1], - "EPRX00PHASESELECT": [0, 0, 0, 0], - "EPRX00TERM": [1, 1, 1, 1] - }, - "EPRX01CHNCNTR": - { - "EPRX01ACBIAS": [0, 0, 0, 0], - "EPRX01EQ": [0, 0, 0, 0], - "EPRX01INVERT": [0, 0, 0, 0], - "EPRX01PHASESELECT": [0, 0, 0, 0], - "EPRX01TERM": [0, 0, 0, 0] - }, - "EPRX02CHNCNTR": - { - "EPRX02ACBIAS": [0, 0, 0, 0], - "EPRX02EQ": [0, 0, 0, 0], - "EPRX02INVERT": [0, 0, 0, 0], - "EPRX02PHASESELECT": [0, 0, 0, 0], - "EPRX02TERM": [0, 0, 0, 0] - }, - "EPRX03CHNCNTR": - { - "EPRX03ACBIAS": [0, 0, 0, 0], - "EPRX03EQ": [0, 0, 0, 0], - "EPRX03INVERT": [0, 0, 0, 0], - "EPRX03PHASESELECT": [0, 0, 0, 0], - "EPRX03TERM": [0, 0, 0, 0] - }, - "EPRX0CONTROL": - { - "EPRX00ENABLE": [1, 1, 1, 1], - "EPRX01ENABLE": [0, 0, 0, 0], - "EPRX02ENABLE": [0, 0, 0, 0], - "EPRX03ENABLE": [0, 0, 0, 0], - "EPRX0DATARATE": [3, 3, 3, 3], - "EPRX0TRACKMODE": [3, 3, 3, 3] - }, - "EPRX0CURRENTPHASE10": - { - "EPRX0CURRENTPHASE0": [0, 0, 0, 0], - "EPRX0CURRENTPHASE1": [0, 0, 0, 0] - }, - "EPRX0CURRENTPHASE32": - { - "EPRX0CURRENTPHASE2": [0, 0, 0, 0], - "EPRX0CURRENTPHASE3": [0, 0, 0, 0] - }, - "EPRX0LOCKED": - { - "EPRX0CHNLOCKED": [0, 0, 0, 0], - "EPRX0STATE": [0, 0, 0, 0] - }, - "EPRX10CHNCNTR": - { - "EPRX10ACBIAS": [0, 0, 0, 0], - "EPRX10EQ": [0, 0, 0, 0], - "EPRX10INVERT": [1, 1, 1, 1], - "EPRX10PHASESELECT": [0, 0, 0, 0], - "EPRX10TERM": [1, 1, 1, 1] - }, - "EPRX11CHNCNTR": - { - "EPRX11ACBIAS": [0, 0, 0, 0], - "EPRX11EQ": [0, 0, 0, 0], - "EPRX11INVERT": [0, 0, 0, 0], - "EPRX11PHASESELECT": [0, 0, 0, 0], - "EPRX11TERM": [0, 0, 0, 0] - }, - "EPRX12CHNCNTR": - { - "EPRX12ACBIAS": [0, 0, 0, 0], - "EPRX12EQ": [0, 0, 0, 0], - "EPRX12INVERT": [0, 0, 0, 0], - "EPRX12PHASESELECT": [0, 0, 0, 0], - "EPRX12TERM": [0, 0, 0, 0] - }, - "EPRX13CHNCNTR": - { - "EPRX13ACBIAS": [0, 0, 0, 0], - "EPRX13EQ": [0, 0, 0, 0], - "EPRX13INVERT": [0, 0, 0, 0], - "EPRX13PHASESELECT": [0, 0, 0, 0], - "EPRX13TERM": [0, 0, 0, 0] - }, - "EPRX1CONTROL": - { - "EPRX10ENABLE": [1, 1, 1, 1], - "EPRX11ENABLE": [0, 0, 0, 0], - "EPRX12ENABLE": [0, 0, 0, 0], - "EPRX13ENABLE": [0, 0, 0, 0], - "EPRX1DATARATE": [3, 3, 3, 3], - "EPRX1TRACKMODE": [3, 3, 3, 3] - }, - "EPRX1CURRENTPHASE10": - { - "EPRX1CURRENTPHASE0": [0, 0, 0, 0], - "EPRX1CURRENTPHASE1": [0, 0, 0, 0] - }, - "EPRX1CURRENTPHASE32": - { - "EPRX1CURRENTPHASE2": [0, 0, 0, 0], - "EPRX1CURRENTPHASE3": [0, 0, 0, 0] - }, - "EPRX1LOCKED": - { - "EPRX1CHNLOCKED": [0, 0, 0, 0], - "EPRX1STATE": [0, 0, 0, 0] - }, - "EPRX20CHNCNTR": - { - "EPRX20ACBIAS": [0, 0, 0, 0], - "EPRX20EQ": [0, 0, 0, 0], - "EPRX20INVERT": [1, 1, 1, 1], - "EPRX20PHASESELECT": [0, 0, 0, 0], - "EPRX20TERM": [1, 1, 1, 1] - }, - "EPRX21CHNCNTR": - { - "EPRX21ACBIAS": [0, 0, 0, 0], - "EPRX21EQ": [0, 0, 0, 0], - "EPRX21INVERT": [0, 0, 0, 0], - "EPRX21PHASESELECT": [0, 0, 0, 0], - "EPRX21TERM": [0, 0, 0, 0] - }, - "EPRX22CHNCNTR": - { - "EPRX22ACBIAS": [0, 0, 0, 0], - "EPRX22EQ": [0, 0, 0, 0], - "EPRX22INVERT": [0, 0, 0, 0], - "EPRX22PHASESELECT": [0, 0, 0, 0], - "EPRX22TERM": [0, 0, 0, 0] - }, - "EPRX23CHNCNTR": - { - "EPRX23ACBIAS": [0, 0, 0, 0], - "EPRX23EQ": [0, 0, 0, 0], - "EPRX23INVERT": [0, 0, 0, 0], - "EPRX23PHASESELECT": [0, 0, 0, 0], - "EPRX23TERM": [0, 0, 0, 0] - }, - "EPRX2CONTROL": - { - "EPRX20ENABLE": [1, 1, 1, 1], - "EPRX21ENABLE": [0, 0, 0, 0], - "EPRX22ENABLE": [0, 0, 0, 0], - "EPRX23ENABLE": [0, 0, 0, 0], - "EPRX2DATARATE": [3, 3, 3, 3], - "EPRX2TRACKMODE": [3, 3, 3, 3] - }, - "EPRX2CURRENTPHASE10": - { - "EPRX2CURRENTPHASE0": [0, 0, 0, 0], - "EPRX2CURRENTPHASE1": [0, 0, 0, 0] - }, - "EPRX2CURRENTPHASE32": - { - "EPRX2CURRENTPHASE2": [0, 0, 0, 0], - "EPRX2CURRENTPHASE3": [0, 0, 0, 0] - }, - "EPRX2LOCKED": - { - "EPRX2CHNLOCKED": [0, 0, 0, 0], - "EPRX2STATE": [0, 0, 0, 0] - }, - "EPRX30CHNCNTR": - { - "EPRX30ACBIAS": [0, 0, 0, 0], - "EPRX30EQ": [0, 0, 0, 0], - "EPRX30INVERT": [1, 1, 1, 1], - "EPRX30PHASESELECT": [0, 0, 0, 0], - "EPRX30TERM": [1, 1, 1, 1] - }, - "EPRX31CHNCNTR": - { - "EPRX31ACBIAS": [0, 0, 0, 0], - "EPRX31EQ": [0, 0, 0, 0], - "EPRX31INVERT": [0, 0, 0, 0], - "EPRX31PHASESELECT": [0, 0, 0, 0], - "EPRX31TERM": [0, 0, 0, 0] - }, - "EPRX32CHNCNTR": - { - "EPRX32ACBIAS": [0, 0, 0, 0], - "EPRX32EQ": [0, 0, 0, 0], - "EPRX32INVERT": [0, 0, 0, 0], - "EPRX32PHASESELECT": [0, 0, 0, 0], - "EPRX32TERM": [0, 0, 0, 0] - }, - "EPRX33CHNCNTR": - { - "EPRX33ACBIAS": [0, 0, 0, 0], - "EPRX33EQ": [0, 0, 0, 0], - "EPRX33INVERT": [0, 0, 0, 0], - "EPRX33PHASESELECT": [0, 0, 0, 0], - "EPRX33TERM": [0, 0, 0, 0] - }, - "EPRX3CONTROL": - { - "EPRX30ENABLE": [1, 1, 1, 1], - "EPRX31ENABLE": [0, 0, 0, 0], - "EPRX32ENABLE": [0, 0, 0, 0], - "EPRX33ENABLE": [0, 0, 0, 0], - "EPRX3DATARATE": [3, 3, 3, 3], - "EPRX3TRACKMODE": [3, 3, 3, 3] - }, - "EPRX3CURRENTPHASE10": - { - "EPRX3CURRENTPHASE0": [0, 0, 0, 0], - "EPRX3CURRENTPHASE1": [0, 0, 0, 0] - }, - "EPRX3CURRENTPHASE32": - { - "EPRX3CURRENTPHASE2": [0, 0, 0, 0], - "EPRX3CURRENTPHASE3": [0, 0, 0, 0] - }, - "EPRX3LOCKED": - { - "EPRX3CHNLOCKED": [0, 0, 0, 0], - "EPRX3STATE": [0, 0, 0, 0] - }, - "EPRX40CHNCNTR": - { - "EPRX40ACBIAS": [0, 0, 0, 0], - "EPRX40EQ": [0, 0, 0, 0], - "EPRX40INVERT": [0, 0, 0, 0], - "EPRX40PHASESELECT": [0, 0, 0, 0], - "EPRX40TERM": [1, 1, 1, 1] - }, - "EPRX41CHNCNTR": - { - "EPRX41ACBIAS": [0, 0, 0, 0], - "EPRX41EQ": [0, 0, 0, 0], - "EPRX41INVERT": [0, 0, 0, 0], - "EPRX41PHASESELECT": [0, 0, 0, 0], - "EPRX41TERM": [0, 0, 0, 0] - }, - "EPRX42CHNCNTR": - { - "EPRX42ACBIAS": [0, 0, 0, 0], - "EPRX42EQ": [0, 0, 0, 0], - "EPRX42INVERT": [0, 0, 0, 0], - "EPRX42PHASESELECT": [0, 0, 0, 0], - "EPRX42TERM": [0, 0, 0, 0] - }, - "EPRX43CHNCNTR": - { - "EPRX43ACBIAS": [0, 0, 0, 0], - "EPRX43EQ": [0, 0, 0, 0], - "EPRX43INVERT": [0, 0, 0, 0], - "EPRX43PHASESELECT": [0, 0, 0, 0], - "EPRX43TERM": [0, 0, 0, 0] - }, - "EPRX4CONTROL": - { - "EPRX40ENABLE": [1, 1, 1, 1], - "EPRX41ENABLE": [0, 0, 0, 0], - "EPRX42ENABLE": [0, 0, 0, 0], - "EPRX43ENABLE": [0, 0, 0, 0], - "EPRX4DATARATE": [3, 3, 3, 3], - "EPRX4TRACKMODE": [3, 3, 3, 3] - }, - "EPRX4CURRENTPHASE10": - { - "EPRX4CURRENTPHASE0": [0, 0, 0, 0], - "EPRX4CURRENTPHASE1": [0, 0, 0, 0] - }, - "EPRX4LOCKED": - { - "EPRX4CHNLOCKED": [0, 0, 0, 0], - "EPRX4STATE": [0, 0, 0, 0] - }, - "EPRX50CHNCNTR": - { - "EPRX50ACBIAS": [0, 0, 0, 0], - "EPRX50EQ": [0, 0, 0, 0], - "EPRX50INVERT": [0, 0, 0, 0], - "EPRX50PHASESELECT": [0, 0, 0, 0], - "EPRX50TERM": [1, 1, 1, 1] - }, - "EPRX51CHNCNTR": - { - "EPRX51ACBIAS": [0, 0, 0, 0], - "EPRX51EQ": [0, 0, 0, 0], - "EPRX51INVERT": [0, 0, 0, 0], - "EPRX51PHASESELECT": [0, 0, 0, 0], - "EPRX51TERM": [0, 0, 0, 0] - }, - "EPRX52CHNCNTR": - { - "EPRX52ACBIAS": [0, 0, 0, 0], - "EPRX52EQ": [0, 0, 0, 0], - "EPRX52INVERT": [0, 0, 0, 0], - "EPRX52PHASESELECT": [0, 0, 0, 0], - "EPRX52TERM": [0, 0, 0, 0] - }, - "EPRX53CHNCNTR": - { - "EPRX53ACBIAS": [0, 0, 0, 0], - "EPRX53EQ": [0, 0, 0, 0], - "EPRX53INVERT": [0, 0, 0, 0], - "EPRX53PHASESELECT": [0, 0, 0, 0], - "EPRX53TERM": [0, 0, 0, 0] - }, - "EPRX5CONTROL": - { - "EPRX50ENABLE": [1, 1, 1, 1], - "EPRX51ENABLE": [0, 0, 0, 0], - "EPRX52ENABLE": [0, 0, 0, 0], - "EPRX53ENABLE": [0, 0, 0, 0], - "EPRX5DATARATE": [3, 3, 3, 3], - "EPRX5TRACKMODE": [3, 3, 3, 3] - }, - "EPRX60CHNCNTR": - { - "EPRX60ACBIAS": [0, 0, 0, 0], - "EPRX60EQ": [0, 0, 0, 0], - "EPRX60INVERT": [0, 0, 0, 0], - "EPRX60PHASESELECT": [0, 0, 0, 0], - "EPRX60TERM": [0, 0, 0, 0] - }, - "EPRX61CHNCNTR": - { - "EPRX61ACBIAS": [0, 0, 0, 0], - "EPRX61EQ": [0, 0, 0, 0], - "EPRX61INVERT": [0, 0, 0, 0], - "EPRX61PHASESELECT": [0, 0, 0, 0], - "EPRX61TERM": [0, 0, 0, 0] - }, - "EPRX62CHNCNTR": - { - "EPRX62ACBIAS": [0, 0, 0, 0], - "EPRX62EQ": [0, 0, 0, 0], - "EPRX62INVERT": [0, 0, 0, 0], - "EPRX62PHASESELECT": [0, 0, 0, 0], - "EPRX62TERM": [0, 0, 0, 0] - }, - "EPRX63CHNCNTR": - { - "EPRX63ACBIAS": [0, 0, 0, 0], - "EPRX63EQ": [0, 0, 0, 0], - "EPRX63INVERT": [0, 0, 0, 0], - "EPRX63PHASESELECT": [0, 0, 0, 0], - "EPRX63TERM": [0, 0, 0, 0] - }, - "EPRX6CONTROL": - { - "EPRX60ENABLE": [0, 0, 0, 0], - "EPRX61ENABLE": [0, 0, 0, 0], - "EPRX62ENABLE": [0, 0, 0, 0], - "EPRX63ENABLE": [0, 0, 0, 0], - "EPRX6DATARATE": [0, 0, 0, 0], - "EPRX6TRACKMODE": [0, 0, 0, 0] - }, - "EPRXDLLCONFIG": - { - "EPRXDATAGATINGENABLE": [0, 0, 0, 0], - "EPRXDLLCOARSELOCKDETECTION": [1, 1, 1, 1], - "EPRXDLLCONFIRMCOUNT": [2, 2, 2, 2], - "EPRXDLLCURRENT": [1, 1, 1, 1], - "EPRXDLLFSMCLKALWAYSON": [0, 0, 0, 0], - "EPRXENABLEREINIT": [0, 0, 0, 0] - }, - "EPRXECCHNCNTR": - { - "EPRXECACBIAS": [0, 0, 0, 0], - "EPRXECENABLE": [0, 0, 0, 0], - "EPRXECINVERT": [0, 0, 0, 0], - "EPRXECPHASESELECT": [0, 0, 0, 0], - "EPRXECTERM": [0, 0, 0, 0] - }, - "EPRXECCONTROL": - { - "EPRXECTRACKMODE": [0, 0, 0, 0] - }, - "EPRXEQ10CONTROL": - { - "EPRX00EQ": [0, 0, 0, 0], - "EPRX01EQ": [0, 0, 0, 0], - "EPRX02EQ": [0, 0, 0, 0], - "EPRX03EQ": [0, 0, 0, 0], - "EPRX10EQ": [0, 0, 0, 0], - "EPRX11EQ": [0, 0, 0, 0], - "EPRX12EQ": [0, 0, 0, 0], - "EPRX13EQ": [0, 0, 0, 0] - }, - "EPRXEQ32CONTROL": - { - "EPRX20EQ": [0, 0, 0, 0], - "EPRX21EQ": [0, 0, 0, 0], - "EPRX22EQ": [0, 0, 0, 0], - "EPRX23EQ": [0, 0, 0, 0], - "EPRX30EQ": [0, 0, 0, 0], - "EPRX31EQ": [0, 0, 0, 0], - "EPRX32EQ": [0, 0, 0, 0], - "EPRX33EQ": [0, 0, 0, 0] - }, - "EPRXEQ54CONTROL": - { - "EPRX40EQ": [0, 0, 0, 0], - "EPRX41EQ": [0, 0, 0, 0], - "EPRX42EQ": [0, 0, 0, 0], - "EPRX43EQ": [0, 0, 0, 0], - "EPRX50EQ": [0, 0, 0, 0], - "EPRX51EQ": [0, 0, 0, 0], - "EPRX52EQ": [0, 0, 0, 0], - "EPRX53EQ": [0, 0, 0, 0] - }, - "EPRXEQ6CONTROL": - { - "EPRX60EQ": [0, 0, 0, 0], - "EPRX61EQ": [0, 0, 0, 0], - "EPRX62EQ": [0, 0, 0, 0], - "EPRX63EQ": [0, 0, 0, 0] - }, - "EPRXLOCKFILTER": - { - "EPRXLOCKTHRESHOLD": [5, 5, 5, 5], - "EPRXRELOCKTHRESHOLD": [5, 5, 5, 5] - }, - "EPRXPRBS0": - { - "EPRX00PRBSENABLE": [0, 0, 0, 0], - "EPRX01PRBSENABLE": [0, 0, 0, 0], - "EPRX02PRBSENABLE": [0, 0, 0, 0], - "EPRX03PRBSENABLE": [0, 0, 0, 0], - "EPRX10PRBSENABLE": [0, 0, 0, 0], - "EPRX11PRBSENABLE": [0, 0, 0, 0], - "EPRX12PRBSENABLE": [0, 0, 0, 0], - "EPRX13PRBSENABLE": [0, 0, 0, 0] - }, - "EPRXPRBS1": - { - "EPRX20PRBSENABLE": [0, 0, 0, 0], - "EPRX21PRBSENABLE": [0, 0, 0, 0], - "EPRX22PRBSENABLE": [0, 0, 0, 0], - "EPRX23PRBSENABLE": [0, 0, 0, 0], - "EPRX30PRBSENABLE": [0, 0, 0, 0], - "EPRX31PRBSENABLE": [0, 0, 0, 0], - "EPRX32PRBSENABLE": [0, 0, 0, 0], - "EPRX33PRBSENABLE": [0, 0, 0, 0] - }, - "EPRXPRBS2": - { - "EPRX40PRBSENABLE": [0, 0, 0, 0], - "EPRX41PRBSENABLE": [0, 0, 0, 0], - "EPRX42PRBSENABLE": [0, 0, 0, 0], - "EPRX43PRBSENABLE": [0, 0, 0, 0], - "EPRX50PRBSENABLE": [0, 0, 0, 0], - "EPRX51PRBSENABLE": [0, 0, 0, 0], - "EPRX52PRBSENABLE": [0, 0, 0, 0], - "EPRX53PRBSENABLE": [0, 0, 0, 0] - }, - "EPRXPRBS3": - { - "EPRX60PRBSENABLE": [0, 0, 0, 0], - "EPRX61PRBSENABLE": [0, 0, 0, 0], - "EPRX62PRBSENABLE": [0, 0, 0, 0], - "EPRX63PRBSENABLE": [0, 0, 0, 0], - "EPRXECPRBSENABLE": [0, 0, 0, 0] - }, - "EPRXTRAIN10": - { - "EPRX0TRAIN": [0, 0, 0, 0], - "EPRX1TRAIN": [0, 0, 0, 0] - }, - "EPRXTRAIN32": - { - "EPRX2TRAIN": [0, 0, 0, 0], - "EPRX3TRAIN": [0, 0, 0, 0] - }, - "EPRXTRAIN54": - { - "EPRX4TRAIN": [0, 0, 0, 0], - "EPRX5TRAIN": [0, 0, 0, 0] - }, - "EPRXTRAINEC6": - { - "EPRX6TRAIN": [0, 0, 0, 0], - "EPRXECTRAIN": [0, 0, 0, 0] - }, - "EPTX00CHNCNTR": - { - "EPTX00DRIVESTRENGTH": [3, 0, 0, 0], - "EPTX00PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX00PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX01CHNCNTR": - { - "EPTX01DRIVESTRENGTH": [0, 0, 0, 0], - "EPTX01PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX01PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX01_00CHNCNTR": - { - "EPTX00INVERT": [0, 0, 0, 0], - "EPTX00PREEMPHASISWIDTH": [0, 0, 0, 0], - "EPTX01INVERT": [0, 0, 0, 0], - "EPTX01PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPTX02CHNCNTR": - { - "EPTX02DRIVESTRENGTH": [3, 0, 0, 0], - "EPTX02PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX02PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX03CHNCNTR": - { - "EPTX03DRIVESTRENGTH": [0, 0, 0, 0], - "EPTX03PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX03PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX03_02CHNCNTR": - { - "EPTX02INVERT": [0, 0, 0, 0], - "EPTX02PREEMPHASISWIDTH": [0, 0, 0, 0], - "EPTX03INVERT": [0, 0, 0, 0], - "EPTX03PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPTX10CHNCNTR": - { - "EPTX10DRIVESTRENGTH": [3, 0, 0, 0], - "EPTX10PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX10PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX10ENABLE": - { - "EPTX00ENABLE": [1, 0, 0, 0], - "EPTX01ENABLE": [0, 0, 0, 0], - "EPTX02ENABLE": [1, 0, 0, 0], - "EPTX03ENABLE": [0, 0, 0, 0], - "EPTX10ENABLE": [1, 0, 0, 0], - "EPTX11ENABLE": [0, 0, 0, 0], - "EPTX12ENABLE": [1, 0, 0, 0], - "EPTX13ENABLE": [0, 0, 0, 0] - }, - "EPTX11CHNCNTR": - { - "EPTX11DRIVESTRENGTH": [0, 0, 0, 0], - "EPTX11PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX11PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX11_10CHNCNTR": - { - "EPTX10INVERT": [0, 0, 0, 0], - "EPTX10PREEMPHASISWIDTH": [0, 0, 0, 0], - "EPTX11INVERT": [0, 0, 0, 0], - "EPTX11PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPTX12CHNCNTR": - { - "EPTX12DRIVESTRENGTH": [3, 0, 0, 0], - "EPTX12PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX12PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX13CHNCNTR": - { - "EPTX13DRIVESTRENGTH": [0, 0, 0, 0], - "EPTX13PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX13PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX13_12CHNCNTR": - { - "EPTX12INVERT": [0, 0, 0, 0], - "EPTX12PREEMPHASISWIDTH": [0, 0, 0, 0], - "EPTX13INVERT": [0, 0, 0, 0], - "EPTX13PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPTX20CHNCNTR": - { - "EPTX20DRIVESTRENGTH": [3, 0, 0, 0], - "EPTX20PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX20PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX21CHNCNTR": - { - "EPTX21DRIVESTRENGTH": [0, 0, 0, 0], - "EPTX21PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX21PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX21_20CHNCNTR": - { - "EPTX20INVERT": [0, 0, 0, 0], - "EPTX20PREEMPHASISWIDTH": [0, 0, 0, 0], - "EPTX21INVERT": [0, 0, 0, 0], - "EPTX21PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPTX22CHNCNTR": - { - "EPTX22DRIVESTRENGTH": [3, 0, 0, 0], - "EPTX22PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX22PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX23CHNCNTR": - { - "EPTX23DRIVESTRENGTH": [0, 0, 0, 0], - "EPTX23PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX23PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX23_22CHNCNTR": - { - "EPTX22INVERT": [0, 0, 0, 0], - "EPTX22PREEMPHASISWIDTH": [0, 0, 0, 0], - "EPTX23INVERT": [0, 0, 0, 0], - "EPTX23PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPTX30CHNCNTR": - { - "EPTX30DRIVESTRENGTH": [3, 0, 0, 0], - "EPTX30PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX30PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX31CHNCNTR": - { - "EPTX31DRIVESTRENGTH": [0, 0, 0, 0], - "EPTX31PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX31PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX31_30CHNCNTR": - { - "EPTX30INVERT": [0, 0, 0, 0], - "EPTX30PREEMPHASISWIDTH": [0, 0, 0, 0], - "EPTX31INVERT": [0, 0, 0, 0], - "EPTX31PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPTX32CHNCNTR": - { - "EPTX32DRIVESTRENGTH": [3, 0, 0, 0], - "EPTX32PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX32PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX32ENABLE": - { - "EPTX20ENABLE": [1, 0, 0, 0], - "EPTX21ENABLE": [0, 0, 0, 0], - "EPTX22ENABLE": [1, 0, 0, 0], - "EPTX23ENABLE": [0, 0, 0, 0], - "EPTX30ENABLE": [1, 0, 0, 0], - "EPTX31ENABLE": [0, 0, 0, 0], - "EPTX32ENABLE": [1, 0, 0, 0], - "EPTX33ENABLE": [0, 0, 0, 0] - }, - "EPTX33CHNCNTR": - { - "EPTX33DRIVESTRENGTH": [0, 0, 0, 0], - "EPTX33PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX33PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX33_32CHNCNTR": - { - "EPTX32INVERT": [0, 0, 0, 0], - "EPTX32PREEMPHASISWIDTH": [0, 0, 0, 0], - "EPTX33INVERT": [0, 0, 0, 0], - "EPTX33PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPTXCONTROL": - { - "EPTX0MIRRORENABLE": [0, 0, 0, 0], - "EPTX1MIRRORENABLE": [0, 0, 0, 0], - "EPTX2MIRRORENABLE": [0, 0, 0, 0], - "EPTX3MIRRORENABLE": [0, 0, 0, 0], - "EPTXECENABLE": [0, 0, 0, 0], - "EPTXECINVERT": [0, 0, 0, 0], - "EPTXECPREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPTXDATARATE": - { - "EPTX0DATARATE": [2, 0, 0, 0], - "EPTX1DATARATE": [2, 0, 0, 0], - "EPTX2DATARATE": [2, 0, 0, 0], - "EPTX3DATARATE": [2, 0, 0, 0] - }, - "EPTXECCHNCNTR": - { - "EPTXECDRIVESTRENGTH": [0, 0, 0, 0], - "EPTXECPREEMPHASISMODE": [0, 0, 0, 0], - "EPTXECPREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EQCONFIG": - { - "EQATTENUATION": [3, 0, 0, 0], - "EQCAP": [0, 0, 0, 0] - }, - "EQRES": - { - "EQRES0": [0, 0, 0, 0], - "EQRES1": [0, 0, 0, 0], - "EQRES2": [0, 0, 0, 0], - "EQRES3": [0, 0, 0, 0] - }, - "FAFAMAXSKIPCYCLECOUNTAFTERNF": - { - "FAMAXSKIPCYCLECOUNTAFTERNF": [58, 0, 0, 0] - }, - "FAMAXHEADERFOUNDCOUNT": - { - "FAMAXHEADERFOUNDCOUNT": [10, 0, 0, 0] - }, - "FAMAXHEADERFOUNDCOUNTAFTERNF": - { - "FAMAXHEADERFOUNDCOUNTAFTERNF": [26, 0, 0, 0] - }, - "FAMAXHEADERNOTFOUNDCOUNT": - { - "FAMAXHEADERNOTFOUNDCOUNT": [42, 0, 0, 0] - }, - "FORCEENABLE": - { - "FORCERXENABLE": [0, 0, 0, 0], - "FORCETXENABLE": [0, 0, 0, 0], - "I2CMCLKALWAYSENABLE": [0, 0, 0, 0], - "LDFORCEENABLE": [0, 0, 0, 0], - "PSFSMCLKALWAYSON": [0, 0, 0, 0], - "TESTCLKFORCEENABLE": [0, 0, 0, 0] - }, - "FUSEBLOWADDH": - { - "FUSEBLOWADDRESS": [0, 0, 0, 0] - }, - "FUSEBLOWADDL": - { - "FUSEBLOWADDRESS": [0, 0, 0, 0] - }, - "FUSEBLOWDATAA": - { - "FUSEBLOWDATA": [0, 0, 0, 0] - }, - "FUSEBLOWDATAB": - { - "FUSEBLOWDATA": [0, 0, 0, 0] - }, - "FUSEBLOWDATAC": - { - "FUSEBLOWDATA": [0, 0, 0, 0] - }, - "FUSEBLOWDATAD": - { - "FUSEBLOWDATA": [0, 0, 0, 0] - }, - "FUSECONTROL": - { - "FUSEBLOW": [0, 0, 0, 0], - "FUSEBLOWPULSELENGTH": [0, 0, 0, 0], - "FUSEREAD": [0, 0, 0, 0] - }, - "FUSEMAGIC": - { - "FUSEMAGICNUMBER": [0, 0, 0, 0] - }, - "I2CM0ADDRESS": - { - "I2CM0ADDRESS": [0, 0, 0, 0] - }, - "I2CM0CMD": - { - "I2CM0CMD": [0, 0, 0, 0] - }, - "I2CM0CONFIG": - { - "I2CM0ADDRESSEXT": [0, 0, 0, 0], - "I2CM0SCLDRIVESTRENGTH": [0, 0, 0, 0], - "I2CM0SCLPULLUPENABLE": [1, 0, 0, 0], - "I2CM0SDADRIVESTRENGTH": [0, 0, 0, 0], - "I2CM0SDAPULLUPENABLE": [1, 0, 0, 0] - }, - "I2CM0DATA0": - { - "I2CM0DATA": [0, 0, 0, 0] - }, - "I2CM0DATA1": - { - "I2CM0DATA": [0, 0, 0, 0] - }, - "I2CM0DATA2": - { - "I2CM0DATA": [0, 0, 0, 0] - }, - "I2CM0DATA3": - { - "I2CM0DATA": [0, 0, 0, 0] - }, - "I2CM1ADDRESS": - { - "I2CM1ADDRESS": [0, 0, 0, 0] - }, - "I2CM1CMD": - { - "I2CM1CMD": [0, 0, 0, 0] - }, - "I2CM1CONFIG": - { - "I2CM1ADDRESSEXT": [0, 0, 0, 0], - "I2CM1SCLDRIVESTRENGTH": [0, 0, 0, 0], - "I2CM1SCLPULLUPENABLE": [1, 0, 0, 0], - "I2CM1SDADRIVESTRENGTH": [0, 0, 0, 0], - "I2CM1SDAPULLUPENABLE": [1, 0, 0, 0] - }, - "I2CM1DATA0": - { - "I2CM1DATA": [0, 0, 0, 0] - }, - "I2CM1DATA1": - { - "I2CM1DATA": [0, 0, 0, 0] - }, - "I2CM1DATA2": - { - "I2CM1DATA": [0, 0, 0, 0] - }, - "I2CM1DATA3": - { - "I2CM1DATA": [0, 0, 0, 0] - }, - "I2CM2ADDRESS": - { - "I2CM2ADDRESS": [0, 0, 0, 0] - }, - "I2CM2CMD": - { - "I2CM2CMD": [0, 0, 0, 0] - }, - "I2CM2CONFIG": - { - "I2CM2ADDRESSEXT": [0, 0, 0, 0], - "I2CM2SCLDRIVESTRENGTH": [1, 0, 0, 0], - "I2CM2SCLPULLUPENABLE": [0, 0, 0, 0], - "I2CM2SDADRIVESTRENGTH": [0, 0, 0, 0], - "I2CM2SDAPULLUPENABLE": [1, 0, 0, 0] - }, - "I2CM2DATA0": - { - "I2CM2DATA": [0, 0, 0, 0] - }, - "I2CM2DATA1": - { - "I2CM2DATA": [0, 0, 0, 0] - }, - "I2CM2DATA2": - { - "I2CM2DATA": [0, 0, 0, 0] - }, - "I2CM2DATA3": - { - "I2CM2DATA": [0, 0, 0, 0] - }, - "I2CMTRANSADDRESS": - { - "I2CMTRANSADDRESS": [0, 0, 0, 0] - }, - "I2CMTRANSCONFIG": - { - "I2CMTRANSADDRESSEXT": [0, 0, 0, 0], - "I2CMTRANSCHANNEL": [0, 0, 0, 0], - "I2CMTRANSENABLE": [0, 0, 0, 0] - }, - "I2CMTRANSCTRL": - { - "I2CMTRANSCTRL": [0, 0, 0, 0] - }, - "I2CMTRANSDATA0": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA1": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA10": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA11": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA12": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA13": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA14": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA15": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA2": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA3": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA4": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA5": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA6": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA7": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA8": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA9": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CSLAVEADDRESS": - { - "ASICCONTROLADR": [0, 0, 0, 0] - }, - "LDCONFIGH": - { - "LDEMPHASISENABLE": [0, 0, 0, 0], - "LDMODULATIONCURRENT": [32, 0, 0, 0] - }, - "LDCONFIGL": - { - "LDEMPHASISAMP": [0, 0, 0, 0], - "LDEMPHASISSHORT": [0, 0, 0, 0] - }, - "PGCONFIG": - { - "PGDELAY": [0, 0, 0, 0], - "PGENABLE": [0, 0, 0, 0], - "PGLEVEL": [0, 0, 0, 0] - }, - "PIODIRH": - { - "PIODIR": [0, 0, 0, 0] - }, - "PIODIRL": - { - "PIODIR": [0, 0, 0, 0] - }, - "PIODRIVESTRENGTHH": - { - "PIODRIVESTRENGTH": [0, 0, 0, 0] - }, - "PIODRIVESTRENGTHL": - { - "PIODRIVESTRENGTH": [0, 0, 0, 0] - }, - "PIOOUTH": - { - "PIOOUT": [0, 0, 0, 0] - }, - "PIOOUTL": - { - "PIOOUT": [0, 0, 0, 0] - }, - "PIOPULLENAH": - { - "PIOPULLENABLE": [0, 0, 0, 0] - }, - "PIOPULLENAL": - { - "PIOPULLENABLE": [0, 0, 0, 0] - }, - "PIOUPDOWNH": - { - "PIOUPDOWN": [0, 0, 0, 0] - }, - "PIOUPDOWNL": - { - "PIOUPDOWN": [0, 0, 0, 0] - }, - "POWERUP0": - { - "PUSMDLLWDOGDISABLE": [0, 0, 0, 0], - "PUSMPLLTIMEOUTCONFIG": [0, 0, 0, 0], - "PUSMPLLWDOGDISABLE": [0, 0, 0, 0], - "PUSMREADYWHENCHNSLOCKED": [0, 0, 0, 0] - }, - "POWERUP1": - { - "PUSMCHANNELSTIMEOUTCONFIG": [0, 0, 0, 0], - "PUSMDLLTIMEOUTCONFIG": [0, 0, 0, 0] - }, - "POWERUP2": - { - "DLLCONFIGDONE": [1, 1, 1, 1], - "PLLCONFIGDONE": [1, 1, 1, 1], - "UPDATEENABLE": [0, 0, 0, 0] - }, - "POWERUP3": - { - "PUSMFORCESTATE": [0, 0, 0, 0], - "PUSMSTATEFORCED": [0, 0, 0, 0] - }, - "POWERUP4": - { - "PUSMFORCEMAGIC": [0, 0, 0, 0] - }, - "PROCESSANDSEUMONITOR": - { - "DLDPFECCOUNTERENABLE": [0, 0, 0, 0], - "PMCHANNEL": [0, 0, 0, 0], - "PMENABLE": [0, 0, 0, 0], - "SEUENABLE": [0, 0, 0, 0] - }, - "PS0CONFIG": - { - "PS0DELAY": [0, 0, 0, 0], - "PS0DRIVESTRENGTH": [0, 0, 0, 0], - "PS0ENABLEFINETUNE": [0, 0, 0, 0], - "PS0FREQ": [0, 0, 0, 0] - }, - "PS0DELAY": - { - "PS0DELAY": [0, 0, 0, 0] - }, - "PS0OUTDRIVER": - { - "PS0PREEMPHASISMODE": [0, 0, 0, 0], - "PS0PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "PS0PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "PS1CONFIG": - { - "PS1DELAY": [0, 0, 0, 0], - "PS1DRIVESTRENGTH": [0, 0, 0, 0], - "PS1ENABLEFINETUNE": [0, 0, 0, 0], - "PS1FREQ": [0, 0, 0, 0] - }, - "PS1DELAY": - { - "PS1DELAY": [0, 0, 0, 0] - }, - "PS1OUTDRIVER": - { - "PS1PREEMPHASISMODE": [0, 0, 0, 0], - "PS1PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "PS1PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "PS2CONFIG": - { - "PS2DELAY": [0, 0, 0, 0], - "PS2DRIVESTRENGTH": [0, 0, 0, 0], - "PS2ENABLEFINETUNE": [0, 0, 0, 0], - "PS2FREQ": [0, 0, 0, 0] - }, - "PS2DELAY": - { - "PS2DELAY": [0, 0, 0, 0] - }, - "PS2OUTDRIVER": - { - "PS2PREEMPHASISMODE": [0, 0, 0, 0], - "PS2PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "PS2PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "PS3CONFIG": - { - "PS3DELAY": [0, 0, 0, 0], - "PS3DRIVESTRENGTH": [0, 0, 0, 0], - "PS3ENABLEFINETUNE": [0, 0, 0, 0], - "PS3FREQ": [0, 0, 0, 0] - }, - "PS3DELAY": - { - "PS3DELAY": [0, 0, 0, 0] - }, - "PS3OUTDRIVER": - { - "PS3PREEMPHASISMODE": [0, 0, 0, 0], - "PS3PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "PS3PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "PSDLLCONFIG": - { - "EPRXUNLOCKTHRESHOLD": [0, 0, 0, 0], - "PSDLLCONFIRMCOUNT": [0, 0, 0, 0], - "PSDLLCURRENTSEL": [0, 0, 0, 0] - }, - "REFCLK": - { - "REFCLKACBIAS": [0, 0, 0, 0], - "REFCLKFORCEENABLE": [0, 0, 0, 0], - "REFCLKTERM": [0, 0, 0, 0], - "TESTCLKSETCM": [0, 0, 0, 0] - }, - "RESETCONFIG": - { - "BODENABLE": [0, 0, 0, 0], - "BODLEVEL": [0, 0, 0, 0], - "RESETOUTDRIVESTRENGTH": [0, 0, 0, 0], - "RESETOUTLENGTH": [0, 0, 0, 0] - }, - "RST0": - { - "RSTCONFIG": [0, 0, 0, 0], - "RSTFUSES": [0, 0, 0, 0], - "RSTI2CM0": [0, 0, 0, 0], - "RSTI2CM1": [0, 0, 0, 0], - "RSTI2CM2": [0, 0, 0, 0], - "RSTPLLDIGITAL": [0, 0, 0, 0], - "RSTRXLOGIC": [0, 0, 0, 0], - "RSTTXLOGIC": [0, 0, 0, 0] - }, - "RST1": - { - "RSTEPRX0DLL": [0, 0, 0, 0], - "RSTEPRX1DLL": [0, 0, 0, 0], - "RSTEPRX2DLL": [0, 0, 0, 0], - "RSTEPRX3DLL": [0, 0, 0, 0], - "RSTEPRX4DLL": [0, 0, 0, 0], - "RSTEPRX5DLL": [0, 0, 0, 0], - "RSTEPRX6DLL": [0, 0, 0, 0], - "RSTFRAMEALIGNER": [0, 0, 0, 0] - }, - "RST2": - { - "RESETOUTFORCEACTIVE": [0, 0, 0, 0], - "RSTPS0DLL": [0, 0, 0, 0], - "RSTPS1DLL": [0, 0, 0, 0], - "RSTPS2DLL": [0, 0, 0, 0], - "RSTPS3DLL": [0, 0, 0, 0], - "SKIPFORCE": [0, 0, 0, 0] - }, - "SCCONFIG": - { - "SCPARITYCHECKDISABLE": [0, 0, 0, 0] - }, - "TEMPCALH": - { - "TEMPCAL": [0, 0, 0, 0] - }, - "TEMPCALL": - { - "TEMPCAL": [0, 0, 0, 0] - }, - "TO0SEL": - { - "TO0SELECT": [0, 0, 0, 0] - }, - "TO1SEL": - { - "TO1SELECT": [0, 0, 0, 0] - }, - "TO2SEL": - { - "TO2SELECT": [0, 0, 0, 0] - }, - "TO3SEL": - { - "TO3SELECT": [0, 0, 0, 0] - }, - "TO4DRIVER": - { - "TO4DRIVESTRENGTH": [0, 0, 0, 0], - "TO4PREEMPHASISMODE": [0, 0, 0, 0], - "TO4PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "TO4SEL": - { - "TO4SELECT": [0, 0, 0, 0] - }, - "TO5DRIVER": - { - "TO5DRIVESTRENGTH": [0, 0, 0, 0], - "TO5PREEMPHASISMODE": [0, 0, 0, 0], - "TO5PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "TO5SEL": - { - "TO5SELECT": [0, 0, 0, 0] - }, - "TODRIVINGSTRENGTH": - { - "TO0DS": [0, 0, 0, 0], - "TO1DS": [0, 0, 0, 0], - "TO2DS": [0, 0, 0, 0], - "TO3DS": [0, 0, 0, 0] - }, - "TOPREEMP": - { - "TO4INVERT": [0, 0, 0, 0], - "TO4PREEMPHASISWIDTH": [0, 0, 0, 0], - "TO5INVERT": [0, 0, 0, 0], - "TO5PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "ULDATASOURCE0": - { - "ULECDATASOURCE": [0, 0, 0, 0], - "ULSERTESTPATTERN": [0, 0, 0, 0] - }, - "ULDATASOURCE1": - { - "LDDATASOURCE": [0, 0, 0, 0], - "ULG0DATASOURCE": [0, 0, 0, 0], - "ULG1DATASOURCE": [0, 0, 0, 0] - }, - "ULDATASOURCE2": - { - "ULG2DATASOURCE": [0, 0, 0, 0], - "ULG3DATASOURCE": [0, 0, 0, 0] - }, - "ULDATASOURCE3": - { - "ULG4DATASOURCE": [0, 0, 0, 0], - "ULG5DATASOURCE": [0, 0, 0, 0] - }, - "ULDATASOURCE4": - { - "DLECDATASOURCE": [0, 0, 0, 0], - "ULG6DATASOURCE": [0, 0, 0, 0], - "ULICDATASOURCE": [0, 0, 0, 0] - }, - "ULDATASOURCE5": - { - "DLG0DATASOURCE": [0, 0, 0, 0], - "DLG1DATASOURCE": [0, 0, 0, 0], - "DLG2DATASOURCE": [0, 0, 0, 0], - "DLG3DATASOURCE": [0, 0, 0, 0] - }, - "USERID0": - { - "USERID": [0, 0, 0, 0] - }, - "USERID1": - { - "USERID": [0, 0, 0, 0] - }, - "USERID2": - { - "USERID": [0, 0, 0, 0] - }, - "USERID3": - { - "USERID": [0, 0, 0, 0] - }, - "VREFCNTR": - { - "VREFENABLE": [0, 0, 0, 0], - "VREFTUNE": [0, 0, 0, 0] - } - }, - - "gbcr": - { - "CH1DOWNLINK0": - { - "TX1DISDLEMP": [0, 0, 0, 0], - "TX1DLATT": [3, 3, 3, 3], - "TX1DLSR": [5, 5, 5, 5] - }, - "CH1DOWNLINK1": - { - "TX1DISDLBIAS": [0, 0, 0, 0], - "TX1DISDLLPFBIAS": [1, 1, 1, 1] - }, - "CH1UPLINK0": - { - "CH1CMLAMPLSEL": [7, 7, 7, 7], - "CH1DISEQLF": [1, 1, 1, 1], - "CH1EQATT": [3, 3, 3, 3] - }, - "CH1UPLINK1": - { - "CH1CTLEHFSR": [11, 11, 11, 11], - "CH1CTLEMFSR": [11, 11, 11, 11] - }, - "CH1UPLINK2": - { - "CH1DIS": [0, 0, 0, 0], - "CH1DISDFF": [1, 1, 1, 1], - "CH1DISLPF": [0, 0, 0, 0] - }, - "CH2DOWNLINK0": - { - "TX2DISDLEMP": [0, 0, 0, 0], - "TX2DLATT": [3, 3, 3, 3], - "TX2DLSR": [5, 5, 5, 5] - }, - "CH2DOWNLINK1": - { - "TX2DISDLBIAS": [0, 0, 0, 0], - "TX2DISDLLPFBIAS": [1, 1, 1, 1] - }, - "CH2UPLINK0": - { - "CH2CMLAMPLSEL": [7, 7, 7, 7], - "CH2DISEQLF": [1, 1, 1, 1], - "CH2EQATT": [3, 3, 3, 3] - }, - "CH2UPLINK1": - { - "CH2CTLEHFSR": [11, 11, 11, 11], - "CH2CTLEMFSR": [11, 11, 11, 11] - }, - "CH2UPLINK2": - { - "CH2DIS": [0, 0, 0, 0], - "CH2DISDFF": [1, 1, 1, 1], - "CH2DISLPF": [0, 0, 0, 0] - }, - "CH3UPLINK0": - { - "CH3CMLAMPLSEL": [7, 7, 7, 7], - "CH3DISEQLF": [1, 1, 1, 1], - "CH3EQATT": [3, 3, 3, 3] - }, - "CH3UPLINK1": - { - "CH3CTLEHFSR": [11, 11, 11, 11], - "CH3CTLEMFSR": [11, 11, 11, 11] - }, - "CH3UPLINK2": - { - "CH3DIS": [0, 0, 0, 0], - "CH3DISDFF": [1, 1, 1, 1], - "CH3DISLPF": [0, 0, 0, 0] - }, - "CH4UPLINK0": - { - "CH4CMLAMPLSEL": [7, 7, 7, 7], - "CH4DISEQLF": [1, 1, 1, 1], - "CH4EQATT": [3, 3, 3, 3] - }, - "CH4UPLINK1": - { - "CH4CTLEHFSR": [11, 11, 11, 11], - "CH4CTLEMFSR": [11, 11, 11, 11] - }, - "CH4UPLINK2": - { - "CH4DIS": [0, 0, 0, 0], - "CH4DISDFF": [1, 1, 1, 1], - "CH4DISLPF": [0, 0, 0, 0] - }, - "CH5UPLINK0": - { - "CH5CMLAMPLSEL": [7, 7, 7, 7], - "CH5DISEQLF": [1, 1, 1, 1], - "CH5EQATT": [3, 3, 3, 3] - }, - "CH5UPLINK1": - { - "CH5CTLEHFSR": [11, 11, 11, 11], - "CH5CTLEMFSR": [11, 11, 11, 11] - }, - "CH5UPLINK2": - { - "CH5DIS": [0, 0, 0, 0], - "CH5DISDFF": [1, 1, 1, 1], - "CH5DISLPF": [0, 0, 0, 0] - }, - "CH6UPLINK0": - { - "CH6CMLAMPLSEL": [7, 7, 7, 7], - "CH6DISEQLF": [1, 1, 1, 1], - "CH6EQATT": [3, 3, 3, 3] - }, - "CH6UPLINK1": - { - "CH6CTLEHFSR": [11, 11, 11, 11], - "CH6CTLEMFSR": [11, 11, 11, 11] - }, - "CH6UPLINK2": - { - "CH6DIS": [0, 0, 0, 0], - "CH6DISDFF": [1, 1, 1, 1], - "CH6DISLPF": [0, 0, 0, 0] - }, - "CH7UPLINK0": - { - "CH7CMLAMPLSEL": [7, 7, 7, 7], - "CH7DISEQLF": [1, 1, 1, 1], - "CH7EQATT": [3, 3, 3, 3] - }, - "CH7UPLINK1": - { - "CH7CTLEHFSR": [11, 11, 11, 11], - "CH7CTLEMFSR": [11, 11, 11, 11] - }, - "CH7UPLINK2": - { - "CH7DIS": [0, 0, 0, 0], - "CH7DISDFF": [1, 1, 1, 1], - "CH7DISLPF": [0, 0, 0, 0] - }, - "LVDSRXTX": - { - "DISTX": [0, 0, 0, 0], - "RXEN": [1, 1, 1, 1], - "RXENTERMINATION": [1, 1, 1, 1], - "RXEQ": [0, 0, 0, 0], - "RXINVDATA": [0, 0, 0, 0], - "RXSETCM": [1, 1, 1, 1] - }, - "PHASESHIFTER0": - { - "DLLCAPRESET": [0, 0, 0, 0], - "DLLENABLE": [1, 1, 1, 1] - }, - "PHASESHIFTER1": - { - "DLLCHARGEPUMPCURRENT": [15, 15, 15, 15], - "DLLFORCEDOWN": [1, 1, 1, 1] - }, - "PHASESHIFTER2": - { - "DLLCLOCKDELAYCH6": [5, 5, 5, 5], - "DLLCLOCKDELAYCH7": [5, 5, 5, 5] - }, - "PHASESHIFTER3": - { - "DLLCLOCKDELAYCH4": [5, 5, 5, 5], - "DLLCLOCKDELAYCH5": [5, 5, 5, 5] - }, - "PHASESHIFTER4": - { - "DLLCLOCKDELAYCH6": [5, 5, 5, 5], - "DLLCLOCKDELAYCH7": [5, 5, 5, 5] - }, - "PHASESHIFTER5": - { - "DLLCLOCKDELAYCH1": [5, 5, 5, 5], - "DLLCLOCKDELAYCHTEST": [5, 5, 5, 5] - } - }, - - "vtrx": - { - "C0BC": - { - "C0BiasCur": 47 - }, - "C0CR": - { - "C0BEN": 1, - "C0CEN": 1, - "C0FEP": 0, - "C0LAEN": 1, - "C0MEN": 1, - "C0REP": 0 - }, - "C0EA": - { - "C0EmpAmp": 0 - }, - "C0MC": - { - "C0ModCur": 38 - }, - "C1BC": - { - "C1BiasCur": 47 - }, - "C1CR": - { - "C1BEN": 1, - "C1CEN": 1, - "C1FEP": 0, - "C1LAEN": 1, - "C1MEN": 1, - "C1REP": 0 - }, - "C1EA": - { - "C1EmpAmp": 0 - }, - "C1MC": - { - "C1ModCur": 38 - }, - "C2BC": - { - "C2BiasCur": 47 - }, - "C2CR": - { - "C2BEN": 1, - "C2CEN": 1, - "C2FEP": 0, - "C2LAEN": 1, - "C2MEN": 1, - "C2REP": 0 - }, - "C2EA": - { - "C2EmpAmp": 0 - }, - "C2MC": - { - "C2ModCur": 38 - }, - "C3BC": - { - "C3BiasCur": 47 - }, - "C3CR": - { - "C3BEN": 1, - "C3CEN": 1, - "C3FEP": 0, - "C3LAEN": 1, - "C3MEN": 1, - "C3REP": 0 - }, - "C3EA": - { - "C3EmpAmp": 0 - }, - "C3MC": - { - "C3ModCur": 38 - }, - "CCNF": - { - "CEA": 1, - "CEB": 1, - "CEC": 1, - "CSEN": 0 - }, - "CSE": - { - "ClkSpyEna": 0 - }, - "GCR": - { - "GBEN": 1, - "GCEN": 1, - "GLAEN": 1, - "GMEN": 1, - "GPEN": 1 - }, - "ODC": - { - "DS": 1 - } - } -} \ No newline at end of file diff --git a/ui/src/Config/00000000_test_v1.json b/ui/src/Config/00000000_test_v1.json deleted file mode 100644 index 2ec4e4d..0000000 --- a/ui/src/Config/00000000_test_v1.json +++ /dev/null @@ -1,2334 +0,0 @@ -{ - "Optoboard": - { - "serial": "00000000", - "flx_G": 0, - "flx_i": 0, - "flx_d": 0 - }, - - "power_up_registers_master": - [ - "CLKGCONFIG0", - "CLKGCONFIG1", - "CLKGPLLRES", - "CLKGPLLINTCUR", - "CLKGPLLPROPCUR", - "CLKGCDRPROPCUR", - "CLKGCDRINTCUR", - "CLKGCDRFFPROPCUR", - "CLKGFLLINTCUR", - "CLKGFFCAP", - "CLKGCNTOVERRIDE", - "CLKGOVERRIDECAPBANK", - "CLKGWAITTIME", - "CLKGLFCONFIG0", - "CLKGLFCONFIG1", - "EPRXDLLCONFIG", - "EPRXLOCKFILTER", - "EPRXLOCKFILTER2", - "LDCONFIGH", - "EPRX0CONTROL", - "EPRX00CHNCNTR", - "EPRX1CONTROL", - "EPRX10CHNCNTR", - "EPRX2CONTROL", - "EPRX20CHNCNTR", - "EPRX3CONTROL", - "EPRX30CHNCNTR", - "EPRX4CONTROL", - "EPRX40CHNCNTR", - "EPRX5CONTROL", - "EPRX50CHNCNTR", - "EQCONFIG", - "FAMAXHEADERFOUNDCOUNT", - "FAMAXHEADERFOUNDCOUNTAFTERNF", - "FAMAXHEADERNOTFOUNDCOUNT", - "EPTXDATARATE", - "EPTX10ENABLE", - "EPTX32ENABLE", - "EPTX00CHNCNTR", - "EPTX02CHNCNTR", - "EPTX10CHNCNTR", - "EPTX12CHNCNTR", - "EPTX20CHNCNTR", - "EPTX22CHNCNTR", - "EPTX30CHNCNTR", - "EPTX32CHNCNTR", - "EPCLK5CHNCNTRH", - "EPCLK5CHNCNTRL", - "EPCLK2CHNCNTRH", - "EPCLK2CHNCNTRL", - "EPCLK26CHNCNTRH", - "EPCLK26CHNCNTRL", - "EPCLK19CHNCNTRH", - "EPCLK19CHNCNTRL", - "POWERUP2" - ], - - "power_up_registers_slave": - [ - "REFCLK", - "CLKGCONFIG0", - "CLKGCONFIG1", - "CLKGPLLRES", - "CLKGPLLINTCUR", - "CLKGCDRINTCUR", - "CLKGCDRFFPROPCUR", - "CLKGFLLINTCUR", - "CLKGFFCAP", - "CLKGCNTOVERRIDE", - "CLKGOVERRIDECAPBANK", - "CLKGWAITTIME", - "CLKGLFCONFIG0", - "CLKGLFCONFIG1", - "PSDLLCONFIG", - "EPRXDLLCONFIG", - "EPRXLOCKFILTER", - "EPRXLOCKFILTER2", - "LDCONFIGH", - "EPRX0CONTROL", - "EPRX00CHNCNTR", - "EPRX1CONTROL", - "EPRX10CHNCNTR", - "EPRX2CONTROL", - "EPRX20CHNCNTR", - "EPRX3CONTROL", - "EPRX30CHNCNTR", - "EPRX4CONTROL", - "EPRX40CHNCNTR", - "EPRX5CONTROL", - "EPRX50CHNCNTR", - "EPCLK5CHNCNTRH", - "EPCLK5CHNCNTRL", - "POWERUP2" - ], - - "lpgbt": - { - "ADCCAL0": - { - "ADCCALGAIN2SEHIGH": [0, 0, 0, 0] - }, - "ADCCAL1": - { - "ADCCALGAIN2SELOW": [0, 0, 0, 0] - }, - "ADCCAL10": - { - "ADCCALGAIN8DIFLOW": [0, 0, 0, 0] - }, - "ADCCAL11": - { - "ADCCALGAIN8DIFHIGH": [0, 0, 0, 0], - "ADCCALGAIN8DIRFLOW": [0, 0, 0, 0] - }, - "ADCCAL12": - { - "ADCCALGAIN16DIFHIGH": [0, 0, 0, 0] - }, - "ADCCAL13": - { - "ADCCALGAIN16DIFLOW": [0, 0, 0, 0] - }, - "ADCCAL14": - { - "ADCCALGAIN16DIFHIGH": [0, 0, 0, 0], - "ADCCALGAIN16DIRFLOW": [0, 0, 0, 0] - }, - "ADCCAL2": - { - "ADCCALGAIN2SEHIGH": [0, 0, 0, 0], - "ADCCALGAIN2SELOW": [0, 0, 0, 0] - }, - "ADCCAL3": - { - "ADCCALGAIN2DIFHIGH": [0, 0, 0, 0] - }, - "ADCCAL4": - { - "ADCCALGAIN2DIFLOW": [0, 0, 0, 0] - }, - "ADCCAL5": - { - "ADCCALGAIN2DIFHIGH": [0, 0, 0, 0], - "ADCCALGAIN2DIRFLOW": [0, 0, 0, 0] - }, - "ADCCAL6": - { - "ADCCALGAIN4DIFHIGH": [0, 0, 0, 0] - }, - "ADCCAL7": - { - "ADCCALGAIN4DIFLOW": [0, 0, 0, 0] - }, - "ADCCAL8": - { - "ADCCALGAIN4DIFHIGH": [0, 0, 0, 0], - "ADCCALGAIN4DIRFLOW": [0, 0, 0, 0] - }, - "ADCCAL9": - { - "ADCCALGAIN8DIFHIGH": [0, 0, 0, 0] - }, - "ADCCONFIG": - { - "ADCCONVERT": [0, 0, 0, 0], - "ADCENABLE": [0, 0, 0, 0], - "ADCGAINSELECT": [0, 0, 0, 0] - }, - "ADCMON": - { - "TEMPSENSRESET": [0, 0, 0, 0], - "VDDANMONENA": [0, 0, 0, 0], - "VDDMONENA": [0, 0, 0, 0], - "VDDRXMONENA": [0, 0, 0, 0], - "VDDTXMONENA": [0, 0, 0, 0] - }, - "ADCSELECT": - { - "ADCINNSELECT": [0, 0, 0, 0], - "ADCINPSELECT": [0, 0, 0, 0] - }, - "BERTCONFIG": - { - "BERTMEASTIME": [0, 0, 0, 0], - "BERTSTART": [0, 0, 0, 0], - "SKIPDISABLE": [0, 0, 0, 0] - }, - "BERTDATAPATTERN0": - { - "BERTDATAPATTERN": [0, 0, 0, 0] - }, - "BERTDATAPATTERN1": - { - "BERTDATAPATTERN": [0, 0, 0, 0] - }, - "BERTDATAPATTERN2": - { - "BERTDATAPATTERN": [0, 0, 0, 0] - }, - "BERTDATAPATTERN3": - { - "BERTDATAPATTERN": [0, 0, 0, 0] - }, - "BERTSOURCE": - { - "BERTSOURCE": [0, 0, 0, 0] - }, - "CHIPCONFIG": - { - "CHIPADDRESSBAR": [0, 0, 0, 0], - "HIGHSPEEDDATAININVERT": [0, 0, 0, 0], - "HIGHSPEEDDATAOUTINVERT": [0, 0, 0, 0] - }, - "CHIPID0": - { - "CHIPID": [0, 0, 0, 0] - }, - "CHIPID1": - { - "CHIPID": [0, 0, 0, 0] - }, - "CHIPID2": - { - "CHIPID": [0, 0, 0, 0] - }, - "CHIPID3": - { - "CHIPID": [0, 0, 0, 0] - }, - "CLKGCDRFFPROPCUR": - { - "CLKGCDRFEEDFORWARDPROPCUR": [6, 6, 6, 6], - "CLKGCDRFEEDFORWARDPROPCURWHENLOCKED": [6, 6, 6, 6] - }, - "CLKGCDRINTCUR": - { - "CLKGCDRINTCUR": [5, 5, 5, 5], - "CLKGCDRINTCURWHENLOCKED": [5, 5, 5, 5] - }, - "CLKGCDRPROPCUR": - { - "CLKGCDRPROPCUR": [5, 5, 5, 5], - "CLKGCDRPROPCURWHENLOCKED": [5, 5, 5, 5] - }, - "CLKGCNTOVERRIDE": - { - "CDRCOCONNECTPLL": [0, 0, 0, 0], - "CDRCODISDATACOUNTERREF": [0, 0, 0, 0], - "CDRCODISDESVBIASGEN": [0, 0, 0, 0], - "CDRCOENABLECDR": [0, 0, 0, 0], - "CDRCOENABLEFD": [0, 0, 0, 0], - "CDRCOENABLEPLL": [0, 0, 0, 0], - "CDRCOREFCLKSEL": [0, 0, 0, 0], - "CLKGCOOVERRIDEVC": [0, 0, 0, 0] - }, - "CLKGCONFIG0": - { - "CLKGBIASGENCONFIG": [8, 0, 0, 0], - "CLKGCALIBRATIONENDOFCOUNT": [14, 0, 0, 0] - }, - "CLKGCONFIG1": - { - "CDRCONTROLOVERRIDEENABLE": [0, 0, 0, 0], - "CLKGCDRRES": [1, 1, 1, 1], - "CLKGDISABLEFRAMEALIGNERLOCKCONTROL": [0, 0, 0, 0], - "CLKGVCODAC": [8, 8, 8, 8], - "CLKGVCORAILMODE": [1, 1, 1, 1] - }, - "CLKGFFCAP": - { - "CDRCOCONNECTCDR": [0, 0, 0, 0], - "CLKGCAPBANKOVERRIDEENABLE": [0, 0, 0, 0], - "CLKGFEEDFORWARDCAP": [3, 3, 3, 3], - "CLKGFEEDFORWARDCAPWHENLOCKED": [3, 3, 3, 3] - }, - "CLKGFLLINTCUR": - { - "CLKGFLLINTCUR": [5, 5, 5, 5], - "CLKGFLLINTCURWHENLOCKED": [5, 5, 5, 5] - }, - "CLKGLFCONFIG0": - { - "CLKGCAPBANKSELECT": [0, 0, 0, 0], - "CLKGLOCKFILTERCLKALWAYSON": [0, 0, 0, 0], - "CLKGLOCKFILTERENABLE": [1, 1, 1, 1], - "CLKGLOCKFILTERLOCKTHRCOUNTER": [15, 15, 15, 15] - }, - "CLKGLFCONFIG1": - { - "CLKGLOCKFILTERRELOCKTHRCOUNTER": [15, 15, 15, 15], - "CLKGLOCKFILTERUNLOCKTHRCOUNTER": [15, 15, 15, 15] - }, - "CLKGOVERRIDECAPBANK": - { - "CLKGCAPBANKSELECT": [0, 0, 0, 0] - }, - "CLKGPLLINTCUR": - { - "CLKGPLLINTCUR": [9, 9, 9, 9], - "CLKGPLLINTCURWHENLOCKED": [9, 9, 9, 9] - }, - "CLKGPLLPROPCUR": - { - "CLKGPLLPROPCUR": [9, 9, 9, 9], - "CLKGPLLPROPCURWHENLOCKED": [9, 9, 9, 9] - }, - "CLKGPLLRES": - { - "CLKGPLLRES": [2, 2, 2, 2], - "CLKGPLLRESWHENLOCKED": [2, 2, 2, 2] - }, - "CLKGWAITTIME": - { - "CLKGWAITCDRTIME": [8, 8, 8, 8], - "CLKGWAITPLLTIME": [8, 8, 8, 8] - }, - "CLKTREE": - { - "CLKTREEADISABLE": [0, 0, 0, 0], - "CLKTREEBDISABLE": [0, 0, 0, 0], - "CLKTREECDISABLE": [0, 0, 0, 0], - "CLKTREEMAGICNUMBER": [0, 0, 0, 0] - }, - "CRC0": - { - "CRC32": [0, 0, 0, 0] - }, - "CRC1": - { - "CRC32": [0, 0, 0, 0] - }, - "CRC2": - { - "CRC32": [0, 0, 0, 0] - }, - "CRC3": - { - "CRC32": [0, 0, 0, 0] - }, - "CURDACCALH": - { - "CURDACCAL": [0, 0, 0, 0] - }, - "CURDACCALL": - { - "CURDACCAL": [0, 0, 0, 0] - }, - "CURDACCHN": - { - "CURDACCHNENABLE": [0, 0, 0, 0] - }, - "CURDACVALUE": - { - "CURDACSELECT": [0, 0, 0, 0] - }, - "DACCAL0": - { - "DACCALMINCODE": [0, 0, 0, 0] - }, - "DACCAL1": - { - "DACCALMAXCODE": [0, 0, 0, 0] - }, - "DACCAL2": - { - "DACCALMAXCODE": [0, 0, 0, 0], - "DACCALMINCODE": [0, 0, 0, 0] - }, - "DACCONFIGH": - { - "CURDACENABLE": [0, 0, 0, 0], - "VOLDACENABLE": [0, 0, 0, 0], - "VOLDACVALUE": [0, 0, 0, 0] - }, - "DACCONFIGL": - { - "VOLDACVALUE": [0, 0, 0, 0] - }, - "DATAPATH": - { - "DLDPBYPASDEINTERLEVEAR": [0, 0, 0, 0], - "DLDPBYPASFECDECODER": [0, 0, 0, 0], - "DLDPBYPASSDESCRAMBLER": [0, 0, 0, 0], - "DLDPFECCOUNTERENABLE": [0, 0, 0, 0], - "ULDPBYPASSFECCODER": [0, 0, 0, 0], - "ULDPBYPASSINTERLEAVER": [0, 0, 0, 0], - "ULDPBYPASSSCRAMBLER": [0, 0, 0, 0] - }, - "DPDATAPATTERN0": - { - "DPDATAPATTERN": [0, 0, 0, 0] - }, - "DPDATAPATTERN1": - { - "DPDATAPATTERN": [0, 0, 0, 0] - }, - "DPDATAPATTERN2": - { - "DPDATAPATTERN": [0, 0, 0, 0] - }, - "DPDATAPATTERN3": - { - "DPDATAPATTERN": [0, 0, 0, 0] - }, - "EOMCONFIGH": - { - "EOMBYPASSPHASEINTERPOLATOR": [0, 0, 0, 0], - "EOMENABLE": [0, 0, 0, 0], - "EOMENDOFCOUNTSEL": [0, 0, 0, 0], - "EOMSTART": [0, 0, 0, 0] - }, - "EOMCONFIGL": - { - "EOMPHASESEL": [0, 0, 0, 0] - }, - "EOMVOFSEL": - { - "EOMVOFSEL": [0, 0, 0, 0] - }, - "EPCLK0CHNCNTRH": - { - "EPCLK0DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK0FREQ": [0, 0, 0, 0], - "EPCLK0INVERT": [0, 0, 0, 0], - "EPCLK0LOWRES": [0, 0, 0, 0] - }, - "EPCLK0CHNCNTRL": - { - "EPCLK0PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK0PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK0PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK10CHNCNTRH": - { - "EPCLK10DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK10FREQ": [0, 0, 0, 0], - "EPCLK10INVERT": [0, 0, 0, 0], - "EPCLK10LOWRES": [0, 0, 0, 0] - }, - "EPCLK10CHNCNTRL": - { - "EPCLK10PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK10PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK10PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK11CHNCNTRH": - { - "EPCLK11DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK11FREQ": [0, 0, 0, 0], - "EPCLK11INVERT": [0, 0, 0, 0], - "EPCLK11LOWRES": [0, 0, 0, 0] - }, - "EPCLK11CHNCNTRL": - { - "EPCLK11PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK11PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK11PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK12CHNCNTRH": - { - "EPCLK12DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK12FREQ": [0, 0, 0, 0], - "EPCLK12INVERT": [0, 0, 0, 0], - "EPCLK12LOWRES": [0, 0, 0, 0] - }, - "EPCLK12CHNCNTRL": - { - "EPCLK12PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK12PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK12PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK13CHNCNTRH": - { - "EPCLK13DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK13FREQ": [0, 0, 0, 0], - "EPCLK13INVERT": [0, 0, 0, 0], - "EPCLK13LOWRES": [0, 0, 0, 0] - }, - "EPCLK13CHNCNTRL": - { - "EPCLK13PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK13PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK13PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK14CHNCNTRH": - { - "EPCLK14DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK14FREQ": [0, 0, 0, 0], - "EPCLK14INVERT": [0, 0, 0, 0], - "EPCLK14LOWRES": [0, 0, 0, 0] - }, - "EPCLK14CHNCNTRL": - { - "EPCLK14PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK14PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK14PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK15CHNCNTRH": - { - "EPCLK15DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK15FREQ": [0, 0, 0, 0], - "EPCLK15INVERT": [0, 0, 0, 0], - "EPCLK15LOWRES": [0, 0, 0, 0] - }, - "EPCLK15CHNCNTRL": - { - "EPCLK15PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK15PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK15PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK16CHNCNTRH": - { - "EPCLK16DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK16FREQ": [0, 0, 0, 0], - "EPCLK16INVERT": [0, 0, 0, 0], - "EPCLK16LOWRES": [0, 0, 0, 0] - }, - "EPCLK16CHNCNTRL": - { - "EPCLK16PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK16PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK16PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK17CHNCNTRH": - { - "EPCLK17DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK17FREQ": [0, 0, 0, 0], - "EPCLK17INVERT": [0, 0, 0, 0], - "EPCLK17LOWRES": [0, 0, 0, 0] - }, - "EPCLK17CHNCNTRL": - { - "EPCLK17PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK17PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK17PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK18CHNCNTRH": - { - "EPCLK18DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK18FREQ": [0, 0, 0, 0], - "EPCLK18INVERT": [0, 0, 0, 0], - "EPCLK18LOWRES": [0, 0, 0, 0] - }, - "EPCLK18CHNCNTRL": - { - "EPCLK18PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK18PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK18PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK19CHNCNTRH": - { - "EPCLK19DRIVESTRENGTH": [3, 0, 0, 0], - "EPCLK19FREQ": [1, 0, 0, 0], - "EPCLK19INVERT": [0, 0, 0, 0], - "EPCLK19LOWRES": [0, 0, 0, 0] - }, - "EPCLK19CHNCNTRL": - { - "EPCLK19PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK19PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK19PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK1CHNCNTRH": - { - "EPCLK1DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK1FREQ": [0, 0, 0, 0], - "EPCLK1INVERT": [0, 0, 0, 0], - "EPCLK1LOWRES": [0, 0, 0, 0] - }, - "EPCLK1CHNCNTRL": - { - "EPCLK1PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK1PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK1PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK20CHNCNTRH": - { - "EPCLK20DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK20FREQ": [0, 0, 0, 0], - "EPCLK20INVERT": [0, 0, 0, 0], - "EPCLK20LOWRES": [0, 0, 0, 0] - }, - "EPCLK20CHNCNTRL": - { - "EPCLK20PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK20PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK20PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK21CHNCNTRH": - { - "EPCLK21DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK21FREQ": [0, 0, 0, 0], - "EPCLK21INVERT": [0, 0, 0, 0], - "EPCLK21LOWRES": [0, 0, 0, 0] - }, - "EPCLK21CHNCNTRL": - { - "EPCLK21PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK21PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK21PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK22CHNCNTRH": - { - "EPCLK22DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK22FREQ": [0, 0, 0, 0], - "EPCLK22INVERT": [0, 0, 0, 0], - "EPCLK22LOWRES": [0, 0, 0, 0] - }, - "EPCLK22CHNCNTRL": - { - "EPCLK22PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK22PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK22PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK23CHNCNTRH": - { - "EPCLK23DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK23FREQ": [0, 0, 0, 0], - "EPCLK23INVERT": [0, 0, 0, 0], - "EPCLK23LOWRES": [0, 0, 0, 0] - }, - "EPCLK23CHNCNTRL": - { - "EPCLK23PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK23PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK23PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK24CHNCNTRH": - { - "EPCLK24DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK24FREQ": [0, 0, 0, 0], - "EPCLK24INVERT": [0, 0, 0, 0], - "EPCLK24LOWRES": [0, 0, 0, 0] - }, - "EPCLK24CHNCNTRL": - { - "EPCLK24PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK24PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK24PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK25CHNCNTRH": - { - "EPCLK25DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK25FREQ": [0, 0, 0, 0], - "EPCLK25INVERT": [0, 0, 0, 0], - "EPCLK25LOWRES": [0, 0, 0, 0] - }, - "EPCLK25CHNCNTRL": - { - "EPCLK25PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK25PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK25PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK26CHNCNTRH": - { - "EPCLK26DRIVESTRENGTH": [3, 0, 0, 0], - "EPCLK26FREQ": [1, 0, 0, 0], - "EPCLK26INVERT": [1, 0, 0, 0], - "EPCLK26LOWRES": [0, 0, 0, 0] - }, - "EPCLK26CHNCNTRL": - { - "EPCLK26PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK26PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK26PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK27CHNCNTRH": - { - "EPCLK27DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK27FREQ": [0, 0, 0, 0], - "EPCLK27INVERT": [0, 0, 0, 0], - "EPCLK27LOWRES": [0, 0, 0, 0] - }, - "EPCLK27CHNCNTRL": - { - "EPCLK27PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK27PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK27PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK28CHNCNTRH": - { - "EPCLK28DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK28FREQ": [0, 0, 0, 0], - "EPCLK28INVERT": [0, 0, 0, 0], - "EPCLK28LOWRES": [0, 0, 0, 0] - }, - "EPCLK28CHNCNTRL": - { - "EPCLK28PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK28PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK28PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK2CHNCNTRH": - { - "EPCLK2DRIVESTRENGTH": [3, 0, 0, 0], - "EPCLK2FREQ": [1, 0, 0, 0], - "EPCLK2INVERT": [1, 0, 0, 0], - "EPCLK2LOWRES": [0, 0, 0, 0] - }, - "EPCLK2CHNCNTRL": - { - "EPCLK2PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK2PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK2PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK3CHNCNTRH": - { - "EPCLK3DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK3FREQ": [0, 0, 0, 0], - "EPCLK3INVERT": [0, 0, 0, 0], - "EPCLK3LOWRES": [0, 0, 0, 0] - }, - "EPCLK3CHNCNTRL": - { - "EPCLK3PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK3PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK3PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK4CHNCNTRH": - { - "EPCLK4DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK4FREQ": [0, 0, 0, 0], - "EPCLK4INVERT": [0, 0, 0, 0], - "EPCLK4LOWRES": [0, 0, 0, 0] - }, - "EPCLK4CHNCNTRL": - { - "EPCLK4PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK4PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK4PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK5CHNCNTRH": - { - "EPCLK5DRIVESTRENGTH": [7, 7, 7, 7], - "EPCLK5FREQ": [6, 6, 6, 6], - "EPCLK5INVERT": [0, 0, 0, 0], - "EPCLK5LOWRES": [0, 0, 0, 0] - }, - "EPCLK5CHNCNTRL": - { - "EPCLK5PREEMPHASISMODE": [3, 3, 3, 3], - "EPCLK5PREEMPHASISSTRENGTH": [3, 3, 3, 3], - "EPCLK5PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK6CHNCNTRH": - { - "EPCLK6DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK6FREQ": [0, 0, 0, 0], - "EPCLK6INVERT": [0, 0, 0, 0], - "EPCLK6LOWRES": [0, 0, 0, 0] - }, - "EPCLK6CHNCNTRL": - { - "EPCLK6PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK6PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK6PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK7CHNCNTRH": - { - "EPCLK7DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK7FREQ": [0, 0, 0, 0], - "EPCLK7INVERT": [0, 0, 0, 0], - "EPCLK7LOWRES": [0, 0, 0, 0] - }, - "EPCLK7CHNCNTRL": - { - "EPCLK7PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK7PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK7PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK8CHNCNTRH": - { - "EPCLK8DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK8FREQ": [0, 0, 0, 0], - "EPCLK8INVERT": [0, 0, 0, 0], - "EPCLK8LOWRES": [0, 0, 0, 0] - }, - "EPCLK8CHNCNTRL": - { - "EPCLK8PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK8PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK8PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPCLK9CHNCNTRH": - { - "EPCLK9DRIVESTRENGTH": [0, 0, 0, 0], - "EPCLK9FREQ": [0, 0, 0, 0], - "EPCLK9INVERT": [0, 0, 0, 0], - "EPCLK9LOWRES": [0, 0, 0, 0] - }, - "EPCLK9CHNCNTRL": - { - "EPCLK9PREEMPHASISMODE": [0, 0, 0, 0], - "EPCLK9PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPCLK9PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPRX00CHNCNTR": - { - "EPRX00ACBIAS": [0, 0, 0, 0], - "EPRX00EQ": [0, 0, 0, 0], - "EPRX00INVERT": [1, 1, 1, 1], - "EPRX00PHASESELECT": [0, 0, 0, 0], - "EPRX00TERM": [1, 1, 1, 1] - }, - "EPRX01CHNCNTR": - { - "EPRX01ACBIAS": [0, 0, 0, 0], - "EPRX01EQ": [0, 0, 0, 0], - "EPRX01INVERT": [0, 0, 0, 0], - "EPRX01PHASESELECT": [0, 0, 0, 0], - "EPRX01TERM": [0, 0, 0, 0] - }, - "EPRX02CHNCNTR": - { - "EPRX02ACBIAS": [0, 0, 0, 0], - "EPRX02EQ": [0, 0, 0, 0], - "EPRX02INVERT": [0, 0, 0, 0], - "EPRX02PHASESELECT": [0, 0, 0, 0], - "EPRX02TERM": [0, 0, 0, 0] - }, - "EPRX03CHNCNTR": - { - "EPRX03ACBIAS": [0, 0, 0, 0], - "EPRX03EQ": [0, 0, 0, 0], - "EPRX03INVERT": [0, 0, 0, 0], - "EPRX03PHASESELECT": [0, 0, 0, 0], - "EPRX03TERM": [0, 0, 0, 0] - }, - "EPRX0CONTROL": - { - "EPRX00ENABLE": [1, 1, 1, 1], - "EPRX01ENABLE": [0, 0, 0, 0], - "EPRX02ENABLE": [0, 0, 0, 0], - "EPRX03ENABLE": [0, 0, 0, 0], - "EPRX0DATARATE": [3, 3, 3, 3], - "EPRX0TRACKMODE": [3, 3, 3, 3] - }, - "EPRX10CHNCNTR": - { - "EPRX10ACBIAS": [0, 0, 0, 0], - "EPRX10EQ": [0, 0, 0, 0], - "EPRX10INVERT": [1, 1, 1, 1], - "EPRX10PHASESELECT": [0, 0, 0, 0], - "EPRX10TERM": [1, 1, 1, 1] - }, - "EPRX11CHNCNTR": - { - "EPRX11ACBIAS": [0, 0, 0, 0], - "EPRX11EQ": [0, 0, 0, 0], - "EPRX11INVERT": [0, 0, 0, 0], - "EPRX11PHASESELECT": [0, 0, 0, 0], - "EPRX11TERM": [0, 0, 0, 0] - }, - "EPRX12CHNCNTR": - { - "EPRX12ACBIAS": [0, 0, 0, 0], - "EPRX12EQ": [0, 0, 0, 0], - "EPRX12INVERT": [0, 0, 0, 0], - "EPRX12PHASESELECT": [0, 0, 0, 0], - "EPRX12TERM": [0, 0, 0, 0] - }, - "EPRX13CHNCNTR": - { - "EPRX13ACBIAS": [0, 0, 0, 0], - "EPRX13EQ": [0, 0, 0, 0], - "EPRX13INVERT": [0, 0, 0, 0], - "EPRX13PHASESELECT": [0, 0, 0, 0], - "EPRX13TERM": [0, 0, 0, 0] - }, - "EPRX1CONTROL": - { - "EPRX10ENABLE": [1, 1, 1, 1], - "EPRX11ENABLE": [0, 0, 0, 0], - "EPRX12ENABLE": [0, 0, 0, 0], - "EPRX13ENABLE": [0, 0, 0, 0], - "EPRX1DATARATE": [3, 3, 3, 3], - "EPRX1TRACKMODE": [3, 3, 3, 3] - }, - "EPRX20CHNCNTR": - { - "EPRX20ACBIAS": [0, 0, 0, 0], - "EPRX20EQ": [0, 0, 0, 0], - "EPRX20INVERT": [1, 1, 1, 1], - "EPRX20PHASESELECT": [0, 0, 0, 0], - "EPRX20TERM": [1, 1, 1, 1] - }, - "EPRX21CHNCNTR": - { - "EPRX21ACBIAS": [0, 0, 0, 0], - "EPRX21EQ": [0, 0, 0, 0], - "EPRX21INVERT": [0, 0, 0, 0], - "EPRX21PHASESELECT": [0, 0, 0, 0], - "EPRX21TERM": [0, 0, 0, 0] - }, - "EPRX22CHNCNTR": - { - "EPRX22ACBIAS": [0, 0, 0, 0], - "EPRX22EQ": [0, 0, 0, 0], - "EPRX22INVERT": [0, 0, 0, 0], - "EPRX22PHASESELECT": [0, 0, 0, 0], - "EPRX22TERM": [0, 0, 0, 0] - }, - "EPRX23CHNCNTR": - { - "EPRX23ACBIAS": [0, 0, 0, 0], - "EPRX23EQ": [0, 0, 0, 0], - "EPRX23INVERT": [0, 0, 0, 0], - "EPRX23PHASESELECT": [0, 0, 0, 0], - "EPRX23TERM": [0, 0, 0, 0] - }, - "EPRX2CONTROL": - { - "EPRX20ENABLE": [1, 1, 1, 1], - "EPRX21ENABLE": [0, 0, 0, 0], - "EPRX22ENABLE": [0, 0, 0, 0], - "EPRX23ENABLE": [0, 0, 0, 0], - "EPRX2DATARATE": [3, 3, 3, 3], - "EPRX2TRACKMODE": [3, 3, 3, 3] - }, - "EPRX30CHNCNTR": - { - "EPRX30ACBIAS": [0, 0, 0, 0], - "EPRX30EQ": [0, 0, 0, 0], - "EPRX30INVERT": [1, 1, 1, 1], - "EPRX30PHASESELECT": [0, 0, 0, 0], - "EPRX30TERM": [1, 1, 1, 1] - }, - "EPRX31CHNCNTR": - { - "EPRX31ACBIAS": [0, 0, 0, 0], - "EPRX31EQ": [0, 0, 0, 0], - "EPRX31INVERT": [0, 0, 0, 0], - "EPRX31PHASESELECT": [0, 0, 0, 0], - "EPRX31TERM": [0, 0, 0, 0] - }, - "EPRX32CHNCNTR": - { - "EPRX32ACBIAS": [0, 0, 0, 0], - "EPRX32EQ": [0, 0, 0, 0], - "EPRX32INVERT": [0, 0, 0, 0], - "EPRX32PHASESELECT": [0, 0, 0, 0], - "EPRX32TERM": [0, 0, 0, 0] - }, - "EPRX33CHNCNTR": - { - "EPRX33ACBIAS": [0, 0, 0, 0], - "EPRX33EQ": [0, 0, 0, 0], - "EPRX33INVERT": [0, 0, 0, 0], - "EPRX33PHASESELECT": [0, 0, 0, 0], - "EPRX33TERM": [0, 0, 0, 0] - }, - "EPRX3CONTROL": - { - "EPRX30ENABLE": [1, 1, 1, 1], - "EPRX31ENABLE": [0, 0, 0, 0], - "EPRX32ENABLE": [0, 0, 0, 0], - "EPRX33ENABLE": [0, 0, 0, 0], - "EPRX3DATARATE": [3, 3, 3, 3], - "EPRX3TRACKMODE": [3, 3, 3, 3] - }, - "EPRX40CHNCNTR": - { - "EPRX40ACBIAS": [0, 0, 0, 0], - "EPRX40EQ": [0, 0, 0, 0], - "EPRX40INVERT": [0, 0, 0, 0], - "EPRX40PHASESELECT": [0, 0, 0, 0], - "EPRX40TERM": [1, 1, 1, 1] - }, - "EPRX41CHNCNTR": - { - "EPRX41ACBIAS": [0, 0, 0, 0], - "EPRX41EQ": [0, 0, 0, 0], - "EPRX41INVERT": [0, 0, 0, 0], - "EPRX41PHASESELECT": [0, 0, 0, 0], - "EPRX41TERM": [0, 0, 0, 0] - }, - "EPRX42CHNCNTR": - { - "EPRX42ACBIAS": [0, 0, 0, 0], - "EPRX42EQ": [0, 0, 0, 0], - "EPRX42INVERT": [0, 0, 0, 0], - "EPRX42PHASESELECT": [0, 0, 0, 0], - "EPRX42TERM": [0, 0, 0, 0] - }, - "EPRX43CHNCNTR": - { - "EPRX43ACBIAS": [0, 0, 0, 0], - "EPRX43EQ": [0, 0, 0, 0], - "EPRX43INVERT": [0, 0, 0, 0], - "EPRX43PHASESELECT": [0, 0, 0, 0], - "EPRX43TERM": [0, 0, 0, 0] - }, - "EPRX4CONTROL": - { - "EPRX40ENABLE": [1, 1, 1, 1], - "EPRX41ENABLE": [0, 0, 0, 0], - "EPRX42ENABLE": [0, 0, 0, 0], - "EPRX43ENABLE": [0, 0, 0, 0], - "EPRX4DATARATE": [3, 3, 3, 3], - "EPRX4TRACKMODE": [3, 3, 3, 3] - }, - "EPRX50CHNCNTR": - { - "EPRX50ACBIAS": [0, 0, 0, 0], - "EPRX50EQ": [0, 0, 0, 0], - "EPRX50INVERT": [0, 0, 0, 0], - "EPRX50PHASESELECT": [0, 0, 0, 0], - "EPRX50TERM": [1, 1, 1, 1] - }, - "EPRX51CHNCNTR": - { - "EPRX51ACBIAS": [0, 0, 0, 0], - "EPRX51EQ": [0, 0, 0, 0], - "EPRX51INVERT": [0, 0, 0, 0], - "EPRX51PHASESELECT": [0, 0, 0, 0], - "EPRX51TERM": [0, 0, 0, 0] - }, - "EPRX52CHNCNTR": - { - "EPRX52ACBIAS": [0, 0, 0, 0], - "EPRX52EQ": [0, 0, 0, 0], - "EPRX52INVERT": [0, 0, 0, 0], - "EPRX52PHASESELECT": [0, 0, 0, 0], - "EPRX52TERM": [0, 0, 0, 0] - }, - "EPRX53CHNCNTR": - { - "EPRX53ACBIAS": [0, 0, 0, 0], - "EPRX53EQ": [0, 0, 0, 0], - "EPRX53INVERT": [0, 0, 0, 0], - "EPRX53PHASESELECT": [0, 0, 0, 0], - "EPRX53TERM": [0, 0, 0, 0] - }, - "EPRX5CONTROL": - { - "EPRX50ENABLE": [1, 1, 1, 1], - "EPRX51ENABLE": [0, 0, 0, 0], - "EPRX52ENABLE": [0, 0, 0, 0], - "EPRX53ENABLE": [0, 0, 0, 0], - "EPRX5DATARATE": [3, 3, 3, 3], - "EPRX5TRACKMODE": [3, 3, 3, 3] - }, - "EPRX60CHNCNTR": - { - "EPRX60ACBIAS": [0, 0, 0, 0], - "EPRX60EQ": [0, 0, 0, 0], - "EPRX60INVERT": [0, 0, 0, 0], - "EPRX60PHASESELECT": [0, 0, 0, 0], - "EPRX60TERM": [0, 0, 0, 0] - }, - "EPRX61CHNCNTR": - { - "EPRX61ACBIAS": [0, 0, 0, 0], - "EPRX61EQ": [0, 0, 0, 0], - "EPRX61INVERT": [0, 0, 0, 0], - "EPRX61PHASESELECT": [0, 0, 0, 0], - "EPRX61TERM": [0, 0, 0, 0] - }, - "EPRX62CHNCNTR": - { - "EPRX62ACBIAS": [0, 0, 0, 0], - "EPRX62EQ": [0, 0, 0, 0], - "EPRX62INVERT": [0, 0, 0, 0], - "EPRX62PHASESELECT": [0, 0, 0, 0], - "EPRX62TERM": [0, 0, 0, 0] - }, - "EPRX63CHNCNTR": - { - "EPRX63ACBIAS": [0, 0, 0, 0], - "EPRX63EQ": [0, 0, 0, 0], - "EPRX63INVERT": [0, 0, 0, 0], - "EPRX63PHASESELECT": [0, 0, 0, 0], - "EPRX63TERM": [0, 0, 0, 0] - }, - "EPRX6CONTROL": - { - "EPRX60ENABLE": [0, 0, 0, 0], - "EPRX61ENABLE": [0, 0, 0, 0], - "EPRX62ENABLE": [0, 0, 0, 0], - "EPRX63ENABLE": [0, 0, 0, 0], - "EPRX6DATARATE": [0, 0, 0, 0], - "EPRX6TRACKMODE": [0, 0, 0, 0] - }, - "EPRXDLLCONFIG": - { - "EPRXDATAGATINGDISABLE": [0, 0, 0, 0], - "EPRXDLLCOARSELOCKDETECTION": [1, 1, 1, 1], - "EPRXDLLCONFIRMCOUNT": [2, 2, 2, 2], - "EPRXDLLCURRENT": [1, 1, 1, 1], - "EPRXDLLFSMCLKALWAYSON": [0, 0, 0, 0], - "EPRXENABLEREINIT": [0, 0, 0, 0] - }, - "EPRXECCHNCNTR": - { - "EPRXECACBIAS": [0, 0, 0, 0], - "EPRXECINVERT": [0, 0, 0, 0], - "EPRXECPHASESELECT": [0, 0, 0, 0], - "EPRXECPULLUPENABLE": [0, 0, 0, 0], - "EPRXECTERM": [0, 0, 0, 0] - }, - "EPRXECCONTROL": - { - "EPRXECAUTOPHASERESETDISABLE": [0, 0, 0, 0], - "EPRXECENABLE": [0, 0, 0, 0], - "EPRXECTRACKMODE": [0, 0, 0, 0] - }, - "EPRXEQ10CONTROL": - { - "EPRX00EQ": [0, 0, 0, 0], - "EPRX01EQ": [0, 0, 0, 0], - "EPRX02EQ": [0, 0, 0, 0], - "EPRX03EQ": [0, 0, 0, 0], - "EPRX10EQ": [0, 0, 0, 0], - "EPRX11EQ": [0, 0, 0, 0], - "EPRX12EQ": [0, 0, 0, 0], - "EPRX13EQ": [0, 0, 0, 0] - }, - "EPRXEQ32CONTROL": - { - "EPRX20EQ": [0, 0, 0, 0], - "EPRX21EQ": [0, 0, 0, 0], - "EPRX22EQ": [0, 0, 0, 0], - "EPRX23EQ": [0, 0, 0, 0], - "EPRX30EQ": [0, 0, 0, 0], - "EPRX31EQ": [0, 0, 0, 0], - "EPRX32EQ": [0, 0, 0, 0], - "EPRX33EQ": [0, 0, 0, 0] - }, - "EPRXEQ54CONTROL": - { - "EPRX40EQ": [0, 0, 0, 0], - "EPRX41EQ": [0, 0, 0, 0], - "EPRX42EQ": [0, 0, 0, 0], - "EPRX43EQ": [0, 0, 0, 0], - "EPRX50EQ": [0, 0, 0, 0], - "EPRX51EQ": [0, 0, 0, 0], - "EPRX52EQ": [0, 0, 0, 0], - "EPRX53EQ": [0, 0, 0, 0] - }, - "EPRXEQ6CONTROL": - { - "EPRX60EQ": [0, 0, 0, 0], - "EPRX61EQ": [0, 0, 0, 0], - "EPRX62EQ": [0, 0, 0, 0], - "EPRX63EQ": [0, 0, 0, 0] - }, - "EPRXLOCKFILTER": - { - "EPRXLOCKTHRESHOLD": [5, 5, 5, 5], - "EPRXRELOCKTHRESHOLD": [5, 5, 5, 5] - }, - "EPRXLOCKFILTER2": - { - "EPRXUNLOCKTHRESHOLD": [5, 5, 5, 5] - }, - "EPRXPRBS0": - { - "EPRX00PRBSENABLE": [0, 0, 0, 0], - "EPRX01PRBSENABLE": [0, 0, 0, 0], - "EPRX02PRBSENABLE": [0, 0, 0, 0], - "EPRX03PRBSENABLE": [0, 0, 0, 0], - "EPRX10PRBSENABLE": [0, 0, 0, 0], - "EPRX11PRBSENABLE": [0, 0, 0, 0], - "EPRX12PRBSENABLE": [0, 0, 0, 0], - "EPRX13PRBSENABLE": [0, 0, 0, 0] - }, - "EPRXPRBS1": - { - "EPRX20PRBSENABLE": [0, 0, 0, 0], - "EPRX21PRBSENABLE": [0, 0, 0, 0], - "EPRX22PRBSENABLE": [0, 0, 0, 0], - "EPRX23PRBSENABLE": [0, 0, 0, 0], - "EPRX30PRBSENABLE": [0, 0, 0, 0], - "EPRX31PRBSENABLE": [0, 0, 0, 0], - "EPRX32PRBSENABLE": [0, 0, 0, 0], - "EPRX33PRBSENABLE": [0, 0, 0, 0] - }, - "EPRXPRBS2": - { - "EPRX40PRBSENABLE": [0, 0, 0, 0], - "EPRX41PRBSENABLE": [0, 0, 0, 0], - "EPRX42PRBSENABLE": [0, 0, 0, 0], - "EPRX43PRBSENABLE": [0, 0, 0, 0], - "EPRX50PRBSENABLE": [0, 0, 0, 0], - "EPRX51PRBSENABLE": [0, 0, 0, 0], - "EPRX52PRBSENABLE": [0, 0, 0, 0], - "EPRX53PRBSENABLE": [0, 0, 0, 0] - }, - "EPRXPRBS3": - { - "EPRX60PRBSENABLE": [0, 0, 0, 0], - "EPRX61PRBSENABLE": [0, 0, 0, 0], - "EPRX62PRBSENABLE": [0, 0, 0, 0], - "EPRX63PRBSENABLE": [0, 0, 0, 0], - "EPRXECPRBSENABLE": [0, 0, 0, 0] - }, - "EPRXTRAIN10": - { - "EPRX0TRAIN": [0, 0, 0, 0], - "EPRX1TRAIN": [0, 0, 0, 0] - }, - "EPRXTRAIN32": - { - "EPRX2TRAIN": [0, 0, 0, 0], - "EPRX3TRAIN": [0, 0, 0, 0] - }, - "EPRXTRAIN54": - { - "EPRX4TRAIN": [0, 0, 0, 0], - "EPRX5TRAIN": [0, 0, 0, 0] - }, - "EPRXTRAINEC6": - { - "EPRX6TRAIN": [0, 0, 0, 0] - }, - "EPTX00CHNCNTR": - { - "EPTX00DRIVESTRENGTH": [3, 0, 0, 0], - "EPTX00PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX00PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX01CHNCNTR": - { - "EPTX01DRIVESTRENGTH": [0, 0, 0, 0], - "EPTX01PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX01PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX01_00CHNCNTR": - { - "EPTX00INVERT": [0, 0, 0, 0], - "EPTX00PREEMPHASISWIDTH": [0, 0, 0, 0], - "EPTX01INVERT": [0, 0, 0, 0], - "EPTX01PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPTX02CHNCNTR": - { - "EPTX02DRIVESTRENGTH": [3, 0, 0, 0], - "EPTX02PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX02PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX03CHNCNTR": - { - "EPTX03DRIVESTRENGTH": [0, 0, 0, 0], - "EPTX03PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX03PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX03_02CHNCNTR": - { - "EPTX02INVERT": [0, 0, 0, 0], - "EPTX02PREEMPHASISWIDTH": [0, 0, 0, 0], - "EPTX03INVERT": [0, 0, 0, 0], - "EPTX03PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPTX10CHNCNTR": - { - "EPTX10DRIVESTRENGTH": [3, 0, 0, 0], - "EPTX10PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX10PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX10ENABLE": - { - "EPTX00ENABLE": [1, 0, 0, 0], - "EPTX01ENABLE": [0, 0, 0, 0], - "EPTX02ENABLE": [1, 0, 0, 0], - "EPTX03ENABLE": [0, 0, 0, 0], - "EPTX10ENABLE": [1, 0, 0, 0], - "EPTX11ENABLE": [0, 0, 0, 0], - "EPTX12ENABLE": [1, 0, 0, 0], - "EPTX13ENABLE": [0, 0, 0, 0] - }, - "EPTX11CHNCNTR": - { - "EPTX11DRIVESTRENGTH": [0, 0, 0, 0], - "EPTX11PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX11PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX11_10CHNCNTR": - { - "EPTX10INVERT": [0, 0, 0, 0], - "EPTX10PREEMPHASISWIDTH": [0, 0, 0, 0], - "EPTX11INVERT": [0, 0, 0, 0], - "EPTX11PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPTX12CHNCNTR": - { - "EPTX12DRIVESTRENGTH": [3, 0, 0, 0], - "EPTX12PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX12PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX13CHNCNTR": - { - "EPTX13DRIVESTRENGTH": [0, 0, 0, 0], - "EPTX13PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX13PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX13_12CHNCNTR": - { - "EPTX12INVERT": [0, 0, 0, 0], - "EPTX12PREEMPHASISWIDTH": [0, 0, 0, 0], - "EPTX13INVERT": [0, 0, 0, 0], - "EPTX13PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPTX20CHNCNTR": - { - "EPTX20DRIVESTRENGTH": [3, 0, 0, 0], - "EPTX20PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX20PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX21CHNCNTR": - { - "EPTX21DRIVESTRENGTH": [0, 0, 0, 0], - "EPTX21PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX21PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX21_20CHNCNTR": - { - "EPTX20INVERT": [0, 0, 0, 0], - "EPTX20PREEMPHASISWIDTH": [0, 0, 0, 0], - "EPTX21INVERT": [0, 0, 0, 0], - "EPTX21PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPTX22CHNCNTR": - { - "EPTX22DRIVESTRENGTH": [3, 0, 0, 0], - "EPTX22PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX22PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX23CHNCNTR": - { - "EPTX23DRIVESTRENGTH": [0, 0, 0, 0], - "EPTX23PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX23PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX23_22CHNCNTR": - { - "EPTX22INVERT": [0, 0, 0, 0], - "EPTX22PREEMPHASISWIDTH": [0, 0, 0, 0], - "EPTX23INVERT": [0, 0, 0, 0], - "EPTX23PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPTX30CHNCNTR": - { - "EPTX30DRIVESTRENGTH": [3, 0, 0, 0], - "EPTX30PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX30PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX31CHNCNTR": - { - "EPTX31DRIVESTRENGTH": [0, 0, 0, 0], - "EPTX31PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX31PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX31_30CHNCNTR": - { - "EPTX30INVERT": [0, 0, 0, 0], - "EPTX30PREEMPHASISWIDTH": [0, 0, 0, 0], - "EPTX31INVERT": [0, 0, 0, 0], - "EPTX31PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPTX32CHNCNTR": - { - "EPTX32DRIVESTRENGTH": [3, 0, 0, 0], - "EPTX32PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX32PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX32ENABLE": - { - "EPTX20ENABLE": [1, 0, 0, 0], - "EPTX21ENABLE": [0, 0, 0, 0], - "EPTX22ENABLE": [1, 0, 0, 0], - "EPTX23ENABLE": [0, 0, 0, 0], - "EPTX30ENABLE": [1, 0, 0, 0], - "EPTX31ENABLE": [0, 0, 0, 0], - "EPTX32ENABLE": [1, 0, 0, 0], - "EPTX33ENABLE": [0, 0, 0, 0] - }, - "EPTX33CHNCNTR": - { - "EPTX33DRIVESTRENGTH": [0, 0, 0, 0], - "EPTX33PREEMPHASISMODE": [0, 0, 0, 0], - "EPTX33PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "EPTX33_32CHNCNTR": - { - "EPTX32INVERT": [0, 0, 0, 0], - "EPTX32PREEMPHASISWIDTH": [0, 0, 0, 0], - "EPTX33INVERT": [0, 0, 0, 0], - "EPTX33PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPTXCONTROL": - { - "EPTX0MIRRORENABLE": [0, 0, 0, 0], - "EPTX1MIRRORENABLE": [0, 0, 0, 0], - "EPTX2MIRRORENABLE": [0, 0, 0, 0], - "EPTX3MIRRORENABLE": [0, 0, 0, 0] - }, - "EPTXDATARATE": - { - "EPTX0DATARATE": [2, 0, 0, 0], - "EPTX1DATARATE": [2, 0, 0, 0], - "EPTX2DATARATE": [2, 0, 0, 0], - "EPTX3DATARATE": [2, 0, 0, 0] - }, - "EPTXECCHNCNTR": - { - "EPTXECDRIVESTRENGTH": [0, 0, 0, 0], - "EPTXECENABLE": [0, 0, 0, 0], - "EPTXECINVERT": [0, 0, 0, 0], - "EPTXECTRISTATE": [0, 0, 0, 0] - }, - "EPTXECCHNCNTR2": - { - "EPTXECPREEMPHASISMODE": [0, 0, 0, 0], - "EPTXECPREEMPHASISSTRENGTH": [0, 0, 0, 0], - "EPTXECPREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "EPTXLOWRES0": - { - "EPTX00LOWRES": [0, 0, 0, 0], - "EPTX01LOWRES": [0, 0, 0, 0], - "EPTX02LOWRES": [0, 0, 0, 0], - "EPTX03LOWRES": [0, 0, 0, 0], - "EPTX10LOWRES": [0, 0, 0, 0], - "EPTX11LOWRES": [0, 0, 0, 0], - "EPTX12LOWRES": [0, 0, 0, 0], - "EPTX13LOWRES": [0, 0, 0, 0] - }, - "EPTXLOWRES1": - { - "EPTX20LOWRES": [0, 0, 0, 0], - "EPTX21LOWRES": [0, 0, 0, 0], - "EPTX22LOWRES": [0, 0, 0, 0], - "EPTX23LOWRES": [0, 0, 0, 0], - "EPTX30LOWRES": [0, 0, 0, 0], - "EPTX31LOWRES": [0, 0, 0, 0], - "EPTX32LOWRES": [0, 0, 0, 0], - "EPTX33LOWRES": [0, 0, 0, 0] - }, - "EQCONFIG": - { - "EQATTENUATION": [3, 0, 0, 0], - "EQCAP": [0, 0, 0, 0] - }, - "EQRES": - { - "EQRES0": [0, 0, 0, 0], - "EQRES1": [0, 0, 0, 0], - "EQRES2": [0, 0, 0, 0], - "EQRES3": [0, 0, 0, 0] - }, - "FAMAXHEADERFOUNDCOUNT": - { - "FAMAXHEADERFOUNDCOUNT": [16, 0, 0, 0] - }, - "FAMAXHEADERFOUNDCOUNTAFTERNF": - { - "FAMAXHEADERFOUNDCOUNTAFTERNF": [16, 0, 0, 0] - }, - "FAMAXHEADERNOTFOUNDCOUNT": - { - "FAMAXHEADERNOTFOUNDCOUNT": [16, 0, 0, 0] - }, - "FORCEENABLE": - { - "FORCERXENABLE": [0, 0, 0, 0], - "FORCETXENABLE": [0, 0, 0, 0], - "I2CMCLKALWAYSENABLE": [0, 0, 0, 0], - "LDFORCEENABLE": [0, 0, 0, 0], - "PSFSMCLKALWAYSON": [0, 0, 0, 0] - }, - "FUSEBLOWADDH": - { - "FUSEBLOWADDRESS": [0, 0, 0, 0] - }, - "FUSEBLOWADDL": - { - "FUSEBLOWADDRESS": [0, 0, 0, 0] - }, - "FUSEBLOWDATAA": - { - "FUSEBLOWDATA": [0, 0, 0, 0] - }, - "FUSEBLOWDATAB": - { - "FUSEBLOWDATA": [0, 0, 0, 0] - }, - "FUSEBLOWDATAC": - { - "FUSEBLOWDATA": [0, 0, 0, 0] - }, - "FUSEBLOWDATAD": - { - "FUSEBLOWDATA": [0, 0, 0, 0] - }, - "FUSECONTROL": - { - "FUSEBLOW": [0, 0, 0, 0], - "FUSEBLOWPULSELENGTH": [0, 0, 0, 0], - "FUSEREAD": [0, 0, 0, 0] - }, - "FUSEMAGIC": - { - "FUSEMAGICNUMBER": [0, 0, 0, 0] - }, - "I2CM0ADDRESS": - { - "I2CM0ADDRESS": [0, 0, 0, 0] - }, - "I2CM0CMD": - { - "I2CM0CMD": [0, 0, 0, 0] - }, - "I2CM0CONFIG": - { - "I2CM0ADDRESSEXT": [0, 0, 0, 0], - "I2CM0SCLDRIVESTRENGTH": [0, 0, 0, 0], - "I2CM0SCLPULLUPENABLE": [1, 0, 0, 0], - "I2CM0SDADRIVESTRENGTH": [0, 0, 0, 0], - "I2CM0SDAPULLUPENABLE": [1, 0, 0, 0] - }, - "I2CM0DATA0": - { - "I2CM0DATA": [0, 0, 0, 0] - }, - "I2CM0DATA1": - { - "I2CM0DATA": [0, 0, 0, 0] - }, - "I2CM0DATA2": - { - "I2CM0DATA": [0, 0, 0, 0] - }, - "I2CM0DATA3": - { - "I2CM0DATA": [0, 0, 0, 0] - }, - "I2CM1ADDRESS": - { - "I2CM1ADDRESS": [0, 0, 0, 0] - }, - "I2CM1CMD": - { - "I2CM1CMD": [0, 0, 0, 0] - }, - "I2CM1CONFIG": - { - "I2CM1ADDRESSEXT": [0, 0, 0, 0], - "I2CM1SCLDRIVESTRENGTH": [0, 0, 0, 0], - "I2CM1SCLPULLUPENABLE": [1, 0, 0, 0], - "I2CM1SDADRIVESTRENGTH": [0, 0, 0, 0], - "I2CM1SDAPULLUPENABLE": [1, 0, 0, 0] - }, - "I2CM1DATA0": - { - "I2CM1DATA": [0, 0, 0, 0] - }, - "I2CM1DATA1": - { - "I2CM1DATA": [0, 0, 0, 0] - }, - "I2CM1DATA2": - { - "I2CM1DATA": [0, 0, 0, 0] - }, - "I2CM1DATA3": - { - "I2CM1DATA": [0, 0, 0, 0] - }, - "I2CM2ADDRESS": - { - "I2CM2ADDRESS": [0, 0, 0, 0] - }, - "I2CM2CMD": - { - "I2CM2CMD": [0, 0, 0, 0] - }, - "I2CM2CONFIG": - { - "I2CM2ADDRESSEXT": [0, 0, 0, 0], - "I2CM2SCLDRIVESTRENGTH": [1, 0, 0, 0], - "I2CM2SCLPULLUPENABLE": [0, 0, 0, 0], - "I2CM2SDADRIVESTRENGTH": [0, 0, 0, 0], - "I2CM2SDAPULLUPENABLE": [1, 0, 0, 0] - }, - "I2CM2DATA0": - { - "I2CM2DATA": [0, 0, 0, 0] - }, - "I2CM2DATA1": - { - "I2CM2DATA": [0, 0, 0, 0] - }, - "I2CM2DATA2": - { - "I2CM2DATA": [0, 0, 0, 0] - }, - "I2CM2DATA3": - { - "I2CM2DATA": [0, 0, 0, 0] - }, - "I2CMCLKDISABLE": - { - "I2CM0CLKDISABLE": [0, 0, 0, 0], - "I2CM1CLKDISABLE": [0, 0, 0, 0], - "I2CM2CLKDISABLE": [0, 0, 0, 0] - }, - "I2CMTRANSADDRESS": - { - "I2CMTRANSADDRESS": [0, 0, 0, 0] - }, - "I2CMTRANSCONFIG": - { - "I2CMTRANS10BITADDR": [0, 0, 0, 0], - "I2CMTRANSADDRESSEXT": [0, 0, 0, 0], - "I2CMTRANSCHANNEL": [0, 0, 0, 0], - "I2CMTRANSENABLE": [0, 0, 0, 0] - }, - "I2CMTRANSCTRL": - { - "I2CMTRANSCTRL": [0, 0, 0, 0] - }, - "I2CMTRANSDATA0": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA1": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA10": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA11": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA12": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA13": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA14": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA15": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA2": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA3": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA4": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA5": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA6": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA7": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA8": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "I2CMTRANSDATA9": - { - "I2CMTRANSDATA": [0, 0, 0, 0] - }, - "LDCONFIGH": - { - "LDEMPHASISENABLE": [0, 0, 0, 0], - "LDMODULATIONCURRENT": [127, 127, 127, 127] - }, - "LDCONFIGL": - { - "LDEMPHASISAMP": [0, 0, 0, 0], - "LDEMPHASISSHORT": [0, 0, 0, 0] - }, - "PGCONFIG": - { - "PGDELAY": [0, 0, 0, 0], - "PGENABLE": [0, 0, 0, 0], - "PGLEVEL": [0, 0, 0, 0] - }, - "PIODIRH": - { - "PIODIR": [0, 0, 0, 0] - }, - "PIODIRL": - { - "PIODIR": [0, 0, 0, 0] - }, - "PIODRIVESTRENGTHH": - { - "PIODRIVESTRENGTH": [0, 0, 0, 0] - }, - "PIODRIVESTRENGTHL": - { - "PIODRIVESTRENGTH": [0, 0, 0, 0] - }, - "PIOOUTH": - { - "PIOOUT": [0, 0, 0, 0] - }, - "PIOOUTL": - { - "PIOOUT": [0, 0, 0, 0] - }, - "PIOPULLENAH": - { - "PIOPULLENABLE": [0, 0, 0, 0] - }, - "PIOPULLENAL": - { - "PIOPULLENABLE": [0, 0, 0, 0] - }, - "PIOUPDOWNH": - { - "PIOUPDOWN": [0, 0, 0, 0] - }, - "PIOUPDOWNL": - { - "PIOUPDOWN": [0, 0, 0, 0] - }, - "POWERUP0": - { - "PUSMPLLTIMEOUTCONFIG": [0, 0, 0, 0], - "PUSMREADYWHENCHNSLOCKED": [0, 0, 0, 0] - }, - "POWERUP1": - { - "PUSMCHANNELSTIMEOUTCONFIG": [0, 0, 0, 0], - "PUSMDLLTIMEOUTCONFIG": [0, 0, 0, 0] - }, - "POWERUP2": - { - "DLLCONFIGDONE": [1, 1, 1, 1], - "PLLCONFIGDONE": [1, 1, 1, 1] - }, - "POWERUP3": - { - "PUSMFORCESTATE": [0, 0, 0, 0], - "PUSMSTATEFORCED": [0, 0, 0, 0] - }, - "POWERUP4": - { - "PUSMFORCEMAGIC": [0, 0, 0, 0] - }, - "PROCESSANDSEUMONITOR": - { - "PMCHANNEL": [0, 0, 0, 0], - "PMENABLE": [0, 0, 0, 0], - "SEUENABLE": [0, 0, 0, 0] - }, - "PS0CONFIG": - { - "PS0DELAY": [0, 0, 0, 0], - "PS0DRIVESTRENGTH": [0, 0, 0, 0], - "PS0ENABLEFINETUNE": [0, 0, 0, 0], - "PS0FREQ": [0, 0, 0, 0] - }, - "PS0DELAY": - { - "PS0DELAY": [0, 0, 0, 0] - }, - "PS0OUTDRIVER": - { - "PS0PREEMPHASISMODE": [0, 0, 0, 0], - "PS0PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "PS0PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "PS1CONFIG": - { - "PS1DELAY": [0, 0, 0, 0], - "PS1DRIVESTRENGTH": [0, 0, 0, 0], - "PS1ENABLEFINETUNE": [0, 0, 0, 0], - "PS1FREQ": [0, 0, 0, 0] - }, - "PS1DELAY": - { - "PS1DELAY": [0, 0, 0, 0] - }, - "PS1OUTDRIVER": - { - "PS1PREEMPHASISMODE": [0, 0, 0, 0], - "PS1PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "PS1PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "PS2CONFIG": - { - "PS2DELAY": [0, 0, 0, 0], - "PS2DRIVESTRENGTH": [0, 0, 0, 0], - "PS2ENABLEFINETUNE": [0, 0, 0, 0], - "PS2FREQ": [0, 0, 0, 0] - }, - "PS2DELAY": - { - "PS2DELAY": [0, 0, 0, 0] - }, - "PS2OUTDRIVER": - { - "PS2PREEMPHASISMODE": [0, 0, 0, 0], - "PS2PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "PS2PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "PS3CONFIG": - { - "PS3DELAY": [0, 0, 0, 0], - "PS3DRIVESTRENGTH": [0, 0, 0, 0], - "PS3ENABLEFINETUNE": [0, 0, 0, 0], - "PS3FREQ": [0, 0, 0, 0] - }, - "PS3DELAY": - { - "PS3DELAY": [0, 0, 0, 0] - }, - "PS3OUTDRIVER": - { - "PS3PREEMPHASISMODE": [0, 0, 0, 0], - "PS3PREEMPHASISSTRENGTH": [0, 0, 0, 0], - "PS3PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "PSDLLCONFIG": - { - "PSDLLCONFIRMCOUNT": [0, 0, 0, 0], - "PSDLLCURRENTSEL": [0, 0, 0, 0] - }, - "PSLOWRES": - { - "PS0LOWRES": [0, 0, 0, 0], - "PS1LOWRES": [0, 0, 0, 0], - "PS2LOWRES": [0, 0, 0, 0], - "PS3LOWRES": [0, 0, 0, 0] - }, - "READY": - { - "READYCHNSENABLE": [0, 0, 0, 0], - "READYCLKGENABLE": [0, 0, 0, 0], - "READYDLLSENABLE": [0, 0, 0, 0], - "READYPUSMDISABLE": [0, 0, 0, 0] - }, - "REFCLK": - { - "REFCLKACBIAS": [0, 0, 0, 0], - "REFCLKFORCEENABLE": [0, 0, 0, 0], - "REFCLKTERM": [0, 0, 0, 0] - }, - "RESETCONFIG": - { - "BODENABLE": [0, 0, 0, 0], - "BODLEVEL": [0, 0, 0, 0] - }, - "RST0": - { - "RSTCONFIG": [0, 0, 0, 0], - "RSTFUSES": [0, 0, 0, 0], - "RSTI2CM0": [0, 0, 0, 0], - "RSTI2CM1": [0, 0, 0, 0], - "RSTI2CM2": [0, 0, 0, 0], - "RSTPLLDIGITAL": [0, 0, 0, 0], - "RSTRXLOGIC": [0, 0, 0, 0], - "RSTTXLOGIC": [0, 0, 0, 0] - }, - "RST1": - { - "RSTEPRX0DLL": [0, 0, 0, 0], - "RSTEPRX1DLL": [0, 0, 0, 0], - "RSTEPRX2DLL": [0, 0, 0, 0], - "RSTEPRX3DLL": [0, 0, 0, 0], - "RSTEPRX4DLL": [0, 0, 0, 0], - "RSTEPRX5DLL": [0, 0, 0, 0], - "RSTEPRX6DLL": [0, 0, 0, 0], - "RSTFRAMEALIGNER": [0, 0, 0, 0] - }, - "RST2": - { - "RESETOUTFORCEACTIVE": [0, 0, 0, 0], - "RSTPS0DLL": [0, 0, 0, 0], - "RSTPS1DLL": [0, 0, 0, 0], - "RSTPS2DLL": [0, 0, 0, 0], - "RSTPS3DLL": [0, 0, 0, 0], - "SKIPFORCE": [0, 0, 0, 0] - }, - "SCCONFIG": - { - "SCPARITYCHECKDISABLE": [0, 0, 0, 0] - }, - "TEMPCALH": - { - "TEMPCAL": [0, 0, 0, 0] - }, - "TEMPCALL": - { - "TEMPCAL": [0, 0, 0, 0] - }, - "TO0SEL": - { - "TO0SELECT": [0, 0, 0, 0] - }, - "TO1SEL": - { - "TO1SELECT": [0, 0, 0, 0] - }, - "TO2SEL": - { - "TO2SELECT": [0, 0, 0, 0] - }, - "TO3SEL": - { - "TO3SELECT": [0, 0, 0, 0] - }, - "TO4DRIVER": - { - "TO4DRIVESTRENGTH": [0, 0, 0, 0], - "TO4PREEMPHASISMODE": [0, 0, 0, 0], - "TO4PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "TO4SEL": - { - "TO4SELECT": [0, 0, 0, 0] - }, - "TO5DRIVER": - { - "TO5DRIVESTRENGTH": [0, 0, 0, 0], - "TO5PREEMPHASISMODE": [0, 0, 0, 0], - "TO5PREEMPHASISSTRENGTH": [0, 0, 0, 0] - }, - "TO5SEL": - { - "TO5SELECT": [0, 0, 0, 0] - }, - "TODRIVINGSTRENGTH": - { - "TO0DS": [0, 0, 0, 0], - "TO1DS": [0, 0, 0, 0], - "TO2DS": [0, 0, 0, 0], - "TO3DS": [0, 0, 0, 0] - }, - "TOPREEMP": - { - "TO4INVERT": [0, 0, 0, 0], - "TO4PREEMPHASISWIDTH": [0, 0, 0, 0], - "TO5INVERT": [0, 0, 0, 0], - "TO5PREEMPHASISWIDTH": [0, 0, 0, 0] - }, - "ULDATASOURCE0": - { - "ULECDATASOURCE": [0, 0, 0, 0], - "ULSERTESTPATTERN": [0, 0, 0, 0] - }, - "ULDATASOURCE1": - { - "LDDATASOURCE": [0, 0, 0, 0], - "ULG0DATASOURCE": [0, 0, 0, 0], - "ULG1DATASOURCE": [0, 0, 0, 0] - }, - "ULDATASOURCE2": - { - "ULG2DATASOURCE": [0, 0, 0, 0], - "ULG3DATASOURCE": [0, 0, 0, 0] - }, - "ULDATASOURCE3": - { - "ULG4DATASOURCE": [0, 0, 0, 0], - "ULG5DATASOURCE": [0, 0, 0, 0] - }, - "ULDATASOURCE4": - { - "DLECDATASOURCE": [0, 0, 0, 0], - "ULG6DATASOURCE": [0, 0, 0, 0], - "ULICDATASOURCE": [0, 0, 0, 0] - }, - "ULDATASOURCE5": - { - "DLG0DATASOURCE": [0, 0, 0, 0], - "DLG1DATASOURCE": [0, 0, 0, 0], - "DLG2DATASOURCE": [0, 0, 0, 0], - "DLG3DATASOURCE": [0, 0, 0, 0] - }, - "USERID0": - { - "USERID": [0, 0, 0, 0] - }, - "USERID1": - { - "USERID": [0, 0, 0, 0] - }, - "USERID2": - { - "USERID": [0, 0, 0, 0] - }, - "USERID3": - { - "USERID": [0, 0, 0, 0] - }, - "VREFCNTR": - { - "VREFENABLE": [0, 0, 0, 0] - }, - "VREFTUNE": - { - "VREFTUNE": [0, 0, 0, 0] - }, - "WATCHDOG": - { - "PUSMCHECKSUMWDOGENABLE": [0, 0, 0, 0], - "PUSMDLLWDOGDISABLE": [0, 0, 0, 0], - "PUSMPLLWDOGDISABLE": [0, 0, 0, 0] - } - }, - - "gbcr": - { - "CH1DOWNLINK0": - { - "TX1DISDLEMP": [0, 0, 0, 0], - "TX1DLATT": [3, 3, 3, 3], - "TX1DLSR": [5, 5, 5, 5] - }, - "CH1DOWNLINK1": - { - "TX1DISDLBIAS": [0, 0, 0, 0], - "TX1DISDLLPFBIAS": [1, 1, 1, 1] - }, - "CH1UPLINK0": - { - "CH1CMLAMPLSEL": [7, 7, 7, 7], - "CH1DISEQLF": [1, 1, 1, 1], - "CH1EQATT": [3, 3, 3, 3] - }, - "CH1UPLINK1": - { - "CH1CTLEHFSR": [11, 11, 11, 11], - "CH1CTLEMFSR": [11, 11, 11, 11] - }, - "CH1UPLINK2": - { - "CH1DIS": [0, 0, 0, 0], - "CH1DISDFF": [1, 1, 1, 1], - "CH1DISLPF": [0, 0, 0, 0] - }, - "CH2DOWNLINK0": - { - "TX2DISDLEMP": [0, 0, 0, 0], - "TX2DLATT": [3, 3, 3, 3], - "TX2DLSR": [5, 5, 5, 5] - }, - "CH2DOWNLINK1": - { - "TX2DISDLBIAS": [0, 0, 0, 0], - "TX2DISDLLPFBIAS": [1, 1, 1, 1] - }, - "CH2UPLINK0": - { - "CH2CMLAMPLSEL": [7, 7, 7, 7], - "CH2DISEQLF": [1, 1, 1, 1], - "CH2EQATT": [3, 3, 3, 3] - }, - "CH2UPLINK1": - { - "CH2CTLEHFSR": [11, 11, 11, 11], - "CH2CTLEMFSR": [11, 11, 11, 11] - }, - "CH2UPLINK2": - { - "CH2DIS": [0, 0, 0, 0], - "CH2DISDFF": [1, 1, 1, 1], - "CH2DISLPF": [0, 0, 0, 0] - }, - "CH3UPLINK0": - { - "CH3CMLAMPLSEL": [7, 7, 7, 7], - "CH3DISEQLF": [1, 1, 1, 1], - "CH3EQATT": [3, 3, 3, 3] - }, - "CH3UPLINK1": - { - "CH3CTLEHFSR": [11, 11, 11, 11], - "CH3CTLEMFSR": [11, 11, 11, 11] - }, - "CH3UPLINK2": - { - "CH3DIS": [0, 0, 0, 0], - "CH3DISDFF": [1, 1, 1, 1], - "CH3DISLPF": [0, 0, 0, 0] - }, - "CH4UPLINK0": - { - "CH4CMLAMPLSEL": [7, 7, 7, 7], - "CH4DISEQLF": [1, 1, 1, 1], - "CH4EQATT": [3, 3, 3, 3] - }, - "CH4UPLINK1": - { - "CH4CTLEHFSR": [11, 11, 11, 11], - "CH4CTLEMFSR": [11, 11, 11, 11] - }, - "CH4UPLINK2": - { - "CH4DIS": [0, 0, 0, 0], - "CH4DISDFF": [1, 1, 1, 1], - "CH4DISLPF": [0, 0, 0, 0] - }, - "CH5UPLINK0": - { - "CH5CMLAMPLSEL": [7, 7, 7, 7], - "CH5DISEQLF": [1, 1, 1, 1], - "CH5EQATT": [3, 3, 3, 3] - }, - "CH5UPLINK1": - { - "CH5CTLEHFSR": [11, 11, 11, 11], - "CH5CTLEMFSR": [11, 11, 11, 11] - }, - "CH5UPLINK2": - { - "CH5DIS": [0, 0, 0, 0], - "CH5DISDFF": [1, 1, 1, 1], - "CH5DISLPF": [0, 0, 0, 0] - }, - "CH6UPLINK0": - { - "CH6CMLAMPLSEL": [7, 7, 7, 7], - "CH6DISEQLF": [1, 1, 1, 1], - "CH6EQATT": [3, 3, 3, 3] - }, - "CH6UPLINK1": - { - "CH6CTLEHFSR": [11, 11, 11, 11], - "CH6CTLEMFSR": [11, 11, 11, 11] - }, - "CH6UPLINK2": - { - "CH6DIS": [0, 0, 0, 0], - "CH6DISDFF": [1, 1, 1, 1], - "CH6DISLPF": [0, 0, 0, 0] - }, - "CH7UPLINK0": - { - "CH7CMLAMPLSEL": [7, 7, 7, 7], - "CH7DISEQLF": [1, 1, 1, 1], - "CH7EQATT": [3, 3, 3, 3] - }, - "CH7UPLINK1": - { - "CH7CTLEHFSR": [11, 11, 11, 11], - "CH7CTLEMFSR": [11, 11, 11, 11] - }, - "CH7UPLINK2": - { - "CH7DIS": [0, 0, 0, 0], - "CH7DISDFF": [1, 1, 1, 1], - "CH7DISLPF": [0, 0, 0, 0] - }, - "LVDSRXTX": - { - "DISTX": [0, 0, 0, 0], - "RXEN": [1, 1, 1, 1], - "RXENTERMINATION": [1, 1, 1, 1], - "RXEQ": [0, 0, 0, 0], - "RXINVDATA": [0, 0, 0, 0], - "RXSETCM": [1, 1, 1, 1] - }, - "PHASESHIFTER0": - { - "DLLCAPRESET": [0, 0, 0, 0], - "DLLENABLE": [1, 1, 1, 1] - }, - "PHASESHIFTER1": - { - "DLLCHARGEPUMPCURRENT": [15, 15, 15, 15], - "DLLFORCEDOWN": [1, 1, 1, 1] - }, - "PHASESHIFTER2": - { - "DLLCLOCKDELAYCH6": [5, 5, 5, 5], - "DLLCLOCKDELAYCH7": [5, 5, 5, 5] - }, - "PHASESHIFTER3": - { - "DLLCLOCKDELAYCH4": [5, 5, 5, 5], - "DLLCLOCKDELAYCH5": [5, 5, 5, 5] - }, - "PHASESHIFTER4": - { - "DLLCLOCKDELAYCH6": [5, 5, 5, 5], - "DLLCLOCKDELAYCH7": [5, 5, 5, 5] - }, - "PHASESHIFTER5": - { - "DLLCLOCKDELAYCH1": [5, 5, 5, 5], - "DLLCLOCKDELAYCHTEST": [5, 5, 5, 5] - } - }, - - "vtrx": - { - "C0BC": - { - "C0BiasCur": 47 - }, - "C0CR": - { - "C0BEN": 1, - "C0CEN": 1, - "C0FEP": 0, - "C0LAEN": 1, - "C0MEN": 1, - "C0REP": 0 - }, - "C0EA": - { - "C0EmpAmp": 0 - }, - "C0MC": - { - "C0ModCur": 38 - }, - "C1BC": - { - "C1BiasCur": 47 - }, - "C1CR": - { - "C1BEN": 1, - "C1CEN": 1, - "C1FEP": 0, - "C1LAEN": 1, - "C1MEN": 1, - "C1REP": 0 - }, - "C1EA": - { - "C1EmpAmp": 0 - }, - "C1MC": - { - "C1ModCur": 38 - }, - "C2BC": - { - "C2BiasCur": 47 - }, - "C2CR": - { - "C2BEN": 1, - "C2CEN": 1, - "C2FEP": 0, - "C2LAEN": 1, - "C2MEN": 1, - "C2REP": 0 - }, - "C2EA": - { - "C2EmpAmp": 0 - }, - "C2MC": - { - "C2ModCur": 38 - }, - "C3BC": - { - "C3BiasCur": 47 - }, - "C3CR": - { - "C3BEN": 1, - "C3CEN": 1, - "C3FEP": 0, - "C3LAEN": 1, - "C3MEN": 1, - "C3REP": 0 - }, - "C3EA": - { - "C3EmpAmp": 0 - }, - "C3MC": - { - "C3ModCur": 38 - }, - "CCNF": - { - "CEA": 1, - "CEB": 1, - "CEC": 1, - "CSEN": 0 - }, - "CSE": - { - "ClkSpyEna": 0 - }, - "GCR": - { - "GBEN": 1, - "GCEN": 1, - "GLAEN": 1, - "GMEN": 1, - "GPEN": 1 - }, - "ODC": - { - "DS": 1 - } - } -} \ No newline at end of file diff --git a/ui/src/SimpleTabs/Configurations.js b/ui/src/Config/Configurations.js similarity index 100% rename from ui/src/SimpleTabs/Configurations.js rename to ui/src/Config/Configurations.js diff --git a/ui/src/SimpleTabs/Registers.js b/ui/src/Config/Registers.js similarity index 100% rename from ui/src/SimpleTabs/Registers.js rename to ui/src/Config/Registers.js diff --git a/ui/src/Controls/Diagnosis.js b/ui/src/Controls/Diagnosis.js deleted file mode 100644 index 00a5e33..0000000 --- a/ui/src/Controls/Diagnosis.js +++ /dev/null @@ -1,538 +0,0 @@ -import React from "react"; -import { - Button, - Checkbox, - InputGroup, - InputGroupText, - Dropdown, - DropdownToggle, - DropdownItem, - FormSelect, - FormSelectOption, - FormSelectOptionGroup, - Text, - TextInput, - TextContent, - TextVariants, - Form, - FormGroup, - PanelMainBody, - PanelMain, - Panel, - PanelHeader, - SidebarContent, - Sidebar, - Flex, - FlexItem, - Grid, - GridItem, - Bullseye, - Tooltip, -} from "@patternfly/react-core"; - -import { getPostBody, checkResponse } from "../utils/utility-functions"; -import { FormSelectInputNewer } from "../Widgets/FormSelectInput"; - -class WriteRead4User extends React.Component { - constructor(props) { - super(props); - this.state = { - device_val: 0, - device: [ - { label: "lpgbt1", disabled: false, value: "0" }, - { label: "lpgbt2", disabled: false, value: "1" }, - { label: "lpgbt3", disabled: false, value: "2" }, - { label: "lpgbt4", disabled: false, value: "3" }, - { label: "gbcr1", disabled: false, value: "4" }, - { label: "gbcr2", disabled: false, value: "5" }, - { label: "gbcr3", disabled: false, value: "6" }, - { label: "gbcr4", disabled: false, value: "7" }, - ], - - value_read: "", - reg_write: "", - value_write: "", - read_back_read: "", - read_back_write: "", - }; - - this.onChange_device = (device_val) => { - this.setState({ device_val: device_val }); - console.log(device_val); - }; - - this.handleTextInputChange = (value_read) => { - this.setState({ value_read }); - }; - this.handleTextInputChange2 = (reg_write) => { - this.setState({ reg_write }); - }; - this.handleTextInputChange3 = (value_write) => { - this.setState({ value_write }); - }; - this.handleReadBack = (data) => { - this.setState({ ...this.state, read_back_read: data }); - }; - this.handleWriteReadBack = (data) => { - this.setState({ ...this.state, read_back_write: data }); - }; - this.read_device = (reg_address) => { - //var re = /[0-9A-Fa-f]{6}/g; - const requestData = { - register: reg_address, - device: this.state.device[this.state.device_val].label, - }; - - console.log(requestData); - fetch( - `${this.props.backendUrl}/sendReadRequest`, - getPostBody(requestData) - ) - .then((response) => checkResponse(response)) - .then((data) => { - console.log(data); - this.handleReadBack(data); - }) - .catch((err) => { - console.log(err); - }); - }; - this.write_device = (reg_address, new_reg_value) => { - const requestData = { - device: this.state.device[this.state.device_val].label, - register: reg_address, - newValue: new_reg_value, - }; - - console.log(requestData); - fetch( - `${this.props.backendUrl}/sendWriteRequest`, - getPostBody(requestData) - ) - .then((response) => checkResponse(response)) - .then((data) => { - console.log(data); - this.handleWriteReadBack(data); - }) - .catch((err) => { - console.log(err); - }); - }; - } - - render() { - return ( - <React.Fragment> - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - <Grid> - <Bullseye> - <GridItem span={7}> - <Bullseye> - <h4> Select the device: </h4> - </Bullseye> - </GridItem> - - <GridItem span={5}> - <Bullseye> - <FormSelectInputNewer - id={"selectDeviceSimplePanelRead"} - items={this.state.device} - value={this.state.device_val} - onChange={this.onChange_device} - /> - </Bullseye> - </GridItem> - </Bullseye> - </Grid> - </PanelMainBody> - </PanelMain> - </Panel> - - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - <Grid> - <Bullseye> - <GridItem span={8}> - <Bullseye> - <Tooltip - content={ - <div> - Use rom register for testing. In lpgbt v1 the return - has to be 166.{" "} - </div> - } - > - <Button - id="read_reg_send_command" - variant="primary" - onClick={() => - this.read_device(this.state.value_read) - } - > - <h3> Read register </h3> - </Button> - </Tooltip> - </Bullseye> - </GridItem> - </Bullseye> - - <GridItem span={6}> - <Bullseye> - <h4>Address (hex)</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextInput - id="read_input" - name="read_input" - value={this.state.value_read} - onChange={this.handleTextInputChange} - /> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <h4>Read back value:</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h5}> - {this.state.read_back_read} - </Text> - </TextContent> - </Bullseye> - </GridItem> - </Grid> - </PanelMainBody> - </PanelMain> - </Panel> - - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - <Grid> - <Bullseye> - <GridItem span={8} rowSpan={1}> - <Bullseye> - <Button - id="write_pri_send_command" - variant="primary" - onClick={() => - this.write_device( - this.state.reg_write, - this.state.value_write - ) - } - > - <h3> Write register </h3> - </Button> - </Bullseye> - </GridItem> - </Bullseye> - - <GridItem span={6}> - <Bullseye> - <h4>Address</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextInput - id="write_address" - name="write_address" - value={this.state.reg_write} - onChange={this.handleTextInputChange2} - /> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <h4>Value (hex)</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextInput - id="write_value" - name="write_value" - value={this.state.value_write} - onChange={this.handleTextInputChange3} - /> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <h4>Read back value</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h5}> - {this.state.read_back_write} - </Text> - </TextContent> - </Bullseye> - </GridItem> - </Grid> - </PanelMainBody> - </PanelMain> - </Panel> - </React.Fragment> - ); - } -} - -class WriteReadHorizontal extends React.Component { - constructor(props) { - super(props); - this.state = { - value_read: "", - reg_write: "", - value_write: "", - read_back_read: "-_-", - read_back_write: "-_-", - }; - this.handleTextInputChange = (value_read) => { - this.setState({ value_read }); - }; - this.handleTextInputChange2 = (reg_write) => { - this.setState({ reg_write }); - }; - this.handleTextInputChange3 = (value_write) => { - this.setState({ value_write }); - }; - this.handleReadBack = (data) => { - this.setState({ ...this.state, read_back_read: data }); - }; - this.handleWriteReadBack = (data) => { - this.setState({ ...this.state, read_back_write: data }); - }; - this.read_device = (reg_address) => { - //var re = /[0-9A-Fa-f]{6}/g; - const requestData = { - //fice_G: this.props.fice_g, - //fice_d: this.props.fice_d, - //fice_i: this.props.fice_i, - //fice_I: this.props.fice_I, - //optoboard_serial: this.props.serial, - register: reg_address, - device: this.props.device, - //isMaster: this.props.isMaster, - //i2c_master_val: this.props.i2c_master_val, - }; - - console.log(requestData); - fetch( - `${this.props.backendUrl}/sendReadRequest`, - getPostBody(requestData) - ) - .then((response) => checkResponse(response)) - .then((data) => { - console.log(data); - this.handleReadBack(data); - }) - .catch((err) => { - console.log(err); - }); - }; - this.write_device = (reg_address, new_reg_value) => { - const requestData = { - /* fice_G: this.props.fice_g, - fice_d: this.props.fice_d, - fice_i: this.props.fice_i, - fice_I: this.props.fice_I, - optoboard_serial: this.props.serial, - reg_addr: reg_address, - isMaster: this.props.isMaster, - i2c_master_val: this.props.i2c_master_val,*/ - device: this.props.device, - register: reg_address, - newValue: new_reg_value, - }; - - console.log(requestData); - fetch( - `${this.props.backendUrl}/sendWriteRequest`, - getPostBody(requestData) - ) - .then((response) => checkResponse(response)) - .then((data) => { - console.log(data); - this.handleWriteReadBack(data); - }) - .catch((err) => { - console.log(err); - }); - }; - } - - render() { - const VariableReadBack = "hex_value"; - return ( - <React.Fragment> - <Flex> - <FlexItem flex={{ default: "flex_1" }}> - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - <Bullseye> - <Flex> - <FlexItem flex={{ default: "flex_1" }}> - <Bullseye> - <Button - id="read_reg_send_command" - variant="primary" - onClick={() => - this.read_device(this.state.value_read) - } - > - <h3> Read register </h3> - </Button> - </Bullseye> - </FlexItem> - </Flex> - </Bullseye> - - <Flex> - <FlexItem flex={{ default: "flex_1" }}> - <Bullseye> - <h4>Address </h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: "flex_1" }}> - <Bullseye> - <TextInput - id="read_input" - name="read_input" - value={this.state.value_read} - onChange={this.handleTextInputChange} - /> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: "flex_2" }}> - <Bullseye> - <h4>Read back value:</h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: "flex_1" }}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h5}> - {this.state.read_back_read} - </Text> - </TextContent> - </Bullseye> - </FlexItem> - </Flex> - </PanelMainBody> - </PanelMain> - </Panel> - </FlexItem> - - <FlexItem flex={{ default: "flex_1" }}> - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - <Bullseye> - <Flex> - <Bullseye> - <FlexItem flex={{ default: "flex_1" }}> - <Bullseye> - <Button - id="write_pri_send_command" - variant="primary" - onClick={() => - this.write_device( - this.state.reg_write, - this.state.value_write - ) - } - > - <h3> Write register </h3> - </Button> - </Bullseye> - </FlexItem> - </Bullseye> - </Flex> - </Bullseye> - - <Flex> - <FlexItem flex={{ default: "flex_1" }}> - <Bullseye> - <h4>Address </h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: "flex_1" }}> - <Bullseye> - <TextInput - id="write_address" - name="write_address" - value={this.state.reg_write} - onChange={this.handleTextInputChange2} - /> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: "flex_1" }}> - <Bullseye> - <h4>Value </h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: "flex_1" }}> - <Bullseye> - <TextInput - id="write_value" - name="write_value" - value={this.state.value_write} - onChange={this.handleTextInputChange3} - /> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: "flex_2" }}> - <Bullseye> - <h4>Read back value</h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: "flex_1" }}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h5}> - {this.state.read_back_write} - </Text> - </TextContent> - </Bullseye> - </FlexItem> - </Flex> - </PanelMainBody> - </PanelMain> - </Panel> - </FlexItem> - </Flex> - </React.Fragment> - ); - } -} - -export { WriteRead4User, WriteReadHorizontal }; diff --git a/ui/src/Controls/MinConfig.js b/ui/src/Controls/MinConfig.js deleted file mode 100644 index eaf3849..0000000 --- a/ui/src/Controls/MinConfig.js +++ /dev/null @@ -1,369 +0,0 @@ -import React from "react"; -import { - Button, - TextInput, - PanelMainBody, - PanelMain, - Panel, - Bullseye, - Flex, - FlexItem, - Checkbox, - Switch -} from "@patternfly/react-core"; -import { getPostBody, checkResponse } from '../utils/utility-functions' -import { FormSelectInput } from "../Widgets/FormSelectInput"; -import {MyContext} from '../SimpleTabs/MyContext'; - - - -class MinConfig extends React.Component { - constructor(props) { - super(props); - this.state = { - isLoading: false, - validConfig: 'success', Variant: "primary", - - pathToJson : "/itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json", - - switchState : false, - CheckBox_lpgbt1: true, - CheckBox_lpgbt2: true, - CheckBox_lpgbt3: true, - CheckBox_lpgbt4: true, - CheckBox_gbcr1: true, - CheckBox_gbcr2: true, - CheckBox_gbcr3: true, - CheckBox_gbcr4: true, - - inDBCheckBox: false, inDBCheckBoxLabel: "Fetch configuration from ConfigDB", inDBCheckBoxLabelID: "Fetch configuration from ConfigDB", - configDB: "http://localhost:5000", - configDBAvailable: 'warning' - }; - - this.handleTextInputChange = (event) => { - - this.setState({pathToJson : event}); - - let HandleWrongSerial = (dataObj) => { - if (dataObj==1) { this.setState({ validConfig : 'success'}); this.setState({ Variant : "primary" }); - } else { this.setState({validConfig : 'error'}) ; this.setState({ Variant : "danger" }) } - }; - - const requestData = { - path: event, - inDB: this.state.inDBCheckBox, - CONFIGDB_ADDRESS: this.state.configDB - } - console.log(requestData) - fetch(`${this.props.backendUrl}/checkAvailableDatasetInDB`, getPostBody(requestData)).then( - (response) => checkResponse(response)).then((data) => {console.log(data); HandleWrongSerial(data)}); - - }; - - this.configure = () => { - if (this.state.Variant == 'primary'){ - console.log("Starting configuration of the Optoboard!") - let body={} - if (this.state.switchState) { - body = { - config_path: this.state.pathToJson, - activeLpgbt: (this.state.CheckBox_lpgbt1 ? "1":"0") + (this.state.CheckBox_lpgbt2 ? "1":"0") + (this.state.CheckBox_lpgbt3 ? "1":"0") + (this.state.CheckBox_lpgbt4 ? "1":"0"), - activeGbcr: (this.state.CheckBox_gbcr1 ? "1":"0") + (this.state.CheckBox_gbcr2 ? "1":"0") + (this.state.CheckBox_gbcr3 ? "1":"0") + (this.state.CheckBox_gbcr4 ? "1":"0"), - loadFromConfigDB: this.state.inDBCheckBox, - } - } else { - body = { - config_path: this.state.pathToJson, - activeLpgbt: "None", - activeGbcr: "None", - loadFromConfigDB: this.state.inDBCheckBox, - } - }; - this.setState({ - isLoading: true - }); - console.log(body); - - fetch(`${this.props.backendUrl}/configure`, getPostBody(body)).then( - (response) => checkResponse(response)).then((data) => {console.log(data); this.setState({isLoading: false});}); - //if (data == "Optoboard configuration completed") { EnableI2C(); DataSet(this.state.pathToJson, this.state.vtrxVersionValue, this.state.inDBCheckBox) }; - //});.catch(err => {this.setState({isLoading: false});}); - }; - - }; - -/* this.minimal_config = (EnableI2C, DataSet) => { - if (this.state.Variant == 'primary'){ - console.log("Starting configuration of the Optoboard!") - let body={} - if (this.state.switchState) { - body = { - config_path: this.state.pathToJson, - activeLpgbt: (this.state.CheckBox_lpgbt1 ? "1":"0") + (this.state.CheckBox_lpgbt2 ? "1":"0") + (this.state.CheckBox_lpgbt3 ? "1":"0") + (this.state.CheckBox_lpgbt4 ? "1":"0"), - activeGbcr: (this.state.CheckBox_gbcr1 ? "1":"0") + (this.state.CheckBox_gbcr2 ? "1":"0") + (this.state.CheckBox_gbcr3 ? "1":"0") + (this.state.CheckBox_gbcr4 ? "1":"0"), - loadFromConfigDB: this.state.inDBCheckBox, - } - } else { - body = { - config_path: this.state.pathToJson, - activeLpgbt: "None", - activeGbcr: "None", - loadFromConfigDB: this.state.inDBCheckBox, - } - }; - this.setState({ - isLoading: true - }); - console.log(body); - - fetch(`${this.props.backendUrl}/configure`, getPostBody(body)).then( - response => {console.log(response)}).then( - data => {console.log(data); console.log("so far"); - this.setState({isLoading: false}); - if (data == "Optoboard configuration completed") { EnableI2C(); DataSet(this.state.pathToJson, this.state.vtrxVersionValue, this.state.inDBCheckBox) }; - }).catch(err => {this.setState({isLoading: false});}); - }; - - }; -*/ - this.onError = (err) => { - console.log("There was an Error:"); - console.log(err.message); - }; - -/* this.toggleBoxDebug = checked => { - this.setState({ - debugCheckisBox: checked - }); - console.log(checked); - }; -*/ - this.SwitchChange = checked => { - this.setState({ - switchState: checked - }); - } - - this.toggleBox_lpgbt1 = checked => { - this.setState({ - CheckBox_lpgbt1: checked - }); - console.log(checked); - }; - this.toggleBox_lpgbt2 = checked => { - this.setState({ - CheckBox_lpgbt2: checked - }); - console.log(checked); - }; - this.toggleBox_lpgbt3 = checked => { - this.setState({ - CheckBox_lpgbt3: checked - }); - console.log(checked); - }; - this.toggleBox_lpgbt4 = checked => { - this.setState({ - CheckBox_lpgbt4: checked - }); - console.log(checked); - }; - - this.toggleBox_gbcr1 = checked => { - this.setState({ - CheckBox_gbcr1: checked - }); - console.log(checked); - }; - this.toggleBox_gbcr2 = checked => { - this.setState({ - CheckBox_gbcr2: checked - }); - console.log(checked); - }; - this.toggleBox_gbcr3 = checked => { - this.setState({ - CheckBox_gbcr3: checked - }); - console.log(checked); - }; - this.toggleBox_gbcr4 = checked => { - this.setState({ - CheckBox_gbcr4: checked - }); - console.log(checked); - }; - - this.onChange_ConfigurationDB = (ConfigurationDB) => { - this.setState({ ConfigurationDB }); - fetch(`${this.props.backendUrl}/configDbUnavailable_wrapper`, getPostBody({CONFIGDB_ADDRESS: ConfigurationDB})).then( - (response) => checkResponse(response)).then( - (data) => {console.log(data); - if (data) {this.setState({configDBAvailable : 'error'}); this.setState({ Variant : "danger" }) - } else {this.setState({configDBAvailable : 'success'}); this.setState({ Variant : "primary" });} - }); - } - this.toggleBoxlineLocal = checked => { - this.setState({ - inDBCheckBox: checked - }); - console.log(checked); - - fetch(`${this.props.backendUrl}/configDbUnavailable_wrapper`, getPostBody({CONFIGDB_ADDRESS: this.state.configDB})).then( - (response) => checkResponse(response)).then((data) => {console.log(data); - if (checked) { if (data) {this.setState({configDBAvailable : 'error'}); this.setState({ Variant : "danger" }) - } else {this.setState({configDBAvailable : 'success'}); this.setState({ Variant : "primary" });} - } else { if (this.state.validConfig == 'success') {this.setState({ Variant : "primary" });}} - }); - - }; - -/* this.onChange = (vtrxVersionValue) => { this.setState({ vtrxVersionValue }) - console.log(vtrxVersionValue) - }; -*/ - - - }; - - -/* - - <MyContext.Consumer> - {({isI2C_On_Check, fetchDataSet}) => ( - - )} - </MyContext.Consumer> - -*/ - - render (){ - let stringLPGBT = (this.state.switchState) ? <h4>lpgbt to configure</h4> : <h4 style={{color:"grey"}}>lpgbt to configure</h4> - let stringGBCR = (this.state.switchState) ? <h4> gbcr to configure</h4> : <h4 style={{color:"grey"}}> gbcr to configure</h4> - return ( - <React.Fragment> - - <Flex direction={{ default: 'column' }}> - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - - <Bullseye> - <Button - spinnerAriaValueText={this.state.isLoading ? 'Loading' : undefined} - isLoading={this.state.isLoading} - id="readCharacteristics" - variant={this.state.Variant} - onClick={(event) => { - this.configure(); - }} - > - {this.state.isLoading ? "Configuring the Optoboard" : "Optoboard Quick Start" } - </Button> - </Bullseye> - - - <Flex> - <FlexItem flex={{ default: 'flex_5'}}> - <h3>Manual selection of Optoboard ASICS</h3> - </FlexItem> - <FlexItem flex={{ default: 'flex_1'}}> - <Switch - id="no-label-switch-off" - aria-label="Message when on" - //labelOff="Message when off" - isChecked={this.state.switchState} - onChange={this.SwitchChange} - //isReversed - /> - </FlexItem> - </Flex> - - <Bullseye> - <Flex> - <FlexItem flex={{ default: 'flex_4'}}> - {stringLPGBT} - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={""} isChecked={this.state.CheckBox_lpgbt1} onChange={this.toggleBox_lpgbt1} id={"lpgbt_config_1"} name={"lpgbt_config_1"} isDisabled={!this.state.switchState}/> - <Checkbox label={""} isChecked={this.state.CheckBox_lpgbt2} onChange={this.toggleBox_lpgbt2} id={"lpgbt_config_2"} name={"lpgbt_config_2"} isDisabled={!this.state.switchState}/> - <Checkbox label={""} isChecked={this.state.CheckBox_lpgbt3} onChange={this.toggleBox_lpgbt3} id={"lpgbt_config_3"} name={"lpgbt_config_3"} isDisabled={!this.state.switchState}/> - <Checkbox label={""} isChecked={this.state.CheckBox_lpgbt4} onChange={this.toggleBox_lpgbt4} id={"lpgbt_config_4"} name={"lpgbt_config_4"} isDisabled={!this.state.switchState}/> - </Bullseye> - </FlexItem> - </Flex> - </Bullseye> - - <Bullseye> - <Flex> - <FlexItem flex={{ default: 'flex_4'}}> - {stringGBCR} - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={""} isChecked={this.state.CheckBox_gbcr1} onChange={this.toggleBox_gbcr1} id={"gbcr_config_1"} name={"gbcr_config_1"} isDisabled={!this.state.switchState}/> - <Checkbox label={""} isChecked={this.state.CheckBox_gbcr2} onChange={this.toggleBox_gbcr2} id={"gbcr_config_2"} name={"gbcr_config_2"} isDisabled={!this.state.switchState}/> - <Checkbox label={""} isChecked={this.state.CheckBox_gbcr3} onChange={this.toggleBox_gbcr3} id={"gbcr_config_3"} name={"gbcr_config_3"} isDisabled={!this.state.switchState}/> - <Checkbox label={""} isChecked={this.state.CheckBox_gbcr4} onChange={this.toggleBox_gbcr4} id={"gbcr_config_4"} name={"gbcr_config_4"} isDisabled={!this.state.switchState}/> - </Bullseye> - </FlexItem> - </Flex> - </Bullseye> - - <Flex> - <FlexItem FlexItem flex={{ default: 'flex_3' }}> - <Bullseye> - <TextInput - id="config_minimal" - name="read_input" - value={this.state.pathToJson} - onChange={this.handleTextInputChange} - validated={this.state.validConfig} - /> - </Bullseye> - </FlexItem> - </Flex> - - <Bullseye> - <Flex> - <FlexItem flex={{ default: 'flex_2' }}> - <Bullseye> - <Checkbox label={this.state.inDBCheckBoxLabel} isChecked={this.state.inDBCheckBox} onChange={this.toggleBoxlineLocal} id={this.state.inDBCheckBoxLabelID} name={this.state.inDBCheckBoxLabel}/> - </Bullseye> - </FlexItem> - </Flex> - </Bullseye> - - <Flex> - <FlexItem FlexItem flex={{ default: 'flex_3' }}> - <Bullseye> - <h4> ConfigDB address </h4> - </Bullseye> - </FlexItem> - <FlexItem FlexItem flex={{ default: 'flex_3' }}> - <Bullseye> - <TextInput - id="config_minimal" - name="read_input" - value={this.state.configDB} - onChange={this.handleTextInputChange} - validated={this.state.configDBAvailable} - isDisabled={!this.state.inDBCheckBox} - /> - </Bullseye> - </FlexItem> - </Flex> - - </PanelMainBody> - </PanelMain> - </Panel> - </Flex> - - </React.Fragment> -);}; -} - -export {MinConfig}; \ No newline at end of file diff --git a/ui/src/Controls/OptoStatus.js b/ui/src/Controls/OptoStatus.js index fd967a9..5375b85 100644 --- a/ui/src/Controls/OptoStatus.js +++ b/ui/src/Controls/OptoStatus.js @@ -13,8 +13,6 @@ import { Icon, } from "@patternfly/react-core"; import { getPostBody, checkResponse } from "../utils/utility-functions"; -import { FormSelectInput } from "../Widgets/FormSelectInput"; -import { MyContext } from "../SimpleTabs/MyContext"; import ExclamationCircleIcon from "@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon"; import CheckCircleIcon from "@patternfly/react-icons/dist/esm/icons/check-circle-icon"; import BanIcon from "@patternfly/react-icons/dist/esm/icons/ban-icon"; diff --git a/ui/src/Controls/QuickCommands.js b/ui/src/Controls/QuickCommands.js deleted file mode 100644 index 46e8f99..0000000 --- a/ui/src/Controls/QuickCommands.js +++ /dev/null @@ -1,296 +0,0 @@ -import React from "react"; -import { - Button, - Text, - TextInput, - TextContent, - TextVariants, - PanelMainBody, - PanelMain, - Panel, - Flex, - FlexItem, - Bullseye, - Tooltip, - ValidatedOptions, - Modal, - ModalVariant -} from "@patternfly/react-core"; - -import { getPostBody, checkResponse } from '../utils/utility-functions' -import { FormSelectInputNew } from "../Widgets/FormSelectInput"; -import { SaveIcon } from '@patternfly/react-icons/dist/esm/icons/save-icon' -import { MyContext } from '../SimpleTabs/MyContext'; - -class QuickCommandsSlaves extends React.Component { - - render (){ - return( - <React.Fragment> - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>Start </Text> - </TextContent> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Button id="start_slave" variant="primary"> - Start - </Button> - </FlexItem> - </Flex> - - </PanelMainBody> - </PanelMain> - </Panel> - </React.Fragment> -);}; -} - - - - -class QuickCommands extends React.Component { - constructor(props) { - super(props); - this.state = { - isModalOpen : false, - } - this.SendCommand = () => { - /*const requestData = { - fice_G: this.props.fice_g_val, - fice_d: this.props.fice_d_val, - fice_i: this.props.fice_i_val, - fice_I: this.props.fice_I, - optoboard_serial: this.props.serial, - optoboard_version: this.props.version, - i2c_master: this.props.i2c_master_val, - components: "lpGBT_master", - reg_name: "start_registers_lpGBT1" - } - console.log(requestData);*/ - //, getPostBody(requestData) - fetch(`${this.props.backendUrl}/send_commands_wrapper`).then((response) => response.json()).then((data) => {console.log(data);} - ); - } - - this.Set_i2c = (EnableI2C) => { - const body = {} - fetch(`${this.props.backendUrl}/set_I2C_settings`, getPostBody(body)).then((response) => checkResponse(response)).then((data) => {console.log(data); if (data=="I2C configuration completed") {EnableI2C()}} - ).catch(err => {console.log(err)}); - }; - - // this.testCelery = () => { - // console.log("Start celery test") - // fetch(`${this.props.backendUrl}/testCelery_wrapper`, getPostBody({})).then((response) => response.json()).then((data) => {console.log(data);} - // ); - // }; - // <Button onClick={() => {this.testCelery()}}> CELERY </Button> - - this.handleModalToggleLaunch = (booleanValidSerial) => { - (booleanValidSerial == 'success') ? ( this.setState(({isModalOpen}) => ({ isModalOpen : false })) ) : ( this.setState(({isModalOpen}) => ({ isModalOpen : true })) ) - }; - - this.handleModalToggleOpen = () => { - this.setState(({isModalOpen}) => ({ isModalOpen : true })) - }; - - this.HandleWrongSerial = (dataBool) => { - if (dataBool) { this.setState({ validSerial : 'success'}); this.setState({ ButtonVariant : "primary" }) - } else { this.setState({validSerial : 'error'}) ; this.setState({ ButtonVariant : "danger" }) } - }; - }; - -/* - - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>Start-up</h4> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Switch isChecked={this.props.isSwitched} onChange={this.props.switchBox} onClick={() => this.SendCommand()} id={this.props.switchLabel} name={this.props.switchLabel} /> - </Bullseye> - </FlexItem> - </Flex> -*/ - -/* - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>fice -g</h4> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNew id="fice_g_i2c_master_form" items={this.props.fice_g} value={this.props.fice_g_val} onChange={this.props.onChange_fice_g}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>fice -i</h4> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNew id="fice_i_i2c_master_form" items={this.props.fice_i} value={this.props.fice_i_val} onChange={this.props.onChange_fice_i}/> - </Bullseye> - </FlexItem> - </Flex> - - - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>fice -d</h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNew id="fice_d_i2c_master_form" items={this.props.fice_d} value={this.props.fice_d_val} onChange={this.props.onChange_fice_d}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>fice -I</h4> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextInput id="fice_I_i2c_master_form" name="fice_I_i2c_master_form" value={this.props.fice_I} onChange={this.props.handleTextAddress}/> - </Bullseye> - </FlexItem> - </Flex> -*/ - - render (){ - - return( - - <React.Fragment> - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>General </Text> - </TextContent> - </Bullseye> - </FlexItem> - - </Flex> - - - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - <FlexItem flex={{ default: 'flex_2' }}> - <Bullseye> - <h4>Serial number</h4> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: 'flex_2' }}> - <Bullseye> - <MyContext.Consumer> - {({OptoSerialContext, handleModalToggleOpen}) => ( - <Button key="close" variant='tertiary' onClick={handleModalToggleOpen}> - {OptoSerialContext} - </Button> - )} - </MyContext.Consumer> - - </Bullseye> - </FlexItem> - </Flex> - - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>I2C settings</h4> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - - <MyContext.Consumer> - {({isI2C_On_Check}) => ( - <Button id="set_i2cButton" variant="primary" onClick={() => {this.Set_i2c(isI2C_On_Check);}}> - Set - </Button> - )} - </MyContext.Consumer> - - </Bullseye> - </FlexItem> - </Flex> - - </PanelMainBody> - </PanelMain> - </Panel> - </React.Fragment> - );}; -} - -export {QuickCommands, QuickCommandsSlaves}; - -/* - - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Tooltip content={<div>Save current configuration</div>}> - <Button id="saveconfig_i2c" variant="secondary"> - {<SaveIcon/>} - </Button> - </Tooltip> - </Bullseye> - </FlexItem> - -*/ - -/* - - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - - <FlexItem flex={{ default: 'flex_3' }}> - <Bullseye> - <h4>Optoboard version</h4> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <MyContext.Consumer> - {({optoVersion}) => ( - <h4> {optoVersion} </h4> - )} - </MyContext.Consumer> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_2' }}> - <Bullseye> - <h4>I2C master</h4> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNew id="i2c_master_form" items={this.props.i2c_master} value={this.props.i2c_master_val} onChange={this.props.onChange_i2c_master}/> - </Bullseye> - </FlexItem> - </Flex> - -*/ diff --git a/ui/src/Controls/WriteRead.js b/ui/src/Controls/WriteRead.js deleted file mode 100644 index 3d28f0e..0000000 --- a/ui/src/Controls/WriteRead.js +++ /dev/null @@ -1,406 +0,0 @@ -import React from "react"; -import { - Button, - Checkbox, - InputGroup, - InputGroupText, - Dropdown, - DropdownToggle, - DropdownItem, - FormSelect, - FormSelectOption, - FormSelectOptionGroup, - Text, - TextInput, - TextContent, - TextVariants, - Form, - FormGroup, - PanelMainBody, - PanelMain, - Panel, - PanelHeader, - SidebarContent, - Sidebar, - Flex, - FlexItem, - Grid, - GridItem, - Bullseye, -} from "@patternfly/react-core"; -import { getPostBody, checkResponse } from '../utils/utility-functions' - - -class WriteRead extends React.Component { - constructor(props) { - super(props); - this.state = { - value_read : "", - reg_write : "", - value_write : "", - read_back_read: "", - read_back_write: "", - }; - this.handleTextInputChange = value_read => { - this.setState({ value_read }); - }; - this.handleTextInputChange2 = reg_write => { - this.setState({ reg_write }); - }; - this.handleTextInputChange3 = value_write => { - this.setState({ value_write }); - }; - this.handleReadBack = data => { - this.setState({...this.state, read_back_read : data}); - }; - this.handleWriteReadBack = data => { - this.setState({...this.state, read_back_write : data}); - }; - this.read_device = (reg_address) => { - //var re = /[0-9A-Fa-f]{6}/g; - const requestData = { - //fice_G: this.props.fice_g, - //fice_d: this.props.fice_d, - //fice_i: this.props.fice_i, - //fice_I: this.props.fice_I, - //optoboard_serial: this.props.serial, - register: reg_address, - device: this.props.device, - //isMaster: this.props.isMaster, - //i2c_master_val: this.props.i2c_master_val, - } - - console.log(requestData) - fetch(`${this.props.backendUrl}/sendReadRequest`, getPostBody(requestData)).then((response) => checkResponse(response)).then((data) => {console.log(data); this.handleReadBack(data)} - ).catch(err => {console.log(err)}); - }; - this.write_device = (reg_address,new_reg_value) => { - const requestData = { -/* fice_G: this.props.fice_g, - fice_d: this.props.fice_d, - fice_i: this.props.fice_i, - fice_I: this.props.fice_I, - optoboard_serial: this.props.serial, - reg_addr: reg_address, - isMaster: this.props.isMaster, - i2c_master_val: this.props.i2c_master_val,*/ - device: this.props.device, - register: reg_address, - newValue: new_reg_value, - } - - console.log(requestData) - fetch(`${this.props.backendUrl}/sendWriteRequest`, getPostBody(requestData)).then((response) => checkResponse(response)).then((data) => {console.log(data); this.handleWriteReadBack(data)} - ).catch(err => {console.log(err)}); - }; - }; - - render (){ - const VariableReadBack = "hex_value" - return( - <React.Fragment> - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Grid> - - <Bullseye> - <GridItem span={7}> - <Bullseye> - <Button id="read_reg_send_command" variant="primary" onClick={() => this.read_device(this.state.value_read)}> - <h3> Read register </h3> - </Button> - </Bullseye> - </GridItem> - </Bullseye> - - <GridItem span={6}> - <Bullseye> - <h4>Address (hex)</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextInput id="read_input" name="read_input" value={this.state.value_read} onChange={this.handleTextInputChange}/> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <h4>Read back value:</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h5}>{this.state.read_back_read}</Text> - </TextContent> - </Bullseye> - </GridItem> - - </Grid> - - </PanelMainBody> - </PanelMain> - </Panel> - - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Grid> - - <Bullseye> - <GridItem span={8} rowSpan={1}> - <Bullseye> - <Button id="write_pri_send_command" variant="primary" onClick={() => this.write_device(this.state.reg_write, this.state.value_write)}> - <h3> Write register </h3> - </Button> - </Bullseye> - </GridItem> - </Bullseye> - - <GridItem span={6}> - <Bullseye> - <h4>Address</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextInput id="write_address" name="write_address" value={this.state.reg_write} onChange={this.handleTextInputChange2}/> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <h4>Value (hex)</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextInput id="write_value" name="write_value" value={this.state.value_write} onChange={this.handleTextInputChange3}/> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <h4>Read back value</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h5}>{this.state.read_back_write}</Text> - </TextContent> - </Bullseye> - </GridItem> - </Grid> - - </PanelMainBody> - </PanelMain> - </Panel> - </React.Fragment> -);}; -} - - - -class WriteReadHorizontal extends React.Component { - constructor(props) { - super(props); - this.state = { - value_read : "", - reg_write : "", - value_write : "", - read_back_read: "-_-", - read_back_write: "-_-", - }; - this.handleTextInputChange = value_read => { - this.setState({ value_read }); - }; - this.handleTextInputChange2 = reg_write => { - this.setState({ reg_write }); - }; - this.handleTextInputChange3 = value_write => { - this.setState({ value_write }); - }; - this.handleReadBack = data => { - this.setState({...this.state, read_back_read : data}); - }; - this.handleWriteReadBack = data => { - this.setState({...this.state, read_back_write : data}); - }; - this.read_device = (reg_address) => { - //var re = /[0-9A-Fa-f]{6}/g; - const requestData = { - //fice_G: this.props.fice_g, - //fice_d: this.props.fice_d, - //fice_i: this.props.fice_i, - //fice_I: this.props.fice_I, - //optoboard_serial: this.props.serial, - register: reg_address, - device: this.props.device, - //isMaster: this.props.isMaster, - //i2c_master_val: this.props.i2c_master_val, - } - - console.log(requestData) - fetch(`${this.props.backendUrl}/sendReadRequest`, getPostBody(requestData)).then((response) => checkResponse(response)).then((data) => {console.log(data); this.handleReadBack(data)} - ).catch(err => {console.log(err)}); - }; - this.write_device = (reg_address,new_reg_value) => { - const requestData = { -/* fice_G: this.props.fice_g, - fice_d: this.props.fice_d, - fice_i: this.props.fice_i, - fice_I: this.props.fice_I, - optoboard_serial: this.props.serial, - reg_addr: reg_address, - isMaster: this.props.isMaster, - i2c_master_val: this.props.i2c_master_val,*/ - device: this.props.device, - register: reg_address, - newValue: new_reg_value, - } - - console.log(requestData) - fetch(`${this.props.backendUrl}/sendWriteRequest`, getPostBody(requestData)).then((response) => checkResponse(response)).then((data) => {console.log(data); this.handleWriteReadBack(data)} - ).catch(err => {console.log(err)}); - }; - }; - - render (){ - const VariableReadBack = "hex_value" - return( - <React.Fragment> - - <Flex> - <FlexItem flex={{ default: 'flex_1' }}> - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Bullseye> - <Flex> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Button id="read_reg_send_command" variant="primary" onClick={() => this.read_device(this.state.value_read)}> - <h3> Read register </h3> - </Button> - </Bullseye> - </FlexItem> - </Flex> - </Bullseye> - - <Flex> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>Address </h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextInput id="read_input" name="read_input" value={this.state.value_read} onChange={this.handleTextInputChange}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_2' }}> - <Bullseye> - <h4>Read back value:</h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h5}>{this.state.read_back_read}</Text> - </TextContent> - </Bullseye> - </FlexItem> - - </Flex> - - </PanelMainBody> - </PanelMain> - </Panel> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Bullseye> - <Flex> - <Bullseye> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Button id="write_pri_send_command" variant="primary" onClick={() => this.write_device(this.state.reg_write, this.state.value_write)}> - <h3> Write register </h3> - </Button> - </Bullseye> - </FlexItem> - </Bullseye> - </Flex> - </Bullseye> - - <Flex> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>Address </h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextInput id="write_address" name="write_address" value={this.state.reg_write} onChange={this.handleTextInputChange2}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>Value </h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextInput id="write_value" name="write_value" value={this.state.value_write} onChange={this.handleTextInputChange3}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_2' }}> - <Bullseye> - <h4>Read back value</h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h5}>{this.state.read_back_write}</Text> - </TextContent> - </Bullseye> - </FlexItem> - </Flex> - - </PanelMainBody> - </PanelMain> - </Panel> - </FlexItem> - - </Flex> - </React.Fragment> -);}; -} - -export {WriteRead, WriteReadHorizontal}; diff --git a/ui/src/Controls/WriteRead4User.js b/ui/src/Controls/WriteRead4User.js deleted file mode 100644 index d8b1e38..0000000 --- a/ui/src/Controls/WriteRead4User.js +++ /dev/null @@ -1,442 +0,0 @@ -import React from "react"; -import { - Button, - Checkbox, - InputGroup, - InputGroupText, - Dropdown, - DropdownToggle, - DropdownItem, - FormSelect, - FormSelectOption, - FormSelectOptionGroup, - Text, - TextInput, - TextContent, - TextVariants, - Form, - FormGroup, - PanelMainBody, - PanelMain, - Panel, - PanelHeader, - SidebarContent, - Sidebar, - Flex, - FlexItem, - Grid, - GridItem, - Bullseye, - Tooltip, -} from "@patternfly/react-core"; - -import { getPostBody, checkResponse } from '../utils/utility-functions' -import { FormSelectInputNewer } from "../Widgets/FormSelectInput"; - - -class WriteRead4User extends React.Component { - constructor(props) { - super(props); - this.state = { - - device_val : 0, - device : [ - { label: 'lpgbt1', disabled: false, value: '0'}, - { label: 'lpgbt2', disabled: false, value: '1'}, - { label: 'lpgbt3', disabled: false, value: '2'}, - { label: 'lpgbt4', disabled: false, value: '3'}, - { label: 'gbcr1', disabled: false, value: '4'}, - { label: 'gbcr2', disabled: false, value: '5'}, - { label: 'gbcr3', disabled: false, value: '6'}, - { label: 'gbcr4', disabled: false, value: '7'}, - ], - - value_read : "", - reg_write : "", - value_write : "", - read_back_read: "", - read_back_write: "", - }; - - this.onChange_device = (device_val) => { - this.setState({ device_val : device_val }); - console.log(device_val); - }; - - this.handleTextInputChange = value_read => { - this.setState({ value_read }); - }; - this.handleTextInputChange2 = reg_write => { - this.setState({ reg_write }); - }; - this.handleTextInputChange3 = value_write => { - this.setState({ value_write }); - }; - this.handleReadBack = data => { - this.setState({...this.state, read_back_read : data}); - }; - this.handleWriteReadBack = data => { - this.setState({...this.state, read_back_write : data}); - }; - this.read_device = (reg_address) => { - //var re = /[0-9A-Fa-f]{6}/g; - const requestData = { - register: reg_address, - device: this.state.device[this.state.device_val].label, - } - - console.log(requestData) - fetch(`${this.props.backendUrl}/sendReadRequest`, getPostBody(requestData)).then((response) => checkResponse(response)).then((data) => {console.log(data); this.handleReadBack(data)} - ).catch(err => {console.log(err)}); - }; - this.write_device = (reg_address,new_reg_value) => { - const requestData = { - device: this.state.device[this.state.device_val].label, - register: reg_address, - newValue: new_reg_value, - } - - console.log(requestData) - fetch(`${this.props.backendUrl}/sendWriteRequest`, getPostBody(requestData)).then((response) => checkResponse(response)).then((data) => {console.log(data); this.handleWriteReadBack(data)} - ).catch(err => {console.log(err)}); - }; - }; - - - render (){ - - return( - <React.Fragment> - - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Grid> - <Bullseye> - <GridItem span={7}> - <Bullseye> - <h4> Select the device: </h4> - </Bullseye> - </GridItem> - - <GridItem span={5}> - <Bullseye> - <FormSelectInputNewer id={"selectDeviceSimplePanelRead"} items={this.state.device} value={this.state.device_val} onChange={this.onChange_device}/> - </Bullseye> - </GridItem> - </Bullseye> - </Grid> - - </PanelMainBody> - </PanelMain> - </Panel> - - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Grid> - - <Bullseye> - <GridItem span={8}> - <Bullseye> - <Tooltip content={ <div>Use rom register for testing. In lpgbt v1 the return has to be 166. </div> }> - <Button id="read_reg_send_command" variant="primary" onClick={() => this.read_device(this.state.value_read)}> - <h3> Read register </h3> - </Button> - </Tooltip> - </Bullseye> - </GridItem> - </Bullseye> - - - <GridItem span={6}> - <Bullseye> - <h4>Address (hex)</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextInput id="read_input" name="read_input" value={this.state.value_read} onChange={this.handleTextInputChange}/> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <h4>Read back value:</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h5}>{this.state.read_back_read}</Text> - </TextContent> - </Bullseye> - </GridItem> - - </Grid> - - </PanelMainBody> - </PanelMain> - </Panel> - - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Grid> - - <Bullseye> - <GridItem span={8} rowSpan={1}> - <Bullseye> - <Button id="write_pri_send_command" variant="primary" onClick={() => this.write_device(this.state.reg_write, this.state.value_write)}> - <h3> Write register </h3> - </Button> - </Bullseye> - </GridItem> - </Bullseye> - - <GridItem span={6}> - <Bullseye> - <h4>Address</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextInput id="write_address" name="write_address" value={this.state.reg_write} onChange={this.handleTextInputChange2}/> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <h4>Value (hex)</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextInput id="write_value" name="write_value" value={this.state.value_write} onChange={this.handleTextInputChange3}/> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <h4>Read back value</h4> - </Bullseye> - </GridItem> - - <GridItem span={6}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h5}>{this.state.read_back_write}</Text> - </TextContent> - </Bullseye> - </GridItem> - </Grid> - - </PanelMainBody> - </PanelMain> - </Panel> - </React.Fragment> -);}; -} - - - -class WriteReadHorizontal extends React.Component { - constructor(props) { - super(props); - this.state = { - value_read : "", - reg_write : "", - value_write : "", - read_back_read: "-_-", - read_back_write: "-_-", - }; - this.handleTextInputChange = value_read => { - this.setState({ value_read }); - }; - this.handleTextInputChange2 = reg_write => { - this.setState({ reg_write }); - }; - this.handleTextInputChange3 = value_write => { - this.setState({ value_write }); - }; - this.handleReadBack = data => { - this.setState({...this.state, read_back_read : data}); - }; - this.handleWriteReadBack = data => { - this.setState({...this.state, read_back_write : data}); - }; - this.read_device = (reg_address) => { - //var re = /[0-9A-Fa-f]{6}/g; - const requestData = { - //fice_G: this.props.fice_g, - //fice_d: this.props.fice_d, - //fice_i: this.props.fice_i, - //fice_I: this.props.fice_I, - //optoboard_serial: this.props.serial, - register: reg_address, - device: this.props.device, - //isMaster: this.props.isMaster, - //i2c_master_val: this.props.i2c_master_val, - } - - console.log(requestData) - fetch(`${this.props.backendUrl}/sendReadRequest`, getPostBody(requestData)).then((response) => checkResponse(response)).then((data) => {console.log(data); this.handleReadBack(data)} - ).catch(err => {console.log(err)}); - }; - this.write_device = (reg_address,new_reg_value) => { - const requestData = { -/* fice_G: this.props.fice_g, - fice_d: this.props.fice_d, - fice_i: this.props.fice_i, - fice_I: this.props.fice_I, - optoboard_serial: this.props.serial, - reg_addr: reg_address, - isMaster: this.props.isMaster, - i2c_master_val: this.props.i2c_master_val,*/ - device: this.props.device, - register: reg_address, - newValue: new_reg_value, - } - - console.log(requestData) - fetch(`${this.props.backendUrl}/sendWriteRequest`, getPostBody(requestData)).then((response) => checkResponse(response)).then((data) => {console.log(data); this.handleWriteReadBack(data)} - ).catch(err => {console.log(err)}); - }; - }; - - render (){ - const VariableReadBack = "hex_value" - return( - <React.Fragment> - - <Flex> - <FlexItem flex={{ default: 'flex_1' }}> - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Bullseye> - <Flex> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Button id="read_reg_send_command" variant="primary" onClick={() => this.read_device(this.state.value_read)}> - <h3> Read register </h3> - </Button> - </Bullseye> - </FlexItem> - </Flex> - </Bullseye> - - <Flex> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>Address </h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextInput id="read_input" name="read_input" value={this.state.value_read} onChange={this.handleTextInputChange}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_2' }}> - <Bullseye> - <h4>Read back value:</h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h5}>{this.state.read_back_read}</Text> - </TextContent> - </Bullseye> - </FlexItem> - - </Flex> - - </PanelMainBody> - </PanelMain> - </Panel> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Bullseye> - <Flex> - <Bullseye> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Button id="write_pri_send_command" variant="primary" onClick={() => this.write_device(this.state.reg_write, this.state.value_write)}> - <h3> Write register </h3> - </Button> - </Bullseye> - </FlexItem> - </Bullseye> - </Flex> - </Bullseye> - - <Flex> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>Address </h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextInput id="write_address" name="write_address" value={this.state.reg_write} onChange={this.handleTextInputChange2}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>Value </h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextInput id="write_value" name="write_value" value={this.state.value_write} onChange={this.handleTextInputChange3}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_2' }}> - <Bullseye> - <h4>Read back value</h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h5}>{this.state.read_back_write}</Text> - </TextContent> - </Bullseye> - </FlexItem> - </Flex> - - </PanelMainBody> - </PanelMain> - </Panel> - </FlexItem> - - </Flex> - </React.Fragment> -);}; -} - -export {WriteRead4User, WriteReadHorizontal}; diff --git a/ui/src/Controls/WriteReadBox.js b/ui/src/Controls/WriteReadBox.js index 45ef8ba..5c58488 100644 --- a/ui/src/Controls/WriteReadBox.js +++ b/ui/src/Controls/WriteReadBox.js @@ -12,11 +12,12 @@ import { Select, SelectOption, SelectVariant, + FormSelect, + FormSelectOption, } from "@patternfly/react-core"; import { getPostBody, checkResponse } from "../utils/utility-functions"; -import { FormSelectInputNewer } from "../Widgets/FormSelectInput"; -import { Registers } from "../SimpleTabs/Registers"; +import { Registers } from "../Config/Registers"; export function WriteReadBox({ backendUrl, @@ -235,12 +236,20 @@ export function WriteReadBox({ <FlexItem> <Bullseye> - <FormSelectInputNewer + <FormSelect id={"selectDeviceSimplePanelRead"} items={device} - value={device_val} onChange={(x) => setdevice_val(x)} - /> + > + {device.map((option, index) => ( + <FormSelectOption + isDisabled={option.disabled} + key={index} + value={option.value} + label={option.label} + /> + ))} + </FormSelect> </Bullseye> </FlexItem> </Bullseye> diff --git a/ui/src/SimpleTabs/DevelPanel.js b/ui/src/SimpleTabs/DevelPanel.js deleted file mode 100644 index 7911865..0000000 --- a/ui/src/SimpleTabs/DevelPanel.js +++ /dev/null @@ -1,72 +0,0 @@ -import React, { useState, useEffect } from "react"; -import { - Checkbox, - Skeleton, - Tab, - Tabs, - TabTitleText, - Text, - TextContent, - TextVariants, - Grid, - GridItem, - PageSection, - Page,Bullseye,TextInput, Panel, PanelHeader, Button, Modal, ModalVariant, ValidatedOptions, - Switch, - } from "@patternfly/react-core"; - - import {CommonlpGBT, MasterlpGBT, Placeholder} from "../SimpleTabs/lpGBT_pannel"; - import {ELinks} from "../SimpleTabs/eLinks"; - import { GBCRpannel } from "../SimpleTabs/GBCR"; - import { getPostBody, checkResponse } from '../utils/utility-functions' - import { MyContext, isI2C_On, OptoSerialContext, myFileCon } from '../SimpleTabs/MyContext'; - - import { FormSelectInputNewer } from "../Widgets/FormSelectInput"; - import { SimplePanel } from '../SimpleTabs/SimplePanel'; - - import { LoggingViewer } from '@itk-demo-sw/components'; - import { useLoggingViewer } from '@itk-demo-sw/hooks'; - -export function DevelPanel({url, OpenDevel, setOpenDevel}){ - - const ConfigurationFile = myFileCon; - const [activeTabKey, setactivaTabKey] = useState(0); - const tabs = [ - {tabName : "lpGBT1 (master)", content : <MasterlpGBT lpGBTNum={"1"} deviceAddress={"0x074"} backendUrl={url} isI2C_On_Check={true} ConfigurationFile={ConfigurationFile}/>}, - {tabName :"ePortClk", content: <ELinks backendUrl={url} ConfigurationFile={ConfigurationFile}/>}, - {tabName :"GBCR1", content: <GBCRpannel GBCRnum={"1"} backendUrl={url} ConfigurationFile={ConfigurationFile}/>}, - {tabName :"lpGBT2 (slave)", content: <CommonlpGBT lpGBTNum={"2"} deviceAddress={"0x075"} backendUrl={url} ConfigurationFile={ConfigurationFile}/>}, - {tabName :"GBCR2", content: <GBCRpannel GBCRnum={"2"} backendUrl={url} ConfigurationFile={ConfigurationFile}/>}, - {tabName :"lpGBT3 (slave)", content: <CommonlpGBT lpGBTNum={"3"} deviceAddress={"0x076"} backendUrl={url} ConfigurationFile={ConfigurationFile}/>}, - {tabName :"GBCR3", content: <GBCRpannel GBCRnum={"3"} backendUrl={url} ConfigurationFile={ConfigurationFile}/>}, - {tabName :"lpGBT4 (slave)", content: <CommonlpGBT lpGBTNum={"4"} deviceAddress={"0x077"} backendUrl={url} ConfigurationFile={ConfigurationFile}/>}, - {tabName :"GBCR4", content: <GBCRpannel GBCRnum={"4"} backendUrl={url} ConfigurationFile={ConfigurationFile}/>}, - {tabName :"VTRX", content: <Placeholder />}, - ]; - - - return( - - <Modal - width="90%" - title="Advanced commands" - isOpen={OpenDevel} - showClose = {true} - onClose={() => setOpenDevel(!OpenDevel)} - actions={[ - <Button key="cancel" variant="link" onClick={() => {setOpenDevel(!OpenDevel)}}> - Cancel - </Button>, - ]} - > - <Tabs activeKey={activeTabKey} onSelect={(event, tabIndex) => {setactivaTabKey(tabIndex)}} isBox={true}> - {tabs.map((tab, index) => ( - <Tab eventKey={index} title={<TabTitleText>{tab.tabName}</TabTitleText>}> - {tab.content} - </Tab> - ))} - </Tabs> - </Modal> - - ) -}; diff --git a/ui/src/SimpleTabs/MyContext.js b/ui/src/SimpleTabs/MyContext.js deleted file mode 100644 index 497790d..0000000 --- a/ui/src/SimpleTabs/MyContext.js +++ /dev/null @@ -1,18 +0,0 @@ -import React from "react"; -import myFile from "../Config/00000000_test_v1.json"; - -export const isI2C_On = false; -export const OptoSerialContext = "00000000"; -export const myFileCon = myFile; -export const MyContext = React.createContext({ - isI2C_On: isI2C_On, - isI2C_On_Check: () => {}, - OptoSerialContext: OptoSerialContext, - handleModalToggleOpen: () => {}, - optoVersion: "", - lpgbtVersion: "", - fetchDataSet: () => {}, - myFileConfig: myFileCon, -}); - -export const MyContextTestPattern = React.createContext({ isI2C_On: isI2C_On }); diff --git a/ui/src/SimpleTabs/OptoboardGUI.js b/ui/src/SimpleTabs/OptoboardGUI.js index 21b2dfc..e0c00e7 100644 --- a/ui/src/SimpleTabs/OptoboardGUI.js +++ b/ui/src/SimpleTabs/OptoboardGUI.js @@ -1,15 +1,12 @@ import React, { useState, useEffect } from "react"; import { SimpleList, SimpleListItem } from "@patternfly/react-core"; -import { WriteReadBox } from "../Controls/WriteReadBox"; import { Config } from "../Controls/Config"; import { defaultConfig, Configurations, OptoInfo, -} from "../SimpleTabs/Configurations"; +} from "../Config/Configurations"; import { OptoboardList } from "../SimpleTabs/OptoboardList"; -import { OptoStatus } from "../Controls/OptoStatus"; -import { DevelPanel } from "../SimpleTabs/DevelPanel"; import { AddOptoboard } from "../SimpleTabs/AddOptoboard"; import { @@ -34,16 +31,6 @@ import { Switch, FormSelect, FormSelectOption, - Checkbox, - Icon, - Drawer, - DrawerPanelContent, - DrawerContent, - DrawerContentBody, - DrawerHead, - DrawerActions, - DrawerCloseButton, - Spinner, NotificationDrawer, NotificationDrawerHeader, NotificationDrawerBody, diff --git a/ui/src/SimpleTabs/OptoboardList.js b/ui/src/SimpleTabs/OptoboardList.js index d6352f5..6bbe279 100644 --- a/ui/src/SimpleTabs/OptoboardList.js +++ b/ui/src/SimpleTabs/OptoboardList.js @@ -1,14 +1,12 @@ import React, { useState, useEffect } from "react"; -import { SimpleList, SimpleListItem } from "@patternfly/react-core"; import { WriteReadBox } from "../Controls/WriteReadBox"; import { Config } from "../Controls/Config"; import { defaultConfig, Configurations, OptoInfo, -} from "../SimpleTabs/Configurations"; +} from "../Config/Configurations"; import { OptoStatus } from "../Controls/OptoStatus"; -import { DevelPanel } from "../SimpleTabs/DevelPanel"; import { AddOptoboard } from "../SimpleTabs/AddOptoboard"; import { diff --git a/ui/src/SimpleTabs/SimplePanel.js b/ui/src/SimpleTabs/SimplePanel.js deleted file mode 100644 index 8e96893..0000000 --- a/ui/src/SimpleTabs/SimplePanel.js +++ /dev/null @@ -1,67 +0,0 @@ -import React from "react"; - -import { QuickCommands, QuickCommandsSlaves } from "../Controls/QuickCommands"; -import { WriteRead4User } from "../Controls/WriteRead4User"; -import { MinConfig } from "../Controls/MinConfig"; - -import { - Checkbox, - Skeleton, - Tab, - Tabs, - TabTitleText, - Text, - TextContent, - TextVariants, - Grid, - GridItem, - PageSection, - Page, - Bullseye, - TextInput, - Panel, - PanelHeader, - Button, - Flex, - FlexItem, - Tooltip, - Modal, - ModalVariant, - PanelMainBody, - PanelMain, - PanelBody, -} from "@patternfly/react-core"; - -import { getPostBody, checkResponse } from "../utils/utility-functions"; - -class SimplePanel extends React.Component { - constructor(props) { - super(props); - } - - render() { - return ( - <React.Fragment> - <Page> - <PageSection> - <Flex> - <FlexItem flex={{ default: "flex_2" }}> - <QuickCommands backendUrl={this.props.backendUrl} /> - </FlexItem> - - <FlexItem flex={{ default: "flex_2" }}> - <WriteRead4User backendUrl={this.props.backendUrl} /> - </FlexItem> - - <FlexItem flex={{ default: "flex_2" }}> - <MinConfig backendUrl={this.props.backendUrl} /> - </FlexItem> - </Flex> - </PageSection> - </Page> - </React.Fragment> - ); - } -} - -export { SimplePanel }; diff --git a/ui/src/SimpleTabs/SimpleTabs.js b/ui/src/SimpleTabs/SimpleTabs.js deleted file mode 100644 index 620ce6f..0000000 --- a/ui/src/SimpleTabs/SimpleTabs.js +++ /dev/null @@ -1,411 +0,0 @@ -import React, { useState, useEffect } from "react"; - -import { - Checkbox, - Skeleton, - Tab, - Tabs, - TabTitleText, - Text, - TextContent, - TextVariants, - Grid, - GridItem, - PageSection, - Page, - Bullseye, - TextInput, - Panel, - PanelHeader, - Button, - Modal, - ModalVariant, - ValidatedOptions, - Switch, -} from "@patternfly/react-core"; - -import { - CommonlpGBT, - MasterlpGBT, - Placeholder, -} from "../SimpleTabs/lpGBT_pannel"; -import { ELinks } from "../SimpleTabs/eLinks"; -import { GBCRpannel } from "../SimpleTabs/GBCR"; -import { getPostBody, checkResponse } from "../utils/utility-functions"; -import { - MyContext, - isI2C_On, - OptoSerialContext, - myFileCon, -} from "../SimpleTabs/MyContext"; - -import { FormSelectInputNewer } from "../Widgets/FormSelectInput"; -import { SimplePanel } from "../SimpleTabs/SimplePanel"; - -import { LoggingViewer } from "@itk-demo-sw/components"; -import { useLoggingViewer } from "@itk-demo-sw/hooks"; - -function SimpleTabs(props) { - const [activeTabKey, handleTabClick] = useState(0); - const [vtrx_v_val, onChange_vtrx_v] = useState(0); - const [flx_G, onChange_flx_G] = useState(0); - const [flx_d, onChange_flx_d] = useState(0); - const [withoutFelixcore, onChange_withoutFelixcore] = useState(false); - const [CheckisBox_debug, toggleBox_debug] = useState(false); - const [developermode, SwitchChange] = useState(false); - const [testmode, SwitchTestModeChange] = useState(); - const [isModalOpen, handleModalToggleOpen] = useState(); - const [isI2C_On, isI2C_On_Checked] = useState(isI2C_On); - const [optoVersion, optoVersionChange] = useState(""); - const [lpgbtVersion, lpgbtVersionChange] = useState(""); - const [validSerial, validSerialChange] = useState("success"); - const [ButtonVariant, ButtonVariantChange] = useState("primary"); - const [optoSerial, optoSerialChange] = useState(OptoSerialContext); - const [activeGbcr, activeGbcrChange] = useState("0000"); - const [activeLpgbt, activeLpgbtChange] = useState("0000"); - const [CheckisBox, CheckisBoxChange] = useState(false); - const [validConfigPath, validConfigPathChange] = useState("success"); - const [configDBAvailable, configDBAvailableChange] = useState("warning"); - const [ConfigurationDB, ConfigurationDBChange] = useState( - "http://localhost:5000" - ); - const [ConfigurationPath, ConfigurationPathChange] = useState( - "/itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json" - ); - - const CheckbuttonLabel = "Check in the database"; - const ConfigurationFile = myFileCon; - const vtrx_v = [ - { label: "1.2", disabled: false, value: 0 }, - { label: "1.3", disabled: false, value: 1 }, - ]; - - const isI2C_On_Check = () => { - isI2C_On_Checked(true); - console.log("Enabling I2C bus!!"); - }; - - const fetchDataSet = (name, vtrx_v, inDB) => { - const requestData = { - name: name, - vtrx_v: vtrx_v, - inDB: inDB ? 1 : 0, - }; - fetch(`${props.backendUrl}/config_file_provider`, getPostBody(requestData)) - .then((response) => checkResponse(response)) - .then((data) => { - this.setState({ ConfigurationFile: JSON.parse(data) }); - console.log(JSON.parse(data)); - }); - }; - - const onChange_ConfigurationDB = (newname) => { - ConfigurationDBChange(newname); - fetch( - `${this.props.backendUrl}/configDbUnavailable_wrapper`, - getPostBody({ CONFIGDB_ADDRESS: newname }) - ) - .then((response) => checkResponse(response)) - .then((data) => { - console.log(data); - if (data) { - configDBAvailableChange("error"); - ButtonVariantChange("danger"); - } else { - configDBAvailableChange("success"); - ButtonVariantChange("primary"); - } - }); - }; - - const toggleBox = (checked) => { - CheckisBoxChange(checked); - if (checked) { - onChange_ConfigurationDB(ConfigurationDB); - } else { - if (validSerial == "success" && validConfigPath == "success") { - ButtonVariantChange("primary"); - } - } - }; - - const onChange_ConfigurationPath = (newConfigurationPath) => { - ConfigurationPathChange(newConfigurationPath); - fetch( - `${this.props.backendUrl}/checkAvailableDatasetInDB`, - getPostBody({ - path: newConfigurationPath, - inDB: CheckisBox, - CONFIGDB_ADDRESS: ConfigurationDB, - }) - ) - .then((response) => checkResponse(response)) - .then((data) => { - console.log(data); - if (data == 1) { - validConfigPathChange("success"); - ButtonVariantChange("primary"); - } else { - validConfigPathChange("error"); - ButtonVariantChange("danger"); - } - }); - }; - - return <p>You clicked 55 times</p>; - - /* - const handleModalToggleLaunch = () => { - optoSerChanger(optoSerial); - (ButtonVariant == 'primary') ? ( handleModalToggleOpen(false) ) : ( handleModalToggleOpen(true) ); - }; - - - - const optoSerChanger = (optoSerial) => { - optoSerialChange(optoSerial) - - let HandleWrongSerial = (dataObj) => { - let dataBool = dataObj['boolSerial'] - if (dataBool) { validSerialChange('success'); ButtonVariantChange("primary"); lpgbtVersionChange(dataObj['lpgbt_v']); optoVersionChange(dataObj['optoboard_version']); this.setState({ activeLpgbt : dataObj['activeLpgbt']}); this.setState({ activeGbcr : dataObj['activeGbcr']}); - } else { validSerialChange('error'); ButtonVariantChange("danger") } - }; - - const requestData = { - optoserial: optoSerial, - config_path: this.state.ConfigurationPath, - vtrx_v : this.state.vtrx_v_val==0 ? "1.2" : "1.3", - flx_G : this.state.flx_G, - flx_d : this.state.flx_d, - woflxcore : this.state.withoutFelixcore, - configInDB: this.state.CheckisBox, - CONFIGDB_ADDRESS: ConfigurationDB, - debug: this.state.CheckisBox_debug, - testmode: this.state.testmode - } - console.log(requestData); - fetch(`${this.props.backendUrl}/initializeOptoboard`, getPostBody(requestData)).then((response) => checkResponse(response)).then((data) => {console.log(data); HandleWrongSerial(data)}); - }; - - let tabsWithSlaves = [ - {tabName : "lpGBT1 (master)", content : <MasterlpGBT lpGBTNum={"1"} deviceAddress={"0x074"} backendUrl={this.props.backendUrl} isI2C_On_Check={this.isI2C_On_Check} ConfigurationFile={this.state.ConfigurationFile}/>}, - {tabName :"ePortClk", content: <ELinks backendUrl={this.props.backendUrl} ConfigurationFile={this.state.ConfigurationFile}/>}, - {tabName :"GBCR1", content: <GBCRpannel GBCRnum={"1"} backendUrl={this.props.backendUrl} ConfigurationFile={this.state.ConfigurationFile}/>}, - {tabName :"lpGBT2 (slave)", content: <CommonlpGBT lpGBTNum={"2"} deviceAddress={"0x075"} backendUrl={this.props.backendUrl} ConfigurationFile={this.state.ConfigurationFile}/>}, - {tabName :"GBCR2", content: <GBCRpannel GBCRnum={"2"} backendUrl={this.props.backendUrl} ConfigurationFile={this.state.ConfigurationFile}/>}, - {tabName :"lpGBT3 (slave)", content: <CommonlpGBT lpGBTNum={"3"} deviceAddress={"0x076"} backendUrl={this.props.backendUrl} ConfigurationFile={this.state.ConfigurationFile}/>}, - {tabName :"GBCR3", content: <GBCRpannel GBCRnum={"3"} backendUrl={this.props.backendUrl} ConfigurationFile={this.state.ConfigurationFile}/>}, - {tabName :"lpGBT4 (slave)", content: <CommonlpGBT lpGBTNum={"4"} deviceAddress={"0x077"} backendUrl={this.props.backendUrl} ConfigurationFile={this.state.ConfigurationFile}/>}, - {tabName :"GBCR4", content: <GBCRpannel GBCRnum={"4"} backendUrl={this.props.backendUrl} ConfigurationFile={this.state.ConfigurationFile}/>}, - {tabName :"VTRX", content: <Placeholder />}, - {tabName :"LpGTB1 direct", content: <Placeholder />}, - {tabName :"LpGTB2 direct", content: <Placeholder />}, - {tabName :"LpGTB3 direct", content: <Placeholder />}, - {tabName :"LpGTB4 direct", content: <Placeholder />}, - {tabName :"Test outputs", content: <Placeholder />}, - ]; - - let tabsMaster = [ - {tabName : "lpGBT1 (master)", content : <MasterlpGBT lpGBTNum={"1"} deviceAddress={"0x074"} backendUrl={this.props.backendUrl} ConfigurationFile={this.state.ConfigurationFile}/>}, - ]; - - let tabs = this.state.isI2C_On ? tabsWithSlaves : tabsMaster; - - let myContextVar = { isI2C_On : this.state.isI2C_On, - isI2C_On_Check : this.isI2C_On_Check, - OptoSerialContext : optoSerial, - handleModalToggleOpen : this.handleModalToggleOpen, - optoVersion : optoVersion, - lpgbtVersion : lpgbtVersion, - fetchDataSet : this.fetchDataSet, - myFileConfig : this.state.ConfigurationFile, - }; - - - let enable = this.state.CheckisBox ? 0 : 1; - - let OptoGUI_debug = this.state.developermode ? <Tabs activeKey={this.state.activeTabKey} onSelect={this.handleTabClick} isBox={this.state.isBox}> - {tabs.map((tab, index) => ( - <Tab eventKey={index} title={<TabTitleText>{tab.tabName}</TabTitleText>}> - {tab.content} - </Tab> - ))} - </Tabs> : <SimplePanel backendUrl={this.props.backendUrl}/> -*/ -} - -/*}; - -################################################ -*/ - -/* -return ( - <React.Fragment> - - <MyContext.Provider value={myContextVar}> - - <Modal - variant={ModalVariant.medium} - title="Initialize the Optoboard" - isOpen={this.state.isModalOpen} - showClose = {false} - actions={[ - <Button key="close" variant={ButtonVariant} onClick={this.handleModalToggleLaunch}> - Launch Optoboard GUI - </Button>, - <Switch id={"test_mode"} label="test mode" isChecked={this.state.testmode} onChange={this.SwitchTestModeChange} - isReversed - />, - ]} - > - <Grid hasGutter> - <GridItem span={3}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>Serial Number</Text> - </TextContent> - </Bullseye> - </GridItem> - <GridItem span={3}> - <TextInput id="optoserial" name="Optoboard Serial Number" value={optoSerial} onChange={this.optoSerChanger} validated={validSerial}/> - </GridItem> - <GridItem span={3}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>Vtrx</Text> - </TextContent> - </Bullseye> - </GridItem> - <GridItem span={3}> - <FormSelectInputNewer id={'vtrx_v_id'} items={vtrx_v} value={vtrx_v_val} onChange={this.onChange_vtrx_v}/> - </GridItem> - - <GridItem span={2}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>flx_G</Text> - </TextContent> - </Bullseye> - </GridItem> - <GridItem span={2}> - <TextInput id="flx_G_id" name="flx_G" value={this.state.flx_G} onChange={this.onChange_flx_G}/> - </GridItem> - <GridItem span={2}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>flx_d</Text> - </TextContent> - </Bullseye> - </GridItem> - <GridItem span={2}> - <TextInput id="flx_d" name="flx_d" value={this.state.flx_d} onChange={this.onChange_flx_d}/> - </GridItem> - <GridItem span={4}> - <Bullseye> - <Checkbox label={"without felixcore"} isChecked={this.state.withoutFelixcore} onChange={this.onChange_withoutFelixcore} id={"without felixcore"} name={"without felixcore"}/> - </Bullseye> - </GridItem> - - <GridItem span={3}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>Configuration File</Text> - </TextContent> - </Bullseye> - </GridItem> - <GridItem span={6}> - <TextInput id="ConfFile" name="ConfFile" value={ConfigurationPath} onChange={this.onChange_ConfigurationPath} validated={validConfigPath}/> - </GridItem> - <GridItem span={3}> - <Checkbox label={this.state.CheckbuttonLabel} isChecked={this.state.CheckisBox} onChange={this.toggleBox} id={this.state.CheckbuttonLabel} name={this.state.CheckbuttonLabel}/> - </GridItem> - - <GridItem span={3}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>Configuration DB</Text> - </TextContent> - </Bullseye> - </GridItem> - <GridItem span={5}> - <TextInput id="Configuration DB" name="Configuration DB" value={ConfigurationDB} onChange={this.onChange_ConfigurationDB} isDisabled={enable} validated={configDBAvailable}/> - </GridItem> - <GridItem span={2}> - <Checkbox label={"debug"} isChecked={this.state.CheckisBox_debug} onChange={this.toggleBox_debug} id={"debug"} name={"debug"}/> - </GridItem> - <GridItem span={2}> - <Checkbox id="developer_mode" - label="developer mode" - isChecked={this.state.developermode} - onChange={this.SwitchChange} /> - </GridItem> - </Grid> - </Modal> - - {OptoGUI_debug} - - </MyContext.Provider> - - - </React.Fragment> -); -}; - -*/ -/* -class TabsAlternative extends React.Component { - constructor(props) { - super(props); - this.state = { - isBox : true, - activeTabKey : 0, - }; - - this.handleTabClick = (event, tabIndex) => { - this.setState({ - activeTabKey: tabIndex - }); - }; - } - - render() { - - let tabsWithSlaves = [ - {tabName : "lpGBT1 (master)", content : <MasterlpGBT lpGBTNum={"1"} deviceAddress={"0x074"} backendUrl={this.props.backendUrl} isI2C_On_Check={this.isI2C_On_Check} ConfigurationFile={this.state.ConfigurationFile}/>}, - {tabName :"ePortClk", content: <ELinks backendUrl={this.props.backendUrl} ConfigurationFile={this.state.ConfigurationFile}/>}, - {tabName :"GBCR1", content: <GBCRpannel GBCRnum={"1"} backendUrl={this.props.backendUrl} ConfigurationFile={this.state.ConfigurationFile}/>}, - {tabName :"lpGBT2 (slave)", content: <CommonlpGBT lpGBTNum={"2"} deviceAddress={"0x075"} backendUrl={this.props.backendUrl} ConfigurationFile={this.state.ConfigurationFile}/>}, - {tabName :"GBCR2", content: <GBCRpannel GBCRnum={"2"} backendUrl={this.props.backendUrl} ConfigurationFile={this.state.ConfigurationFile}/>}, - {tabName :"lpGBT3 (slave)", content: <CommonlpGBT lpGBTNum={"3"} deviceAddress={"0x076"} backendUrl={this.props.backendUrl} ConfigurationFile={this.state.ConfigurationFile}/>}, - {tabName :"GBCR3", content: <GBCRpannel GBCRnum={"3"} backendUrl={this.props.backendUrl} ConfigurationFile={this.state.ConfigurationFile}/>}, - {tabName :"lpGBT4 (slave)", content: <CommonlpGBT lpGBTNum={"4"} deviceAddress={"0x077"} backendUrl={this.props.backendUrl} ConfigurationFile={this.state.ConfigurationFile}/>}, - {tabName :"GBCR4", content: <GBCRpannel GBCRnum={"4"} backendUrl={this.props.backendUrl} ConfigurationFile={this.state.ConfigurationFile}/>}, - {tabName :"VTRX", content: <Placeholder />}, - {tabName :"LpGTB1 direct", content: <Placeholder />}, - {tabName :"LpGTB2 direct", content: <Placeholder />}, - {tabName :"LpGTB3 direct", content: <Placeholder />}, - {tabName :"LpGTB4 direct", content: <Placeholder />}, - {tabName :"Test outputs", content: <Placeholder />}, - ]; - - let tabsMaster = [ - {tabName : "lpGBT1 (master)", content : <MasterlpGBT lpGBTNum={"1"} deviceAddress={"0x074"} backendUrl={this.props.backendUrl} ConfigurationFile={this.state.ConfigurationFile}/>}, - ]; - - let tabs = this.state.isI2C_On ? tabsWithSlaves : tabsMaster; - - return( - <React.Fragment> - <Tabs activeKey={this.state.activeTabKey} onSelect={this.handleTabClick} isBox={this.state.isBox}> - {tabs.map((tab, index) => ( - <Tab eventKey={index} title={<TabTitleText>{tab.tabName}</TabTitleText>}> - {tab.content} - </Tab> - ))} - </Tabs> - </React.Fragment> - )}; - }; -*/ -export { SimpleTabs }; diff --git a/ui/src/SimpleTabs/lpGBT_pannel.js b/ui/src/SimpleTabs/lpGBT_pannel.js deleted file mode 100644 index e4324b9..0000000 --- a/ui/src/SimpleTabs/lpGBT_pannel.js +++ /dev/null @@ -1,401 +0,0 @@ -import React from "react"; -import { - Checkbox, - Skeleton, - Tab, - Tabs, - TabTitleText, - Text, - TextContent, - TextVariants, - Grid, - GridItem, - PageSection, - Page, - Bullseye, - TextInput, - Panel, - PanelHeader, - Button, - Flex, - FlexItem, - Tooltip, - Modal, - ModalVariant, -} from "@patternfly/react-core"; - -import { getPostBody, checkResponse } from "../utils/utility-functions"; - -import { EPRXControl } from "../Controls/EPRXControl"; -import { QuickCommands, QuickCommandsSlaves } from "../Controls/QuickCommands"; -import { EPRXChnCntr } from "../Controls/EPRXChnCntr"; -import { WriteRead } from "../Controls/WriteRead"; -import { Characteristics_lpGBT } from "../Controls/Characteristics_lpGBT"; -import { Downlinks_master } from "../Controls/Downlinks_master"; //, DownlinkEnable -import { EPRXDllConfig } from "../Controls/EPRXDllConfig"; -import { TestPatterns } from "../Controls/TestPatterns"; -import { TestPatternsSlave } from "../Controls/TestPatternsSlave"; -import { MinConfig } from "../Controls/MinConfig"; -import { MyContext } from "../SimpleTabs/MyContext"; - -//<DownlinkEnable /> -//<Characteristics_lpGBT backendUrl={this.props.backendUrl} device={'lpgbt' + this.props.lpGBTNum} /> -class MasterlpGBT extends React.Component { - constructor(props) { - super(props); - - this.state = { - i2c_master: [ - { value: "0", disabled: false }, - { value: "1", disabled: false }, - { value: "2", disabled: false }, - ], - fice_g: [ - { value: "0", disabled: false }, - { value: "1", disabled: false }, - { value: "2", disabled: false }, - { value: "3", disabled: false }, - ], - fice_i: [ - { value: "0", disabled: false }, - { value: "1", disabled: false }, - { value: "2", disabled: false }, - { value: "3", disabled: false }, - ], - fice_d: [ - { value: "0", disabled: false }, - { value: "1", disabled: false }, - { value: "2", disabled: false }, - { value: "3", disabled: false }, - ], - fice_I: "0x074", - isSwitched: false, - switchLabel: "i2c_start", - serial: "08000000", - version: "2", - fice_g_val: "0", - fice_i_val: "0", - fice_d_val: "0", - i2c_master_val: "0", - }; - this.switchBox = (checked) => { - if (this.state.isSwitched == false) { - this.setState({ isSwitched: checked }); - } - }; - this.handleTextAddress = (fice_I) => { - this.setState({ fice_I }); - }; - this.handleTextInputChange = (serial) => { - this.setState({ serial }); - }; - this.handleTextVersion = (version) => { - this.setState({ version }); - }; - this.onChange_fice_g = (fice_g_val, event) => { - this.setState({ fice_g_val }); - }; - this.onChange_fice_i = (fice_i_val, event) => { - this.setState({ fice_i_val }); - }; - this.onChange_fice_d = (fice_d_val, event) => { - this.setState({ fice_d_val }); - }; - this.onChange_i2c_master = (i2c_master_val, event) => { - this.setState({ i2c_master_val }); - }; - - this.sendSetting = (registerName, settingName, newValue) => { - const body = { - device: "lpgbt" + props.lpGBTNum, - registerName: registerName, - settingName: settingName, - newValue: newValue, - }; - console.log(body); - return fetch(`${this.props.backendUrl}/sendRegister`, getPostBody(body)) - .then((response) => checkResponse(response)) - .then((data) => { - console.log(data); - }); - }; - } - - /* -<MinConfig backendUrl={this.props.backendUrl}/> -*/ - render() { - return ( - <React.Fragment> - <Page> - <PageSection> - <Flex spaceItems={{ default: "spaceItemsNone" }}> - <FlexItem flex={{ default: "flex_2" }}> - <QuickCommands - backendUrl={this.props.backendUrl} - serial={this.state.serial} - i2c_master={this.state.i2c_master} - version={this.state.version} - fice_g={this.state.fice_g} - fice_i={this.state.fice_i} - fice_I={this.state.fice_I} - fice_d={this.state.fice_d} - handleTextInputChange={this.handleTextInputChange} - handleTextAddress={this.handleTextAddress} - handleTextVersion={this.handleTextVersion} - onChange_i2c_master={this.onChange_i2c_master} - isSwitched={this.state.isSwitched} - switchLabel={this.state.switchLabel} - switchBox={this.switchBox} - onChange_fice_g={this.onChange_fice_g} - onChange_fice_i={this.onChange_fice_i} - onChange_fice_d={this.onChange_fice_d} - fice_g_val={this.state.fice_g_val} - fice_i_val={this.state.fice_i_val} - fice_d_val={this.state.fice_d_val} - i2c_master_val={this.state.i2c_master_val} - /> - - <WriteRead - backendUrl={this.props.backendUrl} - device={"lpgbt" + this.props.lpGBTNum} - fice_g={this.state.fice_g_val} - fice_i={this.state.fice_i_val} - fice_d={this.state.fice_d_val} - fice_I={this.state.fice_I} - serial={this.state.serial} - i2c_master_val={this.state.i2c_master_val} - isMaster="true" - /> - - <Characteristics_lpGBT - backendUrl={this.props.backendUrl} - device={"lpgbt" + this.props.lpGBTNum} - /> - </FlexItem> - - <FlexItem flex={{ default: "flex_4" }}> - <Panel variant="bordered"> - <PanelHeader> - <Flex spaceItems={{ default: "spaceItemsNone" }}> - <FlexItem flex={{ default: "flex_4" }}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}> - Uplink settings - </Text> - </TextContent> - </Bullseye> - </FlexItem> - </Flex> - </PanelHeader> - - <Flex spaceItems={{ default: "spaceItemsNone" }}> - <FlexItem flex={{ default: "flex_4" }}> - <TestPatterns - sendSetting={this.sendSetting} - backendUrl={this.props.backendUrl} - device={"lpgbt" + this.props.lpGBTNum} - lpGBTNum={this.props.lpGBTNum} - ConfigurationFile={this.props.ConfigurationFile} - /> - </FlexItem> - </Flex> - - <Flex spaceItems={{ default: "spaceItemsNone" }}> - <FlexItem flex={{ default: "flex_3" }}> - {[0, 1, 2, 3, 4, 5].map((num) => ( - <EPRXControl - id={num} - sendSetting={this.sendSetting} - backendUrl={this.props.backendUrl} - lpGBTNum={this.props.lpGBTNum} - ConfigurationFile={this.props.ConfigurationFile} - /> - ))} - </FlexItem> - <FlexItem flex={{ default: "flex_4" }}> - {[0, 1, 2, 3, 4, 5].map((num) => ( - <EPRXChnCntr - id={num} - sendSetting={this.sendSetting} - backendUrl={this.props.backendUrl} - lpGBTNum={this.props.lpGBTNum} - ConfigurationFile={this.props.ConfigurationFile} - /> - ))} - </FlexItem> - </Flex> - </Panel> - - <EPRXDllConfig - id={"CHANGE"} - lpGBTNum={this.props.lpGBTNum} - sendSetting={this.sendSetting} - backendUrl={this.props.backendUrl} - ConfigurationFile={this.props.ConfigurationFile} - /> - </FlexItem> - - <FlexItem flex={{ default: "flex_2" }}> - <Panel variant="bordered"> - <PanelHeader> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}> - Configure downlink pre-emphasis settings{" "} - </Text> - </TextContent> - </Bullseye> - </PanelHeader> - {[ - { id: "00", id_reg: "10" }, - { id: "02", id_reg: "10" }, - { id: "10", id_reg: "10" }, - { id: "12", id_reg: "10" }, - { id: "20", id_reg: "32" }, - { id: "22", id_reg: "32" }, - { id: "30", id_reg: "32" }, - { id: "32", id_reg: "32" }, - ].map((num) => ( - <Downlinks_master - id={num.id} - id_reg={num.id_reg} - sendSetting={this.sendSetting} - backendUrl={this.props.backendUrl} - lpGBTNum={this.props.lpGBTNum} - ConfigurationFile={this.props.ConfigurationFile} - /> - ))} - </Panel> - </FlexItem> - </Flex> - </PageSection> - </Page> - </React.Fragment> - ); - } -} - -class CommonlpGBT extends React.Component { - constructor(props) { - super(props); - - this.state = { - isModalOpen: false, - }; - - this.sendSetting = (registerName, settingName, newValue) => { - const body = { - device: "lpgbt" + props.lpGBTNum, - registerName: registerName, - settingName: settingName, - newValue: newValue, - }; - console.log(body); - return fetch(`${this.props.backendUrl}/sendRegister`, getPostBody(body)) - .then((response) => checkResponse(response)) - .then((data) => { - console.log(data); - }); - }; - } - - //<QuickCommandsSlaves /> - //<Characteristics_lpGBT backendUrl={this.props.backendUrl} device={'lpgbt' + this.props.lpGBTNum}/> - render() { - return ( - <React.Fragment> - <Page> - <PageSection> - <Flex> - <FlexItem flex={{ default: "flex_2" }}> - <WriteRead - backendUrl={this.props.backendUrl} - device={"lpgbt" + this.props.lpGBTNum} - /> - - <FlexItem flex={{ default: "flex_1" }}> - <TestPatternsSlave - sendSetting={this.sendSetting} - backendUrl={this.props.backendUrl} - lpGBTNum={this.props.lpGBTNum} - sendSettingTESTPATTERN={this.sendSettingTESTPATTERN} - /> - </FlexItem> - - <Characteristics_lpGBT - backendUrl={this.props.backendUrl} - device={"lpgbt" + this.props.lpGBTNum} - /> - </FlexItem> - - <FlexItem flex={{ default: "flex_4" }}> - <Flex> - <FlexItem flex={{ default: "flex_2" }}> - {[1, 2, 3, 4, 5].map((num) => ( - <EPRXControl - id={num} - sendSetting={this.sendSetting} - backendUrl={this.props.backendUrl} - lpGBTNum={this.props.lpGBTNum} - ConfigurationFile={this.props.ConfigurationFile} - /> - ))} - </FlexItem> - - <FlexItem flex={{ default: "flex_2" }}> - {[1, 2, 3, 4, 5].map((num) => ( - <EPRXChnCntr - id={num} - sendSetting={this.sendSetting} - backendUrl={this.props.backendUrl} - lpGBTNum={this.props.lpGBTNum} - ConfigurationFile={this.props.ConfigurationFile} - /> - ))} - </FlexItem> - </Flex> - </FlexItem> - </Flex> - </PageSection> - </Page> - </React.Fragment> - ); - } -} - -class Placeholder extends React.Component { - constructor(props) { - super(props); - } - render() { - return ( - <React.Fragment> - <Page> - <PageSection> - <Grid hasGutter> - <GridItem span={2}> - {[1, 2, 3, 4, 5].map((num) => ( - <TextContent> - <Text component={TextVariants.h3}>EPRX Control</Text> - </TextContent> - ))} - </GridItem> - - <GridItem span={3}> - {[1, 2, 3, 4, 5].map((num) => ( - <TextContent> - <Text component={TextVariants.h3}>EPRX Control</Text> - </TextContent> - ))} - </GridItem> - </Grid> - </PageSection> - </Page> - </React.Fragment> - ); - } -} - -export { MasterlpGBT, CommonlpGBT, Placeholder }; diff --git a/ui/src/Widgets/FormSelectInput.js b/ui/src/Widgets/FormSelectInput.js deleted file mode 100644 index 508f704..0000000 --- a/ui/src/Widgets/FormSelectInput.js +++ /dev/null @@ -1,89 +0,0 @@ -import React from "react"; -import { - FormSelect, - FormSelectOption, -} from "@patternfly/react-core"; - - -class FormSelectInput extends React.Component { - constructor(props) { - super(props); - this.state = { - value: '' - }; - this.onChange = this.onChange.bind(this); - } - - onChange(value, event) { - this.setState({ value }); - }; - - render() { - return ( - <FormSelect value={this.state.value} onChange={this.onChange} aria-label="FormSelect Input"> - {this.props.items.map((option, index) => ( - <FormSelectOption isDisabled={option.disabled} key={index} value={option.value} label={option.value} /> - ))} - </FormSelect> - ); - } -} - -export {FormSelectInput}; - - -class FormSelectInput2 extends React.Component { - constructor(props) { - super(props); - }; - - render() { - return ( - <FormSelect value={this.props.value} onChange={this.props.onChange} aria-label="FormSelect Input"> - {this.props.items.map((option, index) => ( - <FormSelectOption isDisabled={option.disabled} key={index} value={option.value} label={option.value} /> - ))} - </FormSelect> - ); - } -} - -export {FormSelectInput2}; - - -class FormSelectInputNew extends React.Component { - constructor(props) { - super(props); - } - - render() { - return ( - <FormSelect value={this.props.value} onChange={this.props.onChange} aria-label="FormSelect Input"> - {this.props.items.map((option, index) => ( - <FormSelectOption isDisabled={option.disabled} key={index} value={option.value} label={option.value} /> - ))} - </FormSelect> - ); - } -} - -export {FormSelectInputNew}; - -//class for form which requires the onChange function to be passed as argument + has label != value -class FormSelectInputNewer extends React.Component { - constructor(props) { - super(props); - } - - render() { - return ( - <FormSelect value={this.props.value} onChange={this.props.onChange} aria-label="FormSelect Input"> - {this.props.items.map((option, index) => ( - <FormSelectOption isDisabled={option.disabled} key={index} value={option.value} label={option.label} /> - ))} - </FormSelect> - ); - } -} - -export {FormSelectInputNewer}; \ No newline at end of file diff --git a/ui/src/Widgets/LabelledDropdown.js b/ui/src/Widgets/LabelledDropdown.js deleted file mode 100644 index 22555d0..0000000 --- a/ui/src/Widgets/LabelledDropdown.js +++ /dev/null @@ -1,73 +0,0 @@ -import React from "react"; -import { - Button, - Checkbox, - InputGroup, - InputGroupText, - Dropdown, - DropdownToggle, - DropdownItem, - FormSelect, - FormSelectOption, - FormSelectOptionGroup, - Text, - TextInput, - TextContent, - TextVariants, - Form, - FormGroup, - PanelMainBody, - PanelMain, - Panel, - PanelHeader, - SidebarContent, - Sidebar, - Flex, - FlexItem, - Grid, - GridItem, - Bullseye, -} from "@patternfly/react-core"; - - -class LabelledDropdown extends React.Component { - constructor(props) { - super(props); - this.state = { - isOpen : false, setIsOpen : false, - selected : null, setSelected : null, - }; - - this.onToggle = () => { - setIsOpen(!isOpen); - }; - this.onSelect = (isOpen, selected) => { - setIsOpen(isOpen); - setSelected(selected); - }; - } - - render (){ - const dataRates = props.items; - return ( - <React.Fragment> - <InputGroupText>{props.label}</InputGroupText> - <Dropdown - onSelect={onSelect} - toggle={ - <DropdownToggle onToggle={onToggle}> - {selected ? selected : "EPRXDataRate"} - </DropdownToggle> - } - isOpen={isOpen} - dropdownItems={dataRates.map((item, index) => ( - <DropdownItem key="opt-{index}" value="{item}" component="button"> - {item} - </DropdownItem> - ))} - /> - </React.Fragment> - );}; -}; - -export {LabelledDropdown}; -- GitLab From f7ef64331eb8cad3190857926b2063ca8b340ac3 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Tue, 21 Feb 2023 19:17:27 +0100 Subject: [PATCH 15/33] WIP: Modal for GUI configuration --- ui/src/SimpleTabs/OptoboardGUI.js | 39 +++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/ui/src/SimpleTabs/OptoboardGUI.js b/ui/src/SimpleTabs/OptoboardGUI.js index e0c00e7..fec5183 100644 --- a/ui/src/SimpleTabs/OptoboardGUI.js +++ b/ui/src/SimpleTabs/OptoboardGUI.js @@ -19,16 +19,10 @@ import { Text, TextContent, TextVariants, - Tooltip, - TextInput, Panel, PanelMain, PanelMainBody, - PanelHeader, Page, - PageSection, - PageSectionVariants, - Switch, FormSelect, FormSelectOption, NotificationDrawer, @@ -38,6 +32,7 @@ import { NotificationDrawerListItem, NotificationDrawerListItemBody, NotificationDrawerListItemHeader, + TextArea, } from "@patternfly/react-core"; // import { LogViewer } from "@patternfly/react-log-viewer"; @@ -50,6 +45,9 @@ export function OptoboardGUI({ url }) { const [DefaultConfig, setDefaultConfig] = useState(defaultConfig); const [isOpenConfig, setisOpenConfig] = useState(false); const [isNotDrawerOpen, setisNotDrawerOpen] = useState(false); + const [modalText, setmodalText] = useState( + JSON.stringify(Configurations["SR1"], null, 4) + ); const ConfigurationOptions = [ { @@ -224,24 +222,41 @@ export function OptoboardGUI({ url }) { /> */} <Modal + variant={ModalVariant.large} bodyAriaLabel="Scrollable modal content" tabIndex={0} - variant={ModalVariant.small} title="Modal with overflowing content" isOpen={isOpenConfig} onClose={() => { setisOpenConfig(false); }} - /* actions={[ - <Button key="confirm" variant="primary" onClick={handleModalToggle}> + actions={[ + <Button + key="confirm" + variant="primary" + onClick={() => { + setisOpenConfig(false); + }} + > Confirm </Button>, - <Button key="cancel" variant="link" onClick={handleModalToggle}> + <Button + key="cancel" + variant="link" + onClick={() => { + setisOpenConfig(false); + }} + > Cancel </Button>, - ]} */ + ]} > - Catilina + <TextArea + value={modalText} + onChange={(value) => setmodalText(value)} + aria-label="text area vertical resize example" + autoResize + /> </Modal> </React.Fragment> ); -- GitLab From f4e830a74eca270a0cd5b229bb4714047799159e Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Tue, 21 Feb 2023 20:41:11 +0100 Subject: [PATCH 16/33] patternfly code editor import --- ui/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/package.json b/ui/package.json index 6f36b31..ab477e8 100644 --- a/ui/package.json +++ b/ui/package.json @@ -6,6 +6,7 @@ "@itk-demo-sw/components": "^1.0.0", "@itk-demo-sw/hooks": "^1.0.0", "@itk-demo-sw/utility-functions": "^1.0.0", + "@patternfly/react-code-editor": "^4.82.113", "@patternfly/react-core": "^4.175.4", "@testing-library/jest-dom": "^5.15.1", "@testing-library/react": "^11.2.7", -- GitLab From 64dbe865e19caa7c5261aa07f30848c7de252d39 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Tue, 21 Feb 2023 21:18:25 +0100 Subject: [PATCH 17/33] Improved useEffect in OptoboardGUI.js --- ui/src/SimpleTabs/OptoboardGUI.js | 133 ++++++++++++++++++++++++----- ui/src/SimpleTabs/OptoboardList.js | 32 +------ 2 files changed, 114 insertions(+), 51 deletions(-) diff --git a/ui/src/SimpleTabs/OptoboardGUI.js b/ui/src/SimpleTabs/OptoboardGUI.js index fec5183..0a2fdb0 100644 --- a/ui/src/SimpleTabs/OptoboardGUI.js +++ b/ui/src/SimpleTabs/OptoboardGUI.js @@ -1,11 +1,7 @@ import React, { useState, useEffect } from "react"; import { SimpleList, SimpleListItem } from "@patternfly/react-core"; import { Config } from "../Controls/Config"; -import { - defaultConfig, - Configurations, - OptoInfo, -} from "../Config/Configurations"; +import { defaultConfig, Configurations } from "../Config/Configurations"; import { OptoboardList } from "../SimpleTabs/OptoboardList"; import { AddOptoboard } from "../SimpleTabs/AddOptoboard"; @@ -33,7 +29,11 @@ import { NotificationDrawerListItemBody, NotificationDrawerListItemHeader, TextArea, + TextInput, + Title, } from "@patternfly/react-core"; +import { CodeEditor, Language } from "@patternfly/react-code-editor"; + // import { LogViewer } from "@patternfly/react-log-viewer"; import CogIcon from "@patternfly/react-icons/dist/esm/icons/cog-icon"; @@ -43,22 +43,52 @@ import { getPostBody, checkResponse } from "../utils/utility-functions"; export function OptoboardGUI({ url }) { const [DefaultConfig, setDefaultConfig] = useState(defaultConfig); + const [DefaultConfigChange, setDefaultConfigChange] = useState( + "Add New Configuration" + ); + // const [ChangeConfig, setChangeConfig] = useState(); const [isOpenConfig, setisOpenConfig] = useState(false); const [isNotDrawerOpen, setisNotDrawerOpen] = useState(false); - const [modalText, setmodalText] = useState( - JSON.stringify(Configurations["SR1"], null, 4) - ); + const [newConfigName, setnewConfigName] = useState(""); + const [modalText, setmodalText] = useState(""); + + const [ConfigurationOptions, setConfigurationOptions] = useState([]); - const ConfigurationOptions = [ - { - value: "Load Configuration", - label: "Load Configuration", - disabled: true, - }, - ]; - for (var key in Configurations) { - ConfigurationOptions.push({ value: key, label: key, disabled: false }); - } + const [ConfigurationOptions2Change, setConfigurationOptions2Change] = + useState([]); + + useEffect(() => { + let X = []; + let Y = []; + for (var key in Configurations) { + X.push({ value: key, label: key, disabled: false }); + Y.push({ + value: key, + label: key, + disabled: false, + }); + } + setConfigurationOptions([ + ...[ + { + value: "Load Configuration", + label: "Load Configuration", + disabled: true, + }, + ], + ...X, + ]); + setConfigurationOptions2Change([ + ...[ + { + value: "Add New Configuration", + label: "Add New Configuration", + disabled: false, + }, + ], + ...Y, + ]); + }, [Configurations]); useEffect(() => { const interval = setInterval(() => { @@ -77,6 +107,14 @@ export function OptoboardGUI({ url }) { }; }, []); + useEffect(() => { + DefaultConfigChange == "Add New Configuration" + ? setmodalText("") + : setmodalText( + JSON.stringify(Configurations[DefaultConfigChange], null, 4) + ); + }, [DefaultConfigChange]); + // function optoListChange(newOptoList) { // setoptoList(newOptoList); // console.log("New optolist"); @@ -160,7 +198,7 @@ export function OptoboardGUI({ url }) { isLarge onClick={() => setisOpenConfig(!isOpenConfig)} > - <h3> Add Configuration </h3> + <h3> Add GUI Configuration </h3> </Button> </FlexItem> <FlexItem> @@ -206,7 +244,11 @@ export function OptoboardGUI({ url }) { <PanelMain> <PanelMainBody> <Flex> - <OptoboardList url={url} DefaultConfig={DefaultConfig} /> + <OptoboardList + url={url} + DefaultConfig={DefaultConfig} + Configurations={Configurations} + /> </Flex> </PanelMainBody> </PanelMain> @@ -227,6 +269,48 @@ export function OptoboardGUI({ url }) { tabIndex={0} title="Modal with overflowing content" isOpen={isOpenConfig} + header={ + <React.Fragment> + <Title id="modal-custom-header-label" headingLevel="h1"> + Add/Change GUI Configuration + </Title> + <Flex> + <FlexItem> + <FormSelect + value={DefaultConfigChange} + onChange={(X) => { + setDefaultConfigChange(X); + }} + aria-label="FormSelect Input" + > + {ConfigurationOptions2Change.map((option, index) => ( + <FormSelectOption + isDisabled={option.disabled} + key={index} + value={option.value} + label={option.label} + /> + ))} + </FormSelect> + </FlexItem> + <FlexItem> + <TextInput + value={newConfigName} + type="text" + aria-label="disabled text input example" + onChange={(value) => { + setnewConfigName(value); + }} + isDisabled={ + DefaultConfigChange == "Add New Configuration" + ? false + : true + } + /> + </FlexItem> + </Flex> + </React.Fragment> + } onClose={() => { setisOpenConfig(false); }} @@ -251,11 +335,14 @@ export function OptoboardGUI({ url }) { </Button>, ]} > - <TextArea - value={modalText} + <CodeEditor + code={modalText} + isDarkTheme={false} + isLineNumbersVisible={true} + language={Language.javascript} onChange={(value) => setmodalText(value)} aria-label="text area vertical resize example" - autoResize + height="400px" /> </Modal> </React.Fragment> diff --git a/ui/src/SimpleTabs/OptoboardList.js b/ui/src/SimpleTabs/OptoboardList.js index 6bbe279..10c83f3 100644 --- a/ui/src/SimpleTabs/OptoboardList.js +++ b/ui/src/SimpleTabs/OptoboardList.js @@ -1,45 +1,21 @@ import React, { useState, useEffect } from "react"; import { WriteReadBox } from "../Controls/WriteReadBox"; import { Config } from "../Controls/Config"; -import { - defaultConfig, - Configurations, - OptoInfo, -} from "../Config/Configurations"; import { OptoStatus } from "../Controls/OptoStatus"; -import { AddOptoboard } from "../SimpleTabs/AddOptoboard"; import { Bullseye, Button, Flex, FlexItem, - Modal, - ModalVariant, Text, TextContent, TextVariants, Tooltip, - TextInput, Panel, PanelMain, PanelMainBody, - PanelHeader, - Page, - PageSection, - PageSectionVariants, - Switch, - FormSelect, - FormSelectOption, - Checkbox, Icon, - Drawer, - DrawerPanelContent, - DrawerContent, - DrawerContentBody, - DrawerHead, - DrawerActions, - DrawerCloseButton, Spinner, } from "@patternfly/react-core"; @@ -49,12 +25,12 @@ import InfoCircleIcon from "@patternfly/react-icons/dist/esm/icons/info-circle-i import { getPostBody, checkResponse } from "../utils/utility-functions"; -export function OptoboardList({ url, DefaultConfig }) { - const [optoList, setoptoList] = useState({}); //Configurations[DefaultConfig] +export function OptoboardList({ url, DefaultConfig, Configurations }) { + const [optoList, setoptoList] = useState({}); const [optoListInfo, setoptoListInfo] = useState({}); const [OpenDevel, setOpenDevel] = useState(false); const [loadingData, setloadingData] = useState(true); - const [modify, setmodify] = useState(false); + /* const [modify, setmodify] = useState(false); const [isOpen, setisOpen] = useState(false); const [currentOpto, setcurrentOpto] = useState({ serialNumber: "00000000", @@ -70,7 +46,7 @@ export function OptoboardList({ url, DefaultConfig }) { debugCheckBox: false, testmode: false, }); - const [indexcurrentOpto, setindexcurrentOpto] = useState(); + const [indexcurrentOpto, setindexcurrentOpto] = useState(); */ useEffect(() => { setloadingData(true); -- GitLab From d83c514a7b612841f77eb072a93b7f02841fb400 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Tue, 21 Feb 2023 21:27:22 +0100 Subject: [PATCH 18/33] Work on useEffect of OptoboardGUI.js --- ui/src/SimpleTabs/OptoboardGUI.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/src/SimpleTabs/OptoboardGUI.js b/ui/src/SimpleTabs/OptoboardGUI.js index 0a2fdb0..b3766cd 100644 --- a/ui/src/SimpleTabs/OptoboardGUI.js +++ b/ui/src/SimpleTabs/OptoboardGUI.js @@ -42,7 +42,7 @@ import PlusCircleIcon from "@patternfly/react-icons/dist/esm/icons/plus-circle-i import { getPostBody, checkResponse } from "../utils/utility-functions"; export function OptoboardGUI({ url }) { - const [DefaultConfig, setDefaultConfig] = useState(defaultConfig); + const [DefaultConfig, setDefaultConfig] = useState(""); const [DefaultConfigChange, setDefaultConfigChange] = useState( "Add New Configuration" ); @@ -58,6 +58,7 @@ export function OptoboardGUI({ url }) { useState([]); useEffect(() => { + setDefaultConfig(defaultConfig); let X = []; let Y = []; for (var key in Configurations) { -- GitLab From f222f82811f6a6e49376518433db7c90c7b23d91 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Tue, 21 Feb 2023 21:42:03 +0100 Subject: [PATCH 19/33] Preparation for moving Configuration out --- ui/src/SimpleTabs/OptoboardGUI.js | 339 ++++++++++++++++-------------- 1 file changed, 184 insertions(+), 155 deletions(-) diff --git a/ui/src/SimpleTabs/OptoboardGUI.js b/ui/src/SimpleTabs/OptoboardGUI.js index b3766cd..c73bd8a 100644 --- a/ui/src/SimpleTabs/OptoboardGUI.js +++ b/ui/src/SimpleTabs/OptoboardGUI.js @@ -30,6 +30,7 @@ import { NotificationDrawerListItemHeader, TextArea, TextInput, + Spinner, Title, } from "@patternfly/react-core"; import { CodeEditor, Language } from "@patternfly/react-code-editor"; @@ -57,6 +58,20 @@ export function OptoboardGUI({ url }) { const [ConfigurationOptions2Change, setConfigurationOptions2Change] = useState([]); + const [loadingConfig, setloadingConfig] = useState(false); + + useEffect(() => { + setloadingConfig(true); + fetch(`${url}/health`) + .then((response) => checkResponse(response)) + .then((data) => { + setloadingConfig(false); + }) + .catch((err) => { + console.log(err); + }); + }, []); + useEffect(() => { setDefaultConfig(defaultConfig); let X = []; @@ -174,43 +189,130 @@ export function OptoboardGUI({ url }) { </NotificationDrawer> ); - return ( - <React.Fragment> - <Page - notificationDrawer={notificationDrawer} - isNotificationDrawerExpanded={isNotDrawerOpen} - > - <Panel> - <PanelMain> - <PanelMainBody> - <TextContent> - <Text component={TextVariants.h1}>Optoboard GUI</Text> - </TextContent> - </PanelMainBody> - </PanelMain> - </Panel> - <Panel> - <PanelMain> - <PanelMainBody> + if (loadingConfig) { + return ( + <FlexItem key={"optoInListLoad"}> + <Bullseye> + <Spinner + isSVG + diameter="120px" + aria-label="spinnerforloadingconfig" + /> + </Bullseye> + </FlexItem> + ); + } else { + return ( + <React.Fragment> + <Page + notificationDrawer={notificationDrawer} + isNotificationDrawerExpanded={isNotDrawerOpen} + > + <Panel> + <PanelMain> + <PanelMainBody> + <TextContent> + <Text component={TextVariants.h1}>Optoboard GUI</Text> + </TextContent> + </PanelMainBody> + </PanelMain> + </Panel> + <Panel> + <PanelMain> + <PanelMainBody> + <Flex> + <FlexItem key={"add_configuration"}> + <Button + variant="secondary" + isLarge + onClick={() => setisOpenConfig(!isOpenConfig)} + > + <h3> Add GUI Configuration </h3> + </Button> + </FlexItem> + <FlexItem> + <FormSelect + value={DefaultConfig} + onChange={(X) => { + setDefaultConfig(X); + }} + aria-label="FormSelect Input" + > + {ConfigurationOptions.map((option, index) => ( + <FormSelectOption + isDisabled={option.disabled} + key={index} + value={option.value} + label={option.label} + /> + ))} + </FormSelect> + </FlexItem> + <FlexItem key={"add configuration"}> + <Button + variant="link" + onClick={() => { + fetch(`${url}/health`) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + }) + .catch((err) => { + console.log(err); + }); + }} + > + <h3> Health </h3> + </Button> + </FlexItem> + </Flex> + </PanelMainBody> + </PanelMain> + </Panel> + <Panel> + <PanelMain> + <PanelMainBody> + <Flex> + <OptoboardList + url={url} + DefaultConfig={DefaultConfig} + Configurations={Configurations} + /> + </Flex> + </PanelMainBody> + </PanelMain> + </Panel> + </Page> + + {/* <LogViewer + hasLineNumbers={false} + height={300} + data={data.data} + theme="dark" + header={<Banner>5019 lines</Banner>} + /> */} + + <Modal + variant={ModalVariant.large} + bodyAriaLabel="Scrollable modal content" + tabIndex={0} + title="Modal with overflowing content" + isOpen={isOpenConfig} + header={ + <React.Fragment> + <Title id="modal-custom-header-label" headingLevel="h1"> + Add/Change GUI Configuration + </Title> <Flex> - <FlexItem key={"add_configuration"}> - <Button - variant="secondary" - isLarge - onClick={() => setisOpenConfig(!isOpenConfig)} - > - <h3> Add GUI Configuration </h3> - </Button> - </FlexItem> <FlexItem> <FormSelect - value={DefaultConfig} + value={DefaultConfigChange} onChange={(X) => { - setDefaultConfig(X); + setDefaultConfigChange(X); }} aria-label="FormSelect Input" > - {ConfigurationOptions.map((option, index) => ( + {ConfigurationOptions2Change.map((option, index) => ( <FormSelectOption isDisabled={option.disabled} key={index} @@ -220,132 +322,59 @@ export function OptoboardGUI({ url }) { ))} </FormSelect> </FlexItem> - <FlexItem key={"add configuration"}> - <Button - variant="link" - onClick={() => { - fetch(`${url}/health`) - .then((response) => checkResponse(response)) - .then((data) => { - console.log(data); - }) - .catch((err) => { - console.log(err); - }); + <FlexItem> + <TextInput + value={newConfigName} + type="text" + aria-label="disabled text input example" + onChange={(value) => { + setnewConfigName(value); }} - > - <h3> Health </h3> - </Button> + isDisabled={ + DefaultConfigChange == "Add New Configuration" + ? false + : true + } + /> </FlexItem> </Flex> - </PanelMainBody> - </PanelMain> - </Panel> - <Panel> - <PanelMain> - <PanelMainBody> - <Flex> - <OptoboardList - url={url} - DefaultConfig={DefaultConfig} - Configurations={Configurations} - /> - </Flex> - </PanelMainBody> - </PanelMain> - </Panel> - </Page> - - {/* <LogViewer - hasLineNumbers={false} - height={300} - data={data.data} - theme="dark" - header={<Banner>5019 lines</Banner>} - /> */} - - <Modal - variant={ModalVariant.large} - bodyAriaLabel="Scrollable modal content" - tabIndex={0} - title="Modal with overflowing content" - isOpen={isOpenConfig} - header={ - <React.Fragment> - <Title id="modal-custom-header-label" headingLevel="h1"> - Add/Change GUI Configuration - </Title> - <Flex> - <FlexItem> - <FormSelect - value={DefaultConfigChange} - onChange={(X) => { - setDefaultConfigChange(X); - }} - aria-label="FormSelect Input" - > - {ConfigurationOptions2Change.map((option, index) => ( - <FormSelectOption - isDisabled={option.disabled} - key={index} - value={option.value} - label={option.label} - /> - ))} - </FormSelect> - </FlexItem> - <FlexItem> - <TextInput - value={newConfigName} - type="text" - aria-label="disabled text input example" - onChange={(value) => { - setnewConfigName(value); - }} - isDisabled={ - DefaultConfigChange == "Add New Configuration" - ? false - : true - } - /> - </FlexItem> - </Flex> - </React.Fragment> - } - onClose={() => { - setisOpenConfig(false); - }} - actions={[ - <Button - key="confirm" - variant="primary" - onClick={() => { - setisOpenConfig(false); - }} - > - Confirm - </Button>, - <Button - key="cancel" - variant="link" - onClick={() => { - setisOpenConfig(false); - }} - > - Cancel - </Button>, - ]} - > - <CodeEditor - code={modalText} - isDarkTheme={false} - isLineNumbersVisible={true} - language={Language.javascript} - onChange={(value) => setmodalText(value)} - aria-label="text area vertical resize example" - height="400px" - /> - </Modal> - </React.Fragment> - ); + </React.Fragment> + } + onClose={() => { + setisOpenConfig(false); + }} + actions={[ + <Button + key="confirm" + variant="primary" + onClick={() => { + setisOpenConfig(false); + }} + > + Confirm + </Button>, + <Button + key="cancel" + variant="link" + onClick={() => { + setisOpenConfig(false); + }} + > + Cancel + </Button>, + ]} + > + <CodeEditor + code={modalText} + isDarkTheme={false} + isLineNumbersVisible={true} + language={Language.javascript} + onChange={(value) => setmodalText(value)} + aria-label="text area vertical resize example" + height="400px" + /> + </Modal> + </React.Fragment> + ); + } } -- GitLab From b764ece13ef7f67eb5336b5bcabfcb1c063e7a34 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Wed, 22 Feb 2023 10:15:39 +0100 Subject: [PATCH 20/33] Retrieve GUI config json with endpoint --- itk_demo_optoboard/ConfigGUI.json | 113 ++++++++++++++++++ itk_demo_optoboard/celeryTasks.py | 10 ++ itk_demo_optoboard/routes.py | 20 +--- openapi/openapi.yaml | 189 ++++++++++++++++-------------- ui/src/Config/Configurations.js | 133 +-------------------- ui/src/SimpleTabs/OptoboardGUI.js | 15 ++- 6 files changed, 242 insertions(+), 238 deletions(-) create mode 100644 itk_demo_optoboard/ConfigGUI.json diff --git a/itk_demo_optoboard/ConfigGUI.json b/itk_demo_optoboard/ConfigGUI.json new file mode 100644 index 0000000..487ace6 --- /dev/null +++ b/itk_demo_optoboard/ConfigGUI.json @@ -0,0 +1,113 @@ +{ + "defaultConfig": "SR1", + + "Basic": [ + { + "serialNumber": "30000000", + "Position": "OB0", + "vtrxVersion": "1.3", + "flx_G": "0", + "flx_d": "0", + "withoutFelixcore": false, + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + "inDBCheckBox": false, + "ConfigurationDB": "http://localhost:5000", + "debugCheckBox": false, + "testmode": false + } + ], + + "SR1": [ + { + "serialNumber": "00000000", + "Position": "OB0", + "vtrxVersion": "1.3", + "flx_G": "0", + "flx_d": "0", + "withoutFelixcore": false, + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + "inDBCheckBox": false, + "ConfigurationDB": "http://localhost:5000", + "debugCheckBox": false, + "testmode": false + }, + { + "serialNumber": "00000000", + "Position": "OB1", + "vtrxVersion": "1.3", + "flx_G": "0", + "flx_d": "0", + "withoutFelixcore": false, + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + "inDBCheckBox": false, + "ConfigurationDB": "http://localhost:5000", + "debugCheckBox": false, + "testmode": false + }, + { + "serialNumber": "00000000", + "Position": "OB2", + "vtrxVersion": "1.3", + "flx_G": "0", + "flx_d": "0", + "withoutFelixcore": false, + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + "inDBCheckBox": false, + "ConfigurationDB": "http://localhost:5000", + "debugCheckBox": false, + "testmode": false + }, + { + "serialNumber": "00000000", + "Position": "OB3", + "vtrxVersion": "1.3", + "flx_G": "0", + "flx_d": "0", + "withoutFelixcore": false, + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + "inDBCheckBox": false, + "ConfigurationDB": "http://localhost:5000", + "debugCheckBox": false, + "testmode": false + }, + { + "serialNumber": "00000000", + "Position": "OB4", + "vtrxVersion": "1.3", + "flx_G": "0", + "flx_d": "0", + "withoutFelixcore": false, + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + "inDBCheckBox": false, + "ConfigurationDB": "http://localhost:5000", + "debugCheckBox": false, + "testmode": false + }, + { + "serialNumber": "00000000", + "Position": "OB5", + "vtrxVersion": "1.3", + "flx_G": "0", + "flx_d": "0", + "withoutFelixcore": false, + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + "inDBCheckBox": false, + "ConfigurationDB": "http://localhost:5000", + "debugCheckBox": false, + "testmode": false + }, + { + "serialNumber": "00000000", + "Position": "OB6", + "vtrxVersion": "1.3", + "flx_G": "0", + "flx_d": "0", + "withoutFelixcore": false, + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + "inDBCheckBox": false, + "ConfigurationDB": "http://localhost:5000", + "debugCheckBox": false, + "testmode": false + } + ] +} diff --git a/itk_demo_optoboard/celeryTasks.py b/itk_demo_optoboard/celeryTasks.py index abd34bc..d6d6c98 100644 --- a/itk_demo_optoboard/celeryTasks.py +++ b/itk_demo_optoboard/celeryTasks.py @@ -81,6 +81,16 @@ def initOptoListTask(optoboard_list): logger.info("Optoboard in position " + x["Position"] + " has been added!") return opto_info_dic +@celery.task() +def getOptoGUIConfTasks(): + with open(os.getcwd() + "/itk_demo_optoboard/ConfigGUI.json") as f: + config_json = json.load(f) + defaultConfig = config_json["defaultConfig"] + OptoGUIConf = {x: config_json[x] for x in config_json if x!="defaultConfig"} + + return OptoGUIConf, defaultConfig + + @celery.task() def statusCheckTasks(optoboardPosition): optoboard_dic[optoboardPosition].opto_doc() diff --git a/itk_demo_optoboard/routes.py b/itk_demo_optoboard/routes.py index 48ec45f..33c3e66 100644 --- a/itk_demo_optoboard/routes.py +++ b/itk_demo_optoboard/routes.py @@ -1,30 +1,15 @@ from connexion import request - -# from itk_demo_optoboard.backend import write_read_reg -# from itk_demo_optoboard.backend import I2C_controller -# from itk_demo_optoboard.backend import write_read_reg -# from itk_demo_optoboard.backend import read_reg -# from itk_demo_optoboard.backend import set_I2C_settings -# from itk_demo_optoboard.backend import send_multiple_commands -#from itk_demo_optoboard.driver.control import * - -#from itk_demo_optoboard.lpgbt_control_lib.lpgbt_control_lib.lpgbt_register_map_v1 import LpgbtRegisterMapV1 - from time import sleep import subprocess import logging import json import os - logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) ch = logging.StreamHandler() logger.addHandler(ch) -#lpGBT_reg_map = LpgbtRegisterMapV1() - - def health(): con = {"status": 200} return con, 200, {'content-type': 'application/json'} @@ -35,6 +20,11 @@ def sendOptoList(): return opto_info_dic, 200, {'content-type': 'application/json'} +def getOptoGUIConf(): + OptoGUIConf, defaultConfig = getOptoGUIConfTasks() + + return {"optoGUIConf": OptoGUIConf, "defaultConfig": defaultConfig}, 200, {'content-type': 'application/json'} + def statuscheck(): payload = request.get_json() optoboardPosition = str(payload["optoboardPosition"]) diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index cda1ccb..812e879 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -12,7 +12,6 @@ servers: description: This is a dummy value describing the base URL for the API. paths: - /health: get: tags: @@ -23,25 +22,40 @@ paths: responses: 200: description: json serialized object containing the status of the optoboard microservice - content: + content: application/json: schema: type: object allOf: - - $ref: '#/components/schemas/standard_model' - + - $ref: "#/components/schemas/standard_model" + + /getOptoGUIConf: + get: + tags: + - Default + summary: Get the json file for the Configuration of the GUI + x-openapi-router-controller: itk_demo_optoboard.routes + operationId: getOptoGUIConf + responses: + 200: + description: json serialized object containing the status of the optoboard microservice + content: + application/json: + schema: + type: object + /sendOptoList: post: summary: Endpoint which defines the list of optoboards x-openapi-router-controller: itk_demo_optoboard.routes - operationId: sendOptoList + operationId: sendOptoList requestBody: description: json serialized object containing data to specify the requested component content: application/json: schema: type: object - properties: + properties: optoList: type: array items: {} @@ -51,7 +65,16 @@ paths: content: application/json: schema: - type: object + type: object + properties: + optoGUIConf: + type: object + example: {} + description: json file for OptoGUI configuration + defaultConfig: + type: string + example: "SR1" + description: ID for the configuration /statuscheck: post: @@ -70,22 +93,20 @@ paths: example: "OB0" description: Unique optoboard position required: - - optoboardPosition + - optoboardPosition responses: 200: description: Returns a value that signals if successful - content: + content: application/json: schema: type: object allOf: - - $ref: '#/components/schemas/standard_model' + - $ref: "#/components/schemas/standard_model" - - /testCharacteristics_wrapper: post: - summary: Endpoint, which provides lpgbt characteristics + summary: Endpoint, which provides lpgbt characteristics x-openapi-router-controller: itk_demo_optoboard.routes operationId: testCharacteristics_wrapper requestBody: @@ -93,11 +114,10 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/deviceName" - responses: + $ref: "#/components/schemas/deviceName" + responses: 200: - $ref: '#/components/responses/characteristics_read' - + $ref: "#/components/responses/characteristics_read" /sendRegister: post: @@ -108,12 +128,12 @@ paths: requestBody: description: json object with register name, setting name and new value to write content: - application/json: + application/json: schema: - $ref: '#/components/schemas/sendRegister' + $ref: "#/components/schemas/sendRegister" responses: 200: - $ref: '#/components/responses/config_response' + $ref: "#/components/responses/config_response" /sendRegisterNoReadBack: post: @@ -124,12 +144,12 @@ paths: requestBody: description: json object with register name, setting name and new value to write content: - application/json: + application/json: schema: - $ref: '#/components/schemas/sendRegister' + $ref: "#/components/schemas/sendRegister" responses: 200: - $ref: '#/components/responses/config_response' + $ref: "#/components/responses/config_response" /sendRegisterEQ: post: @@ -140,32 +160,32 @@ paths: requestBody: description: json object with register name, setting name and new value to write content: - application/json: + application/json: schema: - $ref: '#/components/schemas/sendRegisterEQ' + $ref: "#/components/schemas/sendRegisterEQ" responses: 200: - $ref: '#/components/responses/config_response' + $ref: "#/components/responses/config_response" /sendConstPattern: post: - summary: Send 4 bytes for constant pattern + summary: Send 4 bytes for constant pattern description: Send 4 bytes for constant pattern, could be substituted by a sendRegister x4 x-openapi-router-controller: itk_demo_optoboard.routes operationId: sendConstPattern_wrapper requestBody: description: json object with register name x4, setting name and new value x4 to write content: - application/json: + application/json: schema: - $ref: '#/components/schemas/sendConstPattern' + $ref: "#/components/schemas/sendConstPattern" responses: 200: - $ref: '#/components/responses/config_response' + $ref: "#/components/responses/config_response" /sendWriteRequest: - post: - summary: Write register from name or hexadecimal address + post: + summary: Write register from name or hexadecimal address description: Write register from name or hexadecimal address x-openapi-router-controller: itk_demo_optoboard.routes operationId: write_read_wrapper @@ -174,14 +194,14 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/sendWriteRequest' + $ref: "#/components/schemas/sendWriteRequest" responses: 200: - $ref: '#/components/responses/config_response' + $ref: "#/components/responses/config_response" /sendReadRequest: - post: - summary: Read register from name or hexadecimal address + post: + summary: Read register from name or hexadecimal address description: Read register from name or hexadecimal address x-openapi-router-controller: itk_demo_optoboard.routes operationId: read_wrapper @@ -190,12 +210,10 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/sendReadRequest' + $ref: "#/components/schemas/sendReadRequest" responses: 200: - $ref: '#/components/responses/config_response' - - + $ref: "#/components/responses/config_response" /set_I2C_settings: post: @@ -205,7 +223,7 @@ paths: operationId: set_I2C_settings_wrapper responses: 200: - $ref: '#/components/responses/config_response' + $ref: "#/components/responses/config_response" /configure: post: @@ -218,12 +236,12 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/configure' + $ref: "#/components/schemas/configure" responses: 200: - $ref: '#/components/responses/config_response' + $ref: "#/components/responses/config_response" - /BERT_wrapper: + /BERT_wrapper: post: summary: Does a BER Test description: Does a BER Test @@ -244,9 +262,9 @@ paths: - device responses: 200: - $ref: '#/components/responses/BERT_response' + $ref: "#/components/responses/BERT_response" - /initializeOptoboard: + /initializeOptoboard: post: summary: Initialize Optoboard description: Initialize Optoboard object @@ -263,15 +281,15 @@ paths: type: string example: "00000000" description: response-text - vtrx_v: + vtrx_v: type: string example: "1_2" description: response-text - flx_G: + flx_G: type: integer example: 0 description: response-text - flx_d: + flx_d: type: integer example: 0 description: response-text @@ -281,7 +299,7 @@ paths: description: response-text config_path: type: string - example: 'itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json' + example: "itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json" description: response-text CONFIGDB_ADDRESS: type: string @@ -312,17 +330,17 @@ paths: - testmode responses: 200: - $ref: '#/components/responses/OptoSerial_response' + $ref: "#/components/responses/OptoSerial_response" /configDbUnavailable_wrapper: post: - summary: Check if the configuration database is unavailable - description: Check availability of configdb + summary: Check if the configuration database is unavailable + description: Check availability of configdb x-openapi-router-controller: itk_demo_optoboard.routes operationId: configDbUnavailable_wrapper requestBody: description: Config DB address - content: + content: application/json: schema: type: object @@ -331,7 +349,7 @@ paths: type: string example: "https://localhost:5000" description: Config DB address - responses: + responses: 200: description: Returns a value that signals if the configuration was successful content: @@ -359,8 +377,7 @@ paths: description: empty responses: 200: - $ref: '#/components/responses/testCelery_response' - + $ref: "#/components/responses/testCelery_response" /sendFelixSettings: post: @@ -373,10 +390,10 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/deviceName' + $ref: "#/components/schemas/deviceName" responses: 200: - $ref: '#/components/responses/config_response' + $ref: "#/components/responses/config_response" /checkAvailableDatasetInDB: post: @@ -402,11 +419,11 @@ paths: type: string example: "https://localhost:5000" description: Config DB address - required: + required: - path - inDB - CONFIGDB_ADDRESS - responses: + responses: 200: description: Returns a value that signals if the configuration was successful content: @@ -422,7 +439,7 @@ paths: x-openapi-router-controller: itk_demo_optoboard.routes operationId: config_file_provider_wrapper requestBody: - description: json serialized object + description: json serialized object content: application/json: schema: @@ -438,13 +455,13 @@ paths: inDB: type: integer example: 1 - required: + required: - name - vtrx_v - inDB responses: 200: - $ref: '#/components/responses/config_response' + $ref: "#/components/responses/config_response" components: schemas: @@ -468,10 +485,10 @@ components: required: - device - configure: + configure: type: object properties: - optoboardPosition: + optoboardPosition: type: string example: "OB0" activeLpgbt: @@ -485,7 +502,6 @@ components: - activeLpgbt - activeGbcr - sendWriteRequest: type: object properties: @@ -500,7 +516,7 @@ components: register: type: string example: "SomeName" - description: Register name + description: Register name newValue: type: string example: "0" @@ -525,7 +541,7 @@ components: register: type: string example: "SomeName" - description: Register name + description: Register name required: - optoboardPosition - register @@ -553,7 +569,7 @@ components: required: - registerName - - settingName + - settingName sendRegisterEQ: type: object @@ -583,7 +599,7 @@ components: - registerName0 - registerName1 - settingName - + sendConstPattern: type: object properties: @@ -638,7 +654,6 @@ components: - newValue4 - settingName - responses: config_response: description: Returns a value that signals if the configuration was successful @@ -654,23 +669,23 @@ components: application/json: schema: type: object - properties: - VREF: + properties: + VREF: type: string example: "0" - VDDIO: + VDDIO: type: string example: "0" - VDDTX: + VDDTX: type: string example: "0" - VDDRX: + VDDRX: type: string example: "0" - VDD: + VDD: type: string example: "0" - Temp: + Temp: type: string example: "0" @@ -680,14 +695,14 @@ components: application/json: schema: type: object - properties: - BERT_error_count: + properties: + BERT_error_count: type: string example: "0" - total_bits: + total_bits: type: string example: "0" - BER_limit: + BER_limit: type: string example: "0" @@ -697,8 +712,8 @@ components: application/json: schema: type: object - properties: - reply: + properties: + reply: type: string example: "Configuration result" @@ -712,7 +727,7 @@ components: boolSerial: type: boolean example: true - lpgbt_v: + lpgbt_v: type: string example: "0" activeLpgbt: @@ -722,7 +737,7 @@ components: type: string example: "0000" - testCelery_response: + testCelery_response: description: Test endpoint content: application/json: diff --git a/ui/src/Config/Configurations.js b/ui/src/Config/Configurations.js index 444db2f..4f07d36 100644 --- a/ui/src/Config/Configurations.js +++ b/ui/src/Config/Configurations.js @@ -119,135 +119,4 @@ const Configurations = { ], }; -const OptoInfo = { - SR1: { - OB0: { - components: { - I2C_master: 0, - efused: 0, - gbcr1: 1, - gbcr2: 1, - gbcr3: 1, - gbcr4: 1, - gbcr_v: 2, - lpgbt1: 1, - lpgbt2: 1, - lpgbt3: 1, - lpgbt4: 1, - lpgbt_master_addr: 116, - lpgbt_v: 1, - optoboard_v: 2, - }, - }, - OB1: { - components: { - I2C_master: 0, - efused: 0, - gbcr1: 1, - gbcr2: 1, - gbcr3: 1, - gbcr4: 1, - gbcr_v: 2, - lpgbt1: 1, - lpgbt2: 1, - lpgbt3: 1, - lpgbt4: 1, - lpgbt_master_addr: 116, - lpgbt_v: 1, - optoboard_v: 2, - }, - }, - OB2: { - components: { - I2C_master: 0, - efused: 0, - gbcr1: 1, - gbcr2: 1, - gbcr3: 1, - gbcr4: 1, - gbcr_v: 2, - lpgbt1: 1, - lpgbt2: 1, - lpgbt3: 1, - lpgbt4: 1, - lpgbt_master_addr: 116, - lpgbt_v: 1, - optoboard_v: 2, - }, - }, - OB3: { - components: { - I2C_master: 0, - efused: 0, - gbcr1: 1, - gbcr2: 1, - gbcr3: 1, - gbcr4: 1, - gbcr_v: 2, - lpgbt1: 1, - lpgbt2: 1, - lpgbt3: 1, - lpgbt4: 1, - lpgbt_master_addr: 116, - lpgbt_v: 1, - optoboard_v: 2, - }, - }, - OB4: { - components: { - I2C_master: 0, - efused: 0, - gbcr1: 1, - gbcr2: 1, - gbcr3: 1, - gbcr4: 1, - gbcr_v: 2, - lpgbt1: 1, - lpgbt2: 1, - lpgbt3: 1, - lpgbt4: 1, - lpgbt_master_addr: 116, - lpgbt_v: 1, - optoboard_v: 2, - }, - }, - OB5: { - components: { - I2C_master: 0, - efused: 0, - gbcr1: 1, - gbcr2: 1, - gbcr3: 1, - gbcr4: 1, - gbcr_v: 2, - lpgbt1: 1, - lpgbt2: 1, - lpgbt3: 1, - lpgbt4: 1, - lpgbt_master_addr: 116, - lpgbt_v: 1, - optoboard_v: 2, - }, - }, - OB6: { - components: { - I2C_master: 0, - efused: 0, - gbcr1: 1, - gbcr2: 1, - gbcr3: 1, - gbcr4: 1, - gbcr_v: 2, - lpgbt1: 1, - lpgbt2: 1, - lpgbt3: 1, - lpgbt4: 1, - lpgbt_master_addr: 116, - lpgbt_v: 1, - optoboard_v: 2, - }, - }, - }, -}; - -export { defaultConfig, Configurations, OptoInfo }; +export { defaultConfig, Configurations }; diff --git a/ui/src/SimpleTabs/OptoboardGUI.js b/ui/src/SimpleTabs/OptoboardGUI.js index c73bd8a..ff0a76f 100644 --- a/ui/src/SimpleTabs/OptoboardGUI.js +++ b/ui/src/SimpleTabs/OptoboardGUI.js @@ -1,7 +1,7 @@ import React, { useState, useEffect } from "react"; import { SimpleList, SimpleListItem } from "@patternfly/react-core"; import { Config } from "../Controls/Config"; -import { defaultConfig, Configurations } from "../Config/Configurations"; +// import { defaultConfig, Configurations } from "../Config/Configurations"; import { OptoboardList } from "../SimpleTabs/OptoboardList"; import { AddOptoboard } from "../SimpleTabs/AddOptoboard"; @@ -44,6 +44,7 @@ import { getPostBody, checkResponse } from "../utils/utility-functions"; export function OptoboardGUI({ url }) { const [DefaultConfig, setDefaultConfig] = useState(""); + const [Configurations, setConfigurations] = useState({}); const [DefaultConfigChange, setDefaultConfigChange] = useState( "Add New Configuration" ); @@ -58,22 +59,28 @@ export function OptoboardGUI({ url }) { const [ConfigurationOptions2Change, setConfigurationOptions2Change] = useState([]); - const [loadingConfig, setloadingConfig] = useState(false); + const [loadingConfig, setloadingConfig] = useState(true); useEffect(() => { setloadingConfig(true); - fetch(`${url}/health`) + fetch(`${url}/getOptoGUIConf`) .then((response) => checkResponse(response)) .then((data) => { + setDefaultConfig(data.defaultConfig); + setConfigurations(data.optoGUIConf); + console.log("ascs"); + console.log(DefaultConfig); + console.log(Configurations); setloadingConfig(false); }) .catch((err) => { console.log(err); }); + console.log("getOptoGUIConf in useeffect"); }, []); useEffect(() => { - setDefaultConfig(defaultConfig); + setDefaultConfig(DefaultConfig); let X = []; let Y = []; for (var key in Configurations) { -- GitLab From ea6b4960adaf61d64dd3e0ed321ea861c1b12d6e Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Wed, 22 Feb 2023 11:58:06 +0100 Subject: [PATCH 21/33] Fixed GUI configuration rendering --- ui/src/Controls/WriteReadBox.js | 90 +++++++++++++++---------------- ui/src/SimpleTabs/OptoboardGUI.js | 46 +++++++++++----- 2 files changed, 78 insertions(+), 58 deletions(-) diff --git a/ui/src/Controls/WriteReadBox.js b/ui/src/Controls/WriteReadBox.js index 5c58488..8a707bc 100644 --- a/ui/src/Controls/WriteReadBox.js +++ b/ui/src/Controls/WriteReadBox.js @@ -168,55 +168,55 @@ export function WriteReadBox({ }); }; - const optionsChange = () => { - setoptionsRead([]); - setoptionsWrite([]); - let keyRegRead = "", - keyRegWrite = ""; - - if (device_val.includes("lpgbt")) { - keyRegRead = "lpgbt" + (optoComponents.lpgbt_v ? "v1" : "v0") + "Read"; - keyRegWrite = "lpgbt" + (optoComponents.lpgbt_v ? "v1" : "v0") + "Write"; - } else if (device_val.includes("gbcr")) { - keyRegRead = "gbcr" + (optoComponents.gbcr_v == 2 ? "v2" : "v3"); - keyRegWrite = "gbcr" + (optoComponents.gbcr_v == 2 ? "v2" : "v3"); - } else if (device_val.includes("vtrx")) { - keyRegRead = "vtrx" + (vtrxVersion == "1.2" ? "v12" : "v13"); - keyRegWrite = "vtrx" + (vtrxVersion == "1.2" ? "v12" : "v13"); - } - - let x = []; - Object.keys(Registers[keyRegRead]).map((register, index) => { - x.push(<SelectOption key={register} value={register} />); - Registers[keyRegRead][register].map((subreg) => { - x.push( - <SelectOption - key={register + " " + subreg} - value={register + " " + subreg} - /> - ); + useEffect(() => { + const optionsChange = () => { + setoptionsRead([]); + setoptionsWrite([]); + let keyRegRead = "", + keyRegWrite = ""; + + if (device_val.includes("lpgbt")) { + keyRegRead = "lpgbt" + (optoComponents.lpgbt_v ? "v1" : "v0") + "Read"; + keyRegWrite = + "lpgbt" + (optoComponents.lpgbt_v ? "v1" : "v0") + "Write"; + } else if (device_val.includes("gbcr")) { + keyRegRead = "gbcr" + (optoComponents.gbcr_v == 2 ? "v2" : "v3"); + keyRegWrite = "gbcr" + (optoComponents.gbcr_v == 2 ? "v2" : "v3"); + } else if (device_val.includes("vtrx")) { + keyRegRead = "vtrx" + (vtrxVersion == "1.2" ? "v12" : "v13"); + keyRegWrite = "vtrx" + (vtrxVersion == "1.2" ? "v12" : "v13"); + } + + let x = []; + Object.keys(Registers[keyRegRead]).map((register, index) => { + x.push(<SelectOption key={register} value={register} />); + Registers[keyRegRead][register].map((subreg) => { + x.push( + <SelectOption + key={register + " " + subreg} + value={register + " " + subreg} + /> + ); + }); }); - }); - setoptionsRead(x); - - let y = []; - Object.keys(Registers[keyRegWrite]).map((register, index) => { - y.push(<SelectOption key={register} value={register} />); - Registers[keyRegWrite][register].map((subreg) => { - y.push( - <SelectOption - key={register + " " + subreg} - value={register + " " + subreg} - /> - ); + + let y = []; + Object.keys(Registers[keyRegWrite]).map((register, index) => { + y.push(<SelectOption key={register} value={register} />); + Registers[keyRegWrite][register].map((subreg) => { + y.push( + <SelectOption + key={register + " " + subreg} + value={register + " " + subreg} + /> + ); + }); }); - }); - setoptionsRead(x); - setoptionsWrite(x); - }; + setoptionsRead(x); + setoptionsWrite(y); + }; - useEffect(() => { optionsChange(); }, [device_val]); diff --git a/ui/src/SimpleTabs/OptoboardGUI.js b/ui/src/SimpleTabs/OptoboardGUI.js index ff0a76f..b4176a9 100644 --- a/ui/src/SimpleTabs/OptoboardGUI.js +++ b/ui/src/SimpleTabs/OptoboardGUI.js @@ -68,15 +68,13 @@ export function OptoboardGUI({ url }) { .then((data) => { setDefaultConfig(data.defaultConfig); setConfigurations(data.optoGUIConf); - console.log("ascs"); - console.log(DefaultConfig); - console.log(Configurations); setloadingConfig(false); + console.log("getOptoGUIConf in useeffect"); + console.log(DefaultConfig); }) .catch((err) => { console.log(err); }); - console.log("getOptoGUIConf in useeffect"); }, []); useEffect(() => { @@ -198,15 +196,36 @@ export function OptoboardGUI({ url }) { if (loadingConfig) { return ( - <FlexItem key={"optoInListLoad"}> - <Bullseye> - <Spinner - isSVG - diameter="120px" - aria-label="spinnerforloadingconfig" - /> - </Bullseye> - </FlexItem> + <React.Fragment> + <Page> + <Panel> + <PanelMain> + <PanelMainBody> + <TextContent> + <Text component={TextVariants.h1}>Optoboard GUI</Text> + </TextContent> + </PanelMainBody> + </PanelMain> + </Panel> + <Panel> + <PanelMain> + <PanelMainBody> + <Flex> + <FlexItem key={"optoInListLoad"}> + <Bullseye> + <Spinner + isSVG + diameter="120px" + aria-label="spinnerforloadingconfig" + /> + </Bullseye> + </FlexItem> + </Flex> + </PanelMainBody> + </PanelMain> + </Panel> + </Page> + </React.Fragment> ); } else { return ( @@ -302,6 +321,7 @@ export function OptoboardGUI({ url }) { <Modal variant={ModalVariant.large} bodyAriaLabel="Scrollable modal content" + aria-label="modal for config input" tabIndex={0} title="Modal with overflowing content" isOpen={isOpenConfig} -- GitLab From 948e3c48dde374472e4f0a9ec82508d7606c8849 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Wed, 22 Feb 2023 15:06:51 +0100 Subject: [PATCH 22/33] Backend of Edit GUI --- itk_demo_optoboard/celeryTasks.py | 13 ++ itk_demo_optoboard/routes.py | 11 +- openapi/openapi.yaml | 26 ++++ ui/src/SimpleTabs/OptoboardGUI.js | 210 ++++++++++++++++++------------ 4 files changed, 174 insertions(+), 86 deletions(-) diff --git a/itk_demo_optoboard/celeryTasks.py b/itk_demo_optoboard/celeryTasks.py index d6d6c98..0b6c1ed 100644 --- a/itk_demo_optoboard/celeryTasks.py +++ b/itk_demo_optoboard/celeryTasks.py @@ -87,6 +87,19 @@ def getOptoGUIConfTasks(): config_json = json.load(f) defaultConfig = config_json["defaultConfig"] OptoGUIConf = {x: config_json[x] for x in config_json if x!="defaultConfig"} + + return OptoGUIConf, defaultConfig + +@celery.task() +def modifyOptoGUIConfTasks(confKey, newConfiguration): + with open(os.getcwd() + "/itk_demo_optoboard/ConfigGUI.json") as f: + config_json = json.load(f) + config_json[confKey] = newConfiguration + + defaultConfig = config_json["defaultConfig"] + OptoGUIConf = {x: config_json[x] for x in config_json if x!="defaultConfig"} + + f.write(json.dumps(config_json, indent = 4)) return OptoGUIConf, defaultConfig diff --git a/itk_demo_optoboard/routes.py b/itk_demo_optoboard/routes.py index 33c3e66..ef73e9e 100644 --- a/itk_demo_optoboard/routes.py +++ b/itk_demo_optoboard/routes.py @@ -21,7 +21,16 @@ def sendOptoList(): return opto_info_dic, 200, {'content-type': 'application/json'} def getOptoGUIConf(): - OptoGUIConf, defaultConfig = getOptoGUIConfTasks() + OptoGUIConf, defaultConfig = getOptoGUIConfTasks.delay().wait() + + return {"optoGUIConf": OptoGUIConf, "defaultConfig": defaultConfig}, 200, {'content-type': 'application/json'} + +def modifyOptoGUIConf(): + payload = request.get_json() + confKey = str(payload["confKey"]) + newConfiguration = payload["newConfiguration"] + + OptoGUIConf, defaultConfig = modifyOptoGUIConfTasks.delay(confKey, newConfiguration).wait() return {"optoGUIConf": OptoGUIConf, "defaultConfig": defaultConfig}, 200, {'content-type': 'application/json'} diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index 812e879..d73aa6e 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -44,6 +44,32 @@ paths: schema: type: object + /modifyOptoGUIConf: + post: + summary: Get the json file for the Configuration of the GUI + x-openapi-router-controller: itk_demo_optoboard.routes + operationId: modifyOptoGUIConf + requestBody: + description: modify json file with configurations + content: + application/json: + schema: + type: object + properties: + confKey: + type: string + example: "SR1" + description: Key of the list to be modified + newConfiguration: + type: array + responses: + 200: + description: json serialized object containing the status of the optoboard microservice + content: + application/json: + schema: + type: object + /sendOptoList: post: summary: Endpoint which defines the list of optoboards diff --git a/ui/src/SimpleTabs/OptoboardGUI.js b/ui/src/SimpleTabs/OptoboardGUI.js index b4176a9..5e09295 100644 --- a/ui/src/SimpleTabs/OptoboardGUI.js +++ b/ui/src/SimpleTabs/OptoboardGUI.js @@ -52,6 +52,7 @@ export function OptoboardGUI({ url }) { const [isOpenConfig, setisOpenConfig] = useState(false); const [isNotDrawerOpen, setisNotDrawerOpen] = useState(false); const [newConfigName, setnewConfigName] = useState(""); + const [newDefault, setnewDefault] = useState("Choose Configuration"); const [modalText, setmodalText] = useState(""); const [ConfigurationOptions, setConfigurationOptions] = useState([]); @@ -92,8 +93,8 @@ export function OptoboardGUI({ url }) { setConfigurationOptions([ ...[ { - value: "Load Configuration", - label: "Load Configuration", + value: "Choose Configuration", + label: "Choose Configuration", disabled: true, }, ], @@ -136,44 +137,6 @@ export function OptoboardGUI({ url }) { ); }, [DefaultConfigChange]); - // function optoListChange(newOptoList) { - // setoptoList(newOptoList); - // console.log("New optolist"); - // } - - // useEffect(() => { - // console.log("Load!"); - // optoListChange(optoList); - // }, []); - - /* - url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto - const AddOptoboardModal = AddOptoboard(url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto); - */ - /* -<AddOptoboard url={url} optoList={optoList} setoptoList={setoptoList} isOpen={isOpen} setisOpen={setisOpen} modify={modify} setmodify={setmodify} currentOpto={currentOpto} setcurrentOpto={setcurrentOpto}/> -*/ - - /* useEffect(() => {console.log(currentOpto); - const AddOptoboardModal = AddOptoboard(url, optoList, setoptoList, isOpen, setisOpen, modify, setmodify, currentOpto, setcurrentOpto); - })*/ - - /* - <AddOptoboard - url={url} - optoList={optoList} - setoptoList={setoptoList} - isOpen={isOpen} - setisOpen={setisOpen} - modify={modify} - setmodify={setmodify} - currentOpto={currentOpto} - indexcurrentOpto={indexcurrentOpto} - setcurrentOpto={setcurrentOpto} - /> - - <DevelPanel url={url} OpenDevel={OpenDevel} setOpenDevel={setOpenDevel} /> - */ const notificationDrawer = ( <NotificationDrawer> <NotificationDrawerHeader> </NotificationDrawerHeader> @@ -194,6 +157,22 @@ export function OptoboardGUI({ url }) { </NotificationDrawer> ); + function editConfig(confKey, newConfiguration) { + console.log({ confKey: confKey, newConfiguration: newConfiguration }); + fetch( + `${url}/modifyOptoGUIConf`, + getPostBody({ confKey: confKey, newConfiguration: newConfiguration }) + ) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + setisOpenConfig(false); + }) + .catch((err) => { + console.log(err); + }); + } + if (loadingConfig) { return ( <React.Fragment> @@ -323,54 +302,12 @@ export function OptoboardGUI({ url }) { bodyAriaLabel="Scrollable modal content" aria-label="modal for config input" tabIndex={0} - title="Modal with overflowing content" isOpen={isOpenConfig} - header={ - <React.Fragment> - <Title id="modal-custom-header-label" headingLevel="h1"> - Add/Change GUI Configuration - </Title> - <Flex> - <FlexItem> - <FormSelect - value={DefaultConfigChange} - onChange={(X) => { - setDefaultConfigChange(X); - }} - aria-label="FormSelect Input" - > - {ConfigurationOptions2Change.map((option, index) => ( - <FormSelectOption - isDisabled={option.disabled} - key={index} - value={option.value} - label={option.label} - /> - ))} - </FormSelect> - </FlexItem> - <FlexItem> - <TextInput - value={newConfigName} - type="text" - aria-label="disabled text input example" - onChange={(value) => { - setnewConfigName(value); - }} - isDisabled={ - DefaultConfigChange == "Add New Configuration" - ? false - : true - } - /> - </FlexItem> - </Flex> - </React.Fragment> - } + title={"Edit GUI Configuration"} onClose={() => { setisOpenConfig(false); }} - actions={[ + /* actions={[ <Button key="confirm" variant="primary" @@ -389,8 +326,111 @@ export function OptoboardGUI({ url }) { > Cancel </Button>, - ]} + ]} */ > + <Panel> + <PanelMain> + <PanelMainBody> + <Panel> + <PanelMain> + <PanelMainBody> + <Flex> + <FlexItem> + <h2> Select default configuration </h2> + </FlexItem> + <FlexItem> + <FormSelect + value={newDefault} + onChange={(X) => { + setnewDefault(X); + }} + aria-label="FormSelect change default configuration" + > + {ConfigurationOptions.map((option, index) => ( + <FormSelectOption + isDisabled={option.disabled} + key={index} + value={option.value} + label={option.label} + /> + ))} + </FormSelect> + </FlexItem> + <FlexItem> + <Button + key="confirm1" + variant="primary" + onClick={() => { + if (newDefault !== "Choose Configuration") { + editConfig("defaultConfig", [newDefault]); + } + }} + > + Confirm + </Button> + </FlexItem> + </Flex> + </PanelMainBody> + </PanelMain> + </Panel> + + <Panel> + <PanelMain> + <PanelMainBody> + <Flex> + <FlexItem> + <FormSelect + value={DefaultConfigChange} + onChange={(X) => { + setDefaultConfigChange(X); + }} + aria-label="FormSelect Input" + > + {ConfigurationOptions2Change.map( + (option, index) => ( + <FormSelectOption + isDisabled={option.disabled} + key={index} + value={option.value} + label={option.label} + /> + ) + )} + </FormSelect> + </FlexItem> + <FlexItem> + <TextInput + value={newConfigName} + type="text" + aria-label="disabled text input example" + onChange={(value) => { + setnewConfigName(value); + }} + isDisabled={ + DefaultConfigChange == "Add New Configuration" + ? false + : true + } + /> + </FlexItem> + <FlexItem> + <Button + key="confirm2" + variant="primary" + onClick={() => { + editConfig(newConfigName, modalText); + }} + > + Confirm + </Button> + </FlexItem> + </Flex> + </PanelMainBody> + </PanelMain> + </Panel> + </PanelMainBody> + </PanelMain> + </Panel> <CodeEditor code={modalText} isDarkTheme={false} -- GitLab From 58172a8d2c6aefbe3c660befcc15809a26b4d3c4 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Wed, 22 Feb 2023 17:03:54 +0100 Subject: [PATCH 23/33] Useeffect for Edit GUI --- itk_demo_optoboard/ConfigGUI.json | 18 ++-- itk_demo_optoboard/ConfigGUICopy.json | 113 ++++++++++++++++++++++++++ itk_demo_optoboard/celeryTasks.py | 10 ++- itk_demo_optoboard/routes.py | 2 +- openapi/openapi.yaml | 2 +- ui/src/SimpleTabs/OptoboardGUI.js | 20 +++-- 6 files changed, 146 insertions(+), 19 deletions(-) create mode 100644 itk_demo_optoboard/ConfigGUICopy.json diff --git a/itk_demo_optoboard/ConfigGUI.json b/itk_demo_optoboard/ConfigGUI.json index 487ace6..4071cd2 100644 --- a/itk_demo_optoboard/ConfigGUI.json +++ b/itk_demo_optoboard/ConfigGUI.json @@ -1,22 +1,20 @@ { "defaultConfig": "SR1", - "Basic": [ { - "serialNumber": "30000000", + "ConfigurationDB": "http://localhost:5000", + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", "Position": "OB0", - "vtrxVersion": "1.3", + "debugCheckBox": false, "flx_G": "0", "flx_d": "0", - "withoutFelixcore": false, - "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", "inDBCheckBox": false, - "ConfigurationDB": "http://localhost:5000", - "debugCheckBox": false, - "testmode": false + "serialNumber": "30000000", + "testmode": false, + "vtrxVersion": "1.3", + "withoutFelixcore": false } ], - "SR1": [ { "serialNumber": "00000000", @@ -110,4 +108,4 @@ "testmode": false } ] -} +} \ No newline at end of file diff --git a/itk_demo_optoboard/ConfigGUICopy.json b/itk_demo_optoboard/ConfigGUICopy.json new file mode 100644 index 0000000..487ace6 --- /dev/null +++ b/itk_demo_optoboard/ConfigGUICopy.json @@ -0,0 +1,113 @@ +{ + "defaultConfig": "SR1", + + "Basic": [ + { + "serialNumber": "30000000", + "Position": "OB0", + "vtrxVersion": "1.3", + "flx_G": "0", + "flx_d": "0", + "withoutFelixcore": false, + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + "inDBCheckBox": false, + "ConfigurationDB": "http://localhost:5000", + "debugCheckBox": false, + "testmode": false + } + ], + + "SR1": [ + { + "serialNumber": "00000000", + "Position": "OB0", + "vtrxVersion": "1.3", + "flx_G": "0", + "flx_d": "0", + "withoutFelixcore": false, + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + "inDBCheckBox": false, + "ConfigurationDB": "http://localhost:5000", + "debugCheckBox": false, + "testmode": false + }, + { + "serialNumber": "00000000", + "Position": "OB1", + "vtrxVersion": "1.3", + "flx_G": "0", + "flx_d": "0", + "withoutFelixcore": false, + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + "inDBCheckBox": false, + "ConfigurationDB": "http://localhost:5000", + "debugCheckBox": false, + "testmode": false + }, + { + "serialNumber": "00000000", + "Position": "OB2", + "vtrxVersion": "1.3", + "flx_G": "0", + "flx_d": "0", + "withoutFelixcore": false, + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + "inDBCheckBox": false, + "ConfigurationDB": "http://localhost:5000", + "debugCheckBox": false, + "testmode": false + }, + { + "serialNumber": "00000000", + "Position": "OB3", + "vtrxVersion": "1.3", + "flx_G": "0", + "flx_d": "0", + "withoutFelixcore": false, + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + "inDBCheckBox": false, + "ConfigurationDB": "http://localhost:5000", + "debugCheckBox": false, + "testmode": false + }, + { + "serialNumber": "00000000", + "Position": "OB4", + "vtrxVersion": "1.3", + "flx_G": "0", + "flx_d": "0", + "withoutFelixcore": false, + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + "inDBCheckBox": false, + "ConfigurationDB": "http://localhost:5000", + "debugCheckBox": false, + "testmode": false + }, + { + "serialNumber": "00000000", + "Position": "OB5", + "vtrxVersion": "1.3", + "flx_G": "0", + "flx_d": "0", + "withoutFelixcore": false, + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + "inDBCheckBox": false, + "ConfigurationDB": "http://localhost:5000", + "debugCheckBox": false, + "testmode": false + }, + { + "serialNumber": "00000000", + "Position": "OB6", + "vtrxVersion": "1.3", + "flx_G": "0", + "flx_d": "0", + "withoutFelixcore": false, + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", + "inDBCheckBox": false, + "ConfigurationDB": "http://localhost:5000", + "debugCheckBox": false, + "testmode": false + } + ] +} diff --git a/itk_demo_optoboard/celeryTasks.py b/itk_demo_optoboard/celeryTasks.py index 0b6c1ed..cfb7495 100644 --- a/itk_demo_optoboard/celeryTasks.py +++ b/itk_demo_optoboard/celeryTasks.py @@ -92,14 +92,20 @@ def getOptoGUIConfTasks(): @celery.task() def modifyOptoGUIConfTasks(confKey, newConfiguration): - with open(os.getcwd() + "/itk_demo_optoboard/ConfigGUI.json") as f: + if confKey != "defaultConfig": + newConfiguration = json.loads(newConfiguration) + + with open(os.getcwd() + "/itk_demo_optoboard/ConfigGUI.json", "r+") as f: config_json = json.load(f) config_json[confKey] = newConfiguration defaultConfig = config_json["defaultConfig"] OptoGUIConf = {x: config_json[x] for x in config_json if x!="defaultConfig"} - f.write(json.dumps(config_json, indent = 4)) + # logger.warn(json.dumps(config_json, indent = 4)) + f.seek(0) + f.truncate(0) + json.dump(config_json, f, indent = 2) return OptoGUIConf, defaultConfig diff --git a/itk_demo_optoboard/routes.py b/itk_demo_optoboard/routes.py index ef73e9e..42241d7 100644 --- a/itk_demo_optoboard/routes.py +++ b/itk_demo_optoboard/routes.py @@ -28,7 +28,7 @@ def getOptoGUIConf(): def modifyOptoGUIConf(): payload = request.get_json() confKey = str(payload["confKey"]) - newConfiguration = payload["newConfiguration"] + newConfiguration = str(payload["newConfiguration"]) OptoGUIConf, defaultConfig = modifyOptoGUIConfTasks.delay(confKey, newConfiguration).wait() diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index d73aa6e..271fc10 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -61,7 +61,7 @@ paths: example: "SR1" description: Key of the list to be modified newConfiguration: - type: array + type: string responses: 200: description: json serialized object containing the status of the optoboard microservice diff --git a/ui/src/SimpleTabs/OptoboardGUI.js b/ui/src/SimpleTabs/OptoboardGUI.js index 5e09295..90f638d 100644 --- a/ui/src/SimpleTabs/OptoboardGUI.js +++ b/ui/src/SimpleTabs/OptoboardGUI.js @@ -62,7 +62,7 @@ export function OptoboardGUI({ url }) { const [loadingConfig, setloadingConfig] = useState(true); - useEffect(() => { + function getConfigGUI() { setloadingConfig(true); fetch(`${url}/getOptoGUIConf`) .then((response) => checkResponse(response)) @@ -76,6 +76,10 @@ export function OptoboardGUI({ url }) { .catch((err) => { console.log(err); }); + } + + useEffect(() => { + getConfigGUI(); }, []); useEffect(() => { @@ -133,7 +137,7 @@ export function OptoboardGUI({ url }) { DefaultConfigChange == "Add New Configuration" ? setmodalText("") : setmodalText( - JSON.stringify(Configurations[DefaultConfigChange], null, 4) + JSON.stringify(Configurations[DefaultConfigChange], null, 2) ); }, [DefaultConfigChange]); @@ -166,7 +170,8 @@ export function OptoboardGUI({ url }) { .then((response) => checkResponse(response)) .then((data) => { console.log(data); - setisOpenConfig(false); + // setisOpenConfig(false); + getConfigGUI(); }) .catch((err) => { console.log(err); @@ -362,7 +367,7 @@ export function OptoboardGUI({ url }) { variant="primary" onClick={() => { if (newDefault !== "Choose Configuration") { - editConfig("defaultConfig", [newDefault]); + editConfig("defaultConfig", newDefault); } }} > @@ -418,7 +423,12 @@ export function OptoboardGUI({ url }) { key="confirm2" variant="primary" onClick={() => { - editConfig(newConfigName, modalText); + editConfig( + DefaultConfigChange == "Add New Configuration" + ? newConfigName + : DefaultConfigChange, + modalText + ); }} > Confirm -- GitLab From cc7bab5d6fdef0f230a352345552d68f165205fe Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Thu, 23 Feb 2023 10:16:14 +0100 Subject: [PATCH 24/33] Fixed read and write endpoints --- itk_demo_optoboard/ConfigGUI.json | 98 +++++++++++++++--------------- itk_demo_optoboard/celeryTasks.py | 6 +- itk_demo_optoboard/routes.py | 18 ++++-- ui/src/Controls/Config.js | 4 +- ui/src/Controls/OptoStatus.js | 4 +- ui/src/Controls/WriteReadBox.js | 10 +-- ui/src/SimpleTabs/OptoboardGUI.js | 24 -------- ui/src/SimpleTabs/OptoboardList.js | 6 +- 8 files changed, 77 insertions(+), 93 deletions(-) diff --git a/itk_demo_optoboard/ConfigGUI.json b/itk_demo_optoboard/ConfigGUI.json index 4071cd2..bde1b8c 100644 --- a/itk_demo_optoboard/ConfigGUI.json +++ b/itk_demo_optoboard/ConfigGUI.json @@ -17,95 +17,95 @@ ], "SR1": [ { - "serialNumber": "00000000", + "ConfigurationDB": "http://localhost:5000", + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", "Position": "OB0", - "vtrxVersion": "1.3", + "debugCheckBox": false, "flx_G": "0", "flx_d": "0", - "withoutFelixcore": false, - "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", "inDBCheckBox": false, - "ConfigurationDB": "http://localhost:5000", - "debugCheckBox": false, - "testmode": false + "serialNumber": "00000000", + "testmode": true, + "vtrxVersion": "1.3", + "withoutFelixcore": false }, { - "serialNumber": "00000000", + "ConfigurationDB": "http://localhost:5000", + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", "Position": "OB1", - "vtrxVersion": "1.3", + "debugCheckBox": false, "flx_G": "0", "flx_d": "0", - "withoutFelixcore": false, - "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", "inDBCheckBox": false, - "ConfigurationDB": "http://localhost:5000", - "debugCheckBox": false, - "testmode": false + "serialNumber": "00000000", + "testmode": false, + "vtrxVersion": "1.3", + "withoutFelixcore": false }, { - "serialNumber": "00000000", + "ConfigurationDB": "http://localhost:5000", + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", "Position": "OB2", - "vtrxVersion": "1.3", + "debugCheckBox": false, "flx_G": "0", "flx_d": "0", - "withoutFelixcore": false, - "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", "inDBCheckBox": false, - "ConfigurationDB": "http://localhost:5000", - "debugCheckBox": false, - "testmode": false + "serialNumber": "00000000", + "testmode": false, + "vtrxVersion": "1.3", + "withoutFelixcore": false }, { - "serialNumber": "00000000", + "ConfigurationDB": "http://localhost:5000", + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", "Position": "OB3", - "vtrxVersion": "1.3", + "debugCheckBox": false, "flx_G": "0", "flx_d": "0", - "withoutFelixcore": false, - "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", "inDBCheckBox": false, - "ConfigurationDB": "http://localhost:5000", - "debugCheckBox": false, - "testmode": false + "serialNumber": "00000000", + "testmode": false, + "vtrxVersion": "1.3", + "withoutFelixcore": false }, { - "serialNumber": "00000000", + "ConfigurationDB": "http://localhost:5000", + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", "Position": "OB4", - "vtrxVersion": "1.3", + "debugCheckBox": false, "flx_G": "0", "flx_d": "0", - "withoutFelixcore": false, - "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", "inDBCheckBox": false, - "ConfigurationDB": "http://localhost:5000", - "debugCheckBox": false, - "testmode": false + "serialNumber": "00000000", + "testmode": false, + "vtrxVersion": "1.3", + "withoutFelixcore": false }, { - "serialNumber": "00000000", + "ConfigurationDB": "http://localhost:5000", + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", "Position": "OB5", - "vtrxVersion": "1.3", + "debugCheckBox": false, "flx_G": "0", "flx_d": "0", - "withoutFelixcore": false, - "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", "inDBCheckBox": false, - "ConfigurationDB": "http://localhost:5000", - "debugCheckBox": false, - "testmode": false + "serialNumber": "00000000", + "testmode": false, + "vtrxVersion": "1.3", + "withoutFelixcore": false }, { - "serialNumber": "00000000", + "ConfigurationDB": "http://localhost:5000", + "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", "Position": "OB6", - "vtrxVersion": "1.3", + "debugCheckBox": false, "flx_G": "0", "flx_d": "0", - "withoutFelixcore": false, - "ConfigurationPath": "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json", "inDBCheckBox": false, - "ConfigurationDB": "http://localhost:5000", - "debugCheckBox": false, - "testmode": false + "serialNumber": "00000000", + "testmode": false, + "vtrxVersion": "1.3", + "withoutFelixcore": false } ] } \ No newline at end of file diff --git a/itk_demo_optoboard/celeryTasks.py b/itk_demo_optoboard/celeryTasks.py index cfb7495..e418864 100644 --- a/itk_demo_optoboard/celeryTasks.py +++ b/itk_demo_optoboard/celeryTasks.py @@ -138,7 +138,7 @@ def initializeOptoboardTasks( with open(os.getcwd() + config_path) as f: try: config_file = json.load(f) - logger.info("Initialising config from %s", config_path) + # logger.info("Initialising config from %s", config_path) except: raise Exception("Unavailable local configuration file!") else: @@ -175,7 +175,7 @@ def initializeOptoboardTasks( Communication_wrapper, debug, ) - logger.info("The optoboard object 'optoObject' is now available!") + # logger.info("The optoboard object 'optoObject' is now available!") return True, optoObject.lpgbt_v, optoObject.activeLpgbt, optoObject.activeGbcr else: @@ -226,7 +226,7 @@ def configureTasks(optoboardPosition, activeLpgbt, activeGbcr): optoboard_dic[optoboardPosition].configure(activeLpgbt, activeGbcr) return "Optoboard configuration completed" except: - logger.warn("Failed configuring!") + # logger.warn("Failed configuring!") return "Optoboard configuration failed" diff --git a/itk_demo_optoboard/routes.py b/itk_demo_optoboard/routes.py index 42241d7..0b93a29 100644 --- a/itk_demo_optoboard/routes.py +++ b/itk_demo_optoboard/routes.py @@ -143,10 +143,14 @@ def write_read_wrapper(): optoboardPosition = str(payload["optoboardPosition"]) device = str(payload["device"]) - register = str(payload["register"]) + register = str(payload["register"])[0].upper() + try: + subregister = str(payload["register"])[1].upper() + except: + subregister = None newValue = int(payload["newValue"], 16) - read_back = writeReadTasks.delay(optoboardPosition, device, register.upper(), None, newValue).wait() + read_back = writeReadTasks.delay(optoboardPosition, device, register, subregister, newValue).wait() return read_back, {'content-type': 'application/json'} def read_wrapper(): @@ -155,9 +159,13 @@ def read_wrapper(): optoboardPosition = str(payload["optoboardPosition"]) device = str(payload["device"]) - register = str(payload["register"]) - - read_back = readTasks.delay(optoboardPosition, device, register.upper(), None).wait() + register = str(payload["register"])[0].upper() + try: + subregister = str(payload["register"])[1].upper() + except: + subregister = None + + read_back = readTasks.delay(optoboardPosition, device, register, subregister).wait() #read_back = readTasks.delay("OB0", "lpgbt1", "ROM", None).wait() return read_back, 200, {'content-type': 'application/json'} diff --git a/ui/src/Controls/Config.js b/ui/src/Controls/Config.js index 3a79135..dd37175 100644 --- a/ui/src/Controls/Config.js +++ b/ui/src/Controls/Config.js @@ -12,7 +12,7 @@ import { } from "@patternfly/react-core"; import { getPostBody, checkResponse } from "../utils/utility-functions"; -function Config({ backendUrl, optoboardPosition, optoComponents }) { +function Config({ url, optoboardPosition, optoComponents }) { const [isLoading, setisLoading] = useState(false); const [switchState, setswitchState] = useState(false); const [CheckBox_lpgbt1, toggleBox_lpgbt1] = useState( @@ -68,7 +68,7 @@ function Config({ backendUrl, optoboardPosition, optoComponents }) { console.log("Starting configuration of the Optoboard!"); console.log(body); - fetch(`${backendUrl}/configure`, getPostBody(body)) + fetch(`${url}/configure`, getPostBody(body)) .then((response) => checkResponse(response)) .then((data) => { console.log(data); diff --git a/ui/src/Controls/OptoStatus.js b/ui/src/Controls/OptoStatus.js index 5375b85..86d4307 100644 --- a/ui/src/Controls/OptoStatus.js +++ b/ui/src/Controls/OptoStatus.js @@ -17,7 +17,7 @@ import ExclamationCircleIcon from "@patternfly/react-icons/dist/esm/icons/exclam import CheckCircleIcon from "@patternfly/react-icons/dist/esm/icons/check-circle-icon"; import BanIcon from "@patternfly/react-icons/dist/esm/icons/ban-icon"; -export function OptoStatus({ backendUrl, optoboardPosition, optoComponents }) { +export function OptoStatus({ url, optoboardPosition, optoComponents }) { const [isLoading, setisLoading] = useState(false); const [Status1, setStatus1] = useState( @@ -45,7 +45,7 @@ export function OptoStatus({ backendUrl, optoboardPosition, optoComponents }) { const requestData = { optoboardPosition: optoboardPosition, }; - fetch(`${backendUrl}/statuscheck`, getPostBody(requestData)) + fetch(`${url}/statuscheck`, getPostBody(requestData)) .then((response) => checkResponse(response)) .then((data) => { console.log(data); diff --git a/ui/src/Controls/WriteReadBox.js b/ui/src/Controls/WriteReadBox.js index 8a707bc..3b221d5 100644 --- a/ui/src/Controls/WriteReadBox.js +++ b/ui/src/Controls/WriteReadBox.js @@ -20,7 +20,7 @@ import { getPostBody, checkResponse } from "../utils/utility-functions"; import { Registers } from "../Config/Registers"; export function WriteReadBox({ - backendUrl, + url, optoboardPosition, optoComponents, vtrxVersion, @@ -78,9 +78,9 @@ export function WriteReadBox({ const requestData = { optoboardPosition: optoboardPosition, register: reg_address, - device: device[device_val].label, + device: device_val, }; - fetch(`${backendUrl}/sendReadRequest`, getPostBody(requestData)) + fetch(`${url}/sendReadRequest`, getPostBody(requestData)) .then((response) => checkResponse(response)) .then((data) => { console.log(data); @@ -148,11 +148,11 @@ export function WriteReadBox({ const write_device = (reg_address, new_reg_value) => { const requestData = { optoboardPosition: optoboardPosition, - device: device[device_val].label, + device: device_val, register: reg_address, newValue: new_reg_value, }; - fetch(`${backendUrl}/sendWriteRequest`, getPostBody(requestData)) + fetch(`${url}/sendWriteRequest`, getPostBody(requestData)) .then((response) => checkResponse(response)) .then((data) => { console.log(data); diff --git a/ui/src/SimpleTabs/OptoboardGUI.js b/ui/src/SimpleTabs/OptoboardGUI.js index 90f638d..9bd3c47 100644 --- a/ui/src/SimpleTabs/OptoboardGUI.js +++ b/ui/src/SimpleTabs/OptoboardGUI.js @@ -37,9 +37,6 @@ import { CodeEditor, Language } from "@patternfly/react-code-editor"; // import { LogViewer } from "@patternfly/react-log-viewer"; -import CogIcon from "@patternfly/react-icons/dist/esm/icons/cog-icon"; -import PlusCircleIcon from "@patternfly/react-icons/dist/esm/icons/plus-circle-icon"; - import { getPostBody, checkResponse } from "../utils/utility-functions"; export function OptoboardGUI({ url }) { @@ -48,7 +45,6 @@ export function OptoboardGUI({ url }) { const [DefaultConfigChange, setDefaultConfigChange] = useState( "Add New Configuration" ); - // const [ChangeConfig, setChangeConfig] = useState(); const [isOpenConfig, setisOpenConfig] = useState(false); const [isNotDrawerOpen, setisNotDrawerOpen] = useState(false); const [newConfigName, setnewConfigName] = useState(""); @@ -312,26 +308,6 @@ export function OptoboardGUI({ url }) { onClose={() => { setisOpenConfig(false); }} - /* actions={[ - <Button - key="confirm" - variant="primary" - onClick={() => { - setisOpenConfig(false); - }} - > - Confirm - </Button>, - <Button - key="cancel" - variant="link" - onClick={() => { - setisOpenConfig(false); - }} - > - Cancel - </Button>, - ]} */ > <Panel> <PanelMain> diff --git a/ui/src/SimpleTabs/OptoboardList.js b/ui/src/SimpleTabs/OptoboardList.js index 10c83f3..1d291f9 100644 --- a/ui/src/SimpleTabs/OptoboardList.js +++ b/ui/src/SimpleTabs/OptoboardList.js @@ -146,7 +146,7 @@ export function OptoboardList({ url, DefaultConfig, Configurations }) { <Flex> <FlexItem> <WriteReadBox - backendUrl={url} + url={url} optoboardPosition={opto.Position} optoComponents={optoListInfo[opto.Position].components} vtrxVersion={opto.vtrxVersion} @@ -154,12 +154,12 @@ export function OptoboardList({ url, DefaultConfig, Configurations }) { </FlexItem> <FlexItem> <Config - backendUrl={url} + url={url} optoboardPosition={opto.Position} optoComponents={optoListInfo[opto.Position].components} /> <OptoStatus - backendUrl={url} + url={url} optoboardPosition={opto.Position} optoComponents={optoListInfo[opto.Position].components} /> -- GitLab From dc5482bb1d17c4e83200508eeae44273592de995 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Thu, 23 Feb 2023 15:59:13 +0100 Subject: [PATCH 25/33] Middleware cleanup --- itk_demo_optoboard/celeryTasks.py | 85 +------- itk_demo_optoboard/routes.py | 205 +++++------------- openapi/openapi.yaml | 347 +----------------------------- ui/src/index.tsx | 12 -- 4 files changed, 71 insertions(+), 578 deletions(-) diff --git a/itk_demo_optoboard/celeryTasks.py b/itk_demo_optoboard/celeryTasks.py index e418864..bf5035b 100644 --- a/itk_demo_optoboard/celeryTasks.py +++ b/itk_demo_optoboard/celeryTasks.py @@ -110,78 +110,6 @@ def modifyOptoGUIConfTasks(confKey, newConfiguration): return OptoGUIConf, defaultConfig -@celery.task() -def statusCheckTasks(optoboardPosition): - optoboard_dic[optoboardPosition].opto_doc() - return {"status": "1111"} - - -@celery.task() -def initializeOptoboardTasks( - optoboard_serial, - config_path, - vtrx_v, - flx_G, - flx_d, - woflxcore, - CONFIGDB_ADDRESS, - configInDB, - debug, - testmode, -): - - ######### Provide the configuration file - global glob_config_path - glob_config_path = config_path - - if not configInDB: - with open(os.getcwd() + config_path) as f: - try: - config_file = json.load(f) - # logger.info("Initialising config from %s", config_path) - except: - raise Exception("Unavailable local configuration file!") - else: - if configDbUnavailable(CONFIGDB_ADDRESS): - raise Exception("Unavailable configuration database") - else: - config_file = getConfigDataset() - - if optoboard_serial in components.keys(): - - ######### Provide the component dataset - global components_opto - components_opto = OrderedDict(components[optoboard_serial]) - - ######### Initialize the communication wrapper - global Communication_wrapper - Communication_wrapper = CommWrapper( - flx_G=flx_G, - flx_d=flx_d, - lpgbt_master_addr=components_opto["lpgbt_master_addr"], - lpgbt_v=components_opto["lpgbt_v"], - woflxcore=woflxcore, - test_mode=testmode, - ) - - ######### Initialize the optoboard - - global optoObject - optoObject = Optoboard( - config_file, - optoboard_serial, - vtrx_v, - components_opto, - Communication_wrapper, - debug, - ) - # logger.info("The optoboard object 'optoObject' is now available!") - - return True, optoObject.lpgbt_v, optoObject.activeLpgbt, optoObject.activeGbcr - else: - return False, "", "", "" - - @celery.task() def writeReadTasks(optoboardPosition, device, registerName, fieldName, newValue): RequestStatus = 200 @@ -211,15 +139,16 @@ def readTasks(optoboardPosition, device, registerName, fieldName): except: return -1 +### optoboard status @celery.task() -def sendRegisterNoReadBackTasks(device, registerName, fieldName, newValue): - eval("optoObject." + device).write(registerName, fieldName, newValue) +def statusCheckTasks(optoboardPosition): + optoboard_dic[optoboardPosition].opto_doc() + return {"status": "1111"} ### configuration tasks - @celery.task() def configureTasks(optoboardPosition, activeLpgbt, activeGbcr): try: @@ -230,14 +159,8 @@ def configureTasks(optoboardPosition, activeLpgbt, activeGbcr): return "Optoboard configuration failed" -@celery.task() -def set_I2C_settingsTasks(): - optoObject.lpgbt1.configure_I2C_controller() - - ### task for BER test - @celery.task() def BERT_Tasks(device, BERTSOURCE_G, BERTSOURCE_C, BERTMEASTIME): BERT_result = eval("optoObject." + device).bert( diff --git a/itk_demo_optoboard/routes.py b/itk_demo_optoboard/routes.py index 0b93a29..48d9290 100644 --- a/itk_demo_optoboard/routes.py +++ b/itk_demo_optoboard/routes.py @@ -34,108 +34,6 @@ def modifyOptoGUIConf(): return {"optoGUIConf": OptoGUIConf, "defaultConfig": defaultConfig}, 200, {'content-type': 'application/json'} -def statuscheck(): - payload = request.get_json() - optoboardPosition = str(payload["optoboardPosition"]) - status = statusCheckTasks.delay(optoboardPosition).wait() - - return status, 200, {'content-type': 'application/json'} - - -def initializeOptoboard_wrapper(): - - payload = request.get_json() - optoserial = str(payload["optoserial"]) - config_path = str(payload["config_path"]) - vtrx_v = str(payload["vtrx_v"]) - flx_G = int(payload["flx_G"]) - flx_d = int(payload["flx_d"]) - woflxcore = bool(payload["woflxcore"]) - CONFIGDB_ADDRESS = str(payload["CONFIGDB_ADDRESS"]) - - configInDB = bool(payload["configInDB"]) - debug = bool(payload["debug"]) - testmode = bool(payload["testmode"]) - - boolSerial, lpgbt_v, activeLpgbt, activeGbcr = initializeOptoboardTasks.delay(optoserial, config_path, vtrx_v, flx_G, flx_d, woflxcore, CONFIGDB_ADDRESS, configInDB, debug, testmode).wait() - - return {"boolSerial" : boolSerial, "lpgbt_v" : str(lpgbt_v), "activeLpgbt": activeLpgbt, "activeGbcr": activeGbcr}, 200, {'content-type': 'application/json'} - - -def testCharacteristics_wrapper(): - device = request.get_json() - #print(payload) - - characteristics = testCharacteristicsTasks.delay(device).wait() - - return characteristics, 200, {'content-type': 'application/json'} - - - -def sendRegister_wrapper(): - payload = request.get_json() - print(payload) - - device = payload['device'] - registerName = payload['registerName'] - fieldName = payload['settingName'] - newValue = payload['newValue'] - if fieldName == 'DPDATAPATTERN': - newValue = int(newValue,2) - else: newValue = int(newValue) - - read_back = writeReadTasks.delay(device, registerName.upper(), fieldName.upper(), newValue).wait() - #read_back = write_read(device, registerName.upper(), fieldName.upper(), newValue) - - return str(f'Read-back value {read_back}'), 200, {'content-type': 'application/json'} - -def sendRegisterNoReadBack_wrapper(): - payload = request.get_json() - print(payload) - - device = payload['device'] - registerName = payload['registerName'] - fieldName = payload['settingName'] - newValue = payload['newValue'] - newValue = int(newValue) - - sendRegisterNoReadBackTasks.delay(device, registerName.upper(), fieldName.upper(), newValue).wait() - - return str(f'Written register: {registerName}_{fieldName}. No read-back requested!'), 200, {'content-type': 'application/json'} - -def sendRegisterEQ_wrapper(): - payload = request.get_json() - print(payload) - - device = payload['device'] - registerName0 = payload['registerName0'] - registerName1 = payload['registerName1'] - fieldName = payload['settingName'] - newValue = payload['newValue'] - - newValue = str('{0:02b}'.format(int(newValue))) - - read_back0 = writeReadTasks.delay(device, registerName0.upper(), fieldName.upper(), int(newValue[1])).wait() - read_back1 = writeReadTasks.delay(device, registerName1.upper(), fieldName.upper(), int(newValue[0])).wait() - - return str(f'Read-back value {read_back1}{read_back0} Give a look to Modal!'), 200, {'content-type': 'application/json'} - -def sendConstPattern_wrapper(): - payload = request.get_json() - print(payload) - device = payload['device'] - fieldName = payload['settingName'] - newValue1, newValue2, newValue3, newValue4 = int(payload['newValue1'],2), int(payload['newValue2'],2), int(payload['newValue3'],2), int(payload['newValue4'],2) - registerName1, registerName2, registerName3, registerName4 = payload['registerName1'], payload['registerName2'], payload['registerName3'], payload['registerName4'] - - read_back1 = writeReadTasks.delay(device, registerName1.upper(), fieldName.upper(), newValue1).wait() - read_back2 = writeReadTasks.delay(device, registerName2.upper(), fieldName.upper(), newValue2).wait() - read_back3 = writeReadTasks.delay(device, registerName3.upper(), fieldName.upper(), newValue3).wait() - read_back4 = writeReadTasks.delay(device, registerName4.upper(), fieldName.upper(), newValue4).wait() - - return str(f'Read-back value {read_back1} - {read_back2} - {read_back3} - {read_back4}'), 200, {'content-type': 'application/json'} - - def write_read_wrapper(): @@ -170,20 +68,6 @@ def read_wrapper(): return read_back, 200, {'content-type': 'application/json'} - - -def set_I2C_settings_wrapper(): - - try: - set_I2C_settingsTasks.delay().wait() - reply = "I2C configuration completed" - except: - reply = "I2C configuration failed" - - - return str(reply), 200, {'content-type': 'application/json'} - - def configure_wrapper(): payload = request.get_json() @@ -197,6 +81,62 @@ def configure_wrapper(): return reply, 200, {'content-type': 'application/json'} #{"reply": reply} + +""" def initializeOptoboard_wrapper(): + + payload = request.get_json() + optoserial = str(payload["optoserial"]) + config_path = str(payload["config_path"]) + vtrx_v = str(payload["vtrx_v"]) + flx_G = int(payload["flx_G"]) + flx_d = int(payload["flx_d"]) + woflxcore = bool(payload["woflxcore"]) + CONFIGDB_ADDRESS = str(payload["CONFIGDB_ADDRESS"]) + + configInDB = bool(payload["configInDB"]) + debug = bool(payload["debug"]) + testmode = bool(payload["testmode"]) + + boolSerial, lpgbt_v, activeLpgbt, activeGbcr = initializeOptoboardTasks.delay(optoserial, config_path, vtrx_v, flx_G, flx_d, woflxcore, CONFIGDB_ADDRESS, configInDB, debug, testmode).wait() + + return {"boolSerial" : boolSerial, "lpgbt_v" : str(lpgbt_v), "activeLpgbt": activeLpgbt, "activeGbcr": activeGbcr}, 200, {'content-type': 'application/json'} """ + + +""" def sendRegister_wrapper(): + payload = request.get_json() + print(payload) + + device = payload['device'] + registerName = payload['registerName'] + fieldName = payload['settingName'] + newValue = payload['newValue'] + if fieldName == 'DPDATAPATTERN': + newValue = int(newValue,2) + else: newValue = int(newValue) + + read_back = writeReadTasks.delay(device, registerName.upper(), fieldName.upper(), newValue).wait() + #read_back = write_read(device, registerName.upper(), fieldName.upper(), newValue) + + return str(f'Read-back value {read_back}'), 200, {'content-type': 'application/json'} """ + + +def statuscheck(): + payload = request.get_json() + optoboardPosition = str(payload["optoboardPosition"]) + status = statusCheckTasks.delay(optoboardPosition).wait() + + return status, 200, {'content-type': 'application/json'} + + +def testCharacteristics_wrapper(): + device = request.get_json() + #print(payload) + + characteristics = testCharacteristicsTasks.delay(device).wait() + + return characteristics, 200, {'content-type': 'application/json'} + + def BERT_wrapper(): payload = request.get_json() @@ -208,27 +148,10 @@ def BERT_wrapper(): def configDbUnavailable_wrapper(): + CONFIGDB_ADDRESS=request.get_json()['CONFIGDB_ADDRESS'] return configDbUnavailableTasks.delay(CONFIGDB_ADDRESS).wait(), 200, {'content-type': 'application/json'} -""" -def initOptoBoardClass_wrapper(): - - payload = request.get_json() - - config_path = str(payload["config_path"]) - optoboard_serial = str(payload["optoboard_serial"]) - vtrx_v = str(payload["vtrx_v"]) - flx_G = str(payload["flx_G"]) - flx_d = str(payload["flx_d"]) - woflxcore = str(payload["woflxcore"]) - CONFIGDB_ADDRESS = str(payload["CONFIGDB_ADDRESS"]) #"http://localhost:5000" - configInDB = str(payload["configInDB"]) - - initOptoBoardClassTasks(config_path, optoboard_serial, vtrx_v, flx_G, flx_d, woflxcore, CONFIGDB_ADDRESS, configInDB) - - return {"Optoboard object initialized successfully!"} -""" def testCelery_wrapper(): @@ -241,12 +164,6 @@ def testCelery_wrapper(): return reply, 200, {'content-type': 'application/json'} -def sendFelixSettings_wrapper(): - payload = request.get_json() - print(payload) - - return str('WORKS!'), 200, {'content-type': 'application/json'} - def checkAvailableDatasetInDB_wrapper(): payload = request.get_json() @@ -258,13 +175,5 @@ def checkAvailableDatasetInDB_wrapper(): return str(isAvailable), 200, {'content-type': 'application/json'} -def config_file_provider_wrapper(): - - payload = request.get_json() - config_file = config_file_providerTasks.delay(payload['name']).wait() - - return json.dumps(config_file), 200, {'content-type': 'application/json'} - - from wsgi import celery from itk_demo_optoboard.celeryTasks import * \ No newline at end of file diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index 271fc10..7437068 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -130,85 +130,6 @@ paths: allOf: - $ref: "#/components/schemas/standard_model" - /testCharacteristics_wrapper: - post: - summary: Endpoint, which provides lpgbt characteristics - x-openapi-router-controller: itk_demo_optoboard.routes - operationId: testCharacteristics_wrapper - requestBody: - description: json serialized object containing data to specify the requested component - content: - application/json: - schema: - $ref: "#/components/schemas/deviceName" - responses: - 200: - $ref: "#/components/responses/characteristics_read" - - /sendRegister: - post: - summary: Receive register name and settings and writes it after having converted to the proper address - description: Receive register name and settings and writes it - x-openapi-router-controller: itk_demo_optoboard.routes - operationId: sendRegister_wrapper - requestBody: - description: json object with register name, setting name and new value to write - content: - application/json: - schema: - $ref: "#/components/schemas/sendRegister" - responses: - 200: - $ref: "#/components/responses/config_response" - - /sendRegisterNoReadBack: - post: - summary: Receive register name and settings and writes it after having converted to the proper address - description: Receive register name and settings and writes it - x-openapi-router-controller: itk_demo_optoboard.routes - operationId: sendRegisterNoReadBack_wrapper - requestBody: - description: json object with register name, setting name and new value to write - content: - application/json: - schema: - $ref: "#/components/schemas/sendRegister" - responses: - 200: - $ref: "#/components/responses/config_response" - - /sendRegisterEQ: - post: - summary: Receive register name and settings and writes it after having converted to the proper address (EQUALIZER) - description: Receive register name and settings and writes it (EQUALIZER) - x-openapi-router-controller: itk_demo_optoboard.routes - operationId: sendRegisterEQ_wrapper - requestBody: - description: json object with register name, setting name and new value to write - content: - application/json: - schema: - $ref: "#/components/schemas/sendRegisterEQ" - responses: - 200: - $ref: "#/components/responses/config_response" - - /sendConstPattern: - post: - summary: Send 4 bytes for constant pattern - description: Send 4 bytes for constant pattern, could be substituted by a sendRegister x4 - x-openapi-router-controller: itk_demo_optoboard.routes - operationId: sendConstPattern_wrapper - requestBody: - description: json object with register name x4, setting name and new value x4 to write - content: - application/json: - schema: - $ref: "#/components/schemas/sendConstPattern" - responses: - 200: - $ref: "#/components/responses/config_response" - /sendWriteRequest: post: summary: Write register from name or hexadecimal address @@ -241,15 +162,20 @@ paths: 200: $ref: "#/components/responses/config_response" - /set_I2C_settings: + /testCharacteristics_wrapper: post: - summary: Configure the set_i2c_settings - description: Send multiple registers + summary: Endpoint, which provides lpgbt characteristics x-openapi-router-controller: itk_demo_optoboard.routes - operationId: set_I2C_settings_wrapper + operationId: testCharacteristics_wrapper + requestBody: + description: json serialized object containing data to specify the requested component + content: + application/json: + schema: + $ref: "#/components/schemas/deviceName" responses: 200: - $ref: "#/components/responses/config_response" + $ref: "#/components/responses/characteristics_read" /configure: post: @@ -290,74 +216,6 @@ paths: 200: $ref: "#/components/responses/BERT_response" - /initializeOptoboard: - post: - summary: Initialize Optoboard - description: Initialize Optoboard object - x-openapi-router-controller: itk_demo_optoboard.routes - operationId: initializeOptoboard_wrapper - requestBody: - description: json serialized object containing the parameters needed for the inizialization of the optoboard object - content: - application/json: - schema: - type: object - properties: - optoserial: - type: string - example: "00000000" - description: response-text - vtrx_v: - type: string - example: "1_2" - description: response-text - flx_G: - type: integer - example: 0 - description: response-text - flx_d: - type: integer - example: 0 - description: response-text - woflxcore: - type: boolean - example: false - description: response-text - config_path: - type: string - example: "itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json" - description: response-text - CONFIGDB_ADDRESS: - type: string - example: "http://localhost:5000" - description: response-text - configInDB: - type: boolean - example: false - description: response-text - debug: - type: boolean - example: false - description: response-text - testmode: - type: boolean - example: false - description: Enable the test mode allowing to use the microservice without felix - required: - - optoserial - - vtrx_v - - flx_G - - flx_d - - woflxcore - - config_path - - CONFIGDB_ADDRESS - - configInDB - - debug - - testmode - responses: - 200: - $ref: "#/components/responses/OptoSerial_response" - /configDbUnavailable_wrapper: post: summary: Check if the configuration database is unavailable @@ -405,22 +263,6 @@ paths: 200: $ref: "#/components/responses/testCelery_response" - /sendFelixSettings: - post: - summary: Send fice settings - description: Send a dictionary with minimal Felix settings - x-openapi-router-controller: itk_demo_optoboard.routes - operationId: sendFelixSettings_wrapper - requestBody: - description: json object with Felix settings - content: - application/json: - schema: - $ref: "#/components/schemas/deviceName" - responses: - 200: - $ref: "#/components/responses/config_response" - /checkAvailableDatasetInDB: post: summary: Check if file in DB is available @@ -458,37 +300,6 @@ paths: type: integer example: 0 - /config_file_provider: - post: - summary: Fetch configuration file - description: Fetch configuration file - x-openapi-router-controller: itk_demo_optoboard.routes - operationId: config_file_provider_wrapper - requestBody: - description: json serialized object - content: - application/json: - schema: - type: object - properties: - name: - type: string - example: "components.json" - description: response-text - vtrx_v: - type: string - example: "1.2" - inDB: - type: integer - example: 1 - required: - - name - - vtrx_v - - inDB - responses: - 200: - $ref: "#/components/responses/config_response" - components: schemas: standard_model: @@ -573,113 +384,6 @@ components: - register - device - sendRegister: - type: object - properties: - device: - type: string - example: "lpgbt1master" - description: Name of the device to which the read/write request is sent - registerName: - type: string - example: "SomeName" - description: Register name - settingName: - type: string - example: "SomeName" - description: Setting name - newValue: - type: string - example: "0" - description: New value for the considered setting of the register - - required: - - registerName - - settingName - - sendRegisterEQ: - type: object - properties: - device: - type: string - example: "lpgbt1master" - description: Name of the device to which the read/write request is sent - registerName0: - type: string - example: "SomeName" - description: Register name bit 0 - registerName1: - type: string - example: "SomeName" - description: Register name bit 1 - settingName: - type: string - example: "SomeName" - description: Setting name - newValue: - type: string - example: "0" - description: New value for the considered setting of the register - - required: - - registerName0 - - registerName1 - - settingName - - sendConstPattern: - type: object - properties: - device: - type: string - example: "lpgbt1" - description: Name of the device to which the read/write request is sent - settingName: - type: string - example: "SomeName" - description: Setting name - registerName1: - type: string - example: "SomeName" - description: Register name - newValue1: - type: string - example: "0" - description: New value for the considered setting of the register - registerName2: - type: string - example: "SomeName" - description: Register name - newValue2: - type: string - example: "0" - description: New value for the considered setting of the register - registerName3: - type: string - example: "SomeName" - description: Register name - newValue3: - type: string - example: "0" - description: New value for the considered setting of the register - registerName4: - type: string - example: "SomeName" - description: Register name - newValue4: - type: string - example: "0" - description: New value for the considered setting of the register - required: - - registerName1 - - registerName2 - - registerName3 - - registerName4 - - newValue1 - - newValue2 - - newValue3 - - newValue4 - - settingName - responses: config_response: description: Returns a value that signals if the configuration was successful @@ -732,37 +436,6 @@ components: type: string example: "0" - Configuration_result: - description: Returns the configuration result - content: - application/json: - schema: - type: object - properties: - reply: - type: string - example: "Configuration result" - - OptoSerial_response: - description: does the serial exist - content: - application/json: - schema: - type: object - properties: - boolSerial: - type: boolean - example: true - lpgbt_v: - type: string - example: "0" - activeLpgbt: - type: string - example: "0000" - activeGbcr: - type: string - example: "0000" - testCelery_response: description: Test endpoint content: diff --git a/ui/src/index.tsx b/ui/src/index.tsx index 6218ef2..34368ba 100644 --- a/ui/src/index.tsx +++ b/ui/src/index.tsx @@ -1,17 +1,5 @@ -import React from "react"; import ReactDOM from "react-dom"; import "@patternfly/react-core/dist/styles/base.css"; -import { - Page, - PageSection, - TextContent, - Text, - TextVariants, - PageHeader, - Panel, - PanelMain, - PanelMainBody, -} from "@patternfly/react-core"; import { OptoboardGUI } from "./SimpleTabs/OptoboardGUI"; // the url provided in the ReactDOM is used inside the gui for the fetch commands -- GitLab From 27f9b08b141e1466ec398fc81aea5a26473e898a Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Thu, 23 Feb 2023 17:10:50 +0100 Subject: [PATCH 26/33] Cleanup, add button for configure all --- itk_demo_optoboard/ConfigGUI.json | 2 +- itk_demo_optoboard/celeryTasks.py | 9 +++++-- openapi/openapi.yaml | 2 -- ui/src/Controls/Config.js | 3 +++ ui/src/Controls/OptoStatus.js | 8 +++--- ui/src/SimpleTabs/OptoboardGUI.js | 45 ++++++++++++++++--------------- 6 files changed, 39 insertions(+), 30 deletions(-) diff --git a/itk_demo_optoboard/ConfigGUI.json b/itk_demo_optoboard/ConfigGUI.json index bde1b8c..fed4d0d 100644 --- a/itk_demo_optoboard/ConfigGUI.json +++ b/itk_demo_optoboard/ConfigGUI.json @@ -38,7 +38,7 @@ "flx_d": "0", "inDBCheckBox": false, "serialNumber": "00000000", - "testmode": false, + "testmode": true, "vtrxVersion": "1.3", "withoutFelixcore": false }, diff --git a/itk_demo_optoboard/celeryTasks.py b/itk_demo_optoboard/celeryTasks.py index bf5035b..212c458 100644 --- a/itk_demo_optoboard/celeryTasks.py +++ b/itk_demo_optoboard/celeryTasks.py @@ -143,8 +143,13 @@ def readTasks(optoboardPosition, device, registerName, fieldName): @celery.task() def statusCheckTasks(optoboardPosition): - optoboard_dic[optoboardPosition].opto_doc() - return {"status": "1111"} + full_dic = optoboard_dic[optoboardPosition].opto_doc() + status = {"lpgbt1": 0, "lpgbt1": 0, "lpgbt1": 0, "lpgbt1": 0} + for key, device_dic in full_dic.items(): + if key[:-1] == "lpgbt": + if device_dic["PUSM_ready"] is True: + status[key] = 1 + return status ### configuration tasks diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index 7437068..8260ebc 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -127,8 +127,6 @@ paths: application/json: schema: type: object - allOf: - - $ref: "#/components/schemas/standard_model" /sendWriteRequest: post: diff --git a/ui/src/Controls/Config.js b/ui/src/Controls/Config.js index dd37175..a8eb29e 100644 --- a/ui/src/Controls/Config.js +++ b/ui/src/Controls/Config.js @@ -79,6 +79,9 @@ function Config({ url, optoboardPosition, optoComponents }) { setbuttonVariant("primary"); } }) + .catch((err) => { + console.log(err); + }) .finally(() => { setisLoading(false); }); diff --git a/ui/src/Controls/OptoStatus.js b/ui/src/Controls/OptoStatus.js index 86d4307..0fad079 100644 --- a/ui/src/Controls/OptoStatus.js +++ b/ui/src/Controls/OptoStatus.js @@ -50,7 +50,7 @@ export function OptoStatus({ url, optoboardPosition, optoComponents }) { .then((data) => { console.log(data); setStatus1( - 1 === 1 ? ( + data.lpgbt1 === 1 ? ( <Icon status="success"> <CheckCircleIcon /> </Icon> @@ -61,7 +61,7 @@ export function OptoStatus({ url, optoboardPosition, optoComponents }) { ) ); setStatus2( - 1 === 1 ? ( + data.lpgbt2 === 1 ? ( <Icon status="success"> <CheckCircleIcon /> </Icon> @@ -72,7 +72,7 @@ export function OptoStatus({ url, optoboardPosition, optoComponents }) { ) ); setStatus3( - 1 === 1 ? ( + data.lpgbt3 === 1 ? ( <Icon status="success"> <CheckCircleIcon /> </Icon> @@ -83,7 +83,7 @@ export function OptoStatus({ url, optoboardPosition, optoComponents }) { ) ); setStatus4( - 1 === 1 ? ( + data.lpgbt4 === 1 ? ( <Icon status="success"> <CheckCircleIcon /> </Icon> diff --git a/ui/src/SimpleTabs/OptoboardGUI.js b/ui/src/SimpleTabs/OptoboardGUI.js index 9bd3c47..f2004c2 100644 --- a/ui/src/SimpleTabs/OptoboardGUI.js +++ b/ui/src/SimpleTabs/OptoboardGUI.js @@ -1,6 +1,4 @@ import React, { useState, useEffect } from "react"; -import { SimpleList, SimpleListItem } from "@patternfly/react-core"; -import { Config } from "../Controls/Config"; // import { defaultConfig, Configurations } from "../Config/Configurations"; import { OptoboardList } from "../SimpleTabs/OptoboardList"; import { AddOptoboard } from "../SimpleTabs/AddOptoboard"; @@ -57,6 +55,7 @@ export function OptoboardGUI({ url }) { useState([]); const [loadingConfig, setloadingConfig] = useState(true); + const [optoConfigResult, setoptoConfigResult] = useState("primary"); function getConfigGUI() { setloadingConfig(true); @@ -78,6 +77,23 @@ export function OptoboardGUI({ url }) { getConfigGUI(); }, []); + function editConfig(confKey, newConfiguration) { + console.log({ confKey: confKey, newConfiguration: newConfiguration }); + fetch( + `${url}/modifyOptoGUIConf`, + getPostBody({ confKey: confKey, newConfiguration: newConfiguration }) + ) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + // setisOpenConfig(false); + getConfigGUI(); + }) + .catch((err) => { + console.log(err); + }); + } + useEffect(() => { setDefaultConfig(DefaultConfig); let X = []; @@ -157,23 +173,6 @@ export function OptoboardGUI({ url }) { </NotificationDrawer> ); - function editConfig(confKey, newConfiguration) { - console.log({ confKey: confKey, newConfiguration: newConfiguration }); - fetch( - `${url}/modifyOptoGUIConf`, - getPostBody({ confKey: confKey, newConfiguration: newConfiguration }) - ) - .then((response) => checkResponse(response)) - .then((data) => { - console.log(data); - // setisOpenConfig(false); - getConfigGUI(); - }) - .catch((err) => { - console.log(err); - }); - } - if (loadingConfig) { return ( <React.Fragment> @@ -227,10 +226,14 @@ export function OptoboardGUI({ url }) { <PanelMain> <PanelMainBody> <Flex> + <FlexItem key={"add_configuration"}> + <Button variant="primary" onClick={() => {}}> + <h3> Configure all Optoboards </h3> + </Button> + </FlexItem> <FlexItem key={"add_configuration"}> <Button variant="secondary" - isLarge onClick={() => setisOpenConfig(!isOpenConfig)} > <h3> Add GUI Configuration </h3> @@ -397,7 +400,7 @@ export function OptoboardGUI({ url }) { <FlexItem> <Button key="confirm2" - variant="primary" + variant={optoConfigResult} onClick={() => { editConfig( DefaultConfigChange == "Add New Configuration" -- GitLab From ec41e1680ec3df3fe7bc6d0ead1e325d9db0c2e4 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Fri, 24 Feb 2023 13:36:14 +0100 Subject: [PATCH 27/33] "Configure all" function --- itk_demo_optoboard/celeryTasks.py | 43 ++++++++++--- itk_demo_optoboard/routes.py | 98 +++++++++++++++++++++--------- openapi/openapi.yaml | 10 +++ ui/src/SimpleTabs/OptoboardGUI.js | 33 ++++++++-- ui/src/SimpleTabs/OptoboardList.js | 1 - 5 files changed, 142 insertions(+), 43 deletions(-) diff --git a/itk_demo_optoboard/celeryTasks.py b/itk_demo_optoboard/celeryTasks.py index 212c458..6b2c7f8 100644 --- a/itk_demo_optoboard/celeryTasks.py +++ b/itk_demo_optoboard/celeryTasks.py @@ -24,7 +24,7 @@ def initOptoListTask(optoboard_list): global opto_info_dic optoboard_dic = {} opto_info_dic = {} - + for x in optoboard_list["optoList"]: if x["serialNumber"] in components.keys(): @@ -43,8 +43,19 @@ def initOptoListTask(optoboard_list): raise ValueError("Invalid vtrx version provided!") if not x["inDBCheckBox"]: - if x["ConfigurationPath"]!="": - configuration_path = os.getcwd() + "/itk_demo_optoboard/optoboard_felix/configs/optoboard"+ str(components_opto["optoboard_v"]) + "_lpgbtv" + str(components_opto["lpgbt_v"]) + "_gbcr" + str(components_opto["gbcr_v"]) + "_vtrxv" + vtrx_v_string + "_default.json" + if x["ConfigurationPath"] != "": + configuration_path = ( + os.getcwd() + + "/itk_demo_optoboard/optoboard_felix/configs/optoboard" + + str(components_opto["optoboard_v"]) + + "_lpgbtv" + + str(components_opto["lpgbt_v"]) + + "_gbcr" + + str(components_opto["gbcr_v"]) + + "_vtrxv" + + vtrx_v_string + + "_default.json" + ) else: configuration_path = os.getcwd() + x["ConfigurationPath"] with open(configuration_path) as f: @@ -81,32 +92,34 @@ def initOptoListTask(optoboard_list): logger.info("Optoboard in position " + x["Position"] + " has been added!") return opto_info_dic + @celery.task() def getOptoGUIConfTasks(): with open(os.getcwd() + "/itk_demo_optoboard/ConfigGUI.json") as f: config_json = json.load(f) defaultConfig = config_json["defaultConfig"] - OptoGUIConf = {x: config_json[x] for x in config_json if x!="defaultConfig"} + OptoGUIConf = {x: config_json[x] for x in config_json if x != "defaultConfig"} return OptoGUIConf, defaultConfig + @celery.task() def modifyOptoGUIConfTasks(confKey, newConfiguration): if confKey != "defaultConfig": newConfiguration = json.loads(newConfiguration) - + with open(os.getcwd() + "/itk_demo_optoboard/ConfigGUI.json", "r+") as f: config_json = json.load(f) config_json[confKey] = newConfiguration defaultConfig = config_json["defaultConfig"] - OptoGUIConf = {x: config_json[x] for x in config_json if x!="defaultConfig"} + OptoGUIConf = {x: config_json[x] for x in config_json if x != "defaultConfig"} # logger.warn(json.dumps(config_json, indent = 4)) f.seek(0) f.truncate(0) - json.dump(config_json, f, indent = 2) - + json.dump(config_json, f, indent=2) + return OptoGUIConf, defaultConfig @@ -139,8 +152,10 @@ def readTasks(optoboardPosition, device, registerName, fieldName): except: return -1 + ### optoboard status + @celery.task() def statusCheckTasks(optoboardPosition): full_dic = optoboard_dic[optoboardPosition].opto_doc() @@ -154,6 +169,7 @@ def statusCheckTasks(optoboardPosition): ### configuration tasks + @celery.task() def configureTasks(optoboardPosition, activeLpgbt, activeGbcr): try: @@ -164,8 +180,19 @@ def configureTasks(optoboardPosition, activeLpgbt, activeGbcr): return "Optoboard configuration failed" +@celery.task() +def configureAllTasks(): + try: + for pos, opto in optoboard_dic.items(): + opto.configure() + return "Configuration completed" + except: + return "Configuration failed" + + ### task for BER test + @celery.task() def BERT_Tasks(device, BERTSOURCE_G, BERTSOURCE_C, BERTMEASTIME): BERT_result = eval("optoObject." + device).bert( diff --git a/itk_demo_optoboard/routes.py b/itk_demo_optoboard/routes.py index 48d9290..1de7129 100644 --- a/itk_demo_optoboard/routes.py +++ b/itk_demo_optoboard/routes.py @@ -10,29 +10,43 @@ logger.setLevel(logging.DEBUG) ch = logging.StreamHandler() logger.addHandler(ch) + def health(): con = {"status": 200} - return con, 200, {'content-type': 'application/json'} + return con, 200, {"content-type": "application/json"} + def sendOptoList(): payload = request.get_json() opto_info_dic = initOptoListTask.delay(payload).wait() - return opto_info_dic, 200, {'content-type': 'application/json'} + return opto_info_dic, 200, {"content-type": "application/json"} + def getOptoGUIConf(): OptoGUIConf, defaultConfig = getOptoGUIConfTasks.delay().wait() - return {"optoGUIConf": OptoGUIConf, "defaultConfig": defaultConfig}, 200, {'content-type': 'application/json'} + return ( + {"optoGUIConf": OptoGUIConf, "defaultConfig": defaultConfig}, + 200, + {"content-type": "application/json"}, + ) + def modifyOptoGUIConf(): payload = request.get_json() confKey = str(payload["confKey"]) newConfiguration = str(payload["newConfiguration"]) - OptoGUIConf, defaultConfig = modifyOptoGUIConfTasks.delay(confKey, newConfiguration).wait() + OptoGUIConf, defaultConfig = modifyOptoGUIConfTasks.delay( + confKey, newConfiguration + ).wait() - return {"optoGUIConf": OptoGUIConf, "defaultConfig": defaultConfig}, 200, {'content-type': 'application/json'} + return ( + {"optoGUIConf": OptoGUIConf, "defaultConfig": defaultConfig}, + 200, + {"content-type": "application/json"}, + ) def write_read_wrapper(): @@ -42,14 +56,17 @@ def write_read_wrapper(): optoboardPosition = str(payload["optoboardPosition"]) device = str(payload["device"]) register = str(payload["register"])[0].upper() - try: + try: subregister = str(payload["register"])[1].upper() except: subregister = None newValue = int(payload["newValue"], 16) - read_back = writeReadTasks.delay(optoboardPosition, device, register, subregister, newValue).wait() - return read_back, {'content-type': 'application/json'} + read_back = writeReadTasks.delay( + optoboardPosition, device, register, subregister, newValue + ).wait() + return read_back, {"content-type": "application/json"} + def read_wrapper(): @@ -58,15 +75,16 @@ def read_wrapper(): optoboardPosition = str(payload["optoboardPosition"]) device = str(payload["device"]) register = str(payload["register"])[0].upper() - try: + try: subregister = str(payload["register"])[1].upper() except: subregister = None read_back = readTasks.delay(optoboardPosition, device, register, subregister).wait() - #read_back = readTasks.delay("OB0", "lpgbt1", "ROM", None).wait() + # read_back = readTasks.delay("OB0", "lpgbt1", "ROM", None).wait() + + return read_back, 200, {"content-type": "application/json"} - return read_back, 200, {'content-type': 'application/json'} def configure_wrapper(): @@ -74,12 +92,18 @@ def configure_wrapper(): optoboardPosition = str(payload["optoboardPosition"]) activeLpgbt = str(payload["activeLpgbt"]) activeGbcr = str(payload["activeGbcr"]) - if activeLpgbt=="None": activeLpgbt=None - if activeGbcr=="None": activeGbcr=None + if activeLpgbt == "None": + activeLpgbt = None + if activeGbcr == "None": + activeGbcr = None reply = configureTasks.delay(optoboardPosition, activeLpgbt, activeGbcr).wait() - return reply, 200, {'content-type': 'application/json'} #{"reply": reply} + return reply, 200, {"content-type": "application/json"} + +def configureAll_wrapper(): + reply = configureAllTasks.delay().wait() + return reply, 200, {"content-type": "application/json"} """ def initializeOptoboard_wrapper(): @@ -124,18 +148,18 @@ def statuscheck(): payload = request.get_json() optoboardPosition = str(payload["optoboardPosition"]) status = statusCheckTasks.delay(optoboardPosition).wait() - - return status, 200, {'content-type': 'application/json'} - + + return status, 200, {"content-type": "application/json"} + def testCharacteristics_wrapper(): device = request.get_json() - #print(payload) + # print(payload) characteristics = testCharacteristicsTasks.delay(device).wait() - return characteristics, 200, {'content-type': 'application/json'} - + return characteristics, 200, {"content-type": "application/json"} + def BERT_wrapper(): @@ -144,13 +168,25 @@ def BERT_wrapper(): BERT_error_count, total_bits, BER_limit = BERT_Tasks.delay(device).wait() - return {"BERT_error_count": "{:.3e}".format(BERT_error_count), "total_bits": "{:.3e}".format(total_bits), "BER_limit": "{:.3e}".format(BER_limit)}, 200, {'content-type': 'application/json'} + return ( + { + "BERT_error_count": "{:.3e}".format(BERT_error_count), + "total_bits": "{:.3e}".format(total_bits), + "BER_limit": "{:.3e}".format(BER_limit), + }, + 200, + {"content-type": "application/json"}, + ) def configDbUnavailable_wrapper(): - CONFIGDB_ADDRESS=request.get_json()['CONFIGDB_ADDRESS'] - return configDbUnavailableTasks.delay(CONFIGDB_ADDRESS).wait(), 200, {'content-type': 'application/json'} + CONFIGDB_ADDRESS = request.get_json()["CONFIGDB_ADDRESS"] + return ( + configDbUnavailableTasks.delay(CONFIGDB_ADDRESS).wait(), + 200, + {"content-type": "application/json"}, + ) def testCelery_wrapper(): @@ -161,19 +197,21 @@ def testCelery_wrapper(): reply = result.wait() print("After wait") - return reply, 200, {'content-type': 'application/json'} + return reply, 200, {"content-type": "application/json"} def checkAvailableDatasetInDB_wrapper(): payload = request.get_json() - path = payload['path'] - inDB = payload['inDB'] - CONFIGDB_ADDRESS = payload['CONFIGDB_ADDRESS'] - isAvailable = checkAvailableDatasetInDBTasks.delay(path, inDB, CONFIGDB_ADDRESS).wait() + path = payload["path"] + inDB = payload["inDB"] + CONFIGDB_ADDRESS = payload["CONFIGDB_ADDRESS"] + isAvailable = checkAvailableDatasetInDBTasks.delay( + path, inDB, CONFIGDB_ADDRESS + ).wait() - return str(isAvailable), 200, {'content-type': 'application/json'} + return str(isAvailable), 200, {"content-type": "application/json"} from wsgi import celery -from itk_demo_optoboard.celeryTasks import * \ No newline at end of file +from itk_demo_optoboard.celeryTasks import * diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index 8260ebc..2b3822c 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -191,6 +191,16 @@ paths: 200: $ref: "#/components/responses/config_response" + /configureAll: + get: + summary: Does a configuration of the Optoboard based on a json file in server + description: Configure the Optoboard + x-openapi-router-controller: itk_demo_optoboard.routes + operationId: configureAll_wrapper + responses: + 200: + $ref: "#/components/responses/config_response" + /BERT_wrapper: post: summary: Does a BER Test diff --git a/ui/src/SimpleTabs/OptoboardGUI.js b/ui/src/SimpleTabs/OptoboardGUI.js index f2004c2..16b4359 100644 --- a/ui/src/SimpleTabs/OptoboardGUI.js +++ b/ui/src/SimpleTabs/OptoboardGUI.js @@ -26,10 +26,8 @@ import { NotificationDrawerListItem, NotificationDrawerListItemBody, NotificationDrawerListItemHeader, - TextArea, TextInput, Spinner, - Title, } from "@patternfly/react-core"; import { CodeEditor, Language } from "@patternfly/react-code-editor"; @@ -56,6 +54,8 @@ export function OptoboardGUI({ url }) { const [loadingConfig, setloadingConfig] = useState(true); const [optoConfigResult, setoptoConfigResult] = useState("primary"); + const [configureAllStatus, setconfigureAllStatus] = useState("primary"); + const [isConfiguring, setisConfiguring] = useState(false); function getConfigGUI() { setloadingConfig(true); @@ -226,8 +226,33 @@ export function OptoboardGUI({ url }) { <PanelMain> <PanelMainBody> <Flex> - <FlexItem key={"add_configuration"}> - <Button variant="primary" onClick={() => {}}> + <FlexItem key={"configureAll"}> + <Button + spinnerAriaValueText={ + isConfiguring ? "ConfiguringAll" : undefined + } + isLoading={isConfiguring} + variant={configureAllStatus} + onClick={() => { + setisConfiguring(true); + fetch(`${url}/configureAll`) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + if (data == "Configuration failed") { + setconfigureAllStatus("danger"); + } else { + setconfigureAllStatus("primary"); + } + }) + .catch((err) => { + console.log(err); + }) + .finally(() => { + setisConfiguring(false); + }); + }} + > <h3> Configure all Optoboards </h3> </Button> </FlexItem> diff --git a/ui/src/SimpleTabs/OptoboardList.js b/ui/src/SimpleTabs/OptoboardList.js index 1d291f9..d256c5d 100644 --- a/ui/src/SimpleTabs/OptoboardList.js +++ b/ui/src/SimpleTabs/OptoboardList.js @@ -68,7 +68,6 @@ export function OptoboardList({ url, DefaultConfig, Configurations }) { }, [DefaultConfig]); if (loadingData) { - console.log("Loading!"); return ( <FlexItem key={"optoInListLoad"}> <Bullseye> -- GitLab From 01fa58c05d19d3e087dde798876568ab9aafbddf Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Fri, 24 Feb 2023 16:19:28 +0100 Subject: [PATCH 28/33] Bert component --- itk_demo_optoboard/routes.py | 1 - ui/src/Controls/Config.js | 248 +++++++++++---------- ui/src/Controls/WriteReadBox.js | 331 +++++++++++++++++++---------- ui/src/SimpleTabs/OptoboardList.js | 47 ++-- 4 files changed, 363 insertions(+), 264 deletions(-) diff --git a/itk_demo_optoboard/routes.py b/itk_demo_optoboard/routes.py index 1de7129..1d101ec 100644 --- a/itk_demo_optoboard/routes.py +++ b/itk_demo_optoboard/routes.py @@ -81,7 +81,6 @@ def read_wrapper(): subregister = None read_back = readTasks.delay(optoboardPosition, device, register, subregister).wait() - # read_back = readTasks.delay("OB0", "lpgbt1", "ROM", None).wait() return read_back, 200, {"content-type": "application/json"} diff --git a/ui/src/Controls/Config.js b/ui/src/Controls/Config.js index a8eb29e..49b41e2 100644 --- a/ui/src/Controls/Config.js +++ b/ui/src/Controls/Config.js @@ -106,135 +106,131 @@ function Config({ url, optoboardPosition, optoComponents }) { return ( <React.Fragment> - <Flex direction={{ default: "column" }}> - <Panel variant=""> - <PanelMain> - <PanelMainBody> - <Bullseye> - <Button - spinnerAriaValueText={isLoading ? "Loading" : undefined} - isLoading={isLoading} - id="readCharacteristics" - variant={buttonVariant} - onClick={(event) => { - configure(); - }} - > - {isLoading ? "Configuring..." : "Configure Optoboard"} - </Button> - </Bullseye> + <Panel variant=""> + <PanelMain> + <Bullseye> + <Button + spinnerAriaValueText={isLoading ? "Loading" : undefined} + isLoading={isLoading} + id="readCharacteristics" + variant={buttonVariant} + onClick={(event) => { + configure(); + }} + > + {isLoading ? "Configuring..." : "Configure"} + </Button> + </Bullseye> - <Bullseye> - <Flex> - <FlexItem> - <Bullseye> - <h3>Manual selection</h3> - </Bullseye> - </FlexItem> - <FlexItem> - <Switch - id="no-label-switch-off" - aria-label="Message when on" - //labelOff="Message when off" - isChecked={switchState} - onChange={() => setswitchState(!switchState)} - //isReversed - /> - </FlexItem> - </Flex> - </Bullseye> + <Bullseye> + <Flex> + <FlexItem> + <Bullseye> + <h3>Manual selection</h3> + </Bullseye> + </FlexItem> + <FlexItem> + <Switch + id="no-label-switch-off" + aria-label="Message when on" + //labelOff="Message when off" + isChecked={switchState} + onChange={() => setswitchState(!switchState)} + //isReversed + /> + </FlexItem> + </Flex> + </Bullseye> - <Bullseye> - <Flex> - <FlexItem>{stringLPGBT}</FlexItem> - <FlexItem> - <Bullseye> - <Checkbox - label={""} - isChecked={CheckBox_lpgbt1} - onChange={() => { - toggleBox_lpgbt1(!CheckBox_lpgbt1); - }} - id={"lpgbt_config_1"} - name={"lpgbt_config_1"} - isDisabled={!(switchState && optoComponents.lpgbt1)} - /> - <Checkbox - label={""} - isChecked={CheckBox_lpgbt2} - onChange={() => { - toggleBox_lpgbt2(!CheckBox_lpgbt2); - }} - id={"lpgbt_config_2"} - name={"lpgbt_config_2"} - isDisabled={!(switchState && optoComponents.lpgbt2)} - /> - <Checkbox - label={""} - isChecked={CheckBox_lpgbt3} - onChange={() => toggleBox_lpgbt3(!CheckBox_lpgbt3)} - id={"lpgbt_config_3"} - name={"lpgbt_config_3"} - isDisabled={!(switchState && optoComponents.lpgbt3)} - /> - <Checkbox - label={""} - isChecked={CheckBox_lpgbt4} - onChange={() => toggleBox_lpgbt4(!CheckBox_lpgbt4)} - id={"lpgbt_config_4"} - name={"lpgbt_config_4"} - isDisabled={!(switchState && optoComponents.lpgbt4)} - /> - </Bullseye> - </FlexItem> - </Flex> - </Bullseye> + <Bullseye> + <Flex> + <FlexItem>{stringLPGBT}</FlexItem> + <FlexItem> + <Bullseye> + <Checkbox + label={""} + isChecked={CheckBox_lpgbt1} + onChange={() => { + toggleBox_lpgbt1(!CheckBox_lpgbt1); + }} + id={"lpgbt_config_1"} + name={"lpgbt_config_1"} + isDisabled={!(switchState && optoComponents.lpgbt1)} + /> + <Checkbox + label={""} + isChecked={CheckBox_lpgbt2} + onChange={() => { + toggleBox_lpgbt2(!CheckBox_lpgbt2); + }} + id={"lpgbt_config_2"} + name={"lpgbt_config_2"} + isDisabled={!(switchState && optoComponents.lpgbt2)} + /> + <Checkbox + label={""} + isChecked={CheckBox_lpgbt3} + onChange={() => toggleBox_lpgbt3(!CheckBox_lpgbt3)} + id={"lpgbt_config_3"} + name={"lpgbt_config_3"} + isDisabled={!(switchState && optoComponents.lpgbt3)} + /> + <Checkbox + label={""} + isChecked={CheckBox_lpgbt4} + onChange={() => toggleBox_lpgbt4(!CheckBox_lpgbt4)} + id={"lpgbt_config_4"} + name={"lpgbt_config_4"} + isDisabled={!(switchState && optoComponents.lpgbt4)} + /> + </Bullseye> + </FlexItem> + </Flex> + </Bullseye> - <Bullseye> - <Flex> - <FlexItem>{stringGBCR}</FlexItem> - <FlexItem> - <Bullseye> - <Checkbox - label={""} - isChecked={CheckBox_gbcr1} - onChange={() => toggleBox_gbcr1(!CheckBox_gbcr1)} - id={"gbcr_config_1"} - name={"gbcr_config_1"} - isDisabled={!(switchState && optoComponents.gbcr1)} - /> - <Checkbox - label={""} - isChecked={CheckBox_gbcr2} - onChange={() => toggleBox_gbcr2(!CheckBox_gbcr2)} - id={"gbcr_config_2"} - name={"gbcr_config_2"} - isDisabled={!(switchState && optoComponents.gbcr2)} - /> - <Checkbox - label={""} - isChecked={CheckBox_gbcr3} - onChange={() => toggleBox_gbcr3(!CheckBox_gbcr3)} - id={"gbcr_config_3"} - name={"gbcr_config_3"} - isDisabled={!(switchState && optoComponents.gbcr3)} - /> - <Checkbox - label={""} - isChecked={CheckBox_gbcr4} - onChange={() => toggleBox_gbcr4(!CheckBox_gbcr4)} - id={"gbcr_config_4"} - name={"gbcr_config_4"} - isDisabled={!(switchState && optoComponents.gbcr4)} - /> - </Bullseye> - </FlexItem> - </Flex> - </Bullseye> - </PanelMainBody> - </PanelMain> - </Panel> - </Flex> + <Bullseye> + <Flex> + <FlexItem>{stringGBCR}</FlexItem> + <FlexItem> + <Bullseye> + <Checkbox + label={""} + isChecked={CheckBox_gbcr1} + onChange={() => toggleBox_gbcr1(!CheckBox_gbcr1)} + id={"gbcr_config_1"} + name={"gbcr_config_1"} + isDisabled={!(switchState && optoComponents.gbcr1)} + /> + <Checkbox + label={""} + isChecked={CheckBox_gbcr2} + onChange={() => toggleBox_gbcr2(!CheckBox_gbcr2)} + id={"gbcr_config_2"} + name={"gbcr_config_2"} + isDisabled={!(switchState && optoComponents.gbcr2)} + /> + <Checkbox + label={""} + isChecked={CheckBox_gbcr3} + onChange={() => toggleBox_gbcr3(!CheckBox_gbcr3)} + id={"gbcr_config_3"} + name={"gbcr_config_3"} + isDisabled={!(switchState && optoComponents.gbcr3)} + /> + <Checkbox + label={""} + isChecked={CheckBox_gbcr4} + onChange={() => toggleBox_gbcr4(!CheckBox_gbcr4)} + id={"gbcr_config_4"} + name={"gbcr_config_4"} + isDisabled={!(switchState && optoComponents.gbcr4)} + /> + </Bullseye> + </FlexItem> + </Flex> + </Bullseye> + </PanelMain> + </Panel> </React.Fragment> ); } diff --git a/ui/src/Controls/WriteReadBox.js b/ui/src/Controls/WriteReadBox.js index 3b221d5..c1bdc1f 100644 --- a/ui/src/Controls/WriteReadBox.js +++ b/ui/src/Controls/WriteReadBox.js @@ -27,19 +27,66 @@ export function WriteReadBox({ }) { const [device_val, setdevice_val] = useState("lpgbt1"); const device = [ - { label: "lpgbt1", disabled: false, value: "lpgbt1" }, - { label: "lpgbt2", disabled: false, value: "lpgbt2" }, - { label: "lpgbt3", disabled: false, value: "lpgbt3" }, - { label: "lpgbt4", disabled: false, value: "lpgbt4" }, - { label: "gbcr1", disabled: false, value: "gbcr1" }, - { label: "gbcr2", disabled: false, value: "gbcr2" }, - { label: "gbcr3", disabled: false, value: "gbcr3" }, - { label: "gbcr4", disabled: false, value: "gbcr4" }, + { + label: "lpgbt1", + disabled: optoComponents.lpgbt1 ? false : true, + value: "lpgbt1", + }, + { + label: "lpgbt2", + disabled: optoComponents.lpgbt2 ? false : true, + value: "lpgbt2", + }, + { + label: "lpgbt3", + disabled: optoComponents.lpgbt3 ? false : true, + value: "lpgbt3", + }, + { + label: "lpgbt4", + disabled: optoComponents.lpgbt4 ? false : true, + value: "lpgbt4", + }, + { + label: "gbcr1", + disabled: optoComponents.gbcr1 ? false : true, + value: "gbcr1", + }, + { + label: "gbcr2", + disabled: optoComponents.gbcr2 ? false : true, + value: "gbcr2", + }, + { + label: "gbcr3", + disabled: optoComponents.gbcr3 ? false : true, + value: "gbcr3", + }, + { + label: "gbcr4", + disabled: optoComponents.gbcr4 ? false : true, + value: "gbcr4", + }, { label: "vtrx", disabled: false, value: "vtrx" }, ]; + const [isBERTing, setisBERTing] = useState(false); + const [channel, setchannel] = useState(0); + const [meastime, setmeastime] = useState(12); + + const channels = [...Array(6).keys()].map((x) => { + return { label: x, disabled: false, value: x }; + }); + const meastimes = [...Array(16).keys()].map((x) => { + return { label: x, disabled: false, value: x }; + }); + // { label: 0, disabled: false, value: 0 }, + // { label: 1, disabled: false, value: 1 }, + // { label: 2, disabled: false, value: 2 }, + // { label: 3, disabled: false, value: 3 }, + // { label: 4, disabled: false, value: 4 }, + // { label: 5, disabled: false, value: 5 }, + // ]; - // functions to read a register from the Optoboard - // functions to read a register from the Optoboard // functions to read a register from the Optoboard const [reg_read, setreg_read] = useState(""); @@ -96,8 +143,6 @@ export function WriteReadBox({ }); }; - // functions to write a register on the Optoboard - // functions to write a register on the Optoboard // functions to write a register on the Optoboard const [reg_write, setreg_write] = useState(""); @@ -128,15 +173,6 @@ export function WriteReadBox({ const [optionsWrite, setoptionsWrite] = useState([]); - // const optionsWrite = [ - // <SelectOption key={0} value="Alabama" />, - // <SelectOption key={1} value="Florida" />, - // <SelectOption key={2} value="New Jersey" />, - // <SelectOption key={3} value="New Mexico" />, - // <SelectOption key={4} value="New York" />, - // <SelectOption key={5} value="North Carolina" />, - // ]; - const customFilterWrite = (_, value) => { if (!value) { return optionsWrite; @@ -224,38 +260,37 @@ export function WriteReadBox({ <React.Fragment> <Panel> <PanelMain> - <PanelMainBody> - <Bullseye> - <Flex> - <Bullseye> - <FlexItem> - <Bullseye> - <h4> Select device: </h4> - </Bullseye> - </FlexItem> + <Bullseye> + <Flex> + <Bullseye> + <FlexItem> + <Bullseye> + <h4> Select device: </h4> + </Bullseye> + </FlexItem> - <FlexItem> - <Bullseye> - <FormSelect - id={"selectDeviceSimplePanelRead"} - items={device} - onChange={(x) => setdevice_val(x)} - > - {device.map((option, index) => ( - <FormSelectOption - isDisabled={option.disabled} - key={index} - value={option.value} - label={option.label} - /> - ))} - </FormSelect> - </Bullseye> - </FlexItem> - </Bullseye> - </Flex> - </Bullseye> - </PanelMainBody> + <FlexItem> + <Bullseye> + <FormSelect + id={"selectDeviceSimplePanelRead"} + value={device_val} + items={device} + onChange={(x) => setdevice_val(x)} + > + {device.map((option, index) => ( + <FormSelectOption + isDisabled={option.disabled} + key={index} + value={option.value} + label={option.label} + /> + ))} + </FormSelect> + </Bullseye> + </FlexItem> + </Bullseye> + </Flex> + </Bullseye> </PanelMain> </Panel> @@ -324,76 +359,142 @@ export function WriteReadBox({ <Panel> <PanelMain> - <PanelMainBody> - <Bullseye> - <Flex> - <Bullseye> - <FlexItem> - <Bullseye> - <Button - id="write_pri_send_command" - variant={buttonVariantWrite} - onClick={() => write_device(reg_write, value_write)} - > - <h3> Write register </h3> - </Button> - </Bullseye> - </FlexItem> - </Bullseye> - + <Bullseye> + <Flex> + <Bullseye> <FlexItem> <Bullseye> - <h4>Read back: {read_back_write}</h4> - </Bullseye> - </FlexItem> - </Flex> - </Bullseye> - <Bullseye> - <Flex> - <FlexItem> - <Bullseye> - <Select - maxHeight={300} - variant={SelectVariant.typeahead} - direction={"down"} - typeAheadAriaLabel="Select a register write" - onToggle={() => setisOpenWrite(!isOpenWrite)} - onTypeaheadInputChanged={(value) => setreg_write(value)} - onSelect={onSelectWrite} - onClear={clearSelectionWrite} - onFilter={customFilterWrite} - selections={reg_write} - isOpen={isOpenWrite} - aria-labelledby={"typeahead-select-id-2-write"} - placeholderText="Select a register" - noResultsFoundText={"No results found"} + <Button + id="write_pri_send_command" + variant={buttonVariantWrite} + onClick={() => write_device(reg_write, value_write)} > - {optionsWrite} - </Select> - </Bullseye> - </FlexItem> - </Flex> - </Bullseye> - <Bullseye> - <Flex> - <FlexItem> - <Bullseye> - <h4>Value (hex)</h4> + <h3> Write register </h3> + </Button> </Bullseye> </FlexItem> + </Bullseye> - <FlexItem> - <Bullseye> - <TextInput - id="write_value" - name="write_value" - value={value_write} - onChange={(x) => setvalue_write(x)} - /> - </Bullseye> - </FlexItem> - </Flex> + <FlexItem> + <Bullseye> + <h4>Read back: {read_back_write}</h4> + </Bullseye> + </FlexItem> + </Flex> + </Bullseye> + <Bullseye> + <Flex> + <FlexItem> + <Bullseye> + <Select + maxHeight={300} + variant={SelectVariant.typeahead} + direction={"down"} + typeAheadAriaLabel="Select a register write" + onToggle={() => setisOpenWrite(!isOpenWrite)} + onTypeaheadInputChanged={(value) => setreg_write(value)} + onSelect={onSelectWrite} + onClear={clearSelectionWrite} + onFilter={customFilterWrite} + selections={reg_write} + isOpen={isOpenWrite} + aria-labelledby={"typeahead-select-id-2-write"} + placeholderText="Select a register" + noResultsFoundText={"No results found"} + > + {optionsWrite} + </Select> + </Bullseye> + </FlexItem> + </Flex> + </Bullseye> + <Bullseye> + <Flex> + <FlexItem> + <Bullseye> + <h4>Value</h4> + </Bullseye> + </FlexItem> + + <FlexItem> + <Bullseye> + <TextInput + id="write_value" + name="write_value" + value={value_write} + onChange={(x) => setvalue_write(x)} + /> + </Bullseye> + </FlexItem> + </Flex> + </Bullseye> + </PanelMain> + </Panel> + + <Panel> + <PanelMain> + <PanelMainBody> + <Bullseye> + <Button + spinnerAriaValueText={isBERTing ? "Loading" : undefined} + isLoading={isBERTing} + id="berTest" + variant={"primary"} + onClick={(event) => {}} + > + {isBERTing ? "Doing BERT..." : "Perform BERT"} + </Button> </Bullseye> + <Flex> + <FlexItem> + <Bullseye> + <h4>Uplink</h4> + </Bullseye> + </FlexItem> + <FlexItem> + <Bullseye> + <FormSelect + id={"selectChannelBert"} + value={channel} + items={channels} + onChange={(x) => setchannel(x)} + > + {channels.map((option, index) => ( + <FormSelectOption + isDisabled={option.disabled} + key={index} + value={option.value} + label={option.label} + /> + ))} + </FormSelect> + </Bullseye> + </FlexItem> + <FlexItem> + <Bullseye> + <h4>Meas Time</h4> + </Bullseye> + </FlexItem> + <FlexItem> + <Bullseye> + <FormSelect + id={"selectChannelBert"} + value={meastime} + items={meastimes} + onChange={(x) => setmeastime(x)} + > + {meastimes.map((option, index) => ( + <FormSelectOption + isDisabled={option.disabled} + key={index} + value={option.value} + label={option.label} + /> + ))} + </FormSelect> + </Bullseye> + </FlexItem> + </Flex> </PanelMainBody> </PanelMain> </Panel> diff --git a/ui/src/SimpleTabs/OptoboardList.js b/ui/src/SimpleTabs/OptoboardList.js index d256c5d..2a74026 100644 --- a/ui/src/SimpleTabs/OptoboardList.js +++ b/ui/src/SimpleTabs/OptoboardList.js @@ -17,6 +17,11 @@ import { PanelMainBody, Icon, Spinner, + Drawer, + DrawerContent, + DrawerHead, + DrawerContentBody, + DrawerPanelContent, } from "@patternfly/react-core"; import CogIcon from "@patternfly/react-icons/dist/esm/icons/cog-icon"; @@ -28,25 +33,8 @@ import { getPostBody, checkResponse } from "../utils/utility-functions"; export function OptoboardList({ url, DefaultConfig, Configurations }) { const [optoList, setoptoList] = useState({}); const [optoListInfo, setoptoListInfo] = useState({}); - const [OpenDevel, setOpenDevel] = useState(false); const [loadingData, setloadingData] = useState(true); - /* const [modify, setmodify] = useState(false); - const [isOpen, setisOpen] = useState(false); - const [currentOpto, setcurrentOpto] = useState({ - serialNumber: "00000000", - Position: "OB0", - vtrxVersion: "1.3", - flx_G: "0", - flx_d: "0", - withoutFelixcore: false, - ConfigurationPath: - "/itk_demo_optoboard/optoboard_felix/configs/00000000_test_v1.json", - inDBCheckBox: false, - ConfigurationDB: "http://localhost:5000", - debugCheckBox: false, - testmode: false, - }); - const [indexcurrentOpto, setindexcurrentOpto] = useState(); */ + const [isDrawerExpanded, setisDrawerExpanded] = useState(false); useEffect(() => { setloadingData(true); @@ -93,20 +81,20 @@ export function OptoboardList({ url, DefaultConfig, Configurations }) { </TextContent> </FlexItem> <FlexItem align={{ defautl: "alignRight" }}> - <Tooltip content={"Enable advanced mode"}> + {/* <Tooltip content={"Display additional functions"}> <Button aria-label="modify" variant="plain" - id="tt-ref" + id={"tt-ref" + index} onClick={() => { - setOpenDevel(!OpenDevel); + setisDrawerExpanded(!isDrawerExpanded); }} > <Icon> <PlusCircleIcon /> </Icon> </Button> - </Tooltip> + </Tooltip> */} <Tooltip entryDelay={150} exitDelay={200} @@ -142,6 +130,21 @@ export function OptoboardList({ url, DefaultConfig, Configurations }) { </Tooltip> </FlexItem> </Flex> + {/* <Drawer + isExpanded={isDrawerExpanded} + isInline={false} + position="right" + > + <DrawerContent + panelContent={ + <DrawerPanelContent> + <DrawerHead>ascas</DrawerHead> + </DrawerPanelContent> + } + > + <DrawerContentBody></DrawerContentBody> + </DrawerContent> + </Drawer> */} <Flex> <FlexItem> <WriteReadBox -- GitLab From fc87dd7c44d4905734f2224650022184d88f61d6 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Fri, 24 Feb 2023 16:42:12 +0100 Subject: [PATCH 29/33] Fixed implementation of BERT, no display yet --- itk_demo_optoboard/celeryTasks.py | 6 +++--- itk_demo_optoboard/routes.py | 7 ++++++- openapi/openapi.yaml | 14 ++++++++++++++ ui/src/Controls/WriteReadBox.js | 29 +++++++++++++++++++++-------- 4 files changed, 44 insertions(+), 12 deletions(-) diff --git a/itk_demo_optoboard/celeryTasks.py b/itk_demo_optoboard/celeryTasks.py index 6b2c7f8..fc3937b 100644 --- a/itk_demo_optoboard/celeryTasks.py +++ b/itk_demo_optoboard/celeryTasks.py @@ -194,9 +194,9 @@ def configureAllTasks(): @celery.task() -def BERT_Tasks(device, BERTSOURCE_G, BERTSOURCE_C, BERTMEASTIME): - BERT_result = eval("optoObject." + device).bert( - BERTSOURCE_G, BERTSOURCE_C, BERTMEASTIME +def BERT_Tasks(optoboardPosition, device, channel, meastime): + BERT_result = eval('optoboard_dic["' + optoboardPosition + '"].' + device).bert( + channel + 1, 6, meastime ) return BERT_result diff --git a/itk_demo_optoboard/routes.py b/itk_demo_optoboard/routes.py index 1d101ec..04fbf8c 100644 --- a/itk_demo_optoboard/routes.py +++ b/itk_demo_optoboard/routes.py @@ -163,9 +163,14 @@ def testCharacteristics_wrapper(): def BERT_wrapper(): payload = request.get_json() + optoboardPosition = str(payload["optoboardPosition"]) device = str(payload["device"]) + channel = int(payload["channel"]) + meastime = int(payload["meastime"]) - BERT_error_count, total_bits, BER_limit = BERT_Tasks.delay(device).wait() + BERT_error_count, total_bits, BER_limit = BERT_Tasks.delay( + optoboardPosition, device, channel, meastime + ).wait() return ( { diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index 2b3822c..94a88b6 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -214,12 +214,26 @@ paths: schema: type: object properties: + optoboardPosition: + type: string + example: "OB0" + description: Optoboard position device: type: string example: "lpgbt1" description: response-text + meastime: + type: integer + example: 12 + description: BERT length + channel: + type: integer + example: 0 + description: Uplink channel required: - device + - channel + - meastime responses: 200: $ref: "#/components/responses/BERT_response" diff --git a/ui/src/Controls/WriteReadBox.js b/ui/src/Controls/WriteReadBox.js index c1bdc1f..f84434e 100644 --- a/ui/src/Controls/WriteReadBox.js +++ b/ui/src/Controls/WriteReadBox.js @@ -79,13 +79,24 @@ export function WriteReadBox({ const meastimes = [...Array(16).keys()].map((x) => { return { label: x, disabled: false, value: x }; }); - // { label: 0, disabled: false, value: 0 }, - // { label: 1, disabled: false, value: 1 }, - // { label: 2, disabled: false, value: 2 }, - // { label: 3, disabled: false, value: 3 }, - // { label: 4, disabled: false, value: 4 }, - // { label: 5, disabled: false, value: 5 }, - // ]; + + const berTest = () => { + //var re = /[0-9A-Fa-f]{6}/g; + const requestData = { + optoboardPosition: optoboardPosition, + meastime: meastime, + channel: channel, + device: device_val, + }; + fetch(`${url}/BERT_wrapper`, getPostBody(requestData)) + .then((response) => checkResponse(response)) + .then((data) => { + console.log(data); + }) + .catch((err) => { + console.log(err); + }); + }; // functions to read a register from the Optoboard @@ -440,7 +451,9 @@ export function WriteReadBox({ isLoading={isBERTing} id="berTest" variant={"primary"} - onClick={(event) => {}} + onClick={(event) => { + berTest(); + }} > {isBERTing ? "Doing BERT..." : "Perform BERT"} </Button> -- GitLab From 6f979a458a34cdaaf81f2f484d422f14fe8715eb Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Thu, 2 Mar 2023 10:46:48 +0100 Subject: [PATCH 30/33] Implemented searchbar of possible values (write) --- ui/src/Config/Registers.js | 858 ++++++++++++++++++++++---------- ui/src/Controls/WriteReadBox.js | 155 +++++- 2 files changed, 729 insertions(+), 284 deletions(-) diff --git a/ui/src/Config/Registers.js b/ui/src/Config/Registers.js index 7e22540..351fb7d 100644 --- a/ui/src/Config/Registers.js +++ b/ui/src/Config/Registers.js @@ -1,277 +1,617 @@ const lpgbtv0Write = {}; const lpgbtv1Write = { - EPRXDLLCONFIG: [ - "EPRXDLLCURRENT", - "EPRXDLLCONFIRMCOUNT", - "EPRXDLLFSMCLKALWAYSON", - "EPRXDLLCOARSELOCKDETECTION", - "EPRXENABLEREINIT", - "EPRXDATAGATINGDISABLE", - ], - LDCONFIGH: ["LDEMPHASISENABLE", "LDMODULATIONCURRENT"], - EPRX0CONTROL: [ - "EPRX03ENABLE", - "EPRX02ENABLE", - "EPRX01ENABLE", - "EPRX00ENABLE", - "EPRX0DATARATE", - "EPRX0TRACKMODE", - ], - EPRX00CHNCNTR: [ - "EPRX00PHASESELECT", - "EPRX00INVERT", - "EPRX00ACBIAS", - "EPRX00TERM", - "EPRX00EQ", - ], - EPRX1CONTROL: [ - "EPRX13ENABLE", - "EPRX12ENABLE", - "EPRX11ENABLE", - "EPRX10ENABLE", - "EPRX1DATARATE", - "EPRX1TRACKMODE", - ], - EPRX10CHNCNTR: [ - "EPRX10PHASESELECT", - "EPRX10INVERT", - "EPRX10ACBIAS", - "EPRX10TERM", - "EPRX10EQ", - ], - EPRX2CONTROL: [ - "EPRX23ENABLE", - "EPRX22ENABLE", - "EPRX21ENABLE", - "EPRX20ENABLE", - "EPRX2DATARATE", - "EPRX2TRACKMODE", - ], - EPRX20CHNCNTR: [ - "EPRX20PHASESELECT", - "EPRX20INVERT", - "EPRX20ACBIAS", - "EPRX20TERM", - "EPRX20EQ", - ], - EPRX3CONTROL: [ - "EPRX33ENABLE", - "EPRX32ENABLE", - "EPRX31ENABLE", - "EPRX30ENABLE", - "EPRX3DATARATE", - "EPRX3TRACKMODE", - ], - EPRX30CHNCNTR: [ - "EPRX30PHASESELECT", - "EPRX30INVERT", - "EPRX30ACBIAS", - "EPRX30TERM", - "EPRX30EQ", - ], - EPRX4CONTROL: [ - "EPRX43ENABLE", - "EPRX42ENABLE", - "EPRX41ENABLE", - "EPRX40ENABLE", - "EPRX4DATARATE", - "EPRX4TRACKMODE", - ], - EPRX40CHNCNTR: [ - "EPRX40PHASESELECT", - "EPRX40INVERT", - "EPRX40ACBIAS", - "EPRX40TERM", - "EPRX40EQ", - ], - EPRX5CONTROL: [ - "EPRX53ENABLE", - "EPRX52ENABLE", - "EPRX51ENABLE", - "EPRX50ENABLE", - "EPRX5DATARATE", - "EPRX5TRACKMODE", - ], - EPRX50CHNCNTR: [ - "EPRX50PHASESELECT", - "EPRX50INVERT", - "EPRX50ACBIAS", - "EPRX50TERM", - "EPRX50EQ", - ], - EPTXDATARATE: [ - "EPTX0DATARATE", - "EPTX1DATARATE", - "EPTX2DATARATE", - "EPTX3DATARATE", - ], - EPTX10ENABLE: [ - "EPTX13ENABLE", - "EPTX12ENABLE", - "EPTX11ENABLE", - "EPTX10ENABLE", - "EPTX03ENABLE", - "EPTX02ENABLE", - "EPTX01ENABLE", - "EPTX00ENABLE", - ], - EPTX32ENABLE: [ - "EPTX33ENABLE", - "EPTX32ENABLE", - "EPTX31ENABLE", - "EPTX30ENABLE", - "EPTX23ENABLE", - "EPTX22ENABLE", - "EPTX21ENABLE", - "EPTX20ENABLE", - ], - EPTX00CHNCNTR: [ - "EPTX00PREEMPHASISSTRENGTH", - "EPTX00PREEMPHASISMODE", - "EPTX00DRIVESTRENGTH", - ], - EPTX01_00CHNCNTR: [ - "EPTX01INVERT", - "EPTX01PREEMPHASISWIDTH", - "EPTX00INVERT", - "EPTX00PREEMPHASISWIDTH", - ], - EPTX02CHNCNTR: [ - "EPTX02PREEMPHASISSTRENGTH", - "EPTX02PREEMPHASISMODE", - "EPTX02DRIVESTRENGTH", - ], - EPTX03_02CHNCNTR: [ - "EPTX03INVERT", - "EPTX03PREEMPHASISWIDTH", - "EPTX02INVERT", - "EPTX02PREEMPHASISWIDTH", - ], - EPTX10CHNCNTR: [ - "EPTX10PREEMPHASISSTRENGTH", - "EPTX10PREEMPHASISMODE", - "EPTX10DRIVESTRENGTH", - ], - EPTX11_10CHNCNTR: [ - "EPTX11INVERT", - "EPTX11PREEMPHASISWIDTH", - "EPTX10INVERT", - "EPTX10PREEMPHASISWIDTH", - ], - EPTX12CHNCNTR: [ - "EPTX12PREEMPHASISSTRENGTH", - "EPTX12PREEMPHASISMODE", - "EPTX12DRIVESTRENGTH", - ], - EPTX13_12CHNCNTR: [ - "EPTX13INVERT", - "EPTX13PREEMPHASISWIDTH", - "EPTX12INVERT", - "EPTX12PREEMPHASISWIDTH", - ], - EPTX20CHNCNTR: [ - "EPTX20PREEMPHASISSTRENGTH", - "EPTX20PREEMPHASISMODE", - "EPTX20DRIVESTRENGTH", - ], - EPTX21_20CHNCNTR: [ - "EPTX21INVERT", - "EPTX21PREEMPHASISWIDTH", - "EPTX20INVERT", - "EPTX20PREEMPHASISWIDTH", - ], - EPTX22CHNCNTR: [ - "EPTX22PREEMPHASISSTRENGTH", - "EPTX22PREEMPHASISMODE", - "EPTX22DRIVESTRENGTH", - ], - EPTX23_22CHNCNTR: [ - "EPTX23INVERT", - "EPTX23PREEMPHASISWIDTH", - "EPTX22INVERT", - "EPTX22PREEMPHASISWIDTH", - ], - EPTX30CHNCNTR: [ - "EPTX30PREEMPHASISSTRENGTH", - "EPTX30PREEMPHASISMODE", - "EPTX30DRIVESTRENGTH", - ], - EPTX31_30CHNCNTR: [ - "EPTX31INVERT", - "EPTX31PREEMPHASISWIDTH", - "EPTX30INVERT", - "EPTX30PREEMPHASISWIDTH", - ], - EPTX32CHNCNTR: [ - "EPTX32PREEMPHASISSTRENGTH", - "EPTX32PREEMPHASISMODE", - "EPTX32DRIVESTRENGTH", - ], - EPTX33_32CHNCNTR: [ - "EPTX33INVERT", - "EPTX33PREEMPHASISWIDTH", - "EPTX32INVERT", - "EPTX32PREEMPHASISWIDTH", - ], + EPRXDLLCONFIG: { + values: [0, 255], + subregisters: [ + { EPRXDLLCURRENT: [0, 3] }, + { EPRXDLLCONFIRMCOUNT: [0, 3] }, + { EPRXDLLFSMCLKALWAYSON: [0, 1] }, + { EPRXDLLCOARSELOCKDETECTION: [0, 1] }, + { EPRXENABLEREINIT: [0, 1] }, + { EPRXDATAGATINGDISABLE: [0, 1] }, + ], + }, + LDCONFIGH: { + values: [0, 255], + subregisters: [ + { LDEMPHASISENABLE: [0, 1] }, + { LDMODULATIONCURRENT: [0, 127] }, + ], + }, + EPRX0CONTROL: { + values: [0, 255], + subregisters: [ + { EPRX03ENABLE: [0, 1] }, + { EPRX02ENABLE: [0, 1] }, + { EPRX01ENABLE: [0, 1] }, + { EPRX00ENABLE: [0, 1] }, + { EPRX0DATARATE: [0, 3] }, + { EPRX0TRACKMODE: [0, 3] }, + ], + }, + EPRX00CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPRX00PHASESELECT: [0, 15] }, + { EPRX00INVERT: [0, 1] }, + { EPRX00ACBIAS: [0, 1] }, + { EPRX00TERM: [0, 1] }, + { EPRX00EQ: [0, 1] }, + ], + }, + EPRX1CONTROL: { + values: [0, 255], + subregisters: [ + { EPRX13ENABLE: [0, 1] }, + { EPRX12ENABLE: [0, 1] }, + { EPRX11ENABLE: [0, 1] }, + { EPRX10ENABLE: [0, 1] }, + { EPRX1DATARATE: [0, 3] }, + { EPRX1TRACKMODE: [0, 3] }, + ], + }, + EPRX10CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPRX10PHASESELECT: [0, 15] }, + { EPRX10INVERT: [0, 1] }, + { EPRX10ACBIAS: [0, 1] }, + { EPRX10TERM: [0, 1] }, + { EPRX10EQ: [0, 1] }, + ], + }, + EPRX2CONTROL: { + values: [0, 255], + subregisters: [ + { EPRX23ENABLE: [0, 1] }, + { EPRX22ENABLE: [0, 1] }, + { EPRX21ENABLE: [0, 1] }, + { EPRX20ENABLE: [0, 1] }, + { EPRX2DATARATE: [0, 3] }, + { EPRX2TRACKMODE: [0, 3] }, + ], + }, + EPRX20CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPRX20PHASESELECT: [0, 15] }, + { EPRX20INVERT: [0, 1] }, + { EPRX20ACBIAS: [0, 1] }, + { EPRX20TERM: [0, 1] }, + { EPRX20EQ: [0, 1] }, + ], + }, + EPRX3CONTROL: { + values: [0, 255], + subregisters: [ + { EPRX33ENABLE: [0, 1] }, + { EPRX32ENABLE: [0, 1] }, + { EPRX31ENABLE: [0, 1] }, + { EPRX30ENABLE: [0, 1] }, + { EPRX3DATARATE: [0, 3] }, + { EPRX3TRACKMODE: [0, 3] }, + ], + }, + EPRX30CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPRX30PHASESELECT: [0, 15] }, + { EPRX30INVERT: [0, 1] }, + { EPRX30ACBIAS: [0, 1] }, + { EPRX30TERM: [0, 1] }, + { EPRX30EQ: [0, 1] }, + ], + }, + EPRX4CONTROL: { + values: [0, 255], + subregisters: [ + { EPRX43ENABLE: [0, 1] }, + { EPRX42ENABLE: [0, 1] }, + { EPRX41ENABLE: [0, 1] }, + { EPRX40ENABLE: [0, 1] }, + { EPRX4DATARATE: [0, 3] }, + { EPRX4TRACKMODE: [0, 3] }, + ], + }, + EPRX40CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPRX40PHASESELECT: [0, 15] }, + { EPRX40INVERT: [0, 1] }, + { EPRX40ACBIAS: [0, 1] }, + { EPRX40TERM: [0, 1] }, + { EPRX40EQ: [0, 1] }, + ], + }, + EPRX5CONTROL: { + values: [0, 255], + subregisters: [ + { EPRX53ENABLE: [0, 1] }, + { EPRX52ENABLE: [0, 1] }, + { EPRX51ENABLE: [0, 1] }, + { EPRX50ENABLE: [0, 1] }, + { EPRX5DATARATE: [0, 3] }, + { EPRX5TRACKMODE: [0, 3] }, + ], + }, + EPRX50CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPRX50PHASESELECT: [0, 15] }, + { EPRX50INVERT: [0, 1] }, + { EPRX50ACBIAS: [0, 1] }, + { EPRX50TERM: [0, 1] }, + { EPRX50EQ: [0, 1] }, + ], + }, + EPTXDATARATE: { + values: [0, 255], + subregisters: [ + { EPTX0DATARATE: [0, 3] }, + { EPTX1DATARATE: [0, 3] }, + { EPTX2DATARATE: [0, 3] }, + { EPTX3DATARATE: [0, 3] }, + ], + }, + EPTX10ENABLE: { + values: [0, 255], + subregisters: [ + { EPTX13ENABLE: [0, 1] }, + { EPTX12ENABLE: [0, 1] }, + { EPTX11ENABLE: [0, 1] }, + { EPTX10ENABLE: [0, 1] }, + { EPTX03ENABLE: [0, 1] }, + { EPTX02ENABLE: [0, 1] }, + { EPTX01ENABLE: [0, 1] }, + { EPTX00ENABLE: [0, 1] }, + ], + }, + EPTX32ENABLE: { + values: [0, 255], + subregisters: [ + { EPTX33ENABLE: [0, 1] }, + { EPTX32ENABLE: [0, 1] }, + { EPTX31ENABLE: [0, 1] }, + { EPTX30ENABLE: [0, 1] }, + { EPTX23ENABLE: [0, 1] }, + { EPTX22ENABLE: [0, 1] }, + { EPTX21ENABLE: [0, 1] }, + { EPTX20ENABLE: [0, 1] }, + ], + }, + EPTX00CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPTX00PREEMPHASISSTRENGTH: [0, 7] }, + { EPTX00PREEMPHASISMODE: [0, 3] }, + { EPTX00DRIVESTRENGTH: [0, 7] }, + ], + }, + EPTX01_00CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPTX01INVERT: [0, 1] }, + { EPTX01PREEMPHASISWIDTH: [0, 7] }, + { EPTX00INVERT: [0, 1] }, + { EPTX00PREEMPHASISWIDTH: [0, 7] }, + ], + }, + EPTX02CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPTX02PREEMPHASISSTRENGTH: [0, 7] }, + { EPTX02PREEMPHASISMODE: [0, 3] }, + { EPTX02DRIVESTRENGTH: [0, 7] }, + ], + }, + EPTX03_02CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPTX03INVERT: [0, 1] }, + { EPTX03PREEMPHASISWIDTH: [0, 7] }, + { EPTX02INVERT: [0, 1] }, + { EPTX02PREEMPHASISWIDTH: [0, 7] }, + ], + }, + EPTX10CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPTX10PREEMPHASISSTRENGTH: [0, 7] }, + { EPTX10PREEMPHASISMODE: [0, 3] }, + { EPTX10DRIVESTRENGTH: [0, 7] }, + ], + }, + EPTX11_10CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPTX11INVERT: [0, 1] }, + { EPTX11PREEMPHASISWIDTH: [0, 7] }, + { EPTX10INVERT: [0, 1] }, + { EPTX10PREEMPHASISWIDTH: [0, 7] }, + ], + }, + EPTX12CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPTX12PREEMPHASISSTRENGTH: [0, 7] }, + { EPTX12PREEMPHASISMODE: [0, 3] }, + { EPTX12DRIVESTRENGTH: [0, 7] }, + ], + }, + EPTX13_12CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPTX13INVERT: [0, 1] }, + { EPTX13PREEMPHASISWIDTH: [0, 7] }, + { EPTX12INVERT: [0, 1] }, + { EPTX12PREEMPHASISWIDTH: [0, 7] }, + ], + }, + EPTX20CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPTX20PREEMPHASISSTRENGTH: [0, 7] }, + { EPTX20PREEMPHASISMODE: [0, 3] }, + { EPTX20DRIVESTRENGTH: [0, 7] }, + ], + }, + EPTX21_20CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPTX21INVERT: [0, 1] }, + { EPTX21PREEMPHASISWIDTH: [0, 7] }, + { EPTX20INVERT: [0, 1] }, + { EPTX20PREEMPHASISWIDTH: [0, 7] }, + ], + }, + EPTX22CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPTX22PREEMPHASISSTRENGTH: [0, 7] }, + { EPTX22PREEMPHASISMODE: [0, 3] }, + { EPTX22DRIVESTRENGTH: [0, 7] }, + ], + }, + EPTX23_22CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPTX23INVERT: [0, 1] }, + { EPTX23PREEMPHASISWIDTH: [0, 7] }, + { EPTX22INVERT: [0, 1] }, + { EPTX22PREEMPHASISWIDTH: [0, 7] }, + ], + }, + EPTX30CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPTX30PREEMPHASISSTRENGTH: [0, 7] }, + { EPTX30PREEMPHASISMODE: [0, 3] }, + { EPTX30DRIVESTRENGTH: [0, 7] }, + ], + }, + EPTX31_30CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPTX31INVERT: [0, 1] }, + { EPTX31PREEMPHASISWIDTH: [0, 7] }, + { EPTX30INVERT: [0, 1] }, + { EPTX30PREEMPHASISWIDTH: [0, 7] }, + ], + }, + EPTX32CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPTX32PREEMPHASISSTRENGTH: [0, 7] }, + { EPTX32PREEMPHASISMODE: [0, 3] }, + { EPTX32DRIVESTRENGTH: [0, 7] }, + ], + }, + EPTX33_32CHNCNTR: { + values: [0, 255], + subregisters: [ + { EPTX33INVERT: [0, 1] }, + { EPTX33PREEMPHASISWIDTH: [0, 7] }, + { EPTX32INVERT: [0, 1] }, + { EPTX32PREEMPHASISWIDTH: [0, 7] }, + ], + }, }; -const lpgbtv0Read = { ...lpgbtv0Write, ...{ ROM: ["ROMREG"] } }; +const lpgbtv0Read = { + ...lpgbtv0Write, + ...{ + ROM: { + values: [], + subregisters: [{ ROMREG: [] }], + }, + }, +}; -const lpgbtv1Read = { ...lpgbtv1Write, ...{ ROM: ["ROMREG"] } }; +const lpgbtv1Read = { + ...lpgbtv1Write, + ...{ + ROM: { + values: [], + subregisters: [{ ROMREG: [] }], + }, + }, +}; const gbcrv2 = { - CH1UPLINK0: ["CH1DISEQLF", "CH1EQATT", "CH1CMLAMPLSEL"], - CH1UPLINK1: ["CH1CTLEHFSR", "CH1CTLEMFSR"], - CH1UPLINK2: ["CH1DIS", "CH1DISDFF", "CH1DISLPF"], - CH2UPLINK0: ["CH2DISEQLF", "CH2EQATT", "CH2CMLAMPLSEL"], - CH2UPLINK1: ["CH2CTLEHFSR", "CH2CTLEMFSR"], - CH2UPLINK2: ["CH2DIS", "CH2DISDFF", "CH2DISLPF"], - CH3UPLINK0: ["CH3DISEQLF", "CH3EQATT", "CH3CMLAMPLSEL"], - CH3UPLINK1: ["CH3CTLEHFSR", "CH3CTLEMFSR"], - CH3UPLINK2: ["CH3DIS", "CH3DISDFF", "CH3DISLPF"], - CH4UPLINK0: ["CH4DISEQLF", "CH4EQATT", "CH4CMLAMPLSEL"], - CH4UPLINK1: ["CH4CTLEHFSR", "CH4CTLEMFSR"], - CH4UPLINK2: ["CH4DIS", "CH4DISDFF", "CH4DISLPF"], - CH5UPLINK0: ["CH5DISEQLF", "CH5EQATT", "CH5CMLAMPLSEL"], - CH5UPLINK1: ["CH5CTLEHFSR", "CH5CTLEMFSR"], - CH5UPLINK2: ["CH5DIS", "CH5DISDFF", "CH5DISLPF"], - CH6UPLINK0: ["CH6DISEQLF", "CH6EQATT", "CH6CMLAMPLSEL"], - CH6UPLINK1: ["CH6CTLEHFSR", "CH6CTLEMFSR"], - CH6UPLINK2: ["CH6DIS", "CH6DISDFF", "CH6DISLPF"], - CH7UPLINK0: ["CH7DISEQLF", "CH7EQATT", "CH7CMLAMPLSEL"], - CH7UPLINK1: ["CH7CTLEHFSR", "CH7CTLEMFSR"], - CH7UPLINK2: ["CH7DIS", "CH7DISDFF", "CH7DISLPF"], - CH1DOWNLINK0: ["TX1DLATT", "TX1DISDLEMP", "TX1DLSR"], - CH1DOWNLINK1: ["TX1DISDLBIAS", "TX1DISDLLPFBIAS"], - CH2DOWNLINK0: ["TX2DLATT", "TX2DISDLEMP", "TX2DLSR"], - CH2DOWNLINK1: ["TX2DISDLBIAS", "TX2DISDLLPFBIAS"], - PHASESHIFTER0: ["DLLENABLE", "DLLCAPRESET"], - PHASESHIFTER1: ["DLLFORCEDOWN", "DLLCHARGEPUMPCURRENT"], - PHASESHIFTER2: ["DLLCLOCKDELAYCH7", "DLLCLOCKDELAYCH6"], - PHASESHIFTER3: ["DLLCLOCKDELAYCH5", "DLLCLOCKDELAYCH4"], - PHASESHIFTER4: ["DLLCLOCKDELAYCH3", "DLLCLOCKDELAYCH2"], - PHASESHIFTER5: ["DLLCLOCKDELAYCH1", "DLLCLOCKDELAYCHTEST"], - LVDSRXTX: [ - "RXEN", - "RXSETCM", - "RXENTERMINATION", - "RXINVDATA", - "RXEQ", - "DISTX", - ], + CH1UPLINK0: { + values: [0, 63], + subregisters: [ + { CH1DISEQLF: [0, 1] }, + { CH1EQATT: [0, 3] }, + { CH1CMLAMPLSEL: [0, 7] }, + ], + }, + CH1UPLINK1: { + values: [0, 255], + subregisters: [{ CH1CTLEHFSR: [0, 15] }, { CH1CTLEHFSR: [0, 15] }], + }, + CH1UPLINK2: { + values: [0, 7], + subregisters: [ + { CH1DIS: [0, 1] }, + { CH1DISDFF: [0, 1] }, + { CH1DISLPF: [0, 1] }, + ], + }, + CH2UPLINK0: { + values: [0, 63], + subregisters: [ + { CH2DISEQLF: [0, 1] }, + { CH2EQATT: [0, 3] }, + { CH2CMLAMPLSEL: [0, 7] }, + ], + }, + CH2UPLINK1: { + values: [0, 255], + subregisters: [{ CH2CTLEHFSR: [0, 15] }, { CH2CTLEHFSR: [0, 15] }], + }, + CH2UPLINK2: { + values: [0, 7], + subregisters: [ + { CH2DIS: [0, 1] }, + { CH2DISDFF: [0, 1] }, + { CH2DISLPF: [0, 1] }, + ], + }, + CH3UPLINK0: { + values: [0, 63], + subregisters: [ + { CH3DISEQLF: [0, 1] }, + { CH3EQATT: [0, 3] }, + { CH3CMLAMPLSEL: [0, 7] }, + ], + }, + CH3UPLINK1: { + values: [0, 255], + subregisters: [{ CH3CTLEHFSR: [0, 15] }, { CH3CTLEHFSR: [0, 15] }], + }, + CH3UPLINK2: { + values: [0, 7], + subregisters: [ + { CH3DIS: [0, 1] }, + { CH3DISDFF: [0, 1] }, + { CH3DISLPF: [0, 1] }, + ], + }, + CH4UPLINK0: { + values: [0, 63], + subregisters: [ + { CH4DISEQLF: [0, 1] }, + { CH4EQATT: [0, 3] }, + { CH4CMLAMPLSEL: [0, 7] }, + ], + }, + CH4UPLINK1: { + values: [0, 255], + subregisters: [{ CH4CTLEHFSR: [0, 15] }, { CH4CTLEHFSR: [0, 15] }], + }, + CH4UPLINK2: { + values: [0, 7], + subregisters: [ + { CH4DIS: [0, 1] }, + { CH4DISDFF: [0, 1] }, + { CH4DISLPF: [0, 1] }, + ], + }, + CH5UPLINK0: { + values: [0, 63], + subregisters: [ + { CH5DISEQLF: [0, 1] }, + { CH5EQATT: [0, 3] }, + { CH5CMLAMPLSEL: [0, 7] }, + ], + }, + CH5UPLINK1: { + values: [0, 255], + subregisters: [{ CH5CTLEHFSR: [0, 15] }, { CH5CTLEHFSR: [0, 15] }], + }, + CH5UPLINK2: { + values: [0, 7], + subregisters: [ + { CH5DIS: [0, 1] }, + { CH5DISDFF: [0, 1] }, + { CH5DISLPF: [0, 1] }, + ], + }, + CH6UPLINK0: { + values: [0, 63], + subregisters: [ + { CH6DISEQLF: [0, 1] }, + { CH6EQATT: [0, 3] }, + { CH6CMLAMPLSEL: [0, 7] }, + ], + }, + CH6UPLINK1: { + values: [0, 255], + subregisters: [{ CH6CTLEHFSR: [0, 15] }, { CH6CTLEHFSR: [0, 15] }], + }, + CH6UPLINK2: { + values: [0, 7], + subregisters: [ + { CH6DIS: [0, 1] }, + { CH6DISDFF: [0, 1] }, + { CH6DISLPF: [0, 1] }, + ], + }, + CH7UPLINK0: { + values: [0, 63], + subregisters: [ + { CH7DISEQLF: [0, 1] }, + { CH7EQATT: [0, 3] }, + { CH7CMLAMPLSEL: [0, 7] }, + ], + }, + CH7UPLINK1: { + values: [0, 255], + subregisters: [{ CH7CTLEHFSR: [0, 15] }, { CH7CTLEHFSR: [0, 15] }], + }, + CH7UPLINK2: { + values: [0, 7], + subregisters: [ + { CH7DIS: [0, 1] }, + { CH7DISDFF: [0, 1] }, + { CH7DISLPF: [0, 1] }, + ], + }, + CH1DOWNLINK0: { + values: [0, 63], + subregisters: [ + { TX1DLATT: [0, 3] }, + { TX1DISDLEMP: [0, 1] }, + { TX1DLSR: [0, 7] }, + ], + }, + CH1DOWNLINK1: { + values: [0, 3], + subregisters: [{ TX1DISDLBIAS: [0, 1] }, { TX1DISDLLPFBIAS: [0, 1] }], + }, + CH2DOWNLINK0: { + values: [0, 63], + subregisters: [ + { TX2DLATT: [0, 3] }, + { TX2DISDLEMP: [0, 1] }, + { TX2DLSR: [0, 7] }, + ], + }, + CH2DOWNLINK1: { + values: [0, 3], + subregisters: [{ TX2DISDLBIAS: [0, 1] }, { TX2DISDLLPFBIAS: [0, 1] }], + }, + PHASESHIFTER0: { + values: [0, 3], + subregisters: [{ DLLENABLE: [0, 1] }, { DLLCAPRESET: [0, 1] }], + }, + PHASESHIFTER1: { + values: [0, 31], + subregisters: [{ DLLFORCEDOWN: [0, 1] }, { DLLCHARGEPUMPCURRENT: [0, 15] }], + }, + PHASESHIFTER2: { + values: [0, 255], + subregisters: [ + { DLLCLOCKDELAYCH7: [0, 15] }, + { DLLCLOCKDELAYCH6: [0, 15] }, + ], + }, + PHASESHIFTER3: { + values: [0, 255], + subregisters: [ + { DLLCLOCKDELAYCH5: [0, 15] }, + { DLLCLOCKDELAYCH4: [0, 15] }, + ], + }, + PHASESHIFTER4: { + values: [0, 255], + subregisters: [ + { DLLCLOCKDELAYCH3: [0, 15] }, + { DLLCLOCKDELAYCH2: [0, 15] }, + ], + }, + PHASESHIFTER5: { + values: [0, 255], + subregisters: [ + { DLLCLOCKDELAYCH1: [0, 15] }, + { DLLCLOCKDELAYCHTEST: [0, 15] }, + ], + }, + LVDSRXTX: { + values: [0, 127], + subregisters: [ + { RXEN: [0, 1] }, + { RXSETCM: [0, 1] }, + { RXENTERMINATION: [0, 1] }, + { RXINVDATA: [0, 1] }, + { RXEQ: [0, 3] }, + { DISTX: [0, 1] }, + ], + }, }; const gbcrv3 = {}; const vtrxv12 = { - C0CR: ["C0FEP", "C0REP", "C0MEN", "C0BEN", "C0LAEN", "C0CEN"], - C1CR: ["C1FEP", "C1REP", "C1MEN", "C1BEN", "C1LAEN", "C1CEN"], - C2CR: ["C2FEP", "C2REP", "C2MEN", "C2BEN", "C2LAEN", "C2CEN"], - C3CR: ["C3FEP", "C3REP", "C3MEN", "C3BEN", "C3LAEN", "C3CEN"], + C0CR: { + subregisters: [ + { C0FEP: [0, 1] }, + { C0REP: [0, 1] }, + { C0MEN: [0, 1] }, + { C0BEN: [0, 1] }, + { C0LAEN: [0, 1] }, + { C0CEN: [0, 1] }, + ], + values: [0, 63], + }, + C1CR: { + subregisters: [ + { C1FEP: [0, 1] }, + { C1REP: [0, 1] }, + { C1MEN: [0, 1] }, + { C1BEN: [0, 1] }, + { C1LAEN: [0, 1] }, + { C1CEN: [0, 1] }, + ], + values: [0, 63], + }, + C2CR: { + subregisters: [ + { C2FEP: [0, 1] }, + { C2REP: [0, 1] }, + { C2MEN: [0, 1] }, + { C2BEN: [0, 1] }, + { C2LAEN: [0, 1] }, + { C2CEN: [0, 1] }, + ], + values: [0, 63], + }, + C3CR: { + subregisters: [ + { C3FEP: [0, 1] }, + { C3REP: [0, 1] }, + { C3MEN: [0, 1] }, + { C3BEN: [0, 1] }, + { C3LAEN: [0, 1] }, + { C3CEN: [0, 1] }, + ], + values: [0, 63], + }, }; -const vtrxv13 = { GCR: ["CH1EN", "CH2EN", "CH3EN", "CH4EN"] }; +const vtrxv13 = { + GCR: { + subregisters: [ + { CH1EN: [0, 1] }, + { CH2EN: [0, 1] }, + { CH3EN: [0, 1] }, + { CH4EN: [0, 1] }, + ], + values: [0, 15], + }, +}; export const Registers = { lpgbtv0Write: lpgbtv0Write, diff --git a/ui/src/Controls/WriteReadBox.js b/ui/src/Controls/WriteReadBox.js index f84434e..a25d26d 100644 --- a/ui/src/Controls/WriteReadBox.js +++ b/ui/src/Controls/WriteReadBox.js @@ -72,6 +72,8 @@ export function WriteReadBox({ const [isBERTing, setisBERTing] = useState(false); const [channel, setchannel] = useState(0); const [meastime, setmeastime] = useState(12); + const [buttonVariantBERT, setbuttonVariantBERT] = useState("primary"); + const [berLimit, setberLimit] = useState(""); const channels = [...Array(6).keys()].map((x) => { return { label: x, disabled: false, value: x }; @@ -88,14 +90,20 @@ export function WriteReadBox({ channel: channel, device: device_val, }; + setisBERTing(true); + setberLimit(""); + setbuttonVariantBERT("primary"); fetch(`${url}/BERT_wrapper`, getPostBody(requestData)) .then((response) => checkResponse(response)) .then((data) => { console.log(data); + setberLimit(data.BER_limit); }) .catch((err) => { + setbuttonVariantBERT("danger"); console.log(err); - }); + }) + .finally(setisBERTing(false)); }; // functions to read a register from the Optoboard @@ -160,6 +168,7 @@ export function WriteReadBox({ const [value_write, setvalue_write] = useState(""); const [read_back_write, setread_back_write] = useState(""); const [isOpenWrite, setisOpenWrite] = useState(false); + const [isOpenValue, setisOpenValue] = useState(false); const [buttonVariantRead, setbuttonVariantRead] = useState("primary"); const [buttonVariantWrite, setbuttonVariantWrite] = useState("primary"); @@ -171,6 +180,45 @@ export function WriteReadBox({ setreg_write(select); setisOpenWrite(false); console.log("selected:", select); + let x = []; + let selectArray = select.split(" "); + // console.log("selected:", select.split(" ").length); + + let keyRegValue = ""; + + if (device_val.includes("lpgbt")) { + keyRegValue = + "lpgbt" + (optoComponents.lpgbt_v ? "v1" : "v0") + "Write"; + } else if (device_val.includes("gbcr")) { + keyRegValue = "gbcr" + (optoComponents.gbcr_v == 2 ? "v2" : "v3"); + } else if (device_val.includes("vtrx")) { + keyRegValue = "vtrx" + (vtrxVersion == "1.2" ? "v12" : "v13"); + } + + if (selectArray.length == 1) { + for ( + var i = Registers[keyRegValue][select]["values"][0]; + i <= Registers[keyRegValue][select]["values"][1]; + i++ + ) { + x.push(<SelectOption key={i} value={i} />); + } + } else if (selectArray.length == 2) { + let subRegObj = Registers[keyRegValue][selectArray[0]][ + "subregisters" + ].filter((sreg) => Object.keys(sreg) == selectArray[1]); + if (subRegObj.length == 1) { + subRegObj = subRegObj[0]; + for ( + var i = subRegObj[selectArray[1]][0]; + i <= subRegObj[selectArray[1]][1]; + i++ + ) { + x.push(<SelectOption key={i} value={i} />); + } + } + } + setoptionsValue(x); } }; @@ -178,6 +226,7 @@ export function WriteReadBox({ console.log("cancel input/selection"); setreg_write(""); setisOpenWrite(false); + setoptionsValue([]); }; // function to implement the filter of the registers @@ -192,6 +241,34 @@ export function WriteReadBox({ return optionsWrite.filter((child) => input.test(child.props.value)); }; + const onSelectValue = (event, select, isPlaceholder) => { + if (isPlaceholder) { + clearSelectionValue(); + } else { + setvalue_write(select); + setisOpenValue(false); + console.log("selected:", select); + } + }; + + const clearSelectionValue = () => { + console.log("cancel input/selection"); + setvalue_write(""); + setisOpenValue(false); + }; + + // function to implement the filter of the values to write + + const [optionsValue, setoptionsValue] = useState([]); + + const customFilterValue = (_, value) => { + if (!value) { + return optionsValue; + } + const input = new RegExp(value, "i"); + return optionsValue.filter((child) => input.test(child.props.value)); + }; + const write_device = (reg_address, new_reg_value) => { const requestData = { optoboardPosition: optoboardPosition, @@ -237,11 +314,11 @@ export function WriteReadBox({ let x = []; Object.keys(Registers[keyRegRead]).map((register, index) => { x.push(<SelectOption key={register} value={register} />); - Registers[keyRegRead][register].map((subreg) => { + Registers[keyRegRead][register]["subregisters"].map((subreg) => { x.push( <SelectOption - key={register + " " + subreg} - value={register + " " + subreg} + key={register + " " + Object.keys(subreg)[0]} + value={register + " " + Object.keys(subreg)[0]} /> ); }); @@ -250,11 +327,11 @@ export function WriteReadBox({ let y = []; Object.keys(Registers[keyRegWrite]).map((register, index) => { y.push(<SelectOption key={register} value={register} />); - Registers[keyRegWrite][register].map((subreg) => { + Registers[keyRegWrite][register]["subregisters"].map((subreg) => { y.push( <SelectOption - key={register + " " + subreg} - value={register + " " + subreg} + key={register + " " + Object.keys(subreg)[0]} + value={register + " " + Object.keys(subreg)[0]} /> ); }); @@ -403,7 +480,10 @@ export function WriteReadBox({ direction={"down"} typeAheadAriaLabel="Select a register write" onToggle={() => setisOpenWrite(!isOpenWrite)} - onTypeaheadInputChanged={(value) => setreg_write(value)} + onTypeaheadInputChanged={(value) => { + setreg_write(value); + setoptionsValue([]); + }} onSelect={onSelectWrite} onClear={clearSelectionWrite} onFilter={customFilterWrite} @@ -421,20 +501,38 @@ export function WriteReadBox({ </Bullseye> <Bullseye> <Flex> - <FlexItem> + {/* <FlexItem> <Bullseye> <h4>Value</h4> </Bullseye> - </FlexItem> + </FlexItem> */} <FlexItem> <Bullseye> - <TextInput + <Select + maxHeight={300} + variant={SelectVariant.typeahead} + direction={"down"} + typeAheadAriaLabel="Value to be written" + onToggle={() => setisOpenValue(!isOpenValue)} + onTypeaheadInputChanged={(value) => setvalue_write(value)} + onSelect={onSelectValue} + onClear={clearSelectionValue} + onFilter={customFilterValue} + selections={value_write} + isOpen={isOpenValue} + aria-labelledby={"typeahead-select-id-2-valuetowrite"} + placeholderText="Value to be written" + noResultsFoundText={"Range not available for this register"} + > + {optionsValue} + </Select> + {/* <TextInput id="write_value" name="write_value" value={value_write} onChange={(x) => setvalue_write(x)} - /> + /> */} </Bullseye> </FlexItem> </Flex> @@ -445,19 +543,26 @@ export function WriteReadBox({ <Panel> <PanelMain> <PanelMainBody> - <Bullseye> - <Button - spinnerAriaValueText={isBERTing ? "Loading" : undefined} - isLoading={isBERTing} - id="berTest" - variant={"primary"} - onClick={(event) => { - berTest(); - }} - > - {isBERTing ? "Doing BERT..." : "Perform BERT"} - </Button> - </Bullseye> + <Flex> + <FlexItem> + <Button + spinnerAriaValueText={isBERTing ? "Loading" : undefined} + isLoading={isBERTing} + id="berTest" + variant={buttonVariantBERT} + onClick={(event) => { + berTest(); + }} + > + {isBERTing ? "Doing BERT..." : "Perform BERT"} + </Button> + </FlexItem> + <FlexItem> + <Bullseye> + <h4>BER limit: {berLimit}</h4> + </Bullseye> + </FlexItem> + </Flex> <Flex> <FlexItem> <Bullseye> -- GitLab From a1e3f1b4d535662d5a03c3efce4d92fd461007bb Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Thu, 2 Mar 2023 11:35:41 +0100 Subject: [PATCH 31/33] Update optoboard_felix --- itk_demo_optoboard/optoboard_felix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itk_demo_optoboard/optoboard_felix b/itk_demo_optoboard/optoboard_felix index 902042b..2dc4b31 160000 --- a/itk_demo_optoboard/optoboard_felix +++ b/itk_demo_optoboard/optoboard_felix @@ -1 +1 @@ -Subproject commit 902042b5f200b6fe09305feebacad9ee0b4f4629 +Subproject commit 2dc4b31b2158ad31475db62f252caf1f4c502a35 -- GitLab From 92890d90790bbc31e5359cb518c0c57c2e686a81 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Thu, 2 Mar 2023 11:57:48 +0100 Subject: [PATCH 32/33] Code cleanup --- ui/src/Controls/Downlinks_master.js | 168 ---- ui/src/Controls/EPRXChnCntr.js | 179 ---- ui/src/Controls/EPRXControl.js | 132 --- ui/src/Controls/EPRXDllConfig.js | 163 ---- .../Characteristics_lpGBT.js | 0 ui/src/{Controls => OptoboardTools}/Config.js | 0 .../OptoStatus.js | 0 .../TestPatterns.js | 0 .../TestPatternsSlave.js | 0 .../WriteReadBox.js | 0 ui/src/SimpleTabs/AddOptoboard.js | 369 -------- ui/src/SimpleTabs/GBCR.js | 843 ------------------ ui/src/SimpleTabs/eLinks.js | 388 -------- .../OptoboardGUI.js | 3 +- .../OptoboardList.js | 11 +- 15 files changed, 4 insertions(+), 2252 deletions(-) delete mode 100644 ui/src/Controls/Downlinks_master.js delete mode 100644 ui/src/Controls/EPRXChnCntr.js delete mode 100644 ui/src/Controls/EPRXControl.js delete mode 100644 ui/src/Controls/EPRXDllConfig.js rename ui/src/{Controls => OptoboardTools}/Characteristics_lpGBT.js (100%) rename ui/src/{Controls => OptoboardTools}/Config.js (100%) rename ui/src/{Controls => OptoboardTools}/OptoStatus.js (100%) rename ui/src/{Controls => OptoboardTools}/TestPatterns.js (100%) rename ui/src/{Controls => OptoboardTools}/TestPatternsSlave.js (100%) rename ui/src/{Controls => OptoboardTools}/WriteReadBox.js (100%) delete mode 100644 ui/src/SimpleTabs/AddOptoboard.js delete mode 100644 ui/src/SimpleTabs/GBCR.js delete mode 100644 ui/src/SimpleTabs/eLinks.js rename ui/src/{SimpleTabs => UI_architecture}/OptoboardGUI.js (99%) rename ui/src/{SimpleTabs => UI_architecture}/OptoboardList.js (96%) diff --git a/ui/src/Controls/Downlinks_master.js b/ui/src/Controls/Downlinks_master.js deleted file mode 100644 index 51a41e6..0000000 --- a/ui/src/Controls/Downlinks_master.js +++ /dev/null @@ -1,168 +0,0 @@ -import React from "react"; -import { - Text, - TextContent, - TextVariants, - PanelMainBody, - PanelMain, - Panel, - Flex, - FlexItem, - Bullseye, - Switch, - Tooltip, -} from "@patternfly/react-core"; - -import { FormSelectInputNew } from "../Widgets/FormSelectInput"; - - -class Downlinks_master extends React.Component { - constructor(props) { - super(props); - this.state = { - PreEmphasisStrength : [ {label: "0.0 mA", disabled: false, value: 0}, - {label: "0.5 mA", disabled: false, value: 1}, - {label: "1.0 mA", disabled: false, value: 2}, - {label: "1.5 mA", disabled: false, value: 3}, - {label: "2.0 mA", disabled: false, value: 4}, - {label: "2.5 mA", disabled: false, value: 5}, - {label: "3.0 mA", disabled: false, value: 6}, - {label: "3.5 mA", disabled: false, value: 7},], - PreEmphasisStrength_val : String(props.ConfigurationFile["lpgbt"]['EPTX'+props.id+'CHNCNTR']["EPTX"+props.id+"PREEMPHASISSTRENGTH"][Number(props.lpGBTNum)-1]), - DriveStrength : [ {label: "0.0 mA", disabled: false, value: 0}, - {label: "0.5 mA", disabled: false, value: 1}, - {label: "1.0 mA", disabled: false, value: 2}, - {label: "1.5 mA", disabled: false, value: 3}, - {label: "2.0 mA", disabled: false, value: 4}, - {label: "2.5 mA", disabled: false, value: 5}, - {label: "3.0 mA", disabled: false, value: 6}, - {label: "3.5 mA", disabled: false, value: 7},], - DriveStrength_val : String(props.ConfigurationFile["lpgbt"]['EPTX'+props.id+'CHNCNTR']["EPTX"+props.id+"DRIVESTRENGTH"][Number(props.lpGBTNum)-1]), - PreEmphasisMode : [ {label: "disabled", disabled: false, value: 0}, - {label: "disabled", disabled: false, value: 1}, - {label: "self timed", disabled: false, value: 2}, - {label: "clock timed", disabled: false, value: 3}], - PreEmphasisMode_val : String(props.ConfigurationFile["lpgbt"]['EPTX'+props.id+'CHNCNTR']["EPTX"+props.id+"PREEMPHASISMODE"][Number(props.lpGBTNum)-1]), - buttonLabel : "EPTX" + props.id + "enable_switch_MASTER", - isBox : Boolean(props.ConfigurationFile["lpgbt"]['EPTX'+props.id_reg+'ENABLE']["EPTX"+props.id+"ENABLE"][Number(props.lpGBTNum)-1]), - }; - - - this.toggleBox = checked => {const memory = this.state.isBox; - this.setState({isBox: checked}); - console.log(checked); - this.props.sendSetting('EPTX'+props.id_reg+'Enable','EPTX'+props.id+'Enable', checked ? '1' : '0').catch((err) => {console.log(err); this.setState({ isBox: memory });}); - }; - - this.onChange_PreEmph = (PreEmphasisStrength_val) => {const memory = this.state.PreEmphasisStrength_val; - this.setState({ PreEmphasisStrength_val }); - console.log(PreEmphasisStrength_val); - this.props.sendSetting('EPTX'+this.props.id+'ChnCntr','EPTX'+props.id+'PreEmphasisStrength', PreEmphasisStrength_val).catch((err) => {console.log(err); this.setState({ PreEmphasisStrength_val: memory });}); - }; - this.onChange_DriveStrength = (DriveStrength_val) => {const memory = this.state.DriveStrength_val; - this.setState({ DriveStrength_val }); - console.log(DriveStrength_val); - this.props.sendSetting('EPTX'+this.props.id+'ChnCntr','EPTX'+props.id+'DriveStrength', DriveStrength_val).catch((err) => {console.log(err); this.setState({ DriveStrength_val: memory });}); - }; - this.onChange_PreEmphasisMode = (PreEmphasisMode_val) => {const memory = this.state.PreEmphasisMode_val; - this.setState({ PreEmphasisMode_val }); - console.log(PreEmphasisMode_val); - this.props.sendSetting('EPTX'+this.props.id+'ChnCntr','EPTX'+props.id+'PreEmphasisMode', PreEmphasisMode_val).catch((err) => {console.log(err); this.setState({ PreEmphasisMode_val: memory });}); - }; - } - - render (){ - return( - - <React.Fragment> - - <Flex direction={{ default: 'column' }}> - - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}> - EPTX{this.props.id}ChnCntr</Text> - </TextContent> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Tooltip content={<div><div> register: EPTX{this.props.id_reg}Enable </div> <div> reg_field: EPTX{this.props.id}Enable </div></div>} > - <Switch isChecked={this.state.isBox} onChange={this.toggleBox} id={this.state.buttonLabel} name={this.state.buttonLabel} label="Enable"/> - </Tooltip > - </Bullseye> - </FlexItem> - - </Flex> - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Tooltip content={<div><div> register: EPTX{this.props.id}ChnCntr </div> <div> reg_field: EPTX{this.props.id}PreEmphasisStrength </div></div>} > - <h4> EPTX{this.props.id}PreEmphasisStrength </h4> - </Tooltip> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNew id={this.props.id} items={this.state.PreEmphasisStrength} value={this.state.PreEmphasisStrength_val} onChange={this.onChange_PreEmph}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Tooltip content={<div><div> register: EPTX{this.props.id}ChnCntr </div> <div> reg_field: EPTX{this.props.id}DriveStrength </div></div>} > - <h4>EPTX{this.props.id}DriveStrength</h4> - </Tooltip> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNew id={this.props.id} items={this.state.DriveStrength} value={this.state.DriveStrength_val} onChange={this.onChange_DriveStrength}/> - </Bullseye> - </FlexItem> - - </Flex> - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Tooltip content={<div><div> register: EPTX{this.props.id}ChnCntr </div> <div> reg_field: EPTX{this.props.id}PreEmphasisMode </div></div>} > - <h4> EPTX{this.props.id}PreEmphasisMode </h4> - </Tooltip> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNew id={this.props.id} items={this.state.PreEmphasisMode} value={this.state.PreEmphasisMode_val} onChange={this.onChange_PreEmphasisMode}/> - </Bullseye> - </FlexItem> - - </Flex> - - - - - </PanelMainBody> - </PanelMain> - </Panel> - </Flex> - </React.Fragment> - );}; -} - -export {Downlinks_master}; //, DownlinkEnable - diff --git a/ui/src/Controls/EPRXChnCntr.js b/ui/src/Controls/EPRXChnCntr.js deleted file mode 100644 index c81ae95..0000000 --- a/ui/src/Controls/EPRXChnCntr.js +++ /dev/null @@ -1,179 +0,0 @@ -import React from "react"; -import { - Checkbox, - Text, - TextContent, - TextVariants, - PanelMainBody, - PanelMain, - Panel, - Flex, - FlexItem, - Bullseye, -} from "@patternfly/react-core"; - -import { FormSelectInput2, FormSelectInputNewer } from "../Widgets/FormSelectInput"; -import { getPostBody, checkResponse } from '../utils/utility-functions' - -class EPRXChnCntr extends React.Component { - constructor(props) { - super(props); - let regName = 'EPRXEq10Control'; - if ((props.id == 2) || (props.id == 3)) { regName = 'EPRXEq32Control' - } else if (props.id == 4) { regName = 'EPRXEq54Control' }; - - this.state = { - buttonLabel : {first : "EPRX" + props.id + "0Invert", second : "EPRX" + props.id + "0Term", third : "EPRX"+ props.id + "0AcBias"}, - buttonLabelID : {first : "lpgbt" + props.lpGBTNum + "EPRX" + props.id + "0Invert", second : "lpgbt" + props.lpGBTNum + "EPRX" + props.id + "0Term", third : "lpgbt" + props.lpGBTNum + "EPRX"+ props.id + "0AcBias"}, - isBox1 : Boolean(props.ConfigurationFile["lpgbt"]['EPRX'+props.id+'0CHNCNTR']["EPRX"+props.id+"0INVERT"][Number(props.lpGBTNum)-1]), - isBox2 : Boolean(props.ConfigurationFile["lpgbt"]['EPRX'+props.id+'0CHNCNTR']["EPRX"+props.id+"0TERM"][Number(props.lpGBTNum)-1]), - isBox3 : Boolean(props.ConfigurationFile["lpgbt"]['EPRX'+props.id+'0CHNCNTR']["EPRX"+props.id+"0ACBIAS"][Number(props.lpGBTNum)-1]), - setIsBox : false, - Eq_val: String(props.ConfigurationFile["lpgbt"]['EPRX'+props.id+'0CHNCNTR']["EPRX"+props.id+"0PHASESELECT"][Number(props.lpGBTNum)-1]), - PS_value: String(2*props.ConfigurationFile["lpgbt"]['EPRX'+props.id+'0CHNCNTR']["EPRX"+props.id+"0EQ"][Number(props.lpGBTNum)-1] + props.ConfigurationFile["lpgbt"]['EPRXEQ'+String(Math.trunc((props.id)/2)*2+1)+String(Math.trunc((props.id)/2)*2)+'CONTROL']["EPRX"+props.id+"0EQ"][Number(props.lpGBTNum)-1]), - - phaseSelect : [ {value: "0"}, {value: "1"} ,{value:"2"},{value:"3"},{value:"4"},{value:"5"},{value:"6"},{value:"7"},{value:"8"},{value:"9"},{value:"10"},{value:"11"},{value:"12"},{value:"13"},{value:"14"},{value:"15"}], - - Eq : [ - { label: 'Select one', disabled: true, value: 'Select one'}, - { label: "N/A", disabled: false, value: '0'}, - { label: "300 MHz or 4.9 dB", disabled: false, value: '1'}, - { label: "125 MHz or 7.8 dB", disabled: false, value: '2'}, - { label: "70MHz or 10.7 dB", disabled: false, value: '3'}, - ], - }; - this.toggleBox1 = checked => { - const memory = this.state.isBox1; - this.setState({ - isBox1: checked - }); - console.log(checked); - this.props.sendSetting('EPRX'+this.props.id+'0ChnCntr',this.state.buttonLabel.first, checked ? "1" : "0").catch((err) => {console.log(err); this.setState({ isBox1: memory });}); - }; - this.toggleBox2 = checked => { - const memory = this.state.isBox2; - this.setState({ - isBox2: checked - }); - console.log(checked); - this.props.sendSetting('EPRX'+this.props.id+'0ChnCntr',this.state.buttonLabel.second, checked ? "1" : "0").catch((err) => {console.log(err); this.setState({ isBox2: memory });}); - }; - this.toggleBox3 = checked => { - const memory = this.state.isBox3; - this.setState({ - isBox3: checked - }); - console.log(checked); - this.props.sendSetting('EPRX'+this.props.id+'0ChnCntr',this.state.buttonLabel.third, checked ? "1" : "0").catch((err) => {console.log(err); this.setState({ isBox3: memory });});; - }; - - this.onChange_Eq = (Eq_val) => { const memory = this.state.Eq_val; - this.setState({ Eq_val }); - console.log(Eq_val); - console.log(memory); - this.sendSettingEQ(Eq_val).catch((err) => {console.log(err); this.setState({ Eq_val: memory });});//EPRXEq10Control for bit [0], EPRX00ChnCntr for bit [1] - }; - - this.onChange_PS = (PS_value) => {const memory = this.state.PS_value; - this.setState({ PS_value }); - console.log(PS_value); - this.props.sendSetting('EPRX'+this.props.id+'0ChnCntr','EPRX'+props.id+'0PhaseSelect', PS_value).catch((err) => {console.log(err); this.setState({ PS_value: memory });}); - }; - - this.sendSettingEQ = (newValue) => { - let regName = 'EPRXEq10Control'; - if ((props.id == 2) || (props.id == 3)) { regName = 'EPRXEq32Control' - } else if (props.id == 4) { regName = 'EPRXEq54Control' }; - - const body = { - device: 'lpgbt' + props.lpGBTNum, - registerName1: 'EPRX' + props.id + '0ChnCntr', - registerName0: regName, - settingName: 'EPRX' + props.id + '0Eq', - newValue: newValue, - }; - console.log(body); - return fetch(`${this.props.backendUrl}/sendRegisterEQ`, getPostBody(body)).then((response) => checkResponse(response)).then((data) => {console.log(data)}); - }; - - } - //<PanelHeader> - render() { - return ( - <React.Fragment> - - <Flex direction={{ default: 'column' }}> - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>EPRX{this.props.id}0ChnCntr</Text> - </TextContent> - </Bullseye> - - <Flex> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>EPRX{this.props.id}0PhaseSelect</h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInput2 id={this.props.id} items={this.state.phaseSelect} value={this.state.PS_value} onChange={this.onChange_PS}/> - </Bullseye> - </FlexItem> - - </Flex> - <Flex> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.buttonLabel.first} isChecked={this.state.isBox1} onChange={this.toggleBox1} id={this.state.buttonLabelID.first} name={this.state.buttonLabel.first}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.buttonLabel.third} isChecked={this.state.isBox3} onChange={this.toggleBox3} id={this.state.buttonLabelID.third} name={this.state.buttonLabel.third}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.buttonLabel.second} isChecked={this.state.isBox2} onChange={this.toggleBox2} id={this.state.buttonLabelID.second} name={this.state.buttonLabel.second}/> - </Bullseye> - </FlexItem> - - </Flex> - - <Flex> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>EPRX{this.props.id}0Eq</h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNewer id={this.props.id} items={this.state.Eq} value={this.state.Eq_val} onChange={this.onChange_Eq}/> - </Bullseye> - </FlexItem> - - </Flex> - - - </PanelMainBody> - </PanelMain> - </Panel> - </Flex> - - </React.Fragment> - ); - } -} - -export {EPRXChnCntr}; diff --git a/ui/src/Controls/EPRXControl.js b/ui/src/Controls/EPRXControl.js deleted file mode 100644 index 318f497..0000000 --- a/ui/src/Controls/EPRXControl.js +++ /dev/null @@ -1,132 +0,0 @@ -import React from "react"; -import { - Checkbox, - Text, - TextContent, - TextVariants, - PanelMainBody, - PanelMain, - Panel, - Flex, - FlexItem, - Bullseye, -} from "@patternfly/react-core"; - -import { FormSelectInputNewer } from "../Widgets/FormSelectInput"; -//import { getPostBody, checkResponse } from '../utils/utility-functions' - - -class EPRXControl extends React.Component { - constructor(props) { - super(props); - this.state = { - buttonLabel : "lpGBT" + props.lpGBTNum + " (gr:" + props.id + " ch:0)", - isBox : Boolean(props.ConfigurationFile["lpgbt"]['EPRX'+props.id+'CONTROL']["EPRX"+props.id+"0ENABLE"][Number(props.lpGBTNum)-1]), - setIsBox : false, - dataRate_val: String(props.ConfigurationFile["lpgbt"]['EPRX'+props.id+'CONTROL']["EPRX"+props.id+"DATARATE"][Number(props.lpGBTNum)-1]), - trackMode_val: String(props.ConfigurationFile["lpgbt"]['EPRX'+props.id+'CONTROL']["EPRX"+props.id+"TRACKMODE"][Number(props.lpGBTNum)-1]), - - dataRates : [ - { label: 'Select one', disabled: true, value: "Select one"}, - { label: "disabled", disabled: false, value: "0"}, - { label: "320 Mbps", disabled: false, value: "1"}, - { label: "640 Mbps", disabled: false, value: "2"}, - { label: "1280 Mbps", disabled: false, value: "3"} - ], - - trackMode : [ - { label: 'Select one', disabled: true, value: "Select one"}, - { label: "Fixed phase", disabled: false, value: "0"}, - { label: "Initial training", disabled: false, value: "1"}, - { label: "CPT", disabled: false, value: "2"}, - { label: "CPT with inital phase", disabled: false, value: "3"}, - ], - }; - - this.toggleBox = checked => { const memory = this.state.isBox; - this.setState({ isBox: checked }); - this.props.sendSetting('EPRX'+this.props.id+'Control','EPRX'+props.id+'0Enable', checked ? "1" : "0").catch((err) => {console.log(err); this.setState({ isBox: memory })}); - }; - - this.onChange_dataRate = (dataRate_val) => {const memory = this.state.dataRate_val; - this.setState({ dataRate_val }); - console.log(dataRate_val); - //console.log(Boolean(props.ConfigurationFile["lpgbt"]['EPRX'+props.id+'CONTROL']["EPRX"+props.id+"0ENABLE"][Number(props.lpGBTNum)-1])); - this.props.sendSetting('EPRX'+this.props.id+'Control','EPRX'+props.id+'DataRate', dataRate_val).catch((err) => {console.log(err); this.setState({ dataRate_val: memory })}); - }; - this.onChange_trackMode = (trackMode_val) => {const memory = this.state.trackMode_val; - this.setState({ trackMode_val }); console.log(trackMode_val); - this.props.sendSetting('EPRX'+this.props.id+'Control','EPRX'+this.props.id+'TrackMode', trackMode_val).catch((err) => {console.log(err); this.setState({ trackMode_val: memory })}); - }; - - - } - - render() { - return ( - <React.Fragment> - <Flex direction={{ default: 'column' }}> - - <Panel variant="bordered"> - - <PanelMain> - <PanelMainBody> - - - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>EPRX{this.props.id}Control</Text> - </TextContent> - </Bullseye> - - <Flex> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.buttonLabel} isChecked={this.state.isBox} onChange={this.toggleBox} id={this.state.buttonLabel} name={this.state.buttonLabel}/> - </Bullseye> - </FlexItem> - - </Flex> - - <Flex> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>EPRX{this.props.id}DataRate</h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNewer id={this.props.id} items={this.state.dataRates} value={this.state.dataRate_val} onChange={this.onChange_dataRate}/> - </Bullseye> - </FlexItem> - - </Flex> - <Flex> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>EPRX{this.props.id}TrackMode</h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNewer id={this.props.id} items={this.state.trackMode} value={this.state.trackMode_val} onChange={this.onChange_trackMode}/> - </Bullseye> - </FlexItem> - </Flex> - - </PanelMainBody> - </PanelMain> - </Panel> - </Flex> - </React.Fragment> ); - } - } - - - - -export { EPRXControl}; diff --git a/ui/src/Controls/EPRXDllConfig.js b/ui/src/Controls/EPRXDllConfig.js deleted file mode 100644 index f4fa294..0000000 --- a/ui/src/Controls/EPRXDllConfig.js +++ /dev/null @@ -1,163 +0,0 @@ -import React from "react"; -import { - Checkbox, - Text, - TextContent, - TextVariants, - PanelMainBody, - PanelMain, - Panel, - Flex, - FlexItem, - Bullseye, -} from "@patternfly/react-core"; - -import { FormSelectInputNewer } from "../Widgets/FormSelectInput"; - -class EPRXDllConfig extends React.Component { - constructor(props) { - super(props); - this.state = { - isBox1 : Boolean(props.ConfigurationFile["lpgbt"]['EPRXDLLCONFIG']["EPRXDLLFSMCLKALWAYSON"][Number(props.lpGBTNum)-1]), - isBox2 : Boolean(props.ConfigurationFile["lpgbt"]['EPRXDLLCONFIG']["EPRXDLLCOARSELOCKDETECTION"][Number(props.lpGBTNum)-1]), - isBox3 : Boolean(props.ConfigurationFile["lpgbt"]['EPRXDLLCONFIG']["EPRXENABLEREINIT"][Number(props.lpGBTNum)-1]), - isBox4 : Boolean(props.ConfigurationFile["lpgbt"]['EPRXDLLCONFIG']["EPRXDATAGATINGDISABLE"][Number(props.lpGBTNum)-1]), - Current_val : String(props.ConfigurationFile["lpgbt"]['EPRXDLLCONFIG']['EPRXDLLCURRENT'][Number(props.lpGBTNum)-1]), - Count_val : String(props.ConfigurationFile["lpgbt"]['EPRXDLLCONFIG']['EPRXDLLCONFIRMCOUNT'][Number(props.lpGBTNum)-1]), - Current : [ - { label: '1uA', disabled: false, value: '0'}, - { label: "2uA", disabled: false, value: '1'}, - { label: '4uA', disabled: false, value: '2'}, - { label: "8uA", disabled: false, value: '3'},], - Count : [ - { label: '1', disabled: false, value: '0'}, - { label: "4", disabled: false, value: '1'}, - { label: '16', disabled: false, value: '2'}, - { label: "31", disabled: false, value: '3'}, - ], - buttonLabel : {first : "EPRXDLLFSMClkAlwaysOn", second : "EPRXDLLCoarseLockDetection", third : "EPRXEnableReInit", fourth : "EPRXDataGatingDisable"}, - }; - - this.toggleBox1 = checked => { - const memory = this.state.isBox1; - this.setState({isBox1: checked}); - console.log(checked); - this.props.sendSetting('EPRXDllConfig', this.state.buttonLabel.first, checked ? "1" : "0").catch((err) => {console.log(err); this.setState({ isBox1: memory });}); - }; - - this.toggleBox2 = checked => { - const memory = this.state.isBox2; - this.setState({isBox2: checked}); - console.log(checked); - this.props.sendSetting('EPRXDllConfig', this.state.buttonLabel.second, checked ? "1" : "0").catch((err) => {console.log(err); this.setState({ isBox2: memory });}); - }; - - this.toggleBox3 = checked => { - const memory = this.state.isBox3; - this.setState({isBox3: checked}); - console.log(checked); - this.props.sendSetting('EPRXDllConfig', this.state.buttonLabel.third, checked ? "1" : "0").catch((err) => {console.log(err); this.setState({ isBox3: memory });}); - }; - - this.toggleBox4 = checked => { - const memory = this.state.isBox4; - this.setState({isBox4: checked}); - console.log(checked); - this.props.sendSetting('EPRXDllConfig', this.state.buttonLabel.fourth, checked ? "1" : "0").catch((err) => {console.log(err); this.setState({ isBox4: memory });}); - }; - - this.onChange_Current = (Current_val) => { const memory = this.state.Current_val; - this.setState({ Current_val }); - console.log(Current_val); - this.props.sendSetting('EPRXDllConfig','EPRXDllCurrent', Current_val).catch((err) => {console.log(err); this.setState({ Current_val: memory });}); - }; - - this.onChange_Count = (Count_val) => { const memory = this.state.Count_val; - this.setState({ Count_val }); - console.log(Count_val); - this.props.sendSetting('EPRXDllConfig','EPRXDllConfirmCount', Count_val).catch((err) => {console.log(err); this.setState({ Count_val: memory });}); - }; - - }; - - -render() { - return ( - <React.Fragment> - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Flex direction={{ default: 'column' }}> - - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>EPRXDllConfig</Text> - </TextContent> - </Bullseye> - - <Flex> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4> EPRXDllCurrent </h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNewer id={this.props.id} items={this.state.Current} value={this.state.Current_val} onChange={this.onChange_Current}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h5> EPRXDllConfirmCount </h5> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNewer id={this.props.id} items={this.state.Count} value={this.state.Count_val} onChange={this.onChange_Count}/> - </Bullseye> - </FlexItem> - - </Flex> - - - <Flex> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.buttonLabel.first} isChecked={this.state.isBox1} onChange={this.toggleBox1} id={this.state.buttonLabel.first} name={this.state.buttonLabel.first}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.buttonLabel.second} isChecked={this.state.isBox2} onChange={this.toggleBox2} id={this.state.buttonLabel.second} name={this.state.buttonLabel.second}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.buttonLabel.third} isChecked={this.state.isBox3} onChange={this.toggleBox3} id={this.state.buttonLabel.third} name={this.state.buttonLabel.third}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.buttonLabel.fourth} isChecked={this.state.isBox4} onChange={this.toggleBox4} id={this.state.buttonLabel.fourth} name={this.state.buttonLabel.fourth}/> - </Bullseye> - </FlexItem> - - </Flex> - - </Flex> - - </PanelMainBody> - </PanelMain> - </Panel> - </React.Fragment> -)};} - -export {EPRXDllConfig}; diff --git a/ui/src/Controls/Characteristics_lpGBT.js b/ui/src/OptoboardTools/Characteristics_lpGBT.js similarity index 100% rename from ui/src/Controls/Characteristics_lpGBT.js rename to ui/src/OptoboardTools/Characteristics_lpGBT.js diff --git a/ui/src/Controls/Config.js b/ui/src/OptoboardTools/Config.js similarity index 100% rename from ui/src/Controls/Config.js rename to ui/src/OptoboardTools/Config.js diff --git a/ui/src/Controls/OptoStatus.js b/ui/src/OptoboardTools/OptoStatus.js similarity index 100% rename from ui/src/Controls/OptoStatus.js rename to ui/src/OptoboardTools/OptoStatus.js diff --git a/ui/src/Controls/TestPatterns.js b/ui/src/OptoboardTools/TestPatterns.js similarity index 100% rename from ui/src/Controls/TestPatterns.js rename to ui/src/OptoboardTools/TestPatterns.js diff --git a/ui/src/Controls/TestPatternsSlave.js b/ui/src/OptoboardTools/TestPatternsSlave.js similarity index 100% rename from ui/src/Controls/TestPatternsSlave.js rename to ui/src/OptoboardTools/TestPatternsSlave.js diff --git a/ui/src/Controls/WriteReadBox.js b/ui/src/OptoboardTools/WriteReadBox.js similarity index 100% rename from ui/src/Controls/WriteReadBox.js rename to ui/src/OptoboardTools/WriteReadBox.js diff --git a/ui/src/SimpleTabs/AddOptoboard.js b/ui/src/SimpleTabs/AddOptoboard.js deleted file mode 100644 index d3e8db6..0000000 --- a/ui/src/SimpleTabs/AddOptoboard.js +++ /dev/null @@ -1,369 +0,0 @@ -import React, { useState, useEffect } from "react"; -import { getPostBody, checkResponse } from "../utils/utility-functions"; - -import { - Bullseye, - Button, - Flex, - FlexItem, - Modal, - ModalVariant, - Text, - TextContent, - TextVariants, - Tooltip, - TextInput, - FormSelect, - FormSelectOption, - Checkbox, - } from "@patternfly/react-core"; - -export function AddOptoboard({ - url, - optoList, - setoptoList, - isOpen, - setisOpen, - modify, - setmodify, - currentOpto, - indexcurrentOpto, - setcurrentOpto, -}) { - const [Serial, setSerial] = useState( - modify ? currentOpto["serialNumber"] : "00000000" - ); - const [Position, setPosition] = useState( - modify ? currentOpto["Position"] : "OB1" - ); - const [vtrx, setVtrx] = useState(modify ? currentOpto["vtrxVersion"] : "1.3"); - const vtrxOptions = [ - { value: "1.2", label: "1.2", disabled: false }, - { value: "1.3", label: "1.3", disabled: false }, - ]; - const [flx_G, setflx_G] = useState(modify ? currentOpto["flx_G"] : "0"); - const [flx_d, setflx_d] = useState(modify ? currentOpto["flx_d"] : "0"); - const [withoutFelixcore, setwithoutFelixcore] = useState( - modify ? currentOpto["withoutFelixcore"] : false - ); - const [ConfigurationPath, setConfigurationPath] = useState( - modify - ? currentOpto["ConfigurationPath"] - : "/itk_demo_optoboard/optoboard_felix/configs/optoboard_lpgbtv1_gbcr2_vtrxv1_3_default.json" - ); - const [validConfigPath, validConfigPathChange] = useState("success"); - const [inDBCheckBox, setinDBCheckBox] = useState( - modify ? currentOpto["inDBCheckBox"] : false - ); - const [configDBAvailable, setconfigDBAvailable] = useState("warning"); - const [ConfigurationDB, setConfigurationDB] = useState( - modify ? currentOpto["ConfigurationDB"] : "http://localhost:5000" - ); - const [debugCheckBox, setdebugCheckBox] = useState( - modify ? currentOpto["debugCheckBox"] : false - ); - const [testmode, SwitchTestModeChange] = useState( - modify ? currentOpto["testmode"] : false - ); - const [ButtonVariant, setButtonVariant] = useState("primary"); - - function addToList(x) { - let tempArr = optoList; - tempArr.push(x); - return setoptoList(tempArr); - } - - const deleteItem = (index) => { - /*still need to be adjusted*/ - let temp = optoList.filter((item, i) => i !== index); - setoptoList(temp); - }; - - /*modify this function to account for when the serial or path to file are not valid*/ - const onClickAdd = () => { - let uniquePosition = true; - for (var x of optoList) { - if (x["Position"] === Position) { - uniquePosition = false; - } - } - if (Serial !== "") { - if (!modify) { - if (uniquePosition) { - const newoptoList = addToList({ - serialNumber: Serial, - Position: Position, - vtrxVersion: vtrx, - flx_G: flx_G, - flx_d: flx_d, - withoutFelixcore: withoutFelixcore, - ConfigurationPath: ConfigurationPath, - inDBCheckBox: inDBCheckBox, - ConfigurationDB: ConfigurationDB, - debugCheckBox: debugCheckBox, - testmode: testmode, - }); - } - } else { - console.log("Modify"); - optoList[indexcurrentOpto] = { - serialNumber: Serial, - Position: Position, - vtrxVersion: vtrx, - flx_G: flx_G, - flx_d: flx_d, - withoutFelixcore: withoutFelixcore, - ConfigurationPath: ConfigurationPath, - inDBCheckBox: inDBCheckBox, - ConfigurationDB: ConfigurationDB, - debugCheckBox: debugCheckBox, - testmode: testmode, - }; - } - console.log(optoList); - fetch(`${url}/sendOptoList`, getPostBody({ optoList: optoList })) - .then((response) => checkResponse(response)) - .then((data) => { - console.log(data); - setisOpen(!isOpen); - }) - .catch((err) => { - console.log(err); - }); - setSerial(""); - } - }; - - const onChangeConfigurationPath = (x) => { - setConfigurationPath(x); - fetch( - `${url}/checkAvailableDatasetInDB`, - getPostBody({ - path: x, - inDB: inDBCheckBox, - CONFIGDB_ADDRESS: ConfigurationDB, - }) - ) - .then((response) => checkResponse(response)) - .then((data) => { - console.log(data); - if (data === 1) { - validConfigPathChange("success"); - setButtonVariant("primary"); - } else { - validConfigPathChange("error"); - setButtonVariant("danger"); - } - }); - }; - - const onChangeConfigurationDB = (newname) => { - setConfigurationDB(newname); - fetch( - `${url}/configDbUnavailable_wrapper`, - getPostBody({ CONFIGDB_ADDRESS: newname }) - ) - .then((response) => checkResponse(response)) - .then((data) => { - console.log(data); - if (data) { - setconfigDBAvailable("error"); - setButtonVariant("danger"); - } else { - setconfigDBAvailable("success"); - setButtonVariant("primary"); - } - }); - }; - - return ( - <React.Fragment> - <Modal - variant={ModalVariant.medium} - title="Initialize the Optoboard" - isOpen={isOpen} - showClose={true} - onClose={() => setisOpen(!isOpen)} - actions={[ - <Button key="close" variant={ButtonVariant} onClick={onClickAdd}> - Add Optoboard to your setup - </Button>, - <Button - key="cancel" - variant="link" - onClick={() => { - setisOpen(!isOpen); - setmodify(false); - }} - > - Cancel - </Button>, - ]} - > - <Flex> - <FlexItem flex={{ default: "flex_1" }}> - <TextContent> - <Text component={TextVariants.h3}>Serial Number</Text> - </TextContent> - </FlexItem> - <FlexItem flex={{ default: "flex_1" }}> - <Bullseye> - <TextInput - id="optoserial" - name="Optoboard Serial Number" - value={Serial} - type="text" - onChange={(X) => setSerial(X)} - aria-label="text input example" - /> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: "flex_1" }}> - <TextContent> - <Text component={TextVariants.h3}>Position</Text> - </TextContent> - </FlexItem> - <FlexItem flex={{ default: "flex_1" }}> - <Bullseye> - <TextInput - id="position" - name="position" - value={Position} - type="text" - onChange={(X) => setPosition(X)} - aria-label="text input example" - /> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: "flex_1" }}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>Vtrx</Text> - </TextContent> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: "flex_1" }}> - <Bullseye> - <FormSelect - value={vtrx} - onChange={(X) => setVtrx(X)} - aria-label="FormSelect Input" - > - {vtrxOptions.map((option, index) => ( - <FormSelectOption - isDisabled={option.disabled} - key={index} - value={option.value} - label={option.label} - /> - ))} - </FormSelect> - </Bullseye> - </FlexItem> - </Flex> - <Flex> - <FlexItem flex={{ default: "flex_1" }}> - <TextContent> - <Text component={TextVariants.h3}>flx_G</Text> - </TextContent> - </FlexItem> - <FlexItem flex={{ default: "flex_1" }}> - <TextInput - id="flx_G_id" - name="flx_G" - value={flx_G} - onChange={(x) => setflx_G(x)} - /> - </FlexItem> - <FlexItem flex={{ default: "flex_1" }}> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>flx_d</Text> - </TextContent> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: "flex_1" }}> - <Bullseye> - <TextInput - id="flx_d" - name="flx_d" - value={flx_d} - onChange={(x) => setflx_d(x)} - /> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: "flex_2" }}> - <Bullseye> - <Checkbox - label={"without felixcore"} - isChecked={withoutFelixcore} - onChange={() => setwithoutFelixcore(!withoutFelixcore)} - id={"without felixcore"} - name={"without felixcore"} - /> - </Bullseye> - </FlexItem> - </Flex> - <Flex> - <FlexItem flex={{ default: "flex_1" }}> - <TextContent> - <Text component={TextVariants.h3}>Configuration File</Text> - </TextContent> - </FlexItem> - <FlexItem flex={{ default: "flex_1" }}> - <TextInput - id="ConfFile" - name="ConfFile" - value={ConfigurationPath} - onChange={onChangeConfigurationPath} - validated={validConfigPath} - /> - </FlexItem> - <FlexItem flex={{ default: "flex_1" }}> - <Checkbox - label={"Search in ConfigDB"} - isChecked={inDBCheckBox} - onChange={() => setinDBCheckBox(!inDBCheckBox)} - id={"Search in the database"} - name={"Search in the database"} - /> - </FlexItem> - </Flex> - <Flex> - <FlexItem flex={{ default: "flex_2" }}> - <TextContent> - <Text component={TextVariants.h3}>ConfigDB</Text> - </TextContent> - </FlexItem> - <FlexItem flex={{ default: "flex_2" }}> - <TextInput - id="ConfigDB" - name="ConfigDB" - value={ConfigurationDB} - onChange={onChangeConfigurationDB} - isDisabled={inDBCheckBox ? false : true} - validated={configDBAvailable} - /> - </FlexItem> - <FlexItem flex={{ default: "flex_1" }}> - <Checkbox - label={"debug"} - isChecked={debugCheckBox} - onChange={() => setdebugCheckBox(!debugCheckBox)} - id={"debug"} - name={"debug"} - /> - </FlexItem> - <FlexItem flex={{ default: "flex_1" }}> - <Checkbox - id="test_mod" - label="test mode" - isChecked={testmode} - onChange={() => SwitchTestModeChange(!testmode)} - /> - </FlexItem> - </Flex> - </Modal> - </React.Fragment> - ); -}; diff --git a/ui/src/SimpleTabs/GBCR.js b/ui/src/SimpleTabs/GBCR.js deleted file mode 100644 index d59675b..0000000 --- a/ui/src/SimpleTabs/GBCR.js +++ /dev/null @@ -1,843 +0,0 @@ -import React from "react"; -import { - Button, - Checkbox, - InputGroup, - InputGroupText, - FormSelect, - FormSelectOption, - FormSelectOptionGroup, - Text, - TextInput, - TextContent, - TextVariants, - Form, - FormGroup, - PanelMainBody, - PanelMain, - Panel, - PanelHeader, - Grid, - GridItem, - Bullseye, - PageSection, - Page, - Flex, FlexItem, -} from "@patternfly/react-core"; - -import { FormSelectInput, FormSelectInputNew } from "../Widgets/FormSelectInput"; -import {WriteReadHorizontal} from "../Controls/WriteRead"; -import { getPostBody, checkResponse } from '../utils/utility-functions'; - - - -class GBCRpannel extends React.Component { - constructor(props) { - super(props); - this.state = { - device : 'gbcr' + props.GBCRnum, - EQ_ATT : [ - { value: '0', disabled: false}, - { value: "1", disabled: false}, - { value: "2", disabled: false}, - { value: "3", disabled: false},], - CML_AmplSel : [ - { value: '0', disabled: false}, - { value: "1", disabled: false}, - { value: "2", disabled: false}, - { value: "3", disabled: false}, - { value: "4", disabled: false}, - { value: "5", disabled: false}, - { value: "6", disabled: false}, - { value: "7", disabled: false},], - MF_EQ : [ {value: "0", disabled: false}, - {value: "1", disabled: false}, - {value: "2", disabled: false}, - {value: "3", disabled: false}, - {value: "4", disabled: false}, - {value: "5", disabled: false}, - {value: "6", disabled: false}, - {value: "7", disabled: false}, - {value: "8", disabled: false}, - {value: "9", disabled: false}, - {value: "10", disabled: false}, - {value: "11", disabled: false}, - {value: "12", disabled: false}, - {value: "13", disabled: false}, - {value: "14", disabled: false}, - {value: "15", disabled: false},], - HF_EQ : [ {value: "0", disabled: false}, - {value: "1", disabled: false}, - {value: "2", disabled: false}, - {value: "3", disabled: false}, - {value: "4", disabled: false}, - {value: "5", disabled: false}, - {value: "6", disabled: false}, - {value: "7", disabled: false}, - {value: "8", disabled: false}, - {value: "9", disabled: false}, - {value: "10", disabled: false}, - {value: "11", disabled: false}, - {value: "12", disabled: false}, - {value: "13", disabled: false}, - {value: "14", disabled: false}, - {value: "15", disabled: false},], - }; - - this.sendSetting = (registerName,settingName,newValue) => { - const body = { - device: 'gbcr' + props.GBCRnum, - registerName: registerName, - settingName: settingName, - newValue: newValue, - //EPRX0Enable: 'EPRX0'+this.props.id+'Enable' - //: this.state.isBox, - //EPRX0DataRate: this.state.dataRate_val, - //EPRX0TrackMode: this.state.trackMode_val, - }; - console.log(body); - return fetch(`${this.props.backendUrl}/sendRegister`, getPostBody(body)).then((response) => checkResponse(response)).then((data) => {console.log(data)}); - }; - - }; - - render() { - return ( - - <React.Fragment> - <Page> - <PageSection> - - - <Flex direction={{ default: 'column' }}> - <Bullseye> - <WriteReadHorizontal backendUrl={this.props.backendUrl} device={'gbcr' + this.props.GBCRnum}/> - </Bullseye> - - <Flex> - - <FlexItem flex={{ default: 'flex_4' }}> - - <Panel variant="bordered"> - <PanelHeader> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>Uplink</Text> - </TextContent> - </Bullseye> - </PanelHeader> - - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - <FlexItem flex={{ default: 'flex_1' }}> - {[1,2].map((num) => (<Pannel1 ConfigurationFile={this.props.ConfigurationFile} GBCRnum={this.props.GBCRnum} sendSetting={this.sendSetting} id1="aqwes" id2="aqwes11" id3="Changeme1" id4="Changeme2" device={this.state.device} widgetNum={num} choices1={this.state.EQ_ATT} choices2={this.state.CML_AmplSel} choices4={this.state.MF_EQ} choices3={this.state.HF_EQ}/>))} - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - {[3,4].map((num) => (<Pannel1 ConfigurationFile={this.props.ConfigurationFile} GBCRnum={this.props.GBCRnum} sendSetting={this.sendSetting} id1="aqwes" id2="aqwes11" id3="Changeme1" id4="Changeme2" device={this.state.device} widgetNum={num} choices1={this.state.EQ_ATT} choices2={this.state.CML_AmplSel} choices4={this.state.MF_EQ} choices3={this.state.HF_EQ}/>))} - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - {[5,6].map((num) => (<Pannel1 ConfigurationFile={this.props.ConfigurationFile} GBCRnum={this.props.GBCRnum} sendSetting={this.sendSetting} id1="aqwes" id2="aqwes11" id3="Changeme1" id4="Changeme2" device={this.state.device} widgetNum={num} choices1={this.state.EQ_ATT} choices2={this.state.CML_AmplSel} choices4={this.state.MF_EQ} choices3={this.state.HF_EQ}/>))} - </FlexItem> - </Flex> - - </Panel> - </FlexItem> - - <FlexItem flex={{ default: 'flex_2' }}> - - <Panel variant="bordered"> - <PanelHeader> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>Downlink</Text> - </TextContent> - </Bullseye> - </PanelHeader> - - {[1,2].map((num) => (<Pannel2 ConfigurationFile={this.props.ConfigurationFile} GBCRnum={this.props.GBCRnum} sendSetting={this.sendSetting} id1="aqwes" id2="aqwes11" device={this.state.device} widgetNum={num} choices1={this.state.EQ_ATT} choices2={this.state.CML_AmplSel} />))} - - </Panel> - </FlexItem> - - <FlexItem flex={{ default: 'flex_2' }}> - - <Panel variant="bordered"> - <PanelHeader> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>Phase Shifter + LVDS Rx&Tx - </Text> - </TextContent> - </Bullseye> - </PanelHeader> - - {<Pannel3 ConfigurationFile={this.props.ConfigurationFile} GBCRnum={this.props.GBCRnum} sendSetting={this.sendSetting} backendUrl={this.props.backendUrl} device={this.state.device} id1="ascsa" choices1={this.state.MF_EQ} choices2={this.state.EQ_ATT}/>} - - </Panel> - - </FlexItem> - - </Flex> - </Flex> - - </PageSection> - </Page> - </React.Fragment> - -);}; -} - - - - - -class Pannel3 extends React.Component { - constructor(props) { - super(props); - this.state = { - checkName1: "dllEnable", checkName1ID: "dllEnable" + props.device, isBox1: Boolean(props.ConfigurationFile["gbcr"]["PHASESHIFTER0"]["DLLENABLE"][Number(props.GBCRnum)-1]), - checkName2: "dllCapReset", checkName2ID: "dllCapReset" + props.device, isBox2: Boolean(props.ConfigurationFile["gbcr"]["PHASESHIFTER0"]["DLLCAPRESET"][Number(props.GBCRnum)-1]), - - checkName3: "dllForceDown", checkName3ID: "dllForceDown" + props.device, isBox3: Boolean(props.ConfigurationFile["gbcr"]["PHASESHIFTER1"]["DLLFORCEDOWN"][Number(props.GBCRnum)-1]), - - checkName10: "Rx_en", checkName10ID: "Rx_en" + props.device, isBox10: Boolean(props.ConfigurationFile["gbcr"]["LVDSRXTX"]["RXEN"][Number(props.GBCRnum)-1]), - checkName11: "Rx_setCM", checkName11ID: "Rx_setCM" + props.device, isBox11: Boolean(props.ConfigurationFile["gbcr"]["LVDSRXTX"]["RXSETCM"][Number(props.GBCRnum)-1]), - - checkName12: "Rx_enableTermination", checkName12ID: "Rx_enableTermination" + props.device, isBox12: Boolean(props.ConfigurationFile["gbcr"]["LVDSRXTX"]["RXENTERMINATION"][Number(props.GBCRnum)-1]), - checkName13: "RxinvData", checkName13ID: "Rx_invData" + props.device, isBox13: Boolean(props.ConfigurationFile["gbcr"]["LVDSRXTX"]["RXINVDATA"][Number(props.GBCRnum)-1]), - checkName14: "disTx", checkName14ID: "disTx" + props.device, isBox14: Boolean(props.ConfigurationFile["gbcr"]["LVDSRXTX"]["DISTX"][Number(props.GBCRnum)-1]), - - dllChargePumpCurrent_val: String(props.ConfigurationFile["gbcr"]["PHASESHIFTER1"]["DLLCHARGEPUMPCURRENT"][Number(props.GBCRnum)-1]), - }; - - this.toggleBox1 = checked => {const memory = this.state.isBox1; - this.setState({isBox1: checked}); - this.props.sendSetting("PHASESHIFTER0",this.state.checkName1, checked ? "1" : "0").catch(err => {this.setState({isBox1 : memory})}); - }; - this.toggleBox2 = checked => {const memory = this.state.isBox2; - this.setState({isBox2: checked}); - this.props.sendSetting("PHASESHIFTER0",this.state.checkName2, checked ? "1" : "0").catch(err => {this.setState({isBox2 : memory})}); - }; - this.toggleBox3 = checked => {const memory = this.state.isBox3; - this.setState({isBox3: checked}); - this.props.sendSetting("PHASESHIFTER1",this.state.checkName3, checked ? "1" : "0").catch(err => {this.setState({isBox3 : memory})}); - }; - this.toggleBox10 = checked => {const memory = this.state.isBox10; - this.setState({isBox10: checked}); - this.props.sendSetting("LVDSRXTX", "Rxen", checked ? "1" : "0").catch(err => {this.setState({isBox10 : memory})}); - }; - this.toggleBox11 = checked => {const memory = this.state.isBox11; - this.setState({isBox11: checked}); - this.props.sendSetting("LVDSRXTX", "RxsetCM", checked ? "1" : "0").catch(err => {this.setState({isBox11 : memory})}); - }; - this.toggleBox12 = checked => {const memory = this.state.isBox12; - this.setState({isBox12: checked}); - this.props.sendSetting("LVDSRXTX", "RxenTermination", checked ? "1" : "0").catch(err => {this.setState({isBox12 : memory})}); - }; - this.toggleBox13 = checked => {const memory = this.state.isBox13; - this.setState({isBox13: checked}); - this.props.sendSetting("LVDSRXTX", "RxinvData", checked ? "1" : "0").catch(err => {this.setState({isBox13 : memory})}); - }; - this.toggleBox14 = checked => {const memory = this.state.isBox14; - this.setState({isBox14: checked}); - this.props.sendSetting("LVDSRXTX", this.state.checkName14, checked ? "1" : "0").catch(err => {this.setState({isBox14 : memory})}); - }; - - this.onChange_form1 = (dllChargePumpCurrent_val) => {const memory = this.state.dllChargePumpCurrent_val; - this.setState({ dllChargePumpCurrent_val }); - console.log(dllChargePumpCurrent_val); - this.props.sendSetting("PHASESHIFTER1",'dllChargePumpCurrent', dllChargePumpCurrent_val).catch(err => {this.setState({dllChargePumpCurrent_val : memory})}); - }; - - }; - - render() { - - return( - <React.Fragment> - - <Panel variant="bordered"> - <PanelMainBody> - <PanelMain> - - - - <Flex direction={{ default: 'column' }}> - - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>Phase Shifter 15</Text> - </TextContent> - </Bullseye> - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.checkName1} isChecked={this.state.isBox1} onChange={this.toggleBox1} id={this.state.checkName1ID} name={this.state.checkName1ID}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.checkName2} isChecked={this.state.isBox2} onChange={this.toggleBox2} id={this.state.checkName2ID} name={this.state.checkName2ID}/> - </Bullseye> - </FlexItem> - </Flex> - - </Flex> - - </PanelMain> - </PanelMainBody> - </Panel> - - - - <Panel variant="bordered"> - <PanelMainBody> - <PanelMain> - - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>Phase Shifter 16</Text> - </TextContent> - </Bullseye> - - - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.checkName3} isChecked={this.state.isBox3} onChange={this.toggleBox3} id={this.state.checkName3ID} name={this.state.checkName3ID}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>dllChargePumpCurrent </h4> - </Bullseye> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNew id={this.props.id1} items={this.props.choices1} value={this.state.dllChargePumpCurrent_val} onChange={this.onChange_form1}/> - </Bullseye> - </FlexItem> - - </Flex> - - - </PanelMain> - </PanelMainBody> - </Panel> - - <Panel variant="bordered"> - <PanelMainBody> - <PanelMain> - - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>Phase Shifter 17</Text> - </TextContent> - </Bullseye> - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - - <FlexItem flex={{ default: 'flex_1' }}> - {<HelperPannel3 sendSetting={this.props.sendSetting} ConfigurationFile={this.props.ConfigurationFile} GBCRnum={this.props.GBCRnum} backendUrl={this.props.backendUrl} id="aqwsazxs" choice={this.props.choices1} regName="PHASESHIFTER2" formName="DLLCLOCKDELAYCH6"/>} - </FlexItem> - - </Flex> - - </PanelMain> - </PanelMainBody> - </Panel> - - - <Panel variant="bordered"> - <PanelMainBody> - <PanelMain> - - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>Phase Shifter 18</Text> - </TextContent> - </Bullseye> - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - <FlexItem flex={{ default: 'flex_1' }}> - {<HelperPannel3 sendSetting={this.props.sendSetting} ConfigurationFile={this.props.ConfigurationFile} GBCRnum={this.props.GBCRnum} backendUrl={this.props.backendUrl} id="aqwsazxs" choice={this.props.choices1} regName="PHASESHIFTER3" formName="DLLCLOCKDELAYCH5"/>} - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - {<HelperPannel3 sendSetting={this.props.sendSetting} ConfigurationFile={this.props.ConfigurationFile} GBCRnum={this.props.GBCRnum} backendUrl={this.props.backendUrl} id="aqwsazxs" choice={this.props.choices1} regName="PHASESHIFTER3" formName="DLLCLOCKDELAYCH4"/>} - </FlexItem> - </Flex> - - </PanelMain> - </PanelMainBody> - </Panel> - - <Panel variant="bordered"> - <PanelMainBody> - <PanelMain> - - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>Phase Shifter 19</Text> - </TextContent> - </Bullseye> - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - - <FlexItem flex={{ default: 'flex_1' }}> - {<HelperPannel3 sendSetting={this.props.sendSetting} ConfigurationFile={this.props.ConfigurationFile} GBCRnum={this.props.GBCRnum} backendUrl={this.props.backendUrl} id="aqwsazxs" choice={this.props.choices1} regName="PHASESHIFTER4" formName="DLLCLOCKDELAYCH7"/>} - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - {<HelperPannel3 sendSetting={this.props.sendSetting} ConfigurationFile={this.props.ConfigurationFile} GBCRnum={this.props.GBCRnum} backendUrl={this.props.backendUrl} id="aqwsazxs" choice={this.props.choices1} regName="PHASESHIFTER4" formName="DLLCLOCKDELAYCH6"/>} - </FlexItem> - - </Flex> - - </PanelMain> - </PanelMainBody> - </Panel> - - - <Panel variant="bordered"> - <PanelMainBody> - <PanelMain> - - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>Phase Shifter 1a</Text> - </TextContent> - </Bullseye> - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - - <FlexItem flex={{ default: 'flex_1' }}> - {<HelperPannel3 sendSetting={this.props.sendSetting} ConfigurationFile={this.props.ConfigurationFile} GBCRnum={this.props.GBCRnum} backendUrl={this.props.backendUrl} id="aqwsazxs" choice={this.props.choices1} regName="PHASESHIFTER5" formName="DLLCLOCKDELAYCH1"/>} - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - {<HelperPannel3 sendSetting={this.props.sendSetting} ConfigurationFile={this.props.ConfigurationFile} GBCRnum={this.props.GBCRnum} backendUrl={this.props.backendUrl} id="aqwsazxs" choice={this.props.choices1} regName="PHASESHIFTER5" formName="DLLCLOCKDELAYCHTEST"/>} - </FlexItem> - - </Flex> - - </PanelMain> - </PanelMainBody> - </Panel> - - - <Panel variant="bordered"> - <PanelMainBody> - <PanelMain> - - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>LVDS_RxandTx_1b</Text> - </TextContent> - </Bullseye> - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.checkName10} isChecked={this.state.isBox10} onChange={this.toggleBox10} id={this.state.checkName10ID} name={this.state.checkName10ID}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.checkName11} isChecked={this.state.isBox11} onChange={this.toggleBox11} id={this.state.checkName11ID} name={this.state.checkName11ID}/> - </Bullseye> - </FlexItem> - - </Flex> - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.checkName12} isChecked={this.state.isBox12} onChange={this.toggleBox12} id={this.state.checkName12ID} name={this.state.checkName12ID}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.checkName13} isChecked={this.state.isBox13} onChange={this.toggleBox13} id={this.state.checkName13ID} name={this.state.checkName13ID}/> - </Bullseye> - </FlexItem> - </Flex> - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - <FlexItem flex={{ default: 'flex_1' }}> - {<HelperPannel3 sendSetting={this.props.sendSetting} ConfigurationFile={this.props.ConfigurationFile} GBCRnum={this.props.GBCRnum} backendUrl={this.props.backendUrl} id="aqwsazxs" choice={this.props.choices2} regName="LVDSRXTX" formName="RXEQ"/>} - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.checkName14} isChecked={this.state.isBox14} onChange={this.toggleBox14} id={this.state.checkName14ID} name={this.state.checkName14ID}/> - </Bullseye> - </FlexItem> - </Flex> - - - </PanelMain> - </PanelMainBody> - </Panel> - - </React.Fragment> - );}; -} - - -class HelperPannel3 extends React.Component { - constructor(props) { - super(props); - this.state = { - valueX: String(props.ConfigurationFile["gbcr"][props.regName][props.formName][Number(props.GBCRnum)-1]), - } - this.onChange_form = (valueX) => {const memory = this.state.valueX; - this.setState({ valueX }); - console.log(valueX); - this.props.sendSetting(this.props.regName,this.props.formName, valueX).catch(err => {this.setState({valueX : memory})}); - }; - }; - - render (){ - return( - <React.Fragment> - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>{this.props.formName}</h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNew id={this.props.id} items={this.props.choice} value={this.state.valueX} onChange={this.onChange_form}/> - </Bullseye> - </FlexItem> - - </Flex> - - </React.Fragment> - )}; -} - - - -class Pannel2 extends React.Component { - constructor(props) { - super(props); - this.state = { - form1Name: "TX" + props.widgetNum + "DL_ATT", - form1Val: String(props.ConfigurationFile["gbcr"]["CH" + props.widgetNum + "DOWNLINK0"]["TX" + props.widgetNum + "DLATT"][Number(props.GBCRnum)-1]), - - form2Name: "TX" + props.widgetNum + "DL_SR", - form2Val: String(props.ConfigurationFile["gbcr"]["CH" + props.widgetNum + "DOWNLINK0"]["TX" + props.widgetNum + "DLSR"][Number(props.GBCRnum)-1]), - - checkName1: "Tx" + props.widgetNum + "disDL_Emp", checkName1ID: "Tx" + props.widgetNum + "disDL_Emp" + props.device, - isBox1: Boolean(props.ConfigurationFile["gbcr"]["CH" + props.widgetNum + "DOWNLINK0"]["TX" + props.widgetNum + "DISDLEMP"][Number(props.GBCRnum)-1]), - - checkName2: "Tx" + props.widgetNum + "disDL_Bias", checkName2ID: "Tx" + props.widgetNum + "disDL_Bias" + props.device, - isBox2: Boolean(props.ConfigurationFile["gbcr"]["CH" + props.widgetNum + "DOWNLINK1"]["TX" + props.widgetNum + "DISDLBIAS"][Number(props.GBCRnum)-1]), - - checkName3: "Tx" + props.widgetNum + "disDL_LPF_Bias", checkName3ID: "Tx" + props.widgetNum + "disDL_LPF_Bias" + props.device, - isBox3: Boolean(props.ConfigurationFile["gbcr"]["CH" + props.widgetNum + "DOWNLINK1"]["TX" + props.widgetNum + "DISDLLPFBIAS"][Number(props.GBCRnum)-1]), - }; - - this.toggleBox1 = checked => {const memory = this.state.isBox1; - this.setState({isBox1: checked}); - this.props.sendSetting("CH" + props.widgetNum + "DOWNLINK0","Tx" + props.widgetNum + "disDLEmp", checked ? "1" : "0").catch(err => {this.setState({isBox1 : memory})}); - }; - this.toggleBox2 = checked => {const memory = this.state.isBox2; - this.setState({isBox2: checked}); - this.props.sendSetting("CH" + props.widgetNum + "DOWNLINK1","Tx" + props.widgetNum + "disDLBias", checked ? "1" : "0").catch(err => {this.setState({isBox2 : memory})}); - }; - this.toggleBox3 = checked => {const memory = this.state.isBox3; - this.setState({isBox3: checked}); - this.props.sendSetting("CH" + props.widgetNum + "DOWNLINK1","Tx" + props.widgetNum + "disDLLPFBias", checked ? "1" : "0").catch(err => {this.setState({isBox3 : memory})}); - }; - - this.onChange_form1 = (form1Val) => {const memory = this.state.form1Val; - this.setState({ form1Val }); - console.log(form1Val); - this.props.sendSetting("CH" + props.widgetNum + "DOWNLINK0","TX" + props.widgetNum + "DLATT", form1Val).catch(err => {this.setState({form1Val : memory})}); - }; - this.onChange_form2 = (form2Val) => {const memory = this.state.form2Val; - this.setState({ form2Val }); - console.log(form2Val); - this.props.sendSetting("CH" + props.widgetNum + "DOWNLINK0","TX" + props.widgetNum + "DLSR", form2Val).catch(err => {this.setState({form2Val : memory})}); - }; - }; - - render(){ - - return( - <React.Fragment> - - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>Downlink Ch{this.props.widgetNum}</Text> - </TextContent> - </Bullseye> - - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - - <FlexItem flex={{ default: 'flex_1' }}> - <h4>{this.state.form1Name}</h4> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <FormSelectInputNew id={this.props.id1} items={this.props.choices1} value={this.state.form1Val} onChange={this.onChange_form1}/> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <h4>{this.state.form2Name}</h4> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <FormSelectInputNew id={this.props.id2} items={this.props.choices2} value={this.state.form2Val} onChange={this.onChange_form2}/> - </FlexItem> - - - </Flex> - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.checkName1} isChecked={this.state.isBox1} onChange={this.toggleBox1} id={this.state.checkName1ID} name={this.state.checkName1ID}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.checkName2} isChecked={this.state.isBox2} onChange={this.toggleBox2} id={this.state.checkName2ID} name={this.state.checkName2ID}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.checkName3} isChecked={this.state.isBox3} onChange={this.toggleBox3} id={this.state.checkName3ID} name={this.state.checkName3ID}/> - </Bullseye> - </FlexItem> - - </Flex> - - </PanelMainBody> - </PanelMain> - </Panel> - </React.Fragment> -);}; -} - - - - -class Pannel1 extends React.Component { - constructor(props) { - super(props); - this.state = { - isBox: Boolean(props.ConfigurationFile["gbcr"]["CH" + props.widgetNum + "UPLINK0"]["CH" + props.widgetNum + "DISEQLF"][Number(props.GBCRnum)-1]), - checkName: "ch" + props.widgetNum + "dis_EQ_LF", - checkNameID: "ch" + props.widgetNum + "dis_EQ_LF" + props.device, - - form1Name: "ch" + props.widgetNum + "EQ_ATT", - form2Name: "ch" + props.widgetNum + "CML_AmplSel", - form3Name: "ch" + props.widgetNum + "CTLE_HFSR", - form4Name: "ch" + props.widgetNum + "CTLE_MFSR", - form1NameID: "ch" + props.widgetNum + "EQ_ATT" + props.device, - form2NameID: "ch" + props.widgetNum + "CML_AmplSel" + props.device, - form3NameID: "ch" + props.widgetNum + "CTLE_HFSR" + props.device, - form4NameID: "ch" + props.widgetNum + "CTLE_MFSR" + props.device, - - checkName2: "ch" + props.widgetNum + "Dis", - checkName2ID: "ch" + props.widgetNum + "Dis" + props.device, - isBox2: Boolean(props.ConfigurationFile["gbcr"]["CH" + props.widgetNum + "UPLINK2"]["CH" + props.widgetNum + "DIS"][Number(props.GBCRnum)-1]), - - checkName3: "ch" + props.widgetNum + "disDFF", - checkName3ID: "ch" + props.widgetNum + "disDFF" + props.device, - isBox3: Boolean(props.ConfigurationFile["gbcr"]["CH" + props.widgetNum + "UPLINK2"]["CH" + props.widgetNum + "DISDFF"][Number(props.GBCRnum)-1]), - - checkName4: "ch" + props.widgetNum + "disLPF", - checkName4ID: "ch" + props.widgetNum + "disLPF" + props.device, - isBox4: Boolean(props.ConfigurationFile["gbcr"]["CH" + props.widgetNum + "UPLINK2"]["CH" + props.widgetNum + "DISLPF"][Number(props.GBCRnum)-1]), - - EQ_ATT_val: String(props.ConfigurationFile["gbcr"]["CH" + props.widgetNum + "UPLINK0"]["CH" + props.widgetNum + "EQATT"][Number(props.GBCRnum)-1]), - CML_AmplSel_val: String(props.ConfigurationFile["gbcr"]["CH" + props.widgetNum + "UPLINK0"]["CH" + props.widgetNum + "CMLAMPLSEL"][Number(props.GBCRnum)-1]), - HF_EQ_val: String(props.ConfigurationFile["gbcr"]["CH" + props.widgetNum + "UPLINK1"]["CH" + props.widgetNum + "CTLEHFSR"][Number(props.GBCRnum)-1]), - MF_EQ_val: String(props.ConfigurationFile["gbcr"]["CH" + props.widgetNum + "UPLINK1"]["CH" + props.widgetNum + "CTLEMFSR"][Number(props.GBCRnum)-1]), - }; - - this.toggleBox = checked => { const memory = this.state.isBox; - this.setState({isBox: checked}); - this.props.sendSetting("CH" + props.widgetNum + "UPLINK0","ch" + props.widgetNum + "disEQLF", checked ? "1" : "0").catch(err => {this.setState({isBox : memory})}); - }; - - this.toggleBox2 = checked => { const memory = this.state.isBox2; - this.setState({isBox2: checked}); - this.props.sendSetting("CH" + props.widgetNum + "UPLINK2","ch" + props.widgetNum + "Dis", checked ? "1" : "0").catch(err => {this.setState({isBox2 : memory})}); - }; - - this.toggleBox3 = checked => { const memory = this.state.isBox3; - this.setState({isBox3: checked}); - this.props.sendSetting("CH" + props.widgetNum + "UPLINK2","ch" + props.widgetNum + "disDFF", checked ? "1" : "0").catch(err => {this.setState({isBox3 : memory})}); - }; - - this.toggleBox4 = checked => { const memory = this.state.isBox4; - this.setState({isBox4: checked}); - this.props.sendSetting("CH" + props.widgetNum + "UPLINK2","ch" + props.widgetNum + "disLPF", checked ? "1" : "0").catch(err => {this.setState({isBox4 : memory})}); - }; - - this.onChange_EQ_ATT = (EQ_ATT_val) => {const memory = this.state.EQ_ATT_val; - this.setState({ EQ_ATT_val }); - console.log(EQ_ATT_val); - this.props.sendSetting("CH" + props.widgetNum + "UPLINK0","ch" + props.widgetNum + "EQATT", EQ_ATT_val).catch(err => {this.setState({EQ_ATT_val : memory})}); - }; - this.onChange_CML_AmplSel_val = (CML_AmplSel_val) => {const memory = this.state.CML_AmplSel_val; - this.setState({ CML_AmplSel_val }); - console.log(CML_AmplSel_val); - this.props.sendSetting("CH" + props.widgetNum + "UPLINK0","ch" + props.widgetNum + "CMLAmplSel", CML_AmplSel_val).catch(err => {this.setState({CML_AmplSel_val : memory})}); - }; - this.onChange_CTLE_HFSR = (HF_EQ_val) => {const memory = this.state.HF_EQ_val; - this.setState({ HF_EQ_val }); - console.log(HF_EQ_val); - this.props.sendSetting("CH" + props.widgetNum + "UPLINK1","ch" + props.widgetNum + "CTLEHFSR", HF_EQ_val).catch(err => {this.setState({HF_EQ_val : memory})}); - }; - this.onChange_CTLE_MFSR = (MF_EQ_val) => {const memory = this.state.MF_EQ_val; - this.setState({ MF_EQ_val }); - console.log(MF_EQ_val); - this.props.sendSetting("CH" + props.widgetNum + "UPLINK1","ch" + props.widgetNum + "CTLEMFSR", MF_EQ_val).catch(err => {this.setState({MF_EQ_val : memory})}); - }; - }; - - render(){ - return( - - <React.Fragment> - - <Panel variant="bordered"> - <PanelMain> - <PanelMainBody> - - <Flex direction={{ default: 'column' }}> - - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>Uplink Ch{this.props.widgetNum}</Text> - </TextContent> - </Bullseye> - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.checkName} isChecked={this.state.isBox} onChange={this.toggleBox} id={this.state.checkNameID} name={this.state.checkNameID}/> - </Bullseye> - </FlexItem> - - </Flex> - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>{this.state.form1Name}</h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNew id={this.props.id1} items={this.props.choices1} value={this.state.EQ_ATT_val} onChange={this.onChange_EQ_ATT}/> - </Bullseye> - </FlexItem> - - </Flex> - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>{this.state.form2Name}</h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNew id={this.props.id2} items={this.props.choices2} value={this.state.CML_AmplSel_val} onChange={this.onChange_CML_AmplSel_val}/> - </Bullseye> - </FlexItem> - - </Flex> - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>{this.state.form3Name}</h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNew id={this.props.id3} items={this.props.choices3} value={this.state.HF_EQ_val} onChange={this.onChange_CTLE_HFSR}/> - </Bullseye> - </FlexItem> - - </Flex> - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <h4>{this.state.form4Name}</h4> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNew id={this.props.id4} items={this.props.choices4} value={this.state.MF_EQ_val} onChange={this.onChange_CTLE_MFSR}/> - </Bullseye> - </FlexItem> - </Flex> - - <Flex justifyContent={{ default: 'justifyContentFlexCenter' }}> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.checkName2} isChecked={this.state.isBox2} onChange={this.toggleBox2} id={this.state.checkName2ID} name={this.state.checkName2ID}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.checkName3} isChecked={this.state.isBox3} onChange={this.toggleBox3} id={this.state.checkName3ID} name={this.state.checkName3ID}/> - </Bullseye> - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <Checkbox label={this.state.checkName4} isChecked={this.state.isBox4} onChange={this.toggleBox4} id={this.state.checkName4ID} name={this.state.checkName4ID}/> - </Bullseye> - </FlexItem> - </Flex> - </Flex> - - </PanelMainBody> - </PanelMain> - </Panel> - </React.Fragment> - );}; -}; - -export { GBCRpannel }; diff --git a/ui/src/SimpleTabs/eLinks.js b/ui/src/SimpleTabs/eLinks.js deleted file mode 100644 index cd6642e..0000000 --- a/ui/src/SimpleTabs/eLinks.js +++ /dev/null @@ -1,388 +0,0 @@ -import React from "react"; -import { - Button, - Checkbox, - InputGroup, - InputGroupText, - FormSelect, - FormSelectOption, - FormSelectOptionGroup, - Text, - TextInput, - TextContent, - TextVariants, - Form, - FormGroup, - PanelMainBody, - PanelMain, - Panel, - PanelHeader, - Grid, - GridItem, - Bullseye, - PageSection, - Page, - Flex, - FlexItem, -} from "@patternfly/react-core"; - -import { FormSelectInput, FormSelectInputNewer } from "../Widgets/FormSelectInput"; -import { getPostBody, checkResponse } from '../utils/utility-functions' - - -class ELinks extends React.Component { - constructor(props) { - super(props); - this.state = { - DriveStrength : [ { label: '0.0 mA', disabled: false, value: '0'}, - { label: '1.0 mA', disabled: false, value: '1'}, - { label: '1.5 mA', disabled: false, value: '2'}, - { label: '2.0 mA', disabled: false, value: '3'}, - { label: '2.5 mA', disabled: false, value: '4'}, - { label: '3.0 mA', disabled: false, value: '5'}, - { label: '3.5 mA', disabled: false, value: '6'}, - { label: '4.0 mA', disabled: false, value: '7'}], - //DriveStrength_valOne: '0', DriveStrength_valTwo: '0', DriveStrength_valThree: '0', DriveStrength_valFour: '0', DriveStrength_valFive: '0', DriveStrength_valSix: '0', DriveStrength_valSeven: '0', - Freq : [{ label: 'disabled', disabled: false, value: '0'}, - { label: '40', disabled: false, value: '1'}, - { label: '80', disabled: false, value: '2'}, - { label: '160', disabled: false, value: '3'}, - { label: '320', disabled: false, value: '4'}, - { label: '640', disabled: false, value: '5'}, - { label: '1280', disabled: false, value: '6'}, - { label: 'EDIN62 loopback', disabled: false, value: '7'}], - //Freq_val: { one: '0', two: '0', three: '0', four: '0', five: '0', six: '0', seven: '0'}, - PreEmphasisStrength : [ { label: '0.0 mA', disabled: false, value: '0'}, - { label: '1.0 mA', disabled: false, value: '1'}, - { label: '1.5 mA', disabled: false, value: '2'}, - { label: '2.0 mA', disabled: false, value: '3'}, - { label: '2.5 mA', disabled: false, value: '4'}, - { label: '3.0 mA', disabled: false, value: '5'}, - { label: '3.5 mA', disabled: false, value: '6'}, - { label: '4.0 mA', disabled: false, value: '7'}], - //PreEmphasisStrength_val: { one: '0', two: '0', three: '0', four: '0', five: '0', six: '0', seven: '0'}, - PreEmphasisMode : [ { label: 'disabled', disabled: false, value: '0'}, - { label: 'disabled', disabled: false, value: '1'}, - { label: 'self timed', disabled: false, value: '2'}, - { label: 'clock timed', disabled: false, value: '3'}], - //PreEmphasisMode_val: { one: '0', two: '0', three: '0', four: '0', five: '0', six: '0', seven: '0'}, - PreEmphasisWidth : [{ label: '120', disabled: false, value: '0'}, - { label: '240', disabled: false, value: '1'}, - { label: '360', disabled: false, value: '2'}, - { label: '480', disabled: false, value: '3'}, - { label: '600', disabled: false, value: '4'}, - { label: '720', disabled: false, value: '5'}, - { label: '840', disabled: false, value: '6'}, - { label: '960', disabled: false, value: '7'},], - //PreEmphasisWidth_val: { one: '0', two: '0', three: '0', four: '0', five: '0', six: '0', seven: '0'}, - }; - - this.sendSetting = (device,registerName,settingName,newValue) => { - const body = { - device: device, - registerName: registerName, - settingName: settingName, - newValue: newValue, - //EPRX0Enable: 'EPRX0'+this.props.id+'Enable' - //: this.state.isBox, - //EPRX0DataRate: this.state.dataRate_val, - //EPRX0TrackMode: this.state.trackMode_val, - }; - console.log(body); - return fetch(`${this.props.backendUrl}/sendRegister`, getPostBody(body)).then((response) => checkResponse(response)).then((data) => {console.log(data)}); - }; - - }; - - render() { - return ( - - <React.Fragment> - <Page> - <PageSection> - - - <Flex direction={{ default: 'column' }}> - <Bullseye> - <Button id="inputDropdownButton15" variant="primary"> - Configure all registers as below - </Button> - </Bullseye> - - <Panel variant="bordered"> - <PanelHeader> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>from lpGBT1</Text> - </TextContent> - </Bullseye> - </PanelHeader> - - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - <FlexItem flex={{ default: 'flex_1' }}> - - {<HelperELinks EPCLK="2" toChip="(to lpGBT2)" id="changeME" sendSetting={this.sendSetting} device="lpgbt1" - DriveStrength={this.state.DriveStrength} - Freq={this.state.Freq} - PreEmphasisStrength={this.state.PreEmphasisStrength} - PreEmphasisMode={this.state.PreEmphasisMode} - PreEmphasisWidth={this.state.PreEmphasisWidth} - ConfigurationFile={this.props.ConfigurationFile} />} - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - {<HelperELinks EPCLK="26" toChip="(to lpGBT3)" id="changeME" sendSetting={this.sendSetting} device="lpgbt1" - DriveStrength={this.state.DriveStrength} - Freq={this.state.Freq} - PreEmphasisStrength={this.state.PreEmphasisStrength} - PreEmphasisMode={this.state.PreEmphasisMode} - PreEmphasisWidth={this.state.PreEmphasisWidth} - ConfigurationFile={this.props.ConfigurationFile} />} - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - {<HelperELinks EPCLK="19" toChip="(to lpGBT4)" id="changeME" sendSetting={this.sendSetting} device="lpgbt1" - DriveStrength={this.state.DriveStrength} - Freq={this.state.Freq} - PreEmphasisStrength={this.state.PreEmphasisStrength} - PreEmphasisMode={this.state.PreEmphasisMode} - PreEmphasisWidth={this.state.PreEmphasisWidth} - ConfigurationFile={this.props.ConfigurationFile} />} - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - {<HelperELinks EPCLK="5" toChip="(to GBCR1)" id="changeME" sendSetting={this.sendSetting} device="lpgbt1" - DriveStrength={this.state.DriveStrength} - Freq={this.state.Freq} - PreEmphasisStrength={this.state.PreEmphasisStrength} - PreEmphasisMode={this.state.PreEmphasisMode} - PreEmphasisWidth={this.state.PreEmphasisWidth} - ConfigurationFile={this.props.ConfigurationFile} />} - </FlexItem> - - </Flex> - - </Panel> - - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - - <FlexItem flex={{ default: 'flex_1' }}> - - <Panel variant="bordered"> - <PanelHeader> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}> - from lpGBT2 - </Text> - </TextContent> - </Bullseye> - </PanelHeader> - - {<HelperELinks EPCLK="5" toChip="(to GBCR2)" id="changeME" sendSetting={this.sendSetting} device="lpgbt2" - DriveStrength={this.state.DriveStrength} - Freq={this.state.Freq} - PreEmphasisStrength={this.state.PreEmphasisStrength} - PreEmphasisMode={this.state.PreEmphasisMode} - PreEmphasisWidth={this.state.PreEmphasisWidth} - ConfigurationFile={this.props.ConfigurationFile} />} - - </Panel> - - </FlexItem> - - <FlexItem flex={{ default: 'flex_1' }}> - - <Panel variant="bordered"> - <PanelHeader> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}> - from lpGBT3 - </Text> - </TextContent> - </Bullseye> - </PanelHeader> - - {<HelperELinks EPCLK="5" toChip="(to GBCR3)" id="changeME" sendSetting={this.sendSetting} device="lpgbt3" - DriveStrength={this.state.DriveStrength} - Freq={this.state.Freq} - PreEmphasisStrength={this.state.PreEmphasisStrength} - PreEmphasisMode={this.state.PreEmphasisMode} - PreEmphasisWidth={this.state.PreEmphasisWidth} - ConfigurationFile={this.props.ConfigurationFile} />} - - </Panel> - - </FlexItem> - - - <FlexItem flex={{ default: 'flex_1' }}> - - <Panel variant="bordered"> - <PanelHeader> - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}>from lpGBT4</Text> - </TextContent> - </Bullseye> - </PanelHeader> - - - {<HelperELinks EPCLK="5" toChip="(to GBCR4)" id="changeME" sendSetting={this.sendSetting} device="lpgbt4" - DriveStrength={this.state.DriveStrength} - Freq={this.state.Freq} - PreEmphasisStrength={this.state.PreEmphasisStrength} - PreEmphasisMode={this.state.PreEmphasisMode} - PreEmphasisWidth={this.state.PreEmphasisWidth} - ConfigurationFile={this.props.ConfigurationFile} />} - - </Panel> - - </FlexItem> - - </Flex> - </Flex> - - </PageSection> - </Page> - </React.Fragment> - -);}; -}; - - - - - -class HelperELinks extends React.Component { - constructor(props) { - super(props); - this.state = { - isBox : false, - checkLabel: 'EPCLK'+props.EPCLK+'Invert', checkLabelID: 'EPCLK'+this.props.EPCLK+'Invert' + props.device, - checkLabel_reg: "EPCLK" + props.EPCLK + "CHNCNTRH", checkLabel_regID: "EPCLK" + props.EPCLK + "ChnCntrH" + props.device, - pannelLabel: "EPCLK" + props.EPCLK + "ChnCntr" + props.toChip, - DriveStrength_val: String(props.ConfigurationFile["lpgbt"]["EPCLK" + props.EPCLK + "CHNCNTRH"]['EPCLK'+props.EPCLK+'DRIVESTRENGTH'][Number(props.device[5])-1]), - Freq_val: String(props.ConfigurationFile["lpgbt"]["EPCLK" + props.EPCLK + "CHNCNTRH"]['EPCLK'+props.EPCLK+'FREQ'][Number(props.device[5])-1]), - PreEmphasisStrength_val: String(props.ConfigurationFile["lpgbt"]['EPCLK'+props.EPCLK+'CHNCNTRL']['EPCLK'+props.EPCLK+'PREEMPHASISSTRENGTH'][Number(props.device[5])-1]), - PreEmphasisMode_val: String(props.ConfigurationFile["lpgbt"]['EPCLK'+props.EPCLK+'CHNCNTRL']['EPCLK'+props.EPCLK+'PREEMPHASISMODE'][Number(props.device[5])-1]), - PreEmphasisWidth_val: String(props.ConfigurationFile["lpgbt"]['EPCLK'+props.EPCLK+'CHNCNTRL']['EPCLK'+props.EPCLK+'PREEMPHASISWIDTH'][Number(props.device[5])-1]), - }; - - this.toggleBox = checked => { const memory = this.state.isBox; - this.setState({isBox : checked}); - this.props.sendSetting(this.props.device, this.state.checkLabel_reg, this.state.checkLabel, checked ? "1" : "0").catch(err => {this.setState({isBox : memory});}); - }; - - this.onChange_DriveStrength = (DriveStrength_val) => {const memory = this.state.DriveStrength_val; - this.setState({ DriveStrength_val }); - console.log(DriveStrength_val); - this.props.sendSetting(this.props.device, this.state.checkLabel_reg,'EPCLK'+this.props.EPCLK+'DriveStrength', DriveStrength_val).catch(err => {this.setState({ DriveStrength_val : memory});}); - }; - this.onChange_Freq = (Freq_val) => { const memory = this.state.Freq_val; - this.setState({ Freq_val }); - this.props.sendSetting(this.props.device, this.state.checkLabel_reg,'EPCLK'+this.props.EPCLK+'Freq', Freq_val).catch(err => {this.setState({ Freq_val : memory});}); - }; - this.onChange_PreEmphasisStrength = (PreEmphasisStrength_val) => { - const memory = this.state.PreEmphasisStrength_val; - this.setState({ PreEmphasisStrength_val }); - this.props.sendSetting(this.props.device, 'EPCLK'+this.props.EPCLK+'ChnCntrL','EPCLK'+this.props.EPCLK+'PreEmphasisStrength', PreEmphasisStrength_val).catch(err => {this.setState({ PreEmphasisStrength_val : memory});}); - }; - this.onChange_PreEmphasisMode = (PreEmphasisMode_val) => { - const memory = this.state.PreEmphasisMode_val; - this.setState({ PreEmphasisMode_val }); - this.props.sendSetting(this.props.device, 'EPCLK'+this.props.EPCLK+'ChnCntrL','EPCLK'+this.props.EPCLK+'PreEmphasisMode', PreEmphasisMode_val).catch(err => {this.setState({ PreEmphasisMode_val : memory});}); - }; - this.onChange_PreEmphasisWidth = (PreEmphasisWidth_val) => { - const memory = this.state.PreEmphasisWidth_val; - this.setState({ PreEmphasisWidth_val }); - this.props.sendSetting(this.props.device, 'EPCLK'+this.props.EPCLK+'ChnCntrL','EPCLK'+this.props.EPCLK+'PreEmphasisWidth', PreEmphasisWidth_val).catch(err => {this.setState({ PreEmphasisWidth_val : memory});}); - }; - }; - - render() { - return ( - - <React.Fragment> - <Panel variant="bordered"> - <PanelMainBody> - <PanelMain> - - - <Bullseye> - <TextContent> - <Text component={TextVariants.h3}> {this.state.pannelLabel} </Text> - </TextContent> - </Bullseye> - - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - <FlexItem flex={{ default: 'flex_1' }}> - <Checkbox label={this.state.checkLabel} isChecked={this.state.isBox} onChange={this.toggleBox} id={this.state.checkLabelID} name={this.state.checkLabelID}/> - </FlexItem> - </Flex> - - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - <FlexItem flex={{ default: 'flex_1' }}> - <h4> EPCLK{this.props.EPCLK}DriveStrength </h4> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNewer id={this.props.id} items={this.props.DriveStrength} value={this.state.DriveStrength_val} onChange={this.onChange_DriveStrength}/> - </Bullseye> - </FlexItem> - </Flex> - - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - <FlexItem flex={{ default: 'flex_1' }}> - <h4> EPCLK{this.props.EPCLK}Freq </h4> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNewer id={this.props.id} items={this.props.Freq} value={this.state.Freq_val} onChange={this.onChange_Freq}/> - </Bullseye> - </FlexItem> - </Flex> - - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - <FlexItem flex={{ default: 'flex_1' }}> - <h4> EPCLK{this.props.EPCLK}PreEmphasisStrength </h4> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNewer id={this.props.id} items={this.props.PreEmphasisStrength} value={this.state.PreEmphasisStrength_val} onChange={this.onChange_PreEmphasisStrength}/> - </Bullseye> - </FlexItem> - </Flex> - - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - <FlexItem flex={{ default: 'flex_1' }}> - <h4> EPCLK{this.props.EPCLK}PreEmphasisMode </h4> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNewer id={this.props.id} items={this.props.PreEmphasisMode} value={this.state.PreEmphasisMode_val} onChange={this.onChange_PreEmphasisMode}/> - </Bullseye> - </FlexItem> - </Flex> - - <Flex spaceItems={{ default: 'spaceItemsNone' }}> - <FlexItem flex={{ default: 'flex_1' }}> - <h4> EPCLK{this.props.EPCLK}PreEmphasisWidth </h4> - </FlexItem> - <FlexItem flex={{ default: 'flex_1' }}> - <Bullseye> - <FormSelectInputNewer id={this.props.id} items={this.props.PreEmphasisWidth} value={this.state.PreEmphasisWidth_val} onChange={this.onChange_PreEmphasisWidth}/> - </Bullseye> - </FlexItem> - </Flex> - - - </PanelMain> - </PanelMainBody> - </Panel> - </React.Fragment> - );}; -} - -export { ELinks }; diff --git a/ui/src/SimpleTabs/OptoboardGUI.js b/ui/src/UI_architecture/OptoboardGUI.js similarity index 99% rename from ui/src/SimpleTabs/OptoboardGUI.js rename to ui/src/UI_architecture/OptoboardGUI.js index 16b4359..9ddf0e1 100644 --- a/ui/src/SimpleTabs/OptoboardGUI.js +++ b/ui/src/UI_architecture/OptoboardGUI.js @@ -1,7 +1,6 @@ import React, { useState, useEffect } from "react"; // import { defaultConfig, Configurations } from "../Config/Configurations"; -import { OptoboardList } from "../SimpleTabs/OptoboardList"; -import { AddOptoboard } from "../SimpleTabs/AddOptoboard"; +import { OptoboardList } from "./OptoboardList"; import { Bullseye, diff --git a/ui/src/SimpleTabs/OptoboardList.js b/ui/src/UI_architecture/OptoboardList.js similarity index 96% rename from ui/src/SimpleTabs/OptoboardList.js rename to ui/src/UI_architecture/OptoboardList.js index 2a74026..fe3ac94 100644 --- a/ui/src/SimpleTabs/OptoboardList.js +++ b/ui/src/UI_architecture/OptoboardList.js @@ -1,7 +1,7 @@ import React, { useState, useEffect } from "react"; -import { WriteReadBox } from "../Controls/WriteReadBox"; -import { Config } from "../Controls/Config"; -import { OptoStatus } from "../Controls/OptoStatus"; +import { WriteReadBox } from "../OptoboardTools/WriteReadBox"; +import { Config } from "../OptoboardTools/Config"; +import { OptoStatus } from "../OptoboardTools/OptoStatus"; import { Bullseye, @@ -17,11 +17,6 @@ import { PanelMainBody, Icon, Spinner, - Drawer, - DrawerContent, - DrawerHead, - DrawerContentBody, - DrawerPanelContent, } from "@patternfly/react-core"; import CogIcon from "@patternfly/react-icons/dist/esm/icons/cog-icon"; -- GitLab From ce4a448c6eab9a10eff4998c49bc0d2e111e7cc6 Mon Sep 17 00:00:00 2001 From: Daniele Dal Santo <dal.santo.daniele@cern.ch> Date: Thu, 2 Mar 2023 11:58:26 +0100 Subject: [PATCH 33/33] Minor --- ui/src/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/index.tsx b/ui/src/index.tsx index 34368ba..c1d1a34 100644 --- a/ui/src/index.tsx +++ b/ui/src/index.tsx @@ -1,6 +1,6 @@ import ReactDOM from "react-dom"; import "@patternfly/react-core/dist/styles/base.css"; -import { OptoboardGUI } from "./SimpleTabs/OptoboardGUI"; +import { OptoboardGUI } from "./UI_architecture/OptoboardGUI"; // the url provided in the ReactDOM is used inside the gui for the fetch commands ReactDOM.render( -- GitLab