Sha256: 93794db0a1a5c7e19b152a917f20b306789679d64bdbf03d49b5b970f8cdde1e

Contents?: true

Size: 1.9 KB

Versions: 115

Compression:

Stored size: 1.9 KB

Contents

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import qs from 'query-string';
import { translate as __ } from 'foremanReact/common/I18n';
import { orgId } from '../../services/api';
import TableSchema from '../ModuleStreams/ModuleStreamsTableSchema';
import ContentPage from '../../components/Content/ContentPage';

class ModuleStreamsPage extends Component {
  constructor(props) {
    super(props);

    const queryParams = qs.parse(this.props.location.search);
    this.state = {
      searchQuery: queryParams.search || '',
    };
  }

  componentDidMount() {
    this.props.getModuleStreams({
      search: this.state.searchQuery,
    });
  }

  onPaginationChange = (pagination) => {
    this.props.getModuleStreams({
      ...pagination,
    });
  };

  onSearch = (search) => {
    this.props.getModuleStreams({ search });
  };

  getAutoCompleteParams = search => ({
    endpoint: '/module_streams/auto_complete_search',
    params: {
      organization_id: orgId(),
      search,
    },
  });

  updateSearchQuery = (searchQuery) => {
    this.setState({ searchQuery });
  };

  render() {
    const { moduleStreams } = this.props;
    return (
      <ContentPage
        header={__('Module Streams')}
        content={moduleStreams}
        tableSchema={TableSchema}
        onSearch={this.onSearch}
        getAutoCompleteParams={this.getAutoCompleteParams}
        updateSearchQuery={this.updateSearchQuery}
        initialInputValue={this.state.searchQuery}
        onPaginationChange={this.onPaginationChange}
      />
    );
  }
}

ModuleStreamsPage.propTypes = {
  location: PropTypes.shape({
    search: PropTypes.oneOfType([
      PropTypes.shape({}),
      PropTypes.string,
    ]),
  }),
  getModuleStreams: PropTypes.func.isRequired,
  moduleStreams: PropTypes.shape({}).isRequired,
};

ModuleStreamsPage.defaultProps = {
  location: { search: '' },
};

export default ModuleStreamsPage;

Version data entries

115 entries across 115 versions & 1 rubygems

Version Path
katello-4.0.1 webpack/scenes/ModuleStreams/ModuleStreamsPage.js
katello-4.1.0.rc1.1 webpack/scenes/ModuleStreams/ModuleStreamsPage.js
katello-4.1.0.rc1 webpack/scenes/ModuleStreams/ModuleStreamsPage.js
katello-4.0.0 webpack/scenes/ModuleStreams/ModuleStreamsPage.js
katello-4.0.0.rc3.1 webpack/scenes/ModuleStreams/ModuleStreamsPage.js
katello-4.0.0.rc3 webpack/scenes/ModuleStreams/ModuleStreamsPage.js
katello-3.18.2.1 webpack/scenes/ModuleStreams/ModuleStreamsPage.js
katello-3.18.2 webpack/scenes/ModuleStreams/ModuleStreamsPage.js
katello-3.17.3 webpack/scenes/ModuleStreams/ModuleStreamsPage.js
katello-4.0.0.rc2 webpack/scenes/ModuleStreams/ModuleStreamsPage.js
katello-3.18.1.1 webpack/scenes/ModuleStreams/ModuleStreamsPage.js
katello-3.17.2 webpack/scenes/ModuleStreams/ModuleStreamsPage.js
katello-4.0.0.rc1 webpack/scenes/ModuleStreams/ModuleStreamsPage.js
katello-3.18.1 webpack/scenes/ModuleStreams/ModuleStreamsPage.js
katello-3.18.0 webpack/scenes/ModuleStreams/ModuleStreamsPage.js
katello-3.17.1 webpack/scenes/ModuleStreams/ModuleStreamsPage.js
katello-3.16.2 webpack/scenes/ModuleStreams/ModuleStreamsPage.js
katello-3.18.0.rc2.1 webpack/scenes/ModuleStreams/ModuleStreamsPage.js
katello-3.18.0.rc2 webpack/scenes/ModuleStreams/ModuleStreamsPage.js
katello-3.17.0 webpack/scenes/ModuleStreams/ModuleStreamsPage.js