Skip to content

Commit 002f394

Browse files
diningPhilosopher64Prabhakar Kumar
authored andcommitted
This change allows users to point matlab-proxy at custom scripts named matlab for use during startup by, either adding their matlab script to the PATH or, by setting the MWI_CUSTOM_MATLAB_ROOT environment variable. This capability requires users to either use Network License Manager or Existing License to license MATLAB.
Previously, matlab-proxy errored out when it was unable to determine the Version of MATLAB being launched. This restriction is now relaxed for all modes of licensing except Online Licensing. fixes #19
1 parent 0970115 commit 002f394

File tree

22 files changed

+155
-114
lines changed

22 files changed

+155
-114
lines changed

gui/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"last 1 safari version"
4141
]
4242
},
43-
"proxy": "http://localhost:8000",
43+
"proxy": "http://127.0.0.1:8000",
4444
"homepage": "./",
4545
"devDependencies": {
4646
"@babel/preset-env": "^7.11.0",
@@ -52,4 +52,4 @@
5252
"react-test-renderer": "^16.13.1",
5353
"redux-mock-store": "^1.5.4"
5454
}
55-
}
55+
}

gui/src/actionCreators/actionCreators.spec.js

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

33
import configureMockStore from 'redux-mock-store';
44
import thunk from 'redux-thunk';
@@ -65,7 +65,6 @@ describe('Test Sync actionCreators', () => {
6565
error: null,
6666
serverStatus: {
6767
matlabStatus: 'starting',
68-
matlabVersion: 'R2020b',
6968
isFetching: true,
7069
hasFetched: false,
7170
fetchFailCount: 0,
@@ -105,7 +104,6 @@ describe('Test fetchWithTimeout method', () => {
105104
store = mockStore({
106105
error: null,
107106
serverStatus: {
108-
matlabVersion: 'R2020b',
109107
licensingInfo: {
110108
type: 'NLM',
111109
connectionString: 'abc@nlm',
@@ -184,7 +182,6 @@ describe('Test Async actionCreators', () => {
184182
store = mockStore({
185183
error: null,
186184
serverStatus: {
187-
matlabVersion: 'R2020b',
188185
licensingInfo: {
189186
type: 'NLM',
190187
connectionString: 'abc@nlm',

gui/src/components/App/App.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ describe('App Component', () => {
1515
serverStatus: {
1616
licensingInfo: { type: 'MHLM', emailAddress: '[email protected]' },
1717
matlabStatus: 'up',
18-
matlabVersion: 'R2020b',
1918
isFetching: false,
2019
hasFetched: true,
2120
isSubmitting: false,

gui/src/components/Confirmation/Confirmation.spec.js

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

33
import React from 'react';
44
import Confirmation from './index';
@@ -25,7 +25,6 @@ describe('Confirmation Component', () => {
2525
serverStatus: {
2626
licensingInfo: { type: 'MHLM', emailAddress: '[email protected]' },
2727
matlabStatus: 'up',
28-
matlabVersion: 'R2020b',
2928
isFetching: false,
3029
hasFetched: true,
3130
isSubmitting: false,

gui/src/components/Controls/Controls.spec.js

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

33
import React from 'react';
44
import Controls from './index';
@@ -16,7 +16,6 @@ describe('Controls Component', () => {
1616
serverStatus: {
1717
licensingInfo: { type: 'MHLM', emailAddress: '[email protected]' },
1818
matlabStatus: 'up',
19-
matlabVersion: 'R2020b',
2019
isFetching: false,
2120
hasFetched: true,
2221
isSubmitting: false,

gui/src/components/Controls/index.js

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

3-
import React, { useMemo } from 'react';
3+
import React from 'react';
44
import PropTypes from 'prop-types';
55
import { useSelector } from 'react-redux';
66
import ReactTooltip from 'react-tooltip';
@@ -12,10 +12,11 @@ import {
1212
selectMatlabStarting,
1313
selectMatlabStopping,
1414
selectMatlabDown,
15-
selectMatlabVersion,
1615
selectError,
1716
selectIsAuthenticated,
1817
selectAuthEnabled,
18+
selectLicensingIsMhlm,
19+
selectIsEntitled,
1920
} from '../../selectors';
2021
import {
2122
fetchStartMatlab,
@@ -40,20 +41,16 @@ function Controls({
4041
const matlabUp = useSelector(selectMatlabUp);
4142
const matlabStopping = useSelector(selectMatlabStopping);
4243
const matlabDown = useSelector(selectMatlabDown);
43-
const matlabVersion = useSelector(selectMatlabVersion);
4444
const error = useSelector(selectError);
4545
const authEnabled = useSelector(selectAuthEnabled);
4646
const isAuthenticated = useSelector(selectIsAuthenticated);
4747
const licensingInfo = useSelector(selectLicensingInfo);
4848
const canResetLicensing = licensed && !submitting;
4949

50-
const feedbackBody = useMemo(
51-
() => `%0D%0A
52-
Thank you for providing feedback.%0D%0A
53-
%0D%0A
54-
MATLAB version: ${matlabVersion}%0D%0A`,
55-
[matlabVersion]
56-
);
50+
// If licensing type is MHLM and the user is not entitled ( MATLAB version couldn't be determined (VersionInfo.xml was not found))
51+
// then start, stop & signout buttons should be disabled.
52+
const licensingIsMhlm = useSelector(selectLicensingIsMhlm);
53+
const isEntitled = useSelector(selectIsEntitled);
5754

5855
let licensingData, licensingConfirmationMessage;
5956
switch (licensingInfo?.type) {
@@ -136,7 +133,7 @@ MATLAB version: ${matlabVersion}%0D%0A`,
136133
data-testid='startMatlabBtn'
137134
className={getBtnClass(matlabUp ? 'restart' : 'start')}
138135
onClick={() => callback(Confirmations.START)}
139-
disabled={!licensed || matlabStarting || matlabStopping || (authEnabled && !isAuthenticated)}
136+
disabled={!licensed || matlabStarting || matlabStopping || (authEnabled && !isAuthenticated) || (licensingIsMhlm && !isEntitled)}
140137
data-for="control-button-tooltip"
141138
data-tip={`${matlabUp ? 'Restart' : 'Start'} MATLAB`}
142139
>
@@ -160,7 +157,7 @@ MATLAB version: ${matlabVersion}%0D%0A`,
160157
data-testid='unsetLicensingBtn'
161158
className={getBtnClass('sign-out')}
162159
onClick={() => callback(Confirmations.SIGN_OUT)}
163-
disabled={!canResetLicensing || (authEnabled && !isAuthenticated)}
160+
disabled={!canResetLicensing || (authEnabled && !isAuthenticated) || (licensingIsMhlm && !isEntitled)}
164161
data-for="control-button-tooltip"
165162
data-tip= {licensingData.dataTip}
166163
>
@@ -183,9 +180,11 @@ MATLAB version: ${matlabVersion}%0D%0A`,
183180
id="feedback"
184181
data-testid='feedbackLink'
185182
className="btn btn_color_mediumgray companion_btn"
186-
href={`mailto:[email protected]?subject=MATLAB-PROXY Feedback&body=${feedbackBody}`}
183+
href="https://github.com/mathworks/matlab-proxy/issues/new/choose"
184+
target="_blank"
185+
rel="noreferrer"
187186
data-for="control-button-tooltip"
188-
data-tip="Send feedback (opens your default email application)"
187+
data-tip="Provide feedback (opens matlab-proxy repository on github.com in a new tab)"
189188
>
190189
<span className='icon-custom-feedback'></span>
191190
<span className='btn-label'>Feedback</span>

gui/src/components/EntitlementSelector/EntitlementSelector.spec.js

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

33
import React from "react";
44
import EntitlementSelector from "./index";
@@ -31,7 +31,6 @@ describe("EntitlementSelector Component", () => {
3131
entitlementId: null,
3232
},
3333
matlabStatus: "down",
34-
matlabVersion: "R2023a",
3534
isFetching: false,
3635
hasFetched: true,
3736
isSubmitting: false,

gui/src/components/EntitlementSelector/index.js

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

33
import { useState } from "react";
44
import { useDispatch } from "react-redux";

gui/src/components/Help/Help.spec.js

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

33
import React from 'react';
44
import App from '../App'
@@ -16,7 +16,6 @@ describe('Help Component', () => {
1616
serverStatus: {
1717
licensingInfo: { type: 'MHLM', emailAddress: '[email protected]' },
1818
matlabStatus: 'up',
19-
matlabVersion: 'R2020b',
2019
isFetching: false,
2120
hasFetched: true,
2221
isSubmitting: false,

gui/src/components/Help/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function Help({
5555
Sign out of MATLAB. Use this to stop MATLAB and to sign in with an alternative account. Available if using online licensing.<br />
5656
Unset network license manager server address. Use this to stop MATLAB and enter new licensing information. Available if using network license manager.
5757
</p>
58-
<p className="icon-custom-feedback">{`Send feedback about the ${targetEnvMsg}. This action opens your default email application.`}</p>
58+
<p className="icon-custom-feedback">{`Send feedback about the ${targetEnvMsg}. This action opens the matlab-proxy repository on github.com`}</p>
5959
</div>
6060
</div>
6161
<div className="modal-footer">

0 commit comments

Comments
 (0)