Skip to content

Commit

Permalink
Export Structures to file
Browse files Browse the repository at this point in the history
  • Loading branch information
ckitsanelis committed Oct 20, 2023
1 parent 85dba32 commit 74ff41a
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/viewer/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -435,18 +435,17 @@ export default class App extends React.Component<Props, State> {
this.setState(({ caseSearch }) => ({ caseSearch: !caseSearch }));
}

exportSearchResults() {
var exportData: Object[] = []
const searchIndices = this.state.rowProperties.flatMap((row, index) => row.isSearchResult ? index : [])
exportData(exportIndices: number[]) {
var exportObjects: Object[] = []
const originalColumns = this.state.logFile.headers;
for (var index of searchIndices) {
for (var index of exportIndices) {
var rowObject = {};
const row = this.state.logFile.rows[index]
for (var columnIndex = originalColumns.length-1; columnIndex >= 0; columnIndex--)
rowObject[originalColumns[columnIndex].name] = row[columnIndex];
exportData.push(rowObject)
exportObjects.push(rowObject)
}
this.vscode.postMessage({ type: "exportData", data: exportData });
this.vscode.postMessage({ type: "exportData", data: exportObjects });
}

render() {
Expand Down Expand Up @@ -479,16 +478,27 @@ export default class App extends React.Component<Props, State> {
>
<div style={{ display: "flex" }}>
<VSCodeButton
style={{ marginLeft: "5px", height: "25px", width: "150px" }}
style={{ marginLeft: "5px", height: "25px", width: "125px" }}
onClick={() => this.setState({ showSelectDialog: true })}
>
Choose Columns
</VSCodeButton>
<VSCodeButton
style={{ marginLeft: "5px", height: "25px", width: "150px" }}
onClick={() => this.exportSearchResults()}
style={{ marginLeft: "5px", height: "25px", width: "110px" }}
onClick={() => {
const exportIndices = this.state.rowProperties.flatMap((row, index) => row.isSearchResult ? index : []);
this.exportData(exportIndices);}
}
>
Export Search
</VSCodeButton>
<VSCodeButton
style={{ marginLeft: "5px", height: "25px", width: "110px" }}
onClick={() => {
this.exportData(this.state.structureMatchesLogRows);}
}
>
Export
Export Struct
</VSCodeButton>
</div>
<div style={{ flex: 1, display: "flex", justifyContent: "end" }}>
Expand Down

0 comments on commit 74ff41a

Please sign in to comment.