Beispiel #1
0
        group: groupSelector(state, groupId),
        userId,
        isStudentOf: groupId => isSupervisorOf(userId, groupId)(state),
        hasThreshold: editGroupFormSelector(state, 'hasThreshold'),
        isSuperAdmin: isLoggedAsSuperAdmin(state),
        canViewParentDetail: canViewParentDetailSelector(state, groupId),
        instanceId: selectedInstanceId(state),
      };
    },
    (dispatch, { params: { groupId } }) => ({
      push: url => dispatch(push(url)),
      reset: () => dispatch(reset('editGroup')),
      loadAsync: () => dispatch(fetchGroupIfNeeded(groupId)),
      reload: () => dispatch(fetchGroup(groupId)),
      editGroup: ({ localizedTexts, externalId, isPublic, publicStats, threshold, hasThreshold }) => {
        let transformedData = {
          localizedTexts: transformLocalizedTextsFormData(localizedTexts),
          externalId,
          isPublic,
          publicStats,
          hasThreshold,
        };
        if (hasThreshold) {
          transformedData.threshold = Number(threshold);
        }
        return dispatch(editGroup(groupId, transformedData));
      },
    })
  )(injectIntl(EditGroup))
);
      removeInfo['sources[]'] = sources.map(s => (s.id ? s.id : s.media_id));
    }
    dispatch(removeSourcesFromCollection(removeInfo))
      .then((result) => {
        if (result.success === 1) {
          dispatch(updateFeedback({ classes: 'info-notice', open: true, message: ownProps.intl.formatMessage(localMessages.removedFeed) }));
        } else {
          dispatch(updateFeedback({ classes: 'error-notice', open: true, message: ownProps.intl.formatMessage(messages.removeSourceError) }));
        }
      });
  },
  scrapeAllFeeds: (mediaIdList) => {
    mediaIdList.forEach(mediaId => dispatch(scrapeSourceFeeds(mediaId)));
    dispatch(updateFeedback({ classes: 'info-notice', open: true, message: ownProps.intl.formatMessage(localMessages.startedScrapingAll) }));
  },
});

const fetchAsyncData = (dispatch, { collectionId }) => dispatch(fetchCollectionSourceList(collectionId))
  .then(results => results.sources.forEach(source => dispatch(fetchSourceReviewInfo(source.media_id))));

export default
injectIntl(
  connect(mapStateToProps, mapDispatchToProps)(
    withAsyncData(fetchAsyncData)(
      withCsvDownloadNotifyContainer(
        ManageSourcesContainer
      )
    )
  )
);
Beispiel #3
0
import { connect } from 'react-redux';
import { injectIntl } from 'react-intl';
import { addUser } from '../../actions/users';
import { currentUserHasRole, isUserListReady } from '../../selectors';
import AddUserForm from './AddUserForm';

const mapStateToProps = state => ({
  hasGuestRole: currentUserHasRole(state, 'guest'),
  hasMemberRole: currentUserHasRole(state, 'member'),
  hasOwnerRole: currentUserHasRole(state, 'owner'),
  userListReady: isUserListReady(state),
});

const mapDispatchToProps = (dispatch) => ({
  addUserToTeam: payload => dispatch(addUser(payload))
});

export default connect(
  mapStateToProps,
  mapDispatchToProps
)(
  injectIntl(AddUserForm)
);
                  <FormattedDate value={parseSolrShortDate(feed.last_new_story_time)} />
                </td>
                <td>
                  <FormattedDate value={parseSolrShortDate(feed.last_attempted_download_time)} />
                </td>
                <td>
                  <FormattedDate value={parseSolrShortDate(feed.last_successful_download_time)} />
                </td>
                <td>
                  <Permissioned onlyRole={PERMISSION_MEDIA_EDIT}>
                    <Link to={`/sources/${feed.media_id}/feeds/${feed.feeds_id}/edit`}>
                      <EditButton />
                    </Link>
                  </Permissioned>
                </td>
              </tr>
            ))}
          </tbody>
        </table>
      </div>
    );
  }
}

SourceFeedTable.propTypes = {
  feeds: PropTypes.array,
  intl: PropTypes.object.isRequired,
};

