decomp: some cleanup to the type searcher (#141)

This commit is contained in:
Tyler Wilding 2022-10-25 21:12:03 -04:00 committed by GitHub
parent f712aed976
commit 3c3fc0016f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -94,7 +94,7 @@ function getWebviewContent() {
const nameColumn = document.createElement("div");
nameColumn.className = "column column-25";
const nameField = document.createElement("sl-input");
nameField.label = "Field Type?";
nameField.label = "Field Type Name?";
nameColumn.appendChild(nameField);
const offsetColumn = document.createElement("div");
@ -110,6 +110,14 @@ function getWebviewContent() {
document.getElementById("field-filters").appendChild(row);
}
function clearFields(evt) {
document.getElementById("parent-name").value = "";
document.getElementById("type-size").value = "";
document.getElementById("method-id").value = "";
document.getElementById("field-filters").innerHTML = "";
addField();
}
window.addEventListener('message', event => {
document.getElementById("results").innerHTML = "";
const message = event.data;
@ -131,8 +139,6 @@ function getWebviewContent() {
}
}
});
// TODO - implement clear
</script>
<div class="container">
<h2 class="mt-2">General Filters</h2>
@ -165,7 +171,7 @@ function getWebviewContent() {
<div id="field-filters">
<div class="row wrap">
<div class="column column-25">
<sl-input label="Field Name?" class="field-name"></sl-input>
<sl-input label="Field Type Name?" class="field-name"></sl-input>
</div>
<div class="column column-25">
<sl-input label="Offset?" class="field-offset" type="number"></sl-input>
@ -176,7 +182,7 @@ function getWebviewContent() {
<div class="column">
<sl-button variant="primary" onclick="addField()" class="mr-1">Add Another Field</sl-button>
<sl-button variant="success" onclick="search()" class="mr-1">Search</sl-button>
<sl-button variant="warning">Clear</sl-button>
<sl-button variant="warning" onclick="clearFields()">Clear</sl-button>
</div>
</div>
<h2 class="mt-2">Results</h2>
@ -256,8 +262,10 @@ async function searchForTypes(message: any): Promise<string[]> {
offset: fieldOffset,
});
}
args.push(`--fields`);
args.push(JSON.stringify(encodedFields));
if (encodedFields.length > 0) {
args.push(`--fields`);
args.push(JSON.stringify(encodedFields));
}
}
try {
@ -286,6 +294,7 @@ async function openPanel() {
vscode.ViewColumn.One,
{
enableScripts: true,
retainContextWhenHidden: true,
}
);