summaryrefslogtreecommitdiffstats
path: root/testapi/3rd_party/static/testapi-ui/components/results/results.html
blob: 2a43cd1e2e0f30da75fadb973f3ec17633187759 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<h3>{{ctrl.pageHeader}}</h3>
<p>{{ctrl.pageParagraph}}</p>

<div class="result-filters">
    <h4>Filters</h4>
    <div class="row">
        <div class="col-md-3">
            <label for="cpid">Start Date</label>
            <p class="input-group">
                <input type="text" class="form-control"
                    uib-datepicker-popup="{{ctrl.format}}"
                    ng-model="ctrl.startDate" is-open="ctrl.startOpen"
                    close-text="Close" />
                <span class="input-group-btn">
                    <button type="button" class="btn btn-default" ng-click="ctrl.open($event, 'startOpen')">
                        <i class="glyphicon glyphicon-calendar"></i>
                    </button>
                </span>
            </p>
        </div>
        <div class="col-md-3">
            <label for="cpid">End Date</label>
            <p class="input-group">
                <input type="text" class="form-control"
                    uib-datepicker-popup="{{ctrl.format}}"
                    ng-model="ctrl.endDate" is-open="ctrl.endOpen"
                    close-text="Close" />
                <span class="input-group-btn">
                    <button type="button" class="btn btn-default" ng-click="ctrl.open($event, 'endOpen')">
                        <i class="glyphicon glyphicon-calendar"></i>
                    </button>
                </span>
            </p>
        </div>
        <div class="col-md-3" style="margin-top:24px;">
            <button type="submit" class="btn btn-primary" ng-click="ctrl.update()">Filter</button>
            <button type="submit" class="btn btn-primary btn-danger" ng-click="ctrl.clearFilters()">Clear</button>
        </div>
    </div>
</div>

<div cg-busy="{promise:ctrl.authRequest,message:'Loading'}"></div>
<div cg-busy="{promise:ctrl.resultsRequest,message:'Loading'}"></div>

