@equinor/echo-cli 1.0.0-beta-9 → 1.0.0-beta-11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/echo-dev-host/package.json +1 -1
- package/echo-dev-host/public/index.css +60 -60
- package/echo-dev-host/src/api/api-plants.ts +22 -22
- package/echo-dev-host/src/app.css +12 -12
- package/echo-dev-host/src/app.tsx +43 -43
- package/echo-dev-host/src/components/Home/Home.tsx +23 -23
- package/echo-dev-host/src/components/Home/home.module.css +38 -38
- package/echo-dev-host/src/components/legend.tsx +3 -3
- package/echo-dev-host/src/index.tsx +90 -90
- package/echo-dev-host/src/setupTests.ts +25 -25
- package/echo-dev-host/src/utils/plants.test.ts +33 -33
- package/echo-dev-host/src/utils/plants.ts +12 -12
- package/echo-dev-host/src/utils/setupSkipAuth.ts +43 -43
- package/lib/echo-build-dev-host.d.ts +1 -1
- package/lib/echo-build-dev-host.js +1 -1
- package/lib/echo-build-dev-host.js.map +1 -1
- package/lib/echo-build.d.ts +5 -5
- package/lib/echo-build.js +10 -6
- package/lib/echo-build.js.map +1 -1
- package/lib/echo-create.d.ts +9 -9
- package/lib/echo-create.js +10 -10
- package/lib/echo-create.js.map +1 -1
- package/lib/echo-dev-host/package.json +1 -1
- package/lib/echo-dev-host/public/index.css +60 -60
- package/lib/echo-dev-host/src/api/api-plants.ts +22 -22
- package/lib/echo-dev-host/src/app.css +12 -12
- package/lib/echo-dev-host/src/app.tsx +43 -43
- package/lib/echo-dev-host/src/components/Home/Home.tsx +23 -23
- package/lib/echo-dev-host/src/components/Home/home.module.css +38 -38
- package/lib/echo-dev-host/src/components/legend.tsx +3 -3
- package/lib/echo-dev-host/src/index.tsx +90 -90
- package/lib/echo-dev-host/src/setupTests.ts +25 -25
- package/lib/echo-dev-host/src/utils/plants.test.ts +33 -33
- package/lib/echo-dev-host/src/utils/plants.ts +12 -12
- package/lib/echo-dev-host/src/utils/setupSkipAuth.ts +43 -43
- package/lib/echo-manifest.d.ts +1 -1
- package/lib/echo-manifest.js +1 -1
- package/lib/echo-manifest.js.map +1 -1
- package/lib/echo-update-dev-host-deps.d.ts +2 -2
- package/lib/echo-update-dev-host-deps.js +3 -3
- package/lib/echo-update-dev-host-deps.js.map +1 -1
- package/lib/tools/buildScripts/buildAndCopyDevHost.js +1 -1
- package/lib/tools/buildScripts/buildAndCopyDevHost.js.map +1 -1
- package/lib/utils/printDevHostVersions.js +5 -6
- package/lib/utils/printDevHostVersions.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { AppLinks, EchoLogo, Footer, PlantSelector } from '@equinor/echo-framework';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import placeholderHomeImage from '../../images/frontpage-brand-placeholder.jpg';
|
|
4
|
-
import style from './home.module.css';
|
|
5
|
-
|
|
6
|
-
export const Home: React.FC = () => {
|
|
7
|
-
return (
|
|
8
|
-
<main className={style.home}>
|
|
9
|
-
<div className={style.plantSelector}>
|
|
10
|
-
<div>
|
|
11
|
-
<EchoLogo />
|
|
12
|
-
</div>
|
|
13
|
-
|
|
14
|
-
<PlantSelector />
|
|
15
|
-
</div>
|
|
16
|
-
<AppLinks />
|
|
17
|
-
<div className={style.brandSliderContainer}>
|
|
18
|
-
<img src={placeholderHomeImage} alt="Application Echo on tablet" />
|
|
19
|
-
</div>
|
|
20
|
-
<Footer />
|
|
21
|
-
</main>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
1
|
+
import { AppLinks, EchoLogo, Footer, PlantSelector } from '@equinor/echo-framework';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import placeholderHomeImage from '../../images/frontpage-brand-placeholder.jpg';
|
|
4
|
+
import style from './home.module.css';
|
|
5
|
+
|
|
6
|
+
export const Home: React.FC = () => {
|
|
7
|
+
return (
|
|
8
|
+
<main className={style.home}>
|
|
9
|
+
<div className={style.plantSelector}>
|
|
10
|
+
<div>
|
|
11
|
+
<EchoLogo />
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<PlantSelector />
|
|
15
|
+
</div>
|
|
16
|
+
<AppLinks />
|
|
17
|
+
<div className={style.brandSliderContainer}>
|
|
18
|
+
<img src={placeholderHomeImage} alt="Application Echo on tablet" />
|
|
19
|
+
</div>
|
|
20
|
+
<Footer />
|
|
21
|
+
</main>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
.home {
|
|
2
|
-
display: grid;
|
|
3
|
-
grid-template-rows: 30% 100px auto 56px;
|
|
4
|
-
gap: 1rem;
|
|
5
|
-
height: 100%;
|
|
6
|
-
width: 100%;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.plantSelector {
|
|
10
|
-
display: flex;
|
|
11
|
-
justify-content: center;
|
|
12
|
-
align-items: baseline;
|
|
13
|
-
align-self: center;
|
|
14
|
-
flex-flow: wrap;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.heading {
|
|
18
|
-
padding-left: 18px;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.brandSliderContainer {
|
|
22
|
-
display: flex;
|
|
23
|
-
flex: 1 1;
|
|
24
|
-
flex-flow: column-reverse;
|
|
25
|
-
margin: 0;
|
|
26
|
-
width: 100%;
|
|
27
|
-
overflow: hidden;
|
|
28
|
-
object-fit: cover;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.appBar {
|
|
32
|
-
margin: 0 auto 48px;
|
|
33
|
-
display: flex;
|
|
34
|
-
flex-wrap: wrap;
|
|
35
|
-
justify-content: center;
|
|
36
|
-
align-items: flex-start;
|
|
37
|
-
}
|
|
38
|
-
|
|
1
|
+
.home {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-rows: 30% 100px auto 56px;
|
|
4
|
+
gap: 1rem;
|
|
5
|
+
height: 100%;
|
|
6
|
+
width: 100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.plantSelector {
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: baseline;
|
|
13
|
+
align-self: center;
|
|
14
|
+
flex-flow: wrap;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.heading {
|
|
18
|
+
padding-left: 18px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.brandSliderContainer {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex: 1 1;
|
|
24
|
+
flex-flow: column-reverse;
|
|
25
|
+
margin: 0;
|
|
26
|
+
width: 100%;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
object-fit: cover;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.appBar {
|
|
32
|
+
margin: 0 auto 48px;
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-wrap: wrap;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
align-items: flex-start;
|
|
37
|
+
}
|
|
38
|
+
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const Legend: React.FC = () => {
|
|
2
|
-
return null;
|
|
3
|
-
};
|
|
1
|
+
export const Legend: React.FC = () => {
|
|
2
|
+
return null;
|
|
3
|
+
};
|
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
import { LoadingModuleOptions } from '@equinor/echo-base';
|
|
2
|
-
import '@equinor/echo-components/style-reset.css';
|
|
3
|
-
import EchoCore, { createEchoAppModuleApi, EventHubProvider, queryClient } from '@equinor/echo-core';
|
|
4
|
-
import { mainMenu, Mediator, searchPanel } from '@equinor/echo-framework';
|
|
5
|
-
import { Icon } from '@equinor/eds-core-react';
|
|
6
|
-
import * as Icons from '@equinor/eds-icons';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { initForE2ETests } from './utils/setupSkipAuth';
|
|
9
|
-
|
|
10
|
-
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
11
|
-
import { createRoot } from 'react-dom/client';
|
|
12
|
-
import { BrowserRouter } from 'react-router-dom';
|
|
13
|
-
import { EchoApp } from './app';
|
|
14
|
-
|
|
15
|
-
const useEdsIcon = (): void => {
|
|
16
|
-
Icon.add({
|
|
17
|
-
...Icons
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const Echo: React.FC = (): JSX.Element => {
|
|
22
|
-
/* Needed to skip authentication when running e2e tests*/
|
|
23
|
-
initForE2ETests();
|
|
24
|
-
|
|
25
|
-
const isAuthenticated = EchoCore.useEchoSetup({
|
|
26
|
-
leftPanels: [searchPanel],
|
|
27
|
-
rightPanel: mainMenu
|
|
28
|
-
});
|
|
29
|
-
useEdsIcon();
|
|
30
|
-
const moduleOptions: LoadingModuleOptions = {
|
|
31
|
-
createApi: createEchoAppModuleApi(),
|
|
32
|
-
dependencies: {
|
|
33
|
-
react: require('react'),
|
|
34
|
-
'react-dom': require('react-dom'),
|
|
35
|
-
'react-router-dom': require('react-router-dom'),
|
|
36
|
-
'@equinor/echo-core': require('@equinor/echo-core'),
|
|
37
|
-
'@equinor/echo-framework': require('@equinor/echo-framework'),
|
|
38
|
-
'@equinor/echo-utils': require('@equinor/echo-utils'),
|
|
39
|
-
'@equinor/echo-components': require('@equinor/echo-components'),
|
|
40
|
-
'@equinor/echo-base': require('@equinor/echo-base'),
|
|
41
|
-
'@equinor/echo-search': require('@equinor/echo-search'),
|
|
42
|
-
'@equinor/eds-core-react': require('@equinor/eds-core-react'),
|
|
43
|
-
'@equinor/eds-icons': require('@equinor/eds-icons'),
|
|
44
|
-
'styled-components': require('styled-components'),
|
|
45
|
-
classnames: require('classnames'),
|
|
46
|
-
lodash: require('lodash'),
|
|
47
|
-
zustand: require('zustand')
|
|
48
|
-
},
|
|
49
|
-
fetchModules: () => {
|
|
50
|
-
return new Promise((resolve) => {
|
|
51
|
-
fetch('/echoModuleManifest.json').then((response) => {
|
|
52
|
-
response.json().then((manifests) => {
|
|
53
|
-
manifests.forEach((manifest) => {
|
|
54
|
-
manifest.fileUri = `/index.js`;
|
|
55
|
-
});
|
|
56
|
-
resolve(manifests);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
return (
|
|
63
|
-
<>
|
|
64
|
-
{isAuthenticated && (
|
|
65
|
-
<EchoCore.AuthProviderComponent>
|
|
66
|
-
{/*
|
|
67
|
-
Need to cast queryClient to QueryClient because of the following error:
|
|
68
|
-
TS2352: Conversion of type 'import("Equinor\\EchopediaWeb\\node_modules\\@tanstack\\query-core\\build\\modern\\hydration-CwYEwyQI").b' to type 'import("Equinor\\EchopediaWeb\\node_modules\\@tanstack\\query-core\\build\\modern\\hydration-BlEK5ylC").b' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
|
69
|
-
Property '#private' in type 'QueryClient' refers to a different member that cannot be accessed from within type 'QueryClient'.
|
|
70
|
-
Based on my research we used the same version of react-query in echopediaWeb and echo-client.
|
|
71
|
-
*/}
|
|
72
|
-
<QueryClientProvider client={queryClient as unknown as QueryClient}>
|
|
73
|
-
<EventHubProvider>
|
|
74
|
-
<Mediator options={moduleOptions} />
|
|
75
|
-
<BrowserRouter>
|
|
76
|
-
<EchoApp />
|
|
77
|
-
</BrowserRouter>
|
|
78
|
-
</EventHubProvider>
|
|
79
|
-
</QueryClientProvider>
|
|
80
|
-
</EchoCore.AuthProviderComponent>
|
|
81
|
-
)}
|
|
82
|
-
</>
|
|
83
|
-
);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
if (!(window !== window.parent && !window.opener)) {
|
|
87
|
-
const container = document.getElementById('root') as HTMLElement;
|
|
88
|
-
const root = createRoot(container);
|
|
89
|
-
root.render(<Echo />);
|
|
90
|
-
}
|
|
1
|
+
import { LoadingModuleOptions } from '@equinor/echo-base';
|
|
2
|
+
import '@equinor/echo-components/style-reset.css';
|
|
3
|
+
import EchoCore, { createEchoAppModuleApi, EventHubProvider, queryClient } from '@equinor/echo-core';
|
|
4
|
+
import { mainMenu, Mediator, searchPanel } from '@equinor/echo-framework';
|
|
5
|
+
import { Icon } from '@equinor/eds-core-react';
|
|
6
|
+
import * as Icons from '@equinor/eds-icons';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { initForE2ETests } from './utils/setupSkipAuth';
|
|
9
|
+
|
|
10
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
11
|
+
import { createRoot } from 'react-dom/client';
|
|
12
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
13
|
+
import { EchoApp } from './app';
|
|
14
|
+
|
|
15
|
+
const useEdsIcon = (): void => {
|
|
16
|
+
Icon.add({
|
|
17
|
+
...Icons
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const Echo: React.FC = (): JSX.Element => {
|
|
22
|
+
/* Needed to skip authentication when running e2e tests*/
|
|
23
|
+
initForE2ETests();
|
|
24
|
+
|
|
25
|
+
const isAuthenticated = EchoCore.useEchoSetup({
|
|
26
|
+
leftPanels: [searchPanel],
|
|
27
|
+
rightPanel: mainMenu
|
|
28
|
+
});
|
|
29
|
+
useEdsIcon();
|
|
30
|
+
const moduleOptions: LoadingModuleOptions = {
|
|
31
|
+
createApi: createEchoAppModuleApi(),
|
|
32
|
+
dependencies: {
|
|
33
|
+
react: require('react'),
|
|
34
|
+
'react-dom': require('react-dom'),
|
|
35
|
+
'react-router-dom': require('react-router-dom'),
|
|
36
|
+
'@equinor/echo-core': require('@equinor/echo-core'),
|
|
37
|
+
'@equinor/echo-framework': require('@equinor/echo-framework'),
|
|
38
|
+
'@equinor/echo-utils': require('@equinor/echo-utils'),
|
|
39
|
+
'@equinor/echo-components': require('@equinor/echo-components'),
|
|
40
|
+
'@equinor/echo-base': require('@equinor/echo-base'),
|
|
41
|
+
'@equinor/echo-search': require('@equinor/echo-search'),
|
|
42
|
+
'@equinor/eds-core-react': require('@equinor/eds-core-react'),
|
|
43
|
+
'@equinor/eds-icons': require('@equinor/eds-icons'),
|
|
44
|
+
'styled-components': require('styled-components'),
|
|
45
|
+
classnames: require('classnames'),
|
|
46
|
+
lodash: require('lodash'),
|
|
47
|
+
zustand: require('zustand')
|
|
48
|
+
},
|
|
49
|
+
fetchModules: () => {
|
|
50
|
+
return new Promise((resolve) => {
|
|
51
|
+
fetch('/echoModuleManifest.json').then((response) => {
|
|
52
|
+
response.json().then((manifests) => {
|
|
53
|
+
manifests.forEach((manifest) => {
|
|
54
|
+
manifest.fileUri = `/index.js`;
|
|
55
|
+
});
|
|
56
|
+
resolve(manifests);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return (
|
|
63
|
+
<>
|
|
64
|
+
{isAuthenticated && (
|
|
65
|
+
<EchoCore.AuthProviderComponent>
|
|
66
|
+
{/*
|
|
67
|
+
Need to cast queryClient to QueryClient because of the following error:
|
|
68
|
+
TS2352: Conversion of type 'import("Equinor\\EchopediaWeb\\node_modules\\@tanstack\\query-core\\build\\modern\\hydration-CwYEwyQI").b' to type 'import("Equinor\\EchopediaWeb\\node_modules\\@tanstack\\query-core\\build\\modern\\hydration-BlEK5ylC").b' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
|
69
|
+
Property '#private' in type 'QueryClient' refers to a different member that cannot be accessed from within type 'QueryClient'.
|
|
70
|
+
Based on my research we used the same version of react-query in echopediaWeb and echo-client.
|
|
71
|
+
*/}
|
|
72
|
+
<QueryClientProvider client={queryClient as unknown as QueryClient}>
|
|
73
|
+
<EventHubProvider>
|
|
74
|
+
<Mediator options={moduleOptions} />
|
|
75
|
+
<BrowserRouter>
|
|
76
|
+
<EchoApp />
|
|
77
|
+
</BrowserRouter>
|
|
78
|
+
</EventHubProvider>
|
|
79
|
+
</QueryClientProvider>
|
|
80
|
+
</EchoCore.AuthProviderComponent>
|
|
81
|
+
)}
|
|
82
|
+
</>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
if (!(window !== window.parent && !window.opener)) {
|
|
87
|
+
const container = document.getElementById('root') as HTMLElement;
|
|
88
|
+
const root = createRoot(container);
|
|
89
|
+
root.render(<Echo />);
|
|
90
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
// Should remove this error: BrowserAuthError: crypto_nonexistent: The crypto object or function is not available. Detail:Browser crypto or msCrypto object not available.
|
|
3
|
-
const mGetRandomValues = jest.fn().mockReturnValueOnce(new Uint32Array(10));
|
|
4
|
-
Object.defineProperty(window, 'crypto', {
|
|
5
|
-
value: { getRandomValues: mGetRandomValues }
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
jest.mock('@equinor/echo-core', () => {
|
|
9
|
-
return {
|
|
10
|
-
__esModule: true,
|
|
11
|
-
...jest.requireActual('@equinor/echo-core'),
|
|
12
|
-
storage: {
|
|
13
|
-
getItem: jest.fn(),
|
|
14
|
-
setItem: jest.fn()
|
|
15
|
-
},
|
|
16
|
-
EchoEnv: {
|
|
17
|
-
env: jest.fn().mockImplementation(() => {
|
|
18
|
-
return {
|
|
19
|
-
REACT_APP_AZURE_AD_CLIENT_ID: '',
|
|
20
|
-
REACT_APP_API_URL: 'non-mono-base-api-url'
|
|
21
|
-
};
|
|
22
|
-
})
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
});
|
|
1
|
+
export {};
|
|
2
|
+
// Should remove this error: BrowserAuthError: crypto_nonexistent: The crypto object or function is not available. Detail:Browser crypto or msCrypto object not available.
|
|
3
|
+
const mGetRandomValues = jest.fn().mockReturnValueOnce(new Uint32Array(10));
|
|
4
|
+
Object.defineProperty(window, 'crypto', {
|
|
5
|
+
value: { getRandomValues: mGetRandomValues }
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
jest.mock('@equinor/echo-core', () => {
|
|
9
|
+
return {
|
|
10
|
+
__esModule: true,
|
|
11
|
+
...jest.requireActual('@equinor/echo-core'),
|
|
12
|
+
storage: {
|
|
13
|
+
getItem: jest.fn(),
|
|
14
|
+
setItem: jest.fn()
|
|
15
|
+
},
|
|
16
|
+
EchoEnv: {
|
|
17
|
+
env: jest.fn().mockImplementation(() => {
|
|
18
|
+
return {
|
|
19
|
+
REACT_APP_AZURE_AD_CLIENT_ID: '',
|
|
20
|
+
REACT_APP_API_URL: 'non-mono-base-api-url'
|
|
21
|
+
};
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
});
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { Plant } from '@equinor/echo-core';
|
|
2
|
-
import { checkIsPlantsListUpdated } from './plants';
|
|
3
|
-
|
|
4
|
-
describe('checkIsPlantsListUpdated', () => {
|
|
5
|
-
const originalPlant: Plant = {
|
|
6
|
-
instCode: 'JSV',
|
|
7
|
-
hasTr2000: true,
|
|
8
|
-
description: 'A description',
|
|
9
|
-
sapPlantId: '',
|
|
10
|
-
proCoSysPlantId: ''
|
|
11
|
-
};
|
|
12
|
-
const updatedPlant: Plant = { ...originalPlant, description: 'A changed description' };
|
|
13
|
-
it('should return false if lists are identical', () => {
|
|
14
|
-
// given
|
|
15
|
-
const apiPlants = [originalPlant];
|
|
16
|
-
const localStoragePlants = [originalPlant];
|
|
17
|
-
|
|
18
|
-
// when
|
|
19
|
-
const result = checkIsPlantsListUpdated(apiPlants, localStoragePlants);
|
|
20
|
-
|
|
21
|
-
expect(result).toBe(false);
|
|
22
|
-
});
|
|
23
|
-
it('should return true if lists are not identical', () => {
|
|
24
|
-
// given
|
|
25
|
-
const apiPlants = [updatedPlant];
|
|
26
|
-
const localStoragePlants = [originalPlant];
|
|
27
|
-
|
|
28
|
-
// when
|
|
29
|
-
const result = checkIsPlantsListUpdated(apiPlants, localStoragePlants);
|
|
30
|
-
|
|
31
|
-
expect(result).toBe(true);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
1
|
+
import { Plant } from '@equinor/echo-core';
|
|
2
|
+
import { checkIsPlantsListUpdated } from './plants';
|
|
3
|
+
|
|
4
|
+
describe('checkIsPlantsListUpdated', () => {
|
|
5
|
+
const originalPlant: Plant = {
|
|
6
|
+
instCode: 'JSV',
|
|
7
|
+
hasTr2000: true,
|
|
8
|
+
description: 'A description',
|
|
9
|
+
sapPlantId: '',
|
|
10
|
+
proCoSysPlantId: ''
|
|
11
|
+
};
|
|
12
|
+
const updatedPlant: Plant = { ...originalPlant, description: 'A changed description' };
|
|
13
|
+
it('should return false if lists are identical', () => {
|
|
14
|
+
// given
|
|
15
|
+
const apiPlants = [originalPlant];
|
|
16
|
+
const localStoragePlants = [originalPlant];
|
|
17
|
+
|
|
18
|
+
// when
|
|
19
|
+
const result = checkIsPlantsListUpdated(apiPlants, localStoragePlants);
|
|
20
|
+
|
|
21
|
+
expect(result).toBe(false);
|
|
22
|
+
});
|
|
23
|
+
it('should return true if lists are not identical', () => {
|
|
24
|
+
// given
|
|
25
|
+
const apiPlants = [updatedPlant];
|
|
26
|
+
const localStoragePlants = [originalPlant];
|
|
27
|
+
|
|
28
|
+
// when
|
|
29
|
+
const result = checkIsPlantsListUpdated(apiPlants, localStoragePlants);
|
|
30
|
+
|
|
31
|
+
expect(result).toBe(true);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Plant } from '@equinor/echo-core';
|
|
2
|
-
import EchoUtils from '@equinor/echo-utils';
|
|
3
|
-
|
|
4
|
-
const { arraysIsEqual } = EchoUtils.Utils;
|
|
5
|
-
|
|
6
|
-
export const checkIsPlantsListUpdated = (apiPlants: Plant[], localStoragePlants: Plant[]): boolean => {
|
|
7
|
-
if (!localStoragePlants || localStoragePlants.length === 0 || !arraysIsEqual([...localStoragePlants], apiPlants)) {
|
|
8
|
-
return true;
|
|
9
|
-
} else {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
1
|
+
import { Plant } from '@equinor/echo-core';
|
|
2
|
+
import EchoUtils from '@equinor/echo-utils';
|
|
3
|
+
|
|
4
|
+
const { arraysIsEqual } = EchoUtils.Utils;
|
|
5
|
+
|
|
6
|
+
export const checkIsPlantsListUpdated = (apiPlants: Plant[], localStoragePlants: Plant[]): boolean => {
|
|
7
|
+
if (!localStoragePlants || localStoragePlants.length === 0 || !arraysIsEqual([...localStoragePlants], apiPlants)) {
|
|
8
|
+
return true;
|
|
9
|
+
} else {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import EchoCore, { AuthenticationResult } from '@equinor/echo-core';
|
|
2
|
-
import { getDeepLinkParams } from '@equinor/echo-utils';
|
|
3
|
-
|
|
4
|
-
export function initForE2ETests() {
|
|
5
|
-
const { skipAuth } = getDeepLinkParams(['skipAuth']);
|
|
6
|
-
if (skipAuth?.toLowerCase() === 'true') {
|
|
7
|
-
setupSkipAuth();
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const setAuthentication = () => {
|
|
12
|
-
EchoCore.EchoAuthProvider.isAuthenticated = true;
|
|
13
|
-
EchoCore.EchoAuthProvider.userProperties = {
|
|
14
|
-
account: {
|
|
15
|
-
homeAccountId: 'homeAccountId',
|
|
16
|
-
environment: 'testingEnvironment',
|
|
17
|
-
tenantId: 'tenantId',
|
|
18
|
-
username: 'tester',
|
|
19
|
-
localAccountId: 'tester123'
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export function setupSkipAuth() {
|
|
25
|
-
EchoCore.EchoAuthProvider.isAuthenticated = true;
|
|
26
|
-
EchoCore.EchoAuthProvider.handleLogin = async (logRequest?: (...args: unknown[]) => void): Promise<void> => {
|
|
27
|
-
setAuthentication();
|
|
28
|
-
return Promise.resolve(undefined);
|
|
29
|
-
};
|
|
30
|
-
EchoCore.EchoAuthProvider.ssoSilentOrRedirectToAuthenticate = async () => {
|
|
31
|
-
setAuthentication();
|
|
32
|
-
return Promise.resolve(undefined);
|
|
33
|
-
};
|
|
34
|
-
EchoCore.EchoAuthProvider.aquireTokenSilentOrRedirectToAuthenticate =
|
|
35
|
-
async (): Promise<AuthenticationResult | null> => {
|
|
36
|
-
setAuthentication();
|
|
37
|
-
return null;
|
|
38
|
-
};
|
|
39
|
-
EchoCore.EchoAuthProvider.login = async () => {
|
|
40
|
-
setAuthentication();
|
|
41
|
-
return Promise.resolve();
|
|
42
|
-
};
|
|
43
|
-
}
|
|
1
|
+
import EchoCore, { AuthenticationResult } from '@equinor/echo-core';
|
|
2
|
+
import { getDeepLinkParams } from '@equinor/echo-utils';
|
|
3
|
+
|
|
4
|
+
export function initForE2ETests() {
|
|
5
|
+
const { skipAuth } = getDeepLinkParams(['skipAuth']);
|
|
6
|
+
if (skipAuth?.toLowerCase() === 'true') {
|
|
7
|
+
setupSkipAuth();
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const setAuthentication = () => {
|
|
12
|
+
EchoCore.EchoAuthProvider.isAuthenticated = true;
|
|
13
|
+
EchoCore.EchoAuthProvider.userProperties = {
|
|
14
|
+
account: {
|
|
15
|
+
homeAccountId: 'homeAccountId',
|
|
16
|
+
environment: 'testingEnvironment',
|
|
17
|
+
tenantId: 'tenantId',
|
|
18
|
+
username: 'tester',
|
|
19
|
+
localAccountId: 'tester123'
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export function setupSkipAuth() {
|
|
25
|
+
EchoCore.EchoAuthProvider.isAuthenticated = true;
|
|
26
|
+
EchoCore.EchoAuthProvider.handleLogin = async (logRequest?: (...args: unknown[]) => void): Promise<void> => {
|
|
27
|
+
setAuthentication();
|
|
28
|
+
return Promise.resolve(undefined);
|
|
29
|
+
};
|
|
30
|
+
EchoCore.EchoAuthProvider.ssoSilentOrRedirectToAuthenticate = async () => {
|
|
31
|
+
setAuthentication();
|
|
32
|
+
return Promise.resolve(undefined);
|
|
33
|
+
};
|
|
34
|
+
EchoCore.EchoAuthProvider.aquireTokenSilentOrRedirectToAuthenticate =
|
|
35
|
+
async (): Promise<AuthenticationResult | null> => {
|
|
36
|
+
setAuthentication();
|
|
37
|
+
return null;
|
|
38
|
+
};
|
|
39
|
+
EchoCore.EchoAuthProvider.login = async () => {
|
|
40
|
+
setAuthentication();
|
|
41
|
+
return Promise.resolve();
|
|
42
|
+
};
|
|
43
|
+
}
|
package/lib/echo-manifest.d.ts
CHANGED
package/lib/echo-manifest.js
CHANGED
package/lib/echo-manifest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echo-manifest.js","sourceRoot":"","sources":["../src/echo-manifest.ts"],"names":[],"mappings":";AAEA,OAAO,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"echo-manifest.js","sourceRoot":"","sources":["../src/echo-manifest.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,OAAO;IAClC,MAAM,CAAC,WAAW,GAAG,6BAA6B,CAAC;IAEnD,KAAK,CAAC,GAAG;QACZ,oCAAoC;QACpC,kEAAkE;QAClE,gEAAgE;QAChE,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACtC,CAAC;;AAGL,QAAQ,CAAC,GAAG,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Command } from '@oclif/
|
|
2
|
+
import { Command } from '@oclif/core';
|
|
3
3
|
/**
|
|
4
4
|
* @class UpdateDevHostEchoLibVersions
|
|
5
5
|
* @extends Command
|
|
@@ -26,7 +26,7 @@ import { Command } from '@oclif/command';
|
|
|
26
26
|
export default class UpdateDevHostEchoLibVersions extends Command {
|
|
27
27
|
static description: string;
|
|
28
28
|
static flags: {
|
|
29
|
-
all: import("@oclif/
|
|
29
|
+
all: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
30
30
|
};
|
|
31
31
|
run(): Promise<void>;
|
|
32
32
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Command,
|
|
2
|
+
import { Command, Flags } from '@oclif/core';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import { execSync } from 'child_process';
|
|
5
5
|
import fs from 'fs-extra';
|
|
@@ -32,13 +32,13 @@ import path from 'path';
|
|
|
32
32
|
export default class UpdateDevHostEchoLibVersions extends Command {
|
|
33
33
|
static description = 'Interactively update echo library dependencies in echo-dev-host';
|
|
34
34
|
static flags = {
|
|
35
|
-
all:
|
|
35
|
+
all: Flags.boolean({
|
|
36
36
|
char: 'a',
|
|
37
37
|
description: 'Update all echo libraries to latest without prompting'
|
|
38
38
|
})
|
|
39
39
|
};
|
|
40
40
|
async run() {
|
|
41
|
-
const { flags } = this.parse(UpdateDevHostEchoLibVersions);
|
|
41
|
+
const { flags } = await this.parse(UpdateDevHostEchoLibVersions);
|
|
42
42
|
const pkgPath = path.resolve(process.cwd(), 'echo-dev-host-tmp', 'package.json');
|
|
43
43
|
this.log(chalk.cyan(`Trying to load echo lib dependencies from: ${chalk.yellow(pkgPath)}`));
|
|
44
44
|
let pkg;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echo-update-dev-host-deps.js","sourceRoot":"","sources":["../src/echo-update-dev-host-deps.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"echo-update-dev-host-deps.js","sourceRoot":"","sources":["../src/echo-update-dev-host-deps.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,QAAQ,MAAM,UAAU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,EAAE,CAAC;YACV,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC;YACxB,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;YAC9C,IAAI,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;YACzD,QAAQ,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAClD,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QACjD,CAAC;IACL,CAAC;;AAGL,KAAK,UAAU,gBAAgB,CAAC,GAAW,EAAE,OAAY;IACrD,IAAI,CAAC;QACD,OAAO,CAAC,IAAI,GAAG,+BAA+B,GAAG,KAAK,CAAC;QACvD,MAAM,MAAM,GAAG,QAAQ,CAAC,YAAY,GAAG,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC;aACpF,QAAQ,EAAE;aACV,IAAI,EAAE,CAAC;QACZ,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,OAAO,CAAC,IAAI,CAAC,wBAAwB,GAAG,GAAG,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,sCAAsC,GAAG,GAAG,CAAC,CAAC;QAC3D,OAAO,EAAE,CAAC;IACd,CAAC;AACL,CAAC;AAED,4BAA4B,CAAC,GAAG,EAAE,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { execSync } from 'child_process';
|
|
|
3
3
|
import figlet from 'figlet';
|
|
4
4
|
import fs from 'fs-extra';
|
|
5
5
|
import path from 'path';
|
|
6
|
-
import { printDevHostVersions } from '../../utils/printDevHostVersions';
|
|
6
|
+
import { printDevHostVersions } from '../../utils/printDevHostVersions.js';
|
|
7
7
|
/**
|
|
8
8
|
* Builds and copies the `echo-dev-host` package to a specified output directory.
|
|
9
9
|
*
|