/
nuxeo-drive-desktop-packages.js
153 lines (128 loc) · 3.77 KB
/
nuxeo-drive-desktop-packages.js
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
/**
(C) Copyright 2016 Nuxeo SA (http://nuxeo.com/) and contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Contributors:
Nelson Silva <nsilva@nuxeo.com>
*/
import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js';
import { html } from '@polymer/polymer/lib/utils/html-tag.js';
import { I18nBehavior } from '@nuxeo/nuxeo-ui-elements/nuxeo-i18n-behavior.js';
/**
An element listing Nuxeo Drive desktop client packages for download.
Example:
<nuxeo-drive-desktop-packages application="Nuxeo Drive"></nuxeo-drive-desktop-packages>
@group Nuxeo UI Elements
@element nuxeo-drive-desktop-packages
*/
Polymer({
_template: html`
<style include="iron-flex iron-flex-alignment iron-flex-factors nuxeo-styles">
:host {
display: block;
}
.table {
font-family: var(--nuxeo-app-font);
line-height: 3.5;
}
.row {
border-bottom: 1px solid var(--nuxeo-border);
@apply --layout-horizontal;
}
.row:hover {
background-color: var(--nuxeo-container-hover);
}
.header {
background-color: var(--nuxeo-table-header-background);
color: var(--nuxeo-table-header-titles);
font-weight: 400;
height: 56px;
display: flex;
flex-direction: row;
}
.cell {
padding: 0 24px 0 24px;
min-height: 46px;
overflow: hidden;
}
paper-button {
line-height: normal;
}
.platform {
background-color: #50c3f0;
border-radius: 3px;
color: #fff;
font-size: 0.9em;
letter-spacing: 0.04em;
line-height: 130%;
margin: 0 0.2em 0.2em 0;
padding: 0.06em 0.3em;
text-transform: uppercase;
vertical-align: baseline;
white-space: nowrap;
}
</style>
<nuxeo-connection platform-version="{{_tp}}"></nuxeo-connection>
<div class="table">
<div class="header">
<div class="cell flex">[[i18n('driveDesktopPackages.platform')]]</div>
<div class="cell flex-3">[[i18n('driveDesktopPackages.install')]]</div>
</div>
<template is="dom-repeat" items="[[packages]]" as="pkg">
<div class="row">
<div class="cell flex"><span class="platform">[[pkg.platform]]</span></div>
<div class="cell flex-3">
<a href$="[[pkg.url]]" tabindex="-1" target="_blank">
<paper-button noink>
[[pkg.name]]
</paper-button>
</a>
</div>
</div>
</template>
</div>
`,
is: 'nuxeo-drive-desktop-packages',
properties: {
packages: {
type: Array,
computed: '_computeUrls(_tp)',
},
_tp: String,
},
behaviors: [I18nBehavior],
_computeUrls(tp) {
if (!tp) {
return;
}
const pkgs = [];
const prefix = 'nuxeo-drive';
const baseUrl = 'https://community.nuxeo.com/static/drive-updates';
let name = `${prefix}-x86_64.AppImage`;
pkgs.push({
name,
platform: 'Linux',
url: `${baseUrl}/${name}`,
});
name = `${prefix}.dmg`;
pkgs.push({
name,
platform: 'macOS',
url: `${baseUrl}/${name}`,
});
name = `${prefix}.exe`;
pkgs.push({
name,
platform: 'Windows',
url: `${baseUrl}/${name}`,
});
return pkgs;
},
});