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

Commit

Permalink
Fixed DATA SOURCE panel for the case there is no store description or…
Browse files Browse the repository at this point in the history
… notices
  • Loading branch information
forman committed Jan 17, 2019
1 parent 8198163 commit 33cfe46
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/renderer/containers/DataSourcesPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,20 @@ class DataSourcesPanel extends React.Component<IDataSourcesPanelProps & IDataSou
const hasDataStoreDescription = selectedDataStore && selectedDataStore.description;
const hasDataStoreNotices = selectedDataStore && selectedDataStore.notices && selectedDataStore.notices.length;

const callouts = [];
let dataStoreDescriptionElement;
if (hasDataStoreDescription) {
dataStoreDescriptionElement = (
<Collapse isOpen={showDataStoreDescription}>
<Card>
{this.renderMarkdown(selectedDataStore.description)}
</Card>
</Collapse>
);
}

let dataStoreNoticesElement;
if (hasDataStoreNotices) {
const callouts = [];
selectedDataStore.notices.forEach((notice: DataStoreNotice) => {
callouts.push(
<div style={{margin: "0 4px 4px 4px"}}>
Expand All @@ -318,6 +330,7 @@ class DataSourcesPanel extends React.Component<IDataSourcesPanelProps & IDataSou
</div>
);
});
dataStoreNoticesElement = (<Collapse isOpen={showDataStoreNotices}>{callouts}</Collapse>);
}

// a label has by default a 15px margin at the bottom
Expand Down Expand Up @@ -348,15 +361,8 @@ class DataSourcesPanel extends React.Component<IDataSourcesPanelProps & IDataSou
</div>
</div>

<Collapse isOpen={hasDataStoreDescription && showDataStoreDescription}>
<Card>
{this.renderMarkdown(selectedDataStore.description)}
</Card>
</Collapse>

<Collapse isOpen={hasDataStoreNotices && showDataStoreNotices}>
{callouts}
</Collapse>
{dataStoreDescriptionElement}
{dataStoreNoticesElement}

<div style={DataSourcesPanel.FLEX_ROW_STYLE}>
<span style={DataSourcesPanel.SPACER_STYLE}/>
Expand Down

0 comments on commit 33cfe46

Please sign in to comment.