adedoyinNteligen commented on code in PR #1698:
URL: https://github.com/apache/daffodil-vscode/pull/1698#discussion_r3266702362


##########
src/launchWizard/script.js:
##########
@@ -346,6 +353,105 @@ function save() {
     updateOrCreate: updateOrCreate,
   })
 }
+// Function for adding row to tunables table
+function addTunableRow() {
+  const tableBody = document.getElementById('tunablesTableBody')
+
+  const row = document.createElement('tr')
+
+  row.innerHTML = `
+    <td><input class="file-input" /></td>
+    <td><input class="file-input" /></td>
+    <td><button onclick="this.closest('tr').remove()">X</button></td>
+  `
+
+  tableBody.appendChild(row)
+}
+
+function getTunablesFromTable() {
+  const rows = document.querySelectorAll('#tunablesTableBody tr')
+  const tunables = {}
+
+  rows.forEach((row) => {
+    const key = row.children[0].querySelector('input')?.value?.trim()
+    const value = row.children[1].querySelector('input')?.value
+
+    if (!key) return
+
+    tunables[key] = value
+  })
+
+  return tunables
+}
+
+// function to pull tunables from config and render them in the tunables 
table, if there are any
+function renderTunables(tunables = {}) {
+  const tableBody = document.getElementById('tunablesTableBody')
+  // clear existing UI
+  tableBody.innerHTML = ''
+
+  Object.entries(tunables).forEach(([key, value]) => {
+    const row = document.createElement('tr')
+
+    row.innerHTML = `
+      <td><input class="file-input" value="${key}" /></td>
+      <td><input class="file-input" value="${value}" /></td>
+      <td><button onclick="this.closest('tr').remove()">X</button></td>
+    `
+
+    tableBody.appendChild(row)
+  })
+}
+
+// Function for adding row to variables table
+function addVariableRow() {
+  const tableBody = document.getElementById('variablesTableBody')
+
+  const row = document.createElement('tr')
+
+  row.innerHTML = `
+    <td><input class="file-input" /></td>
+    <td><input class="file-input" /></td>
+    <td><button onclick="this.closest('tr').remove()">X</button></td>
+  `
+
+  tableBody.appendChild(row)
+}
+
+function getVariablesFromTable() {
+  const rows = document.querySelectorAll('#variablesTableBody tr')
+  const variables = {}
+
+  rows.forEach((row) => {
+    const key = row.children[0].querySelector('input')?.value?.trim()
+    const value = row.children[1].querySelector('input')?.value
+
+    if (!key) return
+
+    variables[key] = value
+  })
+
+  return variables
+}
+
+// function to pull tunables from config and render them in the tunables 
table, if there are any

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to