@centreon/ui 23.10.1 → 23.10.3-0
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/README.md +44 -14
- package/package.json +41 -23
- package/public/README.md +39 -0
- package/src/@assets/README.md +5 -0
- package/src/@assets/brand/centreon-logo-one-line-dark.svg +1 -0
- package/src/@assets/brand/centreon-logo-one-line-light.svg +1 -0
- package/src/@types/globals.d.ts +9 -0
- package/src/@types/vite-env.d.ts +2 -0
- package/src/Dialog/Duplicate/index.test.tsx +1 -1
- package/src/FallbackPage/FallbackPage.tsx +2 -2
- package/src/Home.stories.mdx +1 -84
- package/src/Image/index.stories.tsx +2 -2
- package/src/Image/index.test.tsx +3 -3
- package/src/InputField/Select/Autocomplete/Connected/Multi/index.test.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Connected/index.stories.tsx +0 -3
- package/src/InputField/Select/Autocomplete/Connected/index.test.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Draggable/index.stories.tsx +0 -2
- package/src/Listing/Cell/DataCell.styles.ts +24 -0
- package/src/Listing/Cell/DataCell.tsx +26 -63
- package/src/Listing/Header/Cell/ListingHeaderCell.styles.ts +71 -0
- package/src/Listing/Header/{SortableCell/Content.tsx → Cell/ListingHeaderCell.tsx} +16 -84
- package/src/Listing/Header/Cell/SelectActionListingHeaderCell.styles.ts +26 -0
- package/src/Listing/Header/Cell/SelectActionListingHeaderCell.tsx +70 -0
- package/src/Listing/Header/ListingHeader.styles.ts +16 -0
- package/src/Listing/Header/{index.tsx → ListingHeader.tsx} +25 -98
- package/src/Listing/Header/_internals/DraggableIconButton.tsx +35 -0
- package/src/Listing/Header/{PredefinedSelectionList.tsx → _internals/PredefinedSelectionList.tsx} +1 -1
- package/src/Listing/Header/index.ts +1 -0
- package/src/Listing/Listing.styles.ts +1 -2
- package/src/Listing/index.stories.tsx +29 -3
- package/src/Listing/index.test.tsx +1 -1
- package/src/Listing/index.tsx +4 -7
- package/src/Listing/useStyleTable.ts +1 -1
- package/src/Logo/CentreonLogo.tsx +2 -2
- package/src/Module/LicensedModule/LicenseCheck/index.stories.tsx +0 -2
- package/src/Panel/Section/index.test.tsx +1 -1
- package/src/ThemeProvider/index.tsx +30 -1
- package/src/WallpaperPage/index.stories.tsx +1 -1
- package/src/Wizard/ActionsBar.test.tsx +1 -1
- package/src/Wizard/index.test.tsx +1 -1
- package/src/__image_snapshots__/storyshots-test-js-image-story-shots-listing-with-editable-and-sortable-columns-1-snap.png +0 -0
- package/.storybook/main.js +0 -82
- package/.storybook/preview.tsx +0 -21
- package/cypress/support/commands.ts +0 -19
- package/cypress/support/component-index.html +0 -12
- package/cypress/support/component.tsx +0 -5
- package/cypress.config.ts +0 -5
- package/jest.config.js +0 -20
- package/setupTests.js +0 -86
- package/src/Listing/Header/SortableCell/DraggableIcon.tsx +0 -41
- package/src/storyshots.test.js +0 -52
- package/src/testRenderer.tsx +0 -56
- package/testRunner.js +0 -36
- package/tsconfig.json +0 -29
- package/types/declarations.d.ts +0 -9
- /package/{assets → public/brand}/centreon-logo-one-line-dark.svg +0 -0
- /package/{assets → public/brand}/centreon-logo-one-line-light.svg +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-bold-webfont.ttf +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-bold-webfont.woff +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-bold-webfont.woff2 +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-light-webfont.ttf +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-light-webfont.woff +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-light-webfont.woff2 +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-medium-webfont.ttf +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-medium-webfont.woff +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-medium-webfont.woff2 +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-regular-webfont.ttf +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-regular-webfont.woff +0 -0
- /package/{fonts/fonts-generated → public/fonts}/roboto-regular-webfont.woff2 +0 -0
- /package/{assets → src/@assets/images}/not-authorized-template-background-dark.svg +0 -0
- /package/{assets → src/@assets/images}/not-authorized-template-background-light.svg +0 -0
- /package/src/Listing/Header/{Label.tsx → _internals/Label.tsx} +0 -0
package/cypress.config.ts
DELETED
package/jest.config.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const baseConfig = require('../js-config/jest');
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
...baseConfig,
|
|
5
|
-
moduleNameMapper: {
|
|
6
|
-
'\\.(s?css|png|svg)$': 'identity-obj-proxy',
|
|
7
|
-
'^react($|/.+)': '<rootDir>/../../node_modules/react$1'
|
|
8
|
-
},
|
|
9
|
-
reporters: ['default', ['jest-junit', { outputName: 'junit.xml' }]],
|
|
10
|
-
roots: ['<rootDir>/src/'],
|
|
11
|
-
setupFilesAfterEnv: [
|
|
12
|
-
'<rootDir>/setupTests.js',
|
|
13
|
-
'@testing-library/jest-dom/extend-expect'
|
|
14
|
-
],
|
|
15
|
-
testResultsProcessor: 'jest-junit',
|
|
16
|
-
transform: {
|
|
17
|
-
...baseConfig.transform,
|
|
18
|
-
'^.+\\.mdx?$': '@storybook/addon-docs/jest-transform-mdx'
|
|
19
|
-
}
|
|
20
|
-
};
|
package/setupTests.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-underscore-dangle */
|
|
2
|
-
/* eslint-disable no-undef */
|
|
3
|
-
// import '@testing-library/jest-dom/extend-expect';
|
|
4
|
-
import i18n from 'i18next';
|
|
5
|
-
import { initReactI18next } from 'react-i18next';
|
|
6
|
-
import fetchMock from 'jest-fetch-mock';
|
|
7
|
-
|
|
8
|
-
const mockedMatchMedia = () => ({
|
|
9
|
-
addListener: () => {},
|
|
10
|
-
matches: false,
|
|
11
|
-
removeListener: () => {}
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
window.matchMedia = window.matchMedia || mockedMatchMedia;
|
|
15
|
-
|
|
16
|
-
document.createRange = () => ({
|
|
17
|
-
commonAncestorContainer: {
|
|
18
|
-
nodeName: 'BODY',
|
|
19
|
-
ownerDocument: document
|
|
20
|
-
},
|
|
21
|
-
setEnd: () => {},
|
|
22
|
-
setStart: () => {}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
global.IntersectionObserver = class IntersectionObserver {
|
|
26
|
-
observe() {
|
|
27
|
-
this.a = '';
|
|
28
|
-
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
disconnect() {
|
|
33
|
-
this.a = '';
|
|
34
|
-
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
Object.defineProperty(window, 'matchMedia', {
|
|
40
|
-
value: jest.fn().mockImplementation((query) => ({
|
|
41
|
-
addEventListener: jest.fn(),
|
|
42
|
-
addListener: jest.fn(),
|
|
43
|
-
dispatchEvent: jest.fn(),
|
|
44
|
-
matches: false,
|
|
45
|
-
media: query,
|
|
46
|
-
onchange: null,
|
|
47
|
-
removeEventListener: jest.fn(),
|
|
48
|
-
removeListener: jest.fn()
|
|
49
|
-
})),
|
|
50
|
-
writable: true
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
Object.defineProperty(Image.prototype, 'onload', {
|
|
54
|
-
get() {
|
|
55
|
-
return this._onload;
|
|
56
|
-
},
|
|
57
|
-
set(onload) {
|
|
58
|
-
onloadRef = onload;
|
|
59
|
-
this._onload = onload;
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
Object.defineProperty(Image.prototype, 'onerror', {
|
|
63
|
-
get() {
|
|
64
|
-
return this._onerror;
|
|
65
|
-
},
|
|
66
|
-
set(onerror) {
|
|
67
|
-
onerrorRef = onerror;
|
|
68
|
-
this._onerror = onerror;
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
i18n.use(initReactI18next).init({
|
|
73
|
-
fallbackLng: 'en',
|
|
74
|
-
keySeparator: false,
|
|
75
|
-
lng: 'en',
|
|
76
|
-
nsSeparator: false,
|
|
77
|
-
resources: {}
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
window.Image = () => ({
|
|
81
|
-
onerror: () => {},
|
|
82
|
-
onload: () => {},
|
|
83
|
-
src: null
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
fetchMock.enableMocks();
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
|
-
|
|
5
|
-
import SvgIcon from '@mui/material/SvgIcon';
|
|
6
|
-
|
|
7
|
-
import { labelDragHandle } from '../../translatedLabels';
|
|
8
|
-
|
|
9
|
-
interface Icon {
|
|
10
|
-
className?: string;
|
|
11
|
-
columnLabel?: string;
|
|
12
|
-
isInteractive?: boolean;
|
|
13
|
-
visible?: boolean;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const DraggableIcon = ({
|
|
17
|
-
visible = false,
|
|
18
|
-
columnLabel,
|
|
19
|
-
className,
|
|
20
|
-
isInteractive = false,
|
|
21
|
-
...rest
|
|
22
|
-
}: Icon): JSX.Element => {
|
|
23
|
-
const { t } = useTranslation();
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<SvgIcon
|
|
27
|
-
aria-label={`${columnLabel} ${t(labelDragHandle)}`}
|
|
28
|
-
fontSize="medium"
|
|
29
|
-
{...rest}
|
|
30
|
-
className={className}
|
|
31
|
-
role={isInteractive ? 'button' : undefined}
|
|
32
|
-
tabIndex={isInteractive ? 0 : undefined}
|
|
33
|
-
>
|
|
34
|
-
{visible && (
|
|
35
|
-
<path d="M 12 8 c 1.1 0 2 -0.9 2 -2 s -0.9 -2 -2 -2 s -2 0.9 -2 2 s 0.9 2 2 2 Z m 0 2 c -1.1 0 -2 0.9 -2 2 s 0.9 2 2 2 s 2 -0.9 2 -2 s -0.9 -2 -2 -2 Z m 0 6 c -1.1 0 -2 0.9 -2 2 s 0.9 2 2 2 s 2 -0.9 2 -2 s -0.9 -2 -2 -2 Z" />
|
|
36
|
-
)}
|
|
37
|
-
</SvgIcon>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export default DraggableIcon;
|
package/src/storyshots.test.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import initStoryshots from '@storybook/addon-storyshots';
|
|
2
|
-
import { imageSnapshot } from '@storybook/addon-storyshots-puppeteer';
|
|
3
|
-
|
|
4
|
-
jest.unmock('axios');
|
|
5
|
-
|
|
6
|
-
const getMatchOptions = () => {
|
|
7
|
-
return {
|
|
8
|
-
failureThreshold: 0.2,
|
|
9
|
-
failureThresholdType: 'percent'
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const beforeScreenshot = async (page) => {
|
|
14
|
-
await page.addStyleTag({
|
|
15
|
-
content: `
|
|
16
|
-
*,
|
|
17
|
-
*::before,
|
|
18
|
-
*::after {
|
|
19
|
-
animation-delay: -1s !important;
|
|
20
|
-
animation-duration: 0s !important;
|
|
21
|
-
animation-iteration-count: 1 !important;
|
|
22
|
-
background-attachment: initial !important;
|
|
23
|
-
scroll-behavior: auto !important;
|
|
24
|
-
transition-duration: 0s !important;
|
|
25
|
-
transition: none !important;
|
|
26
|
-
}`
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
await page.setViewport({
|
|
30
|
-
height: 1000,
|
|
31
|
-
width: 1000
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const getStoryKindRegex = () => {
|
|
36
|
-
const config = JSON.parse(process.env.TEST_CONFIGURATION);
|
|
37
|
-
if (!config.story) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return new RegExp(`^(${config.story || ''})$`, 'g');
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
initStoryshots({
|
|
45
|
-
storyKindRegex: getStoryKindRegex(),
|
|
46
|
-
suite: 'Image StoryShots',
|
|
47
|
-
test: imageSnapshot({
|
|
48
|
-
beforeScreenshot,
|
|
49
|
-
getMatchOptions,
|
|
50
|
-
storybookUrl: `file://${__dirname}/../.out`
|
|
51
|
-
})
|
|
52
|
-
});
|
package/src/testRenderer.tsx
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
render as rtlRender,
|
|
5
|
-
RenderOptions,
|
|
6
|
-
RenderResult
|
|
7
|
-
} from '@testing-library/react';
|
|
8
|
-
import fetchMock, { MockParams } from 'jest-fetch-mock';
|
|
9
|
-
|
|
10
|
-
import { ThemeMode } from '@centreon/ui-context';
|
|
11
|
-
|
|
12
|
-
import ThemeProvider from './StoryBookThemeProvider';
|
|
13
|
-
|
|
14
|
-
interface Props {
|
|
15
|
-
children: ReactElement;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const ThemeProviderWrapper = ({ children }: Props): JSX.Element => {
|
|
19
|
-
return <ThemeProvider themeMode={ThemeMode.light}>{children}</ThemeProvider>;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const render = (ui: ReactElement, options?: RenderOptions): RenderResult =>
|
|
23
|
-
rtlRender(ui, {
|
|
24
|
-
wrapper: ThemeProviderWrapper as (props) => ReactElement | null,
|
|
25
|
-
...options
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
// re-export everything
|
|
29
|
-
export * from '@testing-library/react';
|
|
30
|
-
|
|
31
|
-
// override render method
|
|
32
|
-
export { render };
|
|
33
|
-
|
|
34
|
-
interface MockResponse {
|
|
35
|
-
data: object | unknown;
|
|
36
|
-
options?: MockParams;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const mockResponse = ({ data, options }: MockResponse): void => {
|
|
40
|
-
fetchMock.mockResponse(JSON.stringify(data), options);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const mockResponseOnce = ({ data, options }: MockResponse): void => {
|
|
44
|
-
fetchMock.once(JSON.stringify(data), options);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const resetMocks = (): void => {
|
|
48
|
-
fetchMock.resetMocks();
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const getFetchCall = (
|
|
52
|
-
index,
|
|
53
|
-
secondIndex = 0
|
|
54
|
-
): string | Request | undefined | RequestInit => {
|
|
55
|
-
return fetchMock.mock.calls[index][secondIndex];
|
|
56
|
-
};
|
package/testRunner.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/* eslint-disable array-callback-return */
|
|
2
|
-
/* eslint-disable consistent-return */
|
|
3
|
-
const config = {
|
|
4
|
-
story: null
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
const argv = process.argv.slice(0, 2);
|
|
8
|
-
|
|
9
|
-
process.argv.reduce((cmd, arg) => {
|
|
10
|
-
if (cmd) {
|
|
11
|
-
config[cmd] = arg;
|
|
12
|
-
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (arg.startsWith('--')) {
|
|
17
|
-
const sub = arg.substring('--'.length);
|
|
18
|
-
if (Object.keys(config).includes(sub)) {
|
|
19
|
-
if (typeof config[sub] === 'boolean') {
|
|
20
|
-
config[cmd] = true;
|
|
21
|
-
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return sub;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
argv.push(arg);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
process.argv = argv;
|
|
33
|
-
|
|
34
|
-
process.env.TEST_CONFIGURATION = JSON.stringify(config);
|
|
35
|
-
|
|
36
|
-
require('jest/bin/jest');
|
package/tsconfig.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../js-config/tsconfig/index.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"baseUrl": "./",
|
|
5
|
-
"typeRoots": [
|
|
6
|
-
"./types",
|
|
7
|
-
"./node_modules/@types"
|
|
8
|
-
],
|
|
9
|
-
"outDir": "./dist",
|
|
10
|
-
"declaration": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"pretty": true,
|
|
13
|
-
"emitDeclarationOnly": true,
|
|
14
|
-
"types": [],
|
|
15
|
-
"esModuleInterop": true
|
|
16
|
-
},
|
|
17
|
-
"include": [
|
|
18
|
-
"./src",
|
|
19
|
-
"./types"
|
|
20
|
-
],
|
|
21
|
-
"exclude": [
|
|
22
|
-
"./node_modules",
|
|
23
|
-
"./dist",
|
|
24
|
-
"./src/**/*.test.ts",
|
|
25
|
-
"./src/**/*.test.tsx",
|
|
26
|
-
"./src/**/*.stories.tsx",
|
|
27
|
-
"../../node_modules",
|
|
28
|
-
]
|
|
29
|
-
}
|
package/types/declarations.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|