Skip to content

Commit 502c742

Browse files
pablaKshitizGIT
andauthored
Models Hub v2.9.0 (#13361)
* FEATURE NMH-139: Add annotator to ElasticSearch [skip-test] * FEATURE NMH-139: Add annotator class search in UI * FEATURE NMH-139: Used Sidebar Select for annotator filter [skip-test] * FEATURE NMH-140: Copy S3 Url functionality [skip-test] * FEATURE NMH-116: Frontend changes for autocomplete [skip-test] * FEATURE NMH-116: Fix issues with downshift [skip-test] * FEATURE NMH-116: Making sure debounce works [skip-test] * BUGFIX NMH-139: tags and predicted entities come from another endpoint * FEATURE NMH-151: Changed file selection based on MD5 digest [skip-test] * FEATURE NMH-130: Incremental nlp website build [skip-test] * FEATURE NMH-151: Speed up NLP Website with Github Actions [skip-test] Co-authored-by: Kshitiz Shakya <[email protected]>
1 parent dd17879 commit 502c742

27 files changed

+1014
-108
lines changed

.github/workflows/create_search_index.yml

+61-6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
branches:
66
- master
77

8+
concurrency:
9+
# Make sure only workflow run at a time for create_search_index.yml
10+
group: ${{ github.workflow }}
11+
812
jobs:
913
jekyll:
1014
runs-on: ubuntu-latest
@@ -18,22 +22,57 @@ jobs:
1822
ruby-version: 2.7
1923
working-directory: docs
2024
bundler-cache: true
21-
- name: Index changed posts
25+
- name: Download artifacts
26+
uses: dawidd6/action-download-artifact@v2
27+
with:
28+
github_token: ${{ secrets.GITHUB_TOKEN }}
29+
workflow: create_search_index.yml
30+
workflow_conclusion: success
31+
name: jekyll-build
32+
path: docs
33+
if_no_artifact_found: ignore
34+
- name: Extract artifacts
35+
working-directory: docs
36+
run: >
37+
(7z x -o_site/ jekyll-content.zip
38+
&& rm jekyll-content.zip
39+
&& mv _site/.jekyll-metadata ./
40+
&& mv _site/backup-models.json ./
41+
&& mv _site/backup-benchmarking.json ./
42+
&& mv _site/backup-references.json ./)
43+
|| true
44+
- name: Incremental build
45+
id: incremental-build
46+
env:
47+
ELASTICSEARCH_URL: ${{ secrets.ELASTICSEARCH_URL }}
48+
ELASTICSEARCH_ACCESS_TOKEN: ${{ secrets.ELASTICSEARCH_ACCESS_TOKEN }}
49+
ELASTICSEARCH_INDEX_NAME: ${{ secrets.ELASTICSEARCH_INDEX_NAME }}
50+
SEARCH_ORIGIN: ${{ secrets.SEARCH_ORIGIN }}
51+
working-directory: docs
52+
run: |
53+
bundle exec jekyll build --incremental
54+
continue-on-error: ${{ steps.incremental-build.outputs.require_full_build == 'true' }}
55+
- name: Full build
56+
id: full-build
57+
if: ${{ steps.incremental-build.outputs.require_full_build == 'true' }}
2258
env:
2359
ELASTICSEARCH_URL: ${{ secrets.ELASTICSEARCH_URL }}
2460
ELASTICSEARCH_ACCESS_TOKEN: ${{ secrets.ELASTICSEARCH_ACCESS_TOKEN }}
61+
ELASTICSEARCH_INDEX_NAME: ${{ secrets.ELASTICSEARCH_INDEX_NAME }}
62+
SEARCH_ORIGIN: ${{ secrets.SEARCH_ORIGIN }}
2563
working-directory: docs
2664
run: |
27-
git diff --name-only ${{github.event.before}}..${{github.event.after}} > changes.txt
28-
git diff --name-only ${{github.event.after}}..${{github.event.before}} >> changes.txt
29-
bundle exec jekyll build
30-
- uses: actions/setup-node@v2
65+
rm -f .jekyll-metadata
66+
FULL_BUILD=1 bundle exec jekyll build --incremental
67+
- uses: actions/setup-node@v3
3168
with:
32-
node-version: 14
69+
node-version: 16
3370
cache: yarn
3471
cache-dependency-path: docs/_frontend/yarn.lock
3572
- name: Build frontend
3673
working-directory: docs/_frontend
74+
env:
75+
SEARCH_ORIGIN: ${{ secrets.SEARCH_ORIGIN }}
3776
run: |
3877
yarn
3978
yarn run build
@@ -43,3 +82,19 @@ jobs:
4382
with:
4483
github_token: ${{ secrets.GITHUB_TOKEN }}
4584
publish_dir: ./docs/_site
85+
- name: Zip contents for artifacts
86+
uses: vimtor/action-zip@v1
87+
with:
88+
files: >
89+
./docs/_site/
90+
./docs/.jekyll-metadata
91+
./docs/backup-models.json
92+
./docs/backup-benchmarking.json
93+
./docs/backup-references.json
94+
dest: jekyll-content.zip
95+
- name: Upload artifacts
96+
uses: actions/upload-artifact@v3
97+
with:
98+
name: jekyll-build
99+
path: |
100+
./jekyll-content.zip

docs/Gemfile

+4
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ gem 'wdm', '~> 0.1.0'
1010
gem "webrick"
1111

1212
gem "jekyll", "~> 3.9"
13+
14+
group "jekyll-plugins" do
15+
gem "jekyll-incremental", "0.1.0", path: "_plugins/jekyll-incremental"
16+
end

docs/Gemfile.lock

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
PATH
2+
remote: _plugins/jekyll-incremental
3+
specs:
4+
jekyll-incremental (0.1.0)
5+
jekyll (~> 3.9)
6+
17
GEM
28
remote: https://rubygems.org/
39
specs:
@@ -297,6 +303,7 @@ DEPENDENCIES
297303
elasticsearch (~> 7.10)
298304
github-pages (= 227)
299305
jekyll (~> 3.9)
306+
jekyll-incremental (= 0.1.0)!
300307
nokogiri (>= 1.13.9)
301308
wdm (~> 0.1.0)
302309
webrick

docs/_config.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ exclude:
200200
- /screenshots
201201
- /test
202202
- /vendor
203+
- backup-*.json
203204
- /_frontend
204205

205206
defaults:
@@ -225,4 +226,5 @@ plugins:
225226
- jekyll-feed
226227
- jekyll-paginate
227228
- jekyll-sitemap
228-
- jemoji
229+
- jemoji
230+
- jekyll-incremental

docs/_frontend/src/models/App/App.js

+1-40
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,7 @@ import React, { useState, useEffect } from 'react';
22
import Form from '../Form';
33
import ModelItem from '../ModelItem';
44
import ModelItemList from '../ModelItemList';
5-
6-
const SEARCH_ORIGIN = 'https://search.modelshub.johnsnowlabs.com';
7-
8-
const toSearchString = (params) => {
9-
const searchParams = Object.keys(params).reduce((acc, k) => {
10-
if (params[k]) {
11-
switch (k) {
12-
case '_type':
13-
break;
14-
15-
case 'supported':
16-
acc.append(k, Number(params[k]));
17-
break;
18-
19-
case 'tags':
20-
case 'predicted_entities':
21-
params[k].forEach((v) => {
22-
acc.append(k, v);
23-
});
24-
break;
25-
case 'sort':
26-
if (params[k] !== 'date') {
27-
acc.append(k, params[k]);
28-
}
29-
break;
30-
case 'recommended':
31-
break;
32-
default:
33-
acc.append(k, params[k]);
34-
break;
35-
}
36-
} else {
37-
if (k === 'recommended') acc.append(k, Number(params[k]));
38-
}
39-
return acc;
40-
}, new URLSearchParams());
41-
42-
const search = searchParams.toString();
43-
return search ? '?' + search : '';
44-
};
5+
import { SEARCH_ORIGIN, toSearchString } from '../common';
456

467
const fromSearchString = () => {
478
const params = {};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
2+
.selectedItem {
3+
display: inline-flex;
4+
background: #e2e6ee;
5+
border-radius: 2px;
6+
align-items: center;
7+
margin: 4px;
8+
margin-top: 0;
9+
margin-left: 0;
10+
max-width: 100%;
11+
}
12+
13+
.selectedItem__value {
14+
padding: 2px 4px;
15+
line-height: 14px;
16+
white-space: nowrap;
17+
overflow: hidden;
18+
text-overflow: ellipsis;
19+
min-width: 0;
20+
}
21+
22+
.selectedItem__x {
23+
display: flex;
24+
width: 20px;
25+
height: 20px;
26+
justify-content: center;
27+
align-items: center;
28+
cursor: default;
29+
30+
&:hover {
31+
background: #9ea8bd;
32+
color: #fff;
33+
}
34+
}
35+
36+
.combobox {
37+
display: flex;
38+
background: #ffffff;
39+
border: 1px solid #e8e9ea;
40+
box-sizing: border-box;
41+
border-radius: 2px;
42+
}
43+
44+
.combobox__input {
45+
border: none;
46+
background: transparent;
47+
min-width: 0;
48+
font-family: Roboto, sans-serif;
49+
font-weight: 500;
50+
font-size: 14px;
51+
line-height: 24px;
52+
padding: 6px 16px;
53+
padding-right: 0;
54+
width: 100%;
55+
}
56+
57+
.combobox__toggle {
58+
background-image: url("data:image/svg+xml,%3Csvg width='14' height='8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m5.757 5.76.653-.757-.653.757Zm2.609.003-.651-.758.65.758Zm-1.956-.76L1.653.901.347 2.415l4.757 4.103L6.41 5.003ZM12.5.9 7.715 5.005l1.302 1.517 4.784-4.105L12.5.899ZM5.104 6.518a3 3 0 0 0 3.913.004L7.715 5.005a1 1 0 0 1-1.305-.002L5.104 6.518Z' fill='%23FF8A00'/%3E%3C/svg%3E");
59+
background-repeat: no-repeat;
60+
background-position: 50% 50%;
61+
width: 36px;
62+
height: 36px;
63+
flex-shrink: 0;
64+
}
65+
66+
.menuWrapper {
67+
position: relative;
68+
z-index: 1000;
69+
}
70+
71+
.menu {
72+
background: #ffffff;
73+
border: 1px solid #e7edf0;
74+
box-sizing: border-box;
75+
box-shadow: 0px 5px 25px rgba(30, 119, 183, 0.25);
76+
padding: 0;
77+
margin: 0;
78+
position: absolute;
79+
list-style: none;
80+
min-width: 100%;
81+
max-height: 240px;
82+
overflow: scroll;
83+
}
84+
85+
.menu__item {
86+
font-family: Roboto, sans-serif;
87+
font-style: normal;
88+
font-weight: 500;
89+
font-size: 13px;
90+
line-height: 18px;
91+
padding: 6px 12px;
92+
box-sizing: border-box;
93+
}
94+
95+
.menu__item.isEmpty {
96+
text-align: center;
97+
color: #9ea8bd;
98+
font-weight: normal;
99+
}

0 commit comments

Comments
 (0)