Fix typos
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import PersistantStorage from './PersistantStorage'
|
import PersistentStorage from './PersistentStorage'
|
||||||
import SentimentDissatisfied from '@material-ui/icons/SentimentDissatisfied'
|
import SentimentDissatisfied from '@material-ui/icons/SentimentDissatisfied'
|
||||||
import Warning from '@material-ui/icons/Warning'
|
import Warning from '@material-ui/icons/Warning'
|
||||||
import { electronRendererTelementry } from 'electron-telemetry'
|
import { electronRendererTelementry } from 'electron-telemetry'
|
||||||
@@ -40,7 +40,7 @@ class ErrorBoundary extends React.Component<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private clearStorage = () => {
|
private clearStorage = () => {
|
||||||
PersistantStorage.clear()
|
PersistentStorage.clear()
|
||||||
window.location = window.location
|
window.location = window.location
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,20 +6,20 @@ import {
|
|||||||
makeStorageResponseEvent,
|
makeStorageResponseEvent,
|
||||||
storageLoadEvent,
|
storageLoadEvent,
|
||||||
storageClearEvent,
|
storageClearEvent,
|
||||||
makeStorageAcknoledgementEvent,
|
makeStorageAcknowledgementEvent,
|
||||||
} from '../../events/StorageEvents'
|
} from '../../events/StorageEvents'
|
||||||
|
|
||||||
export interface StorageIdentifier<Model> {
|
export interface StorageIdentifier<Model> {
|
||||||
id: string
|
id: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersistantStorage {
|
export interface PersistentStorage {
|
||||||
store<Model>(identifier: StorageIdentifier<Model>, data: Model): Promise<void>
|
store<Model>(identifier: StorageIdentifier<Model>, data: Model): Promise<void>
|
||||||
load<Model>(identifier: StorageIdentifier<Model>): Promise<Model | undefined>
|
load<Model>(identifier: StorageIdentifier<Model>): Promise<Model | undefined>
|
||||||
clear(): Promise<void>
|
clear(): Promise<void>
|
||||||
}
|
}
|
||||||
|
|
||||||
class RemoteStorage implements PersistantStorage {
|
class RemoteStorage implements PersistentStorage {
|
||||||
private timeoutCallback(event: any, callback: any, reject: any) {
|
private timeoutCallback(event: any, callback: any, reject: any) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
reject('remote storage timeout')
|
reject('remote storage timeout')
|
||||||
@@ -28,7 +28,7 @@ class RemoteStorage implements PersistantStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private expectAck(transactionId: string): Promise<void> {
|
private expectAck(transactionId: string): Promise<void> {
|
||||||
const ack = makeStorageAcknoledgementEvent(transactionId)
|
const ack = makeStorageAcknowledgementEvent(transactionId)
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
const callback = (msg: any) => {
|
const callback = (msg: any) => {
|
||||||
if (msg && msg.error) {
|
if (msg && msg.error) {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { AppState } from '../reducers'
|
import { AppState } from '../reducers'
|
||||||
import { clearLegacyConnectionOptions, loadLegacyConnectionOptions } from '../model/LegacyConnectionSettings'
|
import { clearLegacyConnectionOptions, loadLegacyConnectionOptions } from '../model/LegacyConnectionSettings'
|
||||||
import { ConnectionOptions, createEmptyConnection, makeDefaultConnections, CertificateParameters } from '../model/ConnectionOptions'
|
import { ConnectionOptions, createEmptyConnection, makeDefaultConnections, CertificateParameters } from '../model/ConnectionOptions'
|
||||||
import { default as persistantStorage, StorageIdentifier } from '../PersistantStorage'
|
import { default as persistentStorage, StorageIdentifier } from '../PersistentStorage'
|
||||||
import { Dispatch } from 'redux'
|
import { Dispatch } from 'redux'
|
||||||
import { showError } from './Global'
|
import { showError } from './Global'
|
||||||
import { remote } from 'electron'
|
import { remote } from 'electron'
|
||||||
@@ -21,7 +21,7 @@ export const loadConnectionSettings = () => async (dispatch: Dispatch<any>, getS
|
|||||||
let connections
|
let connections
|
||||||
try {
|
try {
|
||||||
await ensureConnectionsHaveBeenInitialized()
|
await ensureConnectionsHaveBeenInitialized()
|
||||||
connections = await persistantStorage.load(storedConnectionsIdentifier)
|
connections = await persistentStorage.load(storedConnectionsIdentifier)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
dispatch(showError(error))
|
dispatch(showError(error))
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,7 @@ async function openCertificate(): Promise<CertificateParameters> {
|
|||||||
export const saveConnectionSettings = () => async (dispatch: Dispatch<any>, getState: () => AppState) => {
|
export const saveConnectionSettings = () => async (dispatch: Dispatch<any>, getState: () => AppState) => {
|
||||||
try {
|
try {
|
||||||
console.log('store settings')
|
console.log('store settings')
|
||||||
await persistantStorage.store(storedConnectionsIdentifier, getState().connectionManager.connections)
|
await persistentStorage.store(storedConnectionsIdentifier, getState().connectionManager.connections)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
dispatch(showError(error))
|
dispatch(showError(error))
|
||||||
}
|
}
|
||||||
@@ -111,7 +111,7 @@ export const deleteSubscription = (subscription: string, connectionId: string):
|
|||||||
type: ActionTypes.CONNECTION_MANAGER_DELETE_SUBSCRIPTION,
|
type: ActionTypes.CONNECTION_MANAGER_DELETE_SUBSCRIPTION,
|
||||||
})
|
})
|
||||||
|
|
||||||
export const createConnection = () => (dispatch: Dispatch<any>, getState: () => AppState) => {
|
export const createConnection = () => (dispatch: Dispatch<any>) => {
|
||||||
const newConnection = createEmptyConnection()
|
const newConnection = createEmptyConnection()
|
||||||
dispatch(addConnection(newConnection))
|
dispatch(addConnection(newConnection))
|
||||||
dispatch(selectConnection(newConnection.id))
|
dispatch(selectConnection(newConnection.id))
|
||||||
@@ -155,12 +155,12 @@ export const deleteConnection = (connectionId: string) => (dispatch: Dispatch<an
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function ensureConnectionsHaveBeenInitialized() {
|
async function ensureConnectionsHaveBeenInitialized() {
|
||||||
const connections = await persistantStorage.load(storedConnectionsIdentifier)
|
const connections = await persistentStorage.load(storedConnectionsIdentifier)
|
||||||
const requiresInitialization = !connections
|
const requiresInitialization = !connections
|
||||||
if (requiresInitialization) {
|
if (requiresInitialization) {
|
||||||
const migratedConnection = loadLegacyConnectionOptions()
|
const migratedConnection = loadLegacyConnectionOptions()
|
||||||
const defaultConnections = makeDefaultConnections()
|
const defaultConnections = makeDefaultConnections()
|
||||||
persistantStorage.store(storedConnectionsIdentifier, {
|
persistentStorage.store(storedConnectionsIdentifier, {
|
||||||
...migratedConnection,
|
...migratedConnection,
|
||||||
...defaultConnections,
|
...defaultConnections,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import * as q from '../../../backend/src/Model'
|
|||||||
import { AppState } from '../reducers'
|
import { AppState } from '../reducers'
|
||||||
import { autoExpandLimitSet } from '../components/Settings'
|
import { autoExpandLimitSet } from '../components/Settings'
|
||||||
import { batchActions } from 'redux-batched-actions'
|
import { batchActions } from 'redux-batched-actions'
|
||||||
import { default as persistantStorage, StorageIdentifier } from '../PersistantStorage'
|
import { default as persistentStorage, StorageIdentifier } from '../PersistentStorage'
|
||||||
import { Dispatch } from 'redux'
|
import { Dispatch } from 'redux'
|
||||||
import { showError } from './Global'
|
import { showError } from './Global'
|
||||||
import { showTree } from './Tree'
|
import { showTree } from './Tree'
|
||||||
@@ -19,7 +19,7 @@ const settingsIdentifier: StorageIdentifier<Partial<SettingsState>> = {
|
|||||||
|
|
||||||
export const loadSettings = () => async (dispatch: Dispatch<any>, _getState: () => AppState) => {
|
export const loadSettings = () => async (dispatch: Dispatch<any>, _getState: () => AppState) => {
|
||||||
try {
|
try {
|
||||||
const settings = await persistantStorage.load(settingsIdentifier)
|
const settings = await persistentStorage.load(settingsIdentifier)
|
||||||
dispatch({
|
dispatch({
|
||||||
settings,
|
settings,
|
||||||
type: ActionTypes.SETTINGS_DID_LOAD_SETTINGS,
|
type: ActionTypes.SETTINGS_DID_LOAD_SETTINGS,
|
||||||
@@ -37,7 +37,7 @@ export const storeSettings = () => async (dispatch: Dispatch<any>, getState: ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await persistantStorage.store(settingsIdentifier, settings)
|
await persistentStorage.store(settingsIdentifier, settings)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
dispatch(showError(error))
|
dispatch(showError(error))
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ export const toggleSettingsVisibility = () => (dispatch: Dispatch<any>, _getStat
|
|||||||
dispatch(storeSettings())
|
dispatch(storeSettings())
|
||||||
}
|
}
|
||||||
|
|
||||||
export const togglehighlightTopicUpdates = () => (dispatch: Dispatch<any>, _getState: () => AppState) => {
|
export const toggleHighlightTopicUpdates = () => (dispatch: Dispatch<any>, _getState: () => AppState) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ActionTypes.SETTINGS_TOGGLE_HIGHLIGHT_ACTIVITY,
|
type: ActionTypes.SETTINGS_TOGGLE_HIGHLIGHT_ACTIVITY,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import Add from '@material-ui/icons/Add'
|
import Add from '@material-ui/icons/Add'
|
||||||
|
import ClearAdornment from '../helper/ClearAdornment'
|
||||||
import Delete from '@material-ui/icons/Delete'
|
import Delete from '@material-ui/icons/Delete'
|
||||||
import Undo from '@material-ui/icons/Undo'
|
|
||||||
import Lock from '@material-ui/icons/Lock'
|
import Lock from '@material-ui/icons/Lock'
|
||||||
|
import Undo from '@material-ui/icons/Undo'
|
||||||
import { bindActionCreators } from 'redux'
|
import { bindActionCreators } from 'redux'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { connectionManagerActions } from '../../actions'
|
import { connectionManagerActions } from '../../actions'
|
||||||
@@ -20,7 +21,6 @@ import {
|
|||||||
Tooltip,
|
Tooltip,
|
||||||
Typography,
|
Typography,
|
||||||
} from '@material-ui/core'
|
} from '@material-ui/core'
|
||||||
import ClearAdornment from '../helper/ClearAdornment';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
connection: ConnectionOptions
|
connection: ConnectionOptions
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ class Settings extends React.Component<Props, {}> {
|
|||||||
private renderHighlightTopicUpdates() {
|
private renderHighlightTopicUpdates() {
|
||||||
const { highlightTopicUpdates, actions } = this.props
|
const { highlightTopicUpdates, actions } = this.props
|
||||||
|
|
||||||
return this.renderSwitch('Show Activity', highlightTopicUpdates, actions.togglehighlightTopicUpdates, 'Topics blink when a new message arrives')
|
return this.renderSwitch('Show Activity', highlightTopicUpdates, actions.toggleHighlightTopicUpdates, 'Topics blink when a new message arrives')
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderSwitch(title: string, checked: boolean, action: any, tooltip: string) {
|
private renderSwitch(title: string, checked: boolean, action: any, tooltip: string) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
storageClearEvent,
|
storageClearEvent,
|
||||||
storageLoadEvent,
|
storageLoadEvent,
|
||||||
storageStoreEvent,
|
storageStoreEvent,
|
||||||
makeStorageAcknoledgementEvent,
|
makeStorageAcknowledgementEvent,
|
||||||
} from '../../events/StorageEvents'
|
} from '../../events/StorageEvents'
|
||||||
|
|
||||||
export default class ConfigStorage {
|
export default class ConfigStorage {
|
||||||
@@ -27,7 +27,7 @@ export default class ConfigStorage {
|
|||||||
|
|
||||||
public async init() {
|
public async init() {
|
||||||
backendEvents.subscribe(storageStoreEvent, async (event) => {
|
backendEvents.subscribe(storageStoreEvent, async (event) => {
|
||||||
const ack = makeStorageAcknoledgementEvent(event.transactionId)
|
const ack = makeStorageAcknowledgementEvent(event.transactionId)
|
||||||
try {
|
try {
|
||||||
const db = await this.getDb()
|
const db = await this.getDb()
|
||||||
await db.set(event.store, event.data).write()
|
await db.set(event.store, event.data).write()
|
||||||
@@ -57,9 +57,9 @@ export default class ConfigStorage {
|
|||||||
for (const key of keys) {
|
for (const key of keys) {
|
||||||
await db.unset(key).write()
|
await db.unset(key).write()
|
||||||
}
|
}
|
||||||
backendEvents.emit(makeStorageAcknoledgementEvent(event.transactionId), undefined)
|
backendEvents.emit(makeStorageAcknowledgementEvent(event.transactionId), undefined)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
backendEvents.emit(makeStorageAcknoledgementEvent(event.transactionId), { error, transactionId: event.transactionId })
|
backendEvents.emit(makeStorageAcknowledgementEvent(event.transactionId), { error, transactionId: event.transactionId })
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export const storageLoadEvent: Event<LoadCommand> = {
|
|||||||
topic: 'storage/load',
|
topic: 'storage/load',
|
||||||
}
|
}
|
||||||
|
|
||||||
export function makeStorageAcknoledgementEvent(transactionId: string): Event<StoreCommand> {
|
export function makeStorageAcknowledgementEvent(transactionId: string): Event<StoreCommand> {
|
||||||
return {
|
return {
|
||||||
topic: `storage/ack/${transactionId}`,
|
topic: `storage/ack/${transactionId}`,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ import * as path from 'path'
|
|||||||
import ConfigStorage from '../backend/src/ConfigStorage'
|
import ConfigStorage from '../backend/src/ConfigStorage'
|
||||||
import { app, BrowserWindow, Menu } from 'electron'
|
import { app, BrowserWindow, Menu } from 'electron'
|
||||||
import { autoUpdater } from 'electron-updater'
|
import { autoUpdater } from 'electron-updater'
|
||||||
|
import { BuildInfo } from 'electron-telemetry/build/Model'
|
||||||
import { ConnectionManager, updateNotifier } from '../backend/src/index'
|
import { ConnectionManager, updateNotifier } from '../backend/src/index'
|
||||||
import { electronTelemetryFactory } from 'electron-telemetry'
|
import { electronTelemetryFactory } from 'electron-telemetry'
|
||||||
import { menuTemplate } from './MenuTemplate'
|
import { menuTemplate } from './MenuTemplate'
|
||||||
import { UpdateInfo } from '../events'
|
import { UpdateInfo } from '../events'
|
||||||
import { BuildInfo } from 'electron-telemetry/build/Model';
|
|
||||||
const isDev = require('electron-is-dev')
|
const isDev = require('electron-is-dev')
|
||||||
|
|
||||||
if (!isDev) {
|
if (!isDev) {
|
||||||
|
|||||||
Reference in New Issue
Block a user