Skip to content

Commit 01dd376

Browse files
krisctlPrabhakar Kumar
authored and
Prabhakar Kumar
committed
Fixes bug where the online licensing screen would hang indefinitely when a user is not licensed for the release of MATLAB being started.
1 parent a6c9a88 commit 01dd376

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

gui/src/components/Information/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020-2022 The MathWorks, Inc.
1+
// Copyright (c) 2020-2023 The MathWorks, Inc.
22

33
import React, { useRef, useState } from 'react';
44
import PropTypes from 'prop-types';
@@ -66,7 +66,7 @@ function Information({
6666
<div className="error-container alert alert-danger">
6767
<p><strong>Error</strong></p>
6868
<Linkify>
69-
<div className="error-text">{error.message}</div>
69+
<div className="error-text"><pre style={{backgroundColor: 'hsla(0,0%,100%,0)', border: 'none', fontFamily: 'inherit', fontSize: '15px'}}>{error.message}</pre></div>
7070
</Linkify>
7171
</div>
7272
) : null;

gui/src/selectors/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,11 @@ export const selectLicensingMhlmUsername = createSelector(
111111
(licensingInfo, isMhlm) => isMhlm ? licensingInfo.emailAddress : ''
112112
);
113113

114+
// Selector to check if the license type is mhlm and entitlements property is not empty
114115
export const selectLicensingMhlmHasEntitlements = createSelector(
115116
selectLicensingIsMhlm,
116117
selectLicensingInfo,
117-
(isMhlm, licensingInfo) => isMhlm && licensingInfo.entitlements
118+
(isMhlm, licensingInfo) => isMhlm && licensingInfo.entitlements && licensingInfo.entitlements.length > 0
118119
);
119120

120121
export const selectIsEntitled = createSelector(
@@ -124,7 +125,7 @@ export const selectIsEntitled = createSelector(
124125
);
125126

126127
// TODO Are these overkill? Perhaps just selecting status would be enough
127-
// TODO Could be used for detected intermedia failures, such as server being
128+
// TODO Could be used for detected intermediate failures, such as server being
128129
// temporarily inaccessible
129130
export const selectMatlabPending = createSelector(
130131
selectMatlabStatus,

matlab_proxy/app_state.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,17 @@ async def update_entitlements(self):
446446
self.licensing["profile_id"] = None
447447
self.licensing["entitlements"] = []
448448
self.licensing["entitlement_id"] = None
449+
# To ensure that any entitlement errors are displayed on the control panel,
450+
# the function returns true. The cached license file only contains the license type
451+
# and the user's email address. These two attributes are necessary for preventing
452+
# the LicenseGatherer step from becoming stuck on the front-end side.
453+
# Additionally, displaying the license type and user email address on the
454+
# information panel makes it worthwhile to maintain these attributes in the state.
455+
return True
456+
457+
except OnlineLicensingError as e:
458+
self.error = e
459+
log_error(logger, e)
449460
return False
450461

451462
# Keeping base error class at the last to catch any uncaught licensing related issues

matlab_proxy/util/mw.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ async def fetch_entitlements(mhlm_api_endpoint, access_token, matlab_release):
6969

7070
if entitlement_el is None or len(entitlement_el) == 0:
7171
raise EntitlementError(
72-
f"Your MathWorks account is not linked to a valid license for MATLAB {matlab_release}."
72+
f"Your MathWorks account is not linked to a valid license for MATLAB {matlab_release}.\nSign out and login with a licensed user."
7373
)
7474

7575
entitlements = entitlement_el.findall("entitlement")

0 commit comments

Comments
 (0)