Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 817985f

Browse files
committed
Stop launching dataGathering phase after auth. Add usernameAlias
This PR fixes one bug and adds one new component which is part of version 2.1.0 of the WDC. The first change is to stop launching the dataGathering phase after testing the auth phase. This is necessary to properly simulate adding user credentials independently of a datasource as we do on Tableau Server. The other change is to add support for the new usernameAlias property which provides an end-user readable description of the username. Did some manual testing and unit tests pass
1 parent 343987d commit 817985f

4 files changed

Lines changed: 449 additions & 421 deletions

File tree

Simulator/components/SimulatorAttributes.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ class SimulatorAttributes extends Component {
7777
value={this.props.wdcAttrs.password}
7878
onChange={this.handleAttrChange}
7979
/>
80+
<ControlLabel> Username Alias </ControlLabel>
81+
<FormControl
82+
type="text"
83+
disabled={this.props.disabled}
84+
id="usernameAlias"
85+
value={this.props.wdcAttrs.usernameAlias}
86+
onChange={this.handleAttrChange}
87+
/>
8088
{this.props.showAdvanced ?
8189
<div className="advanced">
8290
<PageHeader>
@@ -165,6 +173,7 @@ SimulatorAttributes.propTypes = {
165173
connectionData: PropTypes.string.isRequired,
166174
username: PropTypes.string.isRequired,
167175
password: PropTypes.string.isRequired,
176+
usernameAlias: PropTypes.string.isRequired,
168177
authPurpose: PropTypes.string.isRequired,
169178
locale: PropTypes.string.isRequired,
170179
}).isRequired,

Simulator/reducers/reducers.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { handleActions } from 'redux-actions';
2-
import { defaultWdcAttrs } from '../utils/consts';
2+
import { defaultWdcAttrs, phases } from '../utils/consts';
33

44
// The redux reducers, which create the next state object
55
// from the payload of any given action.
@@ -9,8 +9,20 @@ import { defaultWdcAttrs } from '../utils/consts';
99
// http://redux.js.org/docs/recipes/UsingObjectSpreadOperator.html
1010

1111
export default handleActions({
12-
SET_WDC_ATTRS: (state, action) =>
13-
({ ...state, wdcAttrs: action.payload }),
12+
SET_WDC_ATTRS: (state, action) => {
13+
const { currentPhase } = state;
14+
let newAttrs = action.payload;
15+
if (currentPhase === phases.AUTH) {
16+
// If we are in the auth phase, we are only allowed to update the username/password attributes
17+
newAttrs = {
18+
username: newAttrs.username,
19+
usernameAlias: newAttrs.usernameAlias,
20+
password: newAttrs.password,
21+
};
22+
}
23+
24+
return { ...state, wdcAttrs: newAttrs };
25+
},
1426
SET_WDC_URL: (state, action) =>
1527
({ ...state, wdcUrl: action.payload }),
1628
SET_ADDRESS_BAR_URL: (state, action) =>

Simulator/utils/consts.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const defaultWdcAttrs = {
2929
connectionData: '',
3030
username: '',
3131
password: '',
32+
usernameAlias: '',
3233
platformOS: '',
3334
platformEdition: '',
3435
platformVersion: '',

0 commit comments

Comments
 (0)