Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
forman committed May 18, 2018
1 parent a0e2e3f commit f0182b3
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 35 deletions.
7 changes: 7 additions & 0 deletions src/renderer/components/TextWithLinks.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as React from 'react';
import Linkify from 'react-linkify';


export function TextWithLinks(props: any) {
return <Linkify properties={{target: '_blank'}}>{props.children}</Linkify>;
}
26 changes: 13 additions & 13 deletions src/renderer/containers/DataSourcesPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import {connect} from 'react-redux';
import Linkify from 'react-linkify';
import {State, DataStoreState, DataSourceState} from '../state';
import { CSSProperties } from 'react';
import { connect } from 'react-redux';
import { State, DataStoreState, DataSourceState } from '../state';
import {
AnchorButton,
InputGroup,
Expand All @@ -12,20 +12,20 @@ import {
Checkbox,
Colors
} from '@blueprintjs/core';
import {Table, Column, Cell, TruncatedFormat} from '@blueprintjs/table';
import {ListBox, ListBoxSelectionMode} from '../components/ListBox';
import {Card} from '../components/Card';
import {ScrollablePanelContent} from '../components/ScrollableContent';
import {ContentWithDetailsPanel} from '../components/ContentWithDetailsPanel';
import { Table, Column, Cell, TruncatedFormat } from '@blueprintjs/table';
import { ListBox, ListBoxSelectionMode } from '../components/ListBox';
import { Card } from '../components/Card';
import { ScrollablePanelContent } from '../components/ScrollableContent';
import { ContentWithDetailsPanel } from '../components/ContentWithDetailsPanel';
import { ToolButton } from '../components/ToolButton';
import { TextWithLinks } from '../components/TextWithLinks';
import DownloadDatasetDialog from './DownloadDataSourceDialog';
import OpenDatasetDialog from './OpenDatasetDialog';
import AddDatasetDialog from './AddDatasetDialog';
import RemoveDatasetDialog from './RemoveDatasetDialog';
import * as actions from '../actions';
import * as selectors from '../selectors';
import {NO_DATA_STORES_FOUND, NO_DATA_SOURCES_FOUND, NO_LOCAL_DATA_SOURCES} from '../messages';
import {CSSProperties} from 'react';
import {ToolButton} from '../components/ToolButton';
import { NO_DATA_STORES_FOUND, NO_DATA_SOURCES_FOUND, NO_LOCAL_DATA_SOURCES } from '../messages';


interface IDataSourcesPanelProps {
Expand Down Expand Up @@ -487,7 +487,7 @@ class DataSourceDetails extends React.PureComponent<IDataSourceDetailsProps, nul
if (meta_info.abstract) {
summary = (
<div><h5>Summary</h5>
<p className="user-selectable"><Linkify>{meta_info.abstract}</Linkify></p>
<p className="user-selectable"><TextWithLinks>{meta_info.abstract}</TextWithLinks></p>
</div>
);
}
Expand Down Expand Up @@ -580,7 +580,7 @@ class DataSourceDetails extends React.PureComponent<IDataSourceDetailsProps, nul
id: 'licences',
element: (
<div>
<p className="user-selectable"><Linkify>{meta_info.licences}</Linkify></p>
<p className="user-selectable"><TextWithLinks>{meta_info.licences}</TextWithLinks></p>
</div>
)
};
Expand Down
52 changes: 30 additions & 22 deletions src/renderer/containers/OperationsPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import * as React from 'react';
import {connect, DispatchProp} from 'react-redux';
import {Popover, Menu, MenuItem, InputGroup, Classes, Tag, Intent, PopoverInteractionKind} from "@blueprintjs/core";
import {ContentWithDetailsPanel} from "../components/ContentWithDetailsPanel";
import {LabelWithType} from "../components/LabelWithType";
import {ListBox, ListBoxSelectionMode} from "../components/ListBox";
import {Card} from "../components/Card";
import OperationStepDialog from "./OperationStepDialog";
import {State, OperationState, WorkspaceState, OperationOutputState, OperationInputState} from "../state";
import * as actions from "../actions";
import * as selectors from "../selectors";
import {ScrollablePanelContent} from "../components/ScrollableContent";
import {NO_OPERATIONS_FOUND} from "../messages";
import {ToolButton} from "../components/ToolButton";
import {NEW_OPERATION_STEP_DIALOG_ID} from "./operation-step-dialog-ids";
import { connect, DispatchProp } from 'react-redux';
import { Popover, Menu, MenuItem, InputGroup, Classes, Tag, Intent, PopoverInteractionKind } from '@blueprintjs/core';
import { ContentWithDetailsPanel } from '../components/ContentWithDetailsPanel';
import { LabelWithType } from '../components/LabelWithType';
import { ListBox, ListBoxSelectionMode } from '../components/ListBox';
import { Card } from '../components/Card';
import OperationStepDialog from './OperationStepDialog';
import { State, OperationState, WorkspaceState, OperationOutputState, OperationInputState } from '../state';
import * as actions from '../actions';
import * as selectors from '../selectors';
import { ScrollablePanelContent } from '../components/ScrollableContent';
import { NO_OPERATIONS_FOUND } from '../messages';
import { ToolButton } from '../components/ToolButton';
import { NEW_OPERATION_STEP_DIALOG_ID } from './operation-step-dialog-ids';
import { TextWithLinks } from '../components/TextWithLinks';


interface IOperationsPanelProps {
Expand Down Expand Up @@ -78,7 +79,7 @@ class OperationsPanel extends React.Component<IOperationsPanelProps & DispatchPr
}

private handleOperationFilterExprCleared() {
this.props.dispatch(actions.setOperationFilterExpr(""));
this.props.dispatch(actions.setOperationFilterExpr(''));
}

private handleOperationFilterExprChange(event) {
Expand Down Expand Up @@ -262,12 +263,12 @@ class OperationsPanel extends React.Component<IOperationsPanelProps & DispatchPr
}

private static getMultiplicityText(n: number, singularText: string, pluralText?: string): string {
return n == 1 ? singularText : (pluralText || singularText + "s");
return n == 1 ? singularText : (pluralText || singularText + 's');
}

private renderOperationDetailsCard() {
const operation = this.props.selectedOperation;
let title = "No selection";
let title = 'No selection';
let description = null;
let tags = null;
let inputs = null;
Expand All @@ -276,7 +277,10 @@ class OperationsPanel extends React.Component<IOperationsPanelProps & DispatchPr
title = operation.name;

if (operation.description) {
description = (<p className="user-selectable">{operation.description}</p>);
description = (
<p className="user-selectable">
<TextWithLinks>{operation.description}</TextWithLinks>
</p>);
}

if (operation.tags) {
Expand All @@ -287,13 +291,15 @@ class OperationsPanel extends React.Component<IOperationsPanelProps & DispatchPr
const outputElems = operation.outputs.map(output => (
<li key={output.name}>
<LabelWithType label={output.name} dataType={output.dataType} units={output.units}/>
<span className="user-selectable">{OperationsPanel.getOutputDescriptionText(output)}</span>
<span className="user-selectable">
<TextWithLinks>{OperationsPanel.getOutputDescriptionText(output)}</TextWithLinks>
</span>
</li>
));
outputs = (
<div>
<p>
<strong>{OperationsPanel.getMultiplicityText(operation.outputs.length, 'Output') + ":"}</strong>
<strong>{OperationsPanel.getMultiplicityText(operation.outputs.length, 'Output') + ':'}</strong>
</p>
<ul>{outputElems}</ul>
</div>
Expand All @@ -305,13 +311,15 @@ class OperationsPanel extends React.Component<IOperationsPanelProps & DispatchPr
const inputElems = operation.inputs.map(input => (
<li key={input.name}>
<LabelWithType label={input.name} dataType={input.dataType} units={input.units}/>
<span className="user-selectable">{OperationsPanel.getInputDescriptionText(input)}</span>
<span className="user-selectable">
<TextWithLinks>{OperationsPanel.getInputDescriptionText(input)}</TextWithLinks>
</span>
</li>
));
inputs = (
<div>
<p>
<strong>{OperationsPanel.getMultiplicityText(operation.outputs.length, 'Input') + ":"}</strong>
<strong>{OperationsPanel.getMultiplicityText(operation.outputs.length, 'Input') + ':'}</strong>
</p>
<ul>{inputElems}</ul>
</div>
Expand Down

0 comments on commit f0182b3

Please sign in to comment.