export default injectIntl(SourceFeedTable);
        let isTermsOfServiceChecked = this.refs.termsOfService.value;

        if(!isTermsOfServiceChecked) {
            dispatch(notificationAddError(formatMessage({id: "container.signup.error.termsOfService"})));
            return;
        }

        if(_.isEmpty(email)) {
            dispatch(notificationAddError(formatMessage({id: "container.signup.error.emailBlank"})));
            return;
        }

        if(_.isEmpty(password) || _.isEmpty(password2)) {
            dispatch(notificationAddError(formatMessage({id: "container.signup.error.passwordBlank"})));
            return;
        }

        if(password !== password2) {
            dispatch(notificationAddError(formatMessage({id: "container.signup.error.passwordsDontMatch"}))) ;
        }

        dispatch(UserActionCreators.asyncUserSignup(email, password));
    }
}

function mapStateToProps(state) {
    return { state: state }
}

export default injectIntl(connect(mapStateToProps)(SignUpPage));
Beispiel #6
0
                        onChange={ onInputChange('serviceTypeId')}
                        items={ serviceTypes }
                        verticalLayout={ true }
                        readOnly= { readOnly || translationMode == "view" || translationMode == "edit" }
                        disabled= { descriptionAttached }
                        >
                    </LocalizedRadioGroup>
                </div>
            </div>
    );
}

function mapStateToProps(state, ownProps) {

  return {
    serviceType: ServiceSelectors.getServiceTypeId(state, ownProps),
    serviceTypes: CommonServiceSelectors.getServiceTypesObjectArray(state, ownProps),
    serviceTypeFromGeneralDescription: ServiceSelectors.getServiceTypeIdFromGeneralDescription(state, ownProps),
    descriptionAttached: ServiceSelectors.getIsGeneralDescriptionSelectedAndAttached(state, ownProps),
  }
}

const actions = [
    serviceActions
];

export default connect(mapStateToProps, mapDispatchToProps(actions))(injectIntl(ServiceTypes));



Beispiel #7
0
        </th>
      </tr>
    </thead>
    <tbody>
      {instances
        .sort((a, b) => a.name.localeCompare(b.name, intl.locale))
        .map(({ id, name, adminId, hasValidLicence }) => (
          <tr key={id}>
            <td>
              <Link to={INSTANCE_URI_FACTORY(id)}>{name}</Link>
            </td>
            <td>
              <UsersNameContainer userId={adminId} />
            </td>
            <td>
              <SuccessOrFailureIcon success={hasValidLicence} />
            </td>
          </tr>
        ))}
    </tbody>
  </Table>
);

InstancesTable.propTypes = {
  instances: PropTypes.array.isRequired,
  links: PropTypes.object,
  intl: PropTypes.shape({ locale: PropTypes.string.isRequired }).isRequired,
};

export default injectIntl(withLinks(InstancesTable));
Beispiel #8
0
const IncidentChart = injectIntl(
  class IncidentChart extends React.Component {

  render() {

    const {title, height, data, intl} = this.props

    const colorScale = scaleOrdinal(schemeCategory20).domain(data.map(d => d.id));
    const pieData = data.map((d) => ({x: d.value, y: d.value, fill: colorScale(d.id)}))
    const legendData = data.map(d => {
      return {
        label: d.label.split('/')[intl.locale === 'en' ? 1 : 0],
        color: colorScale(d.id)
      }
    })

    return (
      <Widget title={title}>
        <Grid centered>
          <Grid.Row key={1}>
            <Grid.Column width={7}>
              <Statistic size='mini' horizontal>
                <Statistic.Value>
                <Popup
                    trigger={<Icon name='heartbeat' color="red"/>}
                    content={intl.formatMessage({id: 'TotalIncidents'})}
                />
                  {_.sumBy(data, o => o.value)}
              </Statistic.Value>
                <Statistic.Value>
                  <Popup
                      trigger={<Icon name='wrench' color="blue"/>}
                      content={intl.formatMessage({id: 'IsManualIncidents'})}
                  />
                    {_.sumBy(data, o => o.isManual)}
                </Statistic.Value>
              </Statistic>
              <VictoryPie
                theme={VictoryTheme.material}
                style={{labels: {fontSize:20, fill: 'white' }, data: {fill: d => d.fill}}}
                data={pieData}
                innerRadius={60}
                labelRadius={85}
                padding={{top: 0, bottom: 40, left: 40, right:40}}
                events={[{
                  target: "data",
                  eventHandlers: {
                    onMouseOver: () => {
                      return [
                        {
                          target: "data",
                          mutation: (props) => (Object.assign({}, props.style, {style: {fill: shade(props.datum.fill, 0.2)}}))
                        },
                        {
                          target: "labels",
                          mutation: () => ({ active: true })
                        }
                      ]
                    },
                    onMouseOut: () => {
                      return [
                        {
                          target: "data",
                          mutation: (props) => (Object.assign({}, props.style, {style: {fill: props.datum.fill}}))
                        },
                        {
                          target: "labels",
                          mutation: () => ({ active: false })
                        }
                      ]
                    }
                  }
                }]}
              />
            </Grid.Column>
            <Grid.Column width={9}>
              <Legend height={height-40} width={400} data={legendData}/>
            </Grid.Column>
          </Grid.Row>
        </Grid>
      </Widget>
    )
  }
})
                id: 'help',
                name: formatMessage({ id: 'container.drawer.help' }),
                content: (
                  <FormattedMarkdown text="container.pluginSpecificCacheCard.drawer.help" />
                )
              }
            ]}
          />
        </Card>
      </div>
    );
  }
}

