@imposium-hub/components 2.5.18 → 2.6.0-1
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/Util.js +1 -2
- package/dist/cjs/Util.js.map +1 -1
- package/dist/cjs/components/app-wrapper/AppWrapper.d.ts +32 -21
- package/dist/cjs/components/app-wrapper/AppWrapper.js +244 -208
- package/dist/cjs/components/app-wrapper/AppWrapper.js.map +1 -1
- package/dist/cjs/components/app-wrapper/AppWrapperV2.d.ts +3 -9
- package/dist/cjs/components/app-wrapper/AppWrapperV2.js +119 -45
- package/dist/cjs/components/app-wrapper/AppWrapperV2.js.map +1 -1
- package/dist/cjs/components/app-wrapper/AppWrapperV3.d.ts +1 -1
- package/dist/cjs/components/app-wrapper/AppWrapperV3.js +7 -44
- package/dist/cjs/components/app-wrapper/AppWrapperV3.js.map +1 -1
- package/dist/cjs/components/assets/StoryTableNameFilter.d.ts +9 -2
- package/dist/cjs/components/assets/StoryTableNameFilter.js +3 -13
- package/dist/cjs/components/assets/StoryTableNameFilter.js.map +1 -1
- package/dist/cjs/components/compositions/TextLayer.js +0 -1
- package/dist/cjs/components/compositions/TextLayer.js.map +1 -1
- package/dist/cjs/components/context-menu/AnimateComponent.d.ts +6 -6
- package/dist/cjs/components/context-menu/AnimateComponent.js.map +1 -1
- package/dist/cjs/components/context-menu/ContextMenu.d.ts +12 -27
- package/dist/cjs/components/context-menu/ContextMenu.js +2 -15
- package/dist/cjs/components/context-menu/ContextMenu.js.map +1 -1
- package/dist/cjs/components/context-menu/ContextMenuItem.d.ts +6 -18
- package/dist/cjs/components/context-menu/ContextMenuItem.js +2 -21
- package/dist/cjs/components/context-menu/ContextMenuItem.js.map +1 -1
- package/dist/cjs/components/context-menu/ContextMenuTrigger.d.ts +6 -16
- package/dist/cjs/components/context-menu/ContextMenuTrigger.js +2 -20
- package/dist/cjs/components/context-menu/ContextMenuTrigger.js.map +1 -1
- package/dist/cjs/components/context-menu/SubMenu.d.ts +4 -12
- package/dist/cjs/components/context-menu/SubMenu.js +2 -17
- package/dist/cjs/components/context-menu/SubMenu.js.map +1 -1
- package/dist/cjs/components/data-table/Paginator.d.ts +16 -1
- package/dist/cjs/components/data-table/Paginator.js +1 -1
- package/dist/cjs/components/data-table/Paginator.js.map +1 -1
- package/dist/cjs/components/font-picker/font-manager/constants.d.ts +4 -0
- package/dist/cjs/components/font-picker/font-manager/constants.js +5 -1
- package/dist/cjs/components/font-picker/font-manager/constants.js.map +1 -1
- package/dist/cjs/components/header/Header.d.ts +8 -9
- package/dist/cjs/components/header/Header.js +95 -160
- package/dist/cjs/components/header/Header.js.map +1 -1
- package/dist/cjs/components/header/ProjectDropdown.d.ts +13 -0
- package/dist/cjs/components/header/ProjectDropdown.js +128 -0
- package/dist/cjs/components/header/ProjectDropdown.js.map +1 -0
- package/dist/cjs/components/header/StoryDropdown.d.ts +6 -0
- package/dist/cjs/components/header/StoryDropdown.js +111 -0
- package/dist/cjs/components/header/StoryDropdown.js.map +1 -0
- package/dist/cjs/components/modal/Modal.d.ts +1 -1
- package/dist/cjs/components/modal/Modal.js +2 -3
- package/dist/cjs/components/modal/Modal.js.map +1 -1
- package/dist/cjs/components/portal/Portal.d.ts +0 -2
- package/dist/cjs/components/portal/Portal.js.map +1 -1
- package/dist/cjs/components/publish-wizard/PublishWizard.d.ts +1 -3
- package/dist/cjs/components/publish-wizard/PublishWizard.js.map +1 -1
- package/dist/cjs/components/publish-wizard/publish/EmailWorkflow.js.map +1 -1
- package/dist/cjs/constants/copy.d.ts +3 -0
- package/dist/cjs/constants/copy.js +3 -0
- package/dist/cjs/constants/copy.js.map +1 -1
- package/dist/cjs/index.d.ts +4 -7
- package/dist/cjs/index.js +11 -17
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/redux/actions/asset-uploads.js +0 -1
- package/dist/cjs/redux/actions/asset-uploads.js.map +1 -1
- package/dist/cjs/services/API.d.ts +10 -3
- package/dist/cjs/services/API.js +230 -84
- package/dist/cjs/services/API.js.map +1 -1
- package/dist/cjs/services/Session.d.ts +0 -11
- package/dist/cjs/services/Session.js +3 -126
- package/dist/cjs/services/Session.js.map +1 -1
- package/dist/cjs/utils/modal.d.ts +2 -0
- package/dist/cjs/utils/modal.js +11 -0
- package/dist/cjs/utils/modal.js.map +1 -0
- package/dist/cjs/utils/pendo.d.ts +24 -0
- package/dist/cjs/utils/pendo.js +62 -0
- package/dist/cjs/utils/pendo.js.map +1 -0
- package/dist/cjs/utils/routing.d.ts +2 -0
- package/dist/cjs/utils/routing.js +10 -1
- package/dist/cjs/utils/routing.js.map +1 -1
- package/dist/esm/Util.js +1 -2
- package/dist/esm/Util.js.map +1 -1
- package/dist/esm/components/app-wrapper/AppWrapper.d.ts +32 -21
- package/dist/esm/components/app-wrapper/AppWrapper.js +143 -172
- package/dist/esm/components/app-wrapper/AppWrapper.js.map +1 -1
- package/dist/esm/components/app-wrapper/AppWrapperV2.d.ts +3 -9
- package/dist/esm/components/app-wrapper/AppWrapperV2.js +30 -33
- package/dist/esm/components/app-wrapper/AppWrapperV2.js.map +1 -1
- package/dist/esm/components/app-wrapper/AppWrapperV3.d.ts +1 -1
- package/dist/esm/components/app-wrapper/AppWrapperV3.js +5 -42
- package/dist/esm/components/app-wrapper/AppWrapperV3.js.map +1 -1
- package/dist/esm/components/assets/StoryTableNameFilter.d.ts +9 -2
- package/dist/esm/components/assets/StoryTableNameFilter.js +3 -13
- package/dist/esm/components/assets/StoryTableNameFilter.js.map +1 -1
- package/dist/esm/components/compositions/TextLayer.js +0 -1
- package/dist/esm/components/compositions/TextLayer.js.map +1 -1
- package/dist/esm/components/context-menu/AnimateComponent.d.ts +6 -6
- package/dist/esm/components/context-menu/AnimateComponent.js.map +1 -1
- package/dist/esm/components/context-menu/ContextMenu.d.ts +12 -27
- package/dist/esm/components/context-menu/ContextMenu.js +2 -4
- package/dist/esm/components/context-menu/ContextMenu.js.map +1 -1
- package/dist/esm/components/context-menu/ContextMenuItem.d.ts +6 -18
- package/dist/esm/components/context-menu/ContextMenuItem.js +2 -10
- package/dist/esm/components/context-menu/ContextMenuItem.js.map +1 -1
- package/dist/esm/components/context-menu/ContextMenuTrigger.d.ts +6 -16
- package/dist/esm/components/context-menu/ContextMenuTrigger.js +2 -9
- package/dist/esm/components/context-menu/ContextMenuTrigger.js.map +1 -1
- package/dist/esm/components/context-menu/SubMenu.d.ts +4 -12
- package/dist/esm/components/context-menu/SubMenu.js +2 -6
- package/dist/esm/components/context-menu/SubMenu.js.map +1 -1
- package/dist/esm/components/data-table/Paginator.d.ts +16 -1
- package/dist/esm/components/data-table/Paginator.js +1 -1
- package/dist/esm/components/data-table/Paginator.js.map +1 -1
- package/dist/esm/components/font-picker/font-manager/constants.d.ts +4 -0
- package/dist/esm/components/font-picker/font-manager/constants.js +4 -0
- package/dist/esm/components/font-picker/font-manager/constants.js.map +1 -1
- package/dist/esm/components/header/Header.d.ts +8 -9
- package/dist/esm/components/header/Header.js +93 -147
- package/dist/esm/components/header/Header.js.map +1 -1
- package/dist/esm/components/header/ProjectDropdown.d.ts +13 -0
- package/dist/esm/components/header/ProjectDropdown.js +101 -0
- package/dist/esm/components/header/ProjectDropdown.js.map +1 -0
- package/dist/esm/components/header/StoryDropdown.d.ts +6 -0
- package/dist/esm/components/header/StoryDropdown.js +82 -0
- package/dist/esm/components/header/StoryDropdown.js.map +1 -0
- package/dist/esm/components/modal/Modal.d.ts +1 -1
- package/dist/esm/components/modal/Modal.js +2 -3
- package/dist/esm/components/modal/Modal.js.map +1 -1
- package/dist/esm/components/portal/Portal.d.ts +0 -2
- package/dist/esm/components/portal/Portal.js.map +1 -1
- package/dist/esm/components/publish-wizard/PublishWizard.d.ts +1 -3
- package/dist/esm/components/publish-wizard/PublishWizard.js.map +1 -1
- package/dist/esm/components/publish-wizard/publish/EmailWorkflow.js.map +1 -1
- package/dist/esm/constants/copy.d.ts +3 -0
- package/dist/esm/constants/copy.js +3 -0
- package/dist/esm/constants/copy.js.map +1 -1
- package/dist/esm/index.d.ts +4 -7
- package/dist/esm/index.js +4 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/redux/actions/asset-uploads.js +0 -1
- package/dist/esm/redux/actions/asset-uploads.js.map +1 -1
- package/dist/esm/services/API.d.ts +10 -3
- package/dist/esm/services/API.js +74 -27
- package/dist/esm/services/API.js.map +1 -1
- package/dist/esm/services/Session.d.ts +0 -11
- package/dist/esm/services/Session.js +3 -84
- package/dist/esm/services/Session.js.map +1 -1
- package/dist/esm/utils/modal.d.ts +2 -0
- package/dist/esm/utils/modal.js +7 -0
- package/dist/esm/utils/modal.js.map +1 -0
- package/dist/esm/utils/pendo.d.ts +24 -0
- package/dist/esm/utils/pendo.js +52 -0
- package/dist/esm/utils/pendo.js.map +1 -0
- package/dist/esm/utils/routing.d.ts +2 -0
- package/dist/esm/utils/routing.js +7 -0
- package/dist/esm/utils/routing.js.map +1 -1
- package/dist/styles.css +0 -5
- package/dist/styles.less +0 -1
- package/less/components/button.less +0 -1
- package/package.json +5 -2
- package/src/Util.ts +1 -2
- package/src/components/app-wrapper/AppWrapper.tsx +245 -257
- package/src/components/assets/StoryTableNameFilter.tsx +6 -22
- package/src/components/compositions/TextLayer.tsx +0 -1
- package/src/components/context-menu/AnimateComponent.tsx +12 -1
- package/src/components/context-menu/ContextMenu.tsx +16 -8
- package/src/components/context-menu/ContextMenuItem.tsx +12 -11
- package/src/components/context-menu/ContextMenuTrigger.tsx +12 -10
- package/src/components/context-menu/SubMenu.tsx +6 -8
- package/src/components/data-table/Paginator.tsx +19 -6
- package/src/components/font-picker/font-manager/constants.ts +5 -0
- package/src/components/header/Header.tsx +130 -242
- package/src/components/header/ProjectDropdown.tsx +174 -0
- package/src/components/modal/Modal.tsx +7 -10
- package/src/components/portal/Portal.tsx +1 -2
- package/src/components/publish-wizard/PublishWizard.tsx +1 -1
- package/src/components/publish-wizard/publish/EmailWorkflow.tsx +7 -1
- package/src/constants/copy.ts +3 -0
- package/src/index.ts +6 -14
- package/src/redux/actions/asset-uploads.ts +0 -1
- package/src/services/API.ts +92 -30
- package/src/utils/modal.ts +9 -0
- package/src/utils/pendo.ts +61 -0
- package/src/utils/routing.ts +10 -0
- package/src/components/auth-gate/AuthGate.tsx +0 -84
- package/src/redux/actions/auth.ts +0 -30
- package/src/redux/reducers/auth.ts +0 -33
- package/src/services/Auth0.ts +0 -82
- package/src/services/Session.ts +0 -153
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import ImposiumDropdown from '../dropdown/Dropdown';
|
|
3
3
|
import ServiceIcon from '../service-icon/ServiceIcon';
|
|
4
|
-
import { string2HexCode, parameterizeServiceUrl } from '../../Util';
|
|
4
|
+
import { string2HexCode, parameterizeServiceUrl, getLastModifiedStoryInOrg } from '../../Util';
|
|
5
5
|
import {
|
|
6
6
|
ICON_CHEVRON_DOWN,
|
|
7
7
|
ICON_CHEVRON_UP,
|
|
@@ -9,34 +9,34 @@ import {
|
|
|
9
9
|
ICON_UP_RIGHT_FROM_SQUARE
|
|
10
10
|
} from '../../constants/icons';
|
|
11
11
|
import { connect } from 'react-redux';
|
|
12
|
-
import Spinner from '../spinner/Spinner';
|
|
13
|
-
import _ from 'lodash';
|
|
14
|
-
import DataTable from '../data-table/DataTable';
|
|
15
|
-
import AssetsTableDateCell from '../assets/AssetsTableDateCell';
|
|
16
|
-
import SessionService, { IHubSession } from '../../services/Session';
|
|
17
12
|
import Button from '../button/Button';
|
|
18
13
|
import Select, { createFilter } from 'react-select';
|
|
19
14
|
import { setAccessData } from '../../redux/actions/access';
|
|
20
15
|
import { bindActionCreators } from 'redux';
|
|
21
|
-
import { StoryTableTotalRendersCell } from '../assets/StoryTableTotalRendersCell';
|
|
22
|
-
import StoryTableNameFilter from '../assets/StoryTableNameFilter';
|
|
23
16
|
import { updateStoryFilter } from '../../redux/actions/story-filter';
|
|
24
|
-
|
|
17
|
+
import { IImposiumAPI } from '../../services/API';
|
|
18
|
+
import { pushRoute } from '../../utils/routing';
|
|
19
|
+
import { openConfirmModal } from '../../utils/modal';
|
|
20
|
+
import { header } from '../../constants/copy';
|
|
21
|
+
import { ProjectDropdown } from './ProjectDropdown';
|
|
22
|
+
import { APP_WRAPPER_ERROR_STATES } from '../app-wrapper/AppWrapper';
|
|
25
23
|
export interface IHeaderProps {
|
|
26
|
-
|
|
24
|
+
auth0: any;
|
|
25
|
+
api: IImposiumAPI;
|
|
26
|
+
errorState?: string;
|
|
27
|
+
activeServiceId: string;
|
|
27
28
|
activeOrganization: string;
|
|
28
29
|
activeStory?: string;
|
|
29
30
|
hideStoryPicker?: boolean;
|
|
30
31
|
hideOrgPicker?: boolean;
|
|
31
32
|
setAccessData(access: any): void;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
unsavedChanges: boolean;
|
|
34
|
+
saveStory();
|
|
35
|
+
onLogout();
|
|
35
36
|
additionalButtons?: any[];
|
|
36
37
|
CrMLink?: string;
|
|
37
38
|
auth: any;
|
|
38
39
|
story: any;
|
|
39
|
-
baseUrl: any;
|
|
40
40
|
hideDocs?: boolean;
|
|
41
41
|
showFTLogo?: boolean;
|
|
42
42
|
access: any;
|
|
@@ -47,16 +47,12 @@ export interface IHeaderProps {
|
|
|
47
47
|
export interface IHeaderState {
|
|
48
48
|
inactiveOrganizations: any[];
|
|
49
49
|
servicesByOrganization: any[];
|
|
50
|
-
activeServiceBlob: any;
|
|
51
50
|
activeOrganizationBlob: any;
|
|
52
51
|
showAccountDropdown: boolean;
|
|
53
52
|
showStoriesDropdown: boolean;
|
|
54
53
|
showServiceDropdown: boolean;
|
|
55
54
|
dropdownToggleColor: string;
|
|
56
55
|
activeFirstChar: string;
|
|
57
|
-
order: string;
|
|
58
|
-
orderDirection: string;
|
|
59
|
-
totalRendersLoading: boolean;
|
|
60
56
|
}
|
|
61
57
|
|
|
62
58
|
class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
|
|
@@ -100,16 +96,12 @@ class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
|
|
|
100
96
|
this.state = {
|
|
101
97
|
inactiveOrganizations: [],
|
|
102
98
|
servicesByOrganization: [],
|
|
103
|
-
activeServiceBlob: undefined,
|
|
104
99
|
activeOrganizationBlob: undefined,
|
|
105
100
|
showAccountDropdown: false,
|
|
106
101
|
showStoriesDropdown: false,
|
|
107
102
|
showServiceDropdown: false,
|
|
108
103
|
dropdownToggleColor: ImposiumHeader.DEFAULT_ACCOUNT_TOGGLE_COLOR,
|
|
109
|
-
activeFirstChar: ''
|
|
110
|
-
order: 'date_modified',
|
|
111
|
-
orderDirection: 'desc',
|
|
112
|
-
totalRendersLoading: false
|
|
104
|
+
activeFirstChar: ''
|
|
113
105
|
};
|
|
114
106
|
|
|
115
107
|
this.serviceToggleRef = React.createRef();
|
|
@@ -136,28 +128,20 @@ class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
|
|
|
136
128
|
private parseAccessData = (accessData: any, activeOrganization: string): void => {
|
|
137
129
|
const { organizations, services } = accessData;
|
|
138
130
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const session: IHubSession = SessionService.getSession();
|
|
142
|
-
activeOrgId = session.organization_id;
|
|
143
|
-
}
|
|
144
|
-
const activeOrganizationBlob: any = activeOrgId
|
|
145
|
-
? accessData.organizations.find((org) => org.id === activeOrgId)
|
|
131
|
+
const activeOrganizationBlob: any = activeOrganization
|
|
132
|
+
? accessData.organizations.find((org) => org.id === activeOrganization)
|
|
146
133
|
: undefined;
|
|
147
134
|
|
|
148
135
|
const inactiveOrganizations: any[] =
|
|
149
|
-
organizations.length > 1
|
|
136
|
+
organizations.length > 1
|
|
137
|
+
? organizations.filter((o) => o.id !== activeOrganization)
|
|
138
|
+
: [];
|
|
150
139
|
|
|
151
140
|
const servicesByOrganization: any[] =
|
|
152
141
|
services && activeOrganizationBlob
|
|
153
142
|
? services.filter((s: any) => activeOrganizationBlob.services.includes(s.id))
|
|
154
143
|
: [];
|
|
155
144
|
|
|
156
|
-
const activeServiceBlob: any =
|
|
157
|
-
servicesByOrganization.length > 1
|
|
158
|
-
? services.find((s: any) => window.location.href.includes(s.url))
|
|
159
|
-
: undefined;
|
|
160
|
-
|
|
161
145
|
let dropdownToggleColor: string = ImposiumHeader.DEFAULT_ACCOUNT_TOGGLE_COLOR;
|
|
162
146
|
let activeFirstChar: string = '';
|
|
163
147
|
|
|
@@ -168,7 +152,6 @@ class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
|
|
|
168
152
|
|
|
169
153
|
this.setState({
|
|
170
154
|
servicesByOrganization,
|
|
171
|
-
activeServiceBlob,
|
|
172
155
|
inactiveOrganizations,
|
|
173
156
|
activeOrganizationBlob,
|
|
174
157
|
dropdownToggleColor,
|
|
@@ -176,58 +159,87 @@ class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
|
|
|
176
159
|
});
|
|
177
160
|
};
|
|
178
161
|
|
|
179
|
-
private closeStoriesDropDown() {
|
|
180
|
-
this.setState({ showStoriesDropdown: false }, () =>
|
|
181
|
-
this.props.updateStoryFilter({ name: '' })
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
162
|
private changeStory = (story: any): void => {
|
|
186
|
-
const {
|
|
163
|
+
const { activeOrganization, api, activeServiceId, unsavedChanges } = this.props;
|
|
164
|
+
|
|
165
|
+
const changeStory = () => {
|
|
166
|
+
pushRoute(`/${activeOrganization}/${story.id}`);
|
|
167
|
+
api.cacheActiveStory(activeServiceId, activeOrganization, story.id);
|
|
168
|
+
};
|
|
187
169
|
|
|
188
|
-
if (
|
|
189
|
-
|
|
190
|
-
|
|
170
|
+
if (unsavedChanges) {
|
|
171
|
+
const onYes = () => {
|
|
172
|
+
if (this.props.saveStory) {
|
|
173
|
+
this.props.saveStory();
|
|
174
|
+
}
|
|
175
|
+
changeStory();
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
openConfirmModal({
|
|
179
|
+
showCancel: true,
|
|
180
|
+
noLabel: header.noSave,
|
|
181
|
+
onNo: () => changeStory(),
|
|
182
|
+
yesLabel: header.onSave,
|
|
183
|
+
onYes: () => onYes(),
|
|
184
|
+
title: header.checkUnsaved
|
|
185
|
+
});
|
|
186
|
+
} else {
|
|
187
|
+
changeStory();
|
|
191
188
|
}
|
|
192
189
|
};
|
|
193
190
|
|
|
194
|
-
private toggleAccountDropdown = (toggle: boolean,
|
|
195
|
-
const {
|
|
196
|
-
|
|
191
|
+
private toggleAccountDropdown = (toggle: boolean, orgId: string = ''): void => {
|
|
192
|
+
const { api, activeServiceId, unsavedChanges } = this.props;
|
|
197
193
|
if (toggle) {
|
|
198
194
|
this.setState({ showAccountDropdown: true });
|
|
199
195
|
} else {
|
|
200
196
|
this.setState({ showAccountDropdown: false });
|
|
201
197
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
198
|
+
if (orgId) {
|
|
199
|
+
const lastModified = getLastModifiedStoryInOrg(orgId, this.props.access);
|
|
200
|
+
const changeOrg = () => {
|
|
201
|
+
let storyId = lastModified;
|
|
202
|
+
api.getCachedStoryForOrg(activeServiceId, orgId)
|
|
203
|
+
.then((res) => {
|
|
204
|
+
storyId = res.story_id ? res.story_id : lastModified;
|
|
205
|
+
if (storyId) {
|
|
206
|
+
pushRoute(`/${orgId}/${storyId}`);
|
|
207
|
+
api.cacheActiveStory(activeServiceId, orgId, storyId);
|
|
208
|
+
} else {
|
|
209
|
+
pushRoute(`/${orgId}`);
|
|
210
|
+
}
|
|
211
|
+
})
|
|
212
|
+
.catch((e) => {
|
|
213
|
+
console.error('Error getting cached storyID for Org');
|
|
214
|
+
pushRoute(`/${orgId}/${storyId}`);
|
|
215
|
+
api.cacheActiveStory(activeServiceId, orgId, storyId);
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
if (unsavedChanges) {
|
|
220
|
+
const onYes = () => {
|
|
221
|
+
this.props.saveStory();
|
|
222
|
+
changeOrg();
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
openConfirmModal({
|
|
226
|
+
showCancel: true,
|
|
227
|
+
noLabel: header.noSave,
|
|
228
|
+
onNo: () => changeOrg(),
|
|
229
|
+
yesLabel: header.onSave,
|
|
230
|
+
onYes: () => onYes(),
|
|
231
|
+
title: header.checkUnsaved
|
|
232
|
+
});
|
|
233
|
+
} else {
|
|
234
|
+
changeOrg();
|
|
235
|
+
}
|
|
210
236
|
}
|
|
211
237
|
}
|
|
212
238
|
};
|
|
213
239
|
|
|
214
|
-
private getHomeUrl = (): string => {
|
|
215
|
-
const {
|
|
216
|
-
location: { hostname, host }
|
|
217
|
-
} = window;
|
|
218
|
-
|
|
219
|
-
if (hostname === 'localhost') {
|
|
220
|
-
return 'http://localhost:3036';
|
|
221
|
-
} else if (host.includes('.staging.')) {
|
|
222
|
-
return 'https://launchpad.staging.imposium.com';
|
|
223
|
-
} else {
|
|
224
|
-
return 'https://launchpad.imposium.com';
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
|
|
228
240
|
private doLogout = (): void => {
|
|
229
241
|
this.setState({ showAccountDropdown: false });
|
|
230
|
-
this.props.
|
|
242
|
+
this.props.onLogout();
|
|
231
243
|
};
|
|
232
244
|
|
|
233
245
|
private pullFirstChar = (s: string): string => {
|
|
@@ -274,92 +286,8 @@ class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
|
|
|
274
286
|
</div>
|
|
275
287
|
);
|
|
276
288
|
|
|
277
|
-
private getAccessDataHandler = () => {
|
|
278
|
-
const {
|
|
279
|
-
auth: { accessToken },
|
|
280
|
-
baseUrl,
|
|
281
|
-
activeOrganization
|
|
282
|
-
} = this.props;
|
|
283
|
-
|
|
284
|
-
this.setState({ totalRendersLoading: true });
|
|
285
|
-
|
|
286
|
-
SessionService.getAccessData(accessToken, baseUrl, true, activeOrganization)
|
|
287
|
-
.then((res) => {
|
|
288
|
-
this.props.setAccessData(res);
|
|
289
|
-
this.setState({ totalRendersLoading: false });
|
|
290
|
-
})
|
|
291
|
-
.catch((e) => {
|
|
292
|
-
console.error(e);
|
|
293
|
-
});
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
private getStoriesColumns() {
|
|
297
|
-
return [
|
|
298
|
-
{
|
|
299
|
-
accessor: 'name',
|
|
300
|
-
Header: 'Name',
|
|
301
|
-
width: 115,
|
|
302
|
-
minWidth: 115,
|
|
303
|
-
Search: () => <StoryTableNameFilter />,
|
|
304
|
-
disableSortBy: false
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
accessor: 'total_renders',
|
|
308
|
-
Header: 'Total Renders',
|
|
309
|
-
width: 60,
|
|
310
|
-
minWidth: 60,
|
|
311
|
-
maxWidth: 60,
|
|
312
|
-
disableSortBy: false,
|
|
313
|
-
Cell: (cell: any) => (
|
|
314
|
-
<StoryTableTotalRendersCell
|
|
315
|
-
loading={this.state.totalRendersLoading}
|
|
316
|
-
cell={cell}
|
|
317
|
-
date_created={false}
|
|
318
|
-
/>
|
|
319
|
-
)
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
accessor: 'last_modified_by',
|
|
323
|
-
Header: 'Last Modified By',
|
|
324
|
-
width: 60,
|
|
325
|
-
minWidth: 60,
|
|
326
|
-
maxWidth: 60,
|
|
327
|
-
disableSortBy: true
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
accessor: 'date_modified',
|
|
331
|
-
Header: 'Last Modified',
|
|
332
|
-
width: 65,
|
|
333
|
-
minWidth: 65,
|
|
334
|
-
maxWidth: 65,
|
|
335
|
-
disableSortBy: false,
|
|
336
|
-
Cell: (cell: any) => (
|
|
337
|
-
<AssetsTableDateCell
|
|
338
|
-
cell={cell}
|
|
339
|
-
date_created={false}
|
|
340
|
-
/>
|
|
341
|
-
)
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
accessor: 'date_created',
|
|
345
|
-
Header: 'Created Date',
|
|
346
|
-
width: 65,
|
|
347
|
-
minWidth: 65,
|
|
348
|
-
maxWidth: 65,
|
|
349
|
-
disableSortBy: false,
|
|
350
|
-
Cell: (cell: any) => (
|
|
351
|
-
<AssetsTableDateCell
|
|
352
|
-
cell={cell}
|
|
353
|
-
date_created={true}
|
|
354
|
-
/>
|
|
355
|
-
)
|
|
356
|
-
}
|
|
357
|
-
];
|
|
358
|
-
}
|
|
359
|
-
|
|
360
289
|
public render() {
|
|
361
290
|
const {
|
|
362
|
-
email,
|
|
363
291
|
activeOrganization,
|
|
364
292
|
activeStory,
|
|
365
293
|
hideStoryPicker,
|
|
@@ -369,19 +297,18 @@ class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
|
|
|
369
297
|
showFTLogo,
|
|
370
298
|
hideDocs,
|
|
371
299
|
access,
|
|
372
|
-
|
|
300
|
+
api,
|
|
301
|
+
access: { organizations },
|
|
302
|
+
errorState
|
|
373
303
|
} = this.props;
|
|
374
304
|
const {
|
|
375
305
|
showAccountDropdown,
|
|
376
306
|
servicesByOrganization,
|
|
377
|
-
activeServiceBlob,
|
|
378
307
|
showStoriesDropdown,
|
|
379
308
|
activeOrganizationBlob,
|
|
380
309
|
activeFirstChar,
|
|
381
310
|
dropdownToggleColor,
|
|
382
|
-
showServiceDropdown
|
|
383
|
-
order,
|
|
384
|
-
orderDirection
|
|
311
|
+
showServiceDropdown
|
|
385
312
|
} = this.state;
|
|
386
313
|
|
|
387
314
|
let currentStory: any;
|
|
@@ -391,10 +318,7 @@ class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
|
|
|
391
318
|
let serviceAnchors: JSX.Element[];
|
|
392
319
|
let privateAnchors: JSX.Element[];
|
|
393
320
|
let accountDropdownToggle: JSX.Element;
|
|
394
|
-
let storyToggle: JSX.Element
|
|
395
|
-
let storyMenuInner: JSX.Element = (
|
|
396
|
-
<div className='no-stories-dialog'>{ImposiumHeader.NO_STORIES_COPY}</div>
|
|
397
|
-
);
|
|
321
|
+
let storyToggle: JSX.Element;
|
|
398
322
|
let serviceDropdownToggle: JSX.Element;
|
|
399
323
|
let serviceDropdownMenu: JSX.Element;
|
|
400
324
|
|
|
@@ -407,8 +331,8 @@ class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
|
|
|
407
331
|
);
|
|
408
332
|
|
|
409
333
|
if (access) {
|
|
410
|
-
activeService = servicesByOrganization.find(
|
|
411
|
-
|
|
334
|
+
activeService = servicesByOrganization.find(
|
|
335
|
+
(s: any) => s.id === this.props.activeServiceId
|
|
412
336
|
);
|
|
413
337
|
|
|
414
338
|
if (activeService) {
|
|
@@ -478,23 +402,22 @@ class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
|
|
|
478
402
|
</div>
|
|
479
403
|
);
|
|
480
404
|
|
|
481
|
-
serviceDropdownToggle =
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
?
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
);
|
|
405
|
+
serviceDropdownToggle =
|
|
406
|
+
errorState !== APP_WRAPPER_ERROR_STATES.UNAUTHORIZED_ORG ? (
|
|
407
|
+
<button
|
|
408
|
+
id='btn-toggle-services'
|
|
409
|
+
className='btn-toggle-services'
|
|
410
|
+
style={serviceDropdownColor}
|
|
411
|
+
ref={this.serviceToggleRef}
|
|
412
|
+
onClick={() =>
|
|
413
|
+
this.setState({ showServiceDropdown: !this.state.showServiceDropdown })
|
|
414
|
+
}>
|
|
415
|
+
<span>
|
|
416
|
+
{activeService ? activeService.name : ImposiumHeader.SERVICE_MESH_ALIAS}
|
|
417
|
+
</span>
|
|
418
|
+
{this.renderDropdownChevron(showServiceDropdown)}
|
|
419
|
+
</button>
|
|
420
|
+
) : null;
|
|
498
421
|
|
|
499
422
|
accountDropdownToggle =
|
|
500
423
|
!hideOrgPicker && access.organizations.length > 0 ? (
|
|
@@ -515,7 +438,12 @@ class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
|
|
|
515
438
|
storyToggle = null;
|
|
516
439
|
}
|
|
517
440
|
|
|
518
|
-
if (
|
|
441
|
+
if (
|
|
442
|
+
access &&
|
|
443
|
+
activeOrganizationBlob &&
|
|
444
|
+
!hideStoryPicker &&
|
|
445
|
+
activeOrganizationBlob.stories.length > 0
|
|
446
|
+
) {
|
|
519
447
|
currentStory = activeOrganizationBlob.stories.find((s: any) => s.id === activeStory);
|
|
520
448
|
storyToggle = (
|
|
521
449
|
<button
|
|
@@ -523,12 +451,7 @@ class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
|
|
|
523
451
|
className='btn-toggle-story'
|
|
524
452
|
ref={this.storyToggleRef}
|
|
525
453
|
onClick={() => {
|
|
526
|
-
this.setState({ showStoriesDropdown: !showStoriesDropdown }
|
|
527
|
-
if (showStoriesDropdown === false) {
|
|
528
|
-
this.props.updateStoryFilter({ name: '' });
|
|
529
|
-
this.getAccessDataHandler();
|
|
530
|
-
}
|
|
531
|
-
});
|
|
454
|
+
this.setState({ showStoriesDropdown: !showStoriesDropdown });
|
|
532
455
|
}}>
|
|
533
456
|
<div className='story-name'>
|
|
534
457
|
{currentStory
|
|
@@ -540,48 +463,6 @@ class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
|
|
|
540
463
|
{this.renderDropdownChevron(showStoriesDropdown)}
|
|
541
464
|
</button>
|
|
542
465
|
);
|
|
543
|
-
|
|
544
|
-
if (activeOrganizationBlob.stories.length !== 0) {
|
|
545
|
-
const sortBy =
|
|
546
|
-
order && orderDirection
|
|
547
|
-
? [{ id: order, desc: orderDirection === 'desc' }]
|
|
548
|
-
: undefined;
|
|
549
|
-
|
|
550
|
-
let sortedStories = _.orderBy(
|
|
551
|
-
activeOrganizationBlob.stories,
|
|
552
|
-
['date_modified'],
|
|
553
|
-
['desc']
|
|
554
|
-
);
|
|
555
|
-
|
|
556
|
-
if (this.props.storyFilter && this.props.storyFilter?.name) {
|
|
557
|
-
const storyFilter = this.props.storyFilter.name.toLowerCase();
|
|
558
|
-
|
|
559
|
-
sortedStories = sortedStories.filter((stories) =>
|
|
560
|
-
stories.name.toLowerCase().includes(storyFilter)
|
|
561
|
-
);
|
|
562
|
-
|
|
563
|
-
const sortById = sortedStories.filter((stories) =>
|
|
564
|
-
stories.id.includes(storyFilter)
|
|
565
|
-
);
|
|
566
|
-
|
|
567
|
-
if (sortById.length > 0) {
|
|
568
|
-
sortedStories = sortById;
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
storyMenuInner = (
|
|
573
|
-
<DataTable
|
|
574
|
-
columns={this.getStoriesColumns()}
|
|
575
|
-
data={sortedStories}
|
|
576
|
-
sortBy={sortBy}
|
|
577
|
-
noDataText={ImposiumHeader.NO_STORIES_COPY}
|
|
578
|
-
itemsPerPage={activeOrganizationBlob.stories.length}
|
|
579
|
-
hidePaginator={true}
|
|
580
|
-
onRowClick={this.changeStory}
|
|
581
|
-
keyboardNav={true}
|
|
582
|
-
/>
|
|
583
|
-
);
|
|
584
|
-
}
|
|
585
466
|
}
|
|
586
467
|
|
|
587
468
|
const orgOptions = [];
|
|
@@ -593,6 +474,9 @@ class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
|
|
|
593
474
|
});
|
|
594
475
|
}
|
|
595
476
|
|
|
477
|
+
const email = '';
|
|
478
|
+
// const email = scrapeEmail(auth);
|
|
479
|
+
// TODO: plug this back in
|
|
596
480
|
const orgSelect = () => {
|
|
597
481
|
return (
|
|
598
482
|
<>
|
|
@@ -678,14 +562,18 @@ class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
|
|
|
678
562
|
{serviceDropdownMenu}
|
|
679
563
|
</ImposiumDropdown>
|
|
680
564
|
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
565
|
+
{activeOrganizationBlob && (
|
|
566
|
+
<ProjectDropdown
|
|
567
|
+
api={api}
|
|
568
|
+
position='bottomright'
|
|
569
|
+
setAccessData={this.props.setAccessData}
|
|
570
|
+
storiesArray={activeOrganizationBlob.stories}
|
|
571
|
+
show={this.state.showStoriesDropdown}
|
|
572
|
+
onClose={() => this.setState({ showStoriesDropdown: false })}
|
|
573
|
+
changeStory={this.changeStory}
|
|
574
|
+
toggleRef={this.storyToggleRef}
|
|
575
|
+
/>
|
|
576
|
+
)}
|
|
689
577
|
|
|
690
578
|
<ImposiumDropdown
|
|
691
579
|
key='org-dropdown'
|