|
7 | 7 | <style> |
8 | 8 | body { |
9 | 9 | margin-left: 1em; |
10 | | - font-size: 150%; |
| 10 | + font-size: 140%; |
11 | 11 | } |
12 | 12 | #id_ids { |
13 | 13 | width: 40em; |
|
17 | 17 | margin-top: 1em; |
18 | 18 | font-size: 110%; |
19 | 19 | } |
| 20 | + #missing-activities table { |
| 21 | + border-collapse: collapse; |
| 22 | + width: 95%; |
| 23 | + } |
| 24 | + #missing-activities thead { |
| 25 | + border-bottom: 3px solid #ccc; |
| 26 | + } |
| 27 | + #missing-activities { |
| 28 | + font-size: 90%; |
| 29 | + } |
| 30 | + #missing-activities td, #missing-activities th { |
| 31 | + vertical-align: top; |
| 32 | + padding: 0.4em; |
| 33 | + } |
| 34 | + #missing-activities tr:nth-child(2n+1) { |
| 35 | + background-color: #f3f3fa; |
| 36 | + } |
20 | 37 | </style> |
21 | 38 | </head> |
22 | 39 | <body> |
@@ -47,5 +64,83 @@ <h4>Create a diagram from IDs:</h4> |
47 | 64 | <input id="ids-submit" type="submit" value="View GO-CAM(s)"> |
48 | 65 | </form> |
49 | 66 |
|
| 67 | + <h4>Missing activities</h4> |
| 68 | + <div id="missing-activities"> |
| 69 | + <table> |
| 70 | + <thead> |
| 71 | + <tr> |
| 72 | + <th> |
| 73 | + Pathway |
| 74 | + </th> |
| 75 | + <th> |
| 76 | + Missing activity |
| 77 | + </th> |
| 78 | + <th> |
| 79 | + Process |
| 80 | + </th> |
| 81 | + <th> |
| 82 | + Input/output |
| 83 | + </th> |
| 84 | + <th> |
| 85 | + Occurs in |
| 86 | + </th> |
| 87 | + </tr> |
| 88 | + </thead> |
| 89 | + <tbody> |
| 90 | + </tbody> |
| 91 | + </table> |
| 92 | + </div> |
| 93 | + |
| 94 | + <script type="module"> |
| 95 | +const appPath = '{{app_path}}'; |
| 96 | +const apiPath = '{{api_path}}'; |
| 97 | +const holesUrl = `${apiPath}/missing_activities`; |
| 98 | +const response = await fetch(holesUrl); |
| 99 | +const holes = await response.json(); |
| 100 | +const holesDiv = document.querySelector('#missing-activities'); |
| 101 | +const tbody = holesDiv.querySelector('tbody'); |
| 102 | + |
| 103 | +for (const hole of holes) { |
| 104 | + const rowEl = document.createElement("tr"); |
| 105 | + tbody.appendChild(rowEl); |
| 106 | + let [modelId, modelTitle] = hole.models[0]; |
| 107 | + modelId = modelId.replace('gomodel:', ''); |
| 108 | + |
| 109 | + const modelEl = document.createElement("td"); |
| 110 | + rowEl.appendChild(modelEl); |
| 111 | + const modelLinkEl = document.createElement('a'); |
| 112 | + modelEl.appendChild(modelLinkEl); |
| 113 | + modelLinkEl.textContent = modelTitle; |
| 114 | + modelLinkEl.setAttribute('target', '_blank'); |
| 115 | + modelLinkEl.setAttribute('href', appPath + '/view/model/' +modelId); |
| 116 | + |
| 117 | + const missingActivityEl = document.createElement("td"); |
| 118 | + rowEl.appendChild(missingActivityEl); |
| 119 | + missingActivityEl.textContent = |
| 120 | + hole.label + ' (' + hole.node_id + ')'; |
| 121 | + |
| 122 | + const processEl = document.createElement("td"); |
| 123 | + rowEl.appendChild(processEl); |
| 124 | + processEl.textContent = hole.part_of_process.label + ' (' + |
| 125 | + hole.part_of_process.id + ')'; |
| 126 | + |
| 127 | + let inputs = hole.has_input.map(input => input.label).join(','); |
| 128 | + if (inputs.length == 0) { |
| 129 | + inputs = '?'; |
| 130 | + } |
| 131 | + let outputs = hole.has_output.map(output => output.label).join(','); |
| 132 | + if (outputs.length == 0) { |
| 133 | + outputs = '?'; |
| 134 | + } |
| 135 | + const inputOutputEl = document.createElement("td"); |
| 136 | + rowEl.appendChild(inputOutputEl); |
| 137 | + inputOutputEl.textContent = inputs + ' / ' + outputs; |
| 138 | + |
| 139 | + let occursInText = hole.has_input.map(input => input.label).join(','); |
| 140 | + const occursInEl = document.createElement("td"); |
| 141 | + rowEl.appendChild(occursInEl); |
| 142 | + occursInEl.textContent = occursInText; |
| 143 | +} |
| 144 | + </script> |
50 | 145 | </body> |
51 | 146 | </html> |
0 commit comments