function mapStateToProps(state) {
  return {
    activeZoneId: state.activeZone.id,
    cacheCardValue: getPluginSettingsValueForZoneId(
      state.activeZone.id,
      SETTING_NAME,
      state
    ),
    modifiedDate: getPluginSettingsModifiedDateForZoneId(
      state.activeZone.id,
      SETTING_NAME,
      state
    )
  };
}
export default injectIntl(connect(mapStateToProps)(PluginSpecificCacheCard));
import playerMessages from 'i18n/player';

/**
 * Panel showing a player attributes.
 */
const PlayerAttributes = (props) =>
   <Columns size='small'>
      <Box margin='small'>
         <Value value={props.source.movement} label={props.intl.formatMessage(playerMessages.move)} size='small' />
      </Box>
      <Box margin='small'>
         <Value value={props.source.strength} label={props.intl.formatMessage(playerMessages.strength)} size='small' />
      </Box>
      <Box margin='small'>
         <Value value={props.source.speed} label={props.intl.formatMessage(playerMessages.speed)} size='small' />
      </Box>
      <Box margin='small'>
         <Value value={props.source.skill} label={props.intl.formatMessage(playerMessages.skill)} size='small' />
      </Box>
      <Box margin='small'>
         <Value value={props.source.armor} label={props.intl.formatMessage(playerMessages.armor)} size='small' />
      </Box>
   </Columns>;

PlayerAttributes.propTypes = {
   source: PropTypes.object.isRequired,
   intl: PropTypes.object.isRequired
};

export default injectIntl(PlayerAttributes);
Beispiel #11
0
            <div>
                <Headerbar />
                {organization_missing_msg}
                <div className="content">
                    {this.props.children}
                </div>
                <Notifications flashMsg={this.props.app.flashMsg} dispatch={this.props.dispatch} />
                <Modal show={(!!this.props.app.confirmAction)} dialogClassName="custom-modal" onHide={e => this.props.dispatch(cancelAction())}>
                   <Modal.Header closeButton>
                   </Modal.Header>
                   <Modal.Body>
                     <p>{confirmMsg}</p>
                     <p><strong>{additionalMsg}</strong></p>
                     <div dangerouslySetInnerHTML={getMarkup()}/>
                   </Modal.Body>
                   <Modal.Footer>
                     <RaisedButton style={buttonStyle} label={<FormattedMessage id="cancel" />} onClick={e => this.props.dispatch(cancelAction())} />
                     <RaisedButton style={buttonStyle} backgroundColor={isWarningModal ? 'rgba(255,160,160,1)' : null} label={<FormattedMessage id={actionButtonLabel} />} onClick={e => this.props.dispatch(doAction(this.props.app.confirmAction.data))} />
                   </Modal.Footer>
                 </Modal>
            </div>
        )
    }
}

