SDA-3606 Removing SSO checkbox in Welcome screen (#1367)

This commit is contained in:
Salah Benmoussati 2022-04-05 09:52:38 +02:00 committed by GitHub
parent c1120aecbd
commit 2394db9278
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 85 deletions

View File

@ -34,19 +34,6 @@ exports[`welcome should render correctly 1`] = `
value="https://[POD].symphony.com" value="https://[POD].symphony.com"
/> />
</div> </div>
<div
className="Welcome-main-container-sso-box"
title="Enable Single Sign On"
>
<label>
<input
checked={false}
onChange={[Function]}
type="checkbox"
/>
SSO
</label>
</div>
</div> </div>
<label <label
className="Welcome-message-label" className="Welcome-message-label"

View File

@ -9,7 +9,6 @@ describe('welcome', () => {
url: 'https://my.symphony.com', url: 'https://my.symphony.com',
message: '', message: '',
urlValid: true, urlValid: true,
sso: false,
}; };
const onLabelEvent = 'on'; const onLabelEvent = 'on';
const removeListenerLabelEvent = 'removeListener'; const removeListenerLabelEvent = 'removeListener';
@ -50,7 +49,6 @@ describe('welcome', () => {
url: 'https://corporate.symphony.com', url: 'https://corporate.symphony.com',
message: '', message: '',
urlValid: true, urlValid: true,
sso: false,
}; };
const spy = jest.spyOn(Welcome.prototype, 'setState'); const spy = jest.spyOn(Welcome.prototype, 'setState');
@ -76,7 +74,6 @@ describe('welcome', () => {
url: 'abcdef', url: 'abcdef',
message: 'Please enter a valid url', message: 'Please enter a valid url',
urlValid: false, urlValid: false,
sso: false,
}; };
const spy = jest.spyOn(Welcome.prototype, 'setState'); const spy = jest.spyOn(Welcome.prototype, 'setState');
@ -95,30 +92,6 @@ describe('welcome', () => {
expect(spy).toBeCalledWith(podUrlMock); expect(spy).toBeCalledWith(podUrlMock);
}); });
it('should click sso checkbox', () => {
const podUrlMock = {
url: 'https://my.symphony.com',
message: '',
urlValid: true,
sso: true,
};
const spy = jest.spyOn(Welcome.prototype, 'setState');
const updatePodUrlSpy = jest.spyOn(Welcome.prototype, 'updateSsoCheckbox');
const wrapper = shallow(React.createElement(Welcome));
ipcRenderer.send('welcome', welcomeMock);
const welcomePodUrlBox = `input[type="checkbox"]`;
const input = wrapper.find(welcomePodUrlBox);
input.simulate('focus');
input.simulate('change', { target: { checked: true } });
expect(updatePodUrlSpy).toBeCalled();
expect(spy).toBeCalledWith(podUrlMock);
});
it('should set pod url', () => { it('should set pod url', () => {
const spy = jest.spyOn(Welcome.prototype, 'setState'); const spy = jest.spyOn(Welcome.prototype, 'setState');
const setPodUrlSpy = jest.spyOn(Welcome.prototype, 'setPodUrl'); const setPodUrlSpy = jest.spyOn(Welcome.prototype, 'setPodUrl');

View File

@ -7,7 +7,6 @@ interface IState {
url: string; url: string;
message: string; message: string;
urlValid: boolean; urlValid: boolean;
sso: boolean;
} }
const WELCOME_NAMESPACE = 'Welcome'; const WELCOME_NAMESPACE = 'Welcome';
@ -23,7 +22,6 @@ export default class Welcome extends React.Component<{}, IState> {
url: 'https://[POD].symphony.com', url: 'https://[POD].symphony.com',
message: '', message: '',
urlValid: false, urlValid: false,
sso: false,
}; };
this.updateState = this.updateState.bind(this); this.updateState = this.updateState.bind(this);
} }
@ -32,7 +30,7 @@ export default class Welcome extends React.Component<{}, IState> {
* Render the component * Render the component
*/ */
public render(): JSX.Element { public render(): JSX.Element {
const { url, message, urlValid, sso } = this.state; const { url, message, urlValid } = this.state;
return ( return (
<div className='Welcome' lang={i18n.getLocale()}> <div className='Welcome' lang={i18n.getLocale()}>
<div className='Welcome-image-container'> <div className='Welcome-image-container'>
@ -54,19 +52,6 @@ export default class Welcome extends React.Component<{}, IState> {
onChange={this.updatePodUrl.bind(this)} onChange={this.updatePodUrl.bind(this)}
></input> ></input>
</div> </div>
<div
className='Welcome-main-container-sso-box'
title={i18n.t('Enable Single Sign On', WELCOME_NAMESPACE)()}
>
<label>
<input
type='checkbox'
checked={sso}
onChange={this.updateSsoCheckbox.bind(this)}
/>
{i18n.t('SSO', WELCOME_NAMESPACE)()}
</label>
</div>
</div> </div>
<label className='Welcome-message-label'>{message}</label> <label className='Welcome-message-label'>{message}</label>
<button <button
@ -103,14 +88,10 @@ export default class Welcome extends React.Component<{}, IState> {
* Set pod url and pass it to the main process * Set pod url and pass it to the main process
*/ */
public setPodUrl(): void { public setPodUrl(): void {
const { url, sso } = this.state; const { url } = this.state;
let ssoPath = '/login/sso/initsso';
if (url.endsWith('/')) {
ssoPath = 'login/sso/initsso';
}
ipcRenderer.send(apiName.symphonyApi, { ipcRenderer.send(apiName.symphonyApi, {
cmd: apiCmds.setPodUrl, cmd: apiCmds.setPodUrl,
newPodUrl: sso ? `${url}${ssoPath}` : url, newPodUrl: url,
}); });
} }
@ -129,7 +110,6 @@ export default class Welcome extends React.Component<{}, IState> {
url, url,
message: i18n.t('Please enter a valid url', WELCOME_NAMESPACE)(), message: i18n.t('Please enter a valid url', WELCOME_NAMESPACE)(),
urlValid: false, urlValid: false,
sso: this.state.sso,
}); });
return; return;
} }
@ -137,22 +117,6 @@ export default class Welcome extends React.Component<{}, IState> {
url, url,
message: '', message: '',
urlValid: true, urlValid: true,
sso: this.state.sso,
});
}
/**
* Update the SSO checkbox
* @param _event Event occurred upon action
* on the checkbox
*/
public updateSsoCheckbox(_event): void {
const ssoCheckBox = _event.target.checked;
this.updateState(_event, {
url: this.state.url,
message: this.state.message,
urlValid: this.state.urlValid,
sso: ssoCheckBox,
}); });
} }

View File

@ -1,4 +1,4 @@
@import "theme"; @import 'theme';
@white: rgb(255, 255, 255, 1); @white: rgb(255, 255, 255, 1);
@version-text-color: rgb(47, 47, 47, 1); @version-text-color: rgb(47, 47, 47, 1);
@ -28,7 +28,6 @@ body {
} }
.Welcome:lang(fr-FR) { .Welcome:lang(fr-FR) {
.Welcome-symphony-section { .Welcome-symphony-section {
padding-left: 10px; padding-left: 10px;
} }
@ -87,7 +86,7 @@ body {
} }
&-name { &-name {
font-size: 1.0em; font-size: 1em;
font-weight: bold; font-weight: bold;
margin-bottom: 6px; margin-bottom: 6px;
} }
@ -155,7 +154,7 @@ body {
cursor: pointer; cursor: pointer;
text-transform: uppercase; text-transform: uppercase;
float: right; float: right;
margin: 24px 30px 4px 0; margin: 24px 0px 4px 0;
&:focus { &:focus {
box-shadow: 0 0 10px rgba(61, 162, 253, 1); box-shadow: 0 0 10px rgba(61, 162, 253, 1);
@ -176,7 +175,7 @@ body {
color: #ffffff; color: #ffffff;
text-transform: uppercase; text-transform: uppercase;
float: right; float: right;
margin: 24px 30px 4px 0; margin: 24px 0px 4px 0;
cursor: not-allowed; cursor: not-allowed;
background-color: #cccccc; background-color: #cccccc;
pointer-events: none; pointer-events: none;
@ -187,4 +186,3 @@ body {
} }
} }
} }