Skip to content

Commit 91379e0

Browse files
committed
Checkbox to toggle project's serveSecure flag
This doesn't yet persist or reload the page.
1 parent a267837 commit 91379e0

File tree

5 files changed

+30
-1
lines changed

5 files changed

+30
-1
lines changed

client/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const AUTH_ERROR = 'AUTH_ERROR';
2626
export const SETTINGS_UPDATED = 'SETTINGS_UPDATED';
2727

2828
export const SET_PROJECT_NAME = 'SET_PROJECT_NAME';
29+
export const SET_SERVE_SECURE = 'SET_SERVE_SECURE';
2930

3031
export const PROJECT_SAVE_SUCCESS = 'PROJECT_SAVE_SUCCESS';
3132
export const PROJECT_SAVE_FAIL = 'PROJECT_SAVE_FAIL';

client/modules/IDE/actions/project.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ export function setProjectName(name) {
2828
};
2929
}
3030

31+
export function setServeSecure(serveSecure) {
32+
return {
33+
type: ActionTypes.SET_SERVE_SECURE,
34+
serveSecure
35+
};
36+
}
37+
3138
export function getProject(id) {
3239
return (dispatch, getState) => {
3340
dispatch(justOpenedProject());

client/modules/IDE/components/Toolbar.jsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,19 @@ class Toolbar extends React.Component {
102102
Auto-refresh
103103
</label>
104104
</div>
105+
<div className="toolbar__serve-secure">
106+
<input
107+
id="serve-secure"
108+
type="checkbox"
109+
checked={this.props.project.serveSecure}
110+
onChange={(event) => {
111+
this.props.setServeSecure(event.target.checked);
112+
}}
113+
/>
114+
<label htmlFor="serve-secure" className="toolbar__serve-secure-label">
115+
HTTPS
116+
</label>
117+
</div>
105118
<div className={nameContainerClass}>
106119
<a
107120
className="toolbar__project-name"
@@ -169,13 +182,15 @@ Toolbar.propTypes = {
169182
project: PropTypes.shape({
170183
name: PropTypes.string.isRequired,
171184
isEditingName: PropTypes.bool,
172-
id: PropTypes.string
185+
id: PropTypes.string,
186+
serveSecure: PropTypes.bool,
173187
}).isRequired,
174188
showEditProjectName: PropTypes.func.isRequired,
175189
hideEditProjectName: PropTypes.func.isRequired,
176190
infiniteLoop: PropTypes.bool.isRequired,
177191
autorefresh: PropTypes.bool.isRequired,
178192
setAutorefresh: PropTypes.func.isRequired,
193+
setServeSecure: PropTypes.func.isRequired,
179194
startSketchAndRefresh: PropTypes.func.isRequired,
180195
saveProject: PropTypes.func.isRequired,
181196
currentUser: PropTypes.string,

client/modules/IDE/pages/IDEView.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ class IDEView extends React.Component {
219219
hideEditProjectName={this.props.hideEditProjectName}
220220
openPreferences={this.props.openPreferences}
221221
preferencesIsVisible={this.props.ide.preferencesIsVisible}
222+
serveSecure={this.props.project.serveSecure}
223+
setServeSecure={this.props.setServeSecure}
222224
setTextOutput={this.props.setTextOutput}
223225
owner={this.props.project.owner}
224226
project={this.props.project}
@@ -499,13 +501,15 @@ IDEView.propTypes = {
499501
project: PropTypes.shape({
500502
id: PropTypes.string,
501503
name: PropTypes.string.isRequired,
504+
serveSecure: PropTypes.bool,
502505
owner: PropTypes.shape({
503506
username: PropTypes.string,
504507
id: PropTypes.string
505508
}),
506509
updatedAt: PropTypes.string
507510
}).isRequired,
508511
setProjectName: PropTypes.func.isRequired,
512+
setServeSecure: PropTypes.func.isRequired,
509513
openPreferences: PropTypes.func.isRequired,
510514
editorAccessibility: PropTypes.shape({
511515
lintMessages: PropTypes.array.isRequired,

client/modules/IDE/reducers/project.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ const project = (state, action) => {
1616
state = initialState(); // eslint-disable-line
1717
}
1818
switch (action.type) {
19+
case ActionTypes.SET_SERVE_SECURE:
20+
return Object.assign({}, { ...state }, { serveSecure: action.serveSecure });
1921
case ActionTypes.SET_PROJECT_NAME:
2022
return Object.assign({}, { ...state }, { name: action.name });
2123
case ActionTypes.NEW_PROJECT:

0 commit comments

Comments
 (0)