Skip to content
This repository has been archived by the owner on Jun 14, 2019. It is now read-only.

Commit

Permalink
rename connections to editorSteps
Browse files Browse the repository at this point in the history
  • Loading branch information
kahboom committed Jun 5, 2019
1 parent bc0de4c commit 1885990
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,29 @@ import resolvers from '../../../connections/resolvers';
import { EditorSteps, IEditorStepsProps } from './EditorSteps';
import { IUIIntegrationStep } from './interfaces';

function getFilteredAndSortedConnections(
function getFilteredAndSortedEditorSteps(
steps: IUIIntegrationStep[],
activeFilters: IActiveFilter[],
currentSortType: ISortType,
isSortAscending: boolean
) {
let filteredAndSortedConnections = steps;
let filteredAndSortedEditorSteps = steps;
activeFilters.forEach((filter: IActiveFilter) => {
const valueToLower = filter.value.toLowerCase();
filteredAndSortedConnections = filteredAndSortedConnections.filter(
(c: Connection) => c.name.toLowerCase().includes(valueToLower)
filteredAndSortedEditorSteps = filteredAndSortedEditorSteps.filter(
(e: Connection) => e.name.toLowerCase().includes(valueToLower)
);
});

filteredAndSortedConnections = filteredAndSortedConnections.sort(
filteredAndSortedEditorSteps = filteredAndSortedEditorSteps.sort(
(miA, miB) => {
const left = isSortAscending ? miA : miB;
const right = isSortAscending ? miB : miA;
return left.name.localeCompare(right.name);
}
);

return filteredAndSortedConnections;
return filteredAndSortedEditorSteps;
}

const filterByName = {
Expand Down Expand Up @@ -80,13 +80,13 @@ export class EditorStepsWithToolbar extends React.Component<
{helpers => {
const connectionString = 'connection';

const filteredAndSortedConnections = getFilteredAndSortedConnections(
const filteredAndSortedEditorSteps = getFilteredAndSortedEditorSteps(
this.props.connections as IUIIntegrationStep[],
helpers.activeFilters,
helpers.currentSortType,
helpers.isSortAscending
).map(connection => {
return connection[connectionString];
).map(editorStep => {
return editorStep[connectionString];
});

return (
Expand All @@ -97,19 +97,19 @@ export class EditorStepsWithToolbar extends React.Component<
linkToConnectionCreate={resolvers.create.selectConnector()}
filterTypes={filterTypes}
sortTypes={sortTypes}
resultsCount={filteredAndSortedConnections.length}
resultsCount={filteredAndSortedEditorSteps.length}
{...helpers}
i18nLinkCreateConnection={t('shared:linkCreateConnection')}
i18nResultsCount={t('shared:resultsCount', {
count: filteredAndSortedConnections.length,
count: filteredAndSortedEditorSteps.length,
})}
>
{this.props.children}
<EditorSteps
error={this.props.error}
loading={this.props.loading}
connections={
filteredAndSortedConnections as ConnectionOverview[]
filteredAndSortedEditorSteps as ConnectionOverview[]
}
getConnectionHref={this.props.getConnectionHref}
getConnectionEditHref={this.props.getConnectionEditHref}
Expand Down

0 comments on commit 1885990

Please sign in to comment.