Commit 367ac2e5 authored by Bruno López Trigo's avatar Bruno López Trigo

Solucionado problema HTTPS e modificada a explicación

parent 2c8d3d0a
......@@ -408,18 +408,25 @@ public class Explainer implements ExplainerInterface {
subject.clear();
object.clear();
boolean first = true;
for (String a : antecedents.get(i)) {
subject.add(a);
if(first){
subject.add("its " + a);
first = false;
}
else{
subject.add(a);
}
usualValues += df.format(this.extractor.usualValue(s, a)) + ", ";
}
complement.add("(" + usualValues.substring(0, usualValues.length()-2) + ")");
if (subject.size() > 1) {
object.add("quite close to the usual " + s + " values");
object.add("quite close to the split values ");
phrases.add(this.cbuilder.generateClause(tmpPhrase, this.cbuilder.generateClause(subject, "be", object, complement, true), "because"));
} else {
object.add("quite close to the usual " + s + " value");
object.add("quite close to the split value");
phrases.add(this.cbuilder.generateClause(tmpPhrase, this.cbuilder.generateClause(subject, "be", object, complement, false), "because"));
}
......
......@@ -305,7 +305,7 @@ public class InfoExtractor {
}
}
if (!found && rule.getConsequent().getCode() != this.solution.getRules().get(0).getConsequent().getCode()) {
for (Consequent c : rule.getConsequent().getMistakes()) {
/*for (Consequent c : rule.getConsequent().getMistakes()) {
if (c.getCode() == this.solution.getRules().get(0).getConsequent().getCode()) {
Property p = this.problem.getConfig().getPropertyTree(c.getPercentage_global());
add = probs.get(p.getValueTxt());
......@@ -318,8 +318,17 @@ public class InfoExtractor {
probs.put(p.getValueTxt(), add);
break;
}
}*/
Property p = this.problem.getConfig().getPropertyTree(0f);
add = probs.get(p.getValueTxt());
if (add != null){
add.add(rule.getConsequent().getText());
}
else{
add = new ArrayList<>();
add.add(rule.getConsequent().getText());
}
probs.put(p.getValueTxt(), add);
}
found = false;
}
......@@ -347,8 +356,8 @@ public class InfoExtractor {
for (int i = 1; i < this.solution.getRules().size(); i++) {
if (consequent.equals(this.solution.getRules().get(i).getConsequent().getText())) {
for (Antecedent a : this.solution.getRules().get(i).getAntecedents()) {
if (a.getAttribute().getName().toLowerCase().equals(attribute)) {
return a.getAttribute().getValue();
if (a.getAttribute().getValueTxt().toLowerCase().equals(attribute)) {
return a.getAttribute().getSplitValue();
}
}
}
......
......@@ -38,6 +38,8 @@ public class Attribute {
private float minValue;
@XmlTransient
private boolean modified;
@XmlTransient
private float splitValue;
@XmlElementWrapper(name="properties")
@XmlElement(name="property")
@JsonView(Views.Collection.class)
......@@ -184,6 +186,14 @@ public class Attribute {
public void setMinValue(float minValue) {
this.minValue = minValue;
}
public void setSplitValue(float splitValue) {
this.splitValue = splitValue;
}
public float getSplitValue() {
return splitValue;
}
}
......@@ -66,6 +66,7 @@ public class Problem {
old = p.getAttributes().get(i);
modified = attributes.get(i);
this.attributes.add(new Attribute(old.getName(), old.getValueTxt(), modified.getValue(), old.getMaxValue(), old.getMinValue(), modified.isModified(), old.getProperties()));
this.attributes.get(this.attributes.size()-1).setSplitValue(modified.getSplitValue());
}
this.consequents = new ArrayList<>();
for(Consequent c: p.getConsequents())
......
......@@ -84,6 +84,7 @@ public class RuleBuilder {
for (Attribute a : p.getAttributes()) {
if (a.getName().equals(attribute.getName())) {
attributes.add(new Attribute(attribute.getName(), attribute.getValueTxt(), valueMargin, true));
attributes.get(attributes.size() - 1).setSplitValue(n.getValue());
} else {
attributes.add(a);
}
......@@ -108,6 +109,7 @@ public class RuleBuilder {
for (Attribute a : p.getAttributes()) {
if (a.getName().equals(attribute.getName())) {
attributes.add(new Attribute(attribute.getName(), attribute.getValueTxt(), valueMargin, true));
attributes.get(attributes.size() - 1).setSplitValue(n.getValue());
} else {
attributes.add(a);
}
......
......@@ -260,37 +260,37 @@
<consequent>
<code>1</code>
<name>build wind float</name>
<text>build wind float</text>
<text>Building_windows_float_processed</text>
</consequent>
<consequent>
<code>2</code>
<name>build wind non-float</name>
<text>build wind non-float</text>
<text>Building_windows_non_float_processed</text>
</consequent>
<consequent>
<code>3</code>
<name>vehic wind float</name>
<text>vehic wind float</text>
<text>Vehicle_windows_float_processed</text>
</consequent>
<consequent>
<code>4</code>
<name>vehic wind non-float</name>
<text>vehic wind non-float</text>
<text>Vehicle_windows_non_float_processed</text>
</consequent>
<consequent>
<code>5</code>
<name>containers</name>
<text>containers</text>
<text>Containers</text>
</consequent>
<consequent>
<code>6</code>
<name>tableware</name>
<text>tableware</text>
<text>Tableware</text>
</consequent>
<consequent>
<code>7</code>
<name>headlamps</name>
<text>headlamps</text>
<text>Headlamps</text>
</consequent>
</consequents>
</problem>
\ No newline at end of file
......@@ -118,17 +118,17 @@
<consequent>
<code>1.0</code>
<name>1.0</name>
<text>1.0</text>
<text>Setosa</text>
</consequent>
<consequent>
<code>2.0</code>
<name>2.0</name>
<text>2.0</text>
<text>Virginica</text>
</consequent>
<consequent>
<code>3.0</code>
<name>3.0</name>
<text>3.0</text>
<text>Versicolor</text>
</consequent>
</consequents>
</problem>
......@@ -370,17 +370,17 @@
<consequent>
<code>1.0</code>
<name>1.0</name>
<text>1.0</text>
<text>Wine1</text>
</consequent>
<consequent>
<code>2.0</code>
<name>2.0</name>
<text>2.0</text>
<text>Wine2</text>
</consequent>
<consequent>
<code>3.0</code>
<name>3.0</name>
<text>3.0</text>
<text>Wine3</text>
</consequent>
</consequents>
</problem>
......@@ -41,8 +41,8 @@
// Build a system
const ui = SwaggerUIBundle({
url: "http://demos.citius.usc.es/ExpliClasAPI/api/swagger.json",
//url: "http://localhost:8080/api/swagger.json",
//url: "https://demos.citius.usc.es/ExpliClasAPI/api/swagger.json",
url: "http://localhost:8080/api/swagger.json",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
......@@ -59,4 +59,4 @@
}
</script>
</body>
</html>
</html>/ap/
......@@ -260,37 +260,37 @@
<consequent>
<code>1</code>
<name>build wind float</name>
<text>build wind float</text>
<text>Building_windows_float_processed</text>
</consequent>
<consequent>
<code>2</code>
<name>build wind non-float</name>
<text>build wind non-float</text>
<text>Building_windows_non_float_processed</text>
</consequent>
<consequent>
<code>3</code>
<name>vehic wind float</name>
<text>vehic wind float</text>
<text>Vehicle_windows_float_processed</text>
</consequent>
<consequent>
<code>4</code>
<name>vehic wind non-float</name>
<text>vehic wind non-float</text>
<text>Vehicle_windows_non_float_processed</text>
</consequent>
<consequent>
<code>5</code>
<name>containers</name>
<text>containers</text>
<text>Containers</text>
</consequent>
<consequent>
<code>6</code>
<name>tableware</name>
<text>tableware</text>
<text>Tableware</text>
</consequent>
<consequent>
<code>7</code>
<name>headlamps</name>
<text>headlamps</text>
<text>Headlamps</text>
</consequent>
</consequents>
</problem>
\ No newline at end of file
......@@ -118,17 +118,17 @@
<consequent>
<code>1.0</code>
<name>1.0</name>
<text>1.0</text>
<text>Setosa</text>
</consequent>
<consequent>
<code>2.0</code>
<name>2.0</name>
<text>2.0</text>
<text>Virginica</text>
</consequent>
<consequent>
<code>3.0</code>
<name>3.0</name>
<text>3.0</text>
<text>Versicolor</text>
</consequent>
</consequents>
</problem>
......@@ -370,17 +370,17 @@
<consequent>
<code>1.0</code>
<name>1.0</name>
<text>1.0</text>
<text>Wine1</text>
</consequent>
<consequent>
<code>2.0</code>
<name>2.0</name>
<text>2.0</text>
<text>Wine2</text>
</consequent>
<consequent>
<code>3.0</code>
<name>3.0</name>
<text>3.0</text>
<text>Wine3</text>
</consequent>
</consequents>
</problem>
......@@ -260,37 +260,37 @@
<consequent>
<code>1</code>
<name>build wind float</name>
<text>build wind float</text>
<text>Building_windows_float_processed</text>
</consequent>
<consequent>
<code>2</code>
<name>build wind non-float</name>
<text>build wind non-float</text>
<text>Building_windows_non_float_processed</text>
</consequent>
<consequent>
<code>3</code>
<name>vehic wind float</name>
<text>vehic wind float</text>
<text>Vehicle_windows_float_processed</text>
</consequent>
<consequent>
<code>4</code>
<name>vehic wind non-float</name>
<text>vehic wind non-float</text>
<text>Vehicle_windows_non_float_processed</text>
</consequent>
<consequent>
<code>5</code>
<name>containers</name>
<text>containers</text>
<text>Containers</text>
</consequent>
<consequent>
<code>6</code>
<name>tableware</name>
<text>tableware</text>
<text>Tableware</text>
</consequent>
<consequent>
<code>7</code>
<name>headlamps</name>
<text>headlamps</text>
<text>Headlamps</text>
</consequent>
</consequents>
</problem>
\ No newline at end of file
......@@ -118,17 +118,17 @@
<consequent>
<code>1.0</code>
<name>1.0</name>
<text>1.0</text>
<text>Setosa</text>
</consequent>
<consequent>
<code>2.0</code>
<name>2.0</name>
<text>2.0</text>
<text>Virginica</text>
</consequent>
<consequent>
<code>3.0</code>
<name>3.0</name>
<text>3.0</text>
<text>Versicolor</text>
</consequent>
</consequents>
</problem>
......@@ -370,17 +370,17 @@
<consequent>
<code>1.0</code>
<name>1.0</name>
<text>1.0</text>
<text>Wine1</text>
</consequent>
<consequent>
<code>2.0</code>
<name>2.0</name>
<text>2.0</text>
<text>Wine2</text>
</consequent>
<consequent>
<code>3.0</code>
<name>3.0</name>
<text>3.0</text>
<text>Wine3</text>
</consequent>
</consequents>
</problem>
......@@ -41,8 +41,8 @@
// Build a system
const ui = SwaggerUIBundle({
url: "http://demos.citius.usc.es/ExpliClasAPI/api/swagger.json",
//url: "http://localhost:8080/api/swagger.json",
//url: "https://demos.citius.usc.es/ExpliClasAPI/api/swagger.json",
url: "http://localhost:8080/api/swagger.json",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
......@@ -59,4 +59,4 @@
}
</script>
</body>
</html>
</html>/ap/
#Generated by Maven
#Wed Jun 13 21:41:11 CEST 2018
#Thu Jun 21 16:43:16 CEST 2018
version=1.0
groupId=brunolopez
artifactId=expliclas-api
{
"main.css": "static/css/main.ebc899b1.css",
"main.css.map": "static/css/main.ebc899b1.css.map",
"main.js": "static/js/main.3449a757.js",
"main.js.map": "static/js/main.3449a757.js.map",
"main.js": "static/js/main.b6c571ad.js",
"main.js.map": "static/js/main.b6c571ad.js.map",
"static/media/beer.png": "static/media/beer.70f695ba.png",
"static/media/default.jpeg": "static/media/default.ca7bbe95.jpeg",
"static/media/glass.jpg": "static/media/glass.bcc512b5.jpg",
......
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="manifest" href="/ExpliClas/manifest.json"><link rel="shortcut icon" href="/ExpliClas/favicon.png"><link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"><link href="https://fonts.googleapis.com/css?family=Yeseva+One" rel="stylesheet"><link href="https://fonts.googleapis.com/css?family=Ovo|Yeseva+One" rel="stylesheet"><title>ExpliClass</title><link href="/ExpliClas/static/css/main.ebc899b1.css" rel="stylesheet"></head><body><div id="root"></div><script type="text/javascript" src="/ExpliClas/static/js/main.3449a757.js"></script></body></html>
\ No newline at end of file
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="manifest" href="/ExpliClas/manifest.json"><link rel="shortcut icon" href="/ExpliClas/favicon.png"><link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"><link href="https://fonts.googleapis.com/css?family=Yeseva+One" rel="stylesheet"><link href="https://fonts.googleapis.com/css?family=Ovo|Yeseva+One" rel="stylesheet"><title>ExpliClass</title><link href="/ExpliClas/static/css/main.ebc899b1.css" rel="stylesheet"></head><body><div id="root"></div><script type="text/javascript" src="/ExpliClas/static/js/main.b6c571ad.js"></script></body></html>
\ No newline at end of file
"use strict";var precacheConfig=[["/ExpliClas/index.html","514de57afd0761a7b5ce395fcc81ed77"],["/ExpliClas/static/css/main.ebc899b1.css","7207e89546ec44cdf8c88f1d1dd3778c"],["/ExpliClas/static/js/main.3449a757.js","d5b643602d3894639ca7399c5fd7d633"],["/ExpliClas/static/media/beer.70f695ba.png","70f695ba03218435fa67bbce30f116f0"],["/ExpliClas/static/media/default.ca7bbe95.jpeg","ca7bbe95968570738b2818810dac3b63"],["/ExpliClas/static/media/glass.bcc512b5.jpg","bcc512b56043dd730b1541ccbac287ba"],["/ExpliClas/static/media/iris.1e626fb8.jpg","1e626fb8678e34b9a69468cd9a2b17c0"],["/ExpliClas/static/media/leaf.41640b3b.jpg","41640b3bf944f3b32b0a413ff7447900"],["/ExpliClas/static/media/letters.74256f21.jpg","74256f217d7733b542ae1142f2f26d80"],["/ExpliClas/static/media/notebook.3cdb6b06.jpg","3cdb6b06481b312175a61b7a25b4ef30"],["/ExpliClas/static/media/wine.9b49c81e.jpg","9b49c81e6573307c25621382d8a9dcbf"]],cacheName="sw-precache-v3-sw-precache-webpack-plugin-"+(self.registration?self.registration.scope:""),ignoreUrlParametersMatching=[/^utm_/],addDirectoryIndex=function(e,t){var n=new URL(e);return"/"===n.pathname.slice(-1)&&(n.pathname+=t),n.toString()},cleanResponse=function(t){return t.redirected?("body"in t?Promise.resolve(t.body):t.blob()).then(function(e){return new Response(e,{headers:t.headers,status:t.status,statusText:t.statusText})}):Promise.resolve(t)},createCacheKey=function(e,t,n,a){var r=new URL(e);return a&&r.pathname.match(a)||(r.search+=(r.search?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(n)),r.toString()},isPathWhitelisted=function(e,t){if(0===e.length)return!0;var n=new URL(t).pathname;return e.some(function(e){return n.match(e)})},stripIgnoredUrlParameters=function(e,n){var t=new URL(e);return t.hash="",t.search=t.search.slice(1).split("&").map(function(e){return e.split("=")}).filter(function(t){return n.every(function(e){return!e.test(t[0])})}).map(function(e){return e.join("=")}).join("&"),t.toString()},hashParamName="_sw-precache",urlsToCacheKeys=new Map(precacheConfig.map(function(e){var t=e[0],n=e[1],a=new URL(t,self.location),r=createCacheKey(a,hashParamName,n,/\.\w{8}\./);return[a.toString(),r]}));function setOfCachedUrls(e){return e.keys().then(function(e){return e.map(function(e){return e.url})}).then(function(e){return new Set(e)})}self.addEventListener("install",function(e){e.waitUntil(caches.open(cacheName).then(function(a){return setOfCachedUrls(a).then(function(n){return Promise.all(Array.from(urlsToCacheKeys.values()).map(function(t){if(!n.has(t)){var e=new Request(t,{credentials:"same-origin"});return fetch(e).then(function(e){if(!e.ok)throw new Error("Request for "+t+" returned a response with status "+e.status);return cleanResponse(e).then(function(e){return a.put(t,e)})})}}))})}).then(function(){return self.skipWaiting()}))}),self.addEventListener("activate",function(e){var n=new Set(urlsToCacheKeys.values());e.waitUntil(caches.open(cacheName).then(function(t){return t.keys().then(function(e){return Promise.all(e.map(function(e){if(!n.has(e.url))return t.delete(e)}))})}).then(function(){return self.clients.claim()}))}),self.addEventListener("fetch",function(t){if("GET"===t.request.method){var e,n=stripIgnoredUrlParameters(t.request.url,ignoreUrlParametersMatching),a="index.html";(e=urlsToCacheKeys.has(n))||(n=addDirectoryIndex(n,a),e=urlsToCacheKeys.has(n));var r="/ExpliClas/index.html";!e&&"navigate"===t.request.mode&&isPathWhitelisted(["^(?!\\/__).*"],t.request.url)&&(n=new URL(r,self.location).toString(),e=urlsToCacheKeys.has(n)),e&&t.respondWith(caches.open(cacheName).then(function(e){return e.match(urlsToCacheKeys.get(n)).then(function(e){if(e)return e;throw Error("The cached response that was expected is missing.")})}).catch(function(e){return console.warn('Couldn\'t serve response for "%s" from cache: %O',t.request.url,e),fetch(t.request)}))}});
\ No newline at end of file
"use strict";var precacheConfig=[["/ExpliClas/index.html","82582a4a6b5070c43a0c56c2405983a3"],["/ExpliClas/static/css/main.ebc899b1.css","7207e89546ec44cdf8c88f1d1dd3778c"],["/ExpliClas/static/js/main.b6c571ad.js","1484ff43a5e1505538845d1b0fbb4e05"],["/ExpliClas/static/media/beer.70f695ba.png","70f695ba03218435fa67bbce30f116f0"],["/ExpliClas/static/media/default.ca7bbe95.jpeg","ca7bbe95968570738b2818810dac3b63"],["/ExpliClas/static/media/glass.bcc512b5.jpg","bcc512b56043dd730b1541ccbac287ba"],["/ExpliClas/static/media/iris.1e626fb8.jpg","1e626fb8678e34b9a69468cd9a2b17c0"],["/ExpliClas/static/media/leaf.41640b3b.jpg","41640b3bf944f3b32b0a413ff7447900"],["/ExpliClas/static/media/letters.74256f21.jpg","74256f217d7733b542ae1142f2f26d80"],["/ExpliClas/static/media/notebook.3cdb6b06.jpg","3cdb6b06481b312175a61b7a25b4ef30"],["/ExpliClas/static/media/wine.9b49c81e.jpg","9b49c81e6573307c25621382d8a9dcbf"]],cacheName="sw-precache-v3-sw-precache-webpack-plugin-"+(self.registration?self.registration.scope:""),ignoreUrlParametersMatching=[/^utm_/],addDirectoryIndex=function(e,t){var n=new URL(e);return"/"===n.pathname.slice(-1)&&(n.pathname+=t),n.toString()},cleanResponse=function(t){return t.redirected?("body"in t?Promise.resolve(t.body):t.blob()).then(function(e){return new Response(e,{headers:t.headers,status:t.status,statusText:t.statusText})}):Promise.resolve(t)},createCacheKey=function(e,t,n,a){var r=new URL(e);return a&&r.pathname.match(a)||(r.search+=(r.search?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(n)),r.toString()},isPathWhitelisted=function(e,t){if(0===e.length)return!0;var n=new URL(t).pathname;return e.some(function(e){return n.match(e)})},stripIgnoredUrlParameters=function(e,n){var t=new URL(e);return t.hash="",t.search=t.search.slice(1).split("&").map(function(e){return e.split("=")}).filter(function(t){return n.every(function(e){return!e.test(t[0])})}).map(function(e){return e.join("=")}).join("&"),t.toString()},hashParamName="_sw-precache",urlsToCacheKeys=new Map(precacheConfig.map(function(e){var t=e[0],n=e[1],a=new URL(t,self.location),r=createCacheKey(a,hashParamName,n,/\.\w{8}\./);return[a.toString(),r]}));function setOfCachedUrls(e){return e.keys().then(function(e){return e.map(function(e){return e.url})}).then(function(e){return new Set(e)})}self.addEventListener("install",function(e){e.waitUntil(caches.open(cacheName).then(function(a){return setOfCachedUrls(a).then(function(n){return Promise.all(Array.from(urlsToCacheKeys.values()).map(function(t){if(!n.has(t)){var e=new Request(t,{credentials:"same-origin"});return fetch(e).then(function(e){if(!e.ok)throw new Error("Request for "+t+" returned a response with status "+e.status);return cleanResponse(e).then(function(e){return a.put(t,e)})})}}))})}).then(function(){return self.skipWaiting()}))}),self.addEventListener("activate",function(e){var n=new Set(urlsToCacheKeys.values());e.waitUntil(caches.open(cacheName).then(function(t){return t.keys().then(function(e){return Promise.all(e.map(function(e){if(!n.has(e.url))return t.delete(e)}))})}).then(function(){return self.clients.claim()}))}),self.addEventListener("fetch",function(t){if("GET"===t.request.method){var e,n=stripIgnoredUrlParameters(t.request.url,ignoreUrlParametersMatching),a="index.html";(e=urlsToCacheKeys.has(n))||(n=addDirectoryIndex(n,a),e=urlsToCacheKeys.has(n));var r="/ExpliClas/index.html";!e&&"navigate"===t.request.mode&&isPathWhitelisted(["^(?!\\/__).*"],t.request.url)&&(n=new URL(r,self.location).toString(),e=urlsToCacheKeys.has(n)),e&&t.respondWith(caches.open(cacheName).then(function(e){return e.match(urlsToCacheKeys.get(n)).then(function(e){if(e)return e;throw Error("The cached response that was expected is missing.")})}).catch(function(e){return console.warn('Couldn\'t serve response for "%s" from cache: %O',t.request.url,e),fetch(t.request)}))}});
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -10,7 +10,7 @@ import Explanation from './components/Explanation';
import Footer from './components/Footer';
import NotFound from './components/NotFound';
import Alert from './components/Alert';
import { API_ROOT } from './config';
import { API_ROOT, HOME, BASE } from './config';
class App extends Component {
......@@ -34,8 +34,22 @@ class App extends Component {
this.setAlgorithm = this.setAlgorithm.bind(this);
this.clearState = this.clearState.bind(this);
this.closeAlert = this.closeAlert.bind(this);
this.showSessionAlert = this.showSessionAlert.bind(this);
}
showSessionAlert(){
window.location.assign(`${HOME}`);
var token = localStorage.getItem("token");
localStorage.clear();
fetch(`${API_ROOT}/token/remove`,{
method: 'DELETE',
headers: new Headers({
'Authorization': token
})
})
}
setLogState(e) {
fetch(`${API_ROOT}/token`)
.then((response) => {
......@@ -118,7 +132,7 @@ class App extends Component {
var breadcrumb = <Progress ownlog={this.state.ownlog} step={this.state.step} />;
}
var routeHome = <Route path="/" render = {() => (
var routeHome = <Route path="/" strict exact render = {() => (
localStorage.getItem('token') ? (
<Redirect to="/datasets" />
) : (
......@@ -128,7 +142,7 @@ class App extends Component {
var routeDatasets = <Route path="/datasets" render = {() => (
localStorage.getItem('token') ? (
<Datasets clearState={this.clearState} setOwnLog={this.setOwnLog} setStep={this.setStep} setProblem={this.setProblem} />
<Datasets clearState={this.clearState} setOwnLog={this.setOwnLog} setStep={this.setStep} setProblem={this.setProblem} />
) : (
<Redirect to="/" />
)
......@@ -137,7 +151,7 @@ class App extends Component {
var routeBuild = <Route path="/buildlog" render = {() => (
localStorage.getItem('token') && localStorage.getItem('step') !== "classifier"
&& localStorage.getItem('step') !== "explanation" && localStorage.getItem('ownlog') ? (
<BuildLog setStep={this.setStep} setProblem={this.setProblemAlgorithm} />
<BuildLog setStep={this.setStep} setProblem={this.setProblemAlgorithm} sessionAlert={this.showSessionAlert}/>
) : (
<Redirect to={localStorage.getItem('step') !== null ? "/" + localStorage.getItem('step'):"/"} />
)
......@@ -183,7 +197,7 @@ class App extends Component {
var footer = localStorage.getItem('token') !== null ? <Footer />:"";
return (
<Router basename="/ExpliClas">
<Router basename={BASE}>
<div className="App">
{breadcrumb}
{this.state.alert ? <Alert message={this.state.messageAlert} closeAlert={this.closeAlert} alertType={this.state.alertType}/>:""}
......
......@@ -55,26 +55,26 @@ class BuildLog extends Component {
var form;
if(this.state.algorithm === "J48" || (this.props.location.state && this.props.location.state.algorithm === "J48")){
if(this.props.location.state){
form = <FormJ48 name={this.props.location.state.name} setProblem={this.props.setProblem} />
form = <FormJ48 sessionAlert={this.props.sessionAlert} name={this.props.location.state.name} setProblem={this.props.setProblem} />
}
else{
form = <FormJ48 setProblem={this.props.setProblem} />
form = <FormJ48 sessionAlert={this.props.sessionAlert} setProblem={this.props.setProblem} />
}
}
else if(this.state.algorithm === "RandomTree" || (this.props.location.state && this.props.location.state.algorithm === "RandomTree")){
if(this.props.location.state){
form = <FormRT name={this.props.location.state.name} setProblem={this.props.setProblem} />
form = <FormRT sessionAlert={this.props.sessionAlert} name={this.props.location.state.name} setProblem={this.props.setProblem} />
}
else{
form = <FormRT setProblem={this.props.setProblem} />
form = <FormRT sessionAlert={this.props.sessionAlert} setProblem={this.props.setProblem} />
}
}
else if(this.state.algorithm === "REPTree" || (this.props.location.state && this.props.location.state.algorithm === "REPTree")){
if(this.props.location.state){
form = <FormREP name={this.props.location.state.name} setProblem={this.props.setProblem} />
form = <FormREP sessionAlert={this.props.sessionAlert} name={this.props.location.state.name} setProblem={this.props.setProblem} />
}
else{
form = <FormREP setProblem={this.props.setProblem} />
form = <FormREP sessionAlert={this.props.sessionAlert} setProblem={this.props.setProblem} />
}
}
......
......@@ -16,36 +16,37 @@ class Datasets extends Component {
this.props.setStep("datasets");
this.getDatasets();
this.state = {
datasets: [],
alert: false,
messageAlert: "",
alertType: "error"
datasets: [],
alert: false,
messageAlert: "",
alertType: "error"
};
this.closeAlert = this.closeAlert.bind(this);
this.deleteDataset = this.deleteDataset.bind(this);
this.deleteDataset = this.deleteDataset.bind(this);
}
getDatasets(){
fetch(`${API_ROOT}/datasets`,{
console.log(localStorage.getItem("token"))
fetch(`${API_ROOT}/datasets`,{
headers: new Headers({
'Authorization': localStorage.getItem('token')
})
})
.then((response) => {
return response.json();
})
.then((data) => {
this.setState({
.then((response) => {
return response.json();
})
.then((data) => {
this.setState({
datasets: data
});
})
.catch((error) =>{
})
.catch((error) =>{
this.setState({
alert: true,
messageAlert: "Could not retrieve datasets, please try later or close session if error persist",
alertType: "error"
});
});
alert: true,
messageAlert: "Could not retrieve datasets, please try later or close session if error persist",
alertType: "error"
});
});
}
deleteDataset(event){
......