@jetbrains/ring-ui 7.0.0-beta.8 → 7.0.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/babel.config.js +20 -14
- package/components/alert/alert.css +7 -7
- package/components/alert/alert.d.ts +2 -2
- package/components/alert/alert.js +10 -12
- package/components/alert/container.js +1 -1
- package/components/alert-service/alert-service.js +4 -2
- package/components/analytics/analytics__custom-plugin.js +1 -1
- package/components/auth/auth.js +1 -1
- package/components/auth/auth__core.js +36 -36
- package/components/auth/background-flow.js +2 -2
- package/components/auth/down-notification.js +3 -1
- package/components/auth/iframe-flow.js +4 -2
- package/components/auth/request-builder.js +5 -5
- package/components/auth/storage.js +10 -9
- package/components/auth/token-validator.js +8 -15
- package/components/auth-dialog/auth-dialog.js +8 -8
- package/components/auth-dialog-service/auth-dialog-service.js +4 -4
- package/components/avatar/avatar.js +9 -7
- package/components/avatar/fallback-avatar.js +15 -12
- package/components/button/button.css +36 -25
- package/components/button/button.js +9 -9
- package/components/button/button__classes.d.ts +1 -1
- package/components/button/button__classes.js +3 -4
- package/components/button-group/button-group.css +25 -13
- package/components/button-group/caption.js +1 -1
- package/components/button-toolbar/button-toolbar.d.ts +1 -1
- package/components/button-toolbar/button-toolbar.js +2 -2
- package/components/caret/caret.js +8 -8
- package/components/checkbox/checkbox.css +8 -5
- package/components/checkbox/checkbox.js +1 -1
- package/components/clipboard/clipboard-fallback.js +2 -6
- package/components/clipboard/clipboard.js +5 -5
- package/components/code/code.d.ts +1 -1
- package/components/code/code.js +2 -2
- package/components/code/highlight.css +3 -1
- package/components/collapse/collapse-content.d.ts +1 -2
- package/components/collapse/collapse-content.js +25 -14
- package/components/collapse/collapse-context.js +1 -1
- package/components/collapse/collapse-control.js +5 -3
- package/components/collapse/collapse.css +21 -20
- package/components/collapse/collapse.js +2 -2
- package/components/confirm/confirm.d.ts +2 -2
- package/components/confirm/confirm.js +2 -2
- package/components/confirm-service/confirm-service.d.ts +1 -1
- package/components/confirm-service/confirm-service.js +6 -6
- package/components/content-layout/content-layout.css +6 -5
- package/components/content-layout/content-layout.js +7 -6
- package/components/content-layout/sidebar.js +5 -5
- package/components/contenteditable/contenteditable.d.ts +1 -1
- package/components/contenteditable/contenteditable.js +3 -4
- package/components/control-label/control-label.js +5 -3
- package/components/data-list/data-list.css +3 -3
- package/components/data-list/data-list.d.ts +2 -2
- package/components/data-list/data-list.js +6 -7
- package/components/data-list/data-list.mock.js +57 -47
- package/components/data-list/item.js +14 -16
- package/components/data-list/selection.js +5 -7
- package/components/data-list/title.js +5 -6
- package/components/date-picker/consts.js +2 -2
- package/components/date-picker/date-input.js +4 -4
- package/components/date-picker/date-picker.css +23 -18
- package/components/date-picker/date-picker.d.ts +2 -1
- package/components/date-picker/date-picker.js +13 -19
- package/components/date-picker/date-popup.js +30 -36
- package/components/date-picker/day.js +6 -9
- package/components/date-picker/formats.js +647 -1
- package/components/date-picker/month-names.js +6 -8
- package/components/date-picker/month-slider.js +2 -2
- package/components/date-picker/month.js +1 -3
- package/components/date-picker/months.js +2 -6
- package/components/date-picker/weekdays.js +2 -3
- package/components/date-picker/years.js +3 -3
- package/components/dialog/dialog.d.ts +1 -0
- package/components/dialog/dialog.js +20 -13
- package/components/dialog/dialog__body-scroll-preventer.js +1 -1
- package/components/dropdown/dropdown.css +2 -4
- package/components/dropdown/dropdown.d.ts +2 -2
- package/components/dropdown/dropdown.js +5 -5
- package/components/dropdown-menu/dropdown-menu.js +5 -5
- package/components/editable-heading/editable-heading.css +5 -2
- package/components/editable-heading/editable-heading.js +21 -19
- package/components/error-bubble/error-bubble.js +1 -1
- package/components/error-message/error-message.js +2 -4
- package/components/footer/footer.js +11 -15
- package/components/form/form.stories.js +45 -63
- package/components/global/create-stateful-context.js +2 -4
- package/components/global/data-tests.js +5 -6
- package/components/global/dom.js +8 -11
- package/components/global/focus-sensor-hoc.js +5 -6
- package/components/global/fuzzy-highlight.js +1 -1
- package/components/global/get-event-key.js +2 -2
- package/components/global/global.css +0 -3
- package/components/global/linear-function.js +1 -1
- package/components/global/normalize-indent.js +2 -6
- package/components/global/react-dom-renderer.js +2 -3
- package/components/global/theme.d.ts +4 -2
- package/components/global/theme.js +14 -12
- package/components/global/url.js +8 -8
- package/components/global/variables.css +1 -8
- package/components/global/variables_dark.css +0 -1
- package/components/grid/col.js +6 -6
- package/components/grid/grid.css +174 -173
- package/components/grid/grid.js +1 -1
- package/components/grid/row.js +13 -6
- package/components/group/group.js +1 -1
- package/components/header/header-icon.js +2 -2
- package/components/header/header.css +19 -15
- package/components/header/header.js +3 -5
- package/components/header/links.js +1 -1
- package/components/header/logo.js +1 -1
- package/components/header/profile.d.ts +2 -2
- package/components/header/profile.js +9 -9
- package/components/header/services-link.js +1 -1
- package/components/header/services.js +4 -5
- package/components/header/smart-profile.js +4 -3
- package/components/header/smart-services.js +9 -5
- package/components/header/tray.js +1 -1
- package/components/heading/heading.css +0 -1
- package/components/heading/heading.js +2 -2
- package/components/http/http.d.ts +3 -3
- package/components/http/http.js +25 -29
- package/components/http/http.mock.js +9 -6
- package/components/hub-source/hub-source.js +5 -7
- package/components/hub-source/hub-source__user.js +1 -1
- package/components/hub-source/hub-source__users-groups.js +6 -7
- package/components/i18n/README.md +3 -4
- package/components/i18n/i18n-context.js +2 -4
- package/components/icon/icon.css +1 -1
- package/components/icon/icon.js +7 -9
- package/components/icon/icon__svg.js +6 -6
- package/components/input/input.css +1 -1
- package/components/input/input.js +11 -14
- package/components/input-size/input-size.stories.js +42 -22
- package/components/island/adaptive-island-hoc.js +1 -1
- package/components/island/content.js +4 -6
- package/components/island/header.js +8 -10
- package/components/island/island.css +5 -5
- package/components/island/island.js +1 -1
- package/components/link/clickableLink.js +3 -1
- package/components/link/link.js +5 -3
- package/components/list/consts.js +1 -1
- package/components/list/list.d.ts +1 -1
- package/components/list/list.js +35 -57
- package/components/list/list__custom.js +3 -5
- package/components/list/list__hint.js +3 -1
- package/components/list/list__item.js +11 -9
- package/components/list/list__link.js +1 -1
- package/components/list/list__separator.js +2 -2
- package/components/list/list__title.js +7 -3
- package/components/list/list__users-groups-source.js +6 -8
- package/components/loader/loader.js +1 -1
- package/components/loader/loader__core.js +5 -5
- package/components/loader-inline/loader-inline.css +0 -3
- package/components/loader-inline/loader-inline.js +5 -7
- package/components/loader-screen/loader-screen.js +1 -1
- package/components/login-dialog/login-dialog.js +4 -4
- package/components/login-dialog/service.js +5 -5
- package/components/markdown/markdown.css +6 -6
- package/components/markdown/markdown.d.ts +2 -2
- package/components/markdown/markdown.js +4 -6
- package/components/message/message.css +2 -1
- package/components/message/message.js +30 -21
- package/components/old-browsers-message/old-browsers-message.js +2 -2
- package/components/old-browsers-message/white-list.js +2 -3
- package/components/pager/pager.js +28 -29
- package/components/permissions/permissions.js +8 -13
- package/components/permissions/permissions__cache.js +6 -7
- package/components/popup/popup.consts.js +8 -2
- package/components/popup/popup.js +27 -33
- package/components/popup/popup.target.js +4 -4
- package/components/popup/position.js +21 -28
- package/components/popup-menu/popup-menu.js +1 -1
- package/components/progress-bar/progress-bar.css +10 -8
- package/components/progress-bar/progress-bar.d.ts +2 -2
- package/components/progress-bar/progress-bar.js +2 -2
- package/components/query-assist/query-assist.css +0 -3
- package/components/query-assist/query-assist.js +73 -84
- package/components/query-assist/query-assist__suggestions.js +10 -9
- package/components/radio/radio.css +6 -2
- package/components/radio/radio.js +1 -3
- package/components/scrollable-section/scrollable-section.css +5 -6
- package/components/scrollable-section/scrollable-section.js +1 -1
- package/components/select/select.css +5 -7
- package/components/select/select.d.ts +1 -1
- package/components/select/select.js +96 -110
- package/components/select/select__filter.js +1 -1
- package/components/select/select__popup.js +40 -51
- package/components/shortcuts/core.js +8 -6
- package/components/shortcuts/shortcut-title.js +6 -6
- package/components/shortcuts/shortcuts.js +1 -1
- package/components/sidebar/sidebar.css +3 -1
- package/components/slider/slider.css +14 -14
- package/components/slider/slider.js +7 -7
- package/components/tab-trap/tab-trap.js +7 -9
- package/components/table/cell.js +3 -1
- package/components/table/disable-hover-hoc.js +2 -2
- package/components/table/header-cell.js +5 -3
- package/components/table/header.d.ts +2 -10
- package/components/table/header.js +10 -12
- package/components/table/multitable.js +5 -3
- package/components/table/row.d.ts +0 -1
- package/components/table/row.js +20 -27
- package/components/table/selection-adapter.js +1 -1
- package/components/table/selection-shortcuts-hoc.js +2 -2
- package/components/table/selection.d.ts +2 -3
- package/components/table/selection.js +4 -5
- package/components/table/simple-table.js +4 -4
- package/components/table/smart-table.js +5 -5
- package/components/table/table.css +8 -9
- package/components/table/table.d.ts +0 -1
- package/components/table/table.js +22 -23
- package/components/table/table.stories.json +45 -16
- package/components/tabs/collapsible-more.d.ts +1 -1
- package/components/tabs/collapsible-more.js +13 -16
- package/components/tabs/collapsible-tab.js +2 -2
- package/components/tabs/collapsible-tabs.d.ts +2 -2
- package/components/tabs/collapsible-tabs.js +13 -22
- package/components/tabs/dumb-tabs.js +6 -9
- package/components/tabs/smart-tabs.js +4 -4
- package/components/tabs/tab-link.js +1 -3
- package/components/tabs/tabs.css +7 -9
- package/components/tag/tag.css +7 -7
- package/components/tag/tag.d.ts +1 -1
- package/components/tag/tag.js +9 -12
- package/components/tags-input/tags-input.js +15 -19
- package/components/tags-list/tags-list.d.ts +2 -2
- package/components/tags-list/tags-list.js +6 -5
- package/components/text/text.js +5 -3
- package/components/toggle/toggle.css +12 -10
- package/components/toggle/toggle.d.ts +2 -2
- package/components/toggle/toggle.js +4 -3
- package/components/tooltip/tooltip.d.ts +4 -1
- package/components/tooltip/tooltip.js +19 -10
- package/components/user-agreement/service.js +15 -13
- package/components/user-agreement/user-agreement.js +3 -5
- package/components/user-card/card.js +10 -9
- package/components/user-card/smart-user-card-tooltip.js +5 -7
- package/components/user-card/tooltip.js +4 -4
- package/components/user-card/user-card.css +4 -0
- package/jslint-xml.js +20 -19
- package/package.json +66 -58
- package/postcss.config.js +3 -4
- package/typings.d.ts +2 -4
- package/webpack.config.js +20 -25
- package/components/badge/badge.css +0 -42
- package/components/badge/badge.d.ts +0 -14
- package/components/badge/badge.js +0 -29
- package/components/island-legacy/content-legacy.d.ts +0 -5
- package/components/island-legacy/content-legacy.js +0 -12
- package/components/island-legacy/header-legacy.d.ts +0 -5
- package/components/island-legacy/header-legacy.js +0 -14
- package/components/island-legacy/island-legacy.css +0 -98
- package/components/island-legacy/island-legacy.d.ts +0 -7
- package/components/island-legacy/island-legacy.js +0 -14
- package/components/table-legacy/table-legacy.css +0 -346
- package/components/table-legacy/table-legacy__toolbar.css +0 -25
package/components/grid/grid.js
CHANGED
|
@@ -8,7 +8,7 @@ export class Grid extends Component {
|
|
|
8
8
|
render() {
|
|
9
9
|
const { children, className, ...restProps } = this.props;
|
|
10
10
|
const classes = classNames(styles['container-fluid'], className);
|
|
11
|
-
return (<div {...restProps} className={classes}>
|
|
11
|
+
return (<div data-test="ring-grid" {...restProps} className={classes}>
|
|
12
12
|
{children}
|
|
13
13
|
</div>);
|
|
14
14
|
}
|
package/components/grid/row.js
CHANGED
|
@@ -2,10 +2,17 @@ import { Component } from 'react';
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import styles from './grid.css';
|
|
4
4
|
const modifierKeys = [
|
|
5
|
-
'start',
|
|
6
|
-
'
|
|
7
|
-
'
|
|
8
|
-
'
|
|
5
|
+
'start',
|
|
6
|
+
'center',
|
|
7
|
+
'end', // text-align, justify-content
|
|
8
|
+
'around',
|
|
9
|
+
'between', // justify-content
|
|
10
|
+
'top',
|
|
11
|
+
'middle',
|
|
12
|
+
'baseline',
|
|
13
|
+
'bottom', // align-items
|
|
14
|
+
'first',
|
|
15
|
+
'last', // order
|
|
9
16
|
];
|
|
10
17
|
/**
|
|
11
18
|
* Converts xs="middle" to class "middle-xs"
|
|
@@ -24,9 +31,9 @@ export default class Row extends Component {
|
|
|
24
31
|
render() {
|
|
25
32
|
const { children, className, reverse, ...restProps } = this.props;
|
|
26
33
|
const classes = classNames(className, styles.row, getModifierClassNames(restProps), {
|
|
27
|
-
[styles.reverse]: reverse
|
|
34
|
+
[styles.reverse]: reverse,
|
|
28
35
|
});
|
|
29
|
-
return (<div className={classes}>
|
|
36
|
+
return (<div className={classes} data-test="ring-grid-row">
|
|
30
37
|
{children}
|
|
31
38
|
</div>);
|
|
32
39
|
}
|
|
@@ -8,7 +8,7 @@ export default class Group extends Component {
|
|
|
8
8
|
render() {
|
|
9
9
|
const { children, className, ...restProps } = this.props;
|
|
10
10
|
const classes = classNames(styles.group, className);
|
|
11
|
-
return (<span {...restProps} className={classes}>
|
|
11
|
+
return (<span data-test="ring-group" {...restProps} className={classes}>
|
|
12
12
|
{children}
|
|
13
13
|
</span>);
|
|
14
14
|
}
|
|
@@ -7,8 +7,8 @@ export default class HeaderIcon extends Component {
|
|
|
7
7
|
const { className, rotatable: rotatable, ...restProps } = this.props;
|
|
8
8
|
const classes = classNames(styles.icon, className, {
|
|
9
9
|
[styles.rotatable]: rotatable,
|
|
10
|
-
[styles.rotated]: rotatable && restProps.active
|
|
10
|
+
[styles.rotated]: rotatable && restProps.active,
|
|
11
11
|
});
|
|
12
|
-
return
|
|
12
|
+
return <Button {...restProps} className={classes}/>;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
@import "../global/variables.css";
|
|
2
2
|
|
|
3
|
-
@value dark from "../global/variables_dark.css";
|
|
4
3
|
@value link, active from "../link/link.css";
|
|
5
|
-
@value compensate: 3px;
|
|
6
|
-
@value compensated: calc(calc(var(--ring-unit) * 8) - compensate);
|
|
7
4
|
|
|
8
5
|
:root {
|
|
9
6
|
--ring-header-link-color: var(--ring-link-color);
|
|
10
7
|
}
|
|
11
8
|
|
|
12
|
-
.dark,
|
|
13
9
|
:global(.ring-ui-theme-dark) {
|
|
14
10
|
--ring-header-link-color: var(--ring-text-color);
|
|
15
11
|
}
|
|
16
12
|
|
|
17
13
|
.header {
|
|
14
|
+
--ring-header-compensate: 3px;
|
|
15
|
+
--ring-header-compensated: calc(calc(var(--ring-unit) * 8) - var(--ring-header-compensate));
|
|
16
|
+
|
|
18
17
|
display: flex;
|
|
19
18
|
overflow: hidden;
|
|
20
19
|
align-items: center;
|
|
@@ -26,14 +25,14 @@
|
|
|
26
25
|
|
|
27
26
|
background-color: var(--ring-navigation-background-color);
|
|
28
27
|
|
|
29
|
-
line-height: compensated;
|
|
28
|
+
line-height: var(--ring-header-compensated);
|
|
30
29
|
|
|
31
30
|
& > * {
|
|
32
31
|
display: inline-block;
|
|
33
32
|
|
|
34
33
|
box-sizing: border-box;
|
|
35
34
|
height: calc(var(--ring-unit) * 8);
|
|
36
|
-
padding: 0 calc(var(--ring-unit) * 1.5) compensate;
|
|
35
|
+
padding: 0 calc(var(--ring-unit) * 1.5) var(--ring-header-compensate);
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
/* override link */
|
|
@@ -58,14 +57,14 @@
|
|
|
58
57
|
|
|
59
58
|
.headerVertical {
|
|
60
59
|
display: inline-flex;
|
|
61
|
-
align-items:
|
|
60
|
+
align-items: center;
|
|
62
61
|
flex-direction: column;
|
|
63
62
|
|
|
64
63
|
height: 100%;
|
|
65
64
|
|
|
66
65
|
color: var(--ring-text-color);
|
|
67
66
|
|
|
68
|
-
background-color: var(--ring-
|
|
67
|
+
background-color: var(--ring-navigation-background-color);
|
|
69
68
|
|
|
70
69
|
/* override link */
|
|
71
70
|
& .link {
|
|
@@ -77,6 +76,10 @@
|
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
78
|
|
|
79
|
+
html:global(.ring-ui-theme-dark) .headerVertical {
|
|
80
|
+
box-shadow: inset -1px 0 var(--ring-line-color);
|
|
81
|
+
}
|
|
82
|
+
|
|
80
83
|
.logo {
|
|
81
84
|
display: inline-flex;
|
|
82
85
|
align-items: center;
|
|
@@ -99,6 +102,7 @@
|
|
|
99
102
|
|
|
100
103
|
.links {
|
|
101
104
|
display: flex;
|
|
105
|
+
align-items: center;
|
|
102
106
|
flex-direction: column;
|
|
103
107
|
|
|
104
108
|
min-height: calc(var(--ring-unit) * 5);
|
|
@@ -108,7 +112,7 @@
|
|
|
108
112
|
align-items: flex-end;
|
|
109
113
|
|
|
110
114
|
margin-left: auto;
|
|
111
|
-
padding: 0 0 compensate;
|
|
115
|
+
padding: 0 0 var(--ring-header-compensate);
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
/* override .header > * */
|
|
@@ -117,7 +121,7 @@
|
|
|
117
121
|
}
|
|
118
122
|
|
|
119
123
|
.headerVertical .tray {
|
|
120
|
-
align-items:
|
|
124
|
+
align-items: center;
|
|
121
125
|
flex-direction: column;
|
|
122
126
|
|
|
123
127
|
margin-top: auto;
|
|
@@ -126,7 +130,7 @@
|
|
|
126
130
|
}
|
|
127
131
|
|
|
128
132
|
.trayItemContent {
|
|
129
|
-
height: compensated;
|
|
133
|
+
height: var(--ring-header-compensated);
|
|
130
134
|
}
|
|
131
135
|
|
|
132
136
|
.icon {
|
|
@@ -142,11 +146,11 @@
|
|
|
142
146
|
|
|
143
147
|
/* override button */
|
|
144
148
|
.icon.icon {
|
|
145
|
-
height: compensated;
|
|
149
|
+
height: var(--ring-header-compensated);
|
|
146
150
|
|
|
147
151
|
padding-top: calc(var(--ring-unit) / 2);
|
|
148
152
|
|
|
149
|
-
line-height: compensated;
|
|
153
|
+
line-height: var(--ring-header-compensated);
|
|
150
154
|
}
|
|
151
155
|
|
|
152
156
|
.headerVertical .icon {
|
|
@@ -176,7 +180,7 @@
|
|
|
176
180
|
align-items: center;
|
|
177
181
|
|
|
178
182
|
width: auto;
|
|
179
|
-
height: compensated;
|
|
183
|
+
height: var(--ring-header-compensated);
|
|
180
184
|
padding-left: var(--ring-unit);
|
|
181
185
|
|
|
182
186
|
vertical-align: bottom;
|
|
@@ -190,7 +194,7 @@
|
|
|
190
194
|
.profile {
|
|
191
195
|
composes: profileEmpty;
|
|
192
196
|
|
|
193
|
-
height: compensated;
|
|
197
|
+
height: var(--ring-header-compensated);
|
|
194
198
|
|
|
195
199
|
cursor: pointer;
|
|
196
200
|
}
|
|
@@ -12,21 +12,19 @@ class Header extends Component {
|
|
|
12
12
|
static defaultProps = {
|
|
13
13
|
spaced: true,
|
|
14
14
|
theme: Theme.DARK,
|
|
15
|
-
vertical: false
|
|
15
|
+
vertical: false,
|
|
16
16
|
};
|
|
17
17
|
render() {
|
|
18
18
|
const { children, className, spaced, theme, vertical, ...restProps } = this.props;
|
|
19
19
|
const classes = classNames(vertical ? styles.headerVertical : styles.header, className, {
|
|
20
|
-
[styles.headerSpaced]: spaced && !vertical
|
|
20
|
+
[styles.headerSpaced]: spaced && !vertical,
|
|
21
21
|
});
|
|
22
22
|
const overrideOuterTheme = theme !== Theme.LIGHT;
|
|
23
23
|
const header = (<header {...restProps} className={classes}>
|
|
24
24
|
{children}
|
|
25
25
|
</header>);
|
|
26
26
|
if (overrideOuterTheme) {
|
|
27
|
-
return
|
|
28
|
-
{header}
|
|
29
|
-
</ThemeProvider>);
|
|
27
|
+
return <ThemeProvider theme={theme}>{header}</ThemeProvider>;
|
|
30
28
|
}
|
|
31
29
|
return header;
|
|
32
30
|
}
|
|
@@ -3,5 +3,5 @@ import ScrollableSection from '../scrollable-section/scrollable-section';
|
|
|
3
3
|
import styles from './header.css';
|
|
4
4
|
// currently only supports vertical header
|
|
5
5
|
export default function Links({ className, ...restProps }) {
|
|
6
|
-
return
|
|
6
|
+
return <ScrollableSection {...restProps} className={classNames(styles.links, className)}/>;
|
|
7
7
|
}
|
|
@@ -36,8 +36,8 @@ export interface ProfileProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSe
|
|
|
36
36
|
onRevertPostponement?: (() => void) | null | undefined;
|
|
37
37
|
menuProps?: PopupMenuAttrs | null | undefined;
|
|
38
38
|
activeClassName?: string | null | undefined;
|
|
39
|
-
onShow?: (
|
|
40
|
-
onHide?: (
|
|
39
|
+
onShow?: () => void;
|
|
40
|
+
onHide?: () => void;
|
|
41
41
|
}
|
|
42
42
|
export default class Profile extends PureComponent<ProfileProps> {
|
|
43
43
|
static defaultProps: ProfileProps;
|
|
@@ -20,7 +20,7 @@ export default class Profile extends PureComponent {
|
|
|
20
20
|
{translations?.login ?? translate('login')}
|
|
21
21
|
</Button>
|
|
22
22
|
</div>)}
|
|
23
|
-
</I18nContext.Consumer>)
|
|
23
|
+
</I18nContext.Consumer>),
|
|
24
24
|
};
|
|
25
25
|
static contextType = I18nContext;
|
|
26
26
|
static Size = Size;
|
|
@@ -36,7 +36,7 @@ export default class Profile extends PureComponent {
|
|
|
36
36
|
return renderGuest(this.props);
|
|
37
37
|
}
|
|
38
38
|
const avatarWrapper = classNames(styles.avatarWrapper, {
|
|
39
|
-
[styles.hasUpdates]: hasUpdates
|
|
39
|
+
[styles.hasUpdates]: hasUpdates,
|
|
40
40
|
});
|
|
41
41
|
const anchor = (<button type="button" className={styles.anchorClassName}>
|
|
42
42
|
<span className={avatarWrapper}>
|
|
@@ -49,39 +49,39 @@ export default class Profile extends PureComponent {
|
|
|
49
49
|
rgItemType,
|
|
50
50
|
label: translations?.applyChangedUser ?? translate('applyChangedUser'),
|
|
51
51
|
className: styles.profileMenuItem,
|
|
52
|
-
onClick: onRevertPostponement
|
|
52
|
+
onClick: onRevertPostponement,
|
|
53
53
|
},
|
|
54
54
|
showLogIn && {
|
|
55
55
|
rgItemType,
|
|
56
56
|
label: translations?.login ?? translate('login'),
|
|
57
57
|
className: styles.profileMenuItem,
|
|
58
|
-
onClick: onRevertPostponement
|
|
58
|
+
onClick: onRevertPostponement,
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
rgItemType: PopupMenu.ListProps.Type.LINK,
|
|
62
62
|
label: translations?.profile ?? translate('profile'),
|
|
63
63
|
target: '_self', // Full page reload in Angular
|
|
64
64
|
href: profileUrl,
|
|
65
|
-
LinkComponent
|
|
65
|
+
LinkComponent,
|
|
66
66
|
},
|
|
67
67
|
showSwitchUser && {
|
|
68
68
|
rgItemType,
|
|
69
69
|
label: translations?.switchUser ?? translate('switchUser'),
|
|
70
70
|
className: styles.profileMenuItem,
|
|
71
|
-
onClick: onSwitchUser
|
|
71
|
+
onClick: onSwitchUser,
|
|
72
72
|
},
|
|
73
73
|
showLogOut && {
|
|
74
74
|
rgItemType,
|
|
75
75
|
label: translations?.logout ?? translate('logout'),
|
|
76
|
-
onClick: onLogout
|
|
77
|
-
}
|
|
76
|
+
onClick: onLogout,
|
|
77
|
+
},
|
|
78
78
|
].filter(isTruthy);
|
|
79
79
|
return (<DropdownMenu {...props} onShow={onShow} onHide={onHide} title={user.name} anchor={anchor} data={renderPopupItems(items)} data-test="ring-profile" className={classNames(styles.profile, className)} activeClassName={activeClassName} menuProps={{
|
|
80
80
|
closeOnSelect,
|
|
81
81
|
left: -2,
|
|
82
82
|
top: -8,
|
|
83
83
|
sidePadding: 32,
|
|
84
|
-
...menuProps
|
|
84
|
+
...menuProps,
|
|
85
85
|
}}/>);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -8,7 +8,7 @@ export default class ServicesLink extends PureComponent {
|
|
|
8
8
|
{service.iconUrl
|
|
9
9
|
? [
|
|
10
10
|
<span key="icon" className={styles.itemLogo} style={{ backgroundImage: `url(${service.iconUrl})` }}/>,
|
|
11
|
-
<div key="text">{service.name}</div
|
|
11
|
+
<div key="text">{service.name}</div>,
|
|
12
12
|
]
|
|
13
13
|
: service.name}
|
|
14
14
|
</Link>);
|
|
@@ -16,18 +16,17 @@ export default class Services extends PureComponent {
|
|
|
16
16
|
static sort = (a, b) => {
|
|
17
17
|
const aApplicationName = a.applicationName || '';
|
|
18
18
|
const bApplicationName = b.applicationName || '';
|
|
19
|
-
return aApplicationName.localeCompare(bApplicationName) ||
|
|
20
|
-
a.name.localeCompare(b.name);
|
|
19
|
+
return aApplicationName.localeCompare(bApplicationName) || a.name.localeCompare(b.name);
|
|
21
20
|
};
|
|
22
21
|
static defaultProps = {
|
|
23
|
-
theme: Theme.DARK
|
|
22
|
+
theme: Theme.DARK,
|
|
24
23
|
};
|
|
25
24
|
static Link = ServicesLink;
|
|
26
25
|
serviceIsActive = (service) => service.id === this.props.clientId;
|
|
27
26
|
render() {
|
|
28
27
|
const { clientId, loading, services, initShown, theme, ...props } = this.props;
|
|
29
28
|
if (!services) {
|
|
30
|
-
return
|
|
29
|
+
return <HeaderIcon {...props} loader={loading} active={loading} icon={servicesIcon} aria-label="Services"/>;
|
|
31
30
|
}
|
|
32
31
|
const sortedServices = [...services].sort(Services.sort);
|
|
33
32
|
const servicesWithIcons = sortedServices.filter(service => service.iconUrl && service.homeUrl);
|
|
@@ -39,7 +38,7 @@ export default class Services extends PureComponent {
|
|
|
39
38
|
const isActive = this.serviceIsActive(service);
|
|
40
39
|
return (<Services.Link active={isActive} className={isActive ? styles.activeItem : styles.item} key={service.id} service={service}/>);
|
|
41
40
|
})}
|
|
42
|
-
{separatorIsRequired &&
|
|
41
|
+
{separatorIsRequired && <div className={styles.line} key="separator"/>}
|
|
43
42
|
{servicesWithOutIcons.map(service => {
|
|
44
43
|
const isActive = this.serviceIsActive(service);
|
|
45
44
|
return (<Services.Link active={isActive} className={isActive ? styles.activeItemStacked : styles.itemStacked} key={service.id} service={service}/>);
|
|
@@ -8,7 +8,7 @@ export default class SmartProfile extends PureComponent {
|
|
|
8
8
|
user: null,
|
|
9
9
|
size: Profile.defaultProps.size,
|
|
10
10
|
isLogoutPostponed: false,
|
|
11
|
-
isUserChangePostponed: false
|
|
11
|
+
isUserChangePostponed: false,
|
|
12
12
|
};
|
|
13
13
|
componentDidMount() {
|
|
14
14
|
this.requestUser();
|
|
@@ -47,7 +47,7 @@ export default class SmartProfile extends PureComponent {
|
|
|
47
47
|
this.setState({
|
|
48
48
|
user: newUser,
|
|
49
49
|
isLogoutPostponed: false,
|
|
50
|
-
isUserChangePostponed: false
|
|
50
|
+
isUserChangePostponed: false,
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
53
|
auth.addListener(LOGOUT_POSTPONED_EVENT, () => {
|
|
@@ -65,7 +65,8 @@ export default class SmartProfile extends PureComponent {
|
|
|
65
65
|
const { auth, translations } = this.props;
|
|
66
66
|
const userMeta = auth.http.getMetaForResponse(user);
|
|
67
67
|
if (userMeta?.headers?.has(CERTIFICATE_MISMATCH_HEADER)) {
|
|
68
|
-
const message = translations?.certificateMismatch ||
|
|
68
|
+
const message = translations?.certificateMismatch ||
|
|
69
|
+
`You are authenticated as ${user.login || user.name}. To authenticate with the client certificate for your account, log out, then click the "Log in with certificate" option on the login page.`;
|
|
69
70
|
alertService.warning(message, 0);
|
|
70
71
|
}
|
|
71
72
|
}
|
|
@@ -6,16 +6,18 @@ export default class SmartServices extends Component {
|
|
|
6
6
|
state = {
|
|
7
7
|
visible: true,
|
|
8
8
|
loading: false,
|
|
9
|
-
services: null
|
|
9
|
+
services: null,
|
|
10
10
|
};
|
|
11
11
|
componentDidMount() {
|
|
12
12
|
const { auth } = this.props;
|
|
13
13
|
this.http = new HTTP(auth, auth.getAPIPath());
|
|
14
|
-
this.getServices(SmartServices.countFields)
|
|
14
|
+
this.getServices(SmartServices.countFields)
|
|
15
|
+
?.then(services => {
|
|
15
16
|
if (!services.length) {
|
|
16
17
|
this.setState({ visible: false });
|
|
17
18
|
}
|
|
18
|
-
})
|
|
19
|
+
})
|
|
20
|
+
.catch(noop);
|
|
19
21
|
}
|
|
20
22
|
static allFields = 'id,name,applicationName,homeUrl,iconUrl';
|
|
21
23
|
static countFields = 'key';
|
|
@@ -25,10 +27,12 @@ export default class SmartServices extends Component {
|
|
|
25
27
|
};
|
|
26
28
|
getServicesContent = () => {
|
|
27
29
|
this.setState({ loading: true });
|
|
28
|
-
this.getServices(SmartServices.allFields)
|
|
30
|
+
this.getServices(SmartServices.allFields)
|
|
31
|
+
?.then(services => {
|
|
29
32
|
this.setState({ services });
|
|
30
33
|
this.stopLoading();
|
|
31
|
-
})
|
|
34
|
+
})
|
|
35
|
+
.catch(this.stopLoading);
|
|
32
36
|
};
|
|
33
37
|
getServices(fields) {
|
|
34
38
|
return this.http?.get(`services/header?fields=${fields}`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Children, Component } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import styles from './header.css';
|
|
4
|
-
const wrapChild = (child) => child &&
|
|
4
|
+
const wrapChild = (child) => child && <div className={styles.trayItem}>{child}</div>;
|
|
5
5
|
export default class Tray extends Component {
|
|
6
6
|
render() {
|
|
7
7
|
const { children, className, ...restProps } = this.props;
|
|
@@ -17,8 +17,8 @@ const HeadingMemo = memo(function Heading({ children, className, level = Levels.
|
|
|
17
17
|
const classes = classNames(styles.heading, className);
|
|
18
18
|
const Tag = level <= Levels.H4 ? `h${level}` : fallbackHeading();
|
|
19
19
|
return (<Tag {...restProps} className={classes}>
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
{children}
|
|
21
|
+
</Tag>);
|
|
22
22
|
});
|
|
23
23
|
const Heading = HeadingMemo;
|
|
24
24
|
Heading.Levels = Levels;
|
|
@@ -15,7 +15,7 @@ export interface FetchParams<T = unknown> extends Omit<RequestInit, 'body' | 'he
|
|
|
15
15
|
query?: Record<string, unknown> | undefined;
|
|
16
16
|
headers?: HeadersInit | Record<string, null | undefined>;
|
|
17
17
|
}
|
|
18
|
-
export interface RequestParams<RawBody extends boolean = true | false> extends FetchParams<RawBody extends true ?
|
|
18
|
+
export interface RequestParams<RawBody extends boolean = true | false> extends FetchParams<RawBody extends true ? BodyInit | null : unknown> {
|
|
19
19
|
sendRawBody?: RawBody;
|
|
20
20
|
}
|
|
21
21
|
export type RequestParamsWithoutMethod<RawBody extends boolean = boolean> = Omit<RequestParams<RawBody>, 'method'>;
|
|
@@ -50,9 +50,9 @@ export default class HTTP implements Partial<HTTPAuth> {
|
|
|
50
50
|
* Usage: const {promise, abort} = http.abortify(http.get<{id: string}>)('http://test.com');
|
|
51
51
|
* @param method
|
|
52
52
|
*/
|
|
53
|
-
abortify: <T>(method: Method<T>) => ((...p: Parameters<Method<T>>) =>
|
|
53
|
+
abortify: <T>(method: Method<T>) => ((...p: Parameters<Method<T>>) => {
|
|
54
54
|
promise: Promise<T>;
|
|
55
55
|
abort: () => void;
|
|
56
|
-
})
|
|
56
|
+
});
|
|
57
57
|
}
|
|
58
58
|
export {};
|
package/components/http/http.js
CHANGED
|
@@ -7,9 +7,9 @@ const TOKEN_TYPE = 'Bearer';
|
|
|
7
7
|
export const defaultFetchConfig = {
|
|
8
8
|
headers: {
|
|
9
9
|
'Content-Type': 'application/json',
|
|
10
|
-
Accept: 'application/json'
|
|
10
|
+
Accept: 'application/json',
|
|
11
11
|
},
|
|
12
|
-
credentials: 'same-origin'
|
|
12
|
+
credentials: 'same-origin',
|
|
13
13
|
};
|
|
14
14
|
export class HTTPError extends ExtendableError {
|
|
15
15
|
data;
|
|
@@ -21,7 +21,7 @@ export class HTTPError extends ExtendableError {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
export const CODE = {
|
|
24
|
-
UNAUTHORIZED: 401
|
|
24
|
+
UNAUTHORIZED: 401,
|
|
25
25
|
};
|
|
26
26
|
function isRawBody(params) {
|
|
27
27
|
return params.sendRawBody === true;
|
|
@@ -44,8 +44,8 @@ export default class HTTP {
|
|
|
44
44
|
...fetchConfig,
|
|
45
45
|
headers: {
|
|
46
46
|
...headers,
|
|
47
|
-
...fetchConfig.headers
|
|
48
|
-
}
|
|
47
|
+
...fetchConfig.headers,
|
|
48
|
+
},
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
setAuth = (auth) => {
|
|
@@ -68,7 +68,7 @@ export default class HTTP {
|
|
|
68
68
|
const combinedHeaders = {
|
|
69
69
|
...this.fetchConfig.headers,
|
|
70
70
|
...(token ? { Authorization: `${TOKEN_TYPE} ${token}` } : {}),
|
|
71
|
-
...headers
|
|
71
|
+
...headers,
|
|
72
72
|
};
|
|
73
73
|
Object.entries(combinedHeaders).forEach(([key, header]) => {
|
|
74
74
|
if (header === null || header === undefined) {
|
|
@@ -80,21 +80,19 @@ export default class HTTP {
|
|
|
80
80
|
bodyToSend = params.body;
|
|
81
81
|
}
|
|
82
82
|
else {
|
|
83
|
-
bodyToSend =
|
|
84
|
-
? params.body
|
|
85
|
-
: JSON.stringify(body);
|
|
83
|
+
bodyToSend =
|
|
84
|
+
params.body === null || params.body === undefined || params.body === '' ? params.body : JSON.stringify(body);
|
|
86
85
|
}
|
|
87
86
|
return this._fetch(this._makeRequestUrl(url, query), {
|
|
88
87
|
...this.fetchConfig,
|
|
89
88
|
headers: combinedHeaders,
|
|
90
89
|
...fetchConfig,
|
|
91
|
-
body: bodyToSend
|
|
90
|
+
body: bodyToSend,
|
|
92
91
|
});
|
|
93
92
|
}
|
|
94
93
|
_storeRequestMeta(parsedResponse, rawResponse) {
|
|
95
94
|
const { headers, ok, redirected, status, statusText, type, url } = rawResponse;
|
|
96
|
-
this._requestsMeta.
|
|
97
|
-
set(parsedResponse, { headers, ok, redirected, status, statusText, type, url });
|
|
95
|
+
this._requestsMeta.set(parsedResponse, { headers, ok, redirected, status, statusText, type, url });
|
|
98
96
|
}
|
|
99
97
|
async _processResponse(response) {
|
|
100
98
|
const contentType = response.headers.get('content-type');
|
|
@@ -123,7 +121,7 @@ export default class HTTP {
|
|
|
123
121
|
const response = await this._fetch(this._makeRequestUrl(url, query), {
|
|
124
122
|
...fetchConfig,
|
|
125
123
|
headers: fetchConfig.headers,
|
|
126
|
-
body: body !== null && body !== undefined && body !== '' ? JSON.stringify(body) : body
|
|
124
|
+
body: body !== null && body !== undefined && body !== '' ? JSON.stringify(body) : body,
|
|
127
125
|
});
|
|
128
126
|
return this._processResponse(response);
|
|
129
127
|
};
|
|
@@ -142,9 +140,7 @@ export default class HTTP {
|
|
|
142
140
|
if (!(error instanceof HTTPError)) {
|
|
143
141
|
throw error;
|
|
144
142
|
}
|
|
145
|
-
const shouldRefreshToken = typeof error.data.error === 'string'
|
|
146
|
-
? this.shouldRefreshToken?.(error.data.error)
|
|
147
|
-
: false;
|
|
143
|
+
const shouldRefreshToken = typeof error.data.error === 'string' ? this.shouldRefreshToken?.(error.data.error) : false;
|
|
148
144
|
if (shouldRefreshToken) {
|
|
149
145
|
token = await this.forceTokenUpdate?.();
|
|
150
146
|
response = await this._performRequest(url, token, params);
|
|
@@ -154,22 +150,22 @@ export default class HTTP {
|
|
|
154
150
|
}
|
|
155
151
|
};
|
|
156
152
|
getMetaForResponse = (response) => this._requestsMeta.get(response);
|
|
157
|
-
get = (url, params) =>
|
|
153
|
+
get = (url, params) => this.request(url, {
|
|
158
154
|
...params,
|
|
159
|
-
method: 'GET'
|
|
160
|
-
})
|
|
161
|
-
post = (url, params) =>
|
|
155
|
+
method: 'GET',
|
|
156
|
+
});
|
|
157
|
+
post = (url, params) => this.request(url, {
|
|
162
158
|
...params,
|
|
163
|
-
method: 'POST'
|
|
164
|
-
})
|
|
165
|
-
delete = (url, params) =>
|
|
159
|
+
method: 'POST',
|
|
160
|
+
});
|
|
161
|
+
delete = (url, params) => this.request(url, {
|
|
166
162
|
...params,
|
|
167
|
-
method: 'DELETE'
|
|
168
|
-
})
|
|
169
|
-
put = (url, params) =>
|
|
163
|
+
method: 'DELETE',
|
|
164
|
+
});
|
|
165
|
+
put = (url, params) => this.request(url, {
|
|
170
166
|
...params,
|
|
171
|
-
method: 'PUT'
|
|
172
|
-
})
|
|
167
|
+
method: 'PUT',
|
|
168
|
+
});
|
|
173
169
|
/**
|
|
174
170
|
* Usage: const {promise, abort} = http.abortify(http.get<{id: string}>)('http://test.com');
|
|
175
171
|
* @param method
|
|
@@ -181,7 +177,7 @@ export default class HTTP {
|
|
|
181
177
|
}
|
|
182
178
|
return {
|
|
183
179
|
promise: method.call(this, url, params),
|
|
184
|
-
abort: () => ctrl.abort()
|
|
180
|
+
abort: () => ctrl.abort(),
|
|
185
181
|
};
|
|
186
182
|
};
|
|
187
183
|
}
|
|
@@ -2,7 +2,7 @@ import HTTP from './http';
|
|
|
2
2
|
const authMock = {
|
|
3
3
|
requestToken: () => 'mock token',
|
|
4
4
|
shouldRefreshToken: () => false,
|
|
5
|
-
forceTokenUpdate: () => Promise.resolve(null)
|
|
5
|
+
forceTokenUpdate: () => Promise.resolve(null),
|
|
6
6
|
};
|
|
7
7
|
export default class HTTPMock extends HTTP {
|
|
8
8
|
defaultResponse;
|
|
@@ -15,18 +15,21 @@ export default class HTTPMock extends HTTP {
|
|
|
15
15
|
this.responsesByUrlMap = new Map();
|
|
16
16
|
}
|
|
17
17
|
_fetch(url, params) {
|
|
18
|
-
this.requests = [
|
|
18
|
+
this.requests = [
|
|
19
|
+
...this.requests,
|
|
20
|
+
{
|
|
19
21
|
url,
|
|
20
22
|
params: {
|
|
21
23
|
...params,
|
|
22
|
-
body: typeof params.body === 'string' ? JSON.parse(params.body) : params.body
|
|
23
|
-
}
|
|
24
|
-
}
|
|
24
|
+
body: typeof params.body === 'string' ? JSON.parse(params.body) : params.body,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
];
|
|
25
28
|
return Promise.resolve({
|
|
26
29
|
status: 200,
|
|
27
30
|
ok: true,
|
|
28
31
|
headers: new Headers({ 'content-type': 'application/json' }),
|
|
29
|
-
json: () => Promise.resolve(
|
|
32
|
+
json: () => Promise.resolve(this._getResponseForUrl(url) || this.defaultResponse),
|
|
30
33
|
});
|
|
31
34
|
}
|
|
32
35
|
respondDefault(response) {
|