Example #1
0
            id={this.props.pipeline.id}
            cancelDeleteModal={this.hideConfirmDeleteModal}
            confirmDeletePipeline={this.deletePipeline}
          />
        )}
      </div>
    );
  }
}

PipelineEditorUi.propTypes = {
  close: PropTypes.func.isRequired,
  isNewPipeline: PropTypes.bool.isRequired,
  licenseService: PropTypes.shape({
    checkValidity: PropTypes.func.isRequired,
    isReadOnly: PropTypes.bool.isRequired,
    message: PropTypes.string,
  }).isRequired,
  notifier: PropTypes.shape({
    error: PropTypes.func.isRequired,
  }).isRequired,
  open: PropTypes.func.isRequired,
  pipeline: PropTypes.shape({
    id: PropTypes.string,
    description: PropTypes.string,
    pipeline: PropTypes.any,
    settings: PropTypes.shape({
      'pipeline.batch.delay': PropTypes.number.isRequired,
      'pipeline.batch.size': PropTypes.number.isRequired,
      'pipeline.workers': PropTypes.number,
      'queue.checkpoint.writes': PropTypes.number.isRequired,
                       active={ this.state.url == url ? true : false }
                       onClick={ () => { this.clicked(url) } }>
                      { title }
                    </NavLink>
                  </NavItem>
                ))}
              </Nav>
            </Navbar>
          </Row>

          { this.props.projects.map((project) => (
            <Route key={ `project-${ project.id }` }
                   path={ `${ project.url }/` }
                   component={ () => (<Project { ...project } />) } />
          ))}
        </React.Fragment>
      </Router>
    );
  }
}

ProjectSelector.propTypes = {
  projects: PropTypes.arrayOf(PropTypes.shape({
    id: PropTypes.number.isRequired,
    url: PropTypes.string.isRequired
  })).isRequired,
  baseUrl: PropTypes.string.isRequired,
};

export { ProjectSelector };
Example #3
0
  // TODO: add dynamic class name based on column type ( numeric/text/etc )
  let children = props.children;
  if (!children) {
    children = record[column.dataKey];
    if (formatFn) {
      children = formatFn(children);
    }
  }

  return (
    <td className={`Table-cell ${className}`}>
      {children}
    </td>
  );
}

TableCell.propTypes = {
  children: PropTypes.node,
  className: PropTypes.string,
  column: PropTypes.shape({
    className: PropTypes.string,
    dataKey: PropTypes.string,
  }).isRequired,
  formatFn: PropTypes.func,
  record: PropTypes.shape({
    id: PropTypes.number,
  }).isRequired,
};

Example #4
0
    /**
     * Is the page embed into another ?
     *
     * Permits to know if we use a <main> or a <section> tag.
     */
    embedded: T.bool,

    // alerts management
    alerts: T.array,
    removeAlert: T.func,

    // modal management
    modal: T.shape({
      type: T.string,
      fading: T.bool.isRequired,
      props: T.object.isRequired
    }),
    fadeModal: T.func,
    hideModal: T.func
  },
  defaultProps: {
    fullscreen: false,
    embedded: false
  }
}

export {
  Page
}
// import all icon components
const backgroundStyles = {
  BackgroundCircleSmall,
  BackgroundSquareSmall,
  BackgroundTriangleSmall,
  BackgroundSquare,
  BackgroundSquareBeveled,
  BackgroundSquareRounded,
  BackgroundSquareRoundedSmooth,
  BackgroundTriangle
};

IconBackground.propTypes = {
  backgroundColor: PropTypes.string,
  backgroundOpacity: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  borderColor: PropTypes.string,
  borderOpacity: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  borderWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  name: PropTypes.string
};

IconBackground.defaultProps = {
  backgroundColor: "red",
  backgroundOpacity: "1",
  borderColor: "currentColor",
  borderOpacity: "1",
  borderWidth: "1",
  name: "BackgroundSquare"
};
    )
  }
}

Dropdown.defaultProps = {
  triggerElement: 'button',
  direction: 'down',
  alignment: 'center'
}

