Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ee39c7f
delete toolbox and update components and new styles
Aug 28, 2016
5a49f3e
update styles and add card styles
Aug 29, 2016
a96804a
update dependencies
rrequero Aug 29, 2016
a91de8d
add table, plugins and dashboard styles
Sep 1, 2016
92d6974
update styles
Sep 6, 2016
3117a20
update styles
Sep 6, 2016
7485681
fix text o tables
Sep 6, 2016
b912bef
update styles and logic
Sep 13, 2016
3960d82
add funcionality
rrequero Sep 15, 2016
c3903ef
update styles and logic
Sep 16, 2016
bcc1d82
Merge branch 'feature/style-interface' of https://github.com/control-…
Sep 16, 2016
c408268
-
rrequero Sep 16, 2016
d958466
Merge branch 'feature/style-interface' of github.com:control-tower/ct…
rrequero Sep 16, 2016
6153eda
update styles and logic
Sep 19, 2016
9737ec9
Merge branch 'feature/style-interface' of https://github.com/control-…
Sep 19, 2016
3c00153
update styles and logic
Sep 20, 2016
2822ed3
add loading
rrequero Sep 21, 2016
f6b7c91
change styles
Sep 21, 2016
c8ac600
change styles
Sep 21, 2016
698ca07
update logic and styles on dashboarad page
Oct 1, 2016
bd61bf9
add numbers section on dashboard page
Oct 2, 2016
04fdff0
update table styles
Oct 2, 2016
10ba06b
update svgs images
Oct 2, 2016
d836faa
add icons and data
rrequero Oct 3, 2016
6cc467f
limit trequest by time
rrequero Oct 3, 2016
563e894
change index route
rrequero Oct 3, 2016
2c856af
update map countries styles
Oct 3, 2016
fa04888
update map countries styles
Oct 3, 2016
212e215
add refactor script
Oct 3, 2016
1e2d6d6
add modal to create new user
Oct 24, 2016
8e64f11
improve modal logi
Oct 24, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"presets": ["es2015", "stage-0", "react"]
"presets": ["es2015", "stage-0", "react"],
"plugins": ["transform-decorators-legacy"]
}
19 changes: 19 additions & 0 deletions .sass-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
rules:
property-sort-order:
- 2
force-element-nesting:
- 0
no-color-literals:
- 2
-
allow-rgba: true
no-url-protocols:
- 0
nesting-depth:
- 2
-
max-depth: 3
files:
ignore:
- 'node_modules/**/*.scss'
- 'node_modules/**/*.sass'
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Manage UI to Control tower api-gateway


[Map Icons by MapGlyphs.com](mapglyphs.com)
Binary file added app/.DS_Store
Binary file not shown.
Binary file added app/assets/.DS_Store
Binary file not shown.
Binary file added app/assets/logo/logoSideBar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions app/assets/maps/afghanistan.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions app/assets/maps/albania.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions app/assets/maps/ecuador.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions app/assets/maps/usa.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
<head>
<meta charset="utf-8">
<title>Control Tower UI</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet">
<link rel="stylesheet" href="styles.css" media="all" />
</head>
<body>
Expand Down
3 changes: 3 additions & 0 deletions app/src/actions/endpoints.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { BASE_API_URL, GET_ENDPOINTS } from '../constants';
import { showNotification } from './notification';
import { showLoading } from './loading';
import fetch from '../utils/fetch';

export function getEndpoints() {
return (dispatch) => {
dispatch(showLoading(true));
fetch(`${BASE_API_URL}/api/v1/endpoint`, { method: 'GET' }).then((response) => response.json()).then((data) => {
dispatch(showNotification('Endpoints obtained successfully'));
dispatch({ type: GET_ENDPOINTS, payload: data });
dispatch(showLoading(false));
});
};
}
7 changes: 7 additions & 0 deletions app/src/actions/loading.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { SET_VISIBLE } from '../constants';
export function showLoading(visible) {
return {
type: SET_VISIBLE,
payload: visible,
};
}
3 changes: 3 additions & 0 deletions app/src/actions/microservices.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { BASE_API_URL, GET_MICROSERVICES } from '../constants';
import { showNotification } from './notification';
import { showLoading } from './loading';
import fetch from '../utils/fetch';