export default connect((state) => ({
    editor: state.editor,
    user: state.user,
    app: state.app
}))(injectIntl(App))
Beispiel #12
0
          className="col-xs-1"
        >
          <Tooltip
            arrow
            title={`${intl.formatMessage({
              id: 'juz.index.heading',
              defaultMessage: 'juz'
            })} ${juzNumber}`}
          >
            <Decoration juzNumber={juzNumber} />
          </Tooltip>
        </b>
        <StyledAyah className="col-xs-11">
          <span>{text}</span>
        </StyledAyah>
      </div>
    );
  }
  return <span>{text}</span>;
};

ShowAyahAndJuzMark.propTypes = {
  chapterId: PropTypes.number.isRequired,
  verseNumber: PropTypes.number.isRequired,
  juzNumber: PropTypes.number.isRequired,
  text: PropTypes.instanceOf(Array),
  intl: intlShape.isRequired
};

export default injectIntl(ShowAyahAndJuzMark);
Beispiel #13
0
              this.state.selectedService
                ? formatMessage(messages.noParameters)
                : formatMessage(messages.selectService)
            }
            parameters={this.props.services
              .getIn([this.state.selectedService, 'parameters'], Map())
              .toList()}
            mistralParameters={this.props.mistralParameters}
          />
        </div>
      </div>
    );
  }
}
RoleServices.propTypes = {
  intl: PropTypes.object,
  mistralParameters: ImmutablePropTypes.map.isRequired,
  role: ImmutablePropTypes.record.isRequired,
  services: ImmutablePropTypes.map.isRequired
};

function mapStateToProps(state, props) {
  return {
    mistralParameters: state.parameters.mistralParameters,
    role: getRole(state, props.match.params.roleIdentifier),
    services: getRoleServices(state, props.match.params.roleIdentifier)
  };
}

export default injectIntl(connect(mapStateToProps)(RoleServices));
  }
}

TopicSummaryContainer.propTypes = {
  // from context
  intl: PropTypes.object.isRequired,
  params: PropTypes.object,
  location: PropTypes.object,
  // from state
  selectedTimespan: PropTypes.object,
  filters: PropTypes.object.isRequired,
  topicId: PropTypes.number,
  topicInfo: PropTypes.object,
  user: PropTypes.object.isRequired,
};

const mapStateToProps = state => ({
  filters: state.topics.selected.filters,
  topicId: state.topics.selected.id,
  topicInfo: state.topics.selected.info,
  selectedTimespan: state.topics.selected.timespans.selected,
  user: state.user,
});

export default
injectIntl(
  connect(mapStateToProps)(
    TopicSummaryContainer
  )
);
Beispiel #15
0
  render() {
    const { fields, intl: { formatMessage } } = this.props;

    return (
      <View style={styles.newTodo}>
        <TextInput
          {...fields.title}
          maxLength={100}
          onEndEditing={this.onTextInputEndEditing}
          onSubmitEditing={this.onSubmitEditing}
          placeholder={formatMessage(newTodoMessages.placeholder)}
          placeholderTextColor={'#cce9f2'}
          viewStyle={styles.textInputView}
          inputStyle={styles.textInputInput}
        />
      </View>
    );
  }

}

NewTodo = injectIntl(NewTodo);

NewTodo = fields(NewTodo, {
  path: 'newTodo',
  fields: ['title'],
});

export default connect(null, { addTodo })(NewTodo);
StoryTotalsSummaryContainer.propTypes = {
  // from compositional chain
  intl: PropTypes.object.isRequired,
  // from parent
  topicId: PropTypes.number.isRequired,
  topicName: PropTypes.string.isRequired,
  filters: PropTypes.object.isRequired,
  // from state
  counts: PropTypes.object,
  fetchStatus: PropTypes.string.isRequired,
};

const mapStateToProps = state => ({
  fetchStatus: state.topics.selected.summary.storyTotals.fetchStatus,
  counts: state.topics.selected.summary.storyTotals.counts,
  filters: state.topics.selected.filters,
});

const fetchAsyncData = (dispatch, props) => dispatch(fetchTopicStoryCounts(props.topicId, props.filters));