if (process.env.NODE_ENV !== 'production') {
  Dropdown.propTypes = {
    id: T.string,
    onChange: T.func,

    triggerElement: T.oneOf(['a', 'button']),
    triggerClassName: T.string,
    triggerActiveClassName: T.string,
    triggerTitle: T.string,
    triggerText: T.string.isRequired,

    direction: T.oneOf(['up', 'down', 'left', 'right']),
    alignment: T.oneOf(['left', 'center', 'right', 'top', 'middle', 'bottom']),

    className: T.string,
    children: T.node
  }
}

class TransitionItem extends React.Component {
  componentDidMount () {
Example #7
0
                  <Row>
                    <Col sm={12}>
                      {artifacts && artifacts.length ?
                        <ModuleStreamDetailArtifacts artifacts={artifacts} /> :
                        __('No artifacts to show')}
                    </Col>
                  </Row>
                </TabPane>
              </TabContent>
            </Grid>
          </TabContainer>
        </LoadingState>
      </div>
    );
  }
}

ModuleStreamDetails.propTypes = {
  loadModuleStreamDetails: PropTypes.func.isRequired,
  history: PropTypes.shape({ push: PropTypes.func.isRequired }).isRequired,
  location: PropTypes.shape({}).isRequired,
  match: PropTypes.shape({
    params: PropTypes.shape({
      id: PropTypes.string.isRequired,
    }).isRequired,
  }).isRequired,
  moduleStreamDetails: PropTypes.shape({}).isRequired,
};

export default ModuleStreamDetails;
Example #8
0
    asc: 'Old to New'
  },
  responses: {
    label: `${months[moment().month()]}'s Top Comments`
  },
  videos: {
    label: 'XP Videos'
  }
};

HomeFilter.propTypes = {
  applyFilter: PropTypes.func.isRequired,
  category: PropTypes.string.isRequired,
  changeCategory: PropTypes.func.isRequired,
  displayOrder: PropTypes.string.isRequired,
  hideWatched: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),
  profileTheme: PropTypes.string,
  setDisplayOrder: PropTypes.func.isRequired,
  selectedFilter: PropTypes.string.isRequired,
  userId: PropTypes.number,
  toggleHideWatched: PropTypes.func.isRequired
};

export default function HomeFilter({
  applyFilter,
  category,
  changeCategory,
  displayOrder,
  hideWatched,
  profileTheme,
  selectedFilter,
Example #9
0
// Importation report, used to:
// - know what to do next in UI (hence the various counters)
// - debug issues (hence the skipped contacts with error details)

import { PropTypes } from 'prop-types'

const contactWithErrorPropType = errorPropName =>
  PropTypes.shape({
    contact: PropTypes.object.isRequired,
    [errorPropName]: PropTypes.instanceOf(Error).isRequired
  })

const skippedArrayPropType = PropTypes.arrayOf(
  PropTypes.oneOf([
    contactWithErrorPropType('transformError'),
    contactWithErrorPropType('saveError')
  ])
)

const propType = PropTypes.oneOf([
  PropTypes.shape({
    parseError: PropTypes.instanceOf(Error).isRequired
  }),
  PropTypes.shape({
    imported: PropTypes.number.isRequired,
    skipped: skippedArrayPropType.isRequired,
    total: PropTypes.number.isRequired,
    unsaved: PropTypes.number.isRequired
  })
])
Example #10
0
const contactWithErrorPropType = errorPropName =>
  PropTypes.shape({
    contact: PropTypes.object.isRequired,
    [errorPropName]: PropTypes.instanceOf(Error).isRequired
  })
Example #11
0
import {PropTypes as T} from 'prop-types'

const UserType = {
  propTypes: {
    autoId: T.number.isRequired,
    id: T.string.isRequired,
    name: T.string.isRequired,
    firstName: T.string.isRequired,
    lastName: T.string.isRequired,
    username: T.string.isRequired,
    picture: T.string,
    email: T.string.isRequired,
    meta: T.shape({
      publicUrl: T.string
    })
  }
}

const OptionsDataType = {
  propTypes: {
    show_all_my_contacts: T.bool,
    show_all_visible_users: T.bool,
    show_username: T.bool,
    show_mail: T.bool,
    show_phone: T.bool,
    show_picture: T.bool
  }
}

const OptionsType = {
  propTypes: {
Example #12
0
import React from 'react';
import { PropTypes } from 'prop-types';

import Todo from './Todo';

const TodoList = ({todos, handleToggleTodo, handleDeleteTodo}) => <ul>
  {todos.map((todo) => <Todo
    key={todo.id}
    {...todo}
    handleToggleTodo={handleToggleTodo}
    handleDeleteTodo={handleDeleteTodo}
  />)}
</ul>;

TodoList.propTypes = {
  todos: PropTypes.arrayOf(PropTypes.shape({
    title: PropTypes.string.isRequired,
    id: PropTypes.number.isRequired,
    done: PropTypes.bool,
  })),
  handleToggleTodo: PropTypes.func.isRequired,
  handleDeleteTodo: PropTypes.func.isRequired
};

export default TodoList;
    const {
      className,
      label,
      id,
      options,
      selectedOption,
      onChange
    } = this.props

    return (
      <div className={c('form__group', className)}>
        <label className='form__label' htmlFor={id}>{label}</label>
        <select className='form__control' id={id} name={id} value={selectedOption} onChange={onChange}>
          {options.map(o => <option key={o.value} value={o.value}>{o.label}</option>)}
        </select>
      </div>
    )
  }
}

if (environment !== 'production') {
  SelectControl.propTypes = {
    className: T.string,
    label: T.string,
    id: T.oneOfType([T.string, T.number]),
    options: T.array,
    selectedOption: T.oneOfType([T.string, T.number]),
    onChange: T.func
  }
}
Example #14
0
    }
  }

  componentWillUnmount() {
    this.cleanup()
  }

  cleanup() {
    this.falcor = null
  }

  render() {
    const { children } = this.props
    return React.Children.only(children)
  }
}

