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

mendersoftware / mender-server / 1525608807

04 Nov 2024 08:33AM UTC coverage: 77.544%. First build
1525608807

Pull #159

gitlab-ci

mineralsfree
feat: added tenant creation form

Ticket: MEN-7567
Changelog: None

Signed-off-by: Mikita Pilinka <mikita.pilinka@northern.tech>
Pull Request #159: MEN-7567 - feat: added tenant creation form

4128 of 6027 branches covered (68.49%)

Branch coverage included in aggregate %.

52 of 60 new or added lines in 5 files covered. (86.67%)

8193 of 9862 relevant lines covered (83.08%)

89.19 hits per line

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

83.33
/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 { useState } from 'react';
15
import { 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

22
import { TenantCreateForm } from './TenantCreateForm';
23
import { TenantList } from './TenantList';
24

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