export function getMicroservices() {
return (dispatch) => {
dispatch(showLoading(true));
fetch(`${BASE_API_URL}/api/v1/microservice`, { method: 'GET' }).then((response) => response.json()).then((data) => {
dispatch(showNotification('Microservices obtained successfully'));
dispatch({ type: GET_MICROSERVICES, payload: data });
dispatch(showLoading(false));
});
};
}
14 changes: 8 additions & 6 deletions app/src/actions/notification.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { SHOW_NOTIFICATION, CLEAR_NOTIFICATION } from '../constants';

export function showNotification(message) {
return { type: SHOW_NOTIFICATION, payload: message };
}
return {
type: 'GROWLER__SHOW',
growler: {
text: message,
type: 'growler--success',
}
};


export function clearNotification() {
return { type: CLEAR_NOTIFICATION };
}
21 changes: 21 additions & 0 deletions app/src/actions/plugins.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import { BASE_API_URL, GET_PLUGINS } from '../constants';
import { showNotification } from './notification';
import { showLoading } from './loading';
import fetch from '../utils/fetch';

export function getPlugins() {
return (dispatch) => {
dispatch(showLoading(true));
fetch(`${BASE_API_URL}/api/v1/plugin`, { method: 'GET' }).then((response) => response.json()).then((data) => {
dispatch({ type: GET_PLUGINS, payload: data });
dispatch(showLoading(false));
});
};
}

export function updatePlugin(id, plugin) {
return (dispatch) => {
dispatch(showLoading(true));
fetch(`${BASE_API_URL}/api/v1/plugin/${id}`, {
method: 'PATCH',
body: JSON.stringify(plugin),
Expand All @@ -21,6 +25,23 @@ export function updatePlugin(id, plugin) {
}).then((response) => response.json()).then(() => {
dispatch(showNotification('Plugin updated successfully'));
dispatch(getPlugins());
dispatch(showLoading(false));
});
};
}

export function flushCache() {
return (dispatch) => {
dispatch(showLoading(true));
fetch(`${BASE_API_URL}/cache/flush`, {
method: 'GET',
}).then((response) => {
if (response.ok) {
dispatch(showNotification('Cache Flushed!'));
} else {
dispatch(showNotification('Error Flush cache'));
}
dispatch(showLoading(false));
});
};
}
28 changes: 24 additions & 4 deletions app/src/actions/stadistics.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { BASE_API_URL, GET_STADISTICS, GET_TIME_BY_REQUEST_STADISTICS } from '../constants';
import { BASE_API_URL, GET_STADISTICS } from '../constants';
import { showNotification } from './notification';
import { showLoading } from './loading';
import fetch from '../utils/fetch';

function formatDate(date) {
Expand All @@ -15,23 +16,42 @@ function orderRequestByDay(r1, r2) {
return r1d - r2d;
}

function orderRequestByNum(r1, r2) {
return r2.count - r1.count;
}

function orderRequestBySum(r1, r2) {
return r2.sum - r1.sum;
}


export function getStadistics(fromDate, toDate) {
return (dispatch) => {
dispatch(showLoading(true));
const from = formatDate(fromDate);
const to = formatDate(toDate);

const promises = [];
promises.push(fetch(`${BASE_API_URL}/api/v1/stadistic/timeByRequest?from=${from}&to=${to}`, { method: 'GET' }).then((response) => response.json()));
promises.push(fetch(`${BASE_API_URL}/api/v1/stadistic/avgByRequest?from=${from}&to=${to}`, { method: 'GET' }).then((response) => response.json()));
promises.push(fetch(`${BASE_API_URL}/api/v1/stadistic/requestByDay?from=${from}&to=${to}`, { method: 'GET' }).then((response) => response.json()));
promises.push(fetch(`${BASE_API_URL}/api/v1/stadistic/countRequestToday`, { method: 'GET' }).then((response) => response.json()));
promises.push(fetch(`${BASE_API_URL}/api/v1/stadistic/countRequestLastWeek`, { method: 'GET' }).then((response) => response.json()));
promises.push(fetch(`${BASE_API_URL}/api/v1/stadistic/countRequestTodayByCountry`, { method: 'GET' }).then((response) => response.json()));

Promise.all(promises).then((data) => {
dispatch(showNotification('Stadistics obtained successfully'));
dispatch({ type: GET_STADISTICS, payload: {
timeByRequest: data[0],
timeByRequest: data[0].sort(orderRequestBySum),
requestByDay: data[1].sort(orderRequestByDay),
countRequestToday: data[2],
countRequestLastWeek: data[3],
countRequestTodayByCountry: data[4].sort(orderRequestByNum),
} });
}, () => dispatch(showNotification('Error obtaining stadistics')));
dispatch(showLoading(false));
}, () => {
dispatch(showNotification('Error obtaining stadistics'));
dispatch(showLoading(false));
});

};
}
5 changes: 5 additions & 0 deletions app/src/actions/users.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import { BASE_API_URL, GET_USERS } from '../constants';
import { showNotification } from './notification';
import { showLoading } from './loading';
import fetch from '../utils/fetch';

