Skip to content

Commit 61d976c

Browse files
committed
Checkbox to toggle project's serveSecure flag
This doesn't yet persist or reload the page.
1 parent 67e4669 commit 61d976c

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
@@ -26,6 +26,13 @@ export function setProjectName(name) {
2626
};
2727
}
2828

29+
export function setServeSecure(serveSecure) {
30+
return {
31+
type: ActionTypes.SET_SERVE_SECURE,
32+
serveSecure
33+
};
34+
}
35+
2936
export function getProject(id) {
3037
return (dispatch, getState) => {
3138
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
@@ -211,6 +211,8 @@ class IDEView extends React.Component {
211211
hideEditProjectName={this.props.hideEditProjectName}
212212
openPreferences={this.props.openPreferences}
213213
preferencesIsVisible={this.props.ide.preferencesIsVisible}
214+
serveSecure={this.props.project.serveSecure}
215+
setServeSecure={this.props.setServeSecure}
214216
setTextOutput={this.props.setTextOutput}
215217
owner={this.props.project.owner}
216218
project={this.props.project}
@@ -489,13 +491,15 @@ IDEView.propTypes = {
489491
project: PropTypes.shape({
490492
id: PropTypes.string,
491493
name: PropTypes.string.isRequired,
494+
serveSecure: PropTypes.bool,
492495
owner: PropTypes.shape({
493496
username: PropTypes.string,
494497
id: PropTypes.string
495498
}),
496499
updatedAt: PropTypes.string
497500
}).isRequired,
498501
setProjectName: PropTypes.func.isRequired,
502+
setServeSecure: PropTypes.func.isRequired,
499503
openPreferences: PropTypes.func.isRequired,
500504
editorAccessibility: PropTypes.shape({
501505
lintMessages: PropTypes.array.isRequired,

client/modules/IDE/reducers/project.js

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

0 commit comments

Comments
 (0)