quickfix to display current values of each box in component's setting

This commit is contained in:
pb 2024-07-01 16:31:03 +02:00
parent 765ef6234e
commit 11d99fa821

View File

@ -1638,6 +1638,11 @@ var EditDataDialog = function(ui, cell)
/** /**
* Constructs a new settings dialog. * 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 EditSettingsDialog = function(ui, cell)
{ {
var div = document.createElement('div'); var div = document.createElement('div');
@ -1645,6 +1650,10 @@ var EditDataDialog = function(ui, cell)
var values = graph.getModel().getValue(cell); var values = graph.getModel().getValue(cell);
var getCurrentValue = function(labelName) {
return values.getAttribute(labelName)
}
// Converts the value to an XML node // Converts the value to an XML node
if (!mxUtils.isNode(values)) if (!mxUtils.isNode(values))
{ {
@ -1694,8 +1703,9 @@ var EditDataDialog = function(ui, cell)
var coreLabel = document.createTextNode(mxResources.get('core')); var coreLabel = document.createTextNode(mxResources.get('core'));
var coreInput = document.createElement('input'); var coreInput = document.createElement('input');
coreInput.value = "Test value" coreInput.value = getCurrentValue('core')
coreInput.setAttribute('type', 'text'); coreInput.setAttribute('type', 'text');
coreInput.style.fontSize = '13px'
coreInput.style.boxSizing = 'border-box'; coreInput.style.boxSizing = 'border-box';
coreInput.style.marginLeft = '2px'; coreInput.style.marginLeft = '2px';
coreInput.style.width = '20%'; coreInput.style.width = '20%';
@ -1707,6 +1717,8 @@ var EditDataDialog = function(ui, cell)
var ramLabel = document.createTextNode(mxResources.get('ram')); var ramLabel = document.createTextNode(mxResources.get('ram'));
var ramInput = document.createElement('input'); var ramInput = document.createElement('input');
ramInput.setAttribute('type', 'text'); ramInput.setAttribute('type', 'text');
ramInput.value = getCurrentValue('ram')
ramInput.style.fontSize = '13px'
ramInput.style.boxSizing = 'border-box'; ramInput.style.boxSizing = 'border-box';
ramInput.style.marginLeft = '2px'; ramInput.style.marginLeft = '2px';
ramInput.style.width = '20%'; ramInput.style.width = '20%';
@ -1719,6 +1731,8 @@ var EditDataDialog = function(ui, cell)
var durationInput = document.createElement('input'); var durationInput = document.createElement('input');
durationInput.setAttribute('type', 'text'); durationInput.setAttribute('type', 'text');
durationInput.placeholder = 'in seconds' durationInput.placeholder = 'in seconds'
durationInput.value = getCurrentValue('estDuration')
durationInput.style.fontSize = '13px'
durationInput.style.boxSizing = 'border-box'; durationInput.style.boxSizing = 'border-box';
durationInput.style.marginLeft = '2px'; durationInput.style.marginLeft = '2px';
durationInput.style.width = '20%'; durationInput.style.width = '20%';
@ -1728,6 +1742,8 @@ var EditDataDialog = function(ui, cell)
var commandLabel = document.createTextNode(mxResources.get('command')); var commandLabel = document.createTextNode(mxResources.get('command'));
var commandInput = document.createElement('input'); var commandInput = document.createElement('input');
commandInput.setAttribute('type', 'text'); commandInput.setAttribute('type', 'text');
commandInput.value = getCurrentValue('command')
commandInput.style.fontSize = '13px'
commandInput.style.boxSizing = 'border-box'; commandInput.style.boxSizing = 'border-box';
commandInput.style.marginLeft = '2px'; commandInput.style.marginLeft = '2px';
commandInput.style.width = '100%'; commandInput.style.width = '100%';
@ -1738,6 +1754,8 @@ var EditDataDialog = function(ui, cell)
var argsInput = document.createElement('input'); var argsInput = document.createElement('input');
argsInput.setAttribute('type', 'text'); argsInput.setAttribute('type', 'text');
argsInput.placeholder = '"arg1","arg2",...' argsInput.placeholder = '"arg1","arg2",...'
argsInput.value = getCurrentValue('args')
argsInput.style.fontSize = '13px'
argsInput.style.boxSizing = 'border-box'; argsInput.style.boxSizing = 'border-box';
argsInput.style.marginLeft = '2px'; argsInput.style.marginLeft = '2px';
argsInput.style.width = '100%'; argsInput.style.width = '100%';
@ -1748,6 +1766,9 @@ var EditDataDialog = function(ui, cell)
var envInput = document.createElement('input'); var envInput = document.createElement('input');
envInput.setAttribute('type', 'text'); envInput.setAttribute('type', 'text');
envInput.placeholder = '"env1"="value1","env2"="value2",...' 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.boxSizing = 'border-box';
envInput.style.marginLeft = '2px'; envInput.style.marginLeft = '2px';
envInput.style.width = '100%'; envInput.style.width = '100%';
@ -1758,6 +1779,8 @@ var EditDataDialog = function(ui, cell)
var portsInput = document.createElement('input'); var portsInput = document.createElement('input');
portsInput.setAttribute('type', 'text'); portsInput.setAttribute('type', 'text');
portsInput.placeholder = '8080,8443,...' portsInput.placeholder = '8080,8443,...'
portsInput.value = getCurrentValue('ports')
portsInput.style.fontSize = '13px'
portsInput.style.boxSizing = 'border-box'; portsInput.style.boxSizing = 'border-box';
portsInput.style.marginLeft = '2px'; portsInput.style.marginLeft = '2px';
portsInput.style.width = '100%'; portsInput.style.width = '100%';