Skip to content

Commit

Permalink
Launch Wizard - Allow copying of configs
Browse files Browse the repository at this point in the history
Closes #670
  • Loading branch information
shanedell committed Dec 5, 2023
1 parent 8ba1714 commit 5868292
Show file tree
Hide file tree
Showing 4 changed files with 273 additions and 73 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:

jobs:
build-test-package:
name: 'Build, Test, and Package (OS: ${{ matrix.os }}, Node: ${{ matrix.node }}, Java: ${{ matrix_java_version }}, VS Code: ${{ matrix.vscode }} )'
name: 'Build, Test, and Package (OS: ${{ matrix.os }}, Node: ${{ matrix.node }}, Java: ${{ matrix.java_version }}, VS Code: ${{ matrix.vscode }} )'
strategy:
matrix:
os: [ macos-11, ubuntu-20.04, windows-2019, macos-latest, ubuntu-latest, windows-latest ]
Expand Down
211 changes: 152 additions & 59 deletions src/launchWizard/launchWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,88 @@ function getConfigIndex() {
if (configSelectedValue === 'New Config') {
document.getElementById('nameLabel').style =
'margin-top: 10px; visibility: visible;'
document.getElementById('copyLaunchConfigButton').style =
'visibility: hidden;'
} else {
document.getElementById('nameLabel').style = 'visibility: hidden;'
document.getElementById('copyLaunchConfigButton').style =
'visibility: visible;'
}

return configSelectedValue === 'New Config'
? -1
: configSelectionBox.selectedIndex
}

function getConfigValues() {
var configSelectionBox = document.getElementById('configSelected')
var configSelectedValue =
configSelectionBox.options[configSelectionBox.selectedIndex].value
const name =
configSelectedValue === 'New Config'
? document.getElementById('name').value
: configSelectedValue
const data = document.getElementById('data').value
const debugServer = parseInt(document.getElementById('debugServer').value)
const infosetFormat = document.getElementById('infosetFormat').value
const infosetOutputFilePath = document.getElementById(
'infosetOutputFilePath'
).value
const infosetOutputType = document.getElementById('infosetOutputType').value
const tdmlAction = document.getElementById('tdmlAction').value
const tdmlName = document.getElementById('tdmlName').value
const tdmlDescription = document.getElementById('tdmlDescription').value
const tdmlPath = document.getElementById('tdmlPath').value
const openHexView = document.getElementById('openHexView').checked
const openInfosetDiffView = document.getElementById(
'openInfosetDiffView'
).checked
const openInfosetView = document.getElementById('openInfosetView').checked
const program = document.getElementById('program').value
const stopOnEntry = document.getElementById('stopOnEntry').checked
const trace = document.getElementById('trace').checked
const useExistingServer = document.getElementById('useExistingServer').checked
const dataEditorPort = parseInt(
document.getElementById('dataEditorPort').value
)
const dataEditorLogFile = document.getElementById('dataEditorLogFile').value
const dataEditorLogLevel = document.getElementById('dataEditorLogLevel').value
const dfdlDebuggerLogFile = document.getElementById(
'dfdlDebuggerLogFile'
).value
const dfdlDebuggerLogLevel = document.getElementById(
'dfdlDebuggerLogLevel'
).value

const daffodilDebugClasspath = getDaffodilDebugClasspathString()

return {
name,
data,
debugServer,
infosetFormat,
infosetOutputFilePath,
infosetOutputType,
tdmlAction,
tdmlName,
tdmlDescription,
tdmlPath,
openHexView,
openInfosetDiffView,
openInfosetView,
program,
stopOnEntry,
trace,
useExistingServer,
dataEditorPort,
dataEditorLogFile,
dataEditorLogLevel,
dfdlDebuggerLogFile,
dfdlDebuggerLogLevel,
daffodilDebugClasspath,
}
}

