@imposium-hub/components 1.60.22 → 1.61.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/dist/cjs/components/asset-details/AssetDetails.js +22 -3
- package/dist/cjs/components/asset-details/AssetDetails.js.map +1 -1
- package/dist/cjs/components/button/Button.stories.d.ts +1 -0
- package/dist/cjs/components/button-group-field/ButtonGroupField.stories.d.ts +1 -0
- package/dist/cjs/components/button-menu/ButtonMenu.stories.d.ts +1 -0
- package/dist/cjs/components/card/Card.stories.d.ts +1 -0
- package/dist/cjs/components/checkbox-field/CheckboxField.stories.d.ts +1 -0
- package/dist/cjs/components/color-field/ColorFiled.stories.d.ts +1 -0
- package/dist/cjs/components/controlled-list/ControlledList.stories.d.ts +1 -0
- package/dist/cjs/components/data-table/DataTable.js +2 -2
- package/dist/cjs/components/data-table/DataTable.js.map +1 -1
- package/dist/cjs/components/dropdown/Dropdown.js +1 -1
- package/dist/cjs/components/dropdown/Dropdown.js.map +1 -1
- package/dist/cjs/components/field-wrapper/FieldWrapper.stories.d.ts +1 -0
- package/dist/cjs/components/h-rule/HRule.d.ts +1 -0
- package/dist/cjs/components/h-rule/HRule.stories.d.ts +1 -0
- package/dist/cjs/components/header/Header.d.ts +8 -35
- package/dist/cjs/components/header/Header.js +94 -36
- package/dist/cjs/components/header/Header.js.map +1 -1
- package/dist/cjs/components/list-field/ListField.stories.d.ts +1 -0
- package/dist/cjs/components/modal/Modal.stories.d.ts +1 -0
- package/dist/cjs/components/number-field/NumberField.stories.d.ts +1 -0
- package/dist/cjs/components/section/Section.d.ts +1 -0
- package/dist/cjs/components/section/Section.stories.d.ts +1 -0
- package/dist/cjs/components/select-field/SelectField.stories.d.ts +1 -0
- package/dist/cjs/components/slider-field/SliderField.stories.d.ts +1 -0
- package/dist/cjs/components/text-area-field/TextAreaField.stories.d.ts +1 -0
- package/dist/cjs/components/text-field/TextField.stories.d.ts +1 -0
- package/dist/esm/components/asset-details/AssetDetails.js +22 -3
- package/dist/esm/components/asset-details/AssetDetails.js.map +1 -1
- package/dist/esm/components/button/Button.stories.d.ts +1 -0
- package/dist/esm/components/button-group-field/ButtonGroupField.stories.d.ts +1 -0
- package/dist/esm/components/button-menu/ButtonMenu.stories.d.ts +1 -0
- package/dist/esm/components/card/Card.stories.d.ts +1 -0
- package/dist/esm/components/checkbox-field/CheckboxField.stories.d.ts +1 -0
- package/dist/esm/components/color-field/ColorFiled.stories.d.ts +1 -0
- package/dist/esm/components/controlled-list/ControlledList.stories.d.ts +1 -0
- package/dist/esm/components/data-table/DataTable.js +2 -2
- package/dist/esm/components/data-table/DataTable.js.map +1 -1
- package/dist/esm/components/dropdown/Dropdown.js +1 -1
- package/dist/esm/components/dropdown/Dropdown.js.map +1 -1
- package/dist/esm/components/field-wrapper/FieldWrapper.stories.d.ts +1 -0
- package/dist/esm/components/h-rule/HRule.d.ts +1 -0
- package/dist/esm/components/h-rule/HRule.stories.d.ts +1 -0
- package/dist/esm/components/header/Header.d.ts +8 -35
- package/dist/esm/components/header/Header.js +89 -32
- package/dist/esm/components/header/Header.js.map +1 -1
- package/dist/esm/components/list-field/ListField.stories.d.ts +1 -0
- package/dist/esm/components/modal/Modal.stories.d.ts +1 -0
- package/dist/esm/components/number-field/NumberField.stories.d.ts +1 -0
- package/dist/esm/components/section/Section.d.ts +1 -0
- package/dist/esm/components/section/Section.stories.d.ts +1 -0
- package/dist/esm/components/select-field/SelectField.stories.d.ts +1 -0
- package/dist/esm/components/slider-field/SliderField.stories.d.ts +1 -0
- package/dist/esm/components/text-area-field/TextAreaField.stories.d.ts +1 -0
- package/dist/esm/components/text-field/TextField.stories.d.ts +1 -0
- package/dist/styles.css +5 -42
- package/dist/styles.less +9 -28
- package/less/components/header.less +9 -28
- package/package.json +1 -1
- package/src/components/asset-details/AssetDetails.tsx +33 -4
- package/src/components/data-table/DataTable.tsx +2 -2
- package/src/components/header/Header.tsx +128 -50
package/dist/styles.css
CHANGED
|
@@ -1691,55 +1691,18 @@ body a {
|
|
|
1691
1691
|
color: #4D8C71;
|
|
1692
1692
|
}
|
|
1693
1693
|
.imposium-header .stories-menu {
|
|
1694
|
-
width:
|
|
1694
|
+
width: 510px;
|
|
1695
1695
|
max-height: 400px;
|
|
1696
1696
|
display: flex;
|
|
1697
1697
|
flex-direction: column;
|
|
1698
1698
|
overflow: auto;
|
|
1699
1699
|
}
|
|
1700
|
-
.imposium-header .stories-menu .
|
|
1701
|
-
font-family: 'OswaldHeader', 'Oswald', sans-serif;
|
|
1702
|
-
text-transform: uppercase;
|
|
1703
|
-
color: white;
|
|
1704
|
-
font-size: 12px;
|
|
1705
|
-
text-align: center;
|
|
1706
|
-
padding: 0.3em;
|
|
1707
|
-
}
|
|
1708
|
-
.imposium-header .stories-menu .btn-change-story {
|
|
1709
|
-
padding: 0;
|
|
1710
|
-
border: none;
|
|
1711
|
-
font: inherit;
|
|
1712
|
-
color: inherit;
|
|
1713
|
-
background-color: transparent;
|
|
1700
|
+
.imposium-header .stories-menu .ip-table-body {
|
|
1714
1701
|
cursor: pointer;
|
|
1715
|
-
|
|
1716
|
-
box-sizing: border-box;
|
|
1717
|
-
-webkit-touch-callout: none;
|
|
1718
|
-
-webkit-user-select: none;
|
|
1719
|
-
-khtml-user-select: none;
|
|
1720
|
-
-moz-user-select: none;
|
|
1721
|
-
-ms-user-select: none;
|
|
1722
|
-
user-select: none;
|
|
1723
|
-
font-family: 'OswaldHeader', 'Oswald', sans-serif;
|
|
1724
|
-
text-transform: uppercase;
|
|
1725
|
-
color: white;
|
|
1726
|
-
white-space: nowrap;
|
|
1727
|
-
overflow-x: hidden;
|
|
1728
|
-
text-overflow: ellipsis;
|
|
1729
|
-
max-width: 100%;
|
|
1730
|
-
min-height: 35px;
|
|
1731
|
-
font-size: 12px;
|
|
1732
|
-
border-bottom: 1px solid #494949;
|
|
1733
|
-
box-sizing: content-box;
|
|
1734
|
-
margin: 0;
|
|
1735
|
-
border-radius: 0;
|
|
1736
|
-
padding: 0 5px;
|
|
1702
|
+
height: 244px;
|
|
1737
1703
|
}
|
|
1738
|
-
.imposium-header .stories-menu .
|
|
1739
|
-
|
|
1740
|
-
}
|
|
1741
|
-
.imposium-header .stories-menu .btn-change-story:hover {
|
|
1742
|
-
background-color: #494949;
|
|
1704
|
+
.imposium-header .stories-menu .ip-table-body .ip-table-row:hover .ip-table-col {
|
|
1705
|
+
background-color: #393939;
|
|
1743
1706
|
}
|
|
1744
1707
|
.imposium-header .orgs-menu {
|
|
1745
1708
|
width: 240px;
|
package/dist/styles.less
CHANGED
|
@@ -1656,38 +1656,19 @@ body{
|
|
|
1656
1656
|
}
|
|
1657
1657
|
|
|
1658
1658
|
.stories-menu {
|
|
1659
|
-
width:
|
|
1659
|
+
width: 510px;
|
|
1660
1660
|
max-height: 400px;
|
|
1661
1661
|
display: flex;
|
|
1662
1662
|
flex-direction: column;
|
|
1663
1663
|
overflow: auto;
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
.btn-change-story {
|
|
1673
|
-
.btn-reset;
|
|
1674
|
-
.ellipsis;
|
|
1675
|
-
max-width: 100%;
|
|
1676
|
-
min-height: 35px;
|
|
1677
|
-
font-size: 12px;
|
|
1678
|
-
border-bottom: 1px solid #494949;
|
|
1679
|
-
box-sizing: content-box;
|
|
1680
|
-
margin: 0;
|
|
1681
|
-
border-radius: 0;
|
|
1682
|
-
padding: 0 5px;
|
|
1683
|
-
|
|
1684
|
-
&:last-child {
|
|
1685
|
-
border-bottom: unset;
|
|
1686
|
-
}
|
|
1687
|
-
|
|
1688
|
-
&:hover {
|
|
1689
|
-
background-color: #494949;
|
|
1690
|
-
}
|
|
1664
|
+
.ip-table-body {
|
|
1665
|
+
cursor: pointer;
|
|
1666
|
+
height: 244px;
|
|
1667
|
+
.ip-table-row:hover{
|
|
1668
|
+
.ip-table-col {
|
|
1669
|
+
background-color: darken(@backgroundHighlight, 15%);
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1691
1672
|
}
|
|
1692
1673
|
}
|
|
1693
1674
|
|
|
@@ -271,38 +271,19 @@
|
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
.stories-menu {
|
|
274
|
-
width:
|
|
274
|
+
width: 510px;
|
|
275
275
|
max-height: 400px;
|
|
276
276
|
display: flex;
|
|
277
277
|
flex-direction: column;
|
|
278
278
|
overflow: auto;
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
.btn-change-story {
|
|
288
|
-
.btn-reset;
|
|
289
|
-
.ellipsis;
|
|
290
|
-
max-width: 100%;
|
|
291
|
-
min-height: 35px;
|
|
292
|
-
font-size: 12px;
|
|
293
|
-
border-bottom: 1px solid #494949;
|
|
294
|
-
box-sizing: content-box;
|
|
295
|
-
margin: 0;
|
|
296
|
-
border-radius: 0;
|
|
297
|
-
padding: 0 5px;
|
|
298
|
-
|
|
299
|
-
&:last-child {
|
|
300
|
-
border-bottom: unset;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
&:hover {
|
|
304
|
-
background-color: #494949;
|
|
305
|
-
}
|
|
279
|
+
.ip-table-body {
|
|
280
|
+
cursor: pointer;
|
|
281
|
+
height: 244px;
|
|
282
|
+
.ip-table-row:hover{
|
|
283
|
+
.ip-table-col {
|
|
284
|
+
background-color: darken(@backgroundHighlight, 15%);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
306
287
|
}
|
|
307
288
|
}
|
|
308
289
|
|
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@ import SMPTEField from '../smpte-field/SMPTEField';
|
|
|
12
12
|
|
|
13
13
|
interface IAssetDetailsProps {
|
|
14
14
|
asset: any;
|
|
15
|
+
assetList: any;
|
|
15
16
|
columns: number;
|
|
16
17
|
newAsset: boolean;
|
|
17
18
|
onNameChange(n: any): void;
|
|
@@ -23,6 +24,7 @@ interface IAssetDetailsProps {
|
|
|
23
24
|
|
|
24
25
|
interface IAssetDetailsState {
|
|
25
26
|
newTag: string;
|
|
27
|
+
tags: any;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
class AssetDetails extends React.Component<IAssetDetailsProps, IAssetDetailsState> {
|
|
@@ -30,14 +32,40 @@ class AssetDetails extends React.Component<IAssetDetailsProps, IAssetDetailsStat
|
|
|
30
32
|
super(p);
|
|
31
33
|
|
|
32
34
|
this.state = {
|
|
33
|
-
newTag: ''
|
|
35
|
+
newTag: '',
|
|
36
|
+
tags: null
|
|
34
37
|
};
|
|
35
38
|
}
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
componentDidMount(): void {
|
|
41
|
+
this.setState({ tags: this.getTagsHandler() });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
componentDidUpdate(): void {
|
|
45
|
+
const tags = this.getTagsHandler();
|
|
46
|
+
if (tags !== this.state.tags) {
|
|
47
|
+
this.setState({ tags });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private getTagsHandler() {
|
|
38
52
|
const {
|
|
39
|
-
|
|
53
|
+
assetList: { assets },
|
|
54
|
+
asset,
|
|
55
|
+
asset: { id },
|
|
56
|
+
newAsset
|
|
40
57
|
} = this.props;
|
|
58
|
+
|
|
59
|
+
let tags = assets.find((i) => i.id === id).tags;
|
|
60
|
+
|
|
61
|
+
if (newAsset) {
|
|
62
|
+
tags = asset.tags;
|
|
63
|
+
}
|
|
64
|
+
return tags;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private renderTags() {
|
|
68
|
+
const { tags } = this.state;
|
|
41
69
|
const tagsArray = [...new Set(tags)];
|
|
42
70
|
const tagsMarkup: JSX.Element[] = tagsArray.map((tag: string) => (
|
|
43
71
|
<Tag
|
|
@@ -178,7 +206,8 @@ class AssetDetails extends React.Component<IAssetDetailsProps, IAssetDetailsStat
|
|
|
178
206
|
|
|
179
207
|
const mapStateToProps = (state): any => {
|
|
180
208
|
return {
|
|
181
|
-
assetTags: state.assetTags
|
|
209
|
+
assetTags: state.assetTags,
|
|
210
|
+
assetList: state.assetList
|
|
182
211
|
};
|
|
183
212
|
};
|
|
184
213
|
|
|
@@ -131,7 +131,7 @@ const DataTable: React.FC<IDataTableProps> = (props: IDataTableProps) => {
|
|
|
131
131
|
const doubleClickEnabled: boolean = typeof props.onRowDoubleClick === 'function';
|
|
132
132
|
|
|
133
133
|
const initialTableState = {
|
|
134
|
-
sortBy:
|
|
134
|
+
sortBy: props.sortBy ? props.sortBy : [],
|
|
135
135
|
pageIndex: manualPagination ? props.currentPage - 1 : undefined,
|
|
136
136
|
pageSize: props.itemsPerPage,
|
|
137
137
|
autoResetExpanded: false
|
|
@@ -173,7 +173,7 @@ const DataTable: React.FC<IDataTableProps> = (props: IDataTableProps) => {
|
|
|
173
173
|
manualFilters: true, // always true
|
|
174
174
|
disableMultiSorting: true, // always true
|
|
175
175
|
autoResetExpanded: false,
|
|
176
|
-
disableSortRemove:
|
|
176
|
+
disableSortRemove: true,
|
|
177
177
|
pageCount: props.totalPages,
|
|
178
178
|
pageSize: props.itemsPerPage
|
|
179
179
|
},
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import ImposiumDropdown from '../dropdown/
|
|
2
|
+
import ImposiumDropdown from '../dropdown/dropdown';
|
|
3
3
|
import ServiceIcon from '../service-icon/ServiceIcon';
|
|
4
4
|
import { string2HexCode, parameterizeServiceUrl } from '../../Util';
|
|
5
5
|
import { ICON_CHEVRON_DOWN, ICON_CHEVRON_UP, ICON_HELP } from '../../constants/icons';
|
|
6
|
+
import { connect } from 'react-redux';
|
|
7
|
+
import axios, { AxiosResponse, AxiosError } from 'axios';
|
|
8
|
+
import Spinner from '../spinner/Spinner';
|
|
9
|
+
import _ from 'lodash';
|
|
10
|
+
import DataTable from '../data-table/DataTable';
|
|
6
11
|
|
|
7
12
|
export interface IHeaderProps {
|
|
8
13
|
email?: string;
|
|
9
|
-
accessData: any;
|
|
10
14
|
activeOrganization: string;
|
|
11
15
|
activeStory?: string;
|
|
12
16
|
hideStoryPicker?: boolean;
|
|
13
17
|
onOrganizationChange?: (orgId: any) => any;
|
|
14
18
|
onStoryChange?: (story: any) => any;
|
|
15
19
|
logout: (...args) => any;
|
|
20
|
+
auth: any;
|
|
21
|
+
baseUrl: any;
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
export interface IHeaderState {
|
|
@@ -25,9 +31,13 @@ export interface IHeaderState {
|
|
|
25
31
|
showServiceDropdown: boolean;
|
|
26
32
|
dropdownToggleColor: string;
|
|
27
33
|
activeFirstChar: string;
|
|
34
|
+
order: string;
|
|
35
|
+
orderDirection: string;
|
|
36
|
+
accessData: any;
|
|
37
|
+
dataLoading: boolean;
|
|
28
38
|
}
|
|
29
39
|
|
|
30
|
-
|
|
40
|
+
class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
|
|
31
41
|
private static readonly DEFAULT_TITLE: string = 'imposium';
|
|
32
42
|
|
|
33
43
|
private static readonly SERVICE_MESH_ALIAS: string = 'services';
|
|
@@ -44,8 +54,6 @@ export default class ImposiumHeader extends React.PureComponent<IHeaderProps, IH
|
|
|
44
54
|
|
|
45
55
|
private static readonly SDK_DOCS_LINK: string = 'https://docs.imposium.com/js-sdk/';
|
|
46
56
|
|
|
47
|
-
private static readonly DEFAULT_SERVICE_TOGGLE_COPY: string = 'stories';
|
|
48
|
-
|
|
49
57
|
private static readonly DEFAULT_ACCOUNT_TOGGLE_COLOR: string = 'royalblue';
|
|
50
58
|
|
|
51
59
|
private static readonly NO_STORIES_COPY: string = 'No stories were found';
|
|
@@ -66,6 +74,41 @@ export default class ImposiumHeader extends React.PureComponent<IHeaderProps, IH
|
|
|
66
74
|
|
|
67
75
|
private readonly orgsToggleRef: any = null;
|
|
68
76
|
|
|
77
|
+
private readonly COLUMNS: any[] = [
|
|
78
|
+
{
|
|
79
|
+
accessor: 'name',
|
|
80
|
+
Header: 'Name',
|
|
81
|
+
width: 75,
|
|
82
|
+
minWidth: 75,
|
|
83
|
+
maxWidth: 75,
|
|
84
|
+
disableSortBy: false
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
accessor: 'lastModified',
|
|
88
|
+
Header: 'Last Modified',
|
|
89
|
+
width: 45,
|
|
90
|
+
minWidth: 45,
|
|
91
|
+
maxWidth: 45,
|
|
92
|
+
disableSortBy: false
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
accessor: 'createdDate',
|
|
96
|
+
Header: 'Created Date',
|
|
97
|
+
width: 45,
|
|
98
|
+
minWidth: 45,
|
|
99
|
+
maxWidth: 45,
|
|
100
|
+
disableSortBy: false
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
accessor: 'lastModifiedBy',
|
|
104
|
+
Header: 'Last Modified By',
|
|
105
|
+
width: 50,
|
|
106
|
+
minWidth: 50,
|
|
107
|
+
maxWidth: 50,
|
|
108
|
+
disableSortBy: true
|
|
109
|
+
}
|
|
110
|
+
];
|
|
111
|
+
|
|
69
112
|
constructor(p: IHeaderProps) {
|
|
70
113
|
super(p);
|
|
71
114
|
|
|
@@ -78,7 +121,11 @@ export default class ImposiumHeader extends React.PureComponent<IHeaderProps, IH
|
|
|
78
121
|
showStoriesDropdown: false,
|
|
79
122
|
showServiceDropdown: false,
|
|
80
123
|
dropdownToggleColor: ImposiumHeader.DEFAULT_ACCOUNT_TOGGLE_COLOR,
|
|
81
|
-
activeFirstChar: ''
|
|
124
|
+
activeFirstChar: '',
|
|
125
|
+
order: 'lastModified',
|
|
126
|
+
orderDirection: 'desc',
|
|
127
|
+
accessData: null,
|
|
128
|
+
dataLoading: true
|
|
82
129
|
};
|
|
83
130
|
|
|
84
131
|
this.serviceToggleRef = React.createRef();
|
|
@@ -87,33 +134,19 @@ export default class ImposiumHeader extends React.PureComponent<IHeaderProps, IH
|
|
|
87
134
|
}
|
|
88
135
|
|
|
89
136
|
public componentDidMount = (): void => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (accessData) {
|
|
93
|
-
this.parseAccessData(accessData, activeOrganization);
|
|
94
|
-
}
|
|
137
|
+
this.getAccessData();
|
|
95
138
|
};
|
|
96
139
|
|
|
97
|
-
public componentDidUpdate
|
|
98
|
-
const { accessData
|
|
99
|
-
const {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
this.parseAccessData(currAccess, currActive);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (
|
|
106
|
-
typeof currActive === 'string' &&
|
|
107
|
-
currActive.length === ImposiumHeader.UUID_LENGTH &&
|
|
108
|
-
currActive !== prevActive
|
|
109
|
-
) {
|
|
110
|
-
this.parseAccessData(currAccess, currActive);
|
|
140
|
+
public componentDidUpdate(prevProps: Readonly<IHeaderProps>): void {
|
|
141
|
+
const { accessData } = this.state;
|
|
142
|
+
const { activeOrganization } = this.props;
|
|
143
|
+
if (activeOrganization !== prevProps.activeOrganization) {
|
|
144
|
+
this.parseAccessData(accessData, activeOrganization);
|
|
111
145
|
}
|
|
112
|
-
}
|
|
146
|
+
}
|
|
113
147
|
|
|
114
148
|
private parseAccessData = (accessData: any, activeOrganization: string): void => {
|
|
115
149
|
const { organizations, services } = accessData;
|
|
116
|
-
|
|
117
150
|
const activeOrganizationBlob: any = activeOrganization
|
|
118
151
|
? accessData.organizations.find((org) => org.id === activeOrganization)
|
|
119
152
|
: undefined;
|
|
@@ -227,10 +260,34 @@ export default class ImposiumHeader extends React.PureComponent<IHeaderProps, IH
|
|
|
227
260
|
</div>
|
|
228
261
|
);
|
|
229
262
|
|
|
230
|
-
|
|
231
|
-
const {
|
|
263
|
+
private getAccessData = () => {
|
|
264
|
+
const {
|
|
265
|
+
auth: { idToken },
|
|
266
|
+
baseUrl,
|
|
267
|
+
activeOrganization
|
|
268
|
+
} = this.props;
|
|
269
|
+
|
|
270
|
+
const accessUrl = `${baseUrl}/access`;
|
|
271
|
+
|
|
272
|
+
this.setState({ dataLoading: true });
|
|
273
|
+
axios
|
|
274
|
+
.get(accessUrl, { headers: { Authorization: `Bearer ${idToken}` } })
|
|
275
|
+
.then((res: AxiosResponse) => {
|
|
276
|
+
if (res.data) {
|
|
277
|
+
this.setState({ dataLoading: false, accessData: res.data }, () =>
|
|
278
|
+
this.parseAccessData(res.data, activeOrganization)
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
})
|
|
282
|
+
.catch((e: AxiosError) => {
|
|
283
|
+
console.error(e);
|
|
284
|
+
});
|
|
285
|
+
};
|
|
232
286
|
|
|
287
|
+
public render() {
|
|
288
|
+
const { email, activeOrganization, activeStory, hideStoryPicker } = this.props;
|
|
233
289
|
const {
|
|
290
|
+
accessData,
|
|
234
291
|
showAccountDropdown,
|
|
235
292
|
servicesByOrganization,
|
|
236
293
|
activeServiceBlob,
|
|
@@ -239,7 +296,10 @@ export default class ImposiumHeader extends React.PureComponent<IHeaderProps, IH
|
|
|
239
296
|
activeOrganizationBlob,
|
|
240
297
|
activeFirstChar,
|
|
241
298
|
dropdownToggleColor,
|
|
242
|
-
showServiceDropdown
|
|
299
|
+
showServiceDropdown,
|
|
300
|
+
order,
|
|
301
|
+
orderDirection,
|
|
302
|
+
dataLoading
|
|
243
303
|
} = this.state;
|
|
244
304
|
|
|
245
305
|
let currentStory: any;
|
|
@@ -250,9 +310,11 @@ export default class ImposiumHeader extends React.PureComponent<IHeaderProps, IH
|
|
|
250
310
|
let privateAnchors: JSX.Element[];
|
|
251
311
|
let accountDropdownToggle: JSX.Element;
|
|
252
312
|
let activePanel: JSX.Element;
|
|
253
|
-
let storyToggle: JSX.Element
|
|
313
|
+
let storyToggle: JSX.Element = <Spinner />;
|
|
254
314
|
let orgPicker: JSX.Element;
|
|
255
|
-
let storyMenuInner: JSX.Element
|
|
315
|
+
let storyMenuInner: JSX.Element = (
|
|
316
|
+
<div className='no-stories-dialog'>{ImposiumHeader.NO_STORIES_COPY}</div>
|
|
317
|
+
);
|
|
256
318
|
let serviceDropdownToggle: JSX.Element;
|
|
257
319
|
let serviceDropdownMenu: JSX.Element;
|
|
258
320
|
|
|
@@ -370,37 +432,45 @@ export default class ImposiumHeader extends React.PureComponent<IHeaderProps, IH
|
|
|
370
432
|
|
|
371
433
|
if (accessData && activeOrganizationBlob && !hideStoryPicker) {
|
|
372
434
|
currentStory = activeOrganizationBlob.stories.find((s: any) => s.id === activeStory);
|
|
373
|
-
|
|
374
435
|
storyToggle = (
|
|
375
436
|
<button
|
|
376
437
|
id='btn-toggle-story'
|
|
377
438
|
className='btn-toggle-story'
|
|
378
439
|
ref={this.storyToggleRef}
|
|
379
440
|
onClick={() => {
|
|
380
|
-
this.setState({ showStoriesDropdown: !
|
|
441
|
+
this.setState({ showStoriesDropdown: !showStoriesDropdown }, () => {
|
|
442
|
+
if (showStoriesDropdown === false) this.getAccessData();
|
|
443
|
+
});
|
|
381
444
|
}}>
|
|
382
|
-
<div className='story-name'>
|
|
383
|
-
{currentStory
|
|
384
|
-
? currentStory.name
|
|
385
|
-
: ImposiumHeader.DEFAULT_SERVICE_TOGGLE_COPY}
|
|
386
|
-
</div>
|
|
445
|
+
<div className='story-name'>{currentStory ? currentStory.name : ''}</div>
|
|
387
446
|
{this.renderDropdownChevron(showStoriesDropdown)}
|
|
388
447
|
</button>
|
|
389
448
|
);
|
|
390
449
|
|
|
391
|
-
if (activeOrganizationBlob.stories.length
|
|
450
|
+
if (activeOrganizationBlob.stories.length !== 0) {
|
|
451
|
+
const sortBy =
|
|
452
|
+
order && orderDirection
|
|
453
|
+
? [{ id: order, desc: orderDirection === 'desc' }]
|
|
454
|
+
: undefined;
|
|
455
|
+
|
|
456
|
+
const sortedStories = _.orderBy(
|
|
457
|
+
activeOrganizationBlob.stories,
|
|
458
|
+
['lastModified'],
|
|
459
|
+
['desc']
|
|
460
|
+
);
|
|
461
|
+
|
|
392
462
|
storyMenuInner = (
|
|
393
|
-
<
|
|
463
|
+
<DataTable
|
|
464
|
+
columns={this.COLUMNS}
|
|
465
|
+
data={sortedStories}
|
|
466
|
+
showInterstitial={dataLoading}
|
|
467
|
+
sortBy={sortBy}
|
|
468
|
+
noDataText={ImposiumHeader.NO_STORIES_COPY}
|
|
469
|
+
itemsPerPage={activeOrganizationBlob.stories.length}
|
|
470
|
+
hidePaginator={true}
|
|
471
|
+
onRowClick={this.changeStory}
|
|
472
|
+
/>
|
|
394
473
|
);
|
|
395
|
-
} else {
|
|
396
|
-
storyMenuInner = activeOrganizationBlob.stories.map((s: any) => (
|
|
397
|
-
<button
|
|
398
|
-
key={s.id}
|
|
399
|
-
className='btn-change-story'
|
|
400
|
-
onClick={() => this.changeStory(s)}>
|
|
401
|
-
{s.name}
|
|
402
|
-
</button>
|
|
403
|
-
));
|
|
404
474
|
}
|
|
405
475
|
}
|
|
406
476
|
|
|
@@ -499,3 +569,11 @@ export default class ImposiumHeader extends React.PureComponent<IHeaderProps, IH
|
|
|
499
569
|
);
|
|
500
570
|
}
|
|
501
571
|
}
|
|
572
|
+
|
|
573
|
+
const mapStateToProps = (state): any => {
|
|
574
|
+
return {
|
|
575
|
+
auth: state.auth
|
|
576
|
+
};
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
export default connect(mapStateToProps, null)(ImposiumHeader);
|