这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions console/src/components/Services/Data/DataState.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ const defaultModifyState = {
name: '',
tableName: '',
isObjRel: null,
lcol: '',
lcol: [],
rTable: null,
rcol: '',
rcol: [],
manualColumns: [],
isManualExpanded: false,
manualRelInfo: {
Expand Down
91 changes: 29 additions & 62 deletions console/src/components/Services/Data/Schema/AutoAddRelations.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ import {
autoAddRelName,
} from '../TableRelationships/Actions';
import { getRelationshipLine } from '../TableRelationships/Relationships';
import suggestedRelationshipsRaw from '../TableRelationships/autoRelations';

class AutoAddRelations extends Component {
trackAllRelations = () => {
this.props.dispatch(autoTrackRelations());
trackAllRelations = untrackedData => {
this.props.dispatch(autoTrackRelations(untrackedData));
};
render() {
const { schema, untrackedRelations, dispatch } = this.props;
const { untrackedRelations, dispatch } = this.props;
const styles = require('../PageContainer/PageContainer.scss');
const handleAutoAddIndivRel = obj => {
dispatch(autoAddRelName(obj));
Expand All @@ -32,64 +31,32 @@ class AutoAddRelations extends Component {
</div>
);
}
const untrackedIndivHtml = [];
schema.map(table => {
const currentTable = table.table_name;
const currentTableRel = suggestedRelationshipsRaw(currentTable, schema);
currentTableRel.objectRel.map(obj => {
untrackedIndivHtml.push(
<div
className={styles.padd_top_medium}
key={'untrackedIndiv' + table.table_name}
>
<button
className={`${styles.display_inline} btn btn-xs btn-default`}
onClick={e => {
e.preventDefault();
handleAutoAddIndivRel(obj);
}}
>
Add
</button>
<div className={styles.display_inline + ' ' + styles.add_pad_left}>
<b>{obj.tableName}</b> -{' '}
{getRelationshipLine(
obj.isObjRel,
obj.lcol,
obj.rcol,
obj.rTable
)}
</div>
</div>
);
});
currentTableRel.arrayRel.map(obj => {
untrackedIndivHtml.push(
<div
className={styles.padd_top_medium}
key={'untrackedIndiv' + table.table_name}
const untrackData = untrackedRelations.map(obj => {
return (
<div
className={styles.padd_top_medium}
key={'untrackedIndiv' + obj.data.tableName}
>
<button
className={`${styles.display_inline} btn btn-xs btn-default`}
onClick={e => {
e.preventDefault();
handleAutoAddIndivRel(obj);
}}
>
<button
className={`${styles.display_inline} btn btn-xs btn-default`}
onClick={e => {
e.preventDefault();
handleAutoAddIndivRel(obj);
}}
>
Add
</button>
<div className={styles.display_inline + ' ' + styles.add_pad_left}>
<b>{obj.tableName}</b> -{' '}
{getRelationshipLine(
obj.isObjRel,
obj.lcol,
obj.rcol,
obj.rTable
)}
</div>
Add
</button>
<div className={styles.display_inline + ' ' + styles.add_pad_left}>
<b>{obj.data.tableName}</b> -{' '}
{getRelationshipLine(
obj.data.isObjRel,
obj.data.lcol,
obj.data.rcol,
obj.data.rTable
)}
</div>
);
});
</div>
);
});
return (
<div>
Expand All @@ -109,7 +76,7 @@ class AutoAddRelations extends Component {
</div>
)}
<button
onClick={this.trackAllRelations}
onClick={this.trackAllRelations.bind(this, untrackedRelations)}
className={
styles.display_inline +
' btn btn-xs btn-default ' +
Expand All @@ -119,7 +86,7 @@ class AutoAddRelations extends Component {
>
Track All Relations
</button>
<div className={styles.padd_top_small}>{untrackedIndivHtml}</div>
<div className={styles.padd_top_small}>{untrackData}</div>
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ const modifyReducer = (tableName, schemas, modifyStateOrig, action) => {
tableName: '',
name: '',
isObjRel: null,
lcol: '',
lcol: [],
rTable: null,
rcol: '',
rcol: [],
manualColumns: [],
},
};
Expand Down
Loading