Skip to content

Commit

Permalink
替换通知组件。
Browse files Browse the repository at this point in the history
  • Loading branch information
oldj committed May 30, 2017
1 parent 0576f3e commit 7102e21
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 31 deletions.
4 changes: 2 additions & 2 deletions app/ui/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
exports.version = [3,3,5,5263];
exports.version = [3,3,5,5265];
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
"ora": "^1.1.0",
"react": "^15.5.4",
"react-dom": "^15.5.4",
"react-notification-system": "^0.2.14",
"rimraf": "^2.6.0",
"semver": "^5.3.0",
"sortablejs": "^1.5.1",
Expand Down Expand Up @@ -111,4 +110,4 @@
"presets": ["latest", "stage-0"]
}
}
}
}
17 changes: 6 additions & 11 deletions ui/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
'use strict'

import React from 'react'
import { notification } from 'antd'
import Panel from './panel/panel'
import Content from './content/content'
import SudoPrompt from './frame/sudo'
import EditPrompt from './frame/edit'
import PreferencesPrompt from './frame/preferences'
import NotificationSystem from 'react-notification-system'
import Agent from './Agent'
import { reg as events_reg } from './events/index'
import notificationStyle from './misc/notificationStyle'

import './App.less'

Expand All @@ -31,7 +30,6 @@ export default class App extends React.Component {
}

this.is_dragging = false
this._notificationSystem = null
this.loadHosts()

Agent.pact('getPref')
Expand All @@ -58,12 +56,11 @@ export default class App extends React.Component {

Agent.on('err', e => {
console.log(e)
this._notificationSystem.addNotification({
title: e.title,
message: e.content,
position: 'tr',
autoDismiss: 10,
level: 'error'
notification.error({
message: e.title,
description: e.content,
duration: 10,
style: {backgroundColor: '#fff0f0'}
})
})

Expand Down Expand Up @@ -154,7 +151,6 @@ export default class App extends React.Component {
}

componentDidMount () {
this._notificationSystem = this.refs.notificationSystem

window.addEventListener('keydown', (e) => {
if (e.keyCode === 27) {
Expand All @@ -171,7 +167,6 @@ export default class App extends React.Component {
let current = this.state.current
return (
<div id="app" className={'platform-' + Agent.platform}>
<NotificationSystem ref="notificationSystem" style={notificationStyle}/>
<SudoPrompt lang={this.state.lang}/>
<EditPrompt
lang={this.state.lang}
Expand Down
30 changes: 15 additions & 15 deletions ui/content/content.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class Content extends React.Component {
}

render () {
let {current, lang} = this.props
let {current, readonly, lang} = this.props

return (
<div id="sh-content">
Expand All @@ -36,19 +36,19 @@ export default class Content extends React.Component {
show: this.state.is_loading
})}
>loading...</span>
<Icon
type="global"
className={classnames({
show: current.where === 'remote',
iconfont: 1,
'icon-earth': 1
})}
title={lang.remote_hosts}
/>
{/*<Icon*/}
{/*type="global"*/}
{/*className={classnames({*/}
{/*show: current.where === 'remote',*/}
{/*iconfont: 1,*/}
{/*'icon-earth': 1*/}
{/*})}*/}
{/*title={lang.remote_hosts}*/}
{/*/>*/}
<Icon
type="lock"
className={classnames({
show: this.props.readonly,
show: readonly,
iconfont: 1,
'icon-lock2': 1
})}
Expand All @@ -57,11 +57,11 @@ export default class Content extends React.Component {
</div>
<div className={classnames({
errorMessage: 1,
show: !!this.props.current.error
})}>{this.props.current.error}</div>
show: !!current.error
})}>{current.error}</div>
<Editor
readonly={this.props.readonly}
code={this.props.current.content || ''}
readonly={readonly}
code={current.content || ''}
setValue={this.setValue.bind(this)}
/>
</div>
Expand Down

0 comments on commit 7102e21

Please sign in to comment.