|
@@ -4,9 +4,8 @@ var React = require('react');
|
|
var CloudActive = React.createClass({
|
|
var CloudActive = React.createClass({
|
|
render: function() {
|
|
render: function() {
|
|
var record = this.props.record;
|
|
var record = this.props.record;
|
|
- var type = record.type.val();
|
|
|
|
- if(type === 'A' || type === 'AAAA' || type === 'CNAME') {
|
|
|
|
- var active = record.service_mode.val() === '1';
|
|
|
|
|
|
+ if(record.proxiable.val()) {
|
|
|
|
+ var active = record.proxied.val();
|
|
if(active) {
|
|
if(active) {
|
|
return <button className='btn btn-warning' onClick={this.props.onClick}>On</button>
|
|
return <button className='btn btn-warning' onClick={this.props.onClick}>On</button>
|
|
}
|
|
}
|
|
@@ -86,20 +85,20 @@ var Record = React.createClass({
|
|
commitDelete: function() {
|
|
commitDelete: function() {
|
|
this.setState({saving: true});
|
|
this.setState({saving: true});
|
|
var record = this.props.record;
|
|
var record = this.props.record;
|
|
- DomainStore.recordDelete(record.zone_name.val(), record.rec_id.val());
|
|
|
|
|
|
+ DomainStore.recordDelete(record.zone_name.val(), record.id.val());
|
|
},
|
|
},
|
|
commitEdit: function() {
|
|
commitEdit: function() {
|
|
this.setState({saving: true});
|
|
this.setState({saving: true});
|
|
var record = this.props.record;
|
|
var record = this.props.record;
|
|
var newRecord = {
|
|
var newRecord = {
|
|
- id: record.rec_id.val(),
|
|
|
|
|
|
+ id: record.id.val(),
|
|
type: record.type.val(),
|
|
type: record.type.val(),
|
|
name: this.refs.name.getDOMNode().value.trim(),
|
|
name: this.refs.name.getDOMNode().value.trim(),
|
|
content: this.refs.value.getDOMNode().value.trim(),
|
|
content: this.refs.value.getDOMNode().value.trim(),
|
|
ttl: 1
|
|
ttl: 1
|
|
};
|
|
};
|
|
- if(record.service_mode.val()) {
|
|
|
|
- newRecord.service_mode = record.service_mode.val();
|
|
|
|
|
|
+ if(record.proxied.val()) {
|
|
|
|
+ newRecord.proxied = record.proxied.val();
|
|
}
|
|
}
|
|
DomainStore.recordEdit(record.zone_name.val(), newRecord);
|
|
DomainStore.recordEdit(record.zone_name.val(), newRecord);
|
|
},
|
|
},
|
|
@@ -107,11 +106,11 @@ var Record = React.createClass({
|
|
this.setState({saving: true});
|
|
this.setState({saving: true});
|
|
var record = this.props.record;
|
|
var record = this.props.record;
|
|
var newRecord = {
|
|
var newRecord = {
|
|
- id: record.rec_id.val(),
|
|
|
|
|
|
+ id: record.id.val(),
|
|
type: record.type.val(),
|
|
type: record.type.val(),
|
|
name: record.name.val(),
|
|
name: record.name.val(),
|
|
content: record.content.val(),
|
|
content: record.content.val(),
|
|
- service_mode: record.service_mode.val() === "1" ? "0" : "1",
|
|
|
|
|
|
+ proxied: !record.proxied.val(),
|
|
ttl: 1
|
|
ttl: 1
|
|
};
|
|
};
|
|
DomainStore.recordEdit(record.zone_name.val(), newRecord);
|
|
DomainStore.recordEdit(record.zone_name.val(), newRecord);
|
|
@@ -120,12 +119,18 @@ var Record = React.createClass({
|
|
var record = this.props.record;
|
|
var record = this.props.record;
|
|
var className = this.state.saving ? 'saving' : '';
|
|
var className = this.state.saving ? 'saving' : '';
|
|
var editDisabled = ['MX', 'SRV'].indexOf(record.type.val()) >= 0;
|
|
var editDisabled = ['MX', 'SRV'].indexOf(record.type.val()) >= 0;
|
|
|
|
+ var displayName = record.name.val();
|
|
|
|
+ var zoneName = '.'+record.zone_name.val();
|
|
|
|
+ var limit = displayName.length - zoneName.length;
|
|
|
|
+ if(limit > 0 && displayName.substring(limit) === zoneName) {
|
|
|
|
+ displayName = displayName.substring(0, limit);
|
|
|
|
+ }
|
|
if(this.state.state === 'edit') {
|
|
if(this.state.state === 'edit') {
|
|
return (
|
|
return (
|
|
<tr className={className}>
|
|
<tr className={className}>
|
|
<td className="record-type"><span className={record.type.val()}>{record.type.val()}</span></td>
|
|
<td className="record-type"><span className={record.type.val()}>{record.type.val()}</span></td>
|
|
- <td><input type="text" ref="name" defaultValue={record.display_name.val()} /></td>
|
|
|
|
- <td><input type="text" ref="value" defaultValue={record.display_content.val()} /></td>
|
|
|
|
|
|
+ <td><input type="text" ref="name" defaultValue={displayName} /></td>
|
|
|
|
+ <td><input type="text" ref="value" defaultValue={record.content.val()} /></td>
|
|
<td>
|
|
<td>
|
|
<a onClick={this.cancelEdit}>Cancel</a>
|
|
<a onClick={this.cancelEdit}>Cancel</a>
|
|
</td>
|
|
</td>
|
|
@@ -139,8 +144,8 @@ var Record = React.createClass({
|
|
return (
|
|
return (
|
|
<tr className={className}>
|
|
<tr className={className}>
|
|
<td className="record-type"><span className={record.type.val()}>{record.type.val()}</span></td>
|
|
<td className="record-type"><span className={record.type.val()}>{record.type.val()}</span></td>
|
|
- <td><strong>{record.display_name.val()}</strong></td>
|
|
|
|
- <td>{record.display_content.val()}</td>
|
|
|
|
|
|
+ <td><strong>{displayName}</strong></td>
|
|
|
|
+ <td>{record.content.val()}</td>
|
|
<td>
|
|
<td>
|
|
<a onClick={this.cancelEdit}>Cancel</a>
|
|
<a onClick={this.cancelEdit}>Cancel</a>
|
|
</td>
|
|
</td>
|
|
@@ -154,8 +159,8 @@ var Record = React.createClass({
|
|
return (
|
|
return (
|
|
<tr className={className}>
|
|
<tr className={className}>
|
|
<td className="record-type"><span className={record.type.val()}>{record.type.val()}</span></td>
|
|
<td className="record-type"><span className={record.type.val()}>{record.type.val()}</span></td>
|
|
- <td><strong>{record.display_name.val()}</strong></td>
|
|
|
|
- <td className="value">{record.display_content.val()}</td>
|
|
|
|
|
|
+ <td><strong>{displayName}</strong></td>
|
|
|
|
+ <td className="value">{record.content.val()}</td>
|
|
<td><CloudActive record={record} onClick={this.toggleProxy} /></td>
|
|
<td><CloudActive record={record} onClick={this.toggleProxy} /></td>
|
|
<td className="actions">
|
|
<td className="actions">
|
|
<button className="btn btn-primary" disabled={editDisabled} onClick={this.setEditing}>Edit</button>
|
|
<button className="btn btn-primary" disabled={editDisabled} onClick={this.setEditing}>Edit</button>
|
|
@@ -170,7 +175,7 @@ var Record = React.createClass({
|
|
var RecordList = React.createClass({
|
|
var RecordList = React.createClass({
|
|
render: function() {
|
|
render: function() {
|
|
var records = this.props.records.map(function(record) {
|
|
var records = this.props.records.map(function(record) {
|
|
- return <Record key={record.rec_id.val()} record={record} />
|
|
|
|
|
|
+ return <Record key={record.id.val()} record={record} />
|
|
}.bind(this));
|
|
}.bind(this));
|
|
|
|
|
|
var body;
|
|
var body;
|