export default
injectIntl(
  connect(mapStateToProps)(
    withSummary(localMessages.title, localMessages.descriptionIntro, localMessages.description)(
      withFilteredAsyncData(fetchAsyncData)(
        StoryTotalsSummaryContainer
      )
    )
  )
);
Beispiel #17
0
                }}
              >
                {({
                  state: { email },
                  loading,
                  action: sendToken,
                  validation: { validateEmail },
                }) => (
                    <Button
                      variation="primary"
                      size="small"
                      type="submit"
                      isLoading={loading}
                      onClick={e =>
                        this.handleOnSubmit(e, email, validateEmail, sendToken)
                      }
                    >
                      <span className="t-small">{translate('store/login.send', intl)}</span>
                    </Button>
                  )}
              </AuthService.SendAccessKey>
            </div>
          </Fragment>
        }
      />
    )
  }
}

export default injectIntl(EmailVerification)
const mapStateToProps = state => ({
  selectedTimespan: state.topics.selected.timespans.selected,
  topicId: state.topics.selected.id,
  fetchStatus: state.topics.selected.summary.topWords.fetchStatus,
  topWords: state.topics.selected.summary.topWords,
  wordCounts: state.topics.selected.summary.topWords.list, // for just this timespan
  totalWordCounts: state.topics.selected.summary.topWords.totals, // for the whole snapshot/focus
});

const mapDispatchToProps = dispatch => ({
  handleWordCloudClick: (word, props) => {
    const params = generateParamStr({ ...props.filters, stem: word.stem, term: word.term });
    const url = `/topics/${props.topicId}/words/${word.stem}*?${params}`;
    dispatch(push(url));
  },
});

const fetchAsyncData = (dispatch, props) => {
  dispatch(fetchTopicTopWords(props.topicId, { ...props.filters, withTotals: true }));
};

export default
injectIntl(
  connect(mapStateToProps, mapDispatchToProps)(
    withFilteredAsyncData(fetchAsyncData, ['selectedTimespan'])(
      WordCloudComparisonContainer
    )
  )
);
Beispiel #19
0
  return {
    group: groupSelector(state, groupId),
    userId,
    loggedUser: loggedInUserSelector(state),
    groups: groupsSelector(state),
    assignments: groupsAssignmentsSelector(state, groupId),
    shadowAssignments: groupsShadowAssignmentsSelector(state, groupId),
    assignmentEnvironmentsSelector: assignmentEnvironmentsSelector(state),
    statuses: getStatusesForLoggedUser(state, groupId),
    stats: createGroupsStatsSelector(groupId)(state),
    students: studentsOfGroupSelector(state, groupId),
    isGroupSupervisor: isSupervisorOf(userId, groupId)(state),
    isGroupAdmin: isAdminOf(userId, groupId)(state),
    isGroupStudent: isStudentOf(userId, groupId)(state),
  };
};

const mapDispatchToProps = (dispatch, { params }) => ({
  loadAsync: () => GroupDetail.loadAsync(params, dispatch),
  createShadowAssignment: () => dispatch(createShadowAssignment({ groupId: params.groupId })),
  createGroupExercise: () => dispatch(createExercise({ groupId: params.groupId })),
  push: url => dispatch(push(url)),
});

export default withLinks(
  connect(
    mapStateToProps,
    mapDispatchToProps
  )(injectIntl(GroupDetail))
);
    const routeKey = screens.routes[screens.index].key;
    return (
      <TimeTracker eventName="Tab Time" eventValue={routeKey}>
        <TabNavigator
          screenProps={{
            intl,
          }}
          navigation={{
            ...navigation,
            navigate: (
              routeName: string,
              params?: NavigationParams,
              action?: NavigationNavigateAction
            ) => {
              // Override our navigation.navigate(), so we can track tab switchings
              track('Tab Selected', { Tab: routeName });
              navigation.navigate(routeName, params, action);
              return true;
            },
          }}
          {...props}
        />
      </TimeTracker>
    );
  }
}
export default connect(store => ({
  screens: store.screens,
}))(injectIntl(TabApp));
    return (
      <Dialog
        open={this.state.open}
        onClose={this.handleClose}
        aria-labelledby="simple-dialog-title"
      >
        <DialogTitle id="simple-dialog-title"><FormattedMessage {...localMessages.title} /></DialogTitle>
        <ul>
          <li><FormattedMessage {...localMessages.option1} /></li>
          <li><FormattedMessage {...localMessages.option2} /></li>
          <li><FormattedMessage {...localMessages.option3} /></li>
          <li><FormattedMessage {...localMessages.option4} /></li>
        </ul>
      </Dialog>
    );
  }
}