// Function get daffodil debug classpath string
function getDaffodilDebugClasspathString() {
let childNodes = document.getElementById(
Expand Down Expand Up @@ -188,83 +261,48 @@ function save() {
configSelectionBox.options[configSelectionBox.selectedIndex].value
var updateOrCreate =
configSelectedValue === 'New Config' ? 'create' : 'update'
const name =
configSelectedValue === 'New Config'
? document.getElementById('name').value
: configSelectedValue
const data = document.getElementById('data').value
const debugServer = parseInt(document.getElementById('debugServer').value)
const infosetFormat = document.getElementById('infosetFormat').value
const infosetOutputFilePath = document.getElementById(
'infosetOutputFilePath'
).value
const infosetOutputType = document.getElementById('infosetOutputType').value
const tdmlAction = document.getElementById('tdmlAction').value
const tdmlName = document.getElementById('tdmlName').value
const tdmlDescription = document.getElementById('tdmlDescription').value
const tdmlPath = document.getElementById('tdmlPath').value
const openHexView = document.getElementById('openHexView').checked
const openInfosetDiffView = document.getElementById(
'openInfosetDiffView'
).checked
const openInfosetView = document.getElementById('openInfosetView').checked
const program = document.getElementById('program').value
const stopOnEntry = document.getElementById('stopOnEntry').checked
const trace = document.getElementById('trace').checked
const useExistingServer = document.getElementById('useExistingServer').checked
const dataEditorPort = parseInt(
document.getElementById('dataEditorPort').value
)
const dataEditorLogFile = document.getElementById('dataEditorLogFile').value
const dataEditorLogLevel = document.getElementById('dataEditorLogLevel').value
const dfdlDebuggerLogFile = document.getElementById(
'dfdlDebuggerLogFile'
).value
const dfdlDebuggerLogLevel = document.getElementById(
'dfdlDebuggerLogLevel'
).value

const daffodilDebugClasspath = getDaffodilDebugClasspathString()
const configValues = getConfigValues()

var obj = {
version: '0.2.0',
configurations: [
{
request: 'launch',
type: 'dfdl',
name: name,
program: program,
data: data,
debugServer: debugServer,
infosetFormat: infosetFormat,
name: configValues.name,
program: configValues.program,
data: configValues.data,
debugServer: configValues.debugServer,
infosetFormat: configValues.infosetFormat,
infosetOutput: {
type: infosetOutputType,
path: infosetOutputFilePath,
type: configValues.infosetOutputType,
path: configValues.infosetOutputFilePath,
},
tdmlConfig: {
action: tdmlAction,
name: tdmlName,
description: tdmlDescription,
path: tdmlPath,
action: configValues.tdmlAction,
name: configValues.tdmlName,
description: configValues.tdmlDescription,
path: configValues.tdmlPath,
},
trace: trace,
stopOnEntry: stopOnEntry,
useExistingServer: useExistingServer,
openHexView: openHexView,
openInfosetView: openInfosetView,
openInfosetDiffView: openInfosetDiffView,
daffodilDebugClasspath: daffodilDebugClasspath,
trace: configValues.trace,
stopOnEntry: configValues.stopOnEntry,
useExistingServer: configValues.useExistingServer,
openHexView: configValues.openHexView,
openInfosetView: configValues.openInfosetView,
openInfosetDiffView: configValues.openInfosetDiffView,
daffodilDebugClasspath: configValues.daffodilDebugClasspath,
dataEditor: {
port: dataEditorPort,
port: configValues.dataEditorPort,
logging: {
file: dataEditorLogFile,
level: dataEditorLogLevel,
file: configValues.dataEditorLogFile,
level: configValues.dataEditorLogLevel,
},
},
dfdlDebugger: {
logging: {
file: dfdlDebuggerLogFile,
level: dfdlDebuggerLogLevel,
file: configValues.dfdlDebuggerLogFile,
level: configValues.dfdlDebuggerLogLevel,
},
},
},
Expand All @@ -278,6 +316,61 @@ function save() {
})
}

// Function to copy selected config
function copyConfig() {
const configValues = getConfigValues()

var obj = {
version: '0.2.0',
configurations: [
{
request: 'launch',
type: 'dfdl',
name: `${configValues.name}`,
program: configValues.program,
data: configValues.data,
debugServer: configValues.debugServer,
infosetFormat: configValues.infosetFormat,
infosetOutput: {
type: configValues.infosetOutputType,
path: configValues.infosetOutputFilePath,
},
tdmlConfig: {
action: configValues.tdmlAction,
name: configValues.tdmlName,
description: configValues.tdmlDescription,
path: configValues.tdmlPath,
},
trace: configValues.trace,
stopOnEntry: configValues.stopOnEntry,
useExistingServer: configValues.useExistingServer,
openHexView: configValues.openHexView,
openInfosetView: configValues.openInfosetView,
openInfosetDiffView: configValues.openInfosetDiffView,
daffodilDebugClasspath: configValues.daffodilDebugClasspath,
dataEditor: {
port: configValues.dataEditorPort,
logging: {
file: configValues.dataEditorLogFile,
level: configValues.dataEditorLogLevel,
},
},
dfdlDebugger: {
logging: {
file: configValues.dfdlDebuggerLogFile,
level: configValues.dfdlDebuggerLogLevel,
},
},
},
],
}

vscode.postMessage({
command: 'copyConfig',
data: JSON.stringify(obj, null, 4),
})
}

// Function to update config values in the webview
async function updateConfigValues(config) {
document.getElementById('name').value = config.name
Expand Down
Loading

0 comments on commit 5868292

Please sign in to comment.