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

mendersoftware / mender-server / 1652891695

03 Feb 2025 09:29AM UTC coverage: 77.584% (+1.0%) from 76.616%
1652891695

Pull #412

gitlab-ci

mineralsfree
fix(gui): prevented role creation dialog from closing in case of error

Ticket: MEN-7728
Changelog: None

Signed-off-by: Mikita Pilinka <mikita.pilinka@northern.tech>
Pull Request #412: MEN-7728-fix(gui): prevented role creation dialog from closing in case of error

4328 of 6288 branches covered (68.83%)

Branch coverage included in aggregate %.

4 of 5 new or added lines in 1 file covered. (80.0%)

26 existing lines in 6 files now uncovered.

42805 of 54463 relevant lines covered (78.59%)

21.57 hits per line

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

64.71
/frontend/src/js/components/settings/webhooks/Activity.tsx
1
// Copyright 2022 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14
import { SetStateAction, useEffect, useRef, useState } from 'react';
15

16
import DetailsTable from '@northern.tech/common-ui/DetailsTable';
17
import { ClassesOverrides } from '@northern.tech/common-ui/List';
18
import Pagination from '@northern.tech/common-ui/Pagination';
19
import { Event } from '@northern.tech/store/api/types/MenderTypes';
20
import { DEVICE_LIST_DEFAULTS, Webhook } from '@northern.tech/store/constants';
21

22
import { WebhookColumns } from './Management';
23

24
const { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;
6✔
25

26
interface WebhookActivityProps extends ClassesOverrides {
27
  columns: WebhookColumns;
28
  events?: Event[] | undefined;
29
  eventTotal: number;
30
  getWebhookEvents: () => void;
31
  setSelectedEvent: SetStateAction<Event | undefined>;
32
  webhook: Webhook;
33
}
34

35
const WebhookActivity = ({ classes, columns, events = [], eventTotal, getWebhookEvents, setSelectedEvent, webhook }: WebhookActivityProps) => {
6!
36
  const [page, setPage] = useState(defaultPage);
5✔
37
  const tableRef = useRef();
5✔
38

39
  useEffect(() => {
5✔
40
    getWebhookEvents({ page, perPage: defaultPerPage });
1✔
41
  }, [getWebhookEvents, page]);
42

43
  const mappedColumns = columns.map(column => ({ ...column, extras: { webhook, classes } }));
20✔
44

45
  if (!events.length) {
5!
UNCOV
46
    return <div className="margin-top-large flexbox centered disabled">No webhook activity yet.</div>;
×
47
  }
48

49
  return (
5✔
50
    <>
51
      <DetailsTable columns={mappedColumns} items={events} onItemClick={setSelectedEvent} tableRef={tableRef} />
52
      {eventTotal > defaultPerPage && (
5!
53
        <Pagination
54
          className="margin-top-none"
55
          count={eventTotal ? eventTotal : defaultPerPage}
×
56
          showCountInfo={false}
57
          rowsPerPageOptions={[defaultPerPage]}
58
          page={page}
59
          rowsPerPage={defaultPerPage}
60
          onChangePage={setPage}
61
        />
62
      )}
63
    </>
64
  );
65
};
66

67
export default WebhookActivity;
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

© 2026 Coveralls, Inc