-
Notifications
You must be signed in to change notification settings - Fork 391
/
Copy path_esr_devices.html
91 lines (87 loc) · 3.53 KB
/
_esr_devices.html
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
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js" integrity="sha512-3oappXMVVac3Ge3OndW0WqpGTWx9jjRJA8SXin8RxmPfc8rg87b31FGy14WHG/ZMRISo9pBjezW9y00RYAEONA==" crossorigin="anonymous"></script>
<script type="text/javascript">
(function () {
var archAliasMap = {
rpi: 'armv6hf',
};
// The following pine client query was used to generate the OData url below.
// TODO: Start using the sdk in the docs and use the call directly.
// await sdk.pine.get({
// resource: 'device_type',
// options: {
// $select: ['name', 'slug', 'logo'],
// $expand: {
// is_of__cpu_architecture: {
// $select: 'slug'
// }
// },
// $filter: {
// is_default_for__application: {
// $any: {
// $alias: 'idfa',
// $expr: {
// idfa: {
// is_host: true,
// is_archived: false,
// owns__release: {
// $any: {
// $alias: 'r',
// $expr: {
// status: 'success',
// is_final: true,
// is_invalidated: false,
// }
// }
// }
// },
// $and: {
// idfa: {
// app_name: {
// $contains: '-esr',
// }
// }
// }
// },
// },
// },
// },
// $orderby: {
// name: 'asc',
// }
// }
// })
window.jQuery
.ajax({
url: "https://api.balena-cloud.com/v7/device_type?$select=name,slug,logo&$expand=is_of__cpu_architecture($select=slug)&$filter=is_default_for__application/any(idfa:((idfa/is_host%20eq%20true)%20and%20(idfa/is_archived%20eq%20false)%20and%20(idfa/owns__release/any(r:(status%20eq%20%27success%27)%20and%20(is_final%20eq%20true)%20and%20(is_invalidated%20eq%20false))))%20and(contains(idfa/app_name,%27-esr%27)))&$orderby=name%20asc"
})
.done(function (deviceTypesResponse) {
var table = _(deviceTypesResponse.d)
.reduce(function (acc, deviceType) {
var archSlug = deviceType.is_of__cpu_architecture[0].slug;
if (archAliasMap[archSlug]) {
archSlug = archAliasMap[archSlug];
}
var tableCell =
"<tr> <td>" +
"<img class='device_icon' src=" + deviceType.logo + " />" +
"</td> <td>" +
deviceType.name +
"</td> <td>" +
deviceType.slug +
"</td> <td>" +
archSlug +
"</td> </tr>";
return acc + tableCell;
}, "");
return window.jQuery("#support_esr_devices_table").append(table);
})
.fail(function (error) {
console.error(error)
return window
.jQuery("#support_esr_devices_table")
.append(
'<tr><td colspan="4">Something went wrong.</td></tr>'
);
});
}.call(this));
</script>