mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-04-11 14:19:38 +00:00
Add "Tools" tab with chart issue scanner
This commit is contained in:
77
src-angular/app/components/tools/tools.component.ts
Normal file
77
src-angular/app/components/tools/tools.component.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
import { Component, ElementRef, NgZone, ViewChild } from '@angular/core'
|
||||
|
||||
import { SettingsService } from 'src-angular/app/core/services/settings.service'
|
||||
|
||||
@Component({
|
||||
selector: 'app-tools',
|
||||
templateUrl: './tools.component.html',
|
||||
})
|
||||
export class ToolsComponent {
|
||||
@ViewChild('themeDropdown', { static: true }) themeDropdown: ElementRef
|
||||
@ViewChild('scanErrorModal') scanErrorModal: ElementRef<HTMLDialogElement>
|
||||
|
||||
public scanning = false
|
||||
public buttonText = 'Scan for issues'
|
||||
public scanErrorText = ''
|
||||
|
||||
constructor(
|
||||
zone: NgZone,
|
||||
public settingsService: SettingsService,
|
||||
) {
|
||||
window.electron.on.updateIssueScan(({ status, message }) => zone.run(() => {
|
||||
if (status === 'progress') {
|
||||
this.buttonText = message
|
||||
} else if (status === 'error') {
|
||||
this.scanning = false
|
||||
this.scanErrorText = message
|
||||
this.scanErrorModal.nativeElement.showModal()
|
||||
} else if (status === 'done') {
|
||||
this.scanning = false
|
||||
this.buttonText = 'Complete! (click to scan again)'
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
openIssueScanDirectory() {
|
||||
if (this.settingsService.issueScanDirectory) {
|
||||
window.electron.emit.showFolder(this.settingsService.issueScanDirectory)
|
||||
}
|
||||
}
|
||||
|
||||
async getIssueScanDirectory() {
|
||||
const result = await window.electron.invoke.showOpenDialog({
|
||||
title: 'Choose issue scan folder',
|
||||
defaultPath: this.settingsService.issueScanDirectory || '',
|
||||
properties: ['openDirectory'],
|
||||
})
|
||||
|
||||
if (result.canceled === false) {
|
||||
this.settingsService.issueScanDirectory = result.filePaths[0]
|
||||
}
|
||||
}
|
||||
|
||||
openSpreadsheetOutputDirectory() {
|
||||
if (this.settingsService.spreadsheetOutputDirectory) {
|
||||
window.electron.emit.showFolder(this.settingsService.spreadsheetOutputDirectory)
|
||||
}
|
||||
}
|
||||
|
||||
async getSpreadsheetOutputDirectory() {
|
||||
const result = await window.electron.invoke.showOpenDialog({
|
||||
title: 'Choose spreadsheet output folder',
|
||||
defaultPath: this.settingsService.spreadsheetOutputDirectory || '',
|
||||
properties: ['openDirectory'],
|
||||
})
|
||||
|
||||
if (result.canceled === false) {
|
||||
this.settingsService.spreadsheetOutputDirectory = result.filePaths[0]
|
||||
}
|
||||
}
|
||||
|
||||
async scanIssues() {
|
||||
if (this.settingsService.issueScanDirectory && this.settingsService.spreadsheetOutputDirectory) {
|
||||
this.scanning = true
|
||||
window.electron.emit.scanIssues()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user