This repository has been archived by the owner on Apr 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from Viestinta/develop
Develop to Master
- Loading branch information
Showing
44 changed files
with
1,108 additions
and
313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,27 @@ | ||
pipeline: | ||
test: | ||
image: node:7.5.0 | ||
image: viestinta/node:viestinta-test | ||
when: | ||
event: [push,pull_request] | ||
branches: [master, react-start] | ||
environment: | ||
DATABASE_URL: postgres://postgres:[email protected]:5432 | ||
NODE_ENV: test | ||
COVERALLS_REPO_TOKEN: $$COVERALLS_TOKEN | ||
COVERALLS_TOKEN: $$COVERALLS_TOKEN | ||
CODECOV_TOKEN: $$CODECOV_TOKEN | ||
|
||
commands: | ||
- npm install --silent | ||
- cp -a /drone/node_modules /root | ||
- npm install --depth=0 --quiet | ||
- npm install standard -g | ||
- npm install codecov -g | ||
- npm run test | ||
- cat ./coverage/lcov.info | codecov | ||
- cp -a /root/node_modules /drone | ||
volumes: | ||
- "/drone/node_modules" | ||
|
||
deploy: | ||
image: plugins/ssh | ||
when: | ||
|
@@ -18,3 +32,20 @@ pipeline: | |
commands: | ||
- bash /scripts/deploy-viestinta-prod.sh | ||
|
||
services: | ||
postgres: | ||
image: postgres:9.6 | ||
container_name: viestinta_postgres | ||
ports: | ||
- "5432:5432" | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: viestintacentos | ||
POSTGRES_DB: viestintadb_dev | ||
|
||
cache: | ||
mount: | ||
- /drone/node_modules | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number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XMKCgoK.Rs-UC3geCk_5gYUXlbmTIsNXGdBYZIsgEVQdYj_TZn0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
var path = require('path'); | ||
|
||
module.exports = { | ||
'config': path.resolve('./', 'config/config.js'), | ||
'migrations-path': path.resolve('./', 'server/migrations'), | ||
'seeders-path': path.resolve('./', 'server/seeders'), | ||
'models-path': path.resolve('./', 'server/models') | ||
}; | ||
'config': path.resolve('./', 'src/server/database/config/config.js'), | ||
'migrations-path': path.resolve('./', 'src/server/database/migrations'), | ||
'seeders-path': path.resolve('./', 'src/server/database/seeders'), | ||
'models-path': path.resolve('./', 'src/server/database/models') | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
version: '3' | ||
|
||
services: | ||
postgres: | ||
image: postgres:9.6 | ||
container_name: viestinta_postgres | ||
ports: | ||
- "5432:5432" | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: viestintacentos | ||
POSTGRES_DB: viestintadb_dev | ||
tty: true | ||
stdin_open: true | ||
|
||
nodejs: | ||
build: . | ||
image: node:viestinta | ||
container_name: viestinta_node | ||
depends_on: | ||
- postgres | ||
command: ["./wait-for-postgres.sh", "--", "npm" , "test"] | ||
links: | ||
- postgres | ||
ports: | ||
- "8000:8000" | ||
volumes: | ||
- .:/srv/app/ | ||
- /arv/app/node_modules | ||
environment: | ||
DATABASE_URL: postgres://postgres:viestintacentos@postgres:5432/viestintadb_dev | ||
NODE_ENV: test | ||
tty: true | ||
stdin_open: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,67 @@ | ||
import React, { Component } from 'react' | ||
import socket from '../../server/socket' | ||
|
||
// Theme | ||
import {deepOrange500} from 'material-ui/styles/colors' | ||
import getMuiTheme from 'material-ui/styles/getMuiTheme' | ||
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider' | ||
|
||
// Components | ||
import ChatBox from './ChatBox' | ||
import ChatField from './ChatField' | ||
import MessageList from './MessageList' | ||
import Header from './Header' | ||
import Login from './Login' | ||
import FeedbackBox from './FeedbackBox' | ||
|
||
const styles = { | ||
container: { | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
paddingTop: 0, | ||
height: 'auto', | ||
}, | ||
element: { | ||
display: 'flex', | ||
} | ||
}; | ||
|
||
const muiTheme = getMuiTheme({ | ||
palette: { | ||
primary1Color: '#ec7c2f', // Orange | ||
accent1Color: '#2daae4', // Blue | ||
} | ||
}) | ||
|
||
export default class ChatApp extends Component { | ||
// At beginning there is no msg and the text-field is empty | ||
constructor (props) { | ||
super(props) | ||
this.state = { | ||
messages: [], | ||
text: '', | ||
socket: io.connect() | ||
} | ||
|
||
this.sendMessage = this.sendMessage.bind(this) | ||
this.join = this.join.bind(this) | ||
this.receiveMessage = this.receiveMessage.bind(this) | ||
} | ||
|
||
componentDidMount () { | ||
this.state.socket.on('join', this.join) | ||
this.state.socket.on('send-message', this.sendMessage) | ||
this.state.socket.on('receive-message', this.receiveMessage) | ||
socket.on('join', this.join) | ||
} | ||
|
||
join () { | ||
console.log('join') | ||
this.state.socket.emit('join', 'Hello world from client') | ||
} | ||
|
||
receiveMessage (msg) { | ||
console.log('receiveMessage: ', msg.text) | ||
this.state.messages.push(msg) | ||
this.setState({ messages: this.state.messages }) | ||
} | ||
|
||
// When a message is submitted | ||
sendMessage (msg) { | ||
console.log('sendMessage: ', msg.text) | ||
this.state.socket.emit('new-message', msg) | ||
socket.emit('join', 'Hello world from client') | ||
} | ||
|
||
render () { | ||
return ( | ||
<div id='content'> | ||
<Header /> | ||
<Login /> | ||
<ChatField | ||
messages={this.state.messages} /> | ||
<ChatBox | ||
sendMessage={this.sendMessage} /> | ||
</div> | ||
<MuiThemeProvider muiTheme={muiTheme}> | ||
<div style={styles.container}> | ||
<Header /> | ||
<Login /> | ||
{/* List of messages */} | ||
<MessageList /> | ||
{/* Inputfield for user */} | ||
<ChatBox /> | ||
{/* Sidebar with feedback-options */} | ||
<FeedbackBox /> | ||
</div> | ||
</MuiThemeProvider> | ||
) | ||
} | ||
} |
Oops, something went wrong.