Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ source "https://rubygems.org"

gem "cucumber"
gem "cuprite"
gem "rspec"
2 changes: 2 additions & 0 deletions etapes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
modifier etc host
ajouter reverse proxy en local
17 changes: 17 additions & 0 deletions features/duplicate_portfolio.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#language: fr

Fonctionnalité: Dupliquer un portfolio pour un usage privé

Contexte:

Soit "vitraux" le portfolio ouvert
Soit le point de vue "Histoire des religions" rattaché au portfolio "vitraux"
Soit le corpus "Vitraux - Dr. Krieger" rattaché au portfolio "vitraux"

Scénario: Dupliquer un portfolio

Soit l'utilisateur est connecté
Quand on créé une copie du portfolio appelée "undefined" avec le corpus "Vitraux - Dr. Krieger" et le point de vue "Histoire des religions"
Alors le titre affiché est "undefined"
Et un des corpus affichés est "Vitraux - Dr. Krieger"
Et un des points de vue affichés est "Histoire des religions"
2 changes: 1 addition & 1 deletion features/items_with_same_topic.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Scénario:

Soit "vitraux" le portfolio ouvert
Soit "BSS 007" l'item affiché
Quand on choisit la rubrique "Figuration du donateur"
Quand on choisit la rubrique "Figuration du donateur" contenue dans la rubrique "Donateur"
Alors le titre affiché est "VITRAUX"
Et l'item "BSS 007" est affiché
Et l'item "BSS 018" est affiché
Expand Down
30 changes: 29 additions & 1 deletion features/step_definitions/portfolio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Capybara.run_server = false
Capybara.default_driver = :cuprite
Capybara.javascript_driver = :cuprite
Capybara.app_host = "http://localhost:3000"
Capybara.app_host = "http://vitraux.local:3000"
Capybara.default_max_wait_time = 10


Expand Down Expand Up @@ -62,6 +62,13 @@ def getPassword(username)
# On the remote servers
end

Soit("l'utilisateur est connecté") do
find_link(href: '#login').click
fill_in("Nom d'utilisateur", with: "alice")
fill_in("Mot de passe", with: "whiterabbit")
click_on('Confirmer')
end

Soit("{string} le portfolio spécifié dans la configuration") do |portfolio|
case portfolio
when "vitraux"
Expand Down Expand Up @@ -132,10 +139,31 @@ def getPassword(username)
click_on topic
end

Quand("on choisit la rubrique {string} contenue dans la rubrique {string}") do |string, string2|
click_on string
click_on string2
end

Quand("on choisit l'item {string}") do |item|
click_on item
end

def in_modal()
f = find('.modal-content')
end

Quand("on créé une copie du portfolio appelée {string} avec le corpus {string} et le point de vue {string}") do |name, corpus, viewpoint|
case name
when "undefined"
pending "alternate configuration"
else
click_button('alice')
click_link('Dupliquer')
in_modal.fill_in('copyName', with: name)
in_modal.check(corpus)
in_modal.check(viewpoint)
in_modal.click_on('Valider')
in_modal.click_on('Confirmer')
Quand("l'utilisateur exclue la rubrique {string}") do |topic|
click_on topic
end
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@
"dependencies": {
"bootstrap": "^4.1.1",
"hypertopic": "^3.1.4",
"jquery": "^3.4.1",
"js-tree": "^2.0.1",
"json-groupby": "^1.0.2",
"open-iconic": "^1.1.1",
"query-string": "^4.3.4",
"react": "^16.4.0",
"react-autosuggest": "^9.3.4",
"react-bootstrap": "^1.0.0-beta.8",
"react-dom": "^16.4.0",
"react-router-dom": "^4.1.1",
"sort-by": "^1.2.0"
"sort-by": "^1.2.0",
"styled-components": "^4.2.0"
},
"devDependencies": {
"react-scripts": "^3.0.1",
Expand Down
1 change: 1 addition & 0 deletions reverse-proxy/launcher.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sudo sed -i '/^127.0.0.1 localhost/ s/$/ vitraux.local dupp-vitraux.local/' /etc/hosts
18 changes: 18 additions & 0 deletions reverse-proxy/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "reverse-proxy",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"cors": "^2.8.5",
"express": "^4.17.1",
"express-http-proxy": "^1.5.1",
"http-proxy": "^1.17.0"
}
}
21 changes: 21 additions & 0 deletions reverse-proxy/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
var express = require('express')
var cors = require('cors')
const proxy = require('express-http-proxy');

var app = express()

var corsOptions = {
origin: true,
optionsSuccessStatus: 200,
credentials: true
}

app.use(cors(corsOptions));
app.use(proxy('argos2.test.hypertopic.org'));




app.listen(80, function () {
console.log('CORS-enabled web server listening on port 80')
})
37 changes: 28 additions & 9 deletions src/components/Authenticated/Authenticated.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React, { Component } from 'react';
import conf from '../../config/config.json';
import Duplicator from '../Duplication/Duplicator'
import { Dropdown, DropdownButton, ButtonGroup, Button, Form } from 'react-bootstrap';

const SESSION_URI = conf.services[0] + '/_session';

Expand All @@ -18,24 +20,39 @@ class Authenticated extends Component {

render() {
if (this.state.user) {
if(this.props.portfolio){
return (
<div className="Authenticated">
<DropdownButton variant="secondary" alignRight as={ButtonGroup} title={this.state.user} id="bg-nested-dropdown">
<Dropdown.Item eventKey="1" onClick={this.handleLogout}>Se déconnecter</Dropdown.Item>
<Duplicator portfolio={this.props.portfolio} userConnected={this.state.user} viewpoints={this.props.viewpoints} corpora={this.props.corpora}/>
</DropdownButton>
</div>
);
}

return (
<div className="Authenticated"> {this.state.user}
<a href="#logout" onClick={this.handleLogout}>Se déconnecter</a>
<div className="Authenticated">
<DropdownButton variant="secondary" alignRight as={ButtonGroup} title={this.state.user} id="bg-nested-dropdown">
<Dropdown.Item eventKey="1" onClick={this.handleLogout}>Se déconnecter</Dropdown.Item>
</DropdownButton>
</div>
);
}
if (this.state.ask) {
return(
<form className="Authenticated" onSubmit={this.handleLogin}>
<input placeholder="nom d'utilisateur" ref={(x) => this.login = x} />
<input placeholder="mot de passe" ref={(x) => this.password = x} type="password" />
<input type="submit" value="Se connecter" />
</form>
<Form className="FormConnect" onSubmit={this.handleLogin}>
<Form.Control type="text" ref={(x) => this.login = x} placeholder="Nom d'utilisateur" />
<Form.Control type="password" ref={(x) => this.password = x} placeholder="Mot de passe" />
<Button variant="secondary" type="submit">
Confirmer
</Button>
</Form>
);
}
return (
<div className="Authenticated">
<a href="#login" onClick={this.handleAsk}>Se connecter...</a>
<Button href="#login" onClick={this.handleAsk} variant="secondary">Se connecter</Button>
</div>
);
}
Expand Down Expand Up @@ -82,7 +99,9 @@ class Authenticated extends Component {

_closeSession() {
fetch(SESSION_URI, {method:'DELETE', credentials:'include'})
.then(() => this.setState({user: ''}));
.then(() => {
this.setState({user: ''})
});
}

componentDidMount() {
Expand Down
Loading