Skip to content

Commit 0677621

Browse files
authored
fix: download after template, move download & colab under each left tab (#161)
1 parent 2fbdce9 commit 0677621

13 files changed

+59
-30
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
restore-keys: |
9898
pnpm-and-pip-cache-
9999
100-
- run: pip install -Uq pip wheel && sh scripts/run_code_style.sh install
100+
- run: pip install -Uq pip wheel && bash scripts/run_code_style.sh install
101101
- run: npm i -g pnpm
102102
- run: pnpm i --frozen-lockfile --color
103103
- run: pnpm lint

__tests__/text-classification.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ test('text classification all', async () => {
4747
expect(await page.isChecked('#include_test-checkbox')).toBeTruthy()
4848

4949
await page.waitForSelector('text=README.md')
50-
await page.click(':nth-match(:text("Training"), 2)')
50+
await page.click('text=Training')
5151

5252
await page.check('#deterministic-checkbox')
5353
expect(await page.isChecked('#deterministic-checkbox')).toBeTruthy()
@@ -97,7 +97,7 @@ test('text classification launch', async () => {
9797
await page.selectOption('select', 'template-text-classification')
9898

9999
await page.waitForSelector('text=README.md')
100-
await page.click(':nth-match(:text("Training"), 2)')
100+
await page.click('text=Training')
101101

102102
await page.check('#use_dist-checkbox')
103103
expect(await page.isChecked('#use_dist-checkbox')).toBeTruthy()
@@ -119,7 +119,7 @@ test('text classification spawn', async () => {
119119
await page.selectOption('select', 'template-text-classification')
120120

121121
await page.waitForSelector('text=README.md')
122-
await page.click(':nth-match(:text("Training"), 2)')
122+
await page.click('text=Training')
123123

124124
await page.check('#use_dist-checkbox')
125125
expect(await page.isChecked('#use_dist-checkbox')).toBeTruthy()

__tests__/vision-classification.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ test('vision classification all', async () => {
4747
expect(await page.isChecked('#include_test-checkbox')).toBeTruthy()
4848

4949
await page.waitForSelector('text=README.md')
50-
await page.click(':nth-match(:text("Training"), 2)')
50+
await page.click('text=Training')
5151

5252
await page.check('#deterministic-checkbox')
5353
expect(await page.isChecked('#deterministic-checkbox')).toBeTruthy()
@@ -97,7 +97,7 @@ test('vision classification launch', async () => {
9797
await page.selectOption('select', 'template-vision-classification')
9898

9999
await page.waitForSelector('text=README.md')
100-
await page.click(':nth-match(:text("Training"), 2)')
100+
await page.click('text=Training')
101101

102102
await page.check('#use_dist-checkbox')
103103
expect(await page.isChecked('#use_dist-checkbox')).toBeTruthy()
@@ -119,7 +119,7 @@ test('vision classification spawn', async () => {
119119
await page.selectOption('select', 'template-vision-classification')
120120

121121
await page.waitForSelector('text=README.md')
122-
await page.click(':nth-match(:text("Training"), 2)')
122+
await page.click('text=Training')
123123

124124
await page.check('#use_dist-checkbox')
125125
expect(await page.isChecked('#use_dist-checkbox')).toBeTruthy()

__tests__/vision-dcgan.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ test('vision dcgan all', async () => {
4747
expect(await page.isChecked('#include_test-checkbox')).toBeTruthy()
4848

4949
await page.waitForSelector('text=README.md')
50-
await page.click(':nth-match(:text("Training"), 2)')
50+
await page.click('text=Training')
5151

5252
await page.check('#deterministic-checkbox')
5353
expect(await page.isChecked('#deterministic-checkbox')).toBeTruthy()
@@ -97,7 +97,7 @@ test('vision dcgan launch', async () => {
9797
await page.selectOption('select', 'template-vision-dcgan')
9898

9999
await page.waitForSelector('text=README.md')
100-
await page.click(':nth-match(:text("Training"), 2)')
100+
await page.click('text=Training')
101101

102102
await page.check('#use_dist-checkbox')
103103
expect(await page.isChecked('#use_dist-checkbox')).toBeTruthy()
@@ -119,7 +119,7 @@ test('vision dcgan spawn', async () => {
119119
await page.selectOption('select', 'template-vision-dcgan')
120120

121121
await page.waitForSelector('text=README.md')
122-
await page.click(':nth-match(:text("Training"), 2)')
122+
await page.click('text=Training')
123123

124124
await page.check('#use_dist-checkbox')
125125
expect(await page.isChecked('#use_dist-checkbox')).toBeTruthy()

__tests__/vision-segmentation.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ test('vision segmentation all', async () => {
4747
expect(await page.isChecked('#include_test-checkbox')).toBeTruthy()
4848

4949
await page.waitForSelector('text=README.md')
50-
await page.click(':nth-match(:text("Training"), 2)')
50+
await page.click('text=Training')
5151

5252
await page.check('#deterministic-checkbox')
5353
expect(await page.isChecked('#deterministic-checkbox')).toBeTruthy()
@@ -97,7 +97,7 @@ test('vision segmentation launch', async () => {
9797
await page.selectOption('select', 'template-vision-segmentation')
9898

9999
await page.waitForSelector('text=README.md')
100-
await page.click(':nth-match(:text("Training"), 2)')
100+
await page.click('text=Training')
101101

102102
await page.check('#use_dist-checkbox')
103103
expect(await page.isChecked('#use_dist-checkbox')).toBeTruthy()
@@ -119,7 +119,7 @@ test('vision segmentation spawn', async () => {
119119
await page.selectOption('select', 'template-vision-segmentation')
120120

121121
await page.waitForSelector('text=README.md')
122-
await page.click(':nth-match(:text("Training"), 2)')
122+
await page.click('text=Training')
123123

124124
await page.check('#use_dist-checkbox')
125125
expect(await page.isChecked('#use_dist-checkbox')).toBeTruthy()

src/components/NavBar.vue

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
</h1>
1414
<div class="left-side-badges">
1515
<NavHelp />
16-
<NavDownload />
17-
<NavColab />
1816
<NavGitHub />
1917
<NavTwitter />
2018
<NavDiscord />

src/components/NavColab.vue

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<template>
22
<button
33
@click="downloadProject"
4-
class="download-button external-links"
4+
class="download-button"
55
title="Open in Colab"
66
>
77
<a
88
class="external-links"
9-
v-bind:href="colabLink"
9+
:href="colabLink"
1010
target="_blank"
1111
rel="noopener noreferrer"
1212
>
@@ -63,7 +63,7 @@
6363
</svg>
6464
</g>
6565
</svg>
66-
<span class="icon-text">Open in Colab</span>
66+
<span>Open in Colab</span>
6767
</a>
6868
</button>
6969
<div
@@ -227,8 +227,6 @@ export default {
227227
</script>
228228

229229
<style scoped>
230-
@import url('./css/nav-right.css');
231-
232230
.download-button {
233231
display: inline-flex;
234232
align-items: center;
@@ -238,7 +236,13 @@ export default {
238236
cursor: pointer;
239237
font-family: var(--font-family-base);
240238
font-size: 1em;
241-
padding: 0;
239+
padding: 0.5rem 1rem;
240+
border: 1px solid var(--c-brand-red);
241+
border-radius: 4px;
242+
}
243+
.external-links {
244+
display: flex;
245+
align-items: center;
242246
}
243247
.download-success {
244248
position: fixed;

src/components/NavDownload.vue

+8-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<polyline points="7 10 12 15 17 10"></polyline>
2121
<line x1="12" y1="15" x2="12" y2="3"></line>
2222
</svg>
23-
<span class="icon-text">Download</span>
23+
<span>Download</span>
2424
</button>
2525
<div
2626
class="download-success"
@@ -85,8 +85,6 @@ export default {
8585
</script>
8686

8787
<style scoped>
88-
@import url('./css/nav-right.css');
89-
9088
.download-button {
9189
display: inline-flex;
9290
align-items: center;
@@ -96,7 +94,12 @@ export default {
9694
cursor: pointer;
9795
font-family: var(--font-family-base);
9896
font-size: 1em;
99-
padding: 0;
97+
padding: 0.5rem 1rem;
98+
border: 1px solid var(--c-brand-red);
99+
border-radius: 4px;
100+
}
101+
.download-button span {
102+
margin-left: 0.25rem;
100103
}
101104
.download-success {
102105
position: fixed;
@@ -108,7 +111,7 @@ export default {
108111
height: 100vh;
109112
}
110113
.msg-wrapper {
111-
position: absolute;
114+
position: fixed;
112115
max-width: 38rem;
113116
padding: 0 1rem;
114117
text-align: center;

src/components/NavHelp.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export default {
8282
height: 100vh;
8383
}
8484
.help-wrapper {
85-
position: absolute;
85+
position: fixed;
8686
max-width: 38rem;
8787
padding: 0 0.5rem;
8888
margin: 20vh auto 100%;

src/components/PaneLeft.vue

+21-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
</div>
1212
</div>
1313
<div class="left-pane-contexts">
14+
<div class="download-n-colab">
15+
<NavDownload />
16+
<NavColab />
17+
</div>
1418
<KeepAlive>
1519
<component :is="currentTabComponent" />
1620
</KeepAlive>
@@ -24,11 +28,21 @@ import TabTraining from './TabTraining.vue'
2428
import TabHandlers from './TabHandlers.vue'
2529
import TabLoggers from './TabLoggers.vue'
2630
import Message from './Message.vue'
31+
import NavDownload from './NavDownload.vue'
32+
import NavColab from './NavColab.vue'
2733
import { computed, ref } from 'vue'
2834
import { msg, store } from '../store.js'
2935
3036
export default {
31-
components: { TabTemplates, TabTraining, TabLoggers, TabHandlers, Message },
37+
components: {
38+
TabTemplates,
39+
TabTraining,
40+
TabLoggers,
41+
TabHandlers,
42+
Message,
43+
NavDownload,
44+
NavColab
45+
},
3246
setup() {
3347
const currentTab = ref('Templates')
3448
const tabs = ['Templates', 'Training', 'Handlers', 'Loggers']
@@ -108,4 +122,10 @@ export default {
108122
margin-bottom: 2.5rem;
109123
}
110124
}
125+
.download-n-colab {
126+
display: flex;
127+
align-items: center;
128+
justify-content: space-evenly;
129+
margin-top: 1rem;
130+
}
111131
</style>

src/metadata/metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
"output_dir": {
104104
"name": "output_dir",
105105
"type": "text",
106-
"description": "Directory to save all outputs",
106+
"description": "Directory to save all outputs (including checkpoints, logs)",
107107
"default": "./logs"
108108
},
109109
"log_every_iters": {

src/store.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ export const store = reactive({
4141
code: {},
4242
config: {
4343
template: '',
44-
include_test: false
44+
include_test: false,
45+
output_dir: './logs',
46+
log_every_iters: 2
4547
}
4648
})
4749

src/views/Create.vue

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ export default {
4444
// which are defined in store.js
4545
store.config.template = ''
4646
store.config.include_test = false
47+
store.config.output_dir = './logs'
48+
store.config.log_every_iters = 2
4749
})
4850
}
4951
}

0 commit comments

Comments
 (0)