NONRTRIC-946: Servicemanager - Add Read The Docs
[nonrtric/plt/sme.git] / invoker / view / discovery.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 Invoker | {{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">DiscoveredAPIs - 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     console.log(strData)
47     let index = 0
48     let out = "";
49     strData.serviceAPIDescriptions.forEach((api) => {
50         out += `
51           <h6>
52             ApiId:
53             <small id="ApiId" class="text-muted">${api.apiId}</small>
54           </h6>
55           <h6>
56             ApiName:
57             <small id="ApiName" class="text-muted">${api.apiName}</small>
58           </h6>
59           <h6>
60             Description:
61             <small id="Description" class="text-muted">${api.description}</small>
62           </h6>
63           
64           <h6>AefProfiles:</h6>
65           <div id="responseTable" class="table-responsive">
66             <table class="table accordion">
67               <thead>
68                  <tr>
69                     <th scope="col">AefId</th>
70                     <th scope="col">AefLocation</th>
71                     <th scope="col">DomainName</th>
72                     <th scope="col">Protocol</th>
73                     <th scope="col">SecurityMethods</th>
74                  </tr>
75               </thead>
76               <tbody id="data-output">
77                  <!-- Prodcuts from javascript file in here. -->
78                  ${printAefProfiles(api.aefProfiles, index)}
79               </tbody>
80            </table>
81           </div>
82         `;
83         index++;
84         document.querySelector("#response").innerHTML = out;
85     });
86   </script>
87 {{- else}}
88     <div class="p-5 mb-4 bg-light rounded-3">
89         <div class="container-fluid py-5">
90             {{if .isError}}
91                 <div class="alert alert-danger" role="alert">
92                     {{.response}}
93                 </div>
94             {{end}}
95             {{if .isEmpty}}
96                 <div class="alert alert-warning" role="alert">
97                     {{.response}}
98                 </div>
99             {{end}}
100             <h5 class="card-subtitle mb-3 text-body-secondary">CAPIF_Discover_Service_API > Discover_Service_API</h5>
101             <form action="/discovery" method="GET">
102                 <div class="mb-3">
103                     <label for="apfId" class="form-label">API invoker identifier:</label>
104                     <input type="text" class="form-control" id="api-invoker-id" name="api-invoker-id" placeholder="invokerId" required>
105                 </div>
106                 <div class="mb-3">
107                     <label for="apfId" class="form-label">API name:</label>
108                     <input type="text" class="form-control" id="api-name" name="api-name" placeholder="apiName it is set as {apiName} part of the URI " >
109                 </div>
110                 <div class="mb-3">
111                     <label for="apfId" class="form-label">API major version the URI:</label>
112                     <input type="text" class="form-control" id="api-version" name="api-version" placeholder="apiVersion" >
113                 </div>
114                 <div class="mb-3">
115                     <label for="apfId" class="form-label">Communication type used by the API:</label>
116                     <input type="text" class="form-control" id="comm-type" name="comm-type" placeholder="commType e.g. REQUEST_RESPONSE" >
117                 </div>
118                 <div class="mb-3">
119                     <label for="apfId" class="form-label">Protocol:</label>
120                     <input type="text" class="form-control" id="protocol" name="protocol" placeholder="protocol" >
121                 </div>
122                 <div class="mb-3">
123                     <label for="apfId" class="form-label">AEF identifer:</label>
124                     <input type="text" class="form-control" id="aef-id" name="aef-id" placeholder="aefId" >
125                 </div>
126                 <div class="mb-3">
127                     <label for="apfId" class="form-label">Data formats used by the API:</label>
128                     <input type="text" class="form-control" id="data-format" name="data-format" placeholder="dataFormat e.g. serialization protocol JSON used" >
129                 </div>
130                 <div class="mb-3">
131                     <label for="apfId" class="form-label">Api category:</label>
132                     <input type="text" class="form-control" id="api-cat" name="api-cat" placeholder="apiCat" >
133                 </div>
134                 <div class="mb-3">
135                     <label for="apfId" class="form-label">Preferred Aef Location:</label>
136                     <input type="text" class="form-control" id="preferred-aef-loc" name="preferred-aef-loc" placeholder="preferredAefLoc" >
137                 </div>
138                 <div class="mb-3">
139                     <label for="apfId" class="form-label">Supported Features:</label>
140                     <input type="text" class="form-control" id="supported-features" name="supported-features" placeholder="suppFeat" >
141                 </div>
142                 <div class="btns col-md-12 text-center">
143                     <input class="btn btn-primary" type="submit" value="Submit">
144                     <input class="btn btn-secondary" formaction="/" type="submit" value="Cancel" formnovalidate>
145                 </div>
146             </form>
147         </div>
148     </div>
149 {{- end}}
150 {{end}}
151
152