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