From 11d99fa821e1eb1ba7f30c8d0b53b35202c8c9ee Mon Sep 17 00:00:00 2001 From: pb Date: Mon, 1 Jul 2024 16:31:03 +0200 Subject: [PATCH] quickfix to display current values of each box in component's setting --- .../examples/grapheditor/www/js/Dialogs.js | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/static/mxgraph/examples/grapheditor/www/js/Dialogs.js b/static/mxgraph/examples/grapheditor/www/js/Dialogs.js index 0423083..1891cc7 100644 --- a/static/mxgraph/examples/grapheditor/www/js/Dialogs.js +++ b/static/mxgraph/examples/grapheditor/www/js/Dialogs.js @@ -1638,6 +1638,11 @@ var EditDataDialog = function(ui, cell) /** * Constructs a new settings dialog. */ +/* + TODO + - [ ] create a function to fill an input label with its current value if it has one + - [ ] create a function to create a different window for each type of component (check cell.rType ?) + */ var EditSettingsDialog = function(ui, cell) { var div = document.createElement('div'); @@ -1645,6 +1650,10 @@ var EditDataDialog = function(ui, cell) var values = graph.getModel().getValue(cell); + var getCurrentValue = function(labelName) { + return values.getAttribute(labelName) + } + // Converts the value to an XML node if (!mxUtils.isNode(values)) { @@ -1694,8 +1703,9 @@ var EditDataDialog = function(ui, cell) var coreLabel = document.createTextNode(mxResources.get('core')); var coreInput = document.createElement('input'); - coreInput.value = "Test value" + coreInput.value = getCurrentValue('core') coreInput.setAttribute('type', 'text'); + coreInput.style.fontSize = '13px' coreInput.style.boxSizing = 'border-box'; coreInput.style.marginLeft = '2px'; coreInput.style.width = '20%'; @@ -1707,6 +1717,8 @@ var EditDataDialog = function(ui, cell) var ramLabel = document.createTextNode(mxResources.get('ram')); var ramInput = document.createElement('input'); ramInput.setAttribute('type', 'text'); + ramInput.value = getCurrentValue('ram') + ramInput.style.fontSize = '13px' ramInput.style.boxSizing = 'border-box'; ramInput.style.marginLeft = '2px'; ramInput.style.width = '20%'; @@ -1719,6 +1731,8 @@ var EditDataDialog = function(ui, cell) var durationInput = document.createElement('input'); durationInput.setAttribute('type', 'text'); durationInput.placeholder = 'in seconds' + durationInput.value = getCurrentValue('estDuration') + durationInput.style.fontSize = '13px' durationInput.style.boxSizing = 'border-box'; durationInput.style.marginLeft = '2px'; durationInput.style.width = '20%'; @@ -1728,6 +1742,8 @@ var EditDataDialog = function(ui, cell) var commandLabel = document.createTextNode(mxResources.get('command')); var commandInput = document.createElement('input'); commandInput.setAttribute('type', 'text'); + commandInput.value = getCurrentValue('command') + commandInput.style.fontSize = '13px' commandInput.style.boxSizing = 'border-box'; commandInput.style.marginLeft = '2px'; commandInput.style.width = '100%'; @@ -1738,6 +1754,8 @@ var EditDataDialog = function(ui, cell) var argsInput = document.createElement('input'); argsInput.setAttribute('type', 'text'); argsInput.placeholder = '"arg1","arg2",...' + argsInput.value = getCurrentValue('args') + argsInput.style.fontSize = '13px' argsInput.style.boxSizing = 'border-box'; argsInput.style.marginLeft = '2px'; argsInput.style.width = '100%'; @@ -1748,6 +1766,9 @@ var EditDataDialog = function(ui, cell) var envInput = document.createElement('input'); envInput.setAttribute('type', 'text'); envInput.placeholder = '"env1"="value1","env2"="value2",...' + console.log("THIS IS THE TEST " + values) + envInput.value = getCurrentValue('env') + envInput.style.fontSize = '13px' envInput.style.boxSizing = 'border-box'; envInput.style.marginLeft = '2px'; envInput.style.width = '100%'; @@ -1758,6 +1779,8 @@ var EditDataDialog = function(ui, cell) var portsInput = document.createElement('input'); portsInput.setAttribute('type', 'text'); portsInput.placeholder = '8080,8443,...' + portsInput.value = getCurrentValue('ports') + portsInput.style.fontSize = '13px' portsInput.style.boxSizing = 'border-box'; portsInput.style.marginLeft = '2px'; portsInput.style.width = '100%';