Fix code-style
This commit is contained in:
@@ -57,7 +57,7 @@ async function openCertificate(): Promise<CertificateParameters> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
remote.dialog.showOpenDialog({ properties: ['openFile'], securityScopedBookmarks: true }, (filePaths?: string[]) => {
|
remote.dialog.showOpenDialog({ properties: ['openFile'], securityScopedBookmarks: true }, (filePaths?: Array<string>) => {
|
||||||
const selectedFile = filePaths && filePaths[0]
|
const selectedFile = filePaths && filePaths[0]
|
||||||
if (!selectedFile) {
|
if (!selectedFile) {
|
||||||
reject(rejectReasons.noCertificateSelected)
|
reject(rejectReasons.noCertificateSelected)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { AppState } from '../reducers'
|
|||||||
import { batchActions } from 'redux-batched-actions'
|
import { batchActions } from 'redux-batched-actions'
|
||||||
import { setTopic } from './Publish'
|
import { setTopic } from './Publish'
|
||||||
import { TopicViewModel } from '../model/TopicViewModel'
|
import { TopicViewModel } from '../model/TopicViewModel'
|
||||||
import { globalActions } from '.';
|
import { globalActions } from '.'
|
||||||
const debounce = require('lodash.debounce')
|
const debounce = require('lodash.debounce')
|
||||||
|
|
||||||
export const selectTopic = (topic: q.TreeNode<TopicViewModel>) => (dispatch: Dispatch<any>, getState: () => AppState) => {
|
export const selectTopic = (topic: q.TreeNode<TopicViewModel>) => (dispatch: Dispatch<any>, getState: () => AppState) => {
|
||||||
@@ -80,5 +80,4 @@ export const togglePause = (tree?: q.Tree<TopicViewModel>) => (dispatch: Dispatc
|
|||||||
type: paused ? ActionTypes.TREE_RESUME_UPDATES : ActionTypes.TREE_PAUSE_UPDATES,
|
type: paused ? ActionTypes.TREE_RESUME_UPDATES : ActionTypes.TREE_PAUSE_UPDATES,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import Key from './Key'
|
|||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
message?: string
|
message?: string
|
||||||
keys: string[]
|
keys: Array<string>
|
||||||
location: string
|
location: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ class Demo extends React.Component<{classes: any}, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public componentDidMount() {
|
public componentDidMount() {
|
||||||
(window as any).demo.showMessage = (message: string, location: string, duration: number, keys: string[] = []) => {
|
(window as any).demo.showMessage = (message: string, location: string, duration: number, keys: Array<string> = []) => {
|
||||||
this.clearTimer()
|
this.clearTimer()
|
||||||
this.setState({ message, location, keys })
|
this.setState({ message, location, keys })
|
||||||
this.timer = setTimeout(() => this.setState({ message: undefined }), duration)
|
this.timer = setTimeout(() => this.setState({ message: undefined }), duration)
|
||||||
@@ -59,7 +59,7 @@ class Demo extends React.Component<{classes: any}, State> {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
let keys: any[] = []
|
let keys: Array<any> = []
|
||||||
if (this.state.keys.length > 0) {
|
if (this.state.keys.length > 0) {
|
||||||
keys = this.state.keys.map(key => [<Key key={key} keyboardKey={key} />])
|
keys = this.state.keys.map(key => [<Key key={key} keyboardKey={key} />])
|
||||||
.reduce((prev, current) => {
|
.reduce((prev, current) => {
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ const mapDispatchToProps = (dispatch: any) => {
|
|||||||
actions: {
|
actions: {
|
||||||
settings: bindActionCreators(settingsActions, dispatch),
|
settings: bindActionCreators(settingsActions, dispatch),
|
||||||
global: bindActionCreators(globalActions, dispatch),
|
global: bindActionCreators(globalActions, dispatch),
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class CodeDiff extends React.Component<Props, {}> {
|
|||||||
super(props)
|
super(props)
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderChangeAmount(changes: Diff.Change[]) {
|
private renderChangeAmount(changes: Array<Diff.Change>) {
|
||||||
const additions = changes.map(change => (change.added === true) ? (change.count || 0) : 0).reduce((a, b) => a + b)
|
const additions = changes.map(change => (change.added === true) ? (change.count || 0) : 0).reduce((a, b) => a + b)
|
||||||
const deletions = changes.map(change => (change.removed === true) ? (change.count || 0) : 0).reduce((a, b) => a + b)
|
const deletions = changes.map(change => (change.removed === true) ? (change.count || 0) : 0).reduce((a, b) => a + b)
|
||||||
if (additions === 0 && deletions === 0) {
|
if (additions === 0 && deletions === 0) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ interface HistoryItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
items: HistoryItem[]
|
items: Array<HistoryItem>
|
||||||
onClick?: (index: number, element: EventTarget) => void
|
onClick?: (index: number, element: EventTarget) => void
|
||||||
classes: any
|
classes: any
|
||||||
contentTypeIndicator?: JSX.Element
|
contentTypeIndicator?: JSX.Element
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import {
|
|||||||
withTheme,
|
withTheme,
|
||||||
} from '@material-ui/core'
|
} from '@material-ui/core'
|
||||||
|
|
||||||
// tslint:disable-next-line
|
|
||||||
import { default as AceEditor } from 'react-ace'
|
import { default as AceEditor } from 'react-ace'
|
||||||
import { AppState } from '../../../reducers'
|
import { AppState } from '../../../reducers'
|
||||||
import History from '../History'
|
import History from '../History'
|
||||||
@@ -52,7 +51,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
history: Message[]
|
history: Array<Message>
|
||||||
}
|
}
|
||||||
|
|
||||||
class Publish extends React.Component<Props, State> {
|
class Publish extends React.Component<Props, State> {
|
||||||
@@ -97,7 +96,7 @@ class Publish extends React.Component<Props, State> {
|
|||||||
// Remove duplicates
|
// Remove duplicates
|
||||||
let filteredHistory = this.state.history.filter(e => e.payload !== payload || e.topic !== topic)
|
let filteredHistory = this.state.history.filter(e => e.payload !== payload || e.topic !== topic)
|
||||||
filteredHistory = filteredHistory.slice(-7)
|
filteredHistory = filteredHistory.slice(-7)
|
||||||
const history: Message[] = [...filteredHistory, { topic, payload, sent: new Date() }]
|
const history: Array<Message> = [...filteredHistory, { topic, payload, sent: new Date() }]
|
||||||
this.setState({ history })
|
this.setState({ history })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ const styles: StyleRulesCallback<string> = (theme: Theme) => {
|
|||||||
},
|
},
|
||||||
toggleButton: {
|
toggleButton: {
|
||||||
height: '36px',
|
height: '36px',
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,16 @@
|
|||||||
|
import * as compareVersions from 'compare-versions'
|
||||||
|
import * as electron from 'electron'
|
||||||
|
import * as os from 'os'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
|
import axios from 'axios'
|
||||||
|
import Close from '@material-ui/icons/Close'
|
||||||
|
import CloudDownload from '@material-ui/icons/CloudDownload'
|
||||||
|
import { AppState } from '../reducers'
|
||||||
|
import { bindActionCreators } from 'redux'
|
||||||
|
import { connect } from 'react-redux'
|
||||||
|
import { green } from '@material-ui/core/colors'
|
||||||
|
import { Theme, withStyles } from '@material-ui/core/styles'
|
||||||
|
import { updateNotifierActions } from '../actions'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
@@ -9,19 +21,6 @@ import {
|
|||||||
SnackbarContent,
|
SnackbarContent,
|
||||||
Typography,
|
Typography,
|
||||||
} from '@material-ui/core'
|
} from '@material-ui/core'
|
||||||
import { Theme, withStyles } from '@material-ui/core/styles'
|
|
||||||
import { green } from '@material-ui/core/colors'
|
|
||||||
|
|
||||||
import { AppState } from '../reducers'
|
|
||||||
import Close from '@material-ui/icons/Close'
|
|
||||||
import CloudDownload from '@material-ui/icons/CloudDownload'
|
|
||||||
import { bindActionCreators } from 'redux'
|
|
||||||
import { connect } from 'react-redux'
|
|
||||||
import { updateNotifierActions } from '../actions'
|
|
||||||
import axios from 'axios'
|
|
||||||
import * as compareVersions from 'compare-versions'
|
|
||||||
import * as electron from 'electron'
|
|
||||||
import * as os from 'os'
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
showUpdateNotification: boolean
|
showUpdateNotification: boolean
|
||||||
@@ -32,7 +31,7 @@ interface Props {
|
|||||||
|
|
||||||
interface GithubRelease {
|
interface GithubRelease {
|
||||||
url: string,
|
url: string,
|
||||||
assets?: GithubAsset[]
|
assets?: Array<GithubAsset>
|
||||||
published_at: string // "2019-01-25T20:14:39Z"
|
published_at: string // "2019-01-25T20:14:39Z"
|
||||||
body_html: string
|
body_html: string
|
||||||
body: string
|
body: string
|
||||||
@@ -50,7 +49,7 @@ interface GithubAsset {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
newerVersions: GithubRelease[]
|
newerVersions: Array<GithubRelease>
|
||||||
}
|
}
|
||||||
|
|
||||||
class UpdateNotifier extends React.Component<Props, State> {
|
class UpdateNotifier extends React.Component<Props, State> {
|
||||||
@@ -78,14 +77,14 @@ class UpdateNotifier extends React.Component<Props, State> {
|
|||||||
return ownVersionIsBeta || !release.prerelease
|
return ownVersionIsBeta || !release.prerelease
|
||||||
}
|
}
|
||||||
|
|
||||||
private async fetchReleases(): Promise<GithubRelease[]> {
|
private async fetchReleases(): Promise<Array<GithubRelease>> {
|
||||||
const res = await axios.get('https://api.github.com/repos/thomasnordquist/mqtt-explorer/releases', {
|
const res = await axios.get('https://api.github.com/repos/thomasnordquist/mqtt-explorer/releases', {
|
||||||
headers: {
|
headers: {
|
||||||
accept: 'application/vnd.github.v3.full+json',
|
accept: 'application/vnd.github.v3.full+json',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
return res.data as GithubRelease[]
|
return res.data as Array<GithubRelease>
|
||||||
}
|
}
|
||||||
|
|
||||||
private onCloseNotification = (event: React.SyntheticEvent<any>, reason: string) => {
|
private onCloseNotification = (event: React.SyntheticEvent<any>, reason: string) => {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export interface ConnectionOptions {
|
|||||||
certValidation: boolean
|
certValidation: boolean
|
||||||
selfSignedCertificate?: CertificateParameters
|
selfSignedCertificate?: CertificateParameters
|
||||||
clientId?: string
|
clientId?: string
|
||||||
subscriptions: string[]
|
subscriptions: Array<string>
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toMqttConnection(options: ConnectionOptions): MqttOptions | undefined {
|
export function toMqttConnection(options: ConnectionOptions): MqttOptions | undefined {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { createMuiTheme } from "@material-ui/core";
|
import { createMuiTheme } from '@material-ui/core'
|
||||||
import { amber } from "@material-ui/core/colors";
|
import { amber } from '@material-ui/core/colors'
|
||||||
|
|
||||||
const baseTheme = {
|
const baseTheme = {
|
||||||
typography: {
|
typography: {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export interface MqttOptions {
|
|||||||
tls: boolean
|
tls: boolean
|
||||||
certValidation: boolean
|
certValidation: boolean
|
||||||
clientId?: string
|
clientId?: string
|
||||||
subscriptions: string[]
|
subscriptions: Array<string>
|
||||||
certificateAuthority?: string
|
certificateAuthority?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { MqttMessage } from '../../../events'
|
import { MqttMessage } from '../../../events'
|
||||||
|
|
||||||
export class ChangeBuffer {
|
export class ChangeBuffer {
|
||||||
private buffer: MqttMessage[] = []
|
private buffer: Array<MqttMessage> = []
|
||||||
private size = 0
|
private size = 0
|
||||||
private maxSize = 100_000_000 // ~100MB
|
private maxSize = 100_000_000 // ~100MB
|
||||||
public length = 0
|
public length = 0
|
||||||
@@ -27,7 +27,7 @@ export class ChangeBuffer {
|
|||||||
return this.size / this.maxSize
|
return this.size / this.maxSize
|
||||||
}
|
}
|
||||||
|
|
||||||
public popAll(): MqttMessage[] {
|
public popAll(): Array<MqttMessage> {
|
||||||
const tmpBuffer = this.buffer
|
const tmpBuffer = this.buffer
|
||||||
this.buffer = []
|
this.buffer = []
|
||||||
this.size = 0
|
this.size = 0
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export class RingBuffer<T extends Lengthwise> {
|
|||||||
private capacity: number
|
private capacity: number
|
||||||
private maxItems: number
|
private maxItems: number
|
||||||
private usage: number = 0
|
private usage: number = 0
|
||||||
private items: T[] = []
|
private items: Array<T> = []
|
||||||
private start: number = 0
|
private start: number = 0
|
||||||
private end: number = 0
|
private end: number = 0
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export class TreeNode<ViewModel> {
|
|||||||
previous.removeEdge(this.sourceEdge)
|
previous.removeEdge(this.sourceEdge)
|
||||||
}
|
}
|
||||||
|
|
||||||
private findChild(edges: string[]): TreeNode<ViewModel> | undefined {
|
private findChild(edges: Array<string>): TreeNode<ViewModel> | undefined {
|
||||||
if (edges.length === 0) {
|
if (edges.length === 0) {
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ interface HasLength {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export abstract class TreeNodeFactory {
|
export abstract class TreeNodeFactory {
|
||||||
public static insertNodeAtPosition<ViewModel>(edgeNames: string[], node: TreeNode<ViewModel>) {
|
public static insertNodeAtPosition<ViewModel>(edgeNames: Array<string>, node: TreeNode<ViewModel>) {
|
||||||
let currentNode: TreeNode<ViewModel> = new Tree()
|
let currentNode: TreeNode<ViewModel> = new Tree()
|
||||||
let edge
|
let edge
|
||||||
for (const edgeName of edgeNames) {
|
for (const edgeName of edgeNames) {
|
||||||
@@ -19,7 +19,7 @@ export abstract class TreeNodeFactory {
|
|||||||
node.sourceEdge!.target = node
|
node.sourceEdge!.target = node
|
||||||
}
|
}
|
||||||
|
|
||||||
public static fromEdgesAndValue<ViewModel>(edgeNames: string[], value?: Base64Message | null): TreeNode<ViewModel> {
|
public static fromEdgesAndValue<ViewModel>(edgeNames: Array<string>, value?: Base64Message | null): TreeNode<ViewModel> {
|
||||||
const node = new TreeNode<ViewModel>()
|
const node = new TreeNode<ViewModel>()
|
||||||
node.setMessage({
|
node.setMessage({
|
||||||
value: value || undefined,
|
value: value || undefined,
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class IpcMainEventBus implements EventBusInterface {
|
|||||||
|
|
||||||
class IpcRendererEventBus implements EventBusInterface {
|
class IpcRendererEventBus implements EventBusInterface {
|
||||||
private ipc: IpcRenderer
|
private ipc: IpcRenderer
|
||||||
private callbacks: CallbackStore[] = []
|
private callbacks: Array<CallbackStore> = []
|
||||||
|
|
||||||
constructor(ipc: IpcRenderer) {
|
constructor(ipc: IpcRenderer) {
|
||||||
this.ipc = ipc
|
this.ipc = ipc
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ interface CallbackStore {
|
|||||||
export class EventDispatcher<Message, Dispatcher> {
|
export class EventDispatcher<Message, Dispatcher> {
|
||||||
private emitter = new EventEmitter()
|
private emitter = new EventEmitter()
|
||||||
private dispatcher: Dispatcher
|
private dispatcher: Dispatcher
|
||||||
private callbacks: CallbackStore[] = []
|
private callbacks: Array<CallbackStore> = []
|
||||||
|
|
||||||
constructor(dispatcher: Dispatcher) {
|
constructor(dispatcher: Dispatcher) {
|
||||||
this.dispatcher = dispatcher
|
this.dispatcher = dispatcher
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ export interface BuildInfo {
|
|||||||
package: Packages
|
package: Packages
|
||||||
}
|
}
|
||||||
|
|
||||||
type Packages = 'portable' | 'nsis' | 'appx' | 'AppImage' | 'snap' | 'dmg' | 'zip' | 'mas' | 'mas-dev'
|
type Packages = 'portable' | 'nsis' | 'appx' | 'AppImage' | 'snap' | 'dmg' | 'zip' | 'mas' | 'mas-dev' | 'deb'
|
||||||
|
|
||||||
async function buildWithOptions(options: builder.CliOptions, buildInfo: BuildInfo) {
|
async function buildWithOptions(options: builder.CliOptions, buildInfo: BuildInfo) {
|
||||||
fs.writeFileSync(path.join(options.projectDir!, 'buildOptions.json'), JSON.stringify(buildInfo))
|
fs.writeFileSync(path.join(options.projectDir!, 'buildOptions.json'), JSON.stringify(buildInfo))
|
||||||
|
|||||||
Reference in New Issue
Block a user