Provider.propTypes = {
  falcor: PropTypes.shape({
    _root: PropTypes.shape({
      onChange: PropTypes.func,
    }).isRequired,
  }).isRequired,
  children: PropTypes.element.isRequired,
}
Provider.childContextTypes = {
  falcor: falcorShape.isRequired,
}

export default Provider
export class Orientation extends Component {
  render () {
    const { orientation, children, className } = this.props
    return (
      <div className={`${className} react-orientation react-orientation--${orientation}`}>
        {children}
      </div>
    )
  }
}

Orientation.propTypes = {
  alwaysRender: PropTypes.bool,
  children: PropTypes.node,
  className: PropTypes.string,
  orientation: PropTypes.oneOf(['portrait', 'landscape']).isRequired
}

Orientation.defaultProps = {
  className: '',
  alwaysRender: true
}

const noop = () => false

window.screen.lockOrientationUniversal = window.screen.lockOrientation ||
  window.screen.mozLockOrientation ||
  window.screen.msLockOrientation

const lock = (orientation) => {
  const { screen } = window
Example #16
0
          })}
        </EuiText>
      </EuiLink>);
  } else if (showAllBadges === true && newSelection.length > limit) {
    badges.push(
      <EuiLink
        key="hide-badges-link"
        onClick={onLinkClick}
      >
        <EuiText grow={false} size="xs">
          {i18n.translate('xpack.ml.jobSelector.hideFlyoutBadges', {
            defaultMessage: 'Hide'
          })}
        </EuiText>
      </EuiLink>);
  }

  return badges;
}
NewSelectionIdBadges.propTypes = {
  limit: PropTypes.number,
  maps: PropTypes.shape({
    jobsMap: PropTypes.object,
    groupsMap: PropTypes.object
  }),
  newSelection: PropTypes.array,
  onDeleteClick: PropTypes.func,
  onLinkClick: PropTypes.func,
  showAllBadges: PropTypes.bool
};
Example #17
0
        color="primary"
        style={styles.root}
      >
        <Card style={this.props.theme.overrides.Execution}>
          <CardContent>
            <Typography variant="headline" component="h2">
              Clusters
            </Typography>
            <Typography color="textSecondary">
              Groups of hosts
            </Typography>
          </CardContent>
          <CardActions>
            <Link to="/clusters" style={this.props.theme.overrides.noDecorationLink}>
              <Button variant="outlined" size="small">Explore</Button>
            </Link>
          </CardActions>
        </Card>
      </Badge>
    )
  }
}


