@@ -710,7 +710,7 @@ <h5 class="step-number">Trustworthiness <i class="fa fa-handshake-o"></i>
710
710
'robustness-pillar', 'privacy-pillar', 'fairness-pillar', 'explainability-pillar',
711
711
'accountability-pillar', 'architectural-soundness-pillar', 'sustainability-pillar', 'robustness-notion-1', 'robustness-notion-2',
712
712
'robustness-notion-3', 'privacy-notion-1', 'privacy-notion-2', 'privacy-notion-3', 'fairness-notion-1', 'fairness-notion-2', 'fairness-notion-3',
713
- 'explainability-notion-1', 'explainability-notion-2', 'accountability-notion-1', 'architectural_soundness- notion-1', 'architectural_soundness -notion-2',
713
+ 'explainability-notion-1', 'explainability-notion-2', 'architectural-soundness- notion-1', 'architectural-soundness -notion-2',
714
714
'sustainability-notion-1', 'sustainability-notion-2', 'sustainability-notion-3',
715
715
checked) " style ="display: none; ">
716
716
< label for ="trustworthiness-lock " class ="icon-container " style ="float: right; ">
@@ -860,7 +860,7 @@ <h5 class="step-title">Accountability pillar</h5>
860
860
< h5 class ="step-title "> Factsheet completeness notion</ h5 >
861
861
< input type ="number " class ="form-control " id ="accountability-notion-1 "
862
862
placeholder ="Factsheet completeness notion " min ="100 " value ="100 "
863
- style ="display: inline; width: 70%; ">
863
+ style ="display: inline; width: 70%; " disabled =" true " >
864
864
< small class ="form-text text-muted "> %</ small >
865
865
</ div >
866
866
</ div >
@@ -876,14 +876,14 @@ <h5 class="step-title">Architectural soundness pillar</h5>
876
876
< div class ="notion-container ">
877
877
< div class ="notion ">
878
878
< h5 class ="step-title "> Client management notion</ h5 >
879
- < input type ="number " class ="form-control " id ="architectural_soundness -notion-1 "
879
+ < input type ="number " class ="form-control " id ="architectural-soundness -notion-1 "
880
880
placeholder ="Client management notion " min ="20 " value ="50 "
881
881
style ="display: inline; width: 70%; ">
882
882
< small class ="form-text text-muted "> %</ small >
883
883
</ div >
884
884
< div class ="notion ">
885
885
< h5 class ="step-title "> Optimization notion</ h5 >
886
- < input type ="number " class ="form-control " id ="architectural_soundness -notion-2 "
886
+ < input type ="number " class ="form-control " id ="architectural-soundness -notion-2 "
887
887
placeholder ="Optimization notion " min ="20 " value ="50 "
888
888
style ="display: inline; width: 70%; ">
889
889
< small class ="form-text text-muted "> %</ small >
@@ -1320,8 +1320,8 @@ <h5 class="step-title">Federation complexity notion</h5>
1320
1320
data [ "accountability_pillar" ] = document . getElementById ( "accountability-pillar" ) . value
1321
1321
data [ "factsheet_completeness" ] = document . getElementById ( "accountability-notion-1" ) . value
1322
1322
data [ "architectural_soundness_pillar" ] = document . getElementById ( "architectural-soundness-pillar" ) . value
1323
- data [ "client_management" ] = document . getElementById ( "architectural_soundness -notion-1" ) . value
1324
- data [ "optimization" ] = document . getElementById ( "architectural_soundness -notion-2" ) . value
1323
+ data [ "client_management" ] = document . getElementById ( "architectural-soundness -notion-1" ) . value
1324
+ data [ "optimization" ] = document . getElementById ( "architectural-soundness -notion-2" ) . value
1325
1325
data [ "sustainability_pillar" ] = document . getElementById ( "sustainability-pillar" ) . value
1326
1326
data [ "energy_source" ] = document . getElementById ( "sustainability-notion-1" ) . value
1327
1327
data [ "hardware_efficiency" ] = document . getElementById ( "sustainability-notion-2" ) . value
@@ -1448,9 +1448,9 @@ <h5 class="step-title">Federation complexity notion</h5>
1448
1448
document . getElementById ( "explainability-notion-2" ) . value = data [ "post_hoc_methods" ]
1449
1449
document . getElementById ( "accountability-pillar" ) . value = data [ "accountability_pillar" ]
1450
1450
document . getElementById ( "accountability-notion-1" ) . value = data [ "factsheet_completeness" ]
1451
- document . getElementById ( "architectural_soundness -pillar" ) . value = data [ "architectural_soundness_pillar" ]
1452
- document . getElementById ( "architectural_soundness -notion-1" ) . value = data [ "client_management" ]
1453
- document . getElementById ( "architectural_soundness -notion-2" ) . value = data [ "optimization" ]
1451
+ document . getElementById ( "architectural-soundness -pillar" ) . value = data [ "architectural_soundness_pillar" ]
1452
+ document . getElementById ( "architectural-soundness -notion-1" ) . value = data [ "client_management" ]
1453
+ document . getElementById ( "architectural-soundness -notion-2" ) . value = data [ "optimization" ]
1454
1454
document . getElementById ( "sustainability-pillar" ) . value = data [ "sustainability_pillar" ]
1455
1455
document . getElementById ( "sustainability-notion-1" ) . value = data [ "energy_source" ]
1456
1456
document . getElementById ( "sustainability-notion-2" ) . value = data [ "hardware_efficiency" ]
@@ -2032,30 +2032,42 @@ <h5 class="step-title">Federation complexity notion</h5>
2032
2032
2033
2033
//When click "add-btn" button, save actual scenario in the list of scenarios
2034
2034
document . getElementById ( "add-btn" ) . addEventListener ( "click" , function ( ) {
2035
- scenarioStorage . saveScenario ( ) ;
2036
- scenarioStorage . actual_scenario = scenarioStorage . scenariosList . length - 1 ;
2037
-
2038
- sessionStorage . setItem ( "ScenarioList" , JSON . stringify ( scenarioStorage . scenariosList ) ) ;
2035
+ trust = document . getElementById ( "with-trustworthiness-btn" ) . checked ? true : false
2039
2036
2040
- updateScenariosPosition ( ) ;
2041
-
2042
- var actual_scenario = scenarioStorage . scenariosList [ scenarioStorage . actual_scenario ] ;
2043
- setScenarioData ( actual_scenario ) ;
2037
+ var message = null ;
2038
+ if ( trust === true ) {
2039
+ message = checkWeights ( )
2040
+ }
2044
2041
2045
- document . getElementById ( "add-btn" ) . style . display = "none" ;
2046
- if ( scenarioStorage . scenariosList . length == 1 ) {
2047
- document . getElementById ( "prev-btn" ) . style . display = "none" ;
2048
- document . getElementById ( "next-btn" ) . style . display = "none" ;
2042
+ if ( message != null ) {
2043
+ showAlert ( 'info' , message ) ;
2049
2044
}
2050
2045
else {
2051
- document . getElementById ( "prev-btn" ) . style . display = "inline-block" ;
2052
- }
2053
- document . getElementById ( "new-btn" ) . style . display = "inline-block" ;
2054
- document . getElementById ( "del-btn" ) . style . display = "inline-block" ;
2046
+ scenarioStorage . saveScenario ( ) ;
2047
+ scenarioStorage . actual_scenario = scenarioStorage . scenariosList . length - 1 ;
2048
+
2049
+ sessionStorage . setItem ( "ScenarioList" , JSON . stringify ( scenarioStorage . scenariosList ) ) ;
2050
+
2051
+ updateScenariosPosition ( ) ;
2052
+
2053
+ var actual_scenario = scenarioStorage . scenariosList [ scenarioStorage . actual_scenario ] ;
2054
+ setScenarioData ( actual_scenario ) ;
2055
+
2056
+ document . getElementById ( "add-btn" ) . style . display = "none" ;
2057
+ if ( scenarioStorage . scenariosList . length == 1 ) {
2058
+ document . getElementById ( "prev-btn" ) . style . display = "none" ;
2059
+ document . getElementById ( "next-btn" ) . style . display = "none" ;
2060
+ }
2061
+ else {
2062
+ document . getElementById ( "prev-btn" ) . style . display = "inline-block" ;
2063
+ }
2064
+ document . getElementById ( "new-btn" ) . style . display = "inline-block" ;
2065
+ document . getElementById ( "del-btn" ) . style . display = "inline-block" ;
2055
2066
2056
- //Enable run
2057
- if ( document . getElementById ( "run-btn" ) . disabled ) {
2058
- document . getElementById ( "run-btn" ) . disabled = false ;
2067
+ //Enable run
2068
+ if ( document . getElementById ( "run-btn" ) . disabled ) {
2069
+ document . getElementById ( "run-btn" ) . disabled = false ;
2070
+ }
2059
2071
}
2060
2072
} ) ;
2061
2073
@@ -2338,58 +2350,42 @@ <h5 class="step-title">Federation complexity notion</h5>
2338
2350
'<br><p class="badge text-bg-danger">Warning: you will stop the running scenario and start a new one</p>' ) ;
2339
2351
document . getElementById ( "yes-button" ) . disabled = false ;
2340
2352
2341
- trust = document . getElementById ( "with-trustworthiness-btn " ) . checked ? true : false
2353
+ document . getElementById ( "yes-button " ) . addEventListener ( "click" , function ( ) {
2342
2354
2343
- var check_weights = true ;
2355
+ scenarioStorage . replaceScenario ( ) ;
2356
+ var data = scenarioStorage . scenariosList ;
2344
2357
2345
- if ( trust === true ) {
2346
- check_weights = checkWights ( )
2347
- }
2358
+ // Hide the modal
2359
+ $ ( '#confirm-modal' ) . modal ( 'hide' ) ;
2360
+ document . querySelector ( ".overlay" ) . style . display = "block" ;
2361
+ document . getElementById ( "spinner" ) . style . display = "block" ;
2348
2362
2349
- if ( checkWights ) {
2350
-
2351
- document . getElementById ( "yes-button" ) . addEventListener ( "click" , function ( ) {
2352
-
2353
- scenarioStorage . replaceScenario ( ) ;
2354
- var data = scenarioStorage . scenariosList ;
2355
-
2356
- // Hide the modal
2357
- $ ( '#confirm-modal' ) . modal ( 'hide' ) ;
2358
- document . querySelector ( ".overlay" ) . style . display = "block" ;
2359
- document . getElementById ( "spinner" ) . style . display = "block" ;
2360
-
2361
- fetch ( "/nebula/dashboard/deployment/run" , {
2362
- method : "POST" ,
2363
- headers : {
2364
- 'Content-Type' : 'application/json'
2365
- } ,
2366
- body : JSON . stringify ( data )
2367
- } )
2368
- . then ( response => {
2369
- if ( response . redirected ) {
2370
- window . location . href = response . url ;
2371
- } else {
2372
- document . querySelector ( ".overlay" ) . style . display = "none" ;
2373
- document . getElementById ( "spinner" ) . style . display = "none" ;
2374
- // If the user is a demo, show a modal with a message
2375
- $ ( '#confirm-modal' ) . on ( 'hidden.bs.modal' , function ( ) {
2376
- $ ( '#info-modal-body' ) . html ( 'You are not allowed to run a scenario. You have a limited functionality or a scenario is already running' ) ;
2377
- $ ( '#info-modal' ) . modal ( 'show' ) ;
2378
- } ) ;
2379
- }
2380
- } )
2381
- . catch ( error => {
2382
- console . error ( 'Error:' , error ) ;
2363
+ fetch ( "/nebula/dashboard/deployment/run" , {
2364
+ method : "POST" ,
2365
+ headers : {
2366
+ 'Content-Type' : 'application/json'
2367
+ } ,
2368
+ body : JSON . stringify ( data )
2369
+ } )
2370
+ . then ( response => {
2371
+ if ( response . redirected ) {
2372
+ window . location . href = response . url ;
2373
+ } else {
2383
2374
document . querySelector ( ".overlay" ) . style . display = "none" ;
2384
2375
document . getElementById ( "spinner" ) . style . display = "none" ;
2385
- } ) ;
2386
-
2376
+ // If the user is a demo, show a modal with a message
2377
+ $ ( '#confirm-modal' ) . on ( 'hidden.bs.modal' , function ( ) {
2378
+ $ ( '#info-modal-body' ) . html ( 'You are not allowed to run a scenario. You have a limited functionality or a scenario is already running' ) ;
2379
+ $ ( '#info-modal' ) . modal ( 'show' ) ;
2380
+ } ) ;
2381
+ }
2382
+ } )
2383
+ . catch ( error => {
2384
+ console . error ( 'Error:' , error ) ;
2385
+ document . querySelector ( ".overlay" ) . style . display = "none" ;
2386
+ document . getElementById ( "spinner" ) . style . display = "none" ;
2387
2387
} ) ;
2388
- } else {
2389
- $ ( '#confirm-modal-body' ) . html ( 'The sum of all pillar importances is not equal to 100.\n' +
2390
- '<br><br><p style="color: #772953; font-weight: bold">To calculate the trustworthiness of the scenario, the importance of all the pillas must be equal to 100.</p>' ) ;
2391
- document . getElementById ( "yes-button" ) . disabled = false ;
2392
- }
2388
+ } ) ;
2393
2389
}
2394
2390
} ) ;
2395
2391
@@ -2622,22 +2618,62 @@ <h5 class="step-title">Federation complexity notion</h5>
2622
2618
document . getElementById ( "federationArchitecture" ) . disabled = true ;
2623
2619
} ) ;
2624
2620
2625
- function checkWights ( ) {
2621
+ function checkWeights ( ) {
2622
+ var message = null
2623
+
2626
2624
var robustness_percent = parseFloat ( document . getElementById ( "robustness-pillar" ) . value ) ;
2627
2625
var privacy_percent = parseFloat ( document . getElementById ( "privacy-pillar" ) . value ) ;
2628
2626
var fairness_percent = parseFloat ( document . getElementById ( "fairness-pillar" ) . value ) ;
2629
2627
var explainability_percent = parseFloat ( document . getElementById ( "explainability-pillar" ) . value ) ;
2630
2628
var accountability_percent = parseFloat ( document . getElementById ( "accountability-pillar" ) . value ) ;
2631
2629
var architectural_soundness_percent = parseFloat ( document . getElementById ( "architectural-soundness-pillar" ) . value ) ;
2632
2630
var sustainability_percent = parseFloat ( document . getElementById ( "sustainability-pillar" ) . value ) ;
2633
-
2634
- var total_percent = robustness_percent + privacy_percent + fairness_percent + explainability_percent + accountability_percent + architectural_soundness_percent + sustainability_percent ;
2635
-
2636
- if ( total_percent === 100 ) {
2637
- return true ;
2631
+ var robustness_notion_1 = parseFloat ( document . getElementById ( "robustness-notion-1" ) . value ) ;
2632
+ var robustness_notion_2 = parseFloat ( document . getElementById ( "robustness-notion-2" ) . value ) ;
2633
+ var robustness_notion_3 = parseFloat ( document . getElementById ( "robustness-notion-3" ) . value ) ;
2634
+ var privacy_notion_1 = parseFloat ( document . getElementById ( "privacy-notion-1" ) . value ) ;
2635
+ var privacy_notion_2 = parseFloat ( document . getElementById ( "privacy-notion-2" ) . value ) ;
2636
+ var privacy_notion_3 = parseFloat ( document . getElementById ( "privacy-notion-3" ) . value ) ;
2637
+ var fairness_notion_1 = parseFloat ( document . getElementById ( "fairness-notion-1" ) . value ) ;
2638
+ var fairness_notion_2 = parseFloat ( document . getElementById ( "fairness-notion-2" ) . value ) ;
2639
+ var fairness_notion_3 = parseFloat ( document . getElementById ( "fairness-notion-3" ) . value ) ;
2640
+ var explainability_notion_1 = parseFloat ( document . getElementById ( "explainability-notion-1" ) . value ) ;
2641
+ var explainability_notion_2 = parseFloat ( document . getElementById ( "explainability-notion-2" ) . value ) ;
2642
+ var architectural_soundness_notion_1 = parseFloat ( document . getElementById ( "architectural-soundness-notion-1" ) . value ) ;
2643
+ var architectural_soundness_notion_2 = parseFloat ( document . getElementById ( "architectural-soundness-notion-2" ) . value ) ;
2644
+ var sustainability_notion_1 = parseFloat ( document . getElementById ( "sustainability-notion-1" ) . value ) ;
2645
+ var sustainability_notion_2 = parseFloat ( document . getElementById ( "sustainability-notion-2" ) . value ) ;
2646
+ var sustainability_notion_3 = parseFloat ( document . getElementById ( "sustainability-notion-3" ) . value ) ;
2647
+
2648
+ var total_pillar = robustness_percent + privacy_percent + fairness_percent + explainability_percent + accountability_percent + architectural_soundness_percent + sustainability_percent ;
2649
+ var total_robustness_notion = robustness_notion_1 + robustness_notion_2 + robustness_notion_3 ;
2650
+ var total_privacy_notion = privacy_notion_1 + privacy_notion_2 + privacy_notion_3 ;
2651
+ var total_fairness_notion = fairness_notion_1 + fairness_notion_2 + fairness_notion_3 ;
2652
+ var total_explainability_notion = explainability_notion_1 + explainability_notion_2 ;
2653
+ var total_architectural_soundness_notion = architectural_soundness_notion_1 + architectural_soundness_notion_2 ;
2654
+ var total_sustainability_notion = sustainability_notion_1 + sustainability_notion_2 + sustainability_notion_3 ;
2655
+
2656
+ if ( total_pillar != 100 ) {
2657
+ return '[Trustworthiness] Check pillars weights' ;
2658
+ }
2659
+ if ( total_robustness_notion != 100 ) {
2660
+ return '[Trustworthiness] Check robustness notions weights' ;
2661
+ }
2662
+ if ( total_privacy_notion != 100 ) {
2663
+ return '[Trustworthiness] Check privacy notions weights' ;
2664
+ }
2665
+ if ( total_fairness_notion != 100 ) {
2666
+ return '[Trustworthiness] Check fairness notions weights' ;
2667
+ }
2668
+ if ( total_explainability_notion != 100 ) {
2669
+ return '[Trustworthiness] Check explainability notions weights' ;
2670
+ }
2671
+ if ( total_architectural_soundness_notion != 100 ) {
2672
+ return '[Trustworthiness] Check architectural soundness notions weights' ;
2673
+ }
2674
+ if ( total_sustainability_notion != 100 ) {
2675
+ return '[Trustworthiness] Check sustainability notions weights' ;
2638
2676
}
2639
-
2640
- return false ;
2641
2677
}
2642
2678
</ script >
2643
2679
0 commit comments