Skip to content

Commit 7102e21

Browse files
committed
替换通知组件。
1 parent 0576f3e commit 7102e21

File tree

5 files changed

+25
-31
lines changed

5 files changed

+25
-31
lines changed

app/ui/bundle.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
exports.version = [3,3,5,5263];
1+
exports.version = [3,3,5,5265];

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
"ora": "^1.1.0",
8383
"react": "^15.5.4",
8484
"react-dom": "^15.5.4",
85-
"react-notification-system": "^0.2.14",
8685
"rimraf": "^2.6.0",
8786
"semver": "^5.3.0",
8887
"sortablejs": "^1.5.1",
@@ -111,4 +110,4 @@
111110
"presets": ["latest", "stage-0"]
112111
}
113112
}
114-
}
113+
}

ui/App.jsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66
'use strict'
77

88
import React from 'react'
9+
import { notification } from 'antd'
910
import Panel from './panel/panel'
1011
import Content from './content/content'
1112
import SudoPrompt from './frame/sudo'
1213
import EditPrompt from './frame/edit'
1314
import PreferencesPrompt from './frame/preferences'
14-
import NotificationSystem from 'react-notification-system'
1515
import Agent from './Agent'
1616
import { reg as events_reg } from './events/index'
17-
import notificationStyle from './misc/notificationStyle'
1817

1918
import './App.less'
2019

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

3332
this.is_dragging = false
34-
this._notificationSystem = null
3533
this.loadHosts()
3634

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

5957
Agent.on('err', e => {
6058
console.log(e)
61-
this._notificationSystem.addNotification({
62-
title: e.title,
63-
message: e.content,
64-
position: 'tr',
65-
autoDismiss: 10,
66-
level: 'error'
59+
notification.error({
60+
message: e.title,
61+
description: e.content,
62+
duration: 10,
63+
style: {backgroundColor: '#fff0f0'}
6764
})
6865
})
6966

@@ -154,7 +151,6 @@ export default class App extends React.Component {
154151
}
155152

156153
componentDidMount () {
157-
this._notificationSystem = this.refs.notificationSystem
158154

159155
window.addEventListener('keydown', (e) => {
160156
if (e.keyCode === 27) {
@@ -171,7 +167,6 @@ export default class App extends React.Component {
171167
let current = this.state.current
172168
return (
173169
<div id="app" className={'platform-' + Agent.platform}>
174-
<NotificationSystem ref="notificationSystem" style={notificationStyle}/>
175170
<SudoPrompt lang={this.state.lang}/>
176171
<EditPrompt
177172
lang={this.state.lang}

ui/content/content.jsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default class Content extends React.Component {
2525
}
2626

2727
render () {
28-
let {current, lang} = this.props
28+
let {current, readonly, lang} = this.props
2929

3030
return (
3131
<div id="sh-content">
@@ -36,19 +36,19 @@ export default class Content extends React.Component {
3636
show: this.state.is_loading
3737
})}
3838
>loading...</span>
39-
<Icon
40-
type="global"
41-
className={classnames({
42-
show: current.where === 'remote',
43-
iconfont: 1,
44-
'icon-earth': 1
45-
})}
46-
title={lang.remote_hosts}
47-
/>
39+
{/*<Icon*/}
40+
{/*type="global"*/}
41+
{/*className={classnames({*/}
42+
{/*show: current.where === 'remote',*/}
43+
{/*iconfont: 1,*/}
44+
{/*'icon-earth': 1*/}
45+
{/*})}*/}
46+
{/*title={lang.remote_hosts}*/}
47+
{/*/>*/}
4848
<Icon
4949
type="lock"
5050
className={classnames({
51-
show: this.props.readonly,
51+
show: readonly,
5252
iconfont: 1,
5353
'icon-lock2': 1
5454
})}
@@ -57,11 +57,11 @@ export default class Content extends React.Component {
5757
</div>
5858
<div className={classnames({
5959
errorMessage: 1,
60-
show: !!this.props.current.error
61-
})}>{this.props.current.error}</div>
60+
show: !!current.error
61+
})}>{current.error}</div>
6262
<Editor
63-
readonly={this.props.readonly}
64-
code={this.props.current.content || ''}
63+
readonly={readonly}
64+
code={current.content || ''}
6565
setValue={this.setValue.bind(this)}
6666
/>
6767
</div>

0 commit comments

Comments
 (0)