Adding Capif provider
[nonrtric/plt/sme.git] / provider / view / getapi.html
1 <!--
2    ========================LICENSE_START=================================
3    O-RAN-SC
4    %%
5    Copyright (C) 2023: Nordix Foundation
6    %%
7    Licensed under the Apache License, Version 2.0 (the "License");
8    you may not use this file except in compliance with the License.
9    You may obtain a copy of the License at
10
11         http://www.apache.org/licenses/LICENSE-2.0
12
13    Unless required by applicable law or agreed to in writing, software
14    distributed under the License is distributed on an "AS IS" BASIS,
15    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16    See the License for the specific language governing permissions and
17    limitations under the License.
18    ========================LICENSE_END===================================
19 -->
20 {{define "title"}}
21   CAPIF Provider | {{index . "name"}}
22 {{end}}
23
24 {{define "body"}}
25
26 {{if .isResponse}}
27 <div class="p-5 mb-4 bg-light rounded-3">
28     <div class="container-fluid py-5">
29       <h4 class="card-subtitle mb-3 text-body-secondary">Response from CAPIF core</h4>
30       <div class="callout callout-info">
31         <h5 class="card-subtitle mb-3 text-body-secondary">ServiceAPIDescription</h5>
32         <div id="response">
33         </div>
34       </div>
35
36       <div class="btns col-md-12 text-center">
37         <form action="/" method="GET">
38             <input class="btn btn-secondary" formaction="/" type="submit" value="Return to main page">
39           </form>
40       </div>
41     </div>
42   </div>
43   <script>
44     var htmlResponse = "{{.response}}"
45     const strData = JSON.parse(htmlResponse);
46     let out = "";
47     strData.forEach((api) => {
48         out += `
49           <h6>
50             ApiId:
51             <small id="ApiId" class="text-muted">${api.apiId}</small>
52           </h6>
53           <h6>
54             ApiName:
55             <small id="ApiName" class="text-muted">${api.apiName}</small>
56           </h6>
57           <h6>
58             Description:
59             <small id="Description" class="text-muted">${api.description}</small>
60           </h6>
61
62           <h6>AefProfiles:</h6>
63           <div id="responseTable" class="table-responsive">
64             <table class="table accordion">
65               <thead>
66                  <tr>
67                     <th scope="col">AefId</th>
68                     <th scope="col">AefLocation</th>
69                     <th scope="col">DomainName</th>
70                     <th scope="col">Protocol</th>
71                     <th scope="col">SecurityMethods</th>
72                  </tr>
73               </thead>
74               <tbody id="data-output">
75                  <!-- Prodcuts from javascript file in here. -->
76                  ${printAefProfiles(api.aefProfiles)}
77               </tbody>
78            </table>
79           </div>
80         `;
81
82         document.querySelector("#response").innerHTML = out;
83     });
84   </script>
85 {{- else}}
86     <div class="p-5 mb-4 bg-light rounded-3">
87         <div class="container-fluid py-5">
88             {{if .isError}}
89                 <div class="alert alert-danger" role="alert">
90                     {{.response}}
91                 </div>
92             {{end}}
93             <h5 class="card-subtitle mb-3 text-body-secondary">API publishing functions> Get APIs</h5>
94             <form action="/getapi" method="GET">
95                 <div class="mb-3">
96                     <label for="apfId" class="form-label">ApfId:</label>
97                     <input type="text" class="form-control" id="apfId" name="apfId" placeholder="apfId" required>
98                 </div>
99                 <div class="btns col-md-12 text-center">
100                     <input class="btn btn-primary" type="submit" value="Submit">
101                     <input class="btn btn-secondary" formaction="/" type="submit" value="Cancel" formnovalidate>
102                 </div>
103             </form>
104         </div>
105     </div>
106 {{- end}}
107 {{end}}
108
109