-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
main-page.html
231 lines (230 loc) · 11.5 KB
/
main-page.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
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
<dom-module id="main-page">
<template>
<style is="custom-style" include="iron-flex iron-flex-alignment"></style>
<style>
*, :host, :host * {box-sizing: border-box}
:host {
@apply --layout-vertical;
--accent-color: #007dfc;
--primary-background-color: #003c75;
--sidebar-default-color: #ffffff4f;
--border-color: #f4f4f6;
}
.flex {flex: 1}
.bottom {
margin-top: auto;
@apply --layout-horizontal;
}
#MainDrawer {
color: white;
background: var(--primary-background-color);
--app-drawer-content-container: {
background: transparent;
@apply --layout-vertical;
}
}
#MainDrawer .menu-item {
cursor: pointer;
transition: background .25s;
font-family: Google Sans;
color: var(--sidebar-default-color);
}
#MainDrawer .menu-item+.divider {width: 90%;margin: 1em auto;border-bottom: 2px solid var(--sidebar-default-color)}
#MainDrawer .menu-item:hover {background: #ffffff1b}
#MainDrawer .menu-item.iron-selected {background: #ffffff3b;color: white;font-weight: 100}
#MainDrawer .footer {padding: 1.25rem;font-size: .9em;color: var(--sidebar-default-color);line-height: 1.5em}
#MainDrawer .footer > .build {font-size: .9em;font-style: italic;color: rgba(255, 255, 255, 0.64)}
#NamespaceSelector {position: absolute;left: 1em;top: 50%;transform: translateY(-50%)}
app-toolbar {display: flex;justify-content: center}
paper-tabs {
--paper-tabs-selection-bar-color: var(--accent-color);
--paper-tab-ink: var(--accent-color);
--paper-tabs-selection-bar: {
border-radius: 50px 50px 0 0;
border-width: 3px;
}
}
paper-tab {padding: 0 2em}
paper-tab.iron-selected {color: var(--accent-color)}
app-header-layout {@apply --layout-vertical}
#Menu {position: absolute;right: 10px;top: 50%;transform: translateY(-50%)}
#PageFrame {
border: 0;
display: inline-block;
width: 100%;
height: 100%;
}
#Logo {
display: flex;
align-items: center;
margin: 0 0 1em;
padding: 2em;
}
#Logo > img {
width: 3em;
margin-right: 1em;
}
#Logo > figcaption {
font-size: 1.3em;
font-family: Google Sans;
}
#Dashboard {
background: #f1f3f4;
padding: 1em;
display: grid;
--primary-background-color: white;
}
#Dashboard > paper-card {
border-radius: 5px;
margin: 1em;
grid-column: 1 / span 2;
--paper-card-header: {
font-family: "Google Sans"
}
}
#Dashboard > paper-card.thin {grid-column: 3}
#Dashboard > .Getting-Started paper-icon-item:not(:last-of-type) {
border-bottom: 1px solid var(--border-color);
}
#Dashboard > .Getting-Started paper-icon-item iron-icon {
color: var(--accent-color)
}
#Dashboard > .Quick-Links {grid-column: 3}
#Dashboard > .Quick-Links .link {
width: 80%;
margin: .5em auto;
border: 1px solid #eeeeef;
padding: .5em 1em;
border-radius: 5px;
@apply --layout-horizontal;
}
#Dashboard > .Quick-Links .link.more-coming {opacity: .4;font-style: italic;pointer-events: none}
#Dashboard > .Quick-Links .link .button {color: var(--accent-color);background: rgba(0, 125, 252, 0.25);border-radius: 50%}
#Dashboard:after {content: '';grid-column: 1 span 3}
#Activity {@apply --layout-vertical;@apply --layout-center-center}
#Activity:before, #Activity:after {font-size: 3em;opacity: .3;font-family: Google Sans}
#Activity:before {content: ":(";font-size: 6em;transform: rotateZ(90deg)}
#Activity:after {content: "No content here yet..."}
[hides] {transition: opacity .25s}
[hidden] {opacity: 0;pointer-events: none}
[hidden]:not([hides]) {display: none}
</style>
<app-drawer-layout class="flex" narrow="{{narrowMode}}">
<app-drawer slot="drawer" id="MainDrawer">
<figure id="Logo">
<img alt='Kubeflow Logo' src='assets/kf-logo_64px.svg'>
<figcaption>Kubeflow</figcaption>
</figure>
<iron-selector id='SidebarSelector' selected='{{sidebarItemIndex}}'>
<template is="dom-repeat" items="[[links]]">
<paper-item on-click="openLink" class='menu-item'>[[item.text]]</paper-item>
<template is="dom-if" if="[[item.hasDivider]]">
<aside class='divider'></aside>
</template>
</template>
</iron-selector>
<aside class="flex"></aside>
<footer class="footer">
<section class='privacy'>Privacy</section>
<section class='build'>build version v[[buildVersion]]</section>
</footer>
</app-drawer>
<app-header-layout fullbleed>
<app-header slot="header" fixed>
<app-toolbar>
<paper-tabs class="bottom" selected="{{primaryViewIndex}}" hides hidden$='[[!isZero(homeOrIframeViewIndex)]]'>
<paper-tab>Dashboard</paper-tab>
<paper-tab hidden$='[[!_devMode]]'>Activity</paper-tab>
</paper-tabs>
<aside id="NamespaceSelector" hidden$='[[!_devMode]]'>
<paper-dropdown-menu label="Namespace"></paper-dropdown-menu>
</aside>
<paper-icon-button id="Menu" icon='menu' on-click="toggleSidebar" hides hidden$="[[!narrowMode]]"></paper-icon-button>
</app-toolbar>
</app-header>
<neon-animated-pages selected="[[homeOrIframeViewIndex]]" class="flex layout vertical" entry-animation="fade-in-animation" exit-animation="fade-out-animation">
<neon-animated-pages id='PrimaryView' selected="[[primaryViewIndex]]" class="flex layout vertical" entry-animation="fade-in-animation" exit-animation="fade-out-animation">
<article id='Dashboard'>
<paper-card heading="Getting Started" class="Getting-Started" hidden$='[[!_devMode]]'>
<template is="dom-repeat" items="[[gettingStartedItems]]">
<paper-icon-item>
<iron-icon icon="[[item.icon]]" slot="item-icon"></iron-icon>
<paper-item-body two-line>
<div>[[item.text]]</div>
<aside secondary>Lorem ipsum...</aside>
</paper-item-body>
</paper-icon-item>
</template>
</paper-card>
<paper-card heading="Quick Links" class="Quick-Links">
<template is="dom-repeat" items="[[quickLinks]]">
<article class="link">
<paper-item-body>[[item.text]]</paper-item-body>
<paper-icon-button class="button" icon='arrow-forward' alt='[[item.text]]', on-click='openQuickLink'></paper-icon-button>
</article>
</template>
<article class="link more-coming">
<paper-item-body>More coming soon</paper-item-body>
<paper-icon-button class="button" icon='arrow-forward' diabled></paper-icon-button>
</article>
</paper-card>
</article>
<article id='Activity'></article>
</neon-animated-pages>
<iframe id='PageFrame' src="[[url]]" class="flex"></iframe>
</neon-animated-pages>
</app-header-layout>
</app-drawer-layout>
</template>
<script>
class MainPage extends Polymer.Element {
static get is() {return "main-page"}
static get properties() {return {
links: {type: Array, value: [
{text: 'Home', defaultPage: true, hasDivider: true},
{link: 'https://www.kubeflow.org/docs/about/kubeflow/', text: 'Kubeflow docs'},
{link: '/jupyter/', text: 'JupyterHub'},
{link: '/tfjobs/ui/', text: 'TFJob Dashboard'},
{link: '/katib/', text: 'Katib Dashboard'},
{link: '/pipeline/', text: 'Pipeline Dashboard'},
]},
gettingStartedItems: {type: Array, value: [
{text: 'Build a model in a notebook', icon: 'donut-large'},
{text: 'Launch a pipeline', icon: 'donut-large'},
{text: 'Deploy a solution', icon: 'donut-large'},
{text: 'Compare run output', icon: 'donut-large'},
{text: 'Share solution on AI Hub', icon: 'donut-large'},
]},
quickLinks: {type: Array, value: [
{text: 'Open docs', link: 'https://www.kubeflow.org/docs/started/getting-started/'},
{text: 'Open Github', link: 'https://github.com/kubeflow/kubeflow'},
]},
sidebarItemIndex: {type: Number, value: 0},
primaryViewIndex: {type: Number, value: 0},
homeOrIframeViewIndex: {type: Number, value: 0},
url: {type: String, value: ""},
buildVersion: {type: String, value: "0.4.1"},
_devMode: {type: Boolean, value: false},
}}
openExternalLink(href) {
const a = document.createElement('a')
a.href = link
a.target='_blank'
a.click()
}
openQuickLink(e) {
const {link} = e.model.item
openExternalLink(link)
}
openLink(e) {
const {link, defaultPage} = e.model.item
this.homeOrIframeViewIndex = defaultPage?0:1
if (defaultPage) return
this.url = link
}
toggleSidebar() {this.$.MainDrawer.toggle()}
isZero(i) {return i === 0}
}
customElements.define(MainPage.is, MainPage)
</script>
</dom-module>