<div ng-show="ctrl.data" class="results-table">
    <table ng-show="ctrl.data" class="table table-striped table-hover">
        <thead>
            <tr>
                <th ng-if="ctrl.isUserResults"></th>
                <th>Upload Date</th>
                <th>Test Run ID</th>
                <th ng-if="ctrl.isUserResults">Vendor</th>
                <th ng-if="ctrl.isUserResults">Product (version)</th>
                <th ng-if="ctrl.isUserResults">Target Program</th>
                <th ng-if="ctrl.isUserResults">Guideline</th>
                <th ng-if="ctrl.isUserResults">Verified</th>
                <th ng-if="ctrl.isUserResults">Shared</th>
            </tr>
        </thead>

        <tbody>
            <tr ng-repeat-start="(index, result) in ctrl.data.results">
                <td ng-if="ctrl.isUserResults">
                    <a ng-if="!result.expanded"
                       class="glyphicon glyphicon-plus"
                       ng-click="result.expanded = true">
                    </a>
                    <a ng-if="result.expanded"
                       class="glyphicon glyphicon-minus"
                       ng-click="result.expanded = false">
                    </a>
                </td>
                <td>{{result.created_at}}</td>
                <td><a ui-sref="resultsDetail({testID: result.id})">
                        {{result.id.slice(0, 8)}}...{{result.id.slice(-8)}}
                    </a>
                </td>
                <td ng-if="ctrl.isUserResults">
                    {{ctrl.vendors[result.product_version.product_info.organization_id].name || '-'}}
                </td>
                <td ng-if="ctrl.isUserResults">{{result.product_version.product_info.name || '-'}}
                    <span ng-if="result.product_version.version">
                        ({{result.product_version.version}})
                    </span>
                </td>
                <td ng-if="ctrl.isUserResults">{{ctrl.targetMappings[result.meta.target] || '-'}}</td>
                <td ng-if="ctrl.isUserResults">{{result.meta.guideline.slice(0, -5) || '-'}}</td>
                <td ng-if="ctrl.isUserResults">
                    <span ng-if="result.verification_status" class="glyphicon glyphicon-ok"></span>
                    <span ng-if="!result.verification_status">-</span>

                </td>
                <td ng-if="ctrl.isUserResults">
                    <span ng-show="result.meta.shared" class="glyphicon glyphicon-share"></span>
                </td>
            </tr>
            <tr ng-if="result.expanded" ng-repeat-end>
                <td></td>
                <td colspan="3">
                    <strong>Publicly Shared:</strong>
                    <span ng-if="result.meta.shared == 'true' && !result.sharedEdit">Yes</span>
                    <span ng-if="!result.meta.shared && !result.sharedEdit">
                        <em>No</em>
                    </span>
                    <select ng-if="result.sharedEdit"
                            ng-model="result.meta.shared"
                            class="form-inline">
                            <option value="true">Yes</option>
                            <option value="">No</option>
                    </select>
                    <a ng-if="!result.sharedEdit"
                       ng-click="result.sharedEdit = true"
                       title="Edit"
                       class="glyphicon glyphicon-pencil"></a>
                    <a ng-if="result.sharedEdit"
                       ng-click="ctrl.associateMeta(index,'shared',result.meta.shared)"
                       title="Save"
                       class="glyphicon glyphicon-floppy-disk"></a>
                    <br />

                    <strong>Associated Guideline:</strong>
                    <span ng-if="!result.meta.guideline && !result.guidelineEdit">
                        <em>None</em>
                    </span>
                    <span ng-if="result.meta.guideline && !result.guidelineEdit">
                        {{result.meta.guideline.slice(0, -5)}}
                    </span>
                    <select ng-if="result.guidelineEdit"
                            ng-model="result.meta.guideline"
                            ng-options="o as o.slice(0, -5) for o in ctrl.versionList"
                            class="form-inline">
                        <option value="">None</option>
                    </select>
                    <a ng-if="!result.guidelineEdit"
                       ng-click="ctrl.getVersionList();result.guidelineEdit = true"
                       title="Edit"
                       class="glyphicon glyphicon-pencil"></a>
                    <a ng-if="result.guidelineEdit"
                       ng-click="ctrl.associateMeta(index, 'guideline', result.meta.guideline)"
                       title="Save"
                       class="glyphicon glyphicon-floppy-disk">
                    </a>
                    <br />

                    <strong>Associated Target Program:</strong>
                    <span ng-if="!result.meta.target && !result.targetEdit">
                        <em>None</em>
                    </span>
                    <span ng-if="result.meta.target && !result.targetEdit">
                        {{ctrl.targetMappings[result.meta.target]}}</span>
                    <select ng-if="result.targetEdit"
                            ng-model="result.meta.target"
                            class="form-inline">
                        <option value="">None</option>
                        <option value="platform">OpenStack Powered Platform</option>
                        <option value="compute">OpenStack Powered Compute</option>
                        <option value="object">OpenStack Powered Object Storage</option>
                    </select>
                    <a ng-if="!result.targetEdit"
                       ng-click="result.targetEdit = true;"
                       title="Edit"
                       class="glyphicon glyphicon-pencil">
                    </a>
                    <a ng-if="result.targetEdit"
                       ng-click="ctrl.associateMeta(index, 'target', result.meta.target)"
                       title="Save"
                       class="glyphicon glyphicon-floppy-disk">
                    </a>
                    <br />

                    <strong>Associated Product:</strong>
                    <span ng-if="!result.product_version && !result.productEdit">
                        <em>None</em>
                    </span>
                    <span ng-if="result.product_version && !result.productEdit">
                        <span ng-if="ctrl.products[result.product_version.product_info.id].product_type == 0">
                            <a ui-sref="distro({id: result.product_version.product_info.id})">
                                {{ctrl.products[result.product_version.product_info.id].name}}
                                <small ng-if="result.product_version.version">
                                    ({{result.product_version.version}})
                                </small>
                            </a>
                        </span>
                        <span ng-if="ctrl.products[result.product_version.product_info.id].product_type != 0">
                            <a ui-sref="cloud({id: result.product_version.product_info.id})">
                                {{ctrl.products[result.product_version.product_info.id].name}}
                                <small ng-if="result.product_version.version">
                                    ({{result.product_version.version}})
                                </small>
                            </a>
                        </span>
                    </span>

                    <select ng-if="result.productEdit"
                            ng-options="product as product.name for product in ctrl.products | arrayConverter | orderBy: 'name' track by product.id"
                            ng-model="result.selectedProduct"
                            ng-change="ctrl.getProductVersions(result)">
                        <option value="">-- No Product --</option>
                    </select>

                    <span ng-if="result.productVersions.length && result.productEdit">
                        <span class="glyphicon glyphicon-arrow-right" style="padding-right:3px;color:#303030;"></span>
                        Version:
                        <select ng-options="version as version.version for version in result.productVersions | orderBy: 'version' track by version.id"
                                ng-model="result.selectedVersion">
                        </select>

                    </span>
                    <a ng-if="!result.productEdit"
                       ng-click="ctrl.prepVersionEdit(result)"
                       title="Edit"
                       class="glyphicon glyphicon-pencil">
                    </a>
                    <a ng-if="result.productEdit"
                       ng-click="ctrl.associateProductVersion(result)"
                       confirm="Once you associate this test to this product, ownership
                                will be transferred to the product's vendor admins.
                                Continue?"
                       title="Save"
                       class="glyphicon glyphicon-floppy-disk">
                    </a>
                    <br />
                </td>
            </tr>
        </tbody>
    </table>

    <div class="pages">
        <uib-pagination
            total-items="ctrl.totalItems"
            ng-model="ctrl.currentPage"
            items-per-page="ctrl.itemsPerPage"
            max-size="ctrl.maxSize"
            class="pagination-sm"
            boundary-links="true"
            rotate="false"
            num-pages="ctrl.numPages"
            ng-change="ctrl.update()">
        </uib-pagination>
    </div>
</div>

<div ng-show="ctrl.showError" class="alert alert-danger" role="alert">
    <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
    <span class="sr-only">Error:</span>
    {{ctrl.error}}
</div>