Browse Source

替换通知组件。

oldj 8 years ago
parent
commit
5db2684d1c
5 changed files with 23 additions and 30 deletions
  1. 0 1
      app/ui/bundle.js
  2. 1 1
      app/version.js
  3. 1 2
      package.json
  4. 6 11
      ui/App.jsx
  5. 15 15
      ui/content/content.jsx

File diff suppressed because it is too large
+ 0 - 1
app/ui/bundle.js


+ 1 - 1
app/version.js

@@ -1 +1 @@
-exports.version = [3,3,5,5263];
+exports.version = [3,3,5,5265];

+ 1 - 2
package.json

@@ -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",
@@ -111,4 +110,4 @@
       "presets": ["latest", "stage-0"]
     }
   }
-}
+}

+ 6 - 11
ui/App.jsx

@@ -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'
 
@@ -31,7 +30,6 @@ export default class App extends React.Component {
     }
 
     this.is_dragging = false
-    this._notificationSystem = null
     this.loadHosts()
 
     Agent.pact('getPref')
@@ -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'}
       })
     })
 
@@ -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) {
@@ -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}

+ 15 - 15
ui/content/content.jsx

@@ -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">
@@ -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
             })}
@@ -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>

Some files were not shown because too many files changed in this diff