ClusterList.propTypes = {
  theme: PropTypes.shape().isRequired,
}


export default withTheme()(ClusterList)
Example #18
0
import React from 'react'
import { PropTypes } from 'prop-types'
import Todo from './Todo'

const TodoList = ({ todos, onTodoClick }) => (
  <ul>
    {todos.map(todo =>
      <Todo
        key={todo.id}
        {...todo}
        onClick={() => onTodoClick(todo.id)}
      />
    )}
  </ul>
)

TodoList.propTypes = {
  // FIXME ?
  todos: PropTypes.arrayOf(PropTypes.shape({
    id: PropTypes.number.isRequired,
    completed: PropTypes.bool.isRequired,
    text: PropTypes.string.isRequired
  }).isRequired).isRequired,
  onTodoClick: PropTypes.func.isRequired
}

export default TodoList
      return _react2.default.createElement(
        'div',
        { className: className + ' react-orientation react-orientation--' + orientation },
        children
      );
    }
  }]);

  return Orientation;
}(_react.Component);

Orientation.propTypes = {
  alwaysRender: _propTypes.PropTypes.bool,
  children: _propTypes.PropTypes.node,
  className: _propTypes.PropTypes.string,
  orientation: _propTypes.PropTypes.oneOf(['portrait', 'landscape']).isRequired
};

Orientation.defaultProps = {
  className: '',
  alwaysRender: true
};

var noop = function noop() {
  return false;
};

window.screen.lockOrientationUniversal = window.screen.lockOrientation || window.screen.mozLockOrientation || window.screen.msLockOrientation;

var lock = function lock(orientation) {
  var _window = window,
Example #20
0
import {PropTypes} from 'prop-types';

export const injector = PropTypes.shape({
    inject: PropTypes.func.isRequired
});

export default {
    injector
};
Example #21
0
  propTypes: {
    /**
     * The label associated to the action.
     *
     * @type {string}
     */
    label: T.string.isRequired,

    icon: T.string,

    /**
     * The action itself (an URL or a function to call).
     *
     * @type {string|function}
     */
    action: T.oneOfType([T.string, T.func]).isRequired, // todo should also accept url array

    /**
     * Is the action disabled ?
     */
    disabled: T.bool,

    /**
     * Is the action primary ?
     */
    primary: T.bool,

    /**
     * Is the action dangerous ?
     */
    dangerous: T.bool
Example #22
0
import { PropTypes } from 'prop-types'

export default PropTypes.shape({
  eventEmitter: PropTypes.object.isRequired,
  model: PropTypes.object.isRequired,
})
  return (
    <ItemDisplay>
      <ReadoutItemData>
        <ReadoutItemTitle>
          {icon && icon()}
          {title || "—"}
        </ReadoutItemTitle>
        <ReadoutItemValue>{value || "—"}</ReadoutItemValue>
        {detail && <ReadoutItemDetail>{detail}</ReadoutItemDetail>}
        {children}
      </ReadoutItemData>
    </ItemDisplay>
  );
}

const readoutItemPropTypes = {
  children: PropTypes.element,
  detail: PropTypes.string,
  graphData: PropTypes.arrayOf(PropTypes.number),
  icon: PropTypes.func,
  title: PropTypes.string,
  value: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.number,
    PropTypes.object
  ])
};

export const ReadoutItemShape = PropTypes.shape(readoutItemPropTypes);
ReadoutItem.propTypes = readoutItemPropTypes;
Example #24
0
     */
    disabled: T.func,

    /**
     * A function to calculate if the action should be displayed.
     * It receives the list of data objects as param.
     */
    displayed: T.func,

    /**
     * Defines if the action is available as row action or bulk action.
     * If not set, action will be available in both context
     *
     * @type {string}
     */
    context: T.oneOf(['row', 'selection'])
  })
}

