@@ -42,19 +42,26 @@ function showDetails(data, connected) {
42
42
let description = document . createElement ( "div" ) ;
43
43
if ( data [ "features" ] . includes ( "simulator" ) ) {
44
44
const quoted_sim = `[id='${ data . id } ']` ;
45
- description . innerHTML = `<div class='d-flex justify-content-between align-items-center'>
45
+ description . innerHTML = `<div class='d-flex justify-content-between align-items-center sticky-top border-bottom border-2' style='background-color: white; '>
46
46
<h2>${ data [ "full_name" ] } </h2>
47
- <button class='btn btn-outline-primary align-middle' title='Center ${ data [ "short_name" ] } in the graph' onclick="highlightNode(cy.nodes('${ quoted_sim . replace ( / ' / g, "\\'" ) } '));">
48
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-bullseye" viewBox="0 0 16 16">
49
- <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/>
50
- <path d="M8 13A5 5 0 1 1 8 3a5 5 0 0 1 0 10m0 1A6 6 0 1 0 8 2a6 6 0 0 0 0 12"/>
51
- <path d="M8 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6m0 1a4 4 0 1 0 0-8 4 4 0 0 0 0 8"/>
52
- <path d="M9.5 8a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/>
47
+ <div id='center_button'>
48
+ <button class='btn btn-outline-primary align-middle m-1 me-2' title='Center ${ data [ "short_name" ] } in the graph' onclick="highlightNode(cy.nodes('${ quoted_sim . replace ( / ' / g, "\\'" ) } '));">
49
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-zoom-in" viewBox="0 0 16 16">
50
+ <path fill-rule="evenodd" d="M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11M13 6.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0"/>
51
+ <path d="M10.344 11.742q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1 6.5 6.5 0 0 1-1.398 1.4z"/>
52
+ <path fill-rule="evenodd" d="M6.5 3a.5.5 0 0 1 .5.5V6h2.5a.5.5 0 0 1 0 1H7v2.5a.5.5 0 0 1-1 0V7H3.5a.5.5 0 0 1 0-1H6V3.5a.5.5 0 0 1 .5-.5"/>
53
+ </svg>
54
+ </div>
55
+ <div class="d-none" id='uncenter_button'>
56
+ <button class='btn btn-outline-primary align-middle m-1 me-2' title='Go back to default view' onclick="unhighlightNode(null);">
57
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-zoom-out" viewBox="0 0 16 16">
58
+ <path fill-rule="evenodd" d="M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11M13 6.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0"/>
59
+ <path d="M10.344 11.742q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1 6.5 6.5 0 0 1-1.398 1.4z"/>
60
+ <path fill-rule="evenodd" d="M3 6.5a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5"/>
53
61
</svg>
54
- </button>
55
62
</div>` ;
56
63
} else {
57
- description . innerHTML = `<h2>${ data [ "full_name" ] } </h2>` ;
64
+ description . innerHTML = `<h2 class="sticky-top border-bottom border-2" style='background-color: white;' >${ data [ "full_name" ] } </h2>` ;
58
65
}
59
66
description . innerHTML += "<p>" + data [ "description" ] + "</p>" ;
60
67
// Relations
@@ -103,20 +110,46 @@ function showDetails(data, connected) {
103
110
link_heading . innerHTML = "Links" ;
104
111
let tool_links = data [ "urls" ] ;
105
112
details_bottom . appendChild ( link_heading ) ;
113
+ const flex_div = document . createElement ( "div" ) ;
114
+ flex_div . classList . add ( "d-flex" , "flex-wrap" ) ;
115
+ const btnClasses = [ "btn-primary" , "btn-success" , "btn-warning" ] ;
106
116
for ( let row_idx = 0 ; row_idx < BUTTON_ROWS . length ; row_idx ++ ) {
107
- let row = document . createElement ( "div" ) ;
108
- row . classList . add ( "row" ) ;
109
117
// Go through elements in BUTTON_ROWS
110
118
for ( const button_type of BUTTON_ROWS [ row_idx ] ) {
111
- let col = document . createElement ( "div" ) ;
112
- col . classList . add ( "col-auto" ) ;
113
- let button = urlButton ( button_type , tool_links [ button_type ] ) ;
114
- col . appendChild ( button ) ;
115
- row . appendChild ( col ) ;
119
+ let button = urlButton ( button_type , tool_links [ button_type ] , btnClasses [ row_idx ] ) ;
120
+ flex_div . appendChild ( button ) ;
116
121
}
117
- details_bottom . appendChild ( row ) ;
118
122
}
123
+ details_bottom . appendChild ( flex_div ) ;
124
+
125
+ // Back to simulators
126
+ back_p = document . createElement ( "p" ) ;
127
+ back_p . classList . add ( "mt-3" ) ;
128
+ back_button = document . createElement ( "a" ) ;
129
+ back_button . href = "#" ;
130
+ back_button . innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-counterclockwise" viewBox="0 0 16 16">
131
+ <path fill-rule="evenodd" d="M8 3a5 5 0 1 1-4.546 2.914.5.5 0 0 0-.908-.417A6 6 0 1 0 8 2z"/>
132
+ <path d="M8 4.466V.534a.25.25 0 0 0-.41-.192L5.23 2.308a.25.25 0 0 0 0 .384l2.36 1.966A.25.25 0 0 0 8 4.466"/>
133
+ </svg> Back to simulators` ;
134
+ back_button . classList . add ( "btn" , "btn-secondary" ) ;
135
+ back_button . onclick = function ( ) { cy . nodes ( `[id = '${ data . id } ']` ) . unselect ( ) ; cy . nodes ( "#simulators" ) . select ( ) ; unhighlightNode ( ) ; } ;
136
+ back_p . appendChild ( back_button ) ;
137
+ details_bottom . appendChild ( back_p ) ;
138
+ // Edit footer
139
+ edit_p = document . createElement ( "p" ) ;
140
+ edit_p . classList . add ( "mt-3" , "text-end" ) ;
141
+ edit_link = document . createElement ( "a" ) ;
142
+ edit_link . classList . add ( "link-secondary" ) ;
143
+ edit_link . href = `${ REPO_URL } /edit/${ GIT_BRANCH } /${ DATA_FOLDER } /${ data [ "short_name" ] . replaceAll ( " " , "-" ) } .yaml` ;
144
+ edit_link . innerHTML = "Edit this description on GitHub " ;
145
+ edit_link . innerHTML += `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-github" viewBox="0 0 16 16">
146
+ <path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8"/>
147
+ </svg>` ;
148
+ edit_link . target = "_blank" ;
149
+ edit_p . appendChild ( edit_link ) ;
150
+ details_bottom . appendChild ( edit_p ) ;
119
151
}
152
+
120
153
// hide filter pane
121
154
const filterPane = new bootstrap . Offcanvas ( '#filter_pane' ) ;
122
155
// FIXME: not quite sure what is going on here, but sometimes the internal state is incorrect
0 commit comments