Skip to content

Commit 1021ccd

Browse files
author
Christopher Gokey
committed
MMT-3252: Updates to use node v18
1 parent d3b56f1 commit 1021ccd

28 files changed

+17120
-9767
lines changed

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
lts/gallium
1+
lts/hydrogen

Dockerfile

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1-
#This image provides the ability to run Ruby/RSpec tests against a Clojure app.
2-
# To build:
3-
# sudo docker build --rm --force-rm --tag=$(basename $(pwd)) .
4-
5-
FROM centos:centos7
6-
1+
FROM centos:centos8
72
USER root
8-
# Get java, epel, whatnot
9-
RUN yum install -y epel-release centos-release-scl-rh llvm-toolset-7-clang \
10-
&& yum --enablerepo=updates clean metadata \
11-
&& yum install -y bzip2 \
12-
chromedriver \
13-
cmake \
14-
https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm \
15-
https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm \
16-
git \
17-
gcc \
18-
gcc-c++ \
19-
ImageMagick \
20-
java-11-openjdk-headless.x86_64 \
3+
RUN cd /etc/yum.repos.d/
4+
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
5+
RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
6+
RUN yum install -y epel-release
7+
#RUN yum install -y centos-release-scl-rh
8+
#RUN yum install -y llvm-toolset-7-clang
9+
#&& yum --enablerepo=updates clean metadata \
10+
RUN yum install -y bzip2
11+
RUN yum install -y cmake
12+
RUN yum install -y https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
13+
RUN yum install -y chromedriver
14+
RUN yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
15+
RUN yum install -y git gcc gcc-c++
16+
RUN yum install -y ImageMagick
17+
RUN yum install -y java-11-openjdk-headless.x86_64 \
2118
liberation-fonts \
2219
libffi-devel \
2320
libicu-devel \
@@ -29,13 +26,12 @@ RUN yum install -y epel-release centos-release-scl-rh llvm-toolset-7-clang \
2926
tar \
3027
which \
3128
xorg-x11-server-Xvfb \
32-
docker \
33-
&& yum clean all
34-
# && freshclam
35-
36-
RUN curl -sL https://rpm.nodesource.com/setup_16.x | bash -
29+
docker
30+
RUN curl -fsSL https://rpm.nodesource.com/setup_18.x | bash -
31+
RUN curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo
32+
RUN yum install -y gcc-c++ make
3733
RUN yum install -y nodejs && yum clean all
38-
RUN npm install --global yarn
34+
RUN yum install -y yarn
3935

4036
ENV JAVA_HOME /etc/alternatives/jre
4137

@@ -51,15 +47,19 @@ RUN curl -OL https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.2.tar.gz \
5147
&& cd / \
5248
&& rm -fr ruby-2.7.2
5349

50+
RUN dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
51+
RUN dnf -y module -y disable postgresql
52+
RUN dnf clean all
5453
ENV PATH /usr/pgsql-11/bin:$PATH
5554
RUN gem install bundler
5655
RUN groupadd -g 500 bamboo
5756
RUN useradd --gid bamboo --create-home --uid 500 bamboo
58-
RUN yum install -y postgresql11-devel
57+
RUN dnf install -y perl
58+
RUN dnf --enablerepo=powertools install perl-IPC-Run -y
59+
RUN dnf install -y postgresql11-devel
5960

6061
USER bamboo
6162
WORKDIR /build
6263
ENV HOME /home/bamboo
6364
ENV PATH /home/bamboo/.gem/ruby/2.7.2/bin:/opt/google/chrome/:$PATH
64-
RUN gem install rspec --version=3.9 --user-install
65-
USER root
65+
RUN gem install rspec --version=3.9 --user-install

app/javascript/components/editor/App.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { observer } from 'mobx-react'
55
import MetadataEditor from './MetadataEditor'
66
import DetailedProgressView from './components/progress/DetailedProgressView'
77
import MetadataEditorForm from './components/MetadataEditorForm'
8+
import DeleteDraftView from './components/deleteView/DeleteDraftView'
89

