Skip to content

Commit 5aefde9

Browse files
author
Jayesh
committed
Merge branch 'v0.10.0' of https://github.com/spaceuptech/space-cloud into ee-v0.10.0
2 parents 7a0cb69 + 0547064 commit 5aefde9

File tree

21 files changed

+236
-92
lines changed

21 files changed

+236
-92
lines changed

main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func actionRun(c *cli.Context) error {
167167
}
168168

169169
// Download and host mission control
170-
staticPath, err := initMissionContol("0.9.0")
170+
staticPath, err := initMissionContol(utils.BuildVersion)
171171
if err != nil {
172172
return err
173173
}

mission-control/src/Routes.js

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import UserManagement from './pages/user-management/UserManagement';
77
import DBRules from './pages/database/rules/Rules'
88
import FunctionRules from './pages/functions/rules/Rules'
99
import FileStorageRules from './pages/file-storage/rules/Rules'
10+
import StaticRules from './pages/static/rules/Rules'
1011
import Configure from './pages/configure/configure'
1112
import Overview from './pages/overview/Overview'
1213
import Welcome from "./pages/welcome/Welcome"
@@ -31,6 +32,8 @@ export default () => {
3132
<Route exact path="/mission-control/projects/:projectId/functions/rules" component={FunctionRules} />
3233
<Route exact path="/mission-control/projects/:projectId/file-storage" component={(props) => <Redirect to={`/mission-control/projects/${props.match.params.projectId}/file-storage/rules`} />} />
3334
<Route exact path="/mission-control/projects/:projectId/file-storage/rules" component={FileStorageRules} />
35+
<Route exact path="/mission-control/projects/:projectId/static" component={(props) => <Redirect to={`/mission-control/projects/${props.match.params.projectId}/static/rules`} />} />
36+
<Route exact path="/mission-control/projects/:projectId/static/rules" component={StaticRules} />
3437
<Route exact path="/mission-control/projects/:projectId/configure" component={Configure} />
3538
<Route exact path="/mission-control/projects/:projectId/deploy" component={Deploy} />
3639
<Route exact path="/mission-control/projects/:projectId/plans" component={Plans} />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React from 'react';
2+
import './configure.css';
3+
import { Form, Input, Select, Switch } from 'antd';
4+
import { createFormField } from 'rc-form';
5+
const { Option } = Select;
6+
7+
function StaticConfigureForm(props) {
8+
const { getFieldDecorator } = props.form;
9+
return (
10+
<div className="configure">
11+
<div className="conn-string">Static : </div>
12+
13+
<Form className="conn-form" layout="inline">
14+
<div className="conn-form-options">
15+
<Form.Item label="Enabled" className="switch">
16+
{getFieldDecorator('enabled', { valuePropName: 'checked' })(<Switch size="small" />)}
17+
</Form.Item>
18+
</div>
19+
</Form> <br />
20+
</div>
21+
);
22+
}
23+
24+
const WrappedStaticConfigureForm = Form.create({
25+
mapPropsToFields(props) {
26+
return {
27+
enabled: createFormField({ value: props.formState.enabled })
28+
};
29+
},
30+
onValuesChange(props, changedValues) {
31+
props.handleChange(changedValues);
32+
}
33+
})(StaticConfigureForm);
34+
35+
export default WrappedStaticConfigureForm;

mission-control/src/components/plan/plan.css

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14),
55
0 3px 1px -2px rgba(0, 0, 0, 0.12), 0 1px 5px 0 rgba(0, 0, 0, 0.2);
66
border-radius: 20px;
7+
cursor: pointer;
78
}
89