LearnMorePopup.propTypes = {
  // from parent
  query: PropTypes.object,
  isDeletable: PropTypes.func.isRequired,
  onColorChange: PropTypes.func.isRequired,
  onDelete: PropTypes.func,
  onLabelEditRequest: PropTypes.func,
  // from composition
  intl: PropTypes.object.isRequired,
};

export default injectIntl(LearnMorePopup);
Beispiel #22
0
  ComposedComponent.defaultProps = {
    readOnly: false
  }

  return injectIntl(ComposedComponent)
}

class ValidatePTV extends Component {

  constructor (props) {
    super(props)
  }

  componentWillReceiveProps (nextProps) {
    if (this.props.validate && typeof this.props.validate === 'function') {
      if (!deepEqual(this.props.valueToValidate, nextProps.valueToValidate) || (this.props.forceValidation != nextProps.forceValidation)) {
        this.props.validate(nextProps.valueToValidate)
      }
    } else {
      console.error('Component for validation must be composed!')
    }
  }

  render () {
    return (this.props.isValid || !this.props.isTouched ? null : <p className='has-error'>{this.props.intl.formatMessage(this.props.message, this.props.message.formatArguments)}</p>)
  }
}

export const ValidatePTVComponent = injectIntl(ValidatePTV)
Beispiel #23
0

function mapDispatchToProps(dispatch) {
  return bindActionCreators(
    {
      cancelChanges,
      deleteData,
      fetchData,
      onChange,
      setDataToEdit,
      setFormErrors,
      submit,
      unsetDataToEdit,
    },
    dispatch,
  );
}

const mapStateToProps = selectHomePage();

const withConnect = connect(mapStateToProps, mapDispatchToProps);

const withReducer = injectReducer({ key: 'homePage', reducer });
const withSaga = injectSaga({ key: 'homePage', saga });

