Skip to content

Commit

Permalink
Jump to newly selected method
Browse files Browse the repository at this point in the history
  • Loading branch information
qtc-de committed Jul 25, 2024
1 parent fb3acd7 commit 464c035
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 14 deletions.
38 changes: 34 additions & 4 deletions frontend/src/components/MethodPane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
setup()
{
const store = processStore();
const { selectedProcess, selectedInterface } = storeToRefs(store);
return { selectedInterface, selectedProcess, store }
const { selectedProcess, selectedInterface, tabs, selectedTab } = storeToRefs(store);
return { tabs, selectedTab, selectedInterface, selectedProcess, store }
},
methods:
Expand All @@ -38,8 +38,13 @@
this.editMethod = null;
let method = this.selectedInterface.methods[index];
this.store.addMethodName(methodName, method.addr, this.selectedInterface.location)
if (method.origName === undefined)
{
method.origName = method.name;
}
method.name = methodName;
},
Expand All @@ -50,6 +55,31 @@
this.store.addMethodNotes(notes, index, this.selectedInterface.id)
this.selectedInterface.methods[index].notes = notes;
},
jumpDecompiled(method)
{
for (const tab of this.tabs)
{
if (tab.origName === this.selectedInterface.id)
{
this.selectedTab = tab.name;
const tabComponent = document.getElementById(tab.origName);
if(tabComponent != null)
{
const tabElement = tabComponent.children[0];
for (const child of tabElement.children)
{
if (child.textContent.includes(` ${method.name}(`) || child.textContent.includes(` ${method.origName}(`))
{
child.scrollIntoView();
}
}
}
}
}
}
}
}
Expand All @@ -67,7 +97,7 @@
<th>Notes</th>
<th>Format Address</th>
</tr>
<tr style="cursor: pointer" v-if="selectedInterface" v-for="(method, index) in selectedInterface.methods" @click="selectedMethod = method"
<tr style="cursor: pointer" v-if="selectedInterface" v-for="(method, index) in selectedInterface.methods" @click="selectedMethod = method; jumpDecompiled(method)"
:class="{ Selected: selectedMethod == method }">
<td>{{ index }}</td>
<td v-if="selectedInterface && editMethod != method.addr" @dblclick="enableEditing(method.addr, 'Method', method.name)">{{ method.name }}</td>
Expand Down
11 changes: 2 additions & 9 deletions frontend/src/components/ProcessPane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
{
return {
lastTabLength: 0,
selectedTab: 'Processes',
timer: null,
editTab: null,
}
Expand All @@ -21,11 +20,11 @@
setup()
{
const store = processStore();
const { processTree, refreshTimer, tabs } = storeToRefs(store)
const { selectedTab, processTree, refreshTimer, tabs } = storeToRefs(store)
const offlineMode = (import.meta.env.VITE_OFFLINE_MODE != 0) ? true : false;
return { store, processTree, refreshTimer, tabs, offlineMode }
return { store, processTree, refreshTimer, tabs, offlineMode, selectedTab }
},
components: {
Expand Down Expand Up @@ -117,13 +116,7 @@
this.selectedTab = new_name;
}
if (tab.oldName === undefined)
{
tab.oldName = tab.name;
}
tab.name = new_name;
this.editTab = null;
},
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/stores/processStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var refreshOngoing = false;
var selectedPane = null;
var selectedProcess = null;
var selectedInterface = null;
var selectedTab = 'Processes';

var processFilter = null;
var interfaceFilter = null;
Expand All @@ -32,6 +33,7 @@ export const processStore = defineStore(
selectedInterface,
processFilter,
interfaceFilter,
selectedTab,
}),

actions:
Expand All @@ -40,7 +42,7 @@ export const processStore = defineStore(
{
for (const tab of this.tabs)
{
if (tab.name === name || tab.oldName === name)
if (tab.name === name || tab.origName === name)
{
return true;
}
Expand All @@ -65,6 +67,7 @@ export const processStore = defineStore(
'type': 'snapshot',
'snapshotId': snapshotID,
'name': name,
'origName': name,
'data': snapshot
}
);
Expand Down Expand Up @@ -130,6 +133,7 @@ export const processStore = defineStore(
'type': 'snapshot',
'snapshotId': snapshotID,
'name': name,
'origName': name,
'data': {
'processes': processes,
'idl_data': {...first.idl_data, ...second.idl_data}
Expand Down Expand Up @@ -162,6 +166,7 @@ export const processStore = defineStore(
{
'type': 'idl',
'name': uuid,
'origName': uuid,
'data': idl.code
});

Expand All @@ -182,6 +187,7 @@ export const processStore = defineStore(
{
'type': 'idl',
'name': uuid,
'origName': name,
'data': decompiled
});
});
Expand Down

0 comments on commit 464c035

Please sign in to comment.