Example #1
0
   } else {
     this.endRenaming();
   }
 },
 onNodeNameInputKeydown(e) {
   if (e.key === 'Enter') {
     this.applyNewNodeName(this.refs.name.getInputDOMNode().value);
   } else if (e.key === 'Escape') {
     this.endRenaming();
   }
 },
 discardNodeDeletion(e) {
   e.preventDefault();
   if (this.state.actionInProgress) return;
   this.setState({actionInProgress: true});
   var node = new models.Node(this.props.node.attributes);
   var data = {pending_deletion: false};
   node.save(data, {patch: true})
     .done(() => {
       this.props.cluster.fetchRelated('nodes').done(() => {
         this.setState({actionInProgress: false});
       });
     })
     .fail((response) => {
       utils.showErrorDialog({
         title: i18n('cluster_page.nodes_tab.node.cant_discard'),
         response: response
       });
     });
 },
 removeNode(e) {
Example #2
0
                    notification={notification}
                  />;
                })}
              </div>
            );
          })}
        </div>
      </div>
    );
  }
});

Notification = React.createClass({
  mixins: [backboneMixin('notification')],
  showNodeInfo(id) {
    var node = new models.Node({id});
    node.fetch();
    ShowNodeInfoDialog.show({node});
  },
  markAsRead() {
    var {notification} = this.props;
    notification.toJSON = () => notification.pick('id', 'status');
    notification.save({status: 'read'});
  },
  onNotificationClick() {
    var {notification} = this.props;
    if (notification.get('status') === 'unread') this.markAsRead();
    if (notification.get('node_id')) this.showNodeInfo(notification.get('node_id'));
  },
  render() {
    var {notification} = this.props;