export default compose(
  withReducer,
  withSaga,
  withConnect,
)(injectIntl(HomePage));
Beispiel #24
0
export function composePTVComponent (ComponentToCompose) {
  class ComposedComponent extends Component {

    componentWillMount () {
      if (this.isControlValidated && this.context.ValidationManager != null && !this.props.readOnly && !this.props.disabled) {
        this.context.ValidationManager.attachComponentToParent(this)
      }
    }

    componentWillReceiveProps (props) {
      if (this.props.readOnly != props.readOnly) {
        if (props.readOnly && this.isControlValidated && this.context.ValidationManager) {
          this.context.ValidationManager.detachComponentFromParent(this.uniqueId)
        }
        if (!props.readOnly && !props.disabled && this.isControlValidated && this.context.ValidationManager) {
          this.context.ValidationManager.attachComponentToParent(this)
        }
      } else if (!props.readOnly && !props.disabled && this.props.validators != props.validators) {
        if (props.validators && props.validators.length > 0) {
          this.isControlValidated = true
          this.context.ValidationManager.attachComponentToParent(this)
        } else {
          this.context.ValidationManager.detachComponentFromParent(this.uniqueId)
          this.isControlValidated = false
          this.state.message = ''
          this.state.isValid = true
        }
      }
    }

    constructor (props) {
      super(props)
      this.isControlValidated = this.props.validators != null && this.props.validators.length > 0
      this.uniqueId = shortid.generate()
      this.state = { isValid: false, isTouched: false, message: '', errorClass: '', forceValidation: false }
      this.validate = this.validate.bind(this)
      this.validateComponent = this.validateComponent.bind(this)
      this.validatedField = this.props.validatedField || this.props.label
    }

    componentWillUnmount () {
      if (this.isControlValidated && this.context.ValidationManager) {
        this.context.ValidationManager.detachComponentFromParent(this.uniqueId)
      }
    }

    validateComponent () {
      this.setState({ forceValidation: !this.state.forceValidation })
    }

    validate (value) {
      if (this.isControlValidated && this.props.validators) {
        let isValid = this.props.validators.map((validator, index) => {
          switch (validator.rule) {
            case PTVValidatorTypes.IS_REQUIRED.rule:
              return ValidationHelper.IsRequired(value, validator.errorMessage)
            case PTVValidatorTypes.IS_MORE_THAN_MAX.rule:
              return ValidationHelper.isMoreThanMax(value, this.props.maxLength || 2500,
                { ...validator.errorMessage,
                  formatArguments: { maximumOfAllowedCharacters : this.props.maxLength || 2500 } })
            case PTVValidatorTypes.IS_ITEM_MORE_THAN_MAX.rule:
              return ValidationHelper.isItemMoreThanMax(value, this.props.maxLength || 150,
                { ...validator.errorMessage,
                  formatArguments: { maximumOfAllowedCharacters : this.props.maxLength || 150 } })
            case PTVValidatorTypes.IS_NOT_EMPTY.rule:
              return ValidationHelper.IsNotEmpty(value, validator.errorMessage)
            case PTVValidatorTypes.IS_EMAIL.rule:
              return ValidationHelper.IsEmail(value, validator.errorMessage)
            case PTVValidatorTypes.IS_URL.rule:
              return ValidationHelper.IsUrl(value, validator.errorMessage)
            case PTVValidatorTypes.IS_POSTALCODE.rule:
              return ValidationHelper.IsPostalCode(value, validator.errorMessage)
            case PTVValidatorTypes.IS_BUSINESSID.rule:
              return ValidationHelper.IsBusinessId(value, validator.errorMessage)
            case PTVValidatorTypes.IS_DATETIME.rule:
              return ValidationHelper.IsValidDateTime(value, validator.errorMessage)
            case PTVValidatorTypes.IS_REQUIRED_NOT_EMPTY_GUID.rule:
              return ValidationHelper.IsRequiredNotEmptyGuid(value, validator.errorMessage)
          }
        })

        if (isValid) {
          let result = { isValid: true, message: '' }
          isValid.forEach((validator) => {
            if (!validator.valid) {
              result.isValid = false
              result.message = validator.reason
              this.setState({ isValid: false, isTouched: true })
              return
            }
          })

          this.state.message = result.message
          this.setState({ isValid: result.isValid, isTouched: true })
        }

        this.context.ValidationManager.notifyMe(this)
      }
    }

    render () {
      let className = cx(this.props.className, 'composed-component')
      if (this.isControlValidated && !this.props.readOnly) {
        className = this.state.isValid || !this.state.isTouched ? className : cx(className, 'has-error')
      }

      return (<ComponentToCompose {...this.props}
        {...this.state}
        className={className}
        isValid={this.state.isValid}
        validate={this.validate} />)
    }
    }

  ComposedComponent.contextTypes = {
    ValidationManager: React.PropTypes.object
  }

  ComposedComponent.propTypes = {
    readOnly: React.PropTypes.bool
  }

  ComposedComponent.defaultProps = {
    readOnly: false
  }

  return injectIntl(ComposedComponent)
}
Beispiel #25
0
        return (
            <div className={styles.inputWrap}>
                <input
                    className={styles.input}
                    type="text"
                    value={searchText || ''}
                    onChange={onInputChange}
                    onKeyDown={onInputKeyDown}
                    ref={(c) => this._input = c}
                    placeholder={intl.formatMessage({ id: 'search.inputPlaceholder' })}
                />
                {inputCleaner}
            </div>
        );
    }

    render() {
        const { onOverlayClick } = this.props;

        return (
            <div className={styles.wrap}>
                <div className={styles.overlay} onClick={onOverlayClick}></div>
                {this._renderInput()}
                {this._renderResult()}
            </div>
        );
    }
}

export default injectIntl(Search);
Beispiel #26
0
    onRouteChange: PropTypes.func.isRequired
  };

  render() {
    const { intl, onRouteChange } = this.props;

    return (
      <ScrollView
        automaticallyAdjustContentInsets={false}
        contentContainerStyle={styles.menu}
        style={styles.container}
      >
        <View>
          <Text
            onPress={() => onRouteChange('home')} // eslint-disable-line react/jsx-no-bind
            style={styles.item}
          >{intl.formatMessage(linksMessages.home)}</Text>
          <Text
            onPress={() => onRouteChange('todos')} // eslint-disable-line react/jsx-no-bind
            style={styles.item}
          >{intl.formatMessage(linksMessages.todos)}</Text>
        </View>
        {/* TODO: Switch language here. */}
      </ScrollView>
    );
  }

}