/**
 * Definition of a data object property.
 *
 * @type {object}
 */
const DataListProperty = {
  propTypes: merge({}, DataProperty.propTypes, {
    /**
     * An alias for the property.
     * If defined, filters and sortBy will use it to retrieve the property.
     *
     * This permits to simplify queryStrings and server communication when prop
      }

      .icon {
        margin: 0 10px 3px 0;
      }
      `}</style>
  </div>
)

Notification.propTypes = {
  message: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.instanceOf(Error)
  ]),
  type: PropTypes.PropTypes.oneOf([
    'info', 'success', 'error', 'warning'
  ]),
  style: PropTypes.object,
  children: (props, propName, componentName) => {
    if (props.message && props.children) {
      return new Error(
        `message and chidlren properties can not both be supplied to ${componentName}.`
      )
    }
  }
}

Notification.defaultProps = {
  message: '',
  type: 'info',
  style: null,
Example #26
0
  children,
  primary,
  color,
  readoutItems = [],
  ...props
}) {
  return (
    <ReadoutDisplay color={color} primary={primary} {...props}>
      {readoutItems.map(item => (
        <ReadoutItem
          key={`${item.title}|${item.value}|${item.detail}`}
          {...item}
        />
      ))}
      {children}
    </ReadoutDisplay>
  );
}

Readout.propTypes = {
  children: PropTypes.element,
  color: PropTypes.string,
  primary: PropTypes.bool,
  readoutItems: PropTypes.oneOfType([
    PropTypes.arrayOf(ReadoutItemShape),
    PropTypes.object
  ])
};

Readout.displayName = "Readout";
          type="date"
          onChange={ this.onChangeDate }
          placeholder={ placeholder || `Enter ${text}...` }
          defaultValue={ this.getDefaultDate() }
        />
      </div>
    );
  }
}

DateFilter.propTypes = {
  onFilter: PropTypes.func.isRequired,
  column: PropTypes.object.isRequired,
  delay: PropTypes.number,
  defaultValue: PropTypes.shape({
    date: PropTypes.oneOfType([PropTypes.object]),
    comparator: PropTypes.oneOf([...legalComparators, ''])
  }),
  /* eslint consistent-return: 0 */
  comparators: (props, propName) => {
    if (!props[propName]) {
      return;
    }
    for (let i = 0; i < props[propName].length; i += 1) {
      let comparatorIsValid = false;
      for (let j = 0; j < legalComparators.length; j += 1) {
        if (legalComparators[j] === props[propName][i] || props[propName][i] === '') {
          comparatorIsValid = true;
          break;
        }
      }
      if (!comparatorIsValid) {
import Container from '../Container';

const styles = StyleSheet.create({
    rowContainer: {
        margin: 8,
        flexDirection: 'row',
        justifyContent: 'center',
    },
    button: {
        marginHorizontal: 8,
    },
});

const propTypes = {
    navigation: PropTypes.shape({
        goBack: PropTypes.func.isRequired,
    }).isRequired,
};

class ButtonPage extends Component {
    render() {
        return (
            <Container>
                <Toolbar
                    leftElement="arrow-back"
                    onLeftElementPress={() => this.props.navigation.goBack()}
                    centerElement="Button"
                />
                <Subheader text="Flat buttons" />
                <View style={styles.rowContainer}>
                    <View style={styles.button}>
Example #29
0
  render() {
    return (
      <div onClick={this.onChoose}>
        {this.props.children ? (
          this.props.children
        ) : (
          <button>Open dropbox chooser</button>
        )}
      </div>
    );
  }
}

DropboxChooser.propTypes = {
  children: PropTypes.node,
  appKey: PropTypes.string.isRequired,
  success: PropTypes.func.isRequired,
  cancel: PropTypes.func,
  linkType: PropTypes.oneOf(["preview", "direct"]),
  multiselect: PropTypes.bool,
  extensions: PropTypes.arrayOf(PropTypes.string),
  disabled: PropTypes.bool
};

DropboxChooser.defaultProps = {
  cancel: () => {},
  linkType: "preview",
  multiselect: false,
  disabled: false
};