Fakultas Ilmu Komputer UI

Commit 5c921954 authored by zamil majdy's avatar zamil majdy
Browse files

Merge branch 'UserStory2' into 'develop'

User story2

See merge request !1
parents 118965f1 dfc575b6
{
"extends": "airbnb",
"env": {
"amd": true,
"browser": true,
"es6": true,
"node": true,
"jest": true
},
"rules": {
"func-names": ["error", "never"],
"react/prefer-stateless-function": [0, { "ignorePureComponents": true }],
"react/forbid-prop-types": [0],
"import/extensions": ["off", "never"],
"import/no-unresolved": 0,
"no-underscore-dangle" : 0,
"linebreak-style" : 0,
"no-extra-bind" : 0
},
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module"
}
}
\ No newline at end of file
node_modules
*.pyc
.pyc
venv
assets/bundles/*
.idea
webpack-stats.json
node_modules
*.pyc
.pyc
venv
assets/bundles/*
.idea
webpack-stats.json
.npm
.bash_history
.cache
test/*
.coverage
.tmp/
npm-debug.log
test:
script:
- apt-get install -f
- apt-get update -qy
- apt-get install -y python-dev python-pip sudo postgresql postgresql-client libpq-dev libxss1 libappindicator1 libindicator7
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
- sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
- apt-get update
- apt-get install -y google-chrome-stable
- export CHROME_BIN=/usr/bin/google-chrome
- curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
- sudo apt-get install -y nodejs
- npm install
- npm run build-production
- service postgresql start
- sudo -u postgres psql -c "CREATE USER kape WITH PASSWORD 'kape' CREATEDB"
- sudo -u postgres psql -c "CREATE DATABASE kape OWNER kape"
- pip install -r requirements.txt
- python manage.py migrate
- python manage.py test
- npm run karma
artifacts:
paths:
- test/
pages:
stage: deploy
dependencies:
- test
script:
- mv test/ public/
artifacts:
paths:
- public
expire_in: 30 days
staging:
type: deploy
script:
- apt-get update -qy
- apt-get install sshpass
- git clone https://gitlab.com/PPL2017csui/PPLA1.git
- cd PPLA1
- git checkout develop
- git pull
- git remote add deployment ssh://kape@bot.recruit.id:8023/home/kape.git
- mkdir ~/.ssh
- echo -e "Host bot.recruit.id\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- sshpass -p yukcarikape git push deployment develop:master --force
only:
- develop
production:
type: deploy
script:
- apt-get update -qy
- apt-get install sshpass
- git clone https://gitlab.com/PPL2017csui/PPLA1.git
- cd PPLA1
- git checkout master
- git pull
- git remote add deployment ssh://kape@bot.recruit.id:8022/home/kape.git
- mkdir ~/.ssh
- echo -e "Host bot.recruit.id\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- sshpass -p yukcarikape git push deployment master:master --force
only:
- master
\ No newline at end of file
var testsContext = require.context("../../assets/js/__test__", false);
var runnable = testsContext.keys();
runnable.forEach(testsContext);
\ No newline at end of file
......@@ -17,8 +17,6 @@
* `create database kape;` to create database.
* `python manage.py migrate` To migrate all the database
Now go to localhost:8000 and you'll see the App running!
## Run Development Mode App
* `npm run webpack`
......@@ -26,4 +24,11 @@ Now go to localhost:8000 and you'll see the App running!
### Now go to localhost:8000 and you'll see the App running!
# Deployment
* Clone this repository
* Install docker, you can do this manually or using `bash /provision/setup-docker.sh`
* Deploy using `bash /provision/run-docker.sh DOCKERNAME APP_PORT SSH_PORT` for example `bash /provision/run-docker.sh staging 8000 8022`
* Profit
This project uses [Django Webpack Loader](https://github.com/owais/django-webpack-loader).
body{
padding: 0;
height: auto;
width: auto;
background-color: black;
}
.center{
text-align: center;
}
* {
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
}
body {
font: 300 14px/1.4 'Helvetica Neue', Helvetica, Arial, sans-serif;
margin: 0;
padding: 0;
}
.halamanLowongan{
}
.tabs {
margin-top: 100px;
margin-left: 150px;
margin-right: 150px;
background: #fff;
border: 1px solid #e5e5e5;
border-radius: 3px;
margin-bottom: 30px;
}
.tabs__labels {
margin: 0;
padding: 0;
}
.tabs__labels li {
display: inline-block;
}
.tabs__labels li a {
padding: 8px 12px;
display: block;
color: #444;
text-decoration: none;
border-bottom: 2px solid #f5f5f5;
}
.tabs__labels li a.active {
border-bottom-color: #337ab7;
}
.tabs__content {
padding: 25px;
}
.halamanLogin{
background-image: url("../img/bw.jpg");
background-size: cover;
background-position: center;
background-attachment: fixed;
height: 700px;
}
.register{
margin-left:180px;
margin-right:110px;
}
.formLogin{
margin: 0 auto;
margin-top: 100px;
width: 430px;
border: 2px solid transparent;
border-radius: 12px;
border-color:#e8e8e8;
padding: 20px;
background-color: white;
}
.registerModal{
margin: 0 auto;
}
.bookmark{
float: right;
}
.formLogin img{
height: 70px !important;
margin:5px;
margin-bottom:30px;
}
.formLogin span{
font-size: 32px;
}
.formLogin span{
margin-left: 5px;
}
.LoginPage{
height: 700px;
}
.input{
margin-top: 5px;
}
.daftar{
float: right;
margin-top:10px;
}
.coverLetter{
margin-top:30px;
}
.linkCV{
float: right;
margin-top: 30px;
margin-bottom: 10px;
}
.registerForm{
margin: 0 auto;
padding:50px;
background-color: #3B8686;
}
item{
color:black;
}
textarea{
width: 800px !important;
height: 160px !important;
}
.note {
color: gray;
margin: 8px 0;
}
input.active:valid {
box-shadow: 0 0 5px 1px green;
}
input.active:invalid {
box-shadow: 0 0 5px 1px red;
}
.error {
color: red;
font-size: 12px;
margin-top: 5px;
}
card .formRegis{
margin-top: 100px;
}
itemLowongan{
color: black;
}
import React from 'react';
import TopMenu from './components/TopMenu';
export default class Dashboard extends React.Component {
static propTypes = {
children: React.PropTypes.oneOfType([
React.PropTypes.arrayOf(React.PropTypes.node),
React.PropTypes.node,
]).isRequired,
};
render = () => (
<div>
<TopMenu />
{this.props.children}
</div>
)
}
import React from 'react';
import { Grid, Segment, Card } from 'semantic-ui-react';
import LoginForm from './components/LoginForm';
import RegisterModal from './components/RegisterModal';
export default class Login extends React.Component {
static defaultProps = {
children: null,
};
static propTypes = {
children: React.PropTypes.oneOfType([
React.PropTypes.arrayOf(React.PropTypes.node),
React.PropTypes.node,
]),
};
render = () => (
<div className="halamanLogin">
<Grid columns={2} relaxed>
<Grid.Column>
<Segment basic>
<LoginForm type="company" header="Company Login" imgSrc="logo.png" imgSize="small" />
{this.props.children}
</Segment >
<div className="register">
<Card>
<Card.Content>
<Card.Header>
New to us ?
</Card.Header>
<RegisterModal />
</Card.Content>
</Card>
</div>
</Grid.Column>
<Grid.Column>
<Segment basic>
<LoginForm type="sso-ui" header="SSO Login" imgSrc="UI.png" imgSize="tiny" />
{this.props.children}
</Segment>
</Grid.Column>
</Grid>
</div>
)
}
import React from 'react';
import Tabs from './components/Tabs';
import Pane from './components/Pane';
import Storage from './lib/Storage';
import VacancyList from './components/VacancyList';
export default class VacancyPage extends React.Component {
constructor(props) {
super(props);
/* istanbul ignore next */
this.state = {
email: '',
password: '',
errorFlag: false,
vacancies: [],
};
this.handleItemClick = this.handleItemClick.bind(this);
}
handleItemClick = (e, { name }) => this.setState({ activeItem: name });
render() {
const student = Storage.get('user-data').student;
return (
<div className="halamanLowongan">
<Tabs selected={0}>
<Pane label="Semua Lowongan" >
<VacancyList key={1} studentId={student.id} url="/vacancies/" />
</Pane>
<Pane label="Lamaran saya" >
<VacancyList key={2} status="Batal" studentId={student.id} url={`/students/${student.id}/applied-vacancies/`} />
</Pane>
<Pane label="Lamaran Ditandai" >
<VacancyList key={3} studentId={student.id} url={`/students/${student.id}/bookmarked-vacancies/`} />
</Pane>
</Tabs>
</div>
);
}
}
/* eslint-disable no-unused-expressions */
import React from 'react';
import ReactTestUtils from 'react-addons-test-utils';
import ApplyModal from '../../components/ApplyModal';
describe('ApplyModal', () => {
it('renders without problem', () => {
const modalPendaftaran = ReactTestUtils.renderIntoDocument(
<ApplyModal id={4} data={{key: 'value'}} buttonTitle="submit" />);
expect(modalPendaftaran).to.exist;
});
it('open without problem', () => {
const modalPendaftaran = ReactTestUtils.renderIntoDocument(
<ApplyModal id={4} data={{ key: 'value' }} buttonTitle="submit" />);
const modal = ReactTestUtils.findRenderedDOMComponentWithTag(modalPendaftaran, 'Button');
ReactTestUtils.Simulate.click(modal);
});
it('change without problem', () => {
const modalPendaftaran = ReactTestUtils.renderIntoDocument(
<ApplyModal id={4} data={{ key: 'value' }} buttonTitle="submit" />);
modalPendaftaran.handleChange({ target: { value: 'duar' } });
expect(modalPendaftaran.state.coverLetter).to.equal('duar');
});
it('close without problem', () => {
const modalPendaftaran = ReactTestUtils.renderIntoDocument(
<ApplyModal id={4} data={{ key: 'value' }} buttonTitle="submit" />);
modalPendaftaran.handleClose();
expect(modalPendaftaran.state.modalOpen).to.equal(false);
});
});
/* eslint-disable no-unused-expressions */
import React from 'react';
import ReactTestUtils from 'react-addons-test-utils';
import CancelModal from '../../components/CancelModal';
import Storage from '../../lib/Storage';
describe('CancelModal', () => {
it('renders without problem', () => {
const modalPendaftaran = ReactTestUtils.renderIntoDocument(
<CancelModal id={4} />);
expect(modalPendaftaran).to.exist;
});
it('open without problem', () => {
const modalPendaftaran = ReactTestUtils.renderIntoDocument(
<CancelModal id={4} />);
const modal = ReactTestUtils.findRenderedDOMComponentWithTag(modalPendaftaran, 'Button');
ReactTestUtils.Simulate.click(modal);
expect(modalPendaftaran.state.modalOpen).to.equal(true);
});
it('close without problem', () => {
const modalPendaftaran = ReactTestUtils.renderIntoDocument(
<CancelModal id={4} />);
modalPendaftaran.handleClose();
expect(modalPendaftaran.state.modalOpen).to.equal(false);
});
it('remove vacancy without problem', () => {
const modalPendaftaran = ReactTestUtils.renderIntoDocument(
<CancelModal id={4} />);
const response3 = { student: { id: 1, name: 2 } };
Storage.set('user-data', response3);
modalPendaftaran.removeVacancy();
expect(modalPendaftaran.state.header).to.exist;
});
it('confirm without problem', () => {
const fetchMock = require('fetch-mock');
fetchMock.delete('*', { data: 'value' });
const modalPendaftaran = ReactTestUtils.renderIntoDocument(
<CancelModal id={4} />);
modalPendaftaran.confirm();
expect(modalPendaftaran.state.header).to.equal('Permintaan gagal');
});
it('render next modal without problem', () => {
const fetchMock = require('fetch-mock');
fetchMock.delete('*', { data: 'value' });
const modalPendaftaran = ReactTestUtils.renderIntoDocument(
<CancelModal id={4} />);
modalPendaftaran.state.confirmed = true;
modalPendaftaran.forceUpdate()
expect(modalPendaftaran).to.exist;
});
});
// /* eslint-disable no-unused-expressions */
// import React from 'react';
// import ReactTestUtils from 'react-addons-test-utils';
// import Vacancy from '../components/ComponentRegister';
//
// describe('Vacancy', () => {
// it('renders without problem', () => {
// let companyRegister = ReactTestUtils.renderIntoDocument(
// <CompanyRegister />);
// expect(companyRegister).to.exist;
//
// });
// });
\ No newline at end of file
/* eslint-disable no-unused-expressions */
import React from 'react';
import ReactTestUtils from 'react-addons-test-utils';
import LoginForm from '../../components/LoginForm';
describe('LoginForm', () => {
const fetchMock = require('fetch-mock');
it('created without problem', () => {
const formLogin = new LoginForm({ url: 'tes' });
expect(formLogin).to.be.an.instanceof(LoginForm);
});
it('renders without problem', () => {
const formLogin = ReactTestUtils.renderIntoDocument(
<LoginForm url="" />);
expect(formLogin).to.exist;
const formDiv = ReactTestUtils.findRenderedDOMComponentWithClass(
formLogin, 'formLogin');
expect(formDiv).to.exist;
const form = ReactTestUtils.findRenderedDOMComponentWithTag(
formLogin, 'form');
expect(form).to.exist;
});
it('handle email input without problem', () => {
const formLogin = ReactTestUtils.renderIntoDocument(
<LoginForm type="sso-ui" />);
expect(formLogin.state.username).to.equal('');
const emailNode = ReactTestUtils.scryRenderedDOMComponentsWithTag(formLogin, 'Input')[0];
// const emailNode = ReactDOM.findDOMNode(formLogin.refs.email);
const email = 'jojon';
emailNode.value = email;
ReactTestUtils.Simulate.change(emailNode, { target: { value: email } });
expect(emailNode.value).to.equal(email);
expect(formLogin.state.username).to.equal(email);
});
it('handle password input without problem', () => {
const formLogin = ReactTestUtils.renderIntoDocument(
<LoginForm type="sso-ui" />);