export default injectIntl(Menu);
Beispiel #27
0
    });

    const formattedTitle = intl.formatMessage({
      id: 'window.title',
      // \u2193 and \u2191 are down and up arrows, respectively
      defaultMessage: '\u2193 {down} \u2191 {up} - Flood',
    }, {
      down: `${formattedDownSpeed} ${translatedDownUnit}`,
      up: `${formattedUpSpeed} ${translatedUpUnit}`,
    });

    this.setState({
      title: formattedTitle
    });
  }

  render() {
    const {children} = this.props;
    const {title} = this.state;

    return (
      <DocumentTitle title={title}>
        {children}
      </DocumentTitle>
    );
  }
}


export default injectIntl(WindowTitle);
Beispiel #28
0
    supervisors: supervisorsOfGroupSelector(state, groupId),
    isSupervisor: isSupervisorOf(userId, groupId)(state),
    isAdmin: isAdminOf(userId, groupId)(state),
    isSuperAdmin: isLoggedAsSuperAdmin(state),
    isStudent: isStudentOf(userId, groupId)(state),
    hasThreshold: addSubgroupFormSelector(state, 'hasThreshold'),
  };
};

const mapDispatchToProps = (dispatch, { params }) => ({
  addSubgroup: (instanceId, userId) => ({ localizedTexts, hasThreshold, threshold, ...data }) =>
    dispatch(
      createGroup({
        ...data,
        hasThreshold,
        threshold: hasThreshold ? threshold : undefined,
        localizedTexts: transformLocalizedTextsFormData(localizedTexts),
        instanceId,
        parentGroupId: params.groupId,
      })
    ).then(() => Promise.all([dispatch(fetchAllGroups()), dispatch(fetchUser(userId))])),
  loadAsync: () => GroupInfo.loadAsync(params, dispatch),
  push: url => dispatch(push(url)),
  refetchSupervisors: () => dispatch(fetchSupervisors(params.groupId)),
});

export default connect(
  mapStateToProps,
  mapDispatchToProps
)(injectIntl(GroupInfo));
Beispiel #29
0
                        <a href="https://www.log84.de">Log84.de</a>
                    </Navbar.Brand>
                    <Navbar.Toggle />
                </Navbar.Header>
                <Navbar.Collapse>
                    <Nav>
                        <NavDropdown eventKey={1} title={ language } id='select-language'>
                            <NavItem eventKey={1.1} onClick={ wrapCollapse(() => setLocale('en')) } active={ locale === 'en' }>
                                <FormattedMessage
                                    id='app.language_en'
                                    defaultMessage='English'
                                />
                            </NavItem>
                            <NavItem eventKey={1.2} onClick={ wrapCollapse(() => setLocale('de')) } active={ locale === 'de' }>
                                <FormattedMessage
                                    id='app.language_de'
                                    defaultMessage='German'
                                />
                            </NavItem>
                        </NavDropdown>
                    </Nav>
                    {options}
                    {logoutItem}
                </Navbar.Collapse>
            </Navbar>
        )
    }
}

export default injectIntl(AppHeader)
        <Tabs
          animated={false}
          defaultActiveKey="write"
          tabBarExtraContent={operations}
          onChange={this.handleTabChange}
        >
          <TabPane tab={formatMessage({ id: 'write' })} key="write">
            <div className="c7n-md-placeholder">{formatMessage({ id: 'md.placeholder' })}</div>
            <CodeMirror
              options={this.options}
              value={value}
              onChange={onChange}
            />
          </TabPane>
          <TabPane tab={formatMessage({ id: 'preview' })} key="preview">
            <div className="c7n-md-parse c7n-md-preview">
              <ReactMarkdown
                source={value || formatMessage({ id: 'noContent' })}
                skipHtml={false}
                escapeHtml={false}
              />
            </div>
          </TabPane>
        </Tabs>
      </div>
    );
  }
}

export default injectIntl(MdEditor);