Compare commits

...
10 Commits
11 changed files with 55 additions and 85 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ class Notification extends React.Component<Props, {}> {
<Snackbar
anchorOrigin={snackbarAnchor}
open={Boolean(this.props.message)}
autoHideDuration={this.props.type === 'error' ? 10000 : 3000}
autoHideDuration={this.props.type === 'error' ? 10000 : 2000}
onClose={this.props.onClose}
>
<SnackbarContent
+5 -4
View File
@@ -44,6 +44,7 @@ interface GithubAsset {
id: number
node_id: string
url: string
browser_download_url: string
name: string
label: string
}
@@ -170,7 +171,7 @@ class UpdateNotifier extends React.Component<Props, State> {
{this.renderDownloads()}
<Button
className={this.props.classes.download}
onClick={this.openGithub}
onClick={this.openHomePage}
>
Github Page
</Button>
@@ -180,8 +181,8 @@ class UpdateNotifier extends React.Component<Props, State> {
)
}
private openGithub = () => {
this.openUrl('https://github.com/thomasnordquist/MQTT-Explorer')
private openHomePage = () => {
this.openUrl('https://mqtt-explorer.com')
}
private openUrl = (url: string) => {
@@ -213,7 +214,7 @@ class UpdateNotifier extends React.Component<Props, State> {
<div>
<Button
className={this.props.classes.download}
onClick={() => this.openUrl(asset.url)}
onClick={() => this.openUrl(asset.browser_download_url)}
>
<CloudDownload />&nbsp;{asset.name}
</Button>
@@ -47,7 +47,7 @@ class ConnectionHealthIndicator extends React.Component<Props, {}> {
return (
<Tooltip title={`Connection health "${health}"`}>
<div>
<div style={{ display: 'inherit' }}>
<DeviceHubOutlined className={`${[classes[health]]} ${this.props.withBackground ? classes.icon : ''}`} />
</div>
</Tooltip>
+18 -29
View File
@@ -2,40 +2,35 @@ import * as React from 'react'
import Check from '@material-ui/icons/Check'
import CustomIconButton from './CustomIconButton'
import FileCopy from '@material-ui/icons/FileCopy'
import green from '@material-ui/core/colors/green'
import { Snackbar, SnackbarContent, Tooltip } from '@material-ui/core'
import { Theme, withStyles } from '@material-ui/core/styles'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import { globalActions } from '../../actions'
const copy = require('copy-text-to-clipboard')
interface Props {
value: string
classes: any
actions: {
global: typeof globalActions
}
}
interface State {
didCopy: boolean
snackBarOpen: boolean
}
const styles = (theme: Theme) => ({
snackbar: {
backgroundColor: green[600],
color: theme.typography.button.color,
},
})
class Copy extends React.Component<Props, State> {
constructor(props: Props) {
super(props)
this.state = { didCopy: false, snackBarOpen: false }
this.state = { didCopy: false }
}
private handleClick = (event: React.MouseEvent) => {
event.stopPropagation()
copy(this.props.value)
this.setState({ didCopy: true, snackBarOpen: true })
this.props.actions.global.showNotification('Copied to clipboard')
this.setState({ didCopy: true })
setTimeout(() => {
this.setState({ didCopy: false })
}, 1500)
@@ -53,23 +48,17 @@ class Copy extends React.Component<Props, State> {
{icon}
</CustomIconButton>
</span>
<Snackbar
anchorOrigin={{
vertical: 'bottom',
horizontal: 'left',
}}
open={this.state.snackBarOpen}
autoHideDuration={2000}
onClose={() => { this.setState({ snackBarOpen: false }) }}
>
<SnackbarContent
className={this.props.classes.snackbar}
message="Copied to clipboard"
/>
</Snackbar>
</span>
)
}
}
export default withStyles(styles)(Copy)
const mapDispatchToProps = (dispatch: any) => {
return {
actions: {
global: bindActionCreators(globalActions, dispatch),
},
}
}
export default connect(undefined, mapDispatchToProps)(Copy)
-18
View File
@@ -1,18 +1,14 @@
import { Base64Message } from './Model/Base64Message'
import { DataSource, MqttSource } from './DataSource'
import { UpdateInfo } from 'builder-util-runtime'
import {
AddMqttConnection,
EventDispatcher,
MqttMessage,
addMqttConnectionEvent,
backendEvents,
checkForUpdates,
makeConnectionMessageEvent,
makeConnectionStateEvent,
makePublishEvent,
removeConnection,
updateAvailable
} from '../../events'
export class ConnectionManager {
@@ -76,17 +72,3 @@ export class ConnectionManager {
.forEach(conenctionId => this.removeConnection(conenctionId))
}
}
class UpdateNotifier {
public onCheckUpdateRequest = new EventDispatcher<void, UpdateNotifier>()
constructor() {
backendEvents.subscribe(checkForUpdates, () => {
this.onCheckUpdateRequest.dispatch()
})
}
public notify(updateInfo: UpdateInfo) {
backendEvents.emit(updateAvailable, updateInfo)
}
}
export const updateNotifier = new UpdateNotifier()
-4
View File
@@ -28,10 +28,6 @@ export function makeConnectionStateEvent(connectionId: string): Event<DataSource
}
}
export const checkForUpdates: Event<void> = {
topic: 'app/update/check',
}
export const updateAvailable: Event<UpdateInfo> = {
topic: 'app/update/available',
}
+8 -11
View File
@@ -1,10 +1,9 @@
import { autoUpdater } from 'electron-updater'
import { BuildInfo } from 'electron-telemetry/build/Model'
import { UpdateInfo } from '../events'
import { updateNotifier } from '../backend/src/index'
export function shouldAutoUpdate(build: BuildInfo) {
return build.package !== 'portable'
return build.package !== 'portable' && build.platform !== 'mac'
}
export function handleAutoUpdate() {
@@ -12,15 +11,13 @@ export function handleAutoUpdate() {
console.log('There is an update available')
})
autoUpdater.on('error', () => {
console.log('could not update due to error')
autoUpdater.on('error', (error) => {
console.error('could not update due to error', error)
})
updateNotifier.onCheckUpdateRequest.subscribe(() => {
try {
autoUpdater.checkForUpdatesAndNotify()
} catch (error) {
console.error(error)
}
})
try {
autoUpdater.checkForUpdatesAndNotify()
} catch (error) {
console.error(error)
}
}
+6 -11
View File
@@ -56,12 +56,7 @@ async function doStuff() {
await createFakeMousePointer(browser)
// Wait for Username input to be visible
let inputField = undefined
let start = Date.now()
let maxWaitDuration = 30000
while ((!inputField || !inputField.isExisting) && ((Date.now() - start) < maxWaitDuration)) {
inputField = await browser.$(`//label[contains(text(), "Username")]/..//input`)
}
await browser.$('//label[contains(text(), "Username")]/..//input')
const scenes = new SceneBuilder()
await scenes.record('connect', async () => {
await connectTo('127.0.0.1', browser)
@@ -69,10 +64,10 @@ async function doStuff() {
})
await scenes.record('topic_updates', async () => {
await showText('Topic overview', 2000, browser, 'top')
await sleep(2000)
await showText('Indicate topic updates', 2000, browser, 'bottom')
await sleep(3000)
await showText('Topic overview', 1000, browser, 'top')
await sleep(1000)
await showText('Indicate topic updates', 1000, browser, 'middle')
await sleep(1000)
})
await scenes.record('numeric_plots', async () => {
@@ -138,7 +133,7 @@ async function doStuff() {
await scenes.record('customize_subscriptions', async () => {
await sleep(2000)
await disconnect(browser)
await showText('Customize Subscriptions', 3000, browser, 'top')
await showText('Customize Subscriptions', 1000, browser, 'top')
await showAdvancedConnectionSettings(browser)
})
+3 -1
View File
@@ -10,9 +10,11 @@ export async function showJsonFormatting(browser: Browser<void>) {
const payloadInput = await browser.$('//*[contains(@class, "ace_text-input")]')
await clickOn(editor, browser)
await browser.keys(['\uE009', 'A']) // Ctrl + A
await sleep(200)
await browser.keys(['\uE000']) // End keyboard modifier
await sleep(200)
await browser.keys(['\uE003']) // Backspace
await sleep(500)
await sleep(200)
await writeTextPayload(payloadInput, '{"action": "setState", "state": "on" }')
await sleep(300)
await clickOn(formatJsonButton, browser)
+9 -1
View File
@@ -1,4 +1,4 @@
import { clickOn, sleep, writeText, expandTopic, moveToCenterOfElement } from '../util'
import { clickOn, sleep, writeText, expandTopic, moveToCenterOfElement, showText } from '../util'
import { Browser } from 'webdriverio'
export async function showMenu(browser: Browser<void>) {
@@ -19,5 +19,13 @@ export async function showMenu(browser: Browser<void>) {
await clickOn(alphabetically, browser)
await sleep(2000)
await showText('Dark Mode', 1500, browser, 'top')
await sleep(1500)
const themeSwitch = await browser.$('//*[contains(text(), "Dark Mode")]/..//input')
await clickOn(themeSwitch, browser)
await sleep(3000)
await browser.saveScreenshot('screen_dark_mode.png')
await clickOn(themeSwitch, browser)
await clickOn(menuButton, browser)
}
+4 -4
View File
@@ -14,8 +14,8 @@ export async function showOffDiffCapability(browser: Browser<void>) {
const diffMessages = await browser.$('#valueRendererDisplayMode-diff')
await clickOn(diffMessages, browser)
// const firstEntry = await browser.$('//span[contains(text(), "History")]/../../div/div[1]/div')
const secondEntry = await browser.$('//span[contains(text(), "History")]/../../div/div[2]/div')
await clickOn(secondEntry, browser)
await sleep(2000)
// // const firstEntry = await browser.$('//span[contains(text(), "History")]/../../div/div[1]/div')
// const secondEntry = await browser.$('//span[contains(text(), "History")]/../../div/div[2]/div')
// await clickOn(secondEntry, browser)
// await sleep(2000)
}