mirror of
https://github.com/fleetdm/fleet
synced 2026-05-08 17:50:52 +00:00
* add prettier and have it format all js code except website: : * trying running prettier check in CI * fix runs on in CI * change CI job name * fix prettier erros and fix CI
46 lines
1 KiB
JavaScript
46 lines
1 KiB
JavaScript
import { Component } from "react";
|
|
import PropTypes from "prop-types";
|
|
import { connect } from "react-redux";
|
|
|
|
import entityGetter from "redux/utilities/entityGetter";
|
|
import helpers from "components/queries/QueryPageWrapper/helpers";
|
|
import queryInterface from "interfaces/query";
|
|
|
|
class QueryPageWrapper extends Component {
|
|
static propTypes = {
|
|
children: PropTypes.node,
|
|
dispatch: PropTypes.func,
|
|
query: queryInterface,
|
|
queryID: PropTypes.string,
|
|
};
|
|
|
|
componentDidMount() {
|
|
const { dispatch, query, queryID } = this.props;
|
|
const { fetchQuery } = helpers;
|
|
|
|
if (queryID && !query) {
|
|
fetchQuery(dispatch, queryID);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
render() {
|
|
const { children } = this.props;
|
|
|
|
if (!children) {
|
|
return false;
|
|
}
|
|
|
|
return children;
|
|
}
|
|
}
|
|
|
|
const mapStateToProps = (state, { params }) => {
|
|
const { id: queryID } = params;
|
|
const query = entityGetter(state).get("queries").findBy({ id: queryID });
|
|
|
|
return { query, queryID };
|
|
};
|
|
|
|
export default connect(mapStateToProps)(QueryPageWrapper);
|