910
type AppProps = {
1011
editor: MetadataEditor;
@@ -23,6 +24,7 @@ class App extends React.Component<AppProps, never> {
2324
<Route path={`/${editor.model.documentType}/:id/edit/:sectionName/:fieldName`} element={<MetadataEditorForm editor={editor} {...this.props} />} />
2425
<Route path={`/${editor.model.documentType}/:id/edit/:sectionName/:fieldName/:index`} element={<MetadataEditorForm editor={editor} {...this.props} />} />
2526
<Route path={`/${editor.model.documentType}/new`} element={<MetadataEditorForm editor={editor} {...this.props} />} />
27+
<Route path={`/${editor.model.documentType}/deleteDraftView`} element={<DeleteDraftView editor={editor} {...this.props} />} />
2628
<Route path="/" element={<MetadataEditorForm editor={editor} {...this.props} />} />
2729
</Routes>
2830
</BrowserRouter>

app/javascript/components/editor/MetadataEditor.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ export default class MetadataEditor {
200200
return this.service.publishDraft(draft)
201201
}
202202

203+
async deleteDraft(draft: Draft): Promise<Draft> {
204+
return this.service.deleteDraft(draft)
205+
}
206+
203207
async fetchKmsKeywords(keywordScheme: string): Promise<object> {
204208
return this.service.fetchKmsKeywords(keywordScheme)
205209
}

app/javascript/components/editor/components/NavigationView.tsx

+6-7
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,21 @@ class NavigationView extends React.Component<NavigationViewProps, NavigationView
7878

7979
saveDraftAndPreview() {
8080
const {
81-
editor
81+
editor, router
8282
} = this.props
83+
const { navigate } = router
8384
const {
8485
draft
8586
} = editor
8687
this.setState({ saving: true }, () => {
8788
editor.saveDraft(draft).then((draft) => {
8889
editor.draft = draft
8990
this.setState({ saving: false })
90-
// this will be needed to redirect to the preview page which is rendered by rails
91-
setTimeout(() => {
91+
if (editor.documentType === 'variable_drafts') {
9292
window.location.href = `/${editor.documentType}/${draft.apiId}`
93-
}, 50)
94-
// } else {
95-
// navigate(`/${editor.documentType}/${draft.apiId}`, { replace: false })
96-
// }
93+
} else {
94+
navigate(`/${editor.documentType}/${draft.apiId}`, { replace: false })
95+
}
9796
}).catch((error) => {
9897
editor.status = new Status('warning', `error saving draft! ${error.message}`)
9998
this.setState({ saving: false })

app/javascript/components/editor/components/__tests__/NavigationView.test.js

+2-15
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@ global.fetch = require('jest-fetch-mock')
1616

1717
global.scroll = jest.fn()
1818

19-
// Window.location doesn't work in jest, so we need to mock its value.
20-
global.window = Object.create(window)
21-
const url = 'http://dummy.com'
22-
Object.defineProperty(window, 'location', {
23-
value: {
24-
href: url
25-
},
26-
writable: true
27-
})
28-
2919
async function mockFetch(url) {
3020
switch (url) {
3121
case '/api/providers/MMT_1/tool_drafts': {
@@ -88,6 +78,7 @@ describe('Navigation View Component', () => {
8878
})
8979

9080
beforeAll(() => jest.spyOn(window, 'fetch'))
81+
Window.prototype.metadataPreview = jest.fn()
9182

9283
test('renders the navigation view', async () => {
9384
const model = new UmmToolsModel()
@@ -166,11 +157,7 @@ describe('Navigation View Component', () => {
166157
await act(async () => {
167158
saveAndPreviewButton.click()
168159
})
169-
// Need to skip this test temorary because we are redirecting to the detailed progress view
170-
// in order to render the MMT tool preview along with the details progress view.
171-
// The redirect does not work properly in the test.
172-
// Once we build a new preview this test can be included again.
173-
// expect(screen.getByText('Metadata Fields')).toBeInTheDocument()
160+
expect(screen.getByText('Metadata Fields')).toBeInTheDocument()
174161
expect(container).toMatchSnapshot()
175162
})
176163

0 commit comments

Comments
 (0)