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

mendersoftware / mender-server / 1562688650

27 Nov 2024 01:09PM UTC coverage: 73.484% (+0.7%) from 72.773%
1562688650

Pull #230

gitlab-ci

mzedel
fix(gui): allowed for async tenant management interactions

otherwise newly created/ edited/ removed tenants would have misleading values/ linger in the UI

Ticket: None
Changelog: None
Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
Pull Request #230: MEN-7775 - fix(gui): included current device limit when configuring a tenant as a SP

4181 of 6081 branches covered (68.76%)

Branch coverage included in aggregate %.

5 of 7 new or added lines in 2 files covered. (71.43%)

3 existing lines in 3 files now uncovered.

39906 of 53914 relevant lines covered (74.02%)

16.69 hits per line

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

82.35
/frontend/src/js/components/tenants/TenantPage.tsx
1
// Copyright 2024 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 { useEffect, useState } from 'react';
15
import { useDispatch, useSelector } from 'react-redux';
16

17
import { Add as AddIcon } from '@mui/icons-material';
18
import { Chip } from '@mui/material';
19

20
import { getTenantsList } from '@northern.tech/store/organizationSlice/selectors';
21
import { getTenants } from '@northern.tech/store/organizationSlice/thunks';
22
import { AppDispatch } from '@northern.tech/store/store';
23

24
import { TenantCreateForm } from './TenantCreateForm';
25
import { TenantList } from './TenantList';
26

27
interface TenantsEmptyStateProps {
28
  openModal: () => void;
29
}
30
const TenantsEmptyState = (props: TenantsEmptyStateProps) => {
3✔
31
  const { openModal } = props;
4✔
32
  const dispatch = useDispatch<AppDispatch>();
4✔
33
  useEffect(() => {
4✔
34
    dispatch(getTenants());
2✔
35
  }, [dispatch]);
36
  return (
4✔
37
    <div className="dashboard-placeholder">
38
      <p>You are not currently managing any tenants. </p>
39
      <p>
40
        <a onClick={openModal}>Add a tenant</a> to get started.
41
      </p>
42
    </div>
43
  );
44
};
45
export const TenantPage = () => {
3✔
46
  const [showCreate, setShowCreate] = useState<boolean>(false);
5✔
47
  const { tenants } = useSelector(getTenantsList);
4✔
48
  return (
4✔
49
    <div>
50
      <h2>Tenants</h2>
51
      {tenants.length ? <TenantList /> : <TenantsEmptyState openModal={() => setShowCreate(true)} />}
×
52
      <Chip className="margin-top-small" color="primary" icon={<AddIcon />} label="Add tenant" onClick={() => setShowCreate(true)} />
2✔
UNCOV
53
      {showCreate && <TenantCreateForm open={showCreate} onCloseClick={() => setShowCreate(false)} />}
✔
54
    </div>
55
  );
56
};
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