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

mendersoftware / gui / 1081664682

22 Nov 2023 02:11PM UTC coverage: 82.798% (-17.2%) from 99.964%
1081664682

Pull #4214

gitlab-ci

tranchitella
fix: Fixed the infinite page redirects when the back button is pressed

Remove the location and navigate from the useLocationParams.setValue callback
dependencies as they change the set function that is presented in other
useEffect dependencies. This happens when the back button is clicked, which
leads to the location changing infinitely.

Changelog: Title
Ticket: MEN-6847
Ticket: MEN-6796

Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
Signed-off-by: Fabio Tranchitella <fabio.tranchitella@northern.tech>
Pull Request #4214: fix: Fixed the infinite page redirects when the back button is pressed

4319 of 6292 branches covered (0.0%)

8332 of 10063 relevant lines covered (82.8%)

191.0 hits per line

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

72.73
/src/js/components/settings/quoterequestform.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, { useState } from 'react';
15

16
import { Button, FormControl, FormHelperText, TextField } from '@mui/material';
17

18
import { ADDONS, PLANS } from '../../constants/appConstants';
19

20
const quoteRequest = {
5✔
21
  default: {
22
    title: 'Request a change to your plan',
23
    note: `If you have any questions regarding plan pricing or device limits, leave us a message and we'll respond as soon as we can.`
24
  },
25
  trial: {
26
    title: '2. Request a quote from our team',
27
    note: `If you have any notes about your requirements or device fleet size, leave a message and we'll respond as soon as we can`
28
  },
29
  enterprise: {
30
    title: 'Request a quote from our team',
31
    note: `If you have any notes about your requirements or device fleet size, leave a message and we'll respond as soon as we can`
32
  }
33
};
34

35
export const QuoteRequestForm = ({ addOns, currentPlan, isTrial, onSendMessage, updatedPlan }) => {
5✔
36
  const [message, setMessage] = useState('');
3✔
37

38
  const isEnterpriseUpgrade = updatedPlan === 'enterprise';
3✔
39
  const isUpgrade = Object.keys(PLANS).indexOf(updatedPlan) > Object.keys(PLANS).indexOf(currentPlan);
3✔
40
  let { note, title } = isEnterpriseUpgrade ? quoteRequest.enterprise : quoteRequest.default;
3✔
41
  title = isTrial ? `2. ${title}` : title;
3!
42
  return (
3✔
43
    <div className="flexbox column margin-bottom-large">
44
      <h3 className="margin-top-large">{title}</h3>
45
      {isEnterpriseUpgrade ? 'You are requesting a quote for the following subscription:' : 'You are requesting the following changes:'}
3✔
46
      <div>
47
        <p>
48
          Plan: {isUpgrade ? 'Upgrade to ' : ''}
3✔
49
          <b>{PLANS[updatedPlan].name}</b>
50
          {!isTrial && !!addOns.length && (
6!
51
            <span>
52
              <br />
53
              Add-ons: {addOns.map(addon => ADDONS[addon.name].title).join(', ')}
×
54
            </span>
55
          )}
56
        </p>
57
      </div>
58
      <FormControl style={{ marginBottom: 30, marginTop: 0 }}>
59
        <FormHelperText>Your message</FormHelperText>
60
        <TextField fullWidth multiline placeholder={note} value={message} onChange={e => setMessage(e.target.value)} />
×
61
      </FormControl>
62
      <p>
63
        {isTrial || isEnterpriseUpgrade
9✔
64
          ? `After we receive your request, we'll be in touch to discuss your needs and provide a quote.`
65
          : `We'll send you a confirmation of any changes to your subscription.`}
66
      </p>
67
      <Button
68
        className="margin-top margin-bottom"
69
        color="secondary"
70
        disabled={!(message || (!isTrial && addOns.length))}
9✔
71
        onClick={() => onSendMessage(message)}
×
72
        style={{ alignSelf: 'flex-start' }}
73
        variant="contained"
74
      >
75
        Submit request
76
      </Button>
77
    </div>
78
  );
79
};
80

81
export default QuoteRequestForm;
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