910
.plan-card > .content {

mission-control/src/components/rules/Rules.jsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Rules extends Component {
1313
constructor(props) {
1414
super(props);
1515
const rules = Object.keys(this.props.rules);
16-
var selectedRule = '';
16+
var selectedRule = null;
1717
if (rules.length > 0) {
1818
selectedRule = rules[0];
1919
}
@@ -26,7 +26,7 @@ class Rules extends Component {
2626
this.setState({ selectedRule: rule });
2727
}
2828
render() {
29-
var rules = Object.keys(this.props.rules);
29+
var rules = this.props.array ? this.props.rules.map((_, index) => (`Rule ${index + 1}`)) : Object.keys(this.props.rules);
3030

3131
return (
3232
<div className="rules-main-wrapper">
@@ -36,14 +36,15 @@ class Rules extends Component {
3636
<Icon className="addIcon" type="plus" /> {this.props.addText}
3737
</div>
3838
<div className="rulesTable">
39-
{rules.map((rule) => {
39+
40+
{rules.map((rule, index) => {
4041
return (
4142
<div
4243
className={`rule ${this.state.selectedRule === rule ? 'selected' : ''}`}
4344
id="rule"
4445
value={rule}
4546
key={rule}
46-
onClick={() => this.handleClick(rule)}
47+
onClick={() => this.handleClick(this.props.array ? index : rule)}
4748
>
4849
{rule}
4950
</div>

mission-control/src/components/select-project/SelectProject.jsx

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import React from 'react'
22
import { connect } from 'react-redux'
3-
import { Link } from "react-router-dom"
43
import { get, set, reset } from 'automate-redux';
54
import service from "../../index";
65
import store from "../../store"
76
import history from "../../history";
8-
import { openProject, notify } from "../../utils"
7+
import { openProject, notify, openPlansPage } from "../../utils"
98

109
import { Modal, Icon, Button, Table } from 'antd'
1110
import Header from "../../components/header/Header"
@@ -51,9 +50,7 @@ function SelectProject(props) {
5150
<Modal className="select-project" footer={null} closable={false} bodyStyle={{ widtht: "800" }}
5251
title={<div className="modal-header">
5352
<Header name="Select a project" />
54-
<Link to="/mission-control/create-project">
55-
<Button type="primary" >Create a project</Button>
56-
</Link>
53+
<Button type="primary" onClick={props.handleCreateProject}>Create a project</Button>
5754
</div>}
5855
visible={props.visible}
5956
onCancel={props.handleCancel}
@@ -92,6 +89,15 @@ const mapStateToProps = (state, ownProps) => {
9289

9390
const mapDispatchToProps = (dispatch, ownProps) => {
9491
return {
92+
handleCreateProject: () => {
93+
const mode = get(store.getState(), "operationConfig.mode", 0)
94+
if (mode < 1) {
95+
openPlansPage()
96+
notify("info", "Info", "You need to upgrade to create multiple projects on the same cluster")
97+
return
98+
}
99+
history.push("/mission-control/create-project")
100+
},
95101
handleDelete: (projectId) => {
96102
service.deleteProject(projectId).then(() => {
97103
notify("success", "Success", "Project deleted successfully")

mission-control/src/components/sidenav/Sidenav.jsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const Sidenav = (props) => {
1111
return(
1212
<div className="sidenav">
1313
<div className="flex-container">
14-
<Header name={props.projectName} color="#000" fontSize="18px" />
14+
<Header name={props.projectId} color="#000" fontSize="18px" />
1515
</div>
1616
<Link to={`/mission-control/projects/${props.projectId}/overview`}>
1717
<SidenavItem name="Project Overview" icon="home" active={props.selectedItem === 'overview'} />
@@ -25,6 +25,9 @@ const Sidenav = (props) => {
2525
<Link to={`/mission-control/projects/${props.projectId}/file-storage`}>
2626
<SidenavItem name="File Storage" icon="folder_open" active={props.selectedItem === 'file-storage'} />
2727
</Link>
28+
<Link to={`/mission-control/projects/${props.projectId}/static`}>
29+
<SidenavItem name="Static Hosting" icon="cloud" active={props.selectedItem === 'static'} />
30+
</Link>
2831
<Link to={`/mission-control/projects/${props.projectId}/functions`}>
2932
<SidenavItem name="Functions" icon="code" active={props.selectedItem === 'functions'} />
3033
</Link>
@@ -48,7 +51,6 @@ const Sidenav = (props) => {
4851
const mapStateToProps = (state, ownProps) => {
4952
return {
5053
projectId: get(state, "config.id", ""),
51-
projectName: get(state, "config.name", ""),
5254
selectedItem: ownProps.selectedItem,
5355
}
5456
}

mission-control/src/components/sidenav/sidenav.css

+1-4
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@
5454
}
5555

5656
.sidenav .flex-container {
57-
display: flex;
58-
align-items: center;
59-
justify-content: space-around;
60-
padding: 40px 0;
57+
padding: 24px;
6158
}
6259

6360
.sidenav .edit {

mission-control/src/components/signin-modal/SigninModal.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const mapDispatchToProps = (dispatch) => {
6969
var user = result.user;
7070
service.oauthLogin(user.uid).then(({ token, user }) => {
7171
localStorage.setItem("space-up-token", token)
72-
const newOperationConfig = Object.assign({}, get(store.getState(), "operationConfig", {}), { email: user.email, key: user.key })
72+
const newOperationConfig = Object.assign({}, get(store.getState(), "operationConfig", {}), { userId: user.id, key: user.key })
7373
service.saveOperationConfig(newOperationConfig).then(() => dispatch(set("operationConfig", newOperationConfig)))
7474
handleSpaceUpLoginSuccess(token)
7575
}).catch(error => {

mission-control/src/components/topbar/Topbar.jsx

+9-5
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ class Topbar extends Component {
3838
{(this.props.showDbSelector) &&
3939
<DbSelector handleSelect={this.props.handleSelect} selectedDb={this.props.selectedDb} />
4040
}
41-
<div className="right-list">
42-
{this.props.mode < 1 && <Button type="primary" className="action-button upgrade-button" onClick={openPlansPage}>UPGRADE</Button>}
43-
{(this.props.save !== "false") &&
41+
{
42+
!this.props.hideActions && <div className="right-list">
43+
{this.props.mode < 1 && <Button type="primary" className="action-button upgrade-button" onClick={openPlansPage}>UPGRADE</Button>}
4444
<Button type="primary" className="action-button save-button" onClick={this.props.handleSave} disabled={!this.props.unsavedChanges}>SAVE</Button>
45-
}
46-
</div>
45+
</div>
46+
}
4747
<SelectProject visible={this.state.modalVisible} handleCancel={() => this.handleModalVisible(false)} />
4848
</div>
4949
</div>
@@ -86,6 +86,10 @@ const mapDispatchToProps = (dispatch, ownProps) => {
8686
if (result.errors.fileStore.length) {
8787
notify("error", 'Error in File Storage config', `Rules - ${result.errors.fileStore.join(", ")}`, 0)
8888
}
89+
90+
if (result.errors.static.length) {
91+
notify("error", 'Error in Static Module config', `Rules - ${result.errors.static.join(", ")}`, 0)
92+
}
8993
return
9094
}
9195

mission-control/src/constants.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ export const defaultDbConnectionStrings = {
1313
export const PAYU_MERCHANT_KEY = "FkS68IbH"
1414

1515
export const SPACE_API_PROJECT = "space-cloud"
16-
export const SPACE_API_URL = "http://localhost:8080"
16+
export const SPACE_API_URL = "https://spaceuptech.com"
1717

mission-control/src/pages/configure/configure.jsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Divider } from 'antd';
99
import RealtimeConfigure from '../../components/configure/RealtimeConfigure';
1010
import FunctionConfigure from '../../components/configure/FunctionConfigure';
1111
import FileStorage from '../../components/configure/FileStorageConfigure';
12+
import StaticConfigure from '../../components/configure/StaticConfigure';
1213
import { get, set } from 'automate-redux';
1314
import store from ".././../store";
1415

@@ -27,6 +28,8 @@ function Rules(props) {
2728
<FunctionConfigure formState={props.functions} handleChange={props.handleFunctionChange} />
2829
<Divider />
2930
<FileStorage formState={props.fileStorage} handleChange={props.handleFileStorageChange} />
31+
<Divider />
32+
<StaticConfigure formState={props.static} handleChange={props.handleStaticChange} />
3033
</div>
3134
</div>
3235
</div>
@@ -38,7 +41,8 @@ const mapStateToProps = (state, ownProps) => {
3841
secret: get(state, "config.secret"),
3942
realtime: get(state, "config.modules.realtime", {}),
4043
functions: get(state, "config.modules.functions", {}),
41-
fileStorage: get(state, "config.modules.fileStore", {})
44+
fileStorage: get(state, "config.modules.fileStore", {}),
45+
static: get(state, "config.modules.static", {})
4246
};
4347
};
4448

@@ -58,6 +62,10 @@ const mapDispatchToProps = (dispatch) => {
5862
handleFileStorageChange: (value) => {
5963
const config = get(store.getState(), "config.modules.fileStore", {})
6064
dispatch(set("config.modules.fileStore", Object.assign({}, config, value)))
65+
},
66+
handleStaticChange: (value) => {
67+
const config = get(store.getState(), "config.modules.static", {})
68+
dispatch(set("config.modules.static", Object.assign({}, config, value)))
6169
}
6270
};
6371
};

mission-control/src/pages/create-project/CreateProject.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class CreateProject extends Component {
4242
const { getFieldDecorator } = this.props.form;
4343
return (
4444
<div className="create-project">
45-
<Topbar save="false" />
45+
<Topbar hideActions />
4646
<div className="content">
4747
<div>
4848
<span>PROJECT NAME</span>
@@ -115,4 +115,4 @@ const mapDispatchToProps = (dispatch) => {
115115
}
116116
}
117117

118-
export default connect(mapDispatchToProps)(WrappedCreateProject);
118+
export default connect(null, mapDispatchToProps)(WrappedCreateProject);

mission-control/src/pages/database/Database.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Topbar from '../../components/topbar/Topbar'
1111
import Documentation from '../../components/documentation/Documentation'
1212
import DatabaseCardList from '../../components/database-card/DatabaseCardList'
1313
import { Redirect } from "react-router-dom";
14-
import { get } from "automate-redux";
14+
import { get, set } from "automate-redux";
1515

1616
function Database(props) {
1717
const cards = [{ graphics: mysql, name: "MySQL", desc: "The world's most popular open source database.", key: "sql-mysql" },
@@ -53,7 +53,7 @@ const mapStateToProps = (state, ownProps) => {
5353
const mapDispatchToProps = (dispatch) => {
5454
return {
5555
handleEnable(key) {
56-
console.log(`Enabled: ${key}`)
56+
dispatch(set(`config.modules.crud.${key}.enabled`, true))
5757
}
5858
}
5959
}

mission-control/src/pages/database/rules/Rules.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const mapDispatchToProps = (dispatch, ownProps) => {
7474
},
7575
handleCreateRule: (ruleName) => {
7676
const defaultRule = {
77-
isRealtimeEnabled: false,
77+
isRealtimeEnabled: true,
7878
rules: {
7979
create: {
8080
rule: "allow"

0 commit comments

Comments
 (0)