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

Commit

Permalink
Rename configRequired to isConfigRequired
Browse files Browse the repository at this point in the history
  • Loading branch information
kahboom committed Jun 14, 2019
1 parent 539aea9 commit c8cfc7e
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 40 deletions.
4 changes: 1 addition & 3 deletions app/ui-react/packages/api/src/helpers/connectionFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ export function getActionStepDefinition(
* Checks whether the ConnectionBulletinBoard provided
* @param board
*/
export function isConfigurationRequired(
board: ConnectionBulletinBoard
): boolean {
export function isConfigRequired(board: ConnectionBulletinBoard): boolean {
return (board.notices || board.warnings || board.errors)! > 0;
}

Expand Down
6 changes: 3 additions & 3 deletions app/ui-react/packages/api/src/useConnection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { IConnectionOverview } from '@syndesis/models';
import {
getActionsWithFrom,
getActionsWithTo,
isConfigurationRequired,
isConfigRequired,
isDerived,
} from './helpers';
import { useApiResource } from './useApiResource';
Expand All @@ -18,9 +18,9 @@ export const transformConnectionResponse = (
...connection,
actionsWithFrom: getActionsWithFrom(connector ? connector.actions : []),
actionsWithTo: getActionsWithTo(connector ? connector.actions : []),
configRequired: isConfigurationRequired(connection),
connector,
derived: isDerived(connection),
isConfigRequired: isConfigRequired(connection),
isTechPreview: connector ? connector.isTechPreview : false,
};
};
Expand All @@ -31,7 +31,7 @@ export const useConnection = (
) => {
return useApiResource<IConnectionOverview>({
defaultValue: {
configRequired: false,
isConfigRequired: false,
isTechPreview: false,
name: '',
},
Expand Down
2 changes: 1 addition & 1 deletion app/ui-react/packages/models/src/extra.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export interface IConfigurationProperty extends ConfigurationProperty {
export interface IConnectionOverview
extends Omit<ConnectionOverview, 'connector'> {
connector?: IConnector;
configRequired: boolean;
isConfigRequired: boolean;
isTechPreview: boolean;
}

Expand Down
12 changes: 6 additions & 6 deletions app/ui-react/packages/ui/src/Connection/ConnectionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ export interface IConnectionCardMenuProps {
}

export interface IConnectionProps {
configurationRequired?: boolean;
description: string;
href: H.LocationDescriptor;
i18nCannotDelete?: string;
i18nConfigurationRequired?: string;
i18nConfigRequired?: string;
i18nTechPreview?: string;
icon: React.ReactNode;
isConfigRequired?: boolean;
isTechPreview?: boolean;
menuProps?: IConnectionCardMenuProps;
name: string;
techPreview?: boolean;
techPreviewPopoverHtml?: React.ReactNode;
}

Expand Down Expand Up @@ -131,7 +131,7 @@ export class ConnectionCard extends React.PureComponent<
matchHeight={true}
className={'connection-card'}
>
{this.props.techPreview && (
{this.props.isTechPreview && (
<div
className="connection-card__tech-preview"
data-testid={'connection-card-tech-preview-heading'}
Expand Down Expand Up @@ -242,15 +242,15 @@ export class ConnectionCard extends React.PureComponent<
</Text>
</div>
</Card.Body>
{this.props.configurationRequired && (
{this.props.isConfigRequired && (
<Card.Footer
className={
'connection-card__footer--config-required alert alert-warning'
}
data-testid={'connection-card-config-required-footer'}
>
<Icon type={'pf'} name={'warning-triangle-o'} size={'2x'} />
{this.props.i18nConfigurationRequired}
{this.props.i18nConfigRequired}
</Card.Footer>
)}
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ const techPreviewPopoverHtml = (
stories.add('no menu', () => (
<MemoryRouter>
<ConnectionCard
configurationRequired={false}
description={text('description', 'Sample connection description')}
href={text('#example') || ''}
i18nConfigurationRequired={'Configuration Required'}
i18nConfigRequired={'Configuration Required'}
i18nTechPreview={'Technology Preview'}
icon={<div />}
isConfigRequired={false}
isTechPreview={false}
name={text('name', 'Sample connection')}
techPreview={false}
/>
</MemoryRouter>
));
Expand All @@ -62,18 +62,17 @@ stories.add('with menu', () => (
<MemoryRouter>
<Container style={{ width: '50%' }}>
<ConnectionCard
configurationRequired={false}
description={text('description', 'Sample connection description')}
href={text('#example') || ''}
i18nCannotDelete={
'Unable to delete this connection as it is being used by one or more integrations'
}
i18nConfigurationRequired={'Configuration Required'}
i18nConfigRequired={'Configuration Required'}
i18nTechPreview={'Technology Preview'}
icon={<div />}
isConfigRequired={false}
menuProps={menuProps}
name={text('name', 'Sample connection')}
techPreview={false}
/>
</Container>
</MemoryRouter>
Expand All @@ -83,18 +82,18 @@ stories.add('tech preview and configuration required', () => (
<MemoryRouter>
<Container style={{ width: '50%' }}>
<ConnectionCard
configurationRequired={true}
description={text('description', 'Sample connection description')}
href={text('#example') || ''}
i18nCannotDelete={
'Unable to delete this connection as it is being used by one or more integrations'
}
i18nConfigurationRequired={'Configuration Required'}
i18nConfigRequired={'Configuration Required'}
i18nTechPreview={'Technology Preview'}
isConfigRequired={true}
isTechPreview={true}
icon={<div />}
menuProps={menuProps}
name={text('name', 'Sample connection')}
techPreview={true}
techPreviewPopoverHtml={techPreviewPopoverHtml}
/>
</Container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ const connections = (
<ConnectionsGridCell>
<ConnectionCard
name={text('name', 'Connection 3')}
configurationRequired={true}
description={text('description', 'Config required and tech preview.')}
href={'#example'}
i18nConfigurationRequired={'Configuration Required'}
i18nConfigRequired={'Configuration Required'}
i18nTechPreview={'Technology Preview'}
icon={<div />}
techPreview={true}
isConfigRequired={true}
isTechPreview={true}
techPreviewPopoverHtml={techPreviewPopoverHtml}
/>
</ConnectionsGridCell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export class Connections extends React.Component<IConnectionsProps> {
<ConnectionsGridCell key={index}>
<ConnectionCard
name={c.name}
configurationRequired={c.configRequired}
description={c.description || ''}
icon={
<EntityIcon
Expand All @@ -92,10 +91,12 @@ export class Connections extends React.Component<IConnectionsProps> {
}
href={this.props.getConnectionHref(c)}
i18nCannotDelete={t('cannotDelete')}
i18nConfigurationRequired={t(
i18nConfigRequired={t(
'configurationRequired'
)}
i18nTechPreview={t('techPreview')}
isConfigRequired={c.isConfigRequired}
isTechPreview={c.isTechPreview}
menuProps={
this.props.includeConnectionMenu
? {
Expand All @@ -121,7 +122,6 @@ export class Connections extends React.Component<IConnectionsProps> {
}
: undefined
}
techPreview={c.isTechPreview}
techPreviewPopoverHtml={
<span
dangerouslySetInnerHTML={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,12 @@ export class ConnectorsPage extends React.Component {
return (
<ConnectionsGridCell key={index}>
<ConnectionCard
configurationRequired={false}
name={connector.name}
description={
connector.description || ''
}
i18nCannotDelete={t('cannotDelete')}
i18nConfigurationRequired={t(
i18nConfigRequired={t(
'configurationRequired'
)}
i18nTechPreview={t('techPreview')}
Expand All @@ -142,14 +141,15 @@ export class ConnectorsPage extends React.Component {
width={46}
/>
}
isConfigRequired={false}
isTechPreview={
connector.isTechPreview
}
href={resolvers.create.configureConnector(
{
connector,
}
)}
techPreview={
connector.isTechPreview
}
techPreviewPopoverHtml={
<span
dangerouslySetInnerHTML={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ export class EditorSteps extends React.Component<IEditorStepsProps> {
<ConnectionsGridCell key={index}>
<ConnectionCard
name={s.name}
configurationRequired={s.configRequired}
description={s.description || ''}
icon={<EntityIcon entity={s} alt={s.name} width={46} />}
href={this.props.getEditorStepHref(s)}
i18nCannotDelete={t('cannotDelete')}
i18nConfigurationRequired={t('configurationRequired')}
i18nConfigRequired={t('configurationRequired')}
i18nTechPreview={t('techPreview')}
techPreview={s.isTechPreview}
isConfigRequired={s.isConfigRequired}
isTechPreview={s.isTechPreview}
techPreviewPopoverHtml={
<span
dangerouslySetInnerHTML={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export enum DataShapeDirection {

export interface IUIStep extends StepKind {
board?: ConnectionBulletinBoard;
configRequired: boolean;
connector?: IConnector;
isConfigRequired: boolean;
isTechPreview: boolean;
uiStepKind: 'api-provider' | StepKind['stepKind'];
title: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ export function toUIStep(step: Step | StepKind): IUIStep {
// An extension needs special mapping
return {
...step,
configRequired: false,
description:
(step as StepKind).description ||
(step as StepKind).extension!.description ||
'',
inputDataShape,
isConfigRequired: false,
isTechPreview: false,
metadata: {
...(step.extension!.metadata || {}),
Expand All @@ -93,12 +93,13 @@ export function toUIStep(step: Step | StepKind): IUIStep {
// this step is a Connection step
return {
...step,
configRequired: (step.connection as IConnectionOverview).configRequired,
description:
(step as IConnectionOverview).description ||
step.connection!.description ||
'',
inputDataShape,
isConfigRequired: (step.connection as IConnectionOverview)
.isConfigRequired,
isTechPreview: (step.connection as IConnectionOverview).isTechPreview,
metadata: {
...(step.connection!.metadata || {}),
Expand All @@ -124,8 +125,8 @@ export function toUIStep(step: Step | StepKind): IUIStep {
const name = step.name || step.stepKind || 'Step';
return {
...(step as StepKind),
configRequired: false,
inputDataShape,
isConfigRequired: false,
isTechPreview: false,
metadata: step.metadata || {},
name,
Expand Down

0 comments on commit c8cfc7e

Please sign in to comment.