diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 683a884..75e983d 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,408 +1,432 @@
+
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
console
+ length
-
-
+
+
true
DEFINITION_ORDER
-
-
-
+
+
+
+
-
-
+
+
+
+
+
+
+
-
-
+
+
-
1535982823834
1535982823834
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/index.html b/index.html
index 52616e9..a7bf844 100644
--- a/index.html
+++ b/index.html
@@ -1,36 +1,36 @@
+
{this.props.legend}
);
}
}
+// Outputs definition
+// ---------------------
+// ---------------------
class CostOutput extends React.Component {
constructor(props) {
super(props);
this.handleChange = this.handleChange.bind(this);
}
handleChange() {
this.props.onCostChange(this.props.display);
}
render() {
return (
);
}
}
function Textoutput(props){
return(
{props.text}
);
}
+// Plugins definition
+// ---------------------
+// ---------------------
class AmountRatesCost extends React.Component {
constructor(props) {
super(props);
this.state={amount : 1, SelectRate : 0 , Rate : this.props.data.Rates[Object.keys(this.props.data.Rates)[0]]};
this.handleAmountChange = this.handleAmountChange.bind(this);
this.handleRateChange = this.handleRateChange.bind(this);
}
handleAmountChange(amount) {
this.setState({amount: amount});
}
handleRateChange(select) {
this.setState({SelectRate: select});
this.setState({Rate: this.props.data.Rates[select]});
}
render() {
const Amount = this.state.amount;
const Rate=this.state.Rate;
const Cost=this.makecost(Amount,Rate);
return (
-
{this.props.name}
+
{this.props.name}
);
}
makecost(amount,rate) {
var total=(amount-this.props.data.AmountFree)*rate;
total=tomoney(total);
- this.props.onCostChange(this.props.name,total);
+ this.props.onCostChange(this.props.n,total);
return total;
}
}
class CategoryAmountRatesCost extends React.Component {
constructor(props) {
super(props);
this.state={SelectCat : 0, Cat : this.props.data.Cat[Object.keys(this.props.data.Cat)[0]],
amount : 1, SelectRate : 0 , Rate : this.props.data.Rates[Object.keys(this.props.data.Rates)[0]]};
this.handleCatChange = this.handleCatChange.bind(this);
this.handleAmountChange = this.handleAmountChange.bind(this);
this.handleRateChange = this.handleRateChange.bind(this);
// this.handleCostChange = this.handleCostChange.bind(this);
}
handleAmountChange(amount) {
this.setState({amount: amount});
}
handleRateChange(select) {
this.setState({SelectRate: select});
this.setState({Rate: this.props.data.Rates[select]});
}
handleCatChange(select) {
this.setState({SelectCat: select});
this.setState({Cat: this.props.data.Cat[select]});
}
- // handleCostChange(total) {
- // this.props.onCostChange(this.props.name,total);
- // }
+
render() {
const Cat=this.state.Cat;
const Amount = this.state.amount;
const Rate=this.state.Rate;
const Cost=this.makecost(Cat,Amount,Rate);
return (
-
{this.props.name}
+
{this.props.name}
);
}
makecost(cat,amount,rate) {
var total=cat+(amount-this.props.data.AmountFree)*rate;
total=tomoney(total);
- this.props.onCostChange(this.props.name,total);
+ this.props.onCostChange(this.props.n,total);
return total;
}
}
class CategoryCost extends React.Component {
constructor(props) {
super(props);
this.state={SelectCat : 0, Cat : this.props.data.Cat[Object.keys(this.props.data.Cat)[0]]};
this.handleCatChange = this.handleCatChange.bind(this);
}
handleCatChange(select) {
this.setState({SelectCat: select});
this.setState({Cat: this.props.data.Cat[select]});
}
- // handleCostChange(total) {
- // this.props.onCostChange(this.props.name,total);
- // }
+
render() {
const Cat=this.state.Cat;
const Cost=this.makecost(Cat);
return (
-
{this.props.name}
+
{this.props.name}
);
}
makecost(cat) {
var total=cat;
total=tomoney(total);
- this.props.onCostChange(this.props.name,total);
+ this.props.onCostChange(this.props.n,total);
return total;
}
}
+
+// Combine plugins
+// ---------------------
+// ---------------------
class ProviderPluginsSelector extends React.Component {
constructor(props) {
super(props);
this.handleCostChange = this.handleCostChange.bind(this);
this.handleProviderChange = this.handleProviderChange.bind(this);
-
- this.state={selected:0,keys:this.ProvidersName(this.props.data)}
-
+ this.state={selected:0,
+ keys:this.ProvidersName(props.data),
+ };
}
- handleCostChange(name,e) {
- this.props.handleCostChange(name,e.target.value);
+ handleCostChange(n,e) {
+ console.log("here n : "+n+" e = "+ e);
+ this.props.handleCostChange(n,e);
}
handleProviderChange(e){
+ const select=this.state.keys.indexOf(e.target.value);
+ this.setState({selected:select});
}
render() {
- const Test=this.cmp2string("AmountRatesCost");//window[NasEpfl.style];
+ console.log("n= "+this.props.n)
+ const Cmp=this.cmp2string(this.cmpdata(this.state.selected).style);
+ const Cdata=this.cmpdata(this.state.selected);
return(
-
-
-
-
-
-
-
+
+
{this.props.data.name}
+
+
+
+
+
+
);
}
+ cmpdata(select){return this.props.data.data[select];}
+
cmp2string(str){
switch (str) {
case "AmountRatesCost" : return AmountRatesCost;
case "CategoryCost" : return CategoryCost;
- case "CategoryAmountRatesCost" : return CategoryAmountRatesCost
+ case "CategoryAmountRatesCost" : return CategoryAmountRatesCost;
}
}
ProvidersName(main){
var data=main.data;
- console.log(data)
+ console.log(data);
var providers=[];
for (var i = 0; i < data.length; i++) {
- providers.push(data[i].provider)
+ providers.push(data[i].provider);
}
return providers;
}
}
class PluginsMain extends React.Component {
constructor(props) {
super(props);
this.handleCostChange = this.handleCostChange.bind(this);
this.state={'varsum':{}};
- console.log(this.ProvidersName(storage))
}
handleCostChange(name,e) {
- // this.props.costs{name:e};
+ console.log("name"+name);
this.state.varsum[name]=e;
this.props.TotalCost(sum(this.state.varsum));
}
render() {
- const Test=this.cmp2string("AmountRatesCost");//window[NasEpfl.style];
+
return(
-
-
-
-
-
-
-
-
-
+
+ {(index) => }
+
);
}
-
}
+// ---------------------
+// ---------------------
class Main extends React.Component {
constructor(props) {
super(props);
this.handleCostChange = this.handleCostChange.bind(this);
this.state={'total':0,'prevtotal':0};
}
handleCostChange(total) {
+ console.log("there total : "+total )
if (this.state.prevtotal != total){
- // console.log("updated :"+total)
+ console.log("updated :"+total);
+ console.log("prev :"+this.state.prevtotal);
this.setState({'total':total});
this.setState({'prevtotal':total});
}
}
render() {
return(
);
}
}
-
+// ---------------------
+// ---------------------
ReactDOM.render(,document.getElementById('root'));
\ No newline at end of file
diff --git a/js/data.js b/js/data.js
index cf8459f..4b16c17 100644
--- a/js/data.js
+++ b/js/data.js
@@ -1,250 +1,283 @@
// Providers
// ----------------------------------------------------
// ----------------------------------------------------
// Storage
const NasEpfl = {
style: "AmountRatesCost",
provider : "EPFL-VPSI",
+ name:'NAS',
url : '',
AmountName: "Amount",
AmountUnit: "TB",
AmountMin : 1,
AmountMax : 100,
AmountStep : 1,
AmountFree:1,
AmountFreeCumulative:false,
RateVar : true,
RateName : 'Performance',
Rates : {
'Collaborative': 165,
'On-line archive': 110,
'Raw': 55
},
- RateUnit : "TB / CHF"
+ RateUnit : "CHF / TB"
};
const SwitchEpfl = {
style : 'CategoryCost',
provider : "Switch-EPFL",
+ name:'Online Storage',
url : '',
CatName:'Options',
Cat:{
'Cloud Based max 50GB':0,
},
CatUnit:'CHF',
};
const GoogleDriveEdu = {
style : 'CategoryCost',
provider : "Google Drive Educ",
+ name:'Online Storage',
url : '',
CatName:'Options',
Cat:{
'Cloud Based illimited':0,
},
CatUnit:'CHF',
};
// ELN
const SLIMSEpfl = {
style:'CategoryAmountRatesCost',
provider : "EPFL-LSIS",
+ name:'SLIMS',
url : '',
CatName:'PI Status',
Cat:{
'Full Professor':3000,
'Associate Professor':2000,
'Tenure Track Assistant Professor or Core Facility':1000
},
CatUnit:'CHF',
AmountName: "Storage",
AmountUnit: "TB",
AmountMin : 1,
AmountMax : 100,
AmountStep : 1,
AmountFree:0,
AmountFreeCumulative:false,
RateVar : true,
RateName: 'ELN Storage',
Rates : {
'Stored on EPFL Server': 300,
},
- RateUnit : "TB / CHF"
+ RateUnit : "CHF / TB"
};
// Database
const MysqlEpfl = {
style : 'CategoryCost',
provider : "EPFL-VPSI",
+ name:'MySql',
url : '',
CatName:'Options',
Cat:{
'MySQL max 2GB':0,
},
CatUnit:'CHF',
};
// Repository
const Zenodo = {
style : 'CategoryCost',
provider : "Zenodo-CERN",
+ name:'Zenodo',
url : '',
CatName:'Options',
Cat:{
'Max 50GB per dataset':0,
},
CatUnit:'CHF',
};
const C4science = {
style : 'CategoryCost',
provider : "EPFL-SCITAS",
+ name:'C4Science',
url : '',
CatName:'Options',
Cat:{
'Free for text file':0,
},
CatUnit:'CHF',
};
const Github = {
style: "AmountRatesCost",
provider : "GitHub",
+ name:'GitHub',
url : '',
AmountName: "Number of user",
AmountUnit: "User(s)",
AmountMin : 1,
AmountMax : 100,
AmountStep : 1,
AmountFree:0,
AmountFreeCumulative:false,
RateVar : true,
- CatName:'Plan',
- Cat:{
+ RateName:'Plan',
+ Rates:{
'OpenSource project':0,
'Developer (for one user)':81.6,
'Team (min 5 users)':104.9,
'Business Cloud':244.7
},
- CatUnit:'CHF / Users',
+ RateUnit:'CHF / Users',
};
const Bitbucket= {
style: "AmountRatesCost",
provider : "Bitbucket",
+ name:'BitBucket',
url : '',
AmountName: "Number of user",
AmountUnit: "User(s)",
AmountMin : 1,
AmountMax : 100,
AmountStep : 1,
AmountFree:0,
AmountFreeCumulative:false,
RateVar : true,
- CatName:'Plan',
- Cat:{
+ RateName:'Plan',
+ Rates:{
'Free (up to 5 users)':0,
'Standard for growing teams (min 5 users)':24,
'Premium for large teams (min 5 users)':60,
},
- CatUnit:'CHF / Users',
+ RateUnit:'CHF / Users',
};
const Gitlab= {
style: "AmountRatesCost",
provider : "Gitlab",
+ name:'Gitlab',
url : '',
AmountName: "Number of user",
AmountUnit: "User(s)",
AmountMin : 1,
AmountMax : 100,
AmountStep : 1,
AmountFree:0,
AmountFreeCumulative:false,
RateVar : true,
- CatName:'Plan',
- Cat:{
+ RateName:'Plan',
+ Rates:{
'Core Self Hosted':0,
'Free Cloud Based' : 0,
'Starter Self Hosted':48,
'Bronze Cloud based':48,
'Premium Self Hosted':228,
'Silver Cloud Based':228
},
- CatUnit:'CHF / Users',
+ RateUnit:'CHF / Users',
};
const Figshare = {
style : 'CategoryCost',
provider : "FigShare",
+ name:'Figshare',
url : '',
CatName:'Options',
Cat:{
'Free 1GB':0,
'10GB':96,
'15GB':132,
'20GB':180
},
CatUnit:'CHF',
};
const Dryad = {
style : 'CategoryAmountRatesCost',
- provider : "FigShare",
+ provider : "Dyrad",
+ name:'Dyrad',
url : '',
CatName:'Options',
Cat:{
'up to 20GB if DPC covered':0,
'up to 20GB if no DPC covered':120
},
CatUnit:'CHF',
AmountName: "Extra - Storage",
AmountUnit: "GB",
AmountMin : 0,
AmountMax : 100,
AmountStep : 10,
AmountFree:0,
AmountFreeCumulative:false,
RateVar : true,
RateName: 'ELN Storage',
Rates : {
- 'Extra Storage': 300,
-},
-RateUnit : "GB / CHF"
+ 'Extra Storage': 50,
+ },
+ RateUnit : "CHF / GB"
};
// Categories definition
// ----------------------------------------------------
// ----------------------------------------------------
const storage={
name : 'Active Storage',
icon : '',
url : '',
intro :'',
data :[NasEpfl,
- SLIMSEpfl,
+ SwitchEpfl,
GoogleDriveEdu
]
};
const ELN={
name : 'Electronic LabBook',
icon : '',
url : '',
intro :'',
data :[SLIMSEpfl,
]
};
const database={
name : 'Database',
icon : '',
url : '',
intro :'',
data :[MysqlEpfl,
]
-
};
+const repository={
+ name : 'Repository',
+ icon : '',
+ url : '',
+ intro :'',
+ data :[Zenodo,
+ C4science,
+ Github,
+ Bitbucket,
+ Gitlab,
+ Figshare,
+ Dryad,
+ ]
+};
+
+
+// Combine Categories
+// ----------------------------------------------------
+// ----------------------------------------------------
+const maincat={
+ data:[storage,ELN,database,repository]
+};