@crystaldesign/diva-backoffice 26.8.0-beta.51 → 26.8.0-beta.53
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/build/esm/index.js +893 -536
- package/build/types/backoffice/src/ui/IDMEnricherEditor/components/PrefilterSelectors/PackagePublishButton.d.ts +20 -0
- package/build/types/backoffice/src/ui/IDMEnricherEditor/components/PrefilterSelectors/PackagePublishButton.d.ts.map +1 -0
- package/build/types/backoffice/src/ui/IDMEnricherEditor/components/PrefilterSelectors/PackagePublishSwitch.d.ts +12 -0
- package/build/types/backoffice/src/ui/IDMEnricherEditor/components/PrefilterSelectors/PackagePublishSwitch.d.ts.map +1 -0
- package/build/types/backoffice/src/ui/IDMEnricherEditor/components/PrefilterSelectors/PackageSelector.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/IDMEnricherEditor/hooks/useEnricherContext.d.ts +7 -0
- package/build/types/backoffice/src/ui/IDMEnricherEditor/hooks/useEnricherContext.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/IDMEnricherEditor/hooks/useModule.d.ts +1 -0
- package/build/types/backoffice/src/ui/IDMEnricherEditor/hooks/useModule.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/IDMEnricherEditor/modules/TableGroups/index.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/IDMEnricherEditor/modules/TablePackages/AutomaticPublishingOrganizationsModal.d.ts +12 -0
- package/build/types/backoffice/src/ui/IDMEnricherEditor/modules/TablePackages/AutomaticPublishingOrganizationsModal.d.ts.map +1 -0
- package/build/types/backoffice/src/ui/IDMEnricherEditor/modules/TablePackages/PackagePublishControls.d.ts +15 -0
- package/build/types/backoffice/src/ui/IDMEnricherEditor/modules/TablePackages/PackagePublishControls.d.ts.map +1 -0
- package/build/types/backoffice/src/ui/IDMEnricherEditor/modules/TablePackages/PublishCustomCell.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/IDMEnricherEditor/modules/TablePackages/publishUtils.d.ts +30 -0
- package/build/types/backoffice/src/ui/IDMEnricherEditor/modules/TablePackages/publishUtils.d.ts.map +1 -0
- package/build/types/backoffice/src/ui/IDMEnricherEditor/modules/TablePackages/usePackagePublishing.d.ts +60 -0
- package/build/types/backoffice/src/ui/IDMEnricherEditor/modules/TablePackages/usePackagePublishing.d.ts.map +1 -0
- package/build/types/backoffice/src/ui/IDMEnricherEditor/modules/TablePartlistPos/index.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/IDMEnricherEditor/modules/TablePriceList/index.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/IDMEnricherEditor/modules/TableProperties/index.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/IDMEnricherEditor/modules/TableTabGroups/index.d.ts.map +1 -1
- package/package.json +9 -9
package/build/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import React, { createElement, createContext, useState, useEffect, useRef, useMemo, forwardRef, useImperativeHandle, useCallback, createRef, useReducer, useContext, memo, useDeferredValue } from 'react';
|
|
3
3
|
import 'antd/dist/reset.css';
|
|
4
|
-
import { Divider, Form as Form$2, Button, Input as Input$1, Popover, Typography, Progress, Select, Avatar, Spin, Radio, Space, Dropdown, InputNumber, ColorPicker, Tooltip as Tooltip$1, Slider, DatePicker, Checkbox as Checkbox$1, Modal as Modal$2, Tabs, Cascader, Descriptions, Row, Col, Collapse, List as List$1, Skeleton, Alert, Card, Upload as Upload$2, Table as Table$1, message, Switch, Popconfirm, Image as Image$1, Breadcrumb, Result as Result$1, Tag, Badge,
|
|
4
|
+
import { Divider, Form as Form$2, Button, Input as Input$1, Popover, Typography, Progress, Select, Avatar, Spin, Radio, Space, Dropdown, InputNumber, ColorPicker, Tooltip as Tooltip$1, Slider, DatePicker, Checkbox as Checkbox$1, Modal as Modal$2, Tabs, Cascader, Descriptions, Row, Col, Collapse, List as List$1, Skeleton, Alert, Card, Upload as Upload$2, Table as Table$1, message, Switch, Popconfirm, Image as Image$1, Breadcrumb, Result as Result$1, theme, Tag as Tag$1, Badge, Empty, Splitter, notification, ConfigProvider, Layout, Drawer } from 'antd';
|
|
5
5
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
6
6
|
import { observer } from 'mobx-react-lite';
|
|
7
7
|
import { getLogger, DivaError, useTranslation, useDivaCore, DivaUtils, i18n } from '@crystaldesign/diva-core';
|
|
@@ -84,7 +84,7 @@ import DeleteOutlined from '@ant-design/icons/DeleteOutlined';
|
|
|
84
84
|
import JSONEditor from 'jsoneditor';
|
|
85
85
|
import 'jsoneditor/dist/jsoneditor.css';
|
|
86
86
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
87
|
-
import { MinusCircleOutlined, PlusOutlined, CheckOutlined, CopyOutlined, CalculatorOutlined, DownloadOutlined as DownloadOutlined$1, PlusSquareOutlined, DeleteOutlined as DeleteOutlined$1, FullscreenOutlined, InfoCircleOutlined as InfoCircleOutlined$1, CloseOutlined as CloseOutlined$1, PlusCircleOutlined as PlusCircleOutlined$1, HomeOutlined as HomeOutlined$1, InboxOutlined, EditOutlined, EyeOutlined, FilePdfOutlined, LoadingOutlined, DownOutlined as DownOutlined$1, UploadOutlined as UploadOutlined$2, GlobalOutlined, SendOutlined as SendOutlined$1, CheckCircleOutlined, CloseCircleOutlined, HeartOutlined, RightOutlined as RightOutlined$1, ReloadOutlined as ReloadOutlined$1, CloudSyncOutlined, HolderOutlined, DatabaseOutlined as DatabaseOutlined$1, DatabaseFilled, PaperClipOutlined, SettingOutlined as SettingOutlined$1, KeyOutlined as KeyOutlined$1, RedoOutlined, MenuUnfoldOutlined, MenuFoldOutlined } from '@ant-design/icons';
|
|
87
|
+
import { MinusCircleOutlined, PlusOutlined, CheckOutlined, CopyOutlined, CalculatorOutlined, DownloadOutlined as DownloadOutlined$1, PlusSquareOutlined, DeleteOutlined as DeleteOutlined$1, FullscreenOutlined, InfoCircleOutlined as InfoCircleOutlined$1, CloseOutlined as CloseOutlined$1, PlusCircleOutlined as PlusCircleOutlined$1, HomeOutlined as HomeOutlined$1, InboxOutlined, EditOutlined, EyeOutlined, FilePdfOutlined, LoadingOutlined, DownOutlined as DownOutlined$1, UploadOutlined as UploadOutlined$2, GlobalOutlined, SendOutlined as SendOutlined$1, CheckCircleOutlined as CheckCircleOutlined$1, CloseCircleOutlined, HeartOutlined, RightOutlined as RightOutlined$1, ReloadOutlined as ReloadOutlined$1, CloudSyncOutlined, HolderOutlined, DatabaseOutlined as DatabaseOutlined$1, DatabaseFilled, PaperClipOutlined, SettingOutlined as SettingOutlined$1, KeyOutlined as KeyOutlined$1, RedoOutlined, MenuUnfoldOutlined, MenuFoldOutlined } from '@ant-design/icons';
|
|
88
88
|
import classNames from 'classnames';
|
|
89
89
|
import RTFEditor from '@crystaldesign/rtf-editor';
|
|
90
90
|
import debounce from 'lodash/debounce';
|
|
@@ -126,13 +126,16 @@ import { TransformWrapper, TransformComponent } from 'react-zoom-pan-pinch';
|
|
|
126
126
|
import _objectDestructuringEmpty from '@babel/runtime/helpers/objectDestructuringEmpty';
|
|
127
127
|
import Descriptions$1 from 'antd/es/descriptions';
|
|
128
128
|
import { Spreadsheet as Spreadsheet$1 } from '@crystaldesign/spreadsheet';
|
|
129
|
-
import EditOutlined$1 from '@ant-design/icons/lib/icons/EditOutlined';
|
|
130
|
-
import Checkbox$2 from 'antd/es/checkbox/Checkbox';
|
|
131
|
-
import SyncOutlined from '@ant-design/icons/SyncOutlined';
|
|
132
|
-
import WarningOutlined from '@ant-design/icons/lib/icons/WarningOutlined';
|
|
133
129
|
import Modal$3 from 'antd/es/modal';
|
|
134
130
|
import Spin$1 from 'antd/es/spin';
|
|
135
131
|
import Flex from 'antd/es/flex';
|
|
132
|
+
import Switch$1 from 'antd/es/switch';
|
|
133
|
+
import Tag from 'antd/es/tag';
|
|
134
|
+
import CheckCircleOutlined from '@ant-design/icons/CheckCircleOutlined';
|
|
135
|
+
import SyncOutlined from '@ant-design/icons/SyncOutlined';
|
|
136
|
+
import WarningOutlined from '@ant-design/icons/lib/icons/WarningOutlined';
|
|
137
|
+
import Checkbox$2 from 'antd/es/checkbox/Checkbox';
|
|
138
|
+
import EditOutlined$1 from '@ant-design/icons/lib/icons/EditOutlined';
|
|
136
139
|
import Radio$1 from 'antd/es/radio';
|
|
137
140
|
import EyeOutlined$1 from '@ant-design/icons/lib/icons/EyeOutlined';
|
|
138
141
|
import { useTranslation as useTranslation$1 } from 'react-i18next';
|
|
@@ -155,7 +158,6 @@ import { useSortable, sortableKeyboardCoordinates, SortableContext, verticalList
|
|
|
155
158
|
import { CSS } from '@dnd-kit/utilities';
|
|
156
159
|
import FileTextOutlined from '@ant-design/icons/FileTextOutlined';
|
|
157
160
|
import UndoOutlined from '@ant-design/icons/UndoOutlined';
|
|
158
|
-
import Switch$1 from 'antd/es/switch';
|
|
159
161
|
import Layout$1 from 'antd/es/layout';
|
|
160
162
|
import Menu from 'antd/es/menu';
|
|
161
163
|
import { DoubleLeftOutlined, PushpinFilled } from '@ant-design/icons/lib/icons';
|
|
@@ -35230,7 +35232,8 @@ var useEnricherContext = function useEnricherContext() {
|
|
|
35230
35232
|
exclusivitiesFeatureSelectorState: createDefaultSelectState('exclusivitiesFeatureSelectorState'),
|
|
35231
35233
|
selectedSerie: undefined,
|
|
35232
35234
|
selectedItem: undefined,
|
|
35233
|
-
selectedFeature: undefined
|
|
35235
|
+
selectedFeature: undefined,
|
|
35236
|
+
packageDataVersion: 0
|
|
35234
35237
|
};
|
|
35235
35238
|
return root.contextStore.getContext('enricher', initialState);
|
|
35236
35239
|
}, [root.configurationStore.apiConfig.enricherService, root.dataStore.organizationId, urlPackageId]);
|
|
@@ -35254,6 +35257,18 @@ var useEnricherContext = function useEnricherContext() {
|
|
|
35254
35257
|
selectedFeature: feature
|
|
35255
35258
|
});
|
|
35256
35259
|
}, [root.contextStore]);
|
|
35260
|
+
|
|
35261
|
+
/**
|
|
35262
|
+
* Signals that data of the selected package changed elsewhere (e.g. a table row was saved). Only bumps a
|
|
35263
|
+
* counter — does NOT touch `selectedPackage` itself, since that feeds grid `applicationData`/config and
|
|
35264
|
+
* replacing it on every edit caused the grid to reset (and editing to break) after each save.
|
|
35265
|
+
*/
|
|
35266
|
+
var notifyPackageDataChanged = useCallback(function () {
|
|
35267
|
+
var _getContext$packageDa;
|
|
35268
|
+
root.contextStore.updateContext('enricher', {
|
|
35269
|
+
packageDataVersion: ((_getContext$packageDa = getContext().packageDataVersion) !== null && _getContext$packageDa !== void 0 ? _getContext$packageDa : 0) + 1
|
|
35270
|
+
});
|
|
35271
|
+
}, [root.contextStore, getContext]);
|
|
35257
35272
|
var setSelectedPackage = useCallback(function (pkg) {
|
|
35258
35273
|
var modules = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : currentModules;
|
|
35259
35274
|
var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '../';
|
|
@@ -35319,7 +35334,713 @@ var useEnricherContext = function useEnricherContext() {
|
|
|
35319
35334
|
setSelectedSerie: setSelectedSerie,
|
|
35320
35335
|
setSelectedItem: setSelectedItem,
|
|
35321
35336
|
setSelectedFeature: setSelectedFeature,
|
|
35322
|
-
setSelectedPackage: setSelectedPackage
|
|
35337
|
+
setSelectedPackage: setSelectedPackage,
|
|
35338
|
+
notifyPackageDataChanged: notifyPackageDataChanged
|
|
35339
|
+
});
|
|
35340
|
+
};
|
|
35341
|
+
|
|
35342
|
+
/**
|
|
35343
|
+
* Custom hook for managing loading, error, and warning modals
|
|
35344
|
+
*
|
|
35345
|
+
* @returns Object containing modal management functions and context holder
|
|
35346
|
+
* @returns {Function} showLoadingModal - Function to show a loading modal
|
|
35347
|
+
* @returns {Function} showErrorModal - Function to show an error modal
|
|
35348
|
+
* @returns {Function} showWarningModal - Function to show a warning modal
|
|
35349
|
+
* @returns {Function} closeModal - Function to close the current modal
|
|
35350
|
+
* @returns {React.ReactElement} contextHolder - Context holder element
|
|
35351
|
+
*/
|
|
35352
|
+
var useLoadingModal = function useLoadingModal() {
|
|
35353
|
+
var _Modal$useModal = Modal$3.useModal(),
|
|
35354
|
+
_Modal$useModal2 = _slicedToArray(_Modal$useModal, 2),
|
|
35355
|
+
modal = _Modal$useModal2[0],
|
|
35356
|
+
contextHolder = _Modal$useModal2[1];
|
|
35357
|
+
var _useState = useState(null),
|
|
35358
|
+
_useState2 = _slicedToArray(_useState, 2);
|
|
35359
|
+
_useState2[0];
|
|
35360
|
+
var setInstance = _useState2[1];
|
|
35361
|
+
var showLoadingModal = useCallback(function (text) {
|
|
35362
|
+
var newInstance = modal.info({
|
|
35363
|
+
content: /*#__PURE__*/jsx(Fragment, {
|
|
35364
|
+
children: /*#__PURE__*/jsx(Flex, {
|
|
35365
|
+
gap: "middle",
|
|
35366
|
+
vertical: true,
|
|
35367
|
+
children: /*#__PURE__*/jsx(Flex, {
|
|
35368
|
+
gap: "middle",
|
|
35369
|
+
children: /*#__PURE__*/jsx(Spin$1, {
|
|
35370
|
+
tip: text,
|
|
35371
|
+
size: "large",
|
|
35372
|
+
children: /*#__PURE__*/jsx("div", {
|
|
35373
|
+
style: {
|
|
35374
|
+
padding: 50,
|
|
35375
|
+
borderRadius: 4
|
|
35376
|
+
}
|
|
35377
|
+
})
|
|
35378
|
+
})
|
|
35379
|
+
})
|
|
35380
|
+
})
|
|
35381
|
+
}),
|
|
35382
|
+
icon: null,
|
|
35383
|
+
maskClosable: false,
|
|
35384
|
+
okButtonProps: {
|
|
35385
|
+
style: {
|
|
35386
|
+
display: 'none'
|
|
35387
|
+
}
|
|
35388
|
+
},
|
|
35389
|
+
closable: false,
|
|
35390
|
+
centered: true
|
|
35391
|
+
});
|
|
35392
|
+
setInstance(function (old) {
|
|
35393
|
+
old === null || old === void 0 || old.destroy();
|
|
35394
|
+
return newInstance;
|
|
35395
|
+
});
|
|
35396
|
+
}, []);
|
|
35397
|
+
var showErrorModal = useCallback(function (error) {
|
|
35398
|
+
var newInstance = modal.error({
|
|
35399
|
+
content: error,
|
|
35400
|
+
okButtonProps: {
|
|
35401
|
+
style: {
|
|
35402
|
+
display: 'none'
|
|
35403
|
+
}
|
|
35404
|
+
},
|
|
35405
|
+
centered: true,
|
|
35406
|
+
closable: true,
|
|
35407
|
+
maskClosable: true
|
|
35408
|
+
});
|
|
35409
|
+
setInstance(function (old) {
|
|
35410
|
+
old === null || old === void 0 || old.destroy();
|
|
35411
|
+
return newInstance;
|
|
35412
|
+
});
|
|
35413
|
+
}, []);
|
|
35414
|
+
var showWarningModal = useCallback(function (warning) {
|
|
35415
|
+
var newInstance = modal.warning({
|
|
35416
|
+
content: warning,
|
|
35417
|
+
okButtonProps: {
|
|
35418
|
+
style: {
|
|
35419
|
+
display: 'none'
|
|
35420
|
+
}
|
|
35421
|
+
},
|
|
35422
|
+
centered: true,
|
|
35423
|
+
closable: true,
|
|
35424
|
+
maskClosable: true
|
|
35425
|
+
});
|
|
35426
|
+
setInstance(function (old) {
|
|
35427
|
+
old === null || old === void 0 || old.destroy();
|
|
35428
|
+
return newInstance;
|
|
35429
|
+
});
|
|
35430
|
+
}, []);
|
|
35431
|
+
var closeModal = useCallback(function () {
|
|
35432
|
+
setInstance(function (old) {
|
|
35433
|
+
old === null || old === void 0 || old.destroy();
|
|
35434
|
+
return null;
|
|
35435
|
+
});
|
|
35436
|
+
}, []);
|
|
35437
|
+
return {
|
|
35438
|
+
contextHolder: contextHolder,
|
|
35439
|
+
showLoadingModal: showLoadingModal,
|
|
35440
|
+
showErrorModal: showErrorModal,
|
|
35441
|
+
showWarningModal: showWarningModal,
|
|
35442
|
+
closeModal: closeModal
|
|
35443
|
+
};
|
|
35444
|
+
};
|
|
35445
|
+
|
|
35446
|
+
/**
|
|
35447
|
+
* Fetches organizations related to the given organization and filters them down to the ones eligible
|
|
35448
|
+
* for automatic publishing of the package (either explicitly enabled for this package, or having both
|
|
35449
|
+
* access to the package and automaticPublishing enabled on their own organization settings).
|
|
35450
|
+
*/
|
|
35451
|
+
function fetchAutomaticPublishingOrganizations(_x) {
|
|
35452
|
+
return _fetchAutomaticPublishingOrganizations.apply(this, arguments);
|
|
35453
|
+
}
|
|
35454
|
+
|
|
35455
|
+
/**
|
|
35456
|
+
* Returns true if the package was last updated after it was published, meaning the published version
|
|
35457
|
+
* is outdated.
|
|
35458
|
+
*/
|
|
35459
|
+
function _fetchAutomaticPublishingOrganizations() {
|
|
35460
|
+
_fetchAutomaticPublishingOrganizations = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
35461
|
+
var authServiceUrl, organizationId, jwt, packageData, url, response, result, allowedOrgIds, currentOrg, currentOrgParentIds, isOwner;
|
|
35462
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
35463
|
+
while (1) switch (_context.prev = _context.next) {
|
|
35464
|
+
case 0:
|
|
35465
|
+
authServiceUrl = _ref.authServiceUrl, organizationId = _ref.organizationId, jwt = _ref.jwt, packageData = _ref.packageData;
|
|
35466
|
+
url = authServiceUrl + "/organizations/".concat(organizationId, "/related?limit=1000");
|
|
35467
|
+
_context.next = 4;
|
|
35468
|
+
return fetch(url, {
|
|
35469
|
+
headers: {
|
|
35470
|
+
Authorization: "Bearer ".concat(jwt),
|
|
35471
|
+
'Content-Type': 'application/json'
|
|
35472
|
+
}
|
|
35473
|
+
});
|
|
35474
|
+
case 4:
|
|
35475
|
+
response = _context.sent;
|
|
35476
|
+
if (response.ok) {
|
|
35477
|
+
_context.next = 7;
|
|
35478
|
+
break;
|
|
35479
|
+
}
|
|
35480
|
+
throw new Error("Failed to fetch organizations: ".concat(response.status));
|
|
35481
|
+
case 7:
|
|
35482
|
+
_context.next = 9;
|
|
35483
|
+
return response.json();
|
|
35484
|
+
case 9:
|
|
35485
|
+
result = _context.sent;
|
|
35486
|
+
allowedOrgIds = packageData.allowedOrganizationIds || []; // Find current organization to get its parents
|
|
35487
|
+
currentOrg = (result.data || []).find(function (o) {
|
|
35488
|
+
return o._id === organizationId;
|
|
35489
|
+
});
|
|
35490
|
+
currentOrgParentIds = (currentOrg === null || currentOrg === void 0 ? void 0 : currentOrg.parentOrganizations) || [];
|
|
35491
|
+
isOwner = packageData.organizationId === organizationId; // Show organizations that are:
|
|
35492
|
+
// 1. In package settings with AutomaticPublishing === true, OR
|
|
35493
|
+
// 2. Has access to the package AND have automaticPublishing === true in their own organization settings
|
|
35494
|
+
return _context.abrupt("return", (result.data || []).filter(function (org) {
|
|
35495
|
+
var _packageData$settings;
|
|
35496
|
+
// EXCLUDE the current organization
|
|
35497
|
+
if (org._id === organizationId) {
|
|
35498
|
+
return false;
|
|
35499
|
+
}
|
|
35500
|
+
var orgParentIds = org.parentOrganizations || [];
|
|
35501
|
+
|
|
35502
|
+
//if only shared with this organization, we only show the subtree of this organization for automatic publishing
|
|
35503
|
+
if (!isOwner) {
|
|
35504
|
+
// EXCLUDE parents of the current organization
|
|
35505
|
+
if (currentOrgParentIds.includes(org._id)) {
|
|
35506
|
+
return false;
|
|
35507
|
+
}
|
|
35508
|
+
// EXCLUDE siblings and their children
|
|
35509
|
+
var isChild = orgParentIds.includes(organizationId);
|
|
35510
|
+
var isOfSiblingBranch = !isChild && currentOrgParentIds.some(function (parentId) {
|
|
35511
|
+
return orgParentIds.includes(parentId);
|
|
35512
|
+
});
|
|
35513
|
+
if (isOfSiblingBranch) {
|
|
35514
|
+
return false;
|
|
35515
|
+
}
|
|
35516
|
+
}
|
|
35517
|
+
var hasAutomaticPublishingForPackage = ((_packageData$settings = packageData.settings) === null || _packageData$settings === void 0 || (_packageData$settings = _packageData$settings[org._id]) === null || _packageData$settings === void 0 ? void 0 : _packageData$settings.automaticPublishing) === true;
|
|
35518
|
+
var hasAccessToPackage = orgParentIds.includes(packageData.organizationId) || allowedOrgIds.includes(org._id) || allowedOrgIds.some(function (id) {
|
|
35519
|
+
return orgParentIds.includes(id);
|
|
35520
|
+
});
|
|
35521
|
+
var hasAutomaticPublishing = org.automaticPublishing === true;
|
|
35522
|
+
var hasAccessToPackageAndAutomaticPublishing = hasAccessToPackage && hasAutomaticPublishing;
|
|
35523
|
+
return hasAutomaticPublishingForPackage || hasAccessToPackageAndAutomaticPublishing;
|
|
35524
|
+
}));
|
|
35525
|
+
case 15:
|
|
35526
|
+
case "end":
|
|
35527
|
+
return _context.stop();
|
|
35528
|
+
}
|
|
35529
|
+
}, _callee);
|
|
35530
|
+
}));
|
|
35531
|
+
return _fetchAutomaticPublishingOrganizations.apply(this, arguments);
|
|
35532
|
+
}
|
|
35533
|
+
function hasUnpublishedChanges(publishDateString, lastUpdatedDateString) {
|
|
35534
|
+
var publishDate = publishDateString ? new Date(publishDateString) : undefined;
|
|
35535
|
+
var lastUpdatedDate = lastUpdatedDateString ? new Date(lastUpdatedDateString) : undefined;
|
|
35536
|
+
if (publishDate) {
|
|
35537
|
+
if (lastUpdatedDate && publishDate < lastUpdatedDate) {
|
|
35538
|
+
return true;
|
|
35539
|
+
}
|
|
35540
|
+
}
|
|
35541
|
+
return false;
|
|
35542
|
+
}
|
|
35543
|
+
|
|
35544
|
+
/**
|
|
35545
|
+
* Shared publish/unpublish state and logic for a package, used by both the packages list column and the
|
|
35546
|
+
* standalone publish button next to the package selector.
|
|
35547
|
+
*/
|
|
35548
|
+
function usePackagePublishing(_ref) {
|
|
35549
|
+
var _data$published, _data$removedOrganiza;
|
|
35550
|
+
var packageId = _ref.packageId,
|
|
35551
|
+
data = _ref.data,
|
|
35552
|
+
organizationId = _ref.organizationId,
|
|
35553
|
+
apiConfig = _ref.apiConfig,
|
|
35554
|
+
modalState = _ref.modalState,
|
|
35555
|
+
onPublished = _ref.onPublished,
|
|
35556
|
+
blockUiWhilePublishing = _ref.blockUiWhilePublishing;
|
|
35557
|
+
var _useTranslation = useTranslation(),
|
|
35558
|
+
t = _useTranslation.t;
|
|
35559
|
+
var root = useStore();
|
|
35560
|
+
var _React$useState = React.useState(false),
|
|
35561
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
35562
|
+
loading = _React$useState2[0],
|
|
35563
|
+
setLoading = _React$useState2[1];
|
|
35564
|
+
//tracks which action triggered the current request, so the UI can tell "publishing" apart from "unpublishing"
|
|
35565
|
+
var _React$useState3 = React.useState(null),
|
|
35566
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
35567
|
+
pendingAction = _React$useState4[0],
|
|
35568
|
+
setPendingAction = _React$useState4[1];
|
|
35569
|
+
var _React$useState5 = React.useState(false),
|
|
35570
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
35571
|
+
organizationModalVisible = _React$useState6[0],
|
|
35572
|
+
setOrganizationModalVisible = _React$useState6[1];
|
|
35573
|
+
var _React$useState7 = React.useState([]),
|
|
35574
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
35575
|
+
availableOrganizations = _React$useState8[0],
|
|
35576
|
+
setAvailableOrganizations = _React$useState8[1];
|
|
35577
|
+
var _React$useState9 = React.useState([]),
|
|
35578
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
35579
|
+
selectedOrganizationIds = _React$useState10[0],
|
|
35580
|
+
setSelectedOrganizationIds = _React$useState10[1];
|
|
35581
|
+
var _React$useState11 = React.useState(false),
|
|
35582
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
35583
|
+
loadingOrganizations = _React$useState12[0],
|
|
35584
|
+
setLoadingOrganizations = _React$useState12[1];
|
|
35585
|
+
var publishedData = data === null || data === void 0 || (_data$published = data.published) === null || _data$published === void 0 ? void 0 : _data$published[organizationId];
|
|
35586
|
+
var isPublishing = (publishedData === null || publishedData === void 0 ? void 0 : publishedData.publishing) || loading;
|
|
35587
|
+
var isPublished = publishedData && !isPublishing;
|
|
35588
|
+
var isReleaseWithdrawn = !!(data !== null && data !== void 0 && (_data$removedOrganiza = data.removedOrganizationIds) !== null && _data$removedOrganiza !== void 0 && _data$removedOrganiza.find(function (id) {
|
|
35589
|
+
return id === organizationId;
|
|
35590
|
+
}));
|
|
35591
|
+
var unpublishedChanges = hasUnpublishedChanges(publishedData === null || publishedData === void 0 ? void 0 : publishedData.publishDate, data === null || data === void 0 ? void 0 : data.lastUpdatedDate);
|
|
35592
|
+
var disabled = isPublishing || !(data !== null && data !== void 0 && data.basedCatalogId) && !(data !== null && data !== void 0 && data.basedPackageId) || !(data !== null && data !== void 0 && data.name);
|
|
35593
|
+
var fetchOrganizationsWithAutomaticPublishing = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
35594
|
+
var filtered;
|
|
35595
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
35596
|
+
while (1) switch (_context.prev = _context.next) {
|
|
35597
|
+
case 0:
|
|
35598
|
+
setLoadingOrganizations(true);
|
|
35599
|
+
_context.prev = 1;
|
|
35600
|
+
_context.next = 4;
|
|
35601
|
+
return fetchAutomaticPublishingOrganizations({
|
|
35602
|
+
authServiceUrl: apiConfig.authService,
|
|
35603
|
+
organizationId: organizationId,
|
|
35604
|
+
jwt: root.dataStore.jwt,
|
|
35605
|
+
packageData: data
|
|
35606
|
+
});
|
|
35607
|
+
case 4:
|
|
35608
|
+
filtered = _context.sent;
|
|
35609
|
+
setAvailableOrganizations(filtered);
|
|
35610
|
+
setSelectedOrganizationIds(filtered.map(function (org) {
|
|
35611
|
+
return org._id;
|
|
35612
|
+
}));
|
|
35613
|
+
return _context.abrupt("return", filtered);
|
|
35614
|
+
case 10:
|
|
35615
|
+
_context.prev = 10;
|
|
35616
|
+
_context.t0 = _context["catch"](1);
|
|
35617
|
+
modalState.showErrorModal("Error fetching organizations: ".concat(_context.t0 instanceof Error ? _context.t0.message : String(_context.t0)));
|
|
35618
|
+
setAvailableOrganizations([]);
|
|
35619
|
+
return _context.abrupt("return", []);
|
|
35620
|
+
case 15:
|
|
35621
|
+
_context.prev = 15;
|
|
35622
|
+
setLoadingOrganizations(false);
|
|
35623
|
+
return _context.finish(15);
|
|
35624
|
+
case 18:
|
|
35625
|
+
case "end":
|
|
35626
|
+
return _context.stop();
|
|
35627
|
+
}
|
|
35628
|
+
}, _callee, null, [[1, 10, 15, 18]]);
|
|
35629
|
+
})), [apiConfig.authService, organizationId, root.dataStore.jwt, modalState, data]);
|
|
35630
|
+
var performPublish = React.useCallback(/*#__PURE__*/function () {
|
|
35631
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(publish) {
|
|
35632
|
+
var automaticPublishingOrgIds,
|
|
35633
|
+
url,
|
|
35634
|
+
response,
|
|
35635
|
+
_errorText,
|
|
35636
|
+
errorText,
|
|
35637
|
+
_json$error,
|
|
35638
|
+
json,
|
|
35639
|
+
_args2 = arguments;
|
|
35640
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
35641
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
35642
|
+
case 0:
|
|
35643
|
+
automaticPublishingOrgIds = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : [];
|
|
35644
|
+
setLoading(true);
|
|
35645
|
+
setPendingAction(publish ? 'publish' : 'unpublish');
|
|
35646
|
+
if (blockUiWhilePublishing) {
|
|
35647
|
+
modalState.showLoadingModal(t("backoffice.idmEnricher.packages.label.".concat(publish ? 'publishing' : 'unpublishing')));
|
|
35648
|
+
}
|
|
35649
|
+
_context2.prev = 4;
|
|
35650
|
+
url = "".concat(apiConfig.enricherService, "/packages/").concat(packageId, "/").concat(publish ? 'publish' : 'unpublish', "?organizationId=").concat(organizationId);
|
|
35651
|
+
if (publish && automaticPublishingOrgIds.length > 0) {
|
|
35652
|
+
url += '&automaticPublishingOrganizationIds=' + automaticPublishingOrgIds.join(',');
|
|
35653
|
+
}
|
|
35654
|
+
_context2.next = 9;
|
|
35655
|
+
return fetch(url, {
|
|
35656
|
+
method: 'PUT',
|
|
35657
|
+
headers: {
|
|
35658
|
+
Authorization: "Bearer ".concat(root.dataStore.jwt)
|
|
35659
|
+
}
|
|
35660
|
+
});
|
|
35661
|
+
case 9:
|
|
35662
|
+
response = _context2.sent;
|
|
35663
|
+
if (!(response.status == 202)) {
|
|
35664
|
+
_context2.next = 14;
|
|
35665
|
+
break;
|
|
35666
|
+
}
|
|
35667
|
+
modalState.showWarningModal(t("backoffice.idmEnricher.packages.label.warning.".concat(publish ? 'publishing' : 'unpublishing')));
|
|
35668
|
+
_context2.next = 31;
|
|
35669
|
+
break;
|
|
35670
|
+
case 14:
|
|
35671
|
+
if (!(response.status == 200)) {
|
|
35672
|
+
_context2.next = 18;
|
|
35673
|
+
break;
|
|
35674
|
+
}
|
|
35675
|
+
modalState.closeModal();
|
|
35676
|
+
_context2.next = 31;
|
|
35677
|
+
break;
|
|
35678
|
+
case 18:
|
|
35679
|
+
_context2.prev = 18;
|
|
35680
|
+
_context2.next = 21;
|
|
35681
|
+
return response.json();
|
|
35682
|
+
case 21:
|
|
35683
|
+
json = _context2.sent;
|
|
35684
|
+
errorText = (_json$error = json.error) !== null && _json$error !== void 0 ? _json$error : json.Error;
|
|
35685
|
+
_context2.next = 30;
|
|
35686
|
+
break;
|
|
35687
|
+
case 25:
|
|
35688
|
+
_context2.prev = 25;
|
|
35689
|
+
_context2.t0 = _context2["catch"](18);
|
|
35690
|
+
_context2.next = 29;
|
|
35691
|
+
return response.text();
|
|
35692
|
+
case 29:
|
|
35693
|
+
errorText = _context2.sent;
|
|
35694
|
+
case 30:
|
|
35695
|
+
throw new Error((_errorText = errorText) !== null && _errorText !== void 0 ? _errorText : "Server error (".concat(response.status, ")"));
|
|
35696
|
+
case 31:
|
|
35697
|
+
onPublished();
|
|
35698
|
+
_context2.next = 37;
|
|
35699
|
+
break;
|
|
35700
|
+
case 34:
|
|
35701
|
+
_context2.prev = 34;
|
|
35702
|
+
_context2.t1 = _context2["catch"](4);
|
|
35703
|
+
modalState.showErrorModal("Error on ".concat(publish ? 'publish' : 'unpublish', ": ").concat(_context2.t1 instanceof Error ? _context2.t1.message : String(_context2.t1)));
|
|
35704
|
+
case 37:
|
|
35705
|
+
_context2.prev = 37;
|
|
35706
|
+
setLoading(false);
|
|
35707
|
+
setPendingAction(null);
|
|
35708
|
+
return _context2.finish(37);
|
|
35709
|
+
case 41:
|
|
35710
|
+
case "end":
|
|
35711
|
+
return _context2.stop();
|
|
35712
|
+
}
|
|
35713
|
+
}, _callee2, null, [[4, 34, 37, 41], [18, 25]]);
|
|
35714
|
+
}));
|
|
35715
|
+
return function (_x) {
|
|
35716
|
+
return _ref3.apply(this, arguments);
|
|
35717
|
+
};
|
|
35718
|
+
}(), [apiConfig.enricherService, packageId, organizationId, root.dataStore.jwt, modalState, t, onPublished, blockUiWhilePublishing]);
|
|
35719
|
+
var handlePublishClick = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
35720
|
+
var organizations;
|
|
35721
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
35722
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
35723
|
+
case 0:
|
|
35724
|
+
setSelectedOrganizationIds([]);
|
|
35725
|
+
_context3.next = 3;
|
|
35726
|
+
return fetchOrganizationsWithAutomaticPublishing();
|
|
35727
|
+
case 3:
|
|
35728
|
+
organizations = _context3.sent;
|
|
35729
|
+
if (!(organizations.length > 0)) {
|
|
35730
|
+
_context3.next = 8;
|
|
35731
|
+
break;
|
|
35732
|
+
}
|
|
35733
|
+
setOrganizationModalVisible(true);
|
|
35734
|
+
_context3.next = 10;
|
|
35735
|
+
break;
|
|
35736
|
+
case 8:
|
|
35737
|
+
_context3.next = 10;
|
|
35738
|
+
return performPublish(true, []);
|
|
35739
|
+
case 10:
|
|
35740
|
+
case "end":
|
|
35741
|
+
return _context3.stop();
|
|
35742
|
+
}
|
|
35743
|
+
}, _callee3);
|
|
35744
|
+
})), [fetchOrganizationsWithAutomaticPublishing, performPublish]);
|
|
35745
|
+
var handleConfirmPublish = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
35746
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
35747
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
35748
|
+
case 0:
|
|
35749
|
+
setOrganizationModalVisible(false);
|
|
35750
|
+
_context4.next = 3;
|
|
35751
|
+
return performPublish(true, selectedOrganizationIds);
|
|
35752
|
+
case 3:
|
|
35753
|
+
case "end":
|
|
35754
|
+
return _context4.stop();
|
|
35755
|
+
}
|
|
35756
|
+
}, _callee4);
|
|
35757
|
+
})), [selectedOrganizationIds, performPublish]);
|
|
35758
|
+
var onChange = React.useCallback(/*#__PURE__*/function () {
|
|
35759
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(publish) {
|
|
35760
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
35761
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
35762
|
+
case 0:
|
|
35763
|
+
if (!publish) {
|
|
35764
|
+
_context5.next = 5;
|
|
35765
|
+
break;
|
|
35766
|
+
}
|
|
35767
|
+
_context5.next = 3;
|
|
35768
|
+
return handlePublishClick();
|
|
35769
|
+
case 3:
|
|
35770
|
+
_context5.next = 7;
|
|
35771
|
+
break;
|
|
35772
|
+
case 5:
|
|
35773
|
+
_context5.next = 7;
|
|
35774
|
+
return performPublish(false);
|
|
35775
|
+
case 7:
|
|
35776
|
+
case "end":
|
|
35777
|
+
return _context5.stop();
|
|
35778
|
+
}
|
|
35779
|
+
}, _callee5);
|
|
35780
|
+
}));
|
|
35781
|
+
return function (_x2) {
|
|
35782
|
+
return _ref6.apply(this, arguments);
|
|
35783
|
+
};
|
|
35784
|
+
}(), [handlePublishClick, performPublish]);
|
|
35785
|
+
return {
|
|
35786
|
+
loading: loading,
|
|
35787
|
+
pendingAction: pendingAction,
|
|
35788
|
+
isPublishing: isPublishing,
|
|
35789
|
+
isPublished: isPublished,
|
|
35790
|
+
isReleaseWithdrawn: isReleaseWithdrawn,
|
|
35791
|
+
unpublishedChanges: unpublishedChanges,
|
|
35792
|
+
disabled: disabled,
|
|
35793
|
+
organizationModalVisible: organizationModalVisible,
|
|
35794
|
+
setOrganizationModalVisible: setOrganizationModalVisible,
|
|
35795
|
+
availableOrganizations: availableOrganizations,
|
|
35796
|
+
loadingOrganizations: loadingOrganizations,
|
|
35797
|
+
selectedOrganizationIds: selectedOrganizationIds,
|
|
35798
|
+
setSelectedOrganizationIds: setSelectedOrganizationIds,
|
|
35799
|
+
onChange: onChange,
|
|
35800
|
+
handleConfirmPublish: handleConfirmPublish
|
|
35801
|
+
};
|
|
35802
|
+
}
|
|
35803
|
+
|
|
35804
|
+
/**
|
|
35805
|
+
* Modal to select which organizations should get automatic publishing enabled, shown after clicking publish
|
|
35806
|
+
* when there are eligible organizations. Shared between the packages list column and the standalone publish button.
|
|
35807
|
+
*/
|
|
35808
|
+
function AutomaticPublishingOrganizationsModal(_ref) {
|
|
35809
|
+
var publishing = _ref.publishing;
|
|
35810
|
+
var _useTranslation = useTranslation(),
|
|
35811
|
+
t = _useTranslation.t;
|
|
35812
|
+
var loading = publishing.loading,
|
|
35813
|
+
organizationModalVisible = publishing.organizationModalVisible,
|
|
35814
|
+
setOrganizationModalVisible = publishing.setOrganizationModalVisible,
|
|
35815
|
+
availableOrganizations = publishing.availableOrganizations,
|
|
35816
|
+
loadingOrganizations = publishing.loadingOrganizations,
|
|
35817
|
+
selectedOrganizationIds = publishing.selectedOrganizationIds,
|
|
35818
|
+
setSelectedOrganizationIds = publishing.setSelectedOrganizationIds,
|
|
35819
|
+
handleConfirmPublish = publishing.handleConfirmPublish;
|
|
35820
|
+
return /*#__PURE__*/jsxs(Modal$3, {
|
|
35821
|
+
title: t('backoffice.idmEnricher.packages.label.selectAutomaticPublishingOrganizations'),
|
|
35822
|
+
open: organizationModalVisible,
|
|
35823
|
+
onOk: handleConfirmPublish,
|
|
35824
|
+
onCancel: function onCancel() {
|
|
35825
|
+
return setOrganizationModalVisible(false);
|
|
35826
|
+
},
|
|
35827
|
+
okText: t('backoffice.idmEnricher.packages.label.publish'),
|
|
35828
|
+
cancelText: t('backoffice.idmEnricher.packages.label.cancel'),
|
|
35829
|
+
confirmLoading: loading,
|
|
35830
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
35831
|
+
style: {
|
|
35832
|
+
marginBottom: 16
|
|
35833
|
+
},
|
|
35834
|
+
children: t('backoffice.idmEnricher.packages.label.selectAutomaticPublishingOrganizationsDescription')
|
|
35835
|
+
}), loadingOrganizations ? /*#__PURE__*/jsx("div", {
|
|
35836
|
+
style: {
|
|
35837
|
+
textAlign: 'center',
|
|
35838
|
+
padding: '20px'
|
|
35839
|
+
},
|
|
35840
|
+
children: t('backoffice.idmEnricher.packages.label.loading')
|
|
35841
|
+
}) : availableOrganizations.length === 0 ? /*#__PURE__*/jsx("div", {
|
|
35842
|
+
style: {
|
|
35843
|
+
textAlign: 'center',
|
|
35844
|
+
padding: '20px'
|
|
35845
|
+
},
|
|
35846
|
+
children: t('backoffice.idmEnricher.packages.label.noOrganizationsFound')
|
|
35847
|
+
}) : /*#__PURE__*/jsx("div", {
|
|
35848
|
+
style: {
|
|
35849
|
+
maxHeight: '400px',
|
|
35850
|
+
overflowY: 'auto'
|
|
35851
|
+
},
|
|
35852
|
+
children: /*#__PURE__*/jsx(Space$1, {
|
|
35853
|
+
direction: "vertical",
|
|
35854
|
+
style: {
|
|
35855
|
+
width: '100%'
|
|
35856
|
+
},
|
|
35857
|
+
children: availableOrganizations.map(function (org) {
|
|
35858
|
+
return /*#__PURE__*/jsx(Checkbox$2, {
|
|
35859
|
+
checked: selectedOrganizationIds.includes(org._id),
|
|
35860
|
+
onChange: function onChange(e) {
|
|
35861
|
+
if (e.target.checked) {
|
|
35862
|
+
setSelectedOrganizationIds([].concat(_toConsumableArray(selectedOrganizationIds), [org._id]));
|
|
35863
|
+
} else {
|
|
35864
|
+
setSelectedOrganizationIds(selectedOrganizationIds.filter(function (id) {
|
|
35865
|
+
return id !== org._id;
|
|
35866
|
+
}));
|
|
35867
|
+
}
|
|
35868
|
+
},
|
|
35869
|
+
children: org.displayName
|
|
35870
|
+
}, org._id);
|
|
35871
|
+
})
|
|
35872
|
+
})
|
|
35873
|
+
})]
|
|
35874
|
+
});
|
|
35875
|
+
}
|
|
35876
|
+
|
|
35877
|
+
/**
|
|
35878
|
+
* Compact publish/unpublish switch for the currently opened package: the switch carries the publish state
|
|
35879
|
+
* (on/off, green when published), a colored tag carries the additional status (current/pending changes/publishing).
|
|
35880
|
+
*/
|
|
35881
|
+
function PackagePublishSwitch(_ref) {
|
|
35882
|
+
var publishing = _ref.publishing;
|
|
35883
|
+
var _useTranslation = useTranslation(),
|
|
35884
|
+
t = _useTranslation.t;
|
|
35885
|
+
var _theme$useToken = theme.useToken(),
|
|
35886
|
+
token = _theme$useToken.token;
|
|
35887
|
+
var isPublishing = publishing.isPublishing,
|
|
35888
|
+
pendingAction = publishing.pendingAction,
|
|
35889
|
+
isPublished = publishing.isPublished,
|
|
35890
|
+
isReleaseWithdrawn = publishing.isReleaseWithdrawn,
|
|
35891
|
+
unpublishedChanges = publishing.unpublishedChanges,
|
|
35892
|
+
disabled = publishing.disabled,
|
|
35893
|
+
_onChange = publishing.onChange;
|
|
35894
|
+
var publishingLabel = pendingAction === 'unpublish' ? t('backoffice.idmEnricher.packages.label.statusUnpublishing', {
|
|
35895
|
+
defaultValue: 'Veröffentlichung wird entfernt'
|
|
35896
|
+
}) : t('backoffice.idmEnricher.packages.label.statusPublishing', {
|
|
35897
|
+
defaultValue: 'Wird gerade publiziert'
|
|
35898
|
+
});
|
|
35899
|
+
var stateLabel = isPublished ? t('backoffice.idmEnricher.packages.label.statusPublished', {
|
|
35900
|
+
defaultValue: 'Publiziert'
|
|
35901
|
+
}) : t('backoffice.idmEnricher.packages.label.statusNotPublished', {
|
|
35902
|
+
defaultValue: 'Nicht publiziert'
|
|
35903
|
+
});
|
|
35904
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
35905
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
35906
|
+
style: {
|
|
35907
|
+
boxSizing: 'border-box',
|
|
35908
|
+
display: 'flex',
|
|
35909
|
+
alignItems: 'center',
|
|
35910
|
+
height: token.controlHeight,
|
|
35911
|
+
border: "1px solid ".concat(token.colorBorder),
|
|
35912
|
+
borderRadius: token.borderRadius,
|
|
35913
|
+
padding: '0 10px',
|
|
35914
|
+
fontSize: token.fontSizeSM
|
|
35915
|
+
},
|
|
35916
|
+
children: /*#__PURE__*/jsx(Space$1, {
|
|
35917
|
+
size: "small",
|
|
35918
|
+
align: "center",
|
|
35919
|
+
children: isPublishing ?
|
|
35920
|
+
/*#__PURE__*/
|
|
35921
|
+
// the switch has no in-between state, so hide it while publishing instead of showing it as misleadingly "off"
|
|
35922
|
+
jsx(Tag, {
|
|
35923
|
+
icon: /*#__PURE__*/jsx(SyncOutlined, {
|
|
35924
|
+
spin: true
|
|
35925
|
+
}),
|
|
35926
|
+
color: "processing",
|
|
35927
|
+
children: publishingLabel
|
|
35928
|
+
}) : /*#__PURE__*/jsxs(Fragment, {
|
|
35929
|
+
children: [/*#__PURE__*/jsx(Tooltip, {
|
|
35930
|
+
title: disabled ? '' : isPublished ? t('backoffice.idmEnricher.packages.label.unpublish') : t('backoffice.idmEnricher.packages.label.publish'),
|
|
35931
|
+
children: /*#__PURE__*/jsx(Switch$1, {
|
|
35932
|
+
size: "small",
|
|
35933
|
+
checked: !!isPublished,
|
|
35934
|
+
disabled: disabled,
|
|
35935
|
+
onChange: function onChange(checked) {
|
|
35936
|
+
return _onChange(checked);
|
|
35937
|
+
}
|
|
35938
|
+
})
|
|
35939
|
+
}), /*#__PURE__*/jsx("span", {
|
|
35940
|
+
children: stateLabel
|
|
35941
|
+
}), unpublishedChanges && /*#__PURE__*/jsxs(Fragment, {
|
|
35942
|
+
children: [/*#__PURE__*/jsx(Tag, {
|
|
35943
|
+
icon: /*#__PURE__*/jsx(WarningOutlined, {}),
|
|
35944
|
+
color: "warning",
|
|
35945
|
+
children: t('backoffice.idmEnricher.packages.label.unpublishedChanges')
|
|
35946
|
+
}), /*#__PURE__*/jsx(Button$1, {
|
|
35947
|
+
size: "small",
|
|
35948
|
+
style: {
|
|
35949
|
+
fontSize: token.fontSizeSM
|
|
35950
|
+
},
|
|
35951
|
+
icon: /*#__PURE__*/jsx(ReloadOutlined, {}),
|
|
35952
|
+
onClick: function onClick() {
|
|
35953
|
+
return _onChange(true);
|
|
35954
|
+
},
|
|
35955
|
+
children: t('backoffice.idmEnricher.packages.label.republish', {
|
|
35956
|
+
defaultValue: 'Erneut publizieren'
|
|
35957
|
+
})
|
|
35958
|
+
})]
|
|
35959
|
+
}), !unpublishedChanges && isReleaseWithdrawn && /*#__PURE__*/jsx(Tag, {
|
|
35960
|
+
icon: /*#__PURE__*/jsx(WarningOutlined, {}),
|
|
35961
|
+
color: "error",
|
|
35962
|
+
children: t('backoffice.idmEnricher.packages.label.releaseWithdrawn')
|
|
35963
|
+
}), !unpublishedChanges && !isReleaseWithdrawn && isPublished && /*#__PURE__*/jsx(Tag, {
|
|
35964
|
+
icon: /*#__PURE__*/jsx(CheckCircleOutlined, {}),
|
|
35965
|
+
color: "success",
|
|
35966
|
+
children: t('backoffice.idmEnricher.packages.label.current', {
|
|
35967
|
+
defaultValue: 'Aktuell'
|
|
35968
|
+
})
|
|
35969
|
+
})]
|
|
35970
|
+
})
|
|
35971
|
+
})
|
|
35972
|
+
}), /*#__PURE__*/jsx(AutomaticPublishingOrganizationsModal, {
|
|
35973
|
+
publishing: publishing
|
|
35974
|
+
})]
|
|
35975
|
+
});
|
|
35976
|
+
}
|
|
35977
|
+
|
|
35978
|
+
/**
|
|
35979
|
+
* Publish/unpublish switch for the currently opened package, sharing its state/actions with the packages list
|
|
35980
|
+
* column but rendered as a compact switch instead (see PackagePublishSwitch).
|
|
35981
|
+
*
|
|
35982
|
+
* Fetches its own copy of the package (rather than reading `selectedPackage` from the enricher context), since
|
|
35983
|
+
* that field also feeds the grid's `applicationData`/config — replacing it on every refresh caused the grid to
|
|
35984
|
+
* reset itself and break cell editing.
|
|
35985
|
+
*/
|
|
35986
|
+
var PackagePublishButton = function PackagePublishButton(_ref) {
|
|
35987
|
+
var packageId = _ref.packageId,
|
|
35988
|
+
organizationId = _ref.organizationId,
|
|
35989
|
+
apiConfig = _ref.apiConfig,
|
|
35990
|
+
refreshToken = _ref.refreshToken;
|
|
35991
|
+
var root = useStore();
|
|
35992
|
+
var modalState = useLoadingModal();
|
|
35993
|
+
var _React$useState = React.useState(),
|
|
35994
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
35995
|
+
data = _React$useState2[0],
|
|
35996
|
+
setData = _React$useState2[1];
|
|
35997
|
+
var fetchPackage = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
35998
|
+
var response;
|
|
35999
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
36000
|
+
while (1) switch (_context.prev = _context.next) {
|
|
36001
|
+
case 0:
|
|
36002
|
+
_context.next = 2;
|
|
36003
|
+
return fetch("".concat(apiConfig.enricherService, "/packages/").concat(packageId), {
|
|
36004
|
+
headers: {
|
|
36005
|
+
Authorization: "Bearer ".concat(root.dataStore.jwt)
|
|
36006
|
+
}
|
|
36007
|
+
});
|
|
36008
|
+
case 2:
|
|
36009
|
+
response = _context.sent;
|
|
36010
|
+
if (!response.ok) {
|
|
36011
|
+
_context.next = 9;
|
|
36012
|
+
break;
|
|
36013
|
+
}
|
|
36014
|
+
_context.t0 = setData;
|
|
36015
|
+
_context.next = 7;
|
|
36016
|
+
return response.json();
|
|
36017
|
+
case 7:
|
|
36018
|
+
_context.t1 = _context.sent;
|
|
36019
|
+
(0, _context.t0)(_context.t1);
|
|
36020
|
+
case 9:
|
|
36021
|
+
case "end":
|
|
36022
|
+
return _context.stop();
|
|
36023
|
+
}
|
|
36024
|
+
}, _callee);
|
|
36025
|
+
})), [apiConfig.enricherService, packageId, root.dataStore.jwt]);
|
|
36026
|
+
React.useEffect(function () {
|
|
36027
|
+
if (packageId) fetchPackage();
|
|
36028
|
+
}, [fetchPackage, refreshToken]);
|
|
36029
|
+
|
|
36030
|
+
//blocks the UI while publishing, since there is no grid row here to show an inline spinner on
|
|
36031
|
+
var publishing = usePackagePublishing({
|
|
36032
|
+
packageId: packageId,
|
|
36033
|
+
data: data !== null && data !== void 0 ? data : {},
|
|
36034
|
+
organizationId: organizationId,
|
|
36035
|
+
apiConfig: apiConfig,
|
|
36036
|
+
modalState: modalState,
|
|
36037
|
+
onPublished: fetchPackage,
|
|
36038
|
+
blockUiWhilePublishing: true
|
|
36039
|
+
});
|
|
36040
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
36041
|
+
children: [/*#__PURE__*/jsx(PackagePublishSwitch, {
|
|
36042
|
+
publishing: publishing
|
|
36043
|
+
}), modalState.contextHolder]
|
|
35323
36044
|
});
|
|
35324
36045
|
};
|
|
35325
36046
|
|
|
@@ -35327,43 +36048,54 @@ var PackageSelector = function PackageSelector(_ref) {
|
|
|
35327
36048
|
var modules = _ref.modules;
|
|
35328
36049
|
var _useTranslation = useTranslation(),
|
|
35329
36050
|
t = _useTranslation.t;
|
|
36051
|
+
var root = useStore();
|
|
35330
36052
|
var _useEnricherContext = useEnricherContext(modules),
|
|
36053
|
+
packageId = _useEnricherContext.packageId,
|
|
35331
36054
|
selectedPackage = _useEnricherContext.selectedPackage,
|
|
35332
36055
|
setSelectedPackage = _useEnricherContext.setSelectedPackage,
|
|
35333
36056
|
enricherService = _useEnricherContext.enricherService,
|
|
35334
36057
|
organizationId = _useEnricherContext.organizationId,
|
|
35335
|
-
packageSelectorState = _useEnricherContext.packageSelectorState
|
|
35336
|
-
|
|
35337
|
-
|
|
35338
|
-
|
|
35339
|
-
|
|
35340
|
-
|
|
35341
|
-
|
|
35342
|
-
|
|
35343
|
-
|
|
36058
|
+
packageSelectorState = _useEnricherContext.packageSelectorState,
|
|
36059
|
+
packageDataVersion = _useEnricherContext.packageDataVersion;
|
|
36060
|
+
return /*#__PURE__*/jsxs(Space, {
|
|
36061
|
+
align: "end",
|
|
36062
|
+
children: [/*#__PURE__*/jsx(PackagePublishButton, {
|
|
36063
|
+
packageId: packageId,
|
|
36064
|
+
organizationId: organizationId,
|
|
36065
|
+
apiConfig: root.configurationStore.apiConfig,
|
|
36066
|
+
refreshToken: packageDataVersion
|
|
36067
|
+
}), /*#__PURE__*/jsx(SimpleSelect, {
|
|
36068
|
+
sharedState: packageSelectorState,
|
|
36069
|
+
apiInterface: {
|
|
36070
|
+
read: "".concat(enricherService, "/packages?fields=name;_id;isoLanguageIds;isApi;organizationId&organizationId=").concat(organizationId)
|
|
35344
36071
|
},
|
|
35345
|
-
|
|
35346
|
-
|
|
35347
|
-
|
|
35348
|
-
|
|
35349
|
-
|
|
35350
|
-
|
|
35351
|
-
|
|
35352
|
-
|
|
35353
|
-
|
|
35354
|
-
|
|
35355
|
-
|
|
35356
|
-
|
|
35357
|
-
|
|
35358
|
-
|
|
35359
|
-
|
|
35360
|
-
|
|
35361
|
-
|
|
35362
|
-
|
|
35363
|
-
|
|
35364
|
-
|
|
35365
|
-
|
|
35366
|
-
|
|
36072
|
+
selectMapping: {
|
|
36073
|
+
label: function label(data) {
|
|
36074
|
+
return "".concat(data.name, " ").concat(data.isApi ? '(CE)' : '');
|
|
36075
|
+
},
|
|
36076
|
+
value: '${_id}'
|
|
36077
|
+
},
|
|
36078
|
+
title: t('backoffice.menu.items.label.IDMEnricherEditorTablePackages'),
|
|
36079
|
+
value: selectedPackage,
|
|
36080
|
+
onChange: function onChange(value) {
|
|
36081
|
+
return setSelectedPackage(value);
|
|
36082
|
+
},
|
|
36083
|
+
search: true,
|
|
36084
|
+
style: {
|
|
36085
|
+
width: 200
|
|
36086
|
+
},
|
|
36087
|
+
popupClassName: 'ag-custom-component-popup',
|
|
36088
|
+
prefix: !(selectedPackage !== null && selectedPackage !== void 0 && selectedPackage.organizationId) ? undefined : selectedPackage.organizationId === organizationId ? /*#__PURE__*/jsx(EditOutlined, {}) : /*#__PURE__*/jsx(EyeOutlined, {}),
|
|
36089
|
+
optionRender: function optionRender(option) {
|
|
36090
|
+
return /*#__PURE__*/jsxs(Space, {
|
|
36091
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
36092
|
+
children: option.data.data.organizationId === organizationId ? /*#__PURE__*/jsx(EditOutlined, {}) : /*#__PURE__*/jsx(EyeOutlined, {})
|
|
36093
|
+
}), /*#__PURE__*/jsx("div", {
|
|
36094
|
+
children: option.label
|
|
36095
|
+
})]
|
|
36096
|
+
});
|
|
36097
|
+
}
|
|
36098
|
+
})]
|
|
35367
36099
|
});
|
|
35368
36100
|
};
|
|
35369
36101
|
var PackageSelector$1 = observer(PackageSelector);
|
|
@@ -35382,7 +36114,8 @@ function useModule$1 (currentModules) {
|
|
|
35382
36114
|
selectedItem = _useEnricherContext.selectedItem,
|
|
35383
36115
|
setSelectedSerie = _useEnricherContext.setSelectedSerie,
|
|
35384
36116
|
setSelectedItem = _useEnricherContext.setSelectedItem,
|
|
35385
|
-
viewOnly = _useEnricherContext.viewOnly
|
|
36117
|
+
viewOnly = _useEnricherContext.viewOnly,
|
|
36118
|
+
notifyPackageDataChanged = _useEnricherContext.notifyPackageDataChanged;
|
|
35386
36119
|
var location = useLocation();
|
|
35387
36120
|
var _useSearchParams = useSearchParams(),
|
|
35388
36121
|
_useSearchParams2 = _slicedToArray(_useSearchParams, 1),
|
|
@@ -35597,7 +36330,8 @@ function useModule$1 (currentModules) {
|
|
|
35597
36330
|
selectedSerie: selectedSerie,
|
|
35598
36331
|
selectedFeature: selectedFeature,
|
|
35599
36332
|
selectedItem: selectedItem,
|
|
35600
|
-
viewOnly: viewOnly
|
|
36333
|
+
viewOnly: viewOnly,
|
|
36334
|
+
notifyPackageDataChanged: notifyPackageDataChanged
|
|
35601
36335
|
};
|
|
35602
36336
|
}
|
|
35603
36337
|
|
|
@@ -35680,7 +36414,8 @@ var TableGroups = observer(function () {
|
|
|
35680
36414
|
selectedSerie = _useModule.selectedSerie,
|
|
35681
36415
|
setSelectedSerie = _useModule.setSelectedSerie,
|
|
35682
36416
|
setSelectedItem = _useModule.setSelectedItem,
|
|
35683
|
-
selectedItem = _useModule.selectedItem
|
|
36417
|
+
selectedItem = _useModule.selectedItem,
|
|
36418
|
+
notifyPackageDataChanged = _useModule.notifyPackageDataChanged;
|
|
35684
36419
|
useTools({
|
|
35685
36420
|
enricherPackage: selectedPackage,
|
|
35686
36421
|
isApi2: selectedPackage === null || selectedPackage === void 0 ? void 0 : selectedPackage.isApi,
|
|
@@ -35797,6 +36532,13 @@ var TableGroups = observer(function () {
|
|
|
35797
36532
|
}]
|
|
35798
36533
|
};
|
|
35799
36534
|
}, [apiInterface, t, selectedPackage === null || selectedPackage === void 0 ? void 0 : selectedPackage.isoLanguageIds, viewOnly]);
|
|
36535
|
+
var hooks = useMemo(function () {
|
|
36536
|
+
return {
|
|
36537
|
+
onDataUpdated: function onDataUpdated() {
|
|
36538
|
+
return notifyPackageDataChanged();
|
|
36539
|
+
}
|
|
36540
|
+
};
|
|
36541
|
+
}, [notifyPackageDataChanged]);
|
|
35800
36542
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
35801
36543
|
children: [/*#__PURE__*/jsx(Descriptions$1, {
|
|
35802
36544
|
title: /*#__PURE__*/jsxs("div", {
|
|
@@ -35812,313 +36554,31 @@ var TableGroups = observer(function () {
|
|
|
35812
36554
|
}), selectedPackage && /*#__PURE__*/jsx(Spreadsheet, {
|
|
35813
36555
|
gridId: 'crud-grid_groups',
|
|
35814
36556
|
applicationData: applicationData,
|
|
35815
|
-
configuration: configuration
|
|
36557
|
+
configuration: configuration,
|
|
36558
|
+
hooks: hooks
|
|
35816
36559
|
})]
|
|
35817
36560
|
});
|
|
35818
36561
|
});
|
|
35819
36562
|
|
|
35820
|
-
|
|
35821
|
-
|
|
35822
|
-
|
|
35823
|
-
|
|
35824
|
-
|
|
35825
|
-
|
|
35826
|
-
|
|
35827
|
-
organizationId = _ref.organizationId;
|
|
36563
|
+
/**
|
|
36564
|
+
* Publish/unpublish checkbox, status icons and automatic-publishing organization modal, shared between the
|
|
36565
|
+
* packages list column and the standalone publish button next to the package selector.
|
|
36566
|
+
*/
|
|
36567
|
+
function PackagePublishControls(_ref) {
|
|
36568
|
+
var publishing = _ref.publishing,
|
|
36569
|
+
buttonSize = _ref.buttonSize;
|
|
35828
36570
|
var _useTranslation = useTranslation(),
|
|
35829
36571
|
t = _useTranslation.t;
|
|
35830
|
-
var
|
|
35831
|
-
|
|
35832
|
-
|
|
35833
|
-
|
|
35834
|
-
|
|
35835
|
-
|
|
35836
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
35837
|
-
organizationModalVisible = _React$useState4[0],
|
|
35838
|
-
setOrganizationModalVisible = _React$useState4[1];
|
|
35839
|
-
var _React$useState5 = React.useState([]),
|
|
35840
|
-
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
35841
|
-
availableOrganizations = _React$useState6[0],
|
|
35842
|
-
setAvailableOrganizations = _React$useState6[1];
|
|
35843
|
-
var _React$useState7 = React.useState([]),
|
|
35844
|
-
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
35845
|
-
selectedOrganizationIds = _React$useState8[0],
|
|
35846
|
-
setSelectedOrganizationIds = _React$useState8[1];
|
|
35847
|
-
var _React$useState9 = React.useState(false),
|
|
35848
|
-
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
35849
|
-
loadingOrganizations = _React$useState10[0],
|
|
35850
|
-
setLoadingOrganizations = _React$useState10[1];
|
|
35851
|
-
var publishedData = (_data$published = data.published) === null || _data$published === void 0 ? void 0 : _data$published[organizationId];
|
|
35852
|
-
var isPublishing = (publishedData === null || publishedData === void 0 ? void 0 : publishedData.publishing) || loading;
|
|
35853
|
-
var isPublished = publishedData && !isPublishing;
|
|
35854
|
-
var isReleaseWithdrawn = !!((_data$removedOrganiza = data.removedOrganizationIds) !== null && _data$removedOrganiza !== void 0 && _data$removedOrganiza.find(function (id) {
|
|
35855
|
-
return id === organizationId;
|
|
35856
|
-
}));
|
|
35857
|
-
var unpublishedChanges = hasUnpublishedChanges(publishedData === null || publishedData === void 0 ? void 0 : publishedData.publishDate, data === null || data === void 0 ? void 0 : data.lastUpdatedDate);
|
|
35858
|
-
var disabled = isPublishing || !(data !== null && data !== void 0 && data.basedCatalogId) && !(data !== null && data !== void 0 && data.basedPackageId) || !(data !== null && data !== void 0 && data.name);
|
|
35859
|
-
var fetchOrganizationsWithAutomaticPublishing = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
35860
|
-
var url, response, result, allowedOrgIds, currentOrg, currentOrgParentIds, isOwner, filtered, allOrgIds;
|
|
35861
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
35862
|
-
while (1) switch (_context.prev = _context.next) {
|
|
35863
|
-
case 0:
|
|
35864
|
-
setLoadingOrganizations(true);
|
|
35865
|
-
_context.prev = 1;
|
|
35866
|
-
// Request organizations with automaticPublishing field from their settings
|
|
35867
|
-
url = apiConfig.authService + "/organizations/".concat(organizationId, "/related?limit=1000");
|
|
35868
|
-
_context.next = 5;
|
|
35869
|
-
return fetch(url, {
|
|
35870
|
-
headers: {
|
|
35871
|
-
Authorization: "Bearer ".concat(root.dataStore.jwt),
|
|
35872
|
-
'Content-Type': 'application/json'
|
|
35873
|
-
}
|
|
35874
|
-
});
|
|
35875
|
-
case 5:
|
|
35876
|
-
response = _context.sent;
|
|
35877
|
-
if (response.ok) {
|
|
35878
|
-
_context.next = 8;
|
|
35879
|
-
break;
|
|
35880
|
-
}
|
|
35881
|
-
throw new Error("Failed to fetch organizations: ".concat(response.status));
|
|
35882
|
-
case 8:
|
|
35883
|
-
_context.next = 10;
|
|
35884
|
-
return response.json();
|
|
35885
|
-
case 10:
|
|
35886
|
-
result = _context.sent;
|
|
35887
|
-
// Get allowed organization IDs from the package
|
|
35888
|
-
allowedOrgIds = data.allowedOrganizationIds || []; // Find current organization to get its parents
|
|
35889
|
-
currentOrg = (result.data || []).find(function (o) {
|
|
35890
|
-
return o._id === organizationId;
|
|
35891
|
-
});
|
|
35892
|
-
currentOrgParentIds = (currentOrg === null || currentOrg === void 0 ? void 0 : currentOrg.parentOrganizations) || [];
|
|
35893
|
-
isOwner = data.organizationId === organizationId; // Show organizations that are:
|
|
35894
|
-
// 1. In package settings with AutomaticPublishing === true, OR
|
|
35895
|
-
// 2. Has access to the package AND have automaticPublishing === true in their own organization settings
|
|
35896
|
-
filtered = (result.data || []).filter(function (org) {
|
|
35897
|
-
var _data$settings;
|
|
35898
|
-
// EXCLUDE the current organization
|
|
35899
|
-
if (org._id === organizationId) {
|
|
35900
|
-
return false;
|
|
35901
|
-
}
|
|
35902
|
-
var orgParentIds = org.parentOrganizations || [];
|
|
35903
|
-
|
|
35904
|
-
//if only shared with this organization, we only show the subtree of this organization for automatic publishing
|
|
35905
|
-
if (!isOwner) {
|
|
35906
|
-
// EXCLUDE parents of the current organization
|
|
35907
|
-
if (currentOrgParentIds.includes(org._id)) {
|
|
35908
|
-
return false;
|
|
35909
|
-
}
|
|
35910
|
-
// EXCLUDE siblings and their children
|
|
35911
|
-
var isChild = orgParentIds.includes(organizationId);
|
|
35912
|
-
var isOfSiblingBranch = !isChild && currentOrgParentIds.some(function (parentId) {
|
|
35913
|
-
return orgParentIds.includes(parentId);
|
|
35914
|
-
});
|
|
35915
|
-
if (isOfSiblingBranch) {
|
|
35916
|
-
return false;
|
|
35917
|
-
}
|
|
35918
|
-
}
|
|
35919
|
-
var hasAutomaticPublishingForPackage = ((_data$settings = data.settings) === null || _data$settings === void 0 || (_data$settings = _data$settings[org._id]) === null || _data$settings === void 0 ? void 0 : _data$settings.automaticPublishing) === true;
|
|
35920
|
-
var hasAccessToPackage = orgParentIds.includes(data.organizationId) || allowedOrgIds.includes(org._id) || allowedOrgIds.some(function (id) {
|
|
35921
|
-
return orgParentIds.includes(id);
|
|
35922
|
-
});
|
|
35923
|
-
var hasAutomaticPublishing = org.automaticPublishing === true;
|
|
35924
|
-
var hasAccessToPackageAndAutomaticPublishing = hasAccessToPackage && hasAutomaticPublishing;
|
|
35925
|
-
return hasAutomaticPublishingForPackage || hasAccessToPackageAndAutomaticPublishing;
|
|
35926
|
-
});
|
|
35927
|
-
setAvailableOrganizations(filtered);
|
|
35928
|
-
// Set all organizations as selected by default
|
|
35929
|
-
allOrgIds = filtered.map(function (org) {
|
|
35930
|
-
return org._id;
|
|
35931
|
-
});
|
|
35932
|
-
setSelectedOrganizationIds(allOrgIds);
|
|
35933
|
-
return _context.abrupt("return", filtered);
|
|
35934
|
-
case 22:
|
|
35935
|
-
_context.prev = 22;
|
|
35936
|
-
_context.t0 = _context["catch"](1);
|
|
35937
|
-
modalState.showErrorModal("Error fetching organizations: ".concat(_context.t0 instanceof Error ? _context.t0.message : String(_context.t0)));
|
|
35938
|
-
setAvailableOrganizations([]);
|
|
35939
|
-
return _context.abrupt("return", []);
|
|
35940
|
-
case 27:
|
|
35941
|
-
_context.prev = 27;
|
|
35942
|
-
setLoadingOrganizations(false);
|
|
35943
|
-
return _context.finish(27);
|
|
35944
|
-
case 30:
|
|
35945
|
-
case "end":
|
|
35946
|
-
return _context.stop();
|
|
35947
|
-
}
|
|
35948
|
-
}, _callee, null, [[1, 22, 27, 30]]);
|
|
35949
|
-
})), [apiConfig.authService, organizationId, root.dataStore.jwt, modalState, data.allowedOrganizationIds, data.settings]);
|
|
35950
|
-
var performPublish = React.useCallback(/*#__PURE__*/function () {
|
|
35951
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(publish) {
|
|
35952
|
-
var automaticPublishingOrgIds,
|
|
35953
|
-
response,
|
|
35954
|
-
url,
|
|
35955
|
-
_errorText,
|
|
35956
|
-
errorText,
|
|
35957
|
-
_json$error,
|
|
35958
|
-
json,
|
|
35959
|
-
_args2 = arguments;
|
|
35960
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
35961
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
35962
|
-
case 0:
|
|
35963
|
-
automaticPublishingOrgIds = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : [];
|
|
35964
|
-
isLoading(true);
|
|
35965
|
-
_context2.prev = 2;
|
|
35966
|
-
if (!publish) {
|
|
35967
|
-
_context2.next = 11;
|
|
35968
|
-
break;
|
|
35969
|
-
}
|
|
35970
|
-
url = apiConfig.enricherService + '/packages/${_id}/publish?organizationId=' + organizationId;
|
|
35971
|
-
if (automaticPublishingOrgIds.length > 0) {
|
|
35972
|
-
url += '&automaticPublishingOrganizationIds=' + automaticPublishingOrgIds.join(',');
|
|
35973
|
-
}
|
|
35974
|
-
_context2.next = 8;
|
|
35975
|
-
return context === null || context === void 0 ? void 0 : context.updateServerData(data, {
|
|
35976
|
-
update: url,
|
|
35977
|
-
usePut: true
|
|
35978
|
-
}, undefined, true);
|
|
35979
|
-
case 8:
|
|
35980
|
-
response = _context2.sent;
|
|
35981
|
-
_context2.next = 14;
|
|
35982
|
-
break;
|
|
35983
|
-
case 11:
|
|
35984
|
-
_context2.next = 13;
|
|
35985
|
-
return context === null || context === void 0 ? void 0 : context.updateServerData(data, {
|
|
35986
|
-
update: apiConfig.enricherService + '/packages/${_id}/unpublish?organizationId=' + organizationId,
|
|
35987
|
-
usePut: true
|
|
35988
|
-
}, undefined, true);
|
|
35989
|
-
case 13:
|
|
35990
|
-
response = _context2.sent;
|
|
35991
|
-
case 14:
|
|
35992
|
-
if (!(response.status == 202)) {
|
|
35993
|
-
_context2.next = 18;
|
|
35994
|
-
break;
|
|
35995
|
-
}
|
|
35996
|
-
modalState.showWarningModal(t("backoffice.idmEnricher.packages.label.warning.".concat(publish ? 'publishing' : 'unpublishing')));
|
|
35997
|
-
_context2.next = 35;
|
|
35998
|
-
break;
|
|
35999
|
-
case 18:
|
|
36000
|
-
if (!(response.status == 200)) {
|
|
36001
|
-
_context2.next = 22;
|
|
36002
|
-
break;
|
|
36003
|
-
}
|
|
36004
|
-
modalState.closeModal();
|
|
36005
|
-
_context2.next = 35;
|
|
36006
|
-
break;
|
|
36007
|
-
case 22:
|
|
36008
|
-
_context2.prev = 22;
|
|
36009
|
-
_context2.next = 25;
|
|
36010
|
-
return response.json();
|
|
36011
|
-
case 25:
|
|
36012
|
-
json = _context2.sent;
|
|
36013
|
-
errorText = (_json$error = json.error) !== null && _json$error !== void 0 ? _json$error : json.Error;
|
|
36014
|
-
_context2.next = 34;
|
|
36015
|
-
break;
|
|
36016
|
-
case 29:
|
|
36017
|
-
_context2.prev = 29;
|
|
36018
|
-
_context2.t0 = _context2["catch"](22);
|
|
36019
|
-
_context2.next = 33;
|
|
36020
|
-
return response.text();
|
|
36021
|
-
case 33:
|
|
36022
|
-
errorText = _context2.sent;
|
|
36023
|
-
case 34:
|
|
36024
|
-
throw new Error((_errorText = errorText) !== null && _errorText !== void 0 ? _errorText : "Server error (".concat(response.status, ")"));
|
|
36025
|
-
case 35:
|
|
36026
|
-
context === null || context === void 0 || context.reset({
|
|
36027
|
-
context: context,
|
|
36028
|
-
api: api
|
|
36029
|
-
});
|
|
36030
|
-
_context2.next = 41;
|
|
36031
|
-
break;
|
|
36032
|
-
case 38:
|
|
36033
|
-
_context2.prev = 38;
|
|
36034
|
-
_context2.t1 = _context2["catch"](2);
|
|
36035
|
-
modalState.showErrorModal("Error on ".concat(publish ? 'publish' : 'unpublish', ": ").concat(_context2.t1 instanceof Error ? _context2.t1.message : String(_context2.t1)));
|
|
36036
|
-
case 41:
|
|
36037
|
-
_context2.prev = 41;
|
|
36038
|
-
isLoading(false);
|
|
36039
|
-
return _context2.finish(41);
|
|
36040
|
-
case 44:
|
|
36041
|
-
case "end":
|
|
36042
|
-
return _context2.stop();
|
|
36043
|
-
}
|
|
36044
|
-
}, _callee2, null, [[2, 38, 41, 44], [22, 29]]);
|
|
36045
|
-
}));
|
|
36046
|
-
return function (_x) {
|
|
36047
|
-
return _ref3.apply(this, arguments);
|
|
36048
|
-
};
|
|
36049
|
-
}(), [data, context, api, apiConfig.enricherService, organizationId, modalState, t]);
|
|
36050
|
-
var handlePublishClick = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
36051
|
-
var organizations;
|
|
36052
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
36053
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
36054
|
-
case 0:
|
|
36055
|
-
// Reset selected organizations before fetching
|
|
36056
|
-
setSelectedOrganizationIds([]);
|
|
36057
|
-
// Fetch organizations with automaticPublishing enabled
|
|
36058
|
-
_context3.next = 3;
|
|
36059
|
-
return fetchOrganizationsWithAutomaticPublishing();
|
|
36060
|
-
case 3:
|
|
36061
|
-
organizations = _context3.sent;
|
|
36062
|
-
if (!(organizations.length > 0)) {
|
|
36063
|
-
_context3.next = 8;
|
|
36064
|
-
break;
|
|
36065
|
-
}
|
|
36066
|
-
setOrganizationModalVisible(true);
|
|
36067
|
-
_context3.next = 10;
|
|
36068
|
-
break;
|
|
36069
|
-
case 8:
|
|
36070
|
-
_context3.next = 10;
|
|
36071
|
-
return performPublish(true, []);
|
|
36072
|
-
case 10:
|
|
36073
|
-
case "end":
|
|
36074
|
-
return _context3.stop();
|
|
36075
|
-
}
|
|
36076
|
-
}, _callee3);
|
|
36077
|
-
})), [fetchOrganizationsWithAutomaticPublishing, performPublish]);
|
|
36078
|
-
var handleConfirmPublish = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
36079
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
36080
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
36081
|
-
case 0:
|
|
36082
|
-
setOrganizationModalVisible(false);
|
|
36083
|
-
_context4.next = 3;
|
|
36084
|
-
return performPublish(true, selectedOrganizationIds);
|
|
36085
|
-
case 3:
|
|
36086
|
-
case "end":
|
|
36087
|
-
return _context4.stop();
|
|
36088
|
-
}
|
|
36089
|
-
}, _callee4);
|
|
36090
|
-
})), [selectedOrganizationIds, performPublish]);
|
|
36091
|
-
var _onChange = /*#__PURE__*/function () {
|
|
36092
|
-
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(publish) {
|
|
36093
|
-
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
36094
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
36095
|
-
case 0:
|
|
36096
|
-
if (!publish) {
|
|
36097
|
-
_context5.next = 5;
|
|
36098
|
-
break;
|
|
36099
|
-
}
|
|
36100
|
-
_context5.next = 3;
|
|
36101
|
-
return handlePublishClick();
|
|
36102
|
-
case 3:
|
|
36103
|
-
_context5.next = 7;
|
|
36104
|
-
break;
|
|
36105
|
-
case 5:
|
|
36106
|
-
_context5.next = 7;
|
|
36107
|
-
return performPublish(false);
|
|
36108
|
-
case 7:
|
|
36109
|
-
case "end":
|
|
36110
|
-
return _context5.stop();
|
|
36111
|
-
}
|
|
36112
|
-
}, _callee5);
|
|
36113
|
-
}));
|
|
36114
|
-
return function onChange(_x2) {
|
|
36115
|
-
return _ref6.apply(this, arguments);
|
|
36116
|
-
};
|
|
36117
|
-
}();
|
|
36118
|
-
if (data.__isEmpty) return '';
|
|
36572
|
+
var isPublishing = publishing.isPublishing,
|
|
36573
|
+
isPublished = publishing.isPublished,
|
|
36574
|
+
isReleaseWithdrawn = publishing.isReleaseWithdrawn,
|
|
36575
|
+
unpublishedChanges = publishing.unpublishedChanges,
|
|
36576
|
+
disabled = publishing.disabled,
|
|
36577
|
+
_onChange = publishing.onChange;
|
|
36119
36578
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
36120
36579
|
children: [/*#__PURE__*/jsxs(Space$1, {
|
|
36121
36580
|
size: "middle",
|
|
36581
|
+
align: "center",
|
|
36122
36582
|
children: [/*#__PURE__*/jsx(Tooltip, {
|
|
36123
36583
|
title: disabled ? '' : !!isPublished ? t('backoffice.idmEnricher.packages.label.unpublish') : t('backoffice.idmEnricher.packages.label.publish'),
|
|
36124
36584
|
children: /*#__PURE__*/jsx(Checkbox$2, {
|
|
@@ -36132,6 +36592,7 @@ function PublishCustomCell (_ref) {
|
|
|
36132
36592
|
}), isPublishing && /*#__PURE__*/jsx(Tooltip, {
|
|
36133
36593
|
title: t('backoffice.idmEnricher.packages.label.currentlyPublishing'),
|
|
36134
36594
|
children: /*#__PURE__*/jsx(Button$1, {
|
|
36595
|
+
size: buttonSize,
|
|
36135
36596
|
shape: "circle",
|
|
36136
36597
|
icon: /*#__PURE__*/jsx(SyncOutlined, {
|
|
36137
36598
|
spin: true
|
|
@@ -36140,6 +36601,7 @@ function PublishCustomCell (_ref) {
|
|
|
36140
36601
|
}), unpublishedChanges && !isPublishing && /*#__PURE__*/jsx(Tooltip, {
|
|
36141
36602
|
title: t('backoffice.idmEnricher.packages.label.unpublishedChanges'),
|
|
36142
36603
|
children: /*#__PURE__*/jsx(Button$1, {
|
|
36604
|
+
size: buttonSize,
|
|
36143
36605
|
shape: "circle",
|
|
36144
36606
|
icon: /*#__PURE__*/jsx(ReloadOutlined, {}),
|
|
36145
36607
|
onClick: function onClick() {
|
|
@@ -36149,76 +36611,42 @@ function PublishCustomCell (_ref) {
|
|
|
36149
36611
|
}), isReleaseWithdrawn && !isPublishing && /*#__PURE__*/jsx(Tooltip, {
|
|
36150
36612
|
title: t('backoffice.idmEnricher.packages.label.releaseWithdrawn'),
|
|
36151
36613
|
children: /*#__PURE__*/jsx(Button$1, {
|
|
36614
|
+
size: buttonSize,
|
|
36152
36615
|
shape: "circle",
|
|
36153
36616
|
icon: /*#__PURE__*/jsx(WarningOutlined, {})
|
|
36154
36617
|
})
|
|
36155
36618
|
})]
|
|
36156
|
-
}), /*#__PURE__*/
|
|
36157
|
-
|
|
36158
|
-
open: organizationModalVisible,
|
|
36159
|
-
onOk: handleConfirmPublish,
|
|
36160
|
-
onCancel: function onCancel() {
|
|
36161
|
-
return setOrganizationModalVisible(false);
|
|
36162
|
-
},
|
|
36163
|
-
okText: t('backoffice.idmEnricher.packages.label.publish'),
|
|
36164
|
-
cancelText: t('backoffice.idmEnricher.packages.label.cancel'),
|
|
36165
|
-
confirmLoading: loading,
|
|
36166
|
-
children: [/*#__PURE__*/jsx("div", {
|
|
36167
|
-
style: {
|
|
36168
|
-
marginBottom: 16
|
|
36169
|
-
},
|
|
36170
|
-
children: t('backoffice.idmEnricher.packages.label.selectAutomaticPublishingOrganizationsDescription')
|
|
36171
|
-
}), loadingOrganizations ? /*#__PURE__*/jsx("div", {
|
|
36172
|
-
style: {
|
|
36173
|
-
textAlign: 'center',
|
|
36174
|
-
padding: '20px'
|
|
36175
|
-
},
|
|
36176
|
-
children: t('backoffice.idmEnricher.packages.label.loading')
|
|
36177
|
-
}) : availableOrganizations.length === 0 ? /*#__PURE__*/jsx("div", {
|
|
36178
|
-
style: {
|
|
36179
|
-
textAlign: 'center',
|
|
36180
|
-
padding: '20px'
|
|
36181
|
-
},
|
|
36182
|
-
children: t('backoffice.idmEnricher.packages.label.noOrganizationsFound')
|
|
36183
|
-
}) : /*#__PURE__*/jsx("div", {
|
|
36184
|
-
style: {
|
|
36185
|
-
maxHeight: '400px',
|
|
36186
|
-
overflowY: 'auto'
|
|
36187
|
-
},
|
|
36188
|
-
children: /*#__PURE__*/jsx(Space$1, {
|
|
36189
|
-
direction: "vertical",
|
|
36190
|
-
style: {
|
|
36191
|
-
width: '100%'
|
|
36192
|
-
},
|
|
36193
|
-
children: availableOrganizations.map(function (org) {
|
|
36194
|
-
return /*#__PURE__*/jsx(Checkbox$2, {
|
|
36195
|
-
checked: selectedOrganizationIds.includes(org._id),
|
|
36196
|
-
onChange: function onChange(e) {
|
|
36197
|
-
if (e.target.checked) {
|
|
36198
|
-
setSelectedOrganizationIds([].concat(_toConsumableArray(selectedOrganizationIds), [org._id]));
|
|
36199
|
-
} else {
|
|
36200
|
-
setSelectedOrganizationIds(selectedOrganizationIds.filter(function (id) {
|
|
36201
|
-
return id !== org._id;
|
|
36202
|
-
}));
|
|
36203
|
-
}
|
|
36204
|
-
},
|
|
36205
|
-
children: org.displayName
|
|
36206
|
-
}, org._id);
|
|
36207
|
-
})
|
|
36208
|
-
})
|
|
36209
|
-
})]
|
|
36619
|
+
}), /*#__PURE__*/jsx(AutomaticPublishingOrganizationsModal, {
|
|
36620
|
+
publishing: publishing
|
|
36210
36621
|
})]
|
|
36211
36622
|
});
|
|
36212
36623
|
}
|
|
36213
|
-
|
|
36214
|
-
|
|
36215
|
-
var
|
|
36216
|
-
|
|
36217
|
-
|
|
36218
|
-
|
|
36624
|
+
|
|
36625
|
+
function PublishCustomCell (_ref) {
|
|
36626
|
+
var data = _ref.data,
|
|
36627
|
+
apiConfig = _ref.apiConfig,
|
|
36628
|
+
context = _ref.context,
|
|
36629
|
+
api = _ref.api,
|
|
36630
|
+
modalState = _ref.modalState,
|
|
36631
|
+
organizationId = _ref.organizationId;
|
|
36632
|
+
//the list only shows an inline spinner while publishing, so no blocking modal here (unlike the standalone publish button)
|
|
36633
|
+
var publishing = usePackagePublishing({
|
|
36634
|
+
packageId: data._id,
|
|
36635
|
+
data: data,
|
|
36636
|
+
organizationId: organizationId,
|
|
36637
|
+
apiConfig: apiConfig,
|
|
36638
|
+
modalState: modalState,
|
|
36639
|
+
onPublished: function onPublished() {
|
|
36640
|
+
return context === null || context === void 0 ? void 0 : context.reset({
|
|
36641
|
+
context: context,
|
|
36642
|
+
api: api
|
|
36643
|
+
});
|
|
36219
36644
|
}
|
|
36220
|
-
}
|
|
36221
|
-
return
|
|
36645
|
+
});
|
|
36646
|
+
if (data.__isEmpty) return '';
|
|
36647
|
+
return /*#__PURE__*/jsx(PackagePublishControls, {
|
|
36648
|
+
publishing: publishing
|
|
36649
|
+
});
|
|
36222
36650
|
}
|
|
36223
36651
|
|
|
36224
36652
|
/**
|
|
@@ -36840,110 +37268,6 @@ var getItemTypeKeyInfo = function getItemTypeKeyInfo(t) {
|
|
|
36840
37268
|
}];
|
|
36841
37269
|
};
|
|
36842
37270
|
|
|
36843
|
-
/**
|
|
36844
|
-
* Custom hook for managing loading, error, and warning modals
|
|
36845
|
-
*
|
|
36846
|
-
* @returns Object containing modal management functions and context holder
|
|
36847
|
-
* @returns {Function} showLoadingModal - Function to show a loading modal
|
|
36848
|
-
* @returns {Function} showErrorModal - Function to show an error modal
|
|
36849
|
-
* @returns {Function} showWarningModal - Function to show a warning modal
|
|
36850
|
-
* @returns {Function} closeModal - Function to close the current modal
|
|
36851
|
-
* @returns {React.ReactElement} contextHolder - Context holder element
|
|
36852
|
-
*/
|
|
36853
|
-
var useLoadingModal = function useLoadingModal() {
|
|
36854
|
-
var _Modal$useModal = Modal$3.useModal(),
|
|
36855
|
-
_Modal$useModal2 = _slicedToArray(_Modal$useModal, 2),
|
|
36856
|
-
modal = _Modal$useModal2[0],
|
|
36857
|
-
contextHolder = _Modal$useModal2[1];
|
|
36858
|
-
var _useState = useState(null),
|
|
36859
|
-
_useState2 = _slicedToArray(_useState, 2);
|
|
36860
|
-
_useState2[0];
|
|
36861
|
-
var setInstance = _useState2[1];
|
|
36862
|
-
var showLoadingModal = useCallback(function (text) {
|
|
36863
|
-
var newInstance = modal.info({
|
|
36864
|
-
content: /*#__PURE__*/jsx(Fragment, {
|
|
36865
|
-
children: /*#__PURE__*/jsx(Flex, {
|
|
36866
|
-
gap: "middle",
|
|
36867
|
-
vertical: true,
|
|
36868
|
-
children: /*#__PURE__*/jsx(Flex, {
|
|
36869
|
-
gap: "middle",
|
|
36870
|
-
children: /*#__PURE__*/jsx(Spin$1, {
|
|
36871
|
-
tip: text,
|
|
36872
|
-
size: "large",
|
|
36873
|
-
children: /*#__PURE__*/jsx("div", {
|
|
36874
|
-
style: {
|
|
36875
|
-
padding: 50,
|
|
36876
|
-
borderRadius: 4
|
|
36877
|
-
}
|
|
36878
|
-
})
|
|
36879
|
-
})
|
|
36880
|
-
})
|
|
36881
|
-
})
|
|
36882
|
-
}),
|
|
36883
|
-
icon: null,
|
|
36884
|
-
maskClosable: false,
|
|
36885
|
-
okButtonProps: {
|
|
36886
|
-
style: {
|
|
36887
|
-
display: 'none'
|
|
36888
|
-
}
|
|
36889
|
-
},
|
|
36890
|
-
closable: false,
|
|
36891
|
-
centered: true
|
|
36892
|
-
});
|
|
36893
|
-
setInstance(function (old) {
|
|
36894
|
-
old === null || old === void 0 || old.destroy();
|
|
36895
|
-
return newInstance;
|
|
36896
|
-
});
|
|
36897
|
-
}, []);
|
|
36898
|
-
var showErrorModal = useCallback(function (error) {
|
|
36899
|
-
var newInstance = modal.error({
|
|
36900
|
-
content: error,
|
|
36901
|
-
okButtonProps: {
|
|
36902
|
-
style: {
|
|
36903
|
-
display: 'none'
|
|
36904
|
-
}
|
|
36905
|
-
},
|
|
36906
|
-
centered: true,
|
|
36907
|
-
closable: true,
|
|
36908
|
-
maskClosable: true
|
|
36909
|
-
});
|
|
36910
|
-
setInstance(function (old) {
|
|
36911
|
-
old === null || old === void 0 || old.destroy();
|
|
36912
|
-
return newInstance;
|
|
36913
|
-
});
|
|
36914
|
-
}, []);
|
|
36915
|
-
var showWarningModal = useCallback(function (warning) {
|
|
36916
|
-
var newInstance = modal.warning({
|
|
36917
|
-
content: warning,
|
|
36918
|
-
okButtonProps: {
|
|
36919
|
-
style: {
|
|
36920
|
-
display: 'none'
|
|
36921
|
-
}
|
|
36922
|
-
},
|
|
36923
|
-
centered: true,
|
|
36924
|
-
closable: true,
|
|
36925
|
-
maskClosable: true
|
|
36926
|
-
});
|
|
36927
|
-
setInstance(function (old) {
|
|
36928
|
-
old === null || old === void 0 || old.destroy();
|
|
36929
|
-
return newInstance;
|
|
36930
|
-
});
|
|
36931
|
-
}, []);
|
|
36932
|
-
var closeModal = useCallback(function () {
|
|
36933
|
-
setInstance(function (old) {
|
|
36934
|
-
old === null || old === void 0 || old.destroy();
|
|
36935
|
-
return null;
|
|
36936
|
-
});
|
|
36937
|
-
}, []);
|
|
36938
|
-
return {
|
|
36939
|
-
contextHolder: contextHolder,
|
|
36940
|
-
showLoadingModal: showLoadingModal,
|
|
36941
|
-
showErrorModal: showErrorModal,
|
|
36942
|
-
showWarningModal: showWarningModal,
|
|
36943
|
-
closeModal: closeModal
|
|
36944
|
-
};
|
|
36945
|
-
};
|
|
36946
|
-
|
|
36947
37271
|
/**
|
|
36948
37272
|
* Hook that provides a dialog to let the user choose the catalog download version (4.0 or 4.1).
|
|
36949
37273
|
*/
|
|
@@ -37497,7 +37821,8 @@ var TableProperties = observer(function () {
|
|
|
37497
37821
|
selectedSerie = _useModule.selectedSerie,
|
|
37498
37822
|
setSelectedSerie = _useModule.setSelectedSerie,
|
|
37499
37823
|
setSelectedItem = _useModule.setSelectedItem,
|
|
37500
|
-
selectedItem = _useModule.selectedItem
|
|
37824
|
+
selectedItem = _useModule.selectedItem,
|
|
37825
|
+
notifyPackageDataChanged = _useModule.notifyPackageDataChanged;
|
|
37501
37826
|
useTools({
|
|
37502
37827
|
mainInformationWindowCodex: 'IDM_ENRICHER_PROPERTIES_TABLE_INFO',
|
|
37503
37828
|
enricherPackage: selectedPackage,
|
|
@@ -37673,6 +37998,13 @@ var TableProperties = observer(function () {
|
|
|
37673
37998
|
}]
|
|
37674
37999
|
};
|
|
37675
38000
|
}, [apiInterface, t, selectedPackage === null || selectedPackage === void 0 ? void 0 : selectedPackage.isoLanguageIds, viewOnly]);
|
|
38001
|
+
var hooks = useMemo(function () {
|
|
38002
|
+
return {
|
|
38003
|
+
onDataUpdated: function onDataUpdated() {
|
|
38004
|
+
return notifyPackageDataChanged();
|
|
38005
|
+
}
|
|
38006
|
+
};
|
|
38007
|
+
}, [notifyPackageDataChanged]);
|
|
37676
38008
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
37677
38009
|
children: [/*#__PURE__*/jsx(Descriptions$1, {
|
|
37678
38010
|
title: /*#__PURE__*/jsxs("div", {
|
|
@@ -37692,7 +38024,8 @@ var TableProperties = observer(function () {
|
|
|
37692
38024
|
}), selectedPackage && /*#__PURE__*/jsx(Spreadsheet, {
|
|
37693
38025
|
gridId: 'crud-grid_properties',
|
|
37694
38026
|
applicationData: applicationData,
|
|
37695
|
-
configuration: configuration
|
|
38027
|
+
configuration: configuration,
|
|
38028
|
+
hooks: hooks
|
|
37696
38029
|
})]
|
|
37697
38030
|
});
|
|
37698
38031
|
});
|
|
@@ -37997,23 +38330,23 @@ var getConfig$6 = function getConfig(isoLanguageIds, t, viewOnly) {
|
|
|
37997
38330
|
editable: !viewOnly
|
|
37998
38331
|
}, {
|
|
37999
38332
|
headerName: 'backoffice.idmEnricher.renaming.label.translated.manufacturename',
|
|
38000
|
-
field: '
|
|
38333
|
+
field: 'translatedManufacturerName1',
|
|
38001
38334
|
cellDataType: 'withPlaceholder',
|
|
38002
38335
|
customParams: {
|
|
38003
|
-
placeHolderField: '
|
|
38004
|
-
combinedField: '
|
|
38336
|
+
placeHolderField: 'origManufacturerName1',
|
|
38337
|
+
combinedField: 'manufacturerName1'
|
|
38005
38338
|
},
|
|
38006
|
-
additionalFields: ['
|
|
38339
|
+
additionalFields: ['origManufacturerName1', 'manufacturerName1'],
|
|
38007
38340
|
editable: !viewOnly
|
|
38008
38341
|
}, {
|
|
38009
38342
|
headerName: 'backoffice.idmEnricher.renaming.label.translated.manufacturename2',
|
|
38010
|
-
field: '
|
|
38343
|
+
field: 'translatedManufacturerName2',
|
|
38011
38344
|
cellDataType: 'withPlaceholder',
|
|
38012
38345
|
customParams: {
|
|
38013
|
-
placeHolderField: '
|
|
38014
|
-
combinedField: '
|
|
38346
|
+
placeHolderField: 'origManufacturerName2',
|
|
38347
|
+
combinedField: 'manufacturerName2'
|
|
38015
38348
|
},
|
|
38016
|
-
additionalFields: ['
|
|
38349
|
+
additionalFields: ['origManufacturerName2', 'manufacturerName2'],
|
|
38017
38350
|
editable: !viewOnly
|
|
38018
38351
|
}, {
|
|
38019
38352
|
headerName: 'backoffice.idmEnricher.renaming.label.translated.email',
|
|
@@ -38369,7 +38702,8 @@ var RenamingTable = observer(function (_ref) {
|
|
|
38369
38702
|
setSelectedItem = _useModule.setSelectedItem,
|
|
38370
38703
|
selectedSerie = _useModule.selectedSerie,
|
|
38371
38704
|
setSelectedSerie = _useModule.setSelectedSerie,
|
|
38372
|
-
viewOnly = _useModule.viewOnly
|
|
38705
|
+
viewOnly = _useModule.viewOnly,
|
|
38706
|
+
notifyPackageDataChanged = _useModule.notifyPackageDataChanged;
|
|
38373
38707
|
useTools({
|
|
38374
38708
|
enricherPackage: selectedPackage,
|
|
38375
38709
|
isApi2: selectedPackage === null || selectedPackage === void 0 ? void 0 : selectedPackage.isApi,
|
|
@@ -38411,9 +38745,10 @@ var RenamingTable = observer(function (_ref) {
|
|
|
38411
38745
|
});
|
|
38412
38746
|
break;
|
|
38413
38747
|
}
|
|
38748
|
+
notifyPackageDataChanged();
|
|
38414
38749
|
}
|
|
38415
38750
|
};
|
|
38416
|
-
}, [type]);
|
|
38751
|
+
}, [type, notifyPackageDataChanged]);
|
|
38417
38752
|
var prevPreFilter = useRef();
|
|
38418
38753
|
var preFilter = useMemo(function () {
|
|
38419
38754
|
if (type === 'items' && selectedSerie) {
|
|
@@ -38971,7 +39306,8 @@ var ExclusivityTable = observer(function (_ref) {
|
|
|
38971
39306
|
setSelectedSerie = _useModule.setSelectedSerie,
|
|
38972
39307
|
setSelectedItem = _useModule.setSelectedItem,
|
|
38973
39308
|
selectedItem = _useModule.selectedItem,
|
|
38974
|
-
viewOnly = _useModule.viewOnly
|
|
39309
|
+
viewOnly = _useModule.viewOnly,
|
|
39310
|
+
notifyPackageDataChanged = _useModule.notifyPackageDataChanged;
|
|
38975
39311
|
var _useTools = useTools({
|
|
38976
39312
|
enricherPackage: selectedPackage,
|
|
38977
39313
|
isApi2: selectedPackage === null || selectedPackage === void 0 ? void 0 : selectedPackage.isApi,
|
|
@@ -39016,9 +39352,10 @@ var ExclusivityTable = observer(function (_ref) {
|
|
|
39016
39352
|
});
|
|
39017
39353
|
break;
|
|
39018
39354
|
}
|
|
39355
|
+
notifyPackageDataChanged();
|
|
39019
39356
|
}
|
|
39020
39357
|
};
|
|
39021
|
-
}, [updateConfigurator, type, onEvent]);
|
|
39358
|
+
}, [updateConfigurator, type, onEvent, notifyPackageDataChanged]);
|
|
39022
39359
|
var apiInterface = useMemo(function () {
|
|
39023
39360
|
var patchId = '${_id}';
|
|
39024
39361
|
if (type === 'eitems') patchId = '${typeNo}';
|
|
@@ -39124,7 +39461,8 @@ var TableTabGroups = observer(function () {
|
|
|
39124
39461
|
selectedSerie = _useModule.selectedSerie,
|
|
39125
39462
|
setSelectedSerie = _useModule.setSelectedSerie,
|
|
39126
39463
|
setSelectedItem = _useModule.setSelectedItem,
|
|
39127
|
-
selectedItem = _useModule.selectedItem
|
|
39464
|
+
selectedItem = _useModule.selectedItem,
|
|
39465
|
+
notifyPackageDataChanged = _useModule.notifyPackageDataChanged;
|
|
39128
39466
|
useTools({
|
|
39129
39467
|
mainInformationWindowCodex: 'IDM_ENRICHER_TAB_GROUPS_TABLE_INFO',
|
|
39130
39468
|
enricherPackage: selectedPackage,
|
|
@@ -39209,6 +39547,13 @@ var TableTabGroups = observer(function () {
|
|
|
39209
39547
|
}]
|
|
39210
39548
|
};
|
|
39211
39549
|
}, [apiInterface, selectedPackage === null || selectedPackage === void 0 ? void 0 : selectedPackage.isoLanguageIds, viewOnly]);
|
|
39550
|
+
var hooks = useMemo(function () {
|
|
39551
|
+
return {
|
|
39552
|
+
onDataUpdated: function onDataUpdated() {
|
|
39553
|
+
return notifyPackageDataChanged();
|
|
39554
|
+
}
|
|
39555
|
+
};
|
|
39556
|
+
}, [notifyPackageDataChanged]);
|
|
39212
39557
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
39213
39558
|
children: [/*#__PURE__*/jsx(Descriptions$1, {
|
|
39214
39559
|
title: /*#__PURE__*/jsxs("div", {
|
|
@@ -39228,7 +39573,8 @@ var TableTabGroups = observer(function () {
|
|
|
39228
39573
|
}), selectedPackage && /*#__PURE__*/jsx(Spreadsheet, {
|
|
39229
39574
|
gridId: 'crud-grid_tabgroups',
|
|
39230
39575
|
applicationData: applicationData,
|
|
39231
|
-
configuration: configuration
|
|
39576
|
+
configuration: configuration,
|
|
39577
|
+
hooks: hooks
|
|
39232
39578
|
})]
|
|
39233
39579
|
});
|
|
39234
39580
|
});
|
|
@@ -39245,7 +39591,8 @@ var TablePartlistPos = observer(function () {
|
|
|
39245
39591
|
selectedSerie = _useModule.selectedSerie,
|
|
39246
39592
|
setSelectedSerie = _useModule.setSelectedSerie,
|
|
39247
39593
|
setSelectedItem = _useModule.setSelectedItem,
|
|
39248
|
-
selectedItem = _useModule.selectedItem
|
|
39594
|
+
selectedItem = _useModule.selectedItem,
|
|
39595
|
+
notifyPackageDataChanged = _useModule.notifyPackageDataChanged;
|
|
39249
39596
|
useTools({
|
|
39250
39597
|
enricherPackage: selectedPackage,
|
|
39251
39598
|
isApi2: selectedPackage === null || selectedPackage === void 0 ? void 0 : selectedPackage.isApi,
|
|
@@ -39405,6 +39752,13 @@ var TablePartlistPos = observer(function () {
|
|
|
39405
39752
|
}]
|
|
39406
39753
|
};
|
|
39407
39754
|
}, [apiInterface, posInvisibility, viewOnly]);
|
|
39755
|
+
var hooks = useMemo(function () {
|
|
39756
|
+
return {
|
|
39757
|
+
onDataUpdated: function onDataUpdated() {
|
|
39758
|
+
return notifyPackageDataChanged();
|
|
39759
|
+
}
|
|
39760
|
+
};
|
|
39761
|
+
}, [notifyPackageDataChanged]);
|
|
39408
39762
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
39409
39763
|
children: [/*#__PURE__*/jsx(Descriptions$1, {
|
|
39410
39764
|
title: /*#__PURE__*/jsxs("div", {
|
|
@@ -39420,7 +39774,8 @@ var TablePartlistPos = observer(function () {
|
|
|
39420
39774
|
}), selectedPackage && /*#__PURE__*/jsx(Spreadsheet, {
|
|
39421
39775
|
gridId: 'crud-grid_epartlistpos',
|
|
39422
39776
|
applicationData: applicationData,
|
|
39423
|
-
configuration: configuration
|
|
39777
|
+
configuration: configuration,
|
|
39778
|
+
hooks: hooks
|
|
39424
39779
|
})]
|
|
39425
39780
|
});
|
|
39426
39781
|
});
|
|
@@ -40718,7 +41073,8 @@ var TablePriceList = observer(function () {
|
|
|
40718
41073
|
selectedSerie = _useModule.selectedSerie,
|
|
40719
41074
|
setSelectedSerie = _useModule.setSelectedSerie,
|
|
40720
41075
|
setSelectedItem = _useModule.setSelectedItem,
|
|
40721
|
-
selectedItem = _useModule.selectedItem
|
|
41076
|
+
selectedItem = _useModule.selectedItem,
|
|
41077
|
+
notifyPackageDataChanged = _useModule.notifyPackageDataChanged;
|
|
40722
41078
|
var _React$useState = React.useState(),
|
|
40723
41079
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
40724
41080
|
selectedPriceList = _React$useState2[0],
|
|
@@ -40803,9 +41159,10 @@ var TablePriceList = observer(function () {
|
|
|
40803
41159
|
} else {
|
|
40804
41160
|
setSelectedPriceList(undefined);
|
|
40805
41161
|
}
|
|
41162
|
+
notifyPackageDataChanged();
|
|
40806
41163
|
}
|
|
40807
41164
|
};
|
|
40808
|
-
}, [selectedNodeId]);
|
|
41165
|
+
}, [selectedNodeId, notifyPackageDataChanged]);
|
|
40809
41166
|
var roundingOptions = useMemo(function () {
|
|
40810
41167
|
return [{
|
|
40811
41168
|
name: t('backoffice.idmEnricher.pricelists.rounding.r1'),
|
|
@@ -41731,10 +42088,10 @@ function ErrorDisplay(_ref) {
|
|
|
41731
42088
|
return fieldErrors.map(function (fieldError, idx) {
|
|
41732
42089
|
return /*#__PURE__*/jsxs("div", {
|
|
41733
42090
|
className: errorItem,
|
|
41734
|
-
children: [/*#__PURE__*/jsx(Tag, {
|
|
42091
|
+
children: [/*#__PURE__*/jsx(Tag$1, {
|
|
41735
42092
|
color: "blue",
|
|
41736
42093
|
children: operationType
|
|
41737
|
-
}), /*#__PURE__*/jsx(Tag, {
|
|
42094
|
+
}), /*#__PURE__*/jsx(Tag$1, {
|
|
41738
42095
|
color: "orange",
|
|
41739
42096
|
children: t('backoffice.uploadModal.row', {
|
|
41740
42097
|
rowNumber: fieldError.index + 1
|
|
@@ -52702,9 +53059,9 @@ function InstancesBadge(_ref) {
|
|
|
52702
53059
|
function StatusTag(_ref2) {
|
|
52703
53060
|
var label = _ref2.label,
|
|
52704
53061
|
status = _ref2.status;
|
|
52705
|
-
var icon = status === 'ok' ? /*#__PURE__*/jsx(CheckCircleOutlined, {}) : status === 'failed' ? /*#__PURE__*/jsx(CloseCircleOutlined, {}) : /*#__PURE__*/jsx(MinusCircleOutlined, {});
|
|
53062
|
+
var icon = status === 'ok' ? /*#__PURE__*/jsx(CheckCircleOutlined$1, {}) : status === 'failed' ? /*#__PURE__*/jsx(CloseCircleOutlined, {}) : /*#__PURE__*/jsx(MinusCircleOutlined, {});
|
|
52706
53063
|
var color = status === 'ok' ? 'success' : status === 'failed' ? 'error' : 'default';
|
|
52707
|
-
return /*#__PURE__*/jsx(Tag, {
|
|
53064
|
+
return /*#__PURE__*/jsx(Tag$1, {
|
|
52708
53065
|
icon: icon,
|
|
52709
53066
|
color: color,
|
|
52710
53067
|
children: label
|
|
@@ -52789,7 +53146,7 @@ function PingCard(_ref) {
|
|
|
52789
53146
|
style: {
|
|
52790
53147
|
fontSize: 12
|
|
52791
53148
|
},
|
|
52792
|
-
children: [/*#__PURE__*/jsx(CheckCircleOutlined, {}), " ", t('backoffice.maintenance.reachable')]
|
|
53149
|
+
children: [/*#__PURE__*/jsx(CheckCircleOutlined$1, {}), " ", t('backoffice.maintenance.reachable')]
|
|
52793
53150
|
}) : /*#__PURE__*/jsxs(Text$4, {
|
|
52794
53151
|
type: "danger",
|
|
52795
53152
|
style: {
|
|
@@ -52854,7 +53211,7 @@ function PingCard(_ref) {
|
|
|
52854
53211
|
style: {
|
|
52855
53212
|
fontSize: 11
|
|
52856
53213
|
},
|
|
52857
|
-
children: [/*#__PURE__*/jsx(CheckCircleOutlined, {}), " ", t('backoffice.maintenance.reachable')]
|
|
53214
|
+
children: [/*#__PURE__*/jsx(CheckCircleOutlined$1, {}), " ", t('backoffice.maintenance.reachable')]
|
|
52858
53215
|
}) : /*#__PURE__*/jsx(Text$4, {
|
|
52859
53216
|
type: "danger",
|
|
52860
53217
|
style: {
|
|
@@ -53021,7 +53378,7 @@ function StatsRow(_ref2) {
|
|
|
53021
53378
|
color: token.colorError,
|
|
53022
53379
|
marginRight: 4
|
|
53023
53380
|
}
|
|
53024
|
-
}) : /*#__PURE__*/jsx(CheckCircleOutlined, {
|
|
53381
|
+
}) : /*#__PURE__*/jsx(CheckCircleOutlined$1, {
|
|
53025
53382
|
style: {
|
|
53026
53383
|
color: token.colorSuccess,
|
|
53027
53384
|
marginRight: 4
|
|
@@ -53145,7 +53502,7 @@ function RefreshRow(_ref4) {
|
|
|
53145
53502
|
},
|
|
53146
53503
|
children: result ? /*#__PURE__*/jsx(RefreshResultTags, {
|
|
53147
53504
|
result: result
|
|
53148
|
-
}) : /*#__PURE__*/jsx(Tag, {
|
|
53505
|
+
}) : /*#__PURE__*/jsx(Tag$1, {
|
|
53149
53506
|
icon: /*#__PURE__*/jsx(CloseCircleOutlined, {}),
|
|
53150
53507
|
color: "error",
|
|
53151
53508
|
children: t('backoffice.maintenance.unreachable')
|
|
@@ -53207,7 +53564,7 @@ function RefreshRow(_ref4) {
|
|
|
53207
53564
|
display: 'block'
|
|
53208
53565
|
},
|
|
53209
53566
|
children: name
|
|
53210
|
-
}), result === null ? /*#__PURE__*/jsx(Tag, {
|
|
53567
|
+
}), result === null ? /*#__PURE__*/jsx(Tag$1, {
|
|
53211
53568
|
icon: /*#__PURE__*/jsx(CloseCircleOutlined, {}),
|
|
53212
53569
|
color: "error",
|
|
53213
53570
|
children: t('backoffice.maintenance.unreachable')
|