Skip to content

Commit 189da60

Browse files
bors[bot]bidoubiwa
andauthored
Merge #1082 #1084
1082: Improve javascript playground r=bidoubiwa a=bidoubiwa 1084: Update github actions version to v2 r=bidoubiwa a=bidoubiwa Co-authored-by: Charlotte Vermandel <[email protected]>
3 parents 5603e1d + 6c3b095 + 478a142 commit 189da60

File tree

5 files changed

+42
-26
lines changed

5 files changed

+42
-26
lines changed

.github/workflows/pre-release-tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ name: Pre-Release Tests
44
# Will only run for PRs and pushes to bump-meilisearch-v*
55
on:
66
push:
7-
branches: bump-meilisearch-v*
7+
branches: [bump-meilisearch-v*]
88
pull_request:
9-
branches: bump-meilisearch-v*
9+
branches: [bump-meilisearch-v*]
1010

1111
jobs:
1212
integration_tests:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
node: [ '12', '14' ]
16+
node: ["12", "14"]
1717
name: integration-tests-against-rc (Node.js ${{ matrix.node }})
1818
steps:
1919
- uses: actions/checkout@v2
@@ -24,7 +24,7 @@ jobs:
2424
./node_modules
2525
key: ${{ hashFiles('yarn.lock') }}
2626
- name: Setup node
27-
uses: actions/setup-node@v1
27+
uses: actions/setup-node@v2
2828
with:
2929
node-version: ${{ matrix.node }}
3030
- name: print version

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v2
12-
- uses: actions/setup-node@v1
12+
- uses: actions/setup-node@v2
1313
with:
1414
node-version: 12
1515
registry-url: https://registry.npmjs.org/

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
node: [ '12', '14' ]
21+
node: ["12", "14"]
2222
name: integration-tests (Node.js ${{ matrix.node }})
2323
steps:
2424
- uses: actions/checkout@v2
@@ -29,7 +29,7 @@ jobs:
2929
./node_modules
3030
key: ${{ hashFiles('yarn.lock') }}
3131
- name: Setup node
32-
uses: actions/setup-node@v1
32+
uses: actions/setup-node@v2
3333
with:
3434
node-version: ${{ matrix.node }}
3535
- name: print version
@@ -63,7 +63,7 @@ jobs:
6363
./node_modules
6464
key: ${{ hashFiles('yarn.lock') }}
6565
- name: Setup node
66-
uses: actions/setup-node@v1
66+
uses: actions/setup-node@v2
6767
- name: Install dependencies
6868
run: yarn --dev
6969
- name: Run style check

playgrounds/javascript/index.html

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="utf-8" />
5-
<meta
6-
name="viewport"
7-
content="width=device-width, initial-scale=1, shrink-to-fit=no"
8-
/>
9-
<meta name="theme-color" content="#000000" />
10-
</head>
11-
<body>
123

4+
<head>
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
7+
<meta name="theme-color" content="#000000" />
8+
</head>
139

10+
<body>
11+
12+
13+
<h2 class="errors_title">Errors:</h2>
14+
<div class="errors"></div>
15+
16+
<h2>Movies index:</h2>
17+
<div class="indexes"></div>
18+
<h2>Search response:</h2>
19+
<div class="hits"></div>
20+
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4"></script>
21+
<script src="/src/app.js"></script>
22+
</body>
1423

15-
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4"></script>
16-
<script src="/src/app.js"></script>
17-
</body>
1824
</html>

playgrounds/javascript/src/app.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,31 @@ const addDataset = async () => {
3131
}
3232

3333
;(async () => {
34-
await addDataset()
3534
try {
36-
const index = await client.getOrCreateIndex('movies')
37-
38-
const resp = await index.search(
39-
'Moana',
35+
await addDataset()
36+
const indexes = await client.getIndexes()
37+
document.querySelector('.indexes').innerText = JSON.stringify(
38+
indexes,
39+
null,
40+
2
41+
)
42+
const resp = await client.index(uid).search(
43+
'',
4044
{
41-
limit: 1,
4245
attributesToHighlight: ['title'],
4346
},
4447
'POST'
4548
)
4649
console.log({ resp })
4750
console.log({ hit: resp.hits[0] })
51+
document.querySelector('.hits').innerText = JSON.stringify(
52+
resp.hits,
53+
null,
54+
2
55+
)
56+
document.querySelector('.errors_title').style.display = 'none'
4857
} catch (e) {
4958
console.error(e)
59+
document.querySelector('.errors').innerText = JSON.stringify(e, null, 2)
5060
}
5161
})()

0 commit comments

Comments
 (0)