• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MarkUsProject / Markus / 17864546036

19 Sep 2025 04:49PM UTC coverage: 91.83% (+0.004%) from 91.826%
17864546036

Pull #7663

github

web-flow
Merge d8ebcdb65 into 857462fab
Pull Request #7663: Convert Create Group modal to React component

693 of 1482 branches covered (46.76%)

Branch coverage included in aggregate %.

12 of 13 new or added lines in 1 file covered. (92.31%)

46 existing lines in 5 files now uncovered.

42302 of 45338 relevant lines covered (93.3%)

119.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

89.29
/app/javascript/Components/instructor_table.jsx
1
import React from "react";
2
import {createRoot} from "react-dom/client";
3
import PropTypes from "prop-types";
4

5
import Table from "./table/table";
6
import {createColumnHelper} from "@tanstack/react-table";
7
import {faPencil} from "@fortawesome/free-solid-svg-icons";
8
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
9

10
class InstructorTable extends React.Component {
11
  constructor() {
12
    super();
4✔
13
    this.state = {
3✔
14
      data: [],
15
      loading: true,
16
    };
17
    this.fetchData = this.fetchData.bind(this);
3✔
18

19
    const columnHelper = createColumnHelper();
3✔
20
    this.columns = [
3✔
21
      columnHelper.accessor("user_name", {
22
        header: () => I18n.t("activerecord.attributes.user.user_name"),
10✔
23
      }),
24
      columnHelper.accessor("first_name", {
25
        header: () => I18n.t("activerecord.attributes.user.first_name"),
10✔
26
      }),
27
      columnHelper.accessor("last_name", {
28
        header: () => I18n.t("activerecord.attributes.user.last_name"),
10✔
29
      }),
30
      columnHelper.accessor("email", {
31
        header: () => I18n.t("activerecord.attributes.user.email"),
10✔
32
      }),
33
      columnHelper.accessor("hidden", {
34
        header: () => I18n.t("roles.active") + "?",
10✔
35
        filterFn: "equalsString",
36
        meta: {
37
          filterVariant: "select",
38
        },
39
      }),
40
      columnHelper.accessor("id", {
41
        id: "id",
42
        enableSorting: false,
43
        enableColumnFilter: false,
44
        header: () => I18n.t("actions"),
10✔
45
        cell: props => (
46
          <a
4✔
47
            href={Routes.edit_course_instructor_path(this.props.course_id, props.getValue())}
48
            aria-label={I18n.t("edit")}
49
            title={I18n.t("edit")}
50
          >
51
            <FontAwesomeIcon icon={faPencil} />
52
          </a>
53
        ),
54
      }),
55
    ];
56
  }
57

58
  componentDidMount() {
59
    this.setState({loading: true});
3✔
60
    this.fetchData().then(data => this.setState({data: this.processData(data), loading: false}));
3✔
61
  }
62

63
  fetchData() {
64
    return fetch(Routes.course_instructors_path(this.props.course_id), {
3✔
65
      headers: {
66
        Accept: "application/json",
67
      },
68
    })
69
      .then(response => {
70
        if (response.ok) {
2!
71
          return response.json();
2✔
72
        }
73
      })
74
      .then(json => json.data);
2✔
75
  }
76

77
  processData(data) {
78
    data.forEach(row => (row.hidden = I18n.t(row.hidden ? "roles.inactive" : "roles.active")));
2✔
79
    return data;
2✔
80
  }
81

82
  render() {
83
    return (
8✔
84
      <Table
85
        data={this.state.data}
86
        columns={this.columns}
87
        noDataText={I18n.t("instructors.empty_table")}
88
        loading={this.state.loading}
89
      />
90
    );
91
  }
92
}
93

94
InstructorTable.propTypes = {
1✔
95
  course_id: PropTypes.number,
96
};
97

98
function makeInstructorTable(elem, props) {
UNCOV
99
  const root = createRoot(elem);
×
UNCOV
100
  root.render(<InstructorTable {...props} />);
×
101
}
102

103
export {makeInstructorTable, InstructorTable};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc