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

mendersoftware / gui / 901187442

pending completion
901187442

Pull #3795

gitlab-ci

mzedel
feat: increased chances of adopting our intended navigation patterns instead of unsupported browser navigation

Ticket: None
Changelog: None
Signed-off-by: Manuel Zedel <manuel.zedel@northern.tech>
Pull Request #3795: feat: increased chances of adopting our intended navigation patterns instead of unsupported browser navigation

4389 of 6365 branches covered (68.96%)

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

1729 existing lines in 165 files now uncovered.

8274 of 10019 relevant lines covered (82.58%)

144.86 hits per line

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

69.23
/src/js/components/settings/planselection.js
1
// Copyright 2021 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 React from 'react';
15

16
import { makeStyles } from 'tss-react/mui';
17

18
import { PLANS } from '../../constants/appConstants';
19
import InfoText from '../common/infotext';
20

21
export const useStyles = makeStyles()(theme => ({
7✔
22
  planNote: { marginBottom: -11, fontSize: 'smaller' },
23
  planPanel: {
24
    borderColor: theme.palette.background.lightgrey,
25
    ['&.active,&:hover']: {
26
      borderColor: theme.palette.grey[50],
27
      boxShadow: '0 1px 6px rgba(0, 0, 0, 0.15)'
28
    },
29
    ['&.active']: {
30
      backgroundColor: theme.palette.mode === 'dark' ? theme.palette.grey[50] : theme.palette.grey[400]
4!
31
    },
32
    '&.addon': {
33
      alignItems: 'center',
34
      columnGap: 10,
35
      display: 'grid',
36
      gridTemplateColumns: 'max-content minmax(150px, min-content) 1fr max-content',
37
      height: 'initial',
38
      marginTop: 10,
39
      minWidth: 550,
40
      width: 'initial'
41
    },
42
    '&.addon.upgrade': {
43
      gridTemplateColumns: 'max-content minmax(120px, min-content) minmax(120px, min-content) 1fr max-content'
44
    }
45
  },
46
  price: { fontSize: '1rem' }
47
}));
48

49
export const PlanSelection = ({ currentPlan = 'os', isTrial, offerValid, offerTag, setUpdatedPlan, updatedPlan }) => {
7✔
50
  const { classes } = useStyles();
3✔
51
  const canUpgrade = plan => Object.keys(PLANS).indexOf(plan) >= Object.keys(PLANS).indexOf(currentPlan);
18✔
52
  const onPlanSelect = plan => (isTrial || canUpgrade(plan) ? setUpdatedPlan(plan) : undefined);
3!
53
  return (
3✔
54
    <>
55
      <h3 className="margin-top">{isTrial ? '1. Choose a plan' : 'Plans'}</h3>
3!
56
      <div className="flexbox space-between" style={{ paddingBottom: 15 }}>
57
        {Object.values(PLANS).map(item => (
58
          <div
9✔
59
            key={item.value}
60
            className={`planPanel ${classes.planPanel} ${updatedPlan === item.value ? 'active' : ''} ${isTrial || canUpgrade(item.value) ? '' : 'muted'}`}
36!
UNCOV
61
            onClick={() => onPlanSelect(item.value)}
×
62
          >
63
            {!isTrial && canUpgrade(item.value) && (
27✔
64
              <div className={`uppercased align-center muted ${classes.planNote}`}>{item.value === currentPlan ? 'current plan' : 'upgrade'}</div>
9✔
65
            )}
66
            <h4>
67
              {item.name} {item.offer && isTrial && offerValid ? offerTag : null}
24!
68
            </h4>
69
            <div>
70
              {item.offer && isTrial && offerValid ? (
24!
71
                <>
72
                  <div className={`link-color bold ${classes.price}`}>{item.offerprice}</div>
73
                  <div className="pre-line">{item.price2}</div>
74
                </>
75
              ) : (
76
                <>
77
                  <div className={`link-color bold ${classes.price}`}>{item.price}</div>
78
                  <div>{item.deviceCount}</div>
79
                </>
80
              )}
81
            </div>
82
            <ul className="unstyled">
83
              {item.features.map((feature, index) => (
84
                <li key={`${item.value}-feature-${index}`}>
15✔
85
                  <InfoText variant="dense">{feature}</InfoText>
86
                </li>
87
              ))}
88
            </ul>
89
          </div>
90
        ))}
91
      </div>
92
    </>
93
  );
94
};
95

96
export default PlanSelection;
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