export function getUsers() {
return (dispatch) => {
dispatch(showLoading(true));
fetch(`${BASE_API_URL}/auth/user`, { method: 'GET' }).then((response) => response.json()).then((data) => {
dispatch(showNotification('Users obtained successfully'));
dispatch({ type: GET_USERS, payload: data });
dispatch(showLoading(false));
});
};
}

export function updateUser(id, user) {
return (dispatch) => {
dispatch(showLoading(true));
fetch(`${BASE_API_URL}/auth/user/${id}`, {
method: 'PATCH',
body: JSON.stringify(user),
Expand All @@ -22,6 +26,7 @@ export function updateUser(id, user) {
}).then((response) => response.json()).then(() => {
dispatch(showNotification('User updated successfully'));
dispatch(getUsers());
dispatch(showLoading(false));
});
};
}
57 changes: 11 additions & 46 deletions app/src/components/appView.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import React, { PropTypes } from 'react';
import {
AppBar,
IconButton,
Layout,
NavDrawer,
Panel,
Navigation,
Button,
} from 'react-toolbox';
import menu from '../../styles/menu';
import generalStyles from '../../styles/general';
import Notification from '../containers/notification';
import SideBar from '../containers/sideBar/sideBar';
import Loading from '../components/loading';
import { GrowlerContainer } from 'flash-notification-react-redux';

class AppView extends React.Component {

Expand All @@ -27,7 +18,6 @@ class AppView extends React.Component {
componentWillUpdate(nextProps) {
if (nextProps.login.correct === false && this.props.login.correct !== nextProps.login.correct) {
this.props.goToLogin();

}
}

Expand All @@ -43,40 +33,13 @@ class AppView extends React.Component {

render() {
return (
<Layout>
<NavDrawer active={this.state.drawerActive} pinned={this.state.drawerPinned} permanentAt="xxxl" onOverlayClick={this.toggleDrawerActive}>
<AppBar>
Menu
</AppBar>
<Navigation type="vertical" className={menu.listMenu}>
{this.props.login.user && this.props.login.user.role === 'ADMIN' && <Button label="Dashboard" icon="timeline" onClick={() => this.props.push('dashboard')} />}
{this.props.login.user && this.props.login.user.role === 'ADMIN' && <Button label="Plugins" icon="extension" onClick={() => this.props.push('plugins')} />}
{this.props.login.user && this.props.login.user.role === 'ADMIN' && <Button label="Microservices" icon="cloud" onClick={() => this.props.push('microservices')} />}
{this.props.login.user && this.props.login.user.role === 'ADMIN' && <Button label="Endpoints" icon="navigation" onClick={() => this.props.push('endpoints')} />}
{this.props.login.user && this.props.login.user.role === 'ADMIN' && <Button label="Users" icon="account_circle" onClick={() => this.props.push('users')} />}
{this.props.login.user && <Button label="Profile" icon="face" onClick={() => this.props.push('profile')} />}
{this.props.login.user && <Button label="Logout" icon="lock_open" onClick={() => this.logout()} />}
{!this.props.login.user && <Button label="Login" icon="lock_outline" onClick={() => this.props.push('login')} />}
</Navigation>
</NavDrawer>
<Panel>
<AppBar>
<IconButton icon="menu" inverse onClick={this.toggleDrawerActive} />
<h3>Api Gateway</h3>
</AppBar>
<div
style={{
flex: 1,
overflowY: 'auto',
padding: '3.5rem 6rem',
}}
>
{this.props.children}
</div>
<Notification />
</Panel>
<div>
<GrowlerContainer />
{this.props.loading && <Loading />}
<SideBar />
{this.props.children}
</div>

</Layout>
);
}

Expand All @@ -86,8 +49,10 @@ AppView.propTypes = {
children: PropTypes.node,
push: PropTypes.func,
checkLogin: PropTypes.func,
goToLogin: PropTypes.func,
logout: PropTypes.func,
login: PropTypes.object,
loading: PropTypes.bool,
};

export default AppView;
Loading