Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #269 from codaco/feature/graphml-ego-warning
Browse files Browse the repository at this point in the history
add ego info to graphml selection
  • Loading branch information
jthrilly authored Jan 7, 2020
2 parents f0e0f8e + ca77606 commit ce11245
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 37 deletions.
76 changes: 40 additions & 36 deletions src/renderer/containers/ExportScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ExportScreen extends Component {
constructor(props) {
super(props);
this.state = {
exportFormat: 'graphml',
exportFormat: 'csv',
exportNetworkUnion: false,
csvTypes: new Set([...Object.keys(availableCsvTypes), 'ego']),
useDirectedEdges: true,
Expand Down Expand Up @@ -182,48 +182,52 @@ class ExportScreen extends Component {
}}
/>
</div>
<div className="export__csv-types">
<Toggle
disabled={this.state.exportFormat === 'graphml'}
label="Include Ego data?"
input={{
name: 'export_ego_data',
onChange: this.handleEgoDataChange,
value: this.state.exportFormat === 'csv' && this.state.useEgoData,
}}
/>
<DrawerTransition in={!showCsvOpts}>
<div className="export__ego-info">* Ego data not supported for this export format. See <a className="external-link" href="https://documentation.networkcanvas.com/docs/tutorials/server-workflows/#managing-and-exporting-data-in-server">documentation</a>.</div>
</DrawerTransition>
</div>
<DrawerTransition in={showCsvOpts}>
<div className="export__csv-types">
<Toggle
label="Include Ego data?"
input={{
name: 'export_ego_data',
onChange: this.handleEgoDataChange,
value: this.state.useEgoData,
}}
/>
<div className="export__subpanel">
<div className="export__subpanel-content">
<h4>Include the following files:</h4>
{
Object.entries(availableCsvTypes).map(([csvType, label]) => (
<div key={`export_csv_type_${csvType}`}>
<Checkbox
label={label}
input={{
name: 'export_csv_types',
checked: this.state.csvTypes.has(csvType),
value: csvType,
onChange: this.handleCsvTypeChange,
}}
/>
</div>
))
}
<DrawerTransition in={this.state.useEgoData}>
<div key="export_csv_type_ego">
<div className="export__subpanel">
<div className="export__subpanel-content">
<h4>Include the following files:</h4>
{
Object.entries(availableCsvTypes).map(([csvType, label]) => (
<div key={`export_csv_type_${csvType}`}>
<Checkbox
label="Ego Attribute List"
label={label}
input={{
name: 'export_ego_attributes',
checked: this.state.csvTypes.has('ego'),
value: 'ego',
name: 'export_csv_types',
checked: this.state.csvTypes.has(csvType),
value: csvType,
onChange: this.handleCsvTypeChange,
}}
/>
</div>
</DrawerTransition>
</div>
))
}
<DrawerTransition in={this.state.useEgoData}>
<div key="export_csv_type_ego">
<Checkbox
label="Ego Attribute List"
input={{
name: 'export_ego_attributes',
checked: this.state.csvTypes.has('ego'),
value: 'ego',
onChange: this.handleCsvTypeChange,
}}
/>
</div>
</DrawerTransition>
</div>
</div>
</DrawerTransition>
Expand Down
14 changes: 14 additions & 0 deletions src/renderer/containers/__tests__/ExportScreen-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,26 @@ describe('<ExportScreen />', () => {
expect(subject.state('exportFormat')).toEqual('csv');
});

it('does not warn about ego data for csv export', () => {
const radioWrapper = subject.findWhere(n => n.name() === 'Radio' && n.prop('label') === 'CSV');
radioWrapper.dive().find('input').simulate('change', { target: { value: 'csv' } });
const toggleWrapper = subject.find('Toggle').at(0);
expect(toggleWrapper.dive().find('.form-field-toggle').at(0).hasClass('form-field-toggle--disabled')).toBe(false);
});

it('selects graphml format', () => {
const radioWrapper = subject.findWhere(n => n.name() === 'Radio' && n.prop('label') === 'GraphML');
radioWrapper.dive().find('input').simulate('change', { target: { value: 'graphml' } });
expect(subject.state('exportFormat')).toEqual('graphml');
});

it('warns about ego data not downloading', () => {
const radioWrapper = subject.findWhere(n => n.name() === 'Radio' && n.prop('label') === 'GraphML');
radioWrapper.dive().find('input').simulate('change', { target: { value: 'graphml' } });
const toggleWrapper = subject.find('Toggle').at(0);
expect(toggleWrapper.dive().find('.form-field-toggle').at(0).hasClass('form-field-toggle--disabled')).toBe(true);
});

it('selects a csv type', () => {
const csvType = 'adjacencyMatrix';
const checkbox = subject.find('Checkbox').first().dive().find('input');
Expand Down
6 changes: 6 additions & 0 deletions src/renderer/styles/containers/_export.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,10 @@
justify-content: flex-end;
padding: 0 spacing(large);
}

&__ego-info {
float: right;
font-style: italic;
font-size: small;
}
}
2 changes: 1 addition & 1 deletion src/renderer/ui
Submodule ui updated from e94b79 to b9f5d9

0 comments on commit ce11245

Please sign in to comment.