@docsvision/management-console 6.2.0-beta.3 → 6.2.0-beta.5

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/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import React__default, { useState, useEffect, createElement, useRef, useMemo, useContext, memo, isValidElement, cloneElement, Children, createContext, useCallback, useDebugValue, useLayoutEffect, forwardRef as forwardRef$1, Fragment as Fragment$1, Component, useReducer } from "react";
3
3
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
4
- import { Accordion as Accordion$1, AccordionSummary, AccordionDetails, Typography as Typography$3, Button as Button$3, Box, CircularProgress as CircularProgress$3, Tooltip as Tooltip$2, Breadcrumbs, IconButton as IconButton$3, Popover as Popover$4, SvgIcon as SvgIcon$3, TableCell as TableCell$2, Grid as Grid$1, Paper as Paper$3, Chip as Chip$1, MenuItem as MenuItem$2, List as List$4, ListItemButton, ListItemIcon as ListItemIcon$1, ListItemText as ListItemText$1, ListItem as ListItem$1, Input as Input$3, TextField as TextField$3, FormControlLabel as FormControlLabel$1, Checkbox as Checkbox$1, RadioGroup, Radio, createTheme as createTheme$3, TableContainer, Table as Table$1, TableHead, TableRow as TableRow$1, TableBody as TableBody$1, capitalize as capitalize$2, ThemeProvider as ThemeProvider$1, InputAdornment as InputAdornment$3, Dialog as Dialog$2, DialogTitle, DialogContent as DialogContent$2, DialogActions as DialogActions$2 } from "@mui/material";
4
+ import { Accordion as Accordion$1, AccordionSummary, AccordionDetails, Typography as Typography$3, Button as Button$3, Box, CircularProgress as CircularProgress$3, Tooltip as Tooltip$2, Breadcrumbs, IconButton as IconButton$3, Popover as Popover$4, SvgIcon as SvgIcon$3, TableCell as TableCell$2, Grid as Grid$1, Paper as Paper$3, Chip as Chip$1, MenuItem as MenuItem$2, List as List$4, ListItemButton, ListItemIcon as ListItemIcon$1, ListItemText as ListItemText$1, ListItem as ListItem$1, Input as Input$3, TextField as TextField$3, FormControlLabel as FormControlLabel$1, Checkbox as Checkbox$1, RadioGroup, Radio, createTheme as createTheme$3, TableContainer, Table as Table$1, TableHead, TableRow as TableRow$1, TableBody as TableBody$1, capitalize as capitalize$2, ThemeProvider as ThemeProvider$1, InputAdornment as InputAdornment$3, Dialog as Dialog$2, DialogTitle, DialogContent as DialogContent$2, DialogActions as DialogActions$2, FormControl as FormControl$3, Select as Select$3, LinearProgress as LinearProgress$1 } from "@mui/material";
5
5
  import * as ReactDOM from "react-dom";
6
6
  import ReactDOM__default, { flushSync } from "react-dom";
7
7
  import { unstable_createGetCssVar, createSpacing as createSpacing$2, useTheme as useTheme$4, GlobalStyles as GlobalStyles$1, unstable_memoTheme, keyframes, css as css$2, styled as styled$1, alpha as alpha$2, lighten as lighten$2, darken as darken$2, decomposeColor as decomposeColor$2, recomposeColor as recomposeColor$2, getThemeProps as getThemeProps$2 } from "@mui/system";
@@ -45,7 +45,7 @@ const useOutsideClick = (ref2, callback) => {
45
45
  };
46
46
  });
47
47
  };
48
- function ExpandMoreIcon(props) {
48
+ function ExpandMoreIcon$1(props) {
49
49
  const { onClick, color: color2 = "#757575" } = props;
50
50
  return /* @__PURE__ */ jsx("div", { className: "expand-more-icon", "data-testid": "expand-more-icon", onClick, children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: color2, children: /* @__PURE__ */ jsx("path", { d: "M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z" }) }) });
51
51
  }
@@ -55,7 +55,7 @@ function Accordion(props) {
55
55
  /* @__PURE__ */ jsx(
56
56
  AccordionSummary,
57
57
  {
58
- expandIcon: /* @__PURE__ */ jsx(ExpandMoreIcon, {}),
58
+ expandIcon: /* @__PURE__ */ jsx(ExpandMoreIcon$1, {}),
59
59
  "aria-controls": ariaControls,
60
60
  id,
61
61
  children: summary()
@@ -52786,7 +52786,7 @@ function ClearButton(props) {
52786
52786
  function DeleteIcon$1({ onClick }) {
52787
52787
  return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", version: "1.1", width: "24", height: "24", viewBox: "0 0 24 24", onClick, children: /* @__PURE__ */ jsx("path", { d: "M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z", fill: "#607d8b" }) });
52788
52788
  }
52789
- function ErrorIcon() {
52789
+ function ErrorIcon$1() {
52790
52790
  return /* @__PURE__ */ jsx("svg", { width: "24px", height: "24px", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("g", { "data-name": "Layer 2", children: /* @__PURE__ */ jsxs("g", { "data-name": "close", children: [
52791
52791
  /* @__PURE__ */ jsx("rect", { width: "24", height: "24", transform: "rotate(180 12 12)", opacity: "0" }),
52792
52792
  /* @__PURE__ */ jsx("path", { d: "M13.41 12l4.3-4.29a1 1 0 1 0-1.42-1.42L12 10.59l-4.29-4.3a1 1 0 0 0-1.42 1.42l4.3 4.29-4.3 4.29a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l4.29-4.3 4.29 4.3a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42z" })
@@ -52794,7 +52794,7 @@ function ErrorIcon() {
52794
52794
  }
52795
52795
  function ErrorBlock({ text, close }) {
52796
52796
  return /* @__PURE__ */ jsxs("div", { className: "error-block", children: [
52797
- /* @__PURE__ */ jsx("div", { className: "error-block__button_close", onClick: close, children: /* @__PURE__ */ jsx(ErrorIcon, {}) }),
52797
+ /* @__PURE__ */ jsx("div", { className: "error-block__button_close", onClick: close, children: /* @__PURE__ */ jsx(ErrorIcon$1, {}) }),
52798
52798
  /* @__PURE__ */ jsx("p", { className: "error-block__text", children: text })
52799
52799
  ] });
52800
52800
  }
@@ -59027,12 +59027,30 @@ function CellWithTwoLineClamping(props) {
59027
59027
  };
59028
59028
  return /* @__PURE__ */ jsx(Cell, { className, style: { maxWidth: maxWidth2 }, align: props.align || "left", onClick, children: /* @__PURE__ */ jsx(LightTooltip, { title: content, placement: "top-start", disableHoverListener: !showTooltip, children: /* @__PURE__ */ jsx("div", { ref: contentRef, className: "mui-table__cell-clamp-two-line", children: content }) }) });
59029
59029
  }
59030
+ const CheckIcon$1 = createSvgIcon(/* @__PURE__ */ jsx("path", {
59031
+ d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"
59032
+ }));
59030
59033
  const Clear = createSvgIcon(/* @__PURE__ */ jsx("path", {
59031
59034
  d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
59032
59035
  }));
59036
+ const Close = createSvgIcon(/* @__PURE__ */ jsx("path", {
59037
+ d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
59038
+ }));
59039
+ const ComputerRounded = createSvgIcon(/* @__PURE__ */ jsx("path", {
59040
+ d: "M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H1c-.55 0-1 .45-1 1s.45 1 1 1h22c.55 0 1-.45 1-1s-.45-1-1-1zM5 6h14c.55 0 1 .45 1 1v8c0 .55-.45 1-1 1H5c-.55 0-1-.45-1-1V7c0-.55.45-1 1-1"
59041
+ }));
59033
59042
  const DeleteIcon = createSvgIcon(/* @__PURE__ */ jsx("path", {
59034
59043
  d: "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z"
59035
59044
  }));
59045
+ const ErrorIcon = createSvgIcon(/* @__PURE__ */ jsx("path", {
59046
+ d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"
59047
+ }));
59048
+ const ExpandMoreIcon = createSvgIcon(/* @__PURE__ */ jsx("path", {
59049
+ d: "M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"
59050
+ }));
59051
+ const ForwardIcon = createSvgIcon(/* @__PURE__ */ jsx("path", {
59052
+ d: "M12 8V4l8 8-8 8v-4H4V8z"
59053
+ }));
59036
59054
  const GroupIcon = createSvgIcon(/* @__PURE__ */ jsx("path", {
59037
59055
  d: "M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5s-3 1.34-3 3 1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5 5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5m8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5"
59038
59056
  }));
@@ -59184,7 +59202,8 @@ function ListItem(props) {
59184
59202
  return /* @__PURE__ */ jsx(ListItem$1, { secondaryAction: /* @__PURE__ */ jsx(DeleteIconButton, { onClick: deleteItem }), children: /* @__PURE__ */ jsx(ListItemText$1, { primary: renderContent() }) });
59185
59203
  }
59186
59204
  function ListPanel(props) {
59187
- const { items, setItems, disabled, validate: validate2, className, errorMessage, services } = props;
59205
+ const services = useContext(ServicesContext);
59206
+ const { items, setItems, disabled, validate: validate2, className, errorMessage } = props;
59188
59207
  const [value, setValue] = useState("");
59189
59208
  const addItem = async () => {
59190
59209
  const isValid2 = await validate2?.(value) ?? true;
@@ -82231,10 +82250,36 @@ function List$1(props) {
82231
82250
  defaultValue: value
82232
82251
  });
82233
82252
  return /* @__PURE__ */ jsxs(EditorContainer, { isChanged: isDirty, resetValue: () => resetField(fieldName, { defaultValue: value }), ...props, children: [
82234
- /* @__PURE__ */ jsx(ListPanel, { className: "list__list-panel", items: field.value, setItems: field.onChange, services }),
82253
+ /* @__PURE__ */ jsx(ListPanel, { className: "list__list-panel", items: field.value, setItems: field.onChange }),
82235
82254
  error && /* @__PURE__ */ jsx(ErrorMessage, { message: services.resources.Dialog_ValidationRequired })
82236
82255
  ] });
82237
82256
  }
82257
+ function UserGroups(props) {
82258
+ const { required, id: fieldName, value } = props;
82259
+ const { control, resetField } = useCustomFormContext();
82260
+ const [selectedGroup, setSelectedGroup] = useState(value ? Object.keys(value)[0] : null);
82261
+ const {
82262
+ field,
82263
+ fieldState: { isDirty }
82264
+ } = useController({
82265
+ name: fieldName,
82266
+ control,
82267
+ rules: { required },
82268
+ defaultValue: value
82269
+ });
82270
+ return /* @__PURE__ */ jsx(EditorContainer, { isChanged: isDirty, resetValue: () => resetField(fieldName, { defaultValue: value }), ...props, children: field.value && /* @__PURE__ */ jsxs("div", { className: "user-groups", children: [
82271
+ /* @__PURE__ */ jsx(GroupPanel, { groups: field.value, selectedGroup, selectGroup: setSelectedGroup }),
82272
+ /* @__PURE__ */ jsx(ForwardIcon, { fontSize: "large", className: "user-groups__forward-icon" }),
82273
+ /* @__PURE__ */ jsx(
82274
+ ListPanel,
82275
+ {
82276
+ items: field.value[selectedGroup],
82277
+ setItems: (items) => field.onChange({ ...field.value, [selectedGroup]: items })
82278
+ },
82279
+ selectedGroup
82280
+ )
82281
+ ] }) });
82282
+ }
82238
82283
  const commonMuiProps = {
82239
82284
  select: {
82240
82285
  displayEmpty: true,
@@ -82527,6 +82572,724 @@ function LdapCatalogs(props) {
82527
82572
  /* @__PURE__ */ jsx("div", { className: "ldap-catalogs__button-panel", children: /* @__PURE__ */ jsx(Button$3, { variant: "contained", size: "small", color: "secondary", onClick: (e2) => goToLdapCatalogPage(e2, "", resources.NewCatalog), children: resources.NewCatalog }) })
82528
82573
  ] });
82529
82574
  }
82575
+ const DATE_FORMAT = "LL";
82576
+ const CREATION_DATE_STRING_KEY = "creationDate";
82577
+ const EXPIRATION_DATE_STRING_KEY = "expirationDate";
82578
+ const EMPTY_OPTION_VALUE = "—";
82579
+ function LicenseOptions(props) {
82580
+ const { features, activationResultText, creationDate, customerName, name, serialNumber, expirationDate } = props.value ?? {};
82581
+ const gridValues = { name, customerName, creationDate, expirationDate, serialNumber };
82582
+ const services = useContext(ServicesContext);
82583
+ if (!props.value) {
82584
+ return /* @__PURE__ */ jsx(EditorContainer, { isChanged: false, resetValue: () => {
82585
+ }, ...props, children: /* @__PURE__ */ jsx("p", { className: "license-options__text", children: services.resources.NoLicenseKeyInformation }) });
82586
+ }
82587
+ const featuresList = Object.values(features);
82588
+ const getOptionDisplayValue = (key, value) => {
82589
+ switch (key) {
82590
+ case CREATION_DATE_STRING_KEY:
82591
+ return formatDateToString(new Date(value), DATE_FORMAT);
82592
+ case EXPIRATION_DATE_STRING_KEY:
82593
+ return value ? formatDateToString(new Date(value), DATE_FORMAT) : EMPTY_OPTION_VALUE;
82594
+ default:
82595
+ return value;
82596
+ }
82597
+ };
82598
+ return /* @__PURE__ */ jsxs(EditorContainer, { isChanged: false, resetValue: () => {
82599
+ }, ...props, children: [
82600
+ /* @__PURE__ */ jsx("div", { className: "license-options__grid", children: Object.entries(gridValues).map(([key, value]) => /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
82601
+ /* @__PURE__ */ jsxs("p", { className: "license-options__text", children: [
82602
+ services.resources[capitalize$2(key)],
82603
+ ":"
82604
+ ] }),
82605
+ /* @__PURE__ */ jsx("p", { className: "license-options__text", children: getOptionDisplayValue(key, value) })
82606
+ ] }, key)) }),
82607
+ /* @__PURE__ */ jsx("p", { className: "license-options__text license-options__text_bold", children: activationResultText }),
82608
+ !!featuresList.length && /* @__PURE__ */ jsxs("div", { className: "license-options__additional", children: [
82609
+ /* @__PURE__ */ jsxs("p", { className: "license-options__text", children: [
82610
+ services.resources.AdditionalOptions,
82611
+ ":"
82612
+ ] }),
82613
+ /* @__PURE__ */ jsx("ul", { className: "license-options__options", children: featuresList.map((feature) => /* @__PURE__ */ jsxs("li", { className: "license-options__option", children: [
82614
+ /* @__PURE__ */ jsx("p", { className: "license-options__text", children: feature.name }),
82615
+ feature.restriction?.allowedConnections && /* @__PURE__ */ jsxs("p", { className: "license-options__text license-options__text_shifted", children: [
82616
+ services.resources.MaximumNumberOfConnections,
82617
+ ": ",
82618
+ feature.restriction.allowedConnections
82619
+ ] })
82620
+ ] }, feature.id)) })
82621
+ ] })
82622
+ ] });
82623
+ }
82624
+ const VALIDATION_REGEXP = /\S+?\\\S+/gm;
82625
+ function PersonalLicenses(props) {
82626
+ const { required, id: fieldName, value } = props;
82627
+ const { resources } = useContext(ServicesContext);
82628
+ const { resetField, control } = useCustomFormContext();
82629
+ const [error, setError] = React__default.useState("");
82630
+ const {
82631
+ field,
82632
+ fieldState: { isDirty }
82633
+ } = useController({
82634
+ name: fieldName,
82635
+ control,
82636
+ rules: { required },
82637
+ defaultValue: value
82638
+ });
82639
+ function handleReset() {
82640
+ resetField(fieldName, { defaultValue: value });
82641
+ }
82642
+ function handleChange(users) {
82643
+ field.onChange({ ...field.value, users });
82644
+ }
82645
+ async function validate2(username) {
82646
+ if (!username.match(VALIDATION_REGEXP)) {
82647
+ setError(resources.AccountNameFormatError);
82648
+ return false;
82649
+ }
82650
+ if (field.value.users.some((user) => user === username)) {
82651
+ setError(resources.UniqueUsernameError);
82652
+ return false;
82653
+ }
82654
+ setError("");
82655
+ return true;
82656
+ }
82657
+ const isDisabled = field.value.users?.length >= field.value.maxCount;
82658
+ if (!props.value.users) {
82659
+ return /* @__PURE__ */ jsx(EditorContainer, { isChanged: false, resetValue: () => {
82660
+ }, ...props, children: /* @__PURE__ */ jsx("p", { className: "personal-licenses__text", children: resources.NoPersonalLicensesInformation }) });
82661
+ }
82662
+ return /* @__PURE__ */ jsxs(EditorContainer, { resetValue: handleReset, isChanged: isDirty, ...props, children: [
82663
+ /* @__PURE__ */ jsx(
82664
+ ListPanel,
82665
+ {
82666
+ className: "personal-licenses__container",
82667
+ items: field.value.users,
82668
+ setItems: handleChange,
82669
+ validate: validate2,
82670
+ disabled: isDisabled,
82671
+ errorMessage: error
82672
+ }
82673
+ ),
82674
+ /* @__PURE__ */ jsx("p", { className: "personal-licenses__footer", children: formatString$1(resources.PersonalLicensesCount, field.value.users.length, field.value.maxCount) })
82675
+ ] });
82676
+ }
82677
+ var IDatabaseMasterState = /* @__PURE__ */ ((IDatabaseMasterState2) => {
82678
+ IDatabaseMasterState2[IDatabaseMasterState2["Preparing"] = 0] = "Preparing";
82679
+ IDatabaseMasterState2[IDatabaseMasterState2["DatabaseInProcess"] = 1] = "DatabaseInProcess";
82680
+ IDatabaseMasterState2[IDatabaseMasterState2["DatabaseProcessFinished"] = 2] = "DatabaseProcessFinished";
82681
+ IDatabaseMasterState2[IDatabaseMasterState2["SolutionInProcess"] = 3] = "SolutionInProcess";
82682
+ IDatabaseMasterState2[IDatabaseMasterState2["SolutionProcessFinished"] = 4] = "SolutionProcessFinished";
82683
+ return IDatabaseMasterState2;
82684
+ })(IDatabaseMasterState || {});
82685
+ var ServerType = /* @__PURE__ */ ((ServerType2) => {
82686
+ ServerType2[ServerType2["PostgreSQL"] = 0] = "PostgreSQL";
82687
+ ServerType2[ServerType2["MS SQL SERVER"] = 1] = "MS SQL SERVER";
82688
+ return ServerType2;
82689
+ })(ServerType || {});
82690
+ var TableLocationType = /* @__PURE__ */ ((TableLocationType2) => {
82691
+ TableLocationType2[TableLocationType2["UseDefaultOrCurrent"] = 0] = "UseDefaultOrCurrent";
82692
+ TableLocationType2[TableLocationType2["UseOwnDatabase"] = 1] = "UseOwnDatabase";
82693
+ TableLocationType2[TableLocationType2["UseOuterDatabase"] = 2] = "UseOuterDatabase";
82694
+ TableLocationType2[TableLocationType2["UseTemporaryDatabase"] = 3] = "UseTemporaryDatabase";
82695
+ return TableLocationType2;
82696
+ })(TableLocationType || {});
82697
+ var TableLocationTypeExtended = /* @__PURE__ */ ((TableLocationTypeExtended2) => {
82698
+ TableLocationTypeExtended2[TableLocationTypeExtended2["UseDefaultOrCurrent"] = 0] = "UseDefaultOrCurrent";
82699
+ TableLocationTypeExtended2[TableLocationTypeExtended2["UseOwnDatabase"] = 1] = "UseOwnDatabase";
82700
+ TableLocationTypeExtended2[TableLocationTypeExtended2["UseOuterDatabase"] = 2] = "UseOuterDatabase";
82701
+ TableLocationTypeExtended2[TableLocationTypeExtended2["UseTemporaryDatabase"] = 3] = "UseTemporaryDatabase";
82702
+ TableLocationTypeExtended2[TableLocationTypeExtended2["InMemoryTableOwnDatabase"] = 4] = "InMemoryTableOwnDatabase";
82703
+ TableLocationTypeExtended2[TableLocationTypeExtended2["InMemoryTableOwnDatabaseNotPersistData"] = 5] = "InMemoryTableOwnDatabaseNotPersistData";
82704
+ return TableLocationTypeExtended2;
82705
+ })(TableLocationTypeExtended || {});
82706
+ var DatabaseWizardMode = /* @__PURE__ */ ((DatabaseWizardMode2) => {
82707
+ DatabaseWizardMode2[DatabaseWizardMode2["Create"] = 0] = "Create";
82708
+ DatabaseWizardMode2[DatabaseWizardMode2["Add"] = 1] = "Add";
82709
+ DatabaseWizardMode2[DatabaseWizardMode2["Update"] = 2] = "Update";
82710
+ return DatabaseWizardMode2;
82711
+ })(DatabaseWizardMode || {});
82712
+ class DatabaseSettingsPanelLogic extends ComponentLogic {
82713
+ constructor() {
82714
+ super(...arguments);
82715
+ this.domain = y("DatabaseSettingsPanelLogic");
82716
+ this.componentDidMount = this.domain.event("componentDidMount");
82717
+ this.loadDatabases = this.domain.event("loadDatabases");
82718
+ this.loadDatabasesFx = this.domain.effect("loadDatabasesFx");
82719
+ this.getDatabasesInfoFx = this.domain.effect("getDatabasesInfoFx");
82720
+ this.setDefaultDatabase = this.domain.event("setDefaultDatabase");
82721
+ this.deleteDatabase = this.domain.event("deleteDatabase");
82722
+ this.confirmDeleting = this.domain.event("confirmDeleting");
82723
+ this.confirmPageSaving = this.domain.event("confirmDeleting");
82724
+ this.confirmDeletingFx = this.domain.effect("confirmDeletingFx");
82725
+ this.confirmPageSavingFx = this.domain.effect("confirmPageSavingFx");
82726
+ this.openCreateWizard = this.domain.event("openCreateWizard");
82727
+ this.openUpdateWizard = this.domain.event("openUpdateWizard");
82728
+ this.openConnectWizard = this.domain.event("openConnectWizard");
82729
+ this.openCreateWizardFx = this.domain.effect("openCreateWizardFx");
82730
+ this.openUpdateWizardFx = this.domain.effect("openUpdateWizardFx");
82731
+ this.openConnectWizardFx = this.domain.effect("openConnectWizardFx");
82732
+ }
82733
+ initStores() {
82734
+ this.$loaded = this.domain.createStore(false, { name: "$loaded" });
82735
+ const serviceId = location.href.match(new RegExp(new RegExp("(?<=\\/)\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}(?=\\/)"), "g"))?.[0] || null;
82736
+ this.$serviceId = this.domain.createStore(serviceId, { name: "$serviceId" });
82737
+ }
82738
+ initDataLoading() {
82739
+ if (!this.options) {
82740
+ return;
82741
+ }
82742
+ this.getDatabasesInfoFx.use(async () => {
82743
+ return await this.options.services.databasesController.info(this.$serviceId.getState());
82744
+ });
82745
+ this.loadDatabasesFx.use(async () => {
82746
+ return await this.options.services.databasesConfigurationController.all(this.$serviceId.getState());
82747
+ });
82748
+ this.confirmDeletingFx.use(async (alias) => {
82749
+ await this.options.services.messageWindow.showConfirmation(
82750
+ this.options.services.resources.DeleteDatabaseConfirmation
82751
+ );
82752
+ return alias;
82753
+ });
82754
+ this.confirmPageSavingFx.use(async ({ mode, pageWasChanged, data }) => {
82755
+ if (pageWasChanged) {
82756
+ await this.options.services.messageWindow.showConfirmation(
82757
+ this.options.services.resources.SavePageForDatabaseConfirmation
82758
+ );
82759
+ await this.options.services.formControl.onSubmit({ confirm: false });
82760
+ if (this.options.services.formControl.isDirty) return;
82761
+ }
82762
+ switch (mode) {
82763
+ case DatabaseWizardMode.Create:
82764
+ this.openCreateWizard();
82765
+ break;
82766
+ case DatabaseWizardMode.Update:
82767
+ this.openUpdateWizard(data.alias);
82768
+ break;
82769
+ case DatabaseWizardMode.Add:
82770
+ this.openConnectWizard();
82771
+ break;
82772
+ }
82773
+ });
82774
+ const infoLoaded = b([this.getDatabasesInfoFx.doneData, this.loadDatabasesFx.doneData]);
82775
+ const infoLoadingFail = b([this.getDatabasesInfoFx.failData, this.loadDatabasesFx.failData]);
82776
+ const initialLoading = [this.getDatabasesInfoFx];
82777
+ ct({ from: this.componentDidMount, to: initialLoading });
82778
+ ct({ from: this.loadDatabases, to: this.loadDatabasesFx });
82779
+ ct({ from: this.loadDatabasesFx.doneData, to: initialLoading });
82780
+ ct({ from: this.deleteDatabase, to: this.confirmDeletingFx });
82781
+ ct({ from: this.confirmPageSaving, to: this.confirmPageSavingFx });
82782
+ v({
82783
+ clock: infoLoaded,
82784
+ fn: (info) => this.options.resetField(this.options.id, { defaultValue: combineInfo(info) })
82785
+ });
82786
+ v({
82787
+ clock: infoLoadingFail,
82788
+ fn: (error) => console.log(error)
82789
+ });
82790
+ v({
82791
+ clock: this.loadDatabases,
82792
+ fn: () => false,
82793
+ target: this.$loaded
82794
+ });
82795
+ v({
82796
+ clock: this.getDatabasesInfoFx.doneData,
82797
+ fn: () => true,
82798
+ target: this.$loaded
82799
+ });
82800
+ v({
82801
+ clock: this.confirmDeletingFx.doneData,
82802
+ fn: (alias) => this.options.field.onChange(deleteDatabase(alias))
82803
+ });
82804
+ v({
82805
+ clock: this.setDefaultDatabase,
82806
+ fn: (defaultAlias) => this.options.field.onChange(setDefault(defaultAlias))
82807
+ });
82808
+ const deleteDatabase = (alias) => this.options.field.value.map(
82809
+ (base) => base.alias === alias ? { ...base, deleted: true } : base
82810
+ );
82811
+ const setDefault = (defaultAlias) => this.options.field.value.map((base) => ({ ...base, isDefault: defaultAlias === base.alias }));
82812
+ const combineInfo = (info) => info.reduce((databases, baseInfo) => {
82813
+ const base = databases.find(
82814
+ (base2) => base2.alias?.toLowerCase() === baseInfo.databaseAlias?.toLowerCase() || base2.alias?.toLowerCase() === baseInfo.alias?.toLowerCase()
82815
+ );
82816
+ if (base) {
82817
+ databases = databases.map(
82818
+ (storeDatabase) => storeDatabase.alias === base.alias ? { ...storeDatabase, ...baseInfo } : storeDatabase
82819
+ );
82820
+ } else {
82821
+ databases.push(baseInfo);
82822
+ }
82823
+ return databases;
82824
+ }, this.options.field.value);
82825
+ }
82826
+ initWizard() {
82827
+ ct({ from: this.openCreateWizard, to: this.openCreateWizardFx });
82828
+ ct({ from: this.openConnectWizard, to: this.openConnectWizardFx });
82829
+ ct({ from: this.openUpdateWizard, to: this.openUpdateWizardFx });
82830
+ this.openCreateWizardFx.use(async () => {
82831
+ await this.options.services.databaseWizardService.openCreateMode(
82832
+ this.$serviceId.getState(),
82833
+ this.loadDatabases
82834
+ );
82835
+ });
82836
+ this.openConnectWizardFx.use(async () => {
82837
+ await this.options.services.databaseWizardService.openConnectMode(
82838
+ this.$serviceId.getState(),
82839
+ this.loadDatabases
82840
+ );
82841
+ });
82842
+ this.openUpdateWizardFx.use(async (alias) => {
82843
+ await this.options.services.databaseWizardService.openUpdateMode(
82844
+ this.$serviceId.getState(),
82845
+ alias
82846
+ );
82847
+ });
82848
+ }
82849
+ init() {
82850
+ this.initStores();
82851
+ this.initDataLoading();
82852
+ this.initWizard();
82853
+ }
82854
+ }
82855
+ function Databases(props) {
82856
+ return /* @__PURE__ */ jsx(Fragment, { children: props.children });
82857
+ }
82858
+ var DatabaseState = /* @__PURE__ */ ((DatabaseState2) => {
82859
+ DatabaseState2[DatabaseState2["Attached"] = 0] = "Attached";
82860
+ DatabaseState2[DatabaseState2["Updating"] = 1] = "Updating";
82861
+ DatabaseState2[DatabaseState2["Creating"] = 2] = "Creating";
82862
+ DatabaseState2[DatabaseState2["Attaching"] = 3] = "Attaching";
82863
+ return DatabaseState2;
82864
+ })(DatabaseState || {});
82865
+ var DatabaseStatusIndicator = /* @__PURE__ */ ((DatabaseStatusIndicator2) => {
82866
+ DatabaseStatusIndicator2[DatabaseStatusIndicator2["Available"] = 0] = "Available";
82867
+ DatabaseStatusIndicator2[DatabaseStatusIndicator2["NotAvailable"] = 1] = "NotAvailable";
82868
+ DatabaseStatusIndicator2[DatabaseStatusIndicator2["Creating"] = 2] = "Creating";
82869
+ DatabaseStatusIndicator2[DatabaseStatusIndicator2["Updating"] = 3] = "Updating";
82870
+ DatabaseStatusIndicator2[DatabaseStatusIndicator2["Attaching"] = 4] = "Attaching";
82871
+ return DatabaseStatusIndicator2;
82872
+ })(DatabaseStatusIndicator || {});
82873
+ var DatabaseType = /* @__PURE__ */ ((DatabaseType2) => {
82874
+ DatabaseType2[DatabaseType2["Postgre"] = 0] = "Postgre";
82875
+ DatabaseType2[DatabaseType2["SQL"] = 1] = "SQL";
82876
+ return DatabaseType2;
82877
+ })(DatabaseType || {});
82878
+ function DatabaseOutlineIcon(props) {
82879
+ const { size = 20, color: color2 = "hsl(205, 67%, 55%)" } = props;
82880
+ return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { stroke: color2, fill: color2, d: "M20 13.09V7C20 4.79 16.42 3 12 3S4 4.79 4 7V17C4 19.21 7.59 21 12 21C12.46 21 12.9 21 13.33 20.94C13.12 20.33 13 19.68 13 19L13 18.95C12.68 19 12.35 19 12 19C8.13 19 6 17.5 6 17V14.77C7.61 15.55 9.72 16 12 16C12.65 16 13.27 15.96 13.88 15.89C14.93 14.16 16.83 13 19 13C19.34 13 19.67 13.04 20 13.09M18 12.45C16.7 13.4 14.42 14 12 14S7.3 13.4 6 12.45V9.64C7.47 10.47 9.61 11 12 11S16.53 10.47 18 9.64V12.45M12 9C8.13 9 6 7.5 6 7S8.13 5 12 5 18 6.5 18 7 15.87 9 12 9M20.41 19L22.54 21.12L21.12 22.54L19 20.41L16.88 22.54L15.47 21.12L17.59 19L15.47 16.88L16.88 15.47L19 17.59L21.12 15.47L22.54 16.88L20.41 19" }) });
82881
+ }
82882
+ var ProcessState = /* @__PURE__ */ ((ProcessState2) => {
82883
+ ProcessState2[ProcessState2["Running"] = 0] = "Running";
82884
+ ProcessState2[ProcessState2["Finished"] = 1] = "Finished";
82885
+ ProcessState2[ProcessState2["Error"] = 2] = "Error";
82886
+ ProcessState2[ProcessState2["Canceled"] = 3] = "Canceled";
82887
+ return ProcessState2;
82888
+ })(ProcessState || {});
82889
+ var ConnectionStatus = /* @__PURE__ */ ((ConnectionStatus2) => {
82890
+ ConnectionStatus2[ConnectionStatus2["Unknown"] = -1] = "Unknown";
82891
+ ConnectionStatus2[ConnectionStatus2["Succesfull"] = 0] = "Succesfull";
82892
+ ConnectionStatus2[ConnectionStatus2["DatabaseNotExist"] = 1] = "DatabaseNotExist";
82893
+ ConnectionStatus2[ConnectionStatus2["ServerNotExist"] = 2] = "ServerNotExist";
82894
+ ConnectionStatus2[ConnectionStatus2["LoginFailed"] = 3] = "LoginFailed";
82895
+ ConnectionStatus2[ConnectionStatus2["AuthNotSupported"] = 4] = "AuthNotSupported";
82896
+ ConnectionStatus2[ConnectionStatus2["AliasAlreadyExists"] = 100] = "AliasAlreadyExists";
82897
+ ConnectionStatus2[ConnectionStatus2["DatabaseAlreadyExists"] = 101] = "DatabaseAlreadyExists";
82898
+ return ConnectionStatus2;
82899
+ })(ConnectionStatus || {});
82900
+ function DatabaseUpdateIcon(props) {
82901
+ const { size = 20, color: color2 = "hsl(205, 67%, 55%)" } = props;
82902
+ return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { stroke: color2, fill: color2, d: "M12,18A6,6 0 0,1 6,12C6,11 6.25,10.03 6.7,9.2L5.24,7.74C4.46,8.97 4,10.43 4,12A8,8 0 0,0 12,20V23L16,19L12,15M12,4V1L8,5L12,9V6A6,6 0 0,1 18,12C18,13 17.75,13.97 17.3,14.8L18.76,16.26C19.54,15.03 20,13.57 20,12A8,8 0 0,0 12,4Z" }) });
82903
+ }
82904
+ function CheckIcon(props) {
82905
+ const { size = 20, color: color2 = "hsl(205, 67%, 55%)", onClick } = props;
82906
+ return /* @__PURE__ */ jsx("svg", { onClick, xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { stroke: color2, fill: color2, d: "M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z" }) });
82907
+ }
82908
+ function DatabaseDefaultButton(props) {
82909
+ const { isDefault, buttonText, tooltip, onClick, alias, disabled } = props;
82910
+ if (isDefault) {
82911
+ return /* @__PURE__ */ jsx("div", { style: { margin: "0 auto", display: "block", width: "min-content" }, children: /* @__PURE__ */ jsx(CheckIcon, {}) });
82912
+ } else {
82913
+ return /* @__PURE__ */ jsx(LightTooltip, { title: disabled ? "" : tooltip, placement: "top", disableFocusListener: true, disableTouchListener: true, children: /* @__PURE__ */ jsx(Button$3, { className: "databases-table-cell-button", color: "primary", disabled, onClick: (e2) => onClick(e2, alias), children: buttonText }) });
82914
+ }
82915
+ }
82916
+ const TEXT_BUTTON_DISABLED_COLOR = "rgba(0, 0, 0, 0.26)";
82917
+ function DatabaseTableButton(props) {
82918
+ const { icon: Icon2, buttonText, tooltip, onClick, alias, disabled } = props;
82919
+ const getIconColor = (disabled2) => {
82920
+ if (disabled2) {
82921
+ return TEXT_BUTTON_DISABLED_COLOR;
82922
+ } else return;
82923
+ };
82924
+ const wrapWithTooltip = (node, tooltip2) => {
82925
+ return tooltip2 ? /* @__PURE__ */ jsx(LightTooltip, { title: tooltip2, placement: "top", disableFocusListener: true, disableTouchListener: true, children: node }) : node;
82926
+ };
82927
+ return wrapWithTooltip(
82928
+ /* @__PURE__ */ jsx(
82929
+ Button$3,
82930
+ {
82931
+ className: "databases-table-cell-button",
82932
+ color: "primary",
82933
+ disabled,
82934
+ startIcon: /* @__PURE__ */ jsx(Icon2, { color: getIconColor(disabled) }),
82935
+ onClick,
82936
+ children: buttonText
82937
+ }
82938
+ ),
82939
+ disabled ? "" : tooltip
82940
+ );
82941
+ }
82942
+ function DatabaseStatusPoint(props) {
82943
+ const { value, resources } = props;
82944
+ const status = getStatus(value, resources);
82945
+ return /* @__PURE__ */ jsx(LightTooltip, { title: status.tooltip, placement: "top", disableFocusListener: true, disableTouchListener: true, children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
82946
+ StatusPoint,
82947
+ {
82948
+ className: `settings-panel__status-point_small settings-panel__status-point_no_margin ${status.className}`,
82949
+ overlay: false,
82950
+ active: value === DatabaseStatusIndicator.Available
82951
+ }
82952
+ ) }) });
82953
+ }
82954
+ function getStatus(statusType, resources) {
82955
+ let tooltip, className;
82956
+ switch (Number(statusType)) {
82957
+ case DatabaseStatusIndicator.Available:
82958
+ tooltip = resources.DatabaseStatusAvailable;
82959
+ className = "available";
82960
+ break;
82961
+ case DatabaseStatusIndicator.NotAvailable:
82962
+ tooltip = resources.DatabaseStatusNotAvailable;
82963
+ className = "not-available";
82964
+ break;
82965
+ case DatabaseStatusIndicator.Creating:
82966
+ tooltip = resources.DatabaseStatusCreating;
82967
+ className = "progress";
82968
+ break;
82969
+ case DatabaseStatusIndicator.Updating:
82970
+ tooltip = resources.DatabaseStatusUpdating;
82971
+ className = "progress";
82972
+ break;
82973
+ case DatabaseStatusIndicator.Attaching:
82974
+ tooltip = resources.DatabaseStatusAttaching;
82975
+ className = "progress";
82976
+ break;
82977
+ }
82978
+ return { tooltip, className };
82979
+ }
82980
+ const IS_DEFAULT_COLUMN_ID = "isDefault";
82981
+ const UPDATE_DATABASE_COLUMN_ID = "update";
82982
+ const DISCONNECT_DATABASE_COLUMN_ID = "disconnect";
82983
+ const STATUS_COLUMN_ID = "status";
82984
+ const BASE_VERSION_COLUMN_ID = "baseVersion";
82985
+ const ALIAS_COLUMN_ID = "alias";
82986
+ const SERVER_NAME_COLUMN_ID = "serverName";
82987
+ const DATABASE_TYPE_COLUMN_ID = "databaseType";
82988
+ const UPDATE_DATE_COLUMN_ID = "updateDate";
82989
+ const FULL_TEXT_SEARCH_ENABLED_COLUMN_ID = "fullTextSearchEnabled";
82990
+ const DATABASE_PAGE_NAVIGATE_COLUMN_ID = "databasePageNavigateArrow";
82991
+ const CENTER_ALIGN_COLUMN_IDS = [
82992
+ IS_DEFAULT_COLUMN_ID,
82993
+ DISCONNECT_DATABASE_COLUMN_ID
82994
+ ];
82995
+ const REDIRECT_CLICK_HANDLER_COLUMN_IDS = [
82996
+ BASE_VERSION_COLUMN_ID,
82997
+ ALIAS_COLUMN_ID,
82998
+ SERVER_NAME_COLUMN_ID,
82999
+ DATABASE_TYPE_COLUMN_ID,
83000
+ FULL_TEXT_SEARCH_ENABLED_COLUMN_ID,
83001
+ DATABASE_PAGE_NAVIGATE_COLUMN_ID,
83002
+ UPDATE_DATE_COLUMN_ID
83003
+ ];
83004
+ async function goToDatabasePage(alias, dataBaseType, services, parameters) {
83005
+ const layoutId = dataBaseType === DatabaseType.Postgre ? parameters?.pgsqlLayoutId : parameters?.mssqlLayoutId;
83006
+ if (!layoutId) return;
83007
+ services.settingsNavigation.goToItemSettingsPage(layoutId, alias, alias);
83008
+ }
83009
+ function prepareTableData(settings, logic) {
83010
+ const resources = logic.options.services.resources || {};
83011
+ return {
83012
+ id: "DatabaseSettingsTable",
83013
+ rows: getRows(settings, logic, resources)
83014
+ };
83015
+ }
83016
+ function getRows(settings, logic, resources) {
83017
+ const rows = settings.filter((data) => !data.deleted).map((data) => ({
83018
+ ...data,
83019
+ status: getStatusPointComponent(data, resources),
83020
+ updateDate: getDateFormatString(data.updateDate),
83021
+ fullTextSearchEnabled: getBooleanDisplayName(data.fullTextSearchEnabled, resources),
83022
+ databaseType: getDatabaseTypeDisplayName(data.databaseType, resources),
83023
+ databaseTypeValue: data.databaseType,
83024
+ isDefault: getDefaultButtonComponent(logic, data, resources),
83025
+ update: getUpdateButtonComponent(logic, data, resources),
83026
+ disconnect: getDisconnectButtonComponent(logic, data, resources),
83027
+ databasePageNavigateArrow: getNavigateButtonComponent(logic, data)
83028
+ })).map((data, index) => ({
83029
+ id: index.toString(),
83030
+ entityId: data.alias,
83031
+ disabled: data.databaseState !== DatabaseState.Attached,
83032
+ available: data.connectionStatus?.status === ConnectionStatus.Succesfull,
83033
+ databaseType: data.databaseTypeValue,
83034
+ cells: getDatabaseSettingsColumns(resources).map((column) => ({
83035
+ columnId: column.id,
83036
+ value: data[column.id]
83037
+ }))
83038
+ }));
83039
+ return rows;
83040
+ }
83041
+ function getBooleanDisplayName(value, resources) {
83042
+ if (value === void 0) return;
83043
+ return value ? resources.Yes : resources.No;
83044
+ }
83045
+ function getDateFormatString(date) {
83046
+ return date ? hooks(date).format("DD.MM.YYYY") : void 0;
83047
+ }
83048
+ function getDatabaseTypeDisplayName(value, resources) {
83049
+ if (value === void 0) return;
83050
+ switch (value) {
83051
+ case DatabaseType.Postgre:
83052
+ return resources.PostgreDatabaseType;
83053
+ case DatabaseType.SQL:
83054
+ return resources.SQLDatabaseType;
83055
+ default:
83056
+ return "";
83057
+ }
83058
+ }
83059
+ function getDefaultButtonComponent(logic, data, resources) {
83060
+ return /* @__PURE__ */ jsx(
83061
+ DatabaseDefaultButton,
83062
+ {
83063
+ isDefault: data.isDefault,
83064
+ onClick: (e2, alias) => {
83065
+ e2.stopPropagation();
83066
+ logic?.setDefaultDatabase(alias);
83067
+ },
83068
+ disabled: data.databaseState !== DatabaseState.Attached || data.connectionStatus?.status !== ConnectionStatus.Succesfull,
83069
+ buttonText: resources.Set,
83070
+ tooltip: resources.SetDefaultDatabaseButtonTitle,
83071
+ alias: data.alias
83072
+ }
83073
+ );
83074
+ }
83075
+ function getUpdateButtonComponent(logic, data, resources) {
83076
+ return /* @__PURE__ */ jsx(
83077
+ DatabaseTableButton,
83078
+ {
83079
+ alias: data.alias,
83080
+ disabled: data.databaseState !== DatabaseState.Attached || data.connectionStatus?.status !== ConnectionStatus.Succesfull,
83081
+ tooltip: "",
83082
+ onClick: (e2) => {
83083
+ e2.stopPropagation();
83084
+ logic.confirmPageSaving({
83085
+ mode: DatabaseWizardMode.Update,
83086
+ pageWasChanged: logic.options.services.formControl.isDirty,
83087
+ data: { alias: data.alias }
83088
+ });
83089
+ },
83090
+ buttonText: resources.Update,
83091
+ icon: DatabaseUpdateIcon
83092
+ }
83093
+ );
83094
+ }
83095
+ function getDisconnectButtonComponent(logic, data, resources) {
83096
+ return /* @__PURE__ */ jsx(
83097
+ DatabaseTableButton,
83098
+ {
83099
+ disabled: data.isDefault || data.databaseState !== DatabaseState.Attached,
83100
+ tooltip: resources.DeleteDatabaseButtonTitle,
83101
+ alias: data.alias,
83102
+ onClick: (e2) => {
83103
+ e2.stopPropagation();
83104
+ logic?.deleteDatabase(data.alias);
83105
+ },
83106
+ buttonText: resources.Disconnect,
83107
+ icon: DatabaseOutlineIcon
83108
+ }
83109
+ );
83110
+ }
83111
+ function getStatusPointComponent(data, resources) {
83112
+ const value = getDatabaseStatusValue({
83113
+ state: data.databaseState,
83114
+ connectionStatus: data.connectionStatus?.status
83115
+ });
83116
+ if (value === void 0) return;
83117
+ return /* @__PURE__ */ jsx(DatabaseStatusPoint, { value, resources });
83118
+ }
83119
+ function getDatabaseStatusValue(data) {
83120
+ if (!data) return;
83121
+ const { state, connectionStatus } = data;
83122
+ if (state === DatabaseState.Attached && connectionStatus === void 0) return;
83123
+ if (state === DatabaseState.Attached && connectionStatus === ConnectionStatus.Succesfull) {
83124
+ return DatabaseStatusIndicator.Available;
83125
+ } else if (state === DatabaseState.Attached && connectionStatus !== ConnectionStatus.Succesfull) {
83126
+ return DatabaseStatusIndicator.NotAvailable;
83127
+ } else if (state === DatabaseState.Creating) {
83128
+ return DatabaseStatusIndicator.Creating;
83129
+ } else if (state === DatabaseState.Updating) {
83130
+ return DatabaseStatusIndicator.Updating;
83131
+ } else if (state === DatabaseState.Attaching) {
83132
+ return DatabaseStatusIndicator.Attaching;
83133
+ }
83134
+ }
83135
+ function getNavigateButtonComponent(logic, data, resources) {
83136
+ return /* @__PURE__ */ jsx(
83137
+ ArrowIconButton,
83138
+ {
83139
+ onClick: (e2) => {
83140
+ e2.stopPropagation();
83141
+ goToDatabasePage(data.alias, data.databaseType, logic.options.services, logic.options.parameters);
83142
+ },
83143
+ disabled: data.databaseState !== DatabaseState.Attached || data.connectionStatus?.status !== ConnectionStatus.Succesfull
83144
+ }
83145
+ );
83146
+ }
83147
+ function getDatabaseSettingsColumns(resources = {}) {
83148
+ return [
83149
+ {
83150
+ id: STATUS_COLUMN_ID,
83151
+ name: ""
83152
+ },
83153
+ {
83154
+ id: ALIAS_COLUMN_ID,
83155
+ name: resources.Alias
83156
+ },
83157
+ {
83158
+ id: SERVER_NAME_COLUMN_ID,
83159
+ name: resources.DatabaseSettingsPanel_ServerName
83160
+ },
83161
+ {
83162
+ id: DATABASE_TYPE_COLUMN_ID,
83163
+ name: resources.ServerType
83164
+ },
83165
+ {
83166
+ id: FULL_TEXT_SEARCH_ENABLED_COLUMN_ID,
83167
+ name: resources.FullTextSearchEnabled
83168
+ },
83169
+ {
83170
+ id: BASE_VERSION_COLUMN_ID,
83171
+ name: firstLetterToUppercase(resources.Version)
83172
+ },
83173
+ {
83174
+ id: UPDATE_DATE_COLUMN_ID,
83175
+ name: resources.DateOfUpdate
83176
+ },
83177
+ {
83178
+ id: IS_DEFAULT_COLUMN_ID,
83179
+ name: resources.Default
83180
+ },
83181
+ {
83182
+ id: UPDATE_DATABASE_COLUMN_ID,
83183
+ name: ""
83184
+ },
83185
+ {
83186
+ id: DISCONNECT_DATABASE_COLUMN_ID,
83187
+ name: ""
83188
+ },
83189
+ {
83190
+ id: DATABASE_PAGE_NAVIGATE_COLUMN_ID,
83191
+ name: ""
83192
+ }
83193
+ ];
83194
+ }
83195
+ function SettingsPageButtonPanel(props) {
83196
+ const { buttons, ...rest } = props;
83197
+ return /* @__PURE__ */ jsx("div", { className: "settings-page__button-panel", ...rest, children: buttons.map(
83198
+ (buttonProps) => /* @__PURE__ */ jsx(
83199
+ Button$3,
83200
+ {
83201
+ onClick: buttonProps.onClick,
83202
+ variant: "contained",
83203
+ size: "small",
83204
+ color: "secondary",
83205
+ children: buttonProps.value
83206
+ },
83207
+ buttonProps.value?.toString()
83208
+ )
83209
+ ) });
83210
+ }
83211
+ function DatabaseSettingsPanel(props) {
83212
+ props = { ...props, services: useContext(ServicesContext) };
83213
+ const { resetField, control } = useCustomFormContext();
83214
+ const { field, fieldState } = useController({
83215
+ name: props.id,
83216
+ control,
83217
+ defaultValue: props.value || []
83218
+ });
83219
+ const logic = useLogic({ ...props, resetField, field }, DatabaseSettingsPanelLogic);
83220
+ const resources = props.services.resources || {};
83221
+ const $loaded = e(logic.$loaded);
83222
+ useEffect(() => {
83223
+ logic.componentDidMount();
83224
+ }, [logic]);
83225
+ return /* @__PURE__ */ jsx(
83226
+ EditorContainer,
83227
+ {
83228
+ resetValue: () => {
83229
+ resetField(props.id);
83230
+ },
83231
+ isChanged: fieldState.isDirty,
83232
+ ...props,
83233
+ children: /* @__PURE__ */ jsxs(Databases, { ...field, value: field.value, children: [
83234
+ /* @__PURE__ */ jsx(TableContainer, { component: Paper$3, children: /* @__PURE__ */ jsxs(Table$1, { size: "small", "aria-label": "database-settings-panel", children: [
83235
+ /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsx(TableRow$1, { children: getDatabaseSettingsColumns(props.services.resources).map((column) => /* @__PURE__ */ jsx(
83236
+ TableCell$2,
83237
+ {
83238
+ className: "databases-header-cell",
83239
+ align: column.id === IS_DEFAULT_COLUMN_ID ? "center" : "left",
83240
+ children: column.name
83241
+ },
83242
+ column.id
83243
+ )) }) }),
83244
+ /* @__PURE__ */ jsx(TableBody$1, { children: prepareTableData(field.value, logic).rows.map((row) => /* @__PURE__ */ jsx(
83245
+ TableRow$1,
83246
+ {
83247
+ className: "databases-table-row" + classIf(row.disabled, "disabled") + classIfElse(row.available, "available", "not-available"),
83248
+ selected: field.value.find((d2) => d2.isDefault)?.alias === row.entityId,
83249
+ children: row.cells.map(
83250
+ (cell) => cell.value === void 0 && !$loaded ? /* @__PURE__ */ jsx(TableCell$2, { className: "databases-loading-table-cell", children: /* @__PURE__ */ jsx(CellPreloader, {}) }, `${row.entityId}_${cell.columnId}`) : /* @__PURE__ */ jsx(
83251
+ CellWithTwoLineClamping,
83252
+ {
83253
+ className: "databases-clamping-table-cell" + classIfElse(
83254
+ REDIRECT_CLICK_HANDLER_COLUMN_IDS.includes(cell.columnId) && !row.disabled && row.available,
83255
+ "clickable",
83256
+ "not-clickable"
83257
+ ),
83258
+ maxWidth: 150,
83259
+ content: cell.value,
83260
+ align: CENTER_ALIGN_COLUMN_IDS.includes(cell.columnId) ? "center" : "left",
83261
+ onClick: () => REDIRECT_CLICK_HANDLER_COLUMN_IDS.includes(cell.columnId) && !row.disabled && row.available && goToDatabasePage(row.entityId, row.databaseType, props.services, props.parameters),
83262
+ component: TableCell$2
83263
+ },
83264
+ `${row.entityId}_${cell.columnId}`
83265
+ )
83266
+ )
83267
+ },
83268
+ row.entityId
83269
+ )) })
83270
+ ] }) }),
83271
+ /* @__PURE__ */ jsx(SettingsPageButtonPanel, { buttons: [
83272
+ {
83273
+ key: "create",
83274
+ value: resources.Create,
83275
+ onClick: () => logic.confirmPageSaving({
83276
+ mode: DatabaseWizardMode.Create,
83277
+ pageWasChanged: props.services.formControl.isDirty
83278
+ })
83279
+ },
83280
+ {
83281
+ key: "connect",
83282
+ value: resources.Connect,
83283
+ onClick: () => logic.confirmPageSaving({
83284
+ mode: DatabaseWizardMode.Add,
83285
+ pageWasChanged: props.services.formControl.isDirty
83286
+ })
83287
+ }
83288
+ ] })
83289
+ ] })
83290
+ }
83291
+ );
83292
+ }
82530
83293
  function ReadonlyEditor(props) {
82531
83294
  const { id, value, options } = props;
82532
83295
  const { resources } = React__default.useContext(ServicesContext);
@@ -82564,6 +83327,116 @@ function AdvancedSettings(props) {
82564
83327
  };
82565
83328
  return /* @__PURE__ */ jsx("div", { className: "advanced-settings", children: /* @__PURE__ */ jsx(Button$3, { name: id, variant: "contained", size: "small", color: "secondary", hidden, onClick: goToConfigurationPage, children: label }) });
82566
83329
  }
83330
+ function OpenIdCatalogs(props) {
83331
+ const { value, id: fieldName, extendedLayoutId } = props;
83332
+ const services = useContext(ServicesContext);
83333
+ const { resources, settingsNavigation, messageWindow } = services;
83334
+ const { resetField, control } = useCustomFormContext();
83335
+ const {
83336
+ field,
83337
+ fieldState: { isDirty },
83338
+ formState: { dirtyFields }
83339
+ } = useController({
83340
+ name: fieldName,
83341
+ control,
83342
+ defaultValue: value
83343
+ });
83344
+ const columns = [resources.ExtensionName, resources.ExtensionId, "", ""];
83345
+ const goToOpenIdCatalogPage = async (e2, id, label) => {
83346
+ e2.stopPropagation();
83347
+ if (!id) {
83348
+ id = generateGuid().toLowerCase();
83349
+ }
83350
+ settingsNavigation.goToItemSettingsPage(extendedLayoutId, id, label);
83351
+ };
83352
+ const deleteRow = async (e2, id) => {
83353
+ e2.stopPropagation();
83354
+ await messageWindow.showConfirmation(resources.DeletionConfirmation);
83355
+ field.onChange(field.value.filter((element) => element.itemId !== id));
83356
+ };
83357
+ return /* @__PURE__ */ jsxs(EditorContainer, { isChanged: isDirty, resetValue: () => resetField(fieldName, { defaultValue: value }), ...props, children: [
83358
+ /* @__PURE__ */ jsx(TableContainer, { component: Paper$3, children: /* @__PURE__ */ jsxs(Table$1, { size: "small", children: [
83359
+ /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsx(TableRow$1, { children: columns.map((column) => /* @__PURE__ */ jsx(TableCell$2, { children: column }, column)) }) }),
83360
+ /* @__PURE__ */ jsx(TableBody$1, { children: field.value && field.value.map((row) => /* @__PURE__ */ jsxs(
83361
+ TableRow$1,
83362
+ {
83363
+ hover: true,
83364
+ onClick: (e2) => goToOpenIdCatalogPage(e2, row.itemId, row.configuration.name),
83365
+ className: "open-id-catalogs__row",
83366
+ children: [
83367
+ /* @__PURE__ */ jsx(CellWithFixedWidth, { content: row.configuration.name, maxWidth: 230 }),
83368
+ /* @__PURE__ */ jsx(CellWithFixedWidth, { content: row.configuration.id, maxWidth: 230 }),
83369
+ /* @__PURE__ */ jsx(TableCell$2, { children: /* @__PURE__ */ jsx(DeleteIconButton, { onClick: (e2) => deleteRow(e2, row.itemId) }) }),
83370
+ /* @__PURE__ */ jsx(TableCell$2, { children: /* @__PURE__ */ jsx(ArrowIconButton, { onClick: (e2) => goToOpenIdCatalogPage(e2, row.itemId, row.configuration.name) }) })
83371
+ ]
83372
+ },
83373
+ row.itemId
83374
+ )) })
83375
+ ] }) }),
83376
+ /* @__PURE__ */ jsx("div", { className: "open-id-catalogs__button-panel", children: /* @__PURE__ */ jsx(Button$3, { variant: "contained", size: "small", color: "secondary", onClick: (e2) => goToOpenIdCatalogPage(e2, "", resources.NewExtension), children: resources.AddExtension }) })
83377
+ ] });
83378
+ }
83379
+ function TenantsOpenIdSettings(props) {
83380
+ const { required, id: fieldName, value } = props;
83381
+ const { resources } = React__default.useContext(ServicesContext);
83382
+ const { control, resetField } = useCustomFormContext();
83383
+ const {
83384
+ field,
83385
+ fieldState: { isDirty }
83386
+ } = useController({
83387
+ name: fieldName,
83388
+ control,
83389
+ rules: { required },
83390
+ defaultValue: value
83391
+ });
83392
+ const handleCheck = (name, extensionName) => (_2, checked) => {
83393
+ const newValue = field.value.map((value2) => {
83394
+ if (value2.databaseAlias !== name) return value2;
83395
+ return { ...value2, extensions: value2.extensions.map((extension) => {
83396
+ if (extension.extensionName !== extensionName) return extension;
83397
+ return { ...extension, enable: checked };
83398
+ }) };
83399
+ });
83400
+ field.onChange(newValue);
83401
+ };
83402
+ const handleReset = () => {
83403
+ resetField(fieldName, { defaultValue: value });
83404
+ };
83405
+ return /* @__PURE__ */ jsx(EditorContainer, { isChanged: isDirty, resetValue: handleReset, ...props, children: /* @__PURE__ */ jsx(Grid$1, { container: true, spacing: 2, children: field.value?.map((value2) => /* @__PURE__ */ jsx(
83406
+ DatabaseSettingsCard,
83407
+ {
83408
+ title: value2.databaseAlias,
83409
+ label: resources.DefaultDatabase,
83410
+ isDefault: value2.isDefaultDatabase,
83411
+ children: /* @__PURE__ */ jsxs(Table$1, { children: [
83412
+ /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsx(TableRow$1, { children: /* @__PURE__ */ jsx(TableCell$2, { children: /* @__PURE__ */ jsx("p", { className: "tenants-open-id-settings__database-extensions", children: resources.AvailableExtensions }) }) }) }),
83413
+ /* @__PURE__ */ jsx(TableBody$1, { children: value2.extensions?.map((extension) => /* @__PURE__ */ jsx(TableRow$1, { children: /* @__PURE__ */ jsxs(TableCell$2, { padding: "normal", children: [
83414
+ /* @__PURE__ */ jsx(
83415
+ Checkbox$1,
83416
+ {
83417
+ id: value2.databaseAlias + "-" + extension.extensionId,
83418
+ color: "primary",
83419
+ size: "medium",
83420
+ name: value2.databaseAlias + "-" + extension.extensionName,
83421
+ checked: extension.enable,
83422
+ "data-testid": value2.databaseAlias + "-" + extension.extensionId,
83423
+ onChange: handleCheck(value2.databaseAlias, extension.extensionName)
83424
+ }
83425
+ ),
83426
+ /* @__PURE__ */ jsx(
83427
+ "label",
83428
+ {
83429
+ className: "tenants-open-id-settings__extension-label",
83430
+ htmlFor: value2.databaseAlias + "-" + extension.extensionId,
83431
+ children: extension.extensionName
83432
+ }
83433
+ )
83434
+ ] }) }, value2.databaseAlias + "-" + extension.extensionId)) })
83435
+ ] })
83436
+ },
83437
+ value2.databaseAlias
83438
+ )) }) });
83439
+ }
82567
83440
  function MailList(props) {
82568
83441
  const { required, id: fieldName, value, label } = props;
82569
83442
  const services = React__default.useContext(ServicesContext);
@@ -82656,22 +83529,6 @@ function ServerAppList(props) {
82656
83529
  error && /* @__PURE__ */ jsx(ErrorMessage, { message: error.message })
82657
83530
  ] });
82658
83531
  }
82659
- var TableLocationType = /* @__PURE__ */ ((TableLocationType2) => {
82660
- TableLocationType2[TableLocationType2["UseDefaultOrCurrent"] = 0] = "UseDefaultOrCurrent";
82661
- TableLocationType2[TableLocationType2["UseOwnDatabase"] = 1] = "UseOwnDatabase";
82662
- TableLocationType2[TableLocationType2["UseOuterDatabase"] = 2] = "UseOuterDatabase";
82663
- TableLocationType2[TableLocationType2["UseTemporaryDatabase"] = 3] = "UseTemporaryDatabase";
82664
- return TableLocationType2;
82665
- })(TableLocationType || {});
82666
- var TableLocationTypeExtended = /* @__PURE__ */ ((TableLocationTypeExtended2) => {
82667
- TableLocationTypeExtended2[TableLocationTypeExtended2["UseDefaultOrCurrent"] = 0] = "UseDefaultOrCurrent";
82668
- TableLocationTypeExtended2[TableLocationTypeExtended2["UseOwnDatabase"] = 1] = "UseOwnDatabase";
82669
- TableLocationTypeExtended2[TableLocationTypeExtended2["UseOuterDatabase"] = 2] = "UseOuterDatabase";
82670
- TableLocationTypeExtended2[TableLocationTypeExtended2["UseTemporaryDatabase"] = 3] = "UseTemporaryDatabase";
82671
- TableLocationTypeExtended2[TableLocationTypeExtended2["InMemoryTableOwnDatabase"] = 4] = "InMemoryTableOwnDatabase";
82672
- TableLocationTypeExtended2[TableLocationTypeExtended2["InMemoryTableOwnDatabaseNotPersistData"] = 5] = "InMemoryTableOwnDatabaseNotPersistData";
82673
- return TableLocationTypeExtended2;
82674
- })(TableLocationTypeExtended || {});
82675
83532
  const databaseGenerationSettingsValueType = {
82676
83533
  searchDataBaseType: TableLocationType,
82677
83534
  changedObjectDataBaseType: TableLocationTypeExtended,
@@ -84651,13 +85508,19 @@ function registerEditors() {
84651
85508
  editorFactory.register("TextArea", TextArea);
84652
85509
  editorFactory.register("RadioButton", RadioButton);
84653
85510
  editorFactory.register("Password", Password);
85511
+ editorFactory.register("Databases", DatabaseSettingsPanel);
84654
85512
  editorFactory.register("List", List$1);
84655
85513
  editorFactory.register("Dropdown", Dropdown);
84656
85514
  editorFactory.register("Header", Header);
85515
+ editorFactory.register("UserGroups", UserGroups);
84657
85516
  editorFactory.register("Number", Number$1);
84658
85517
  editorFactory.register("LdapCatalogs", LdapCatalogs);
85518
+ editorFactory.register("LicenseOptions", LicenseOptions);
85519
+ editorFactory.register("PersonalLicenses", PersonalLicenses);
84659
85520
  editorFactory.register("ReadonlyEditor", ReadonlyEditor);
84660
85521
  editorFactory.register("AdvancedSettings", AdvancedSettings);
85522
+ editorFactory.register("OpenIdCatalogs", OpenIdCatalogs);
85523
+ editorFactory.register("TenantsOpenIdSettings", TenantsOpenIdSettings);
84661
85524
  editorFactory.register("MailList", MailList);
84662
85525
  editorFactory.register("ServerAppList", ServerAppList);
84663
85526
  editorFactory.register("DatabaseGenerationSettings", DatabaseGenerationSettings);
@@ -87825,7 +88688,7 @@ function ComponentList(props) {
87825
88688
  onClick: (event) => onDeleteIconClick(event, component)
87826
88689
  }
87827
88690
  ),
87828
- /* @__PURE__ */ jsx(ExpandMoreIcon, { color: ICON_COLOR })
88691
+ /* @__PURE__ */ jsx(ExpandMoreIcon$1, { color: ICON_COLOR })
87829
88692
  ] }, component.serviceId);
87830
88693
  })
87831
88694
  ] });
@@ -99210,7 +100073,7 @@ const useGridVirtualScroller = () => {
99210
100073
  const handleTouchMove = useEventCallback((event) => {
99211
100074
  apiRef.current.publishEvent("virtualScrollerTouchMove", {}, event);
99212
100075
  });
99213
- const getRows = (params = {}) => {
100076
+ const getRows2 = (params = {}) => {
99214
100077
  if (!params.rows && !currentPage.range) {
99215
100078
  return [];
99216
100079
  }
@@ -99449,7 +100312,7 @@ const useGridVirtualScroller = () => {
99449
100312
  return {
99450
100313
  renderContext,
99451
100314
  setPanels,
99452
- getRows,
100315
+ getRows: getRows2,
99453
100316
  getContainerProps: () => ({
99454
100317
  ref: mainRefCallback
99455
100318
  }),
@@ -100341,10 +101204,10 @@ function GridVirtualScroller(props) {
100341
101204
  getRenderZoneProps,
100342
101205
  getScrollbarVerticalProps,
100343
101206
  getScrollbarHorizontalProps,
100344
- getRows,
101207
+ getRows: getRows2,
100345
101208
  getScrollAreaProps
100346
101209
  } = virtualScroller;
100347
- const rows = getRows();
101210
+ const rows = getRows2();
100348
101211
  return /* @__PURE__ */ jsxs(GridMainContainer, _extends$2({
100349
101212
  className: classes2.root
100350
101213
  }, getContainerProps(), {
@@ -121485,6 +122348,2316 @@ class ExtendedConfigurationController {
121485
122348
  return this.requestService.post(`api/extendedServiceConfiguration/${serviceId}`, changes);
121486
122349
  }
121487
122350
  }
122351
+ var DatabaseWizardStepStatus = /* @__PURE__ */ ((DatabaseWizardStepStatus2) => {
122352
+ DatabaseWizardStepStatus2[DatabaseWizardStepStatus2["Active"] = 0] = "Active";
122353
+ DatabaseWizardStepStatus2[DatabaseWizardStepStatus2["New"] = 1] = "New";
122354
+ DatabaseWizardStepStatus2[DatabaseWizardStepStatus2["Finished"] = 2] = "Finished";
122355
+ return DatabaseWizardStepStatus2;
122356
+ })(DatabaseWizardStepStatus || {});
122357
+ var DatabaseWizardSteps = /* @__PURE__ */ ((DatabaseWizardSteps2) => {
122358
+ DatabaseWizardSteps2[DatabaseWizardSteps2["SQLServer"] = 0] = "SQLServer";
122359
+ DatabaseWizardSteps2[DatabaseWizardSteps2["Database"] = 1] = "Database";
122360
+ DatabaseWizardSteps2[DatabaseWizardSteps2["Configuration"] = 2] = "Configuration";
122361
+ DatabaseWizardSteps2[DatabaseWizardSteps2["Confirmation"] = 3] = "Confirmation";
122362
+ DatabaseWizardSteps2[DatabaseWizardSteps2["Update"] = 4] = "Update";
122363
+ DatabaseWizardSteps2[DatabaseWizardSteps2["UploadSettings"] = 5] = "UploadSettings";
122364
+ return DatabaseWizardSteps2;
122365
+ })(DatabaseWizardSteps || {});
122366
+ var DBFIleLocationType = /* @__PURE__ */ ((DBFIleLocationType2) => {
122367
+ DBFIleLocationType2[DBFIleLocationType2["Standard"] = 0] = "Standard";
122368
+ DBFIleLocationType2[DBFIleLocationType2["Other"] = 1] = "Other";
122369
+ return DBFIleLocationType2;
122370
+ })(DBFIleLocationType || {});
122371
+ var LocaleId = /* @__PURE__ */ ((LocaleId2) => {
122372
+ LocaleId2[LocaleId2["Default"] = -1] = "Default";
122373
+ LocaleId2[LocaleId2["ENU"] = 1033] = "ENU";
122374
+ LocaleId2[LocaleId2["RUS"] = 1049] = "RUS";
122375
+ LocaleId2[LocaleId2["KKZ"] = 1049.1] = "KKZ";
122376
+ LocaleId2[LocaleId2["EST"] = 1061] = "EST";
122377
+ LocaleId2[LocaleId2["LVI"] = 1062] = "LVI";
122378
+ return LocaleId2;
122379
+ })(LocaleId || {});
122380
+ var AuthenticationType = /* @__PURE__ */ ((AuthenticationType2) => {
122381
+ AuthenticationType2[AuthenticationType2["SQLServer"] = 0] = "SQLServer";
122382
+ return AuthenticationType2;
122383
+ })(AuthenticationType || {});
122384
+ const DEFAULT_LOCALE_ID = LocaleId.RUS;
122385
+ ServerType.PostgreSQL;
122386
+ AuthenticationType.SQLServer;
122387
+ DBFIleLocationType.Standard;
122388
+ const DEFAULT_PORT = 5432;
122389
+ const DEFAULT_OPERATION_TIMEOUT = 600;
122390
+ const PLATFORM_SOLUTION_ID = "26dbf2c0-e72e-4e9e-ab99-816758387ae2";
122391
+ const OFFICE_WORK_LIBRARY_ID = "c0afdac0-d533-4fd6-b7da-c8d4f5969379";
122392
+ const getStepFormComponent = (step) => {
122393
+ switch (step) {
122394
+ case DatabaseWizardSteps.SQLServer:
122395
+ return "sqlServerForm";
122396
+ case DatabaseWizardSteps.Database:
122397
+ return "databaseForm";
122398
+ case DatabaseWizardSteps.Configuration:
122399
+ return "configurationForm";
122400
+ case DatabaseWizardSteps.Confirmation:
122401
+ return "confirmationForm";
122402
+ case DatabaseWizardSteps.Update:
122403
+ return "updateForm";
122404
+ case DatabaseWizardSteps.UploadSettings:
122405
+ return "uploadSettingsForm";
122406
+ default:
122407
+ return "sqlServerForm";
122408
+ }
122409
+ };
122410
+ const getDatabaseWizardSteps = (services) => {
122411
+ const steps = [];
122412
+ steps[DatabaseWizardSteps.SQLServer] = {
122413
+ status: DatabaseWizardStepStatus.New,
122414
+ step: DatabaseWizardSteps.SQLServer,
122415
+ active: true,
122416
+ finished: false,
122417
+ name: services.resources.DatabaseWizardLabelStep_SQLServer
122418
+ };
122419
+ steps[DatabaseWizardSteps.Database] = {
122420
+ status: DatabaseWizardStepStatus.New,
122421
+ step: DatabaseWizardSteps.Database,
122422
+ active: false,
122423
+ finished: false,
122424
+ name: services.resources.DatabaseWizardLabelStep_Database
122425
+ };
122426
+ steps[DatabaseWizardSteps.Configuration] = {
122427
+ status: DatabaseWizardStepStatus.New,
122428
+ step: DatabaseWizardSteps.Configuration,
122429
+ active: false,
122430
+ finished: false,
122431
+ name: services.resources.DatabaseWizardLabelStep_Configuration
122432
+ };
122433
+ steps[DatabaseWizardSteps.Confirmation] = {
122434
+ status: DatabaseWizardStepStatus.New,
122435
+ step: DatabaseWizardSteps.Confirmation,
122436
+ active: false,
122437
+ finished: false,
122438
+ name: services.resources.DatabaseWizardLabelStep_Confirmation
122439
+ };
122440
+ steps[DatabaseWizardSteps.Update] = {
122441
+ status: DatabaseWizardStepStatus.New,
122442
+ step: DatabaseWizardSteps.Update,
122443
+ active: false,
122444
+ finished: false,
122445
+ name: services.resources.DatabaseWizardLabelStep_Update
122446
+ };
122447
+ steps[DatabaseWizardSteps.UploadSettings] = {
122448
+ status: DatabaseWizardStepStatus.New,
122449
+ step: DatabaseWizardSteps.UploadSettings,
122450
+ active: false,
122451
+ finished: false,
122452
+ name: services.resources.DatabaseWizardLabelStep_UploadSettings
122453
+ };
122454
+ return steps;
122455
+ };
122456
+ const databaseWizardCreateModeStepsList = [
122457
+ DatabaseWizardSteps.SQLServer,
122458
+ DatabaseWizardSteps.Database,
122459
+ DatabaseWizardSteps.Configuration,
122460
+ DatabaseWizardSteps.Confirmation,
122461
+ DatabaseWizardSteps.UploadSettings
122462
+ ];
122463
+ const databaseWizardUpdateModeStepsList = [
122464
+ DatabaseWizardSteps.Configuration,
122465
+ DatabaseWizardSteps.Confirmation,
122466
+ DatabaseWizardSteps.Update,
122467
+ DatabaseWizardSteps.UploadSettings
122468
+ ];
122469
+ const databaseWizardAddModeStepsList = [
122470
+ DatabaseWizardSteps.SQLServer,
122471
+ DatabaseWizardSteps.Database,
122472
+ DatabaseWizardSteps.Confirmation,
122473
+ DatabaseWizardSteps.Configuration,
122474
+ DatabaseWizardSteps.Update,
122475
+ DatabaseWizardSteps.UploadSettings
122476
+ ];
122477
+ const getDatabaseWizardModeSteps = (mode, services) => {
122478
+ let modeStepsList;
122479
+ let databaseWizardAllSteps = getDatabaseWizardSteps(services);
122480
+ switch (mode) {
122481
+ case DatabaseWizardMode.Create:
122482
+ modeStepsList = databaseWizardCreateModeStepsList;
122483
+ databaseWizardAllSteps = databaseWizardCreateModeStepsList.map((step) => getDatabaseWizardSteps(services)[step]);
122484
+ break;
122485
+ case DatabaseWizardMode.Update:
122486
+ modeStepsList = databaseWizardUpdateModeStepsList;
122487
+ databaseWizardAllSteps = databaseWizardUpdateModeStepsList.map((step) => getDatabaseWizardSteps(services)[step]);
122488
+ break;
122489
+ case DatabaseWizardMode.Add:
122490
+ modeStepsList = databaseWizardAddModeStepsList;
122491
+ databaseWizardAllSteps = databaseWizardAddModeStepsList.map((step) => getDatabaseWizardSteps(services)[step]);
122492
+ }
122493
+ return modeStepsList.map((step, index) => {
122494
+ return {
122495
+ ...databaseWizardAllSteps[index],
122496
+ order: index + 1
122497
+ };
122498
+ });
122499
+ };
122500
+ const getDefaultPlacementsTables = () => {
122501
+ const placementsTables = {
122502
+ changedObjectDataBaseType: TableLocationTypeExtended.UseTemporaryDatabase,
122503
+ cursorDataBaseType: TableLocationType.UseTemporaryDatabase,
122504
+ fileCursorDataBaseType: TableLocationType.UseOwnDatabase,
122505
+ iconDataBaseType: TableLocationType.UseTemporaryDatabase,
122506
+ keysetDataBaseType: TableLocationType.UseTemporaryDatabase,
122507
+ searchDataBaseType: TableLocationType.UseTemporaryDatabase,
122508
+ useOuterArchive: false,
122509
+ useOuterLog: false,
122510
+ useOuterMetadata: false
122511
+ };
122512
+ return placementsTables;
122513
+ };
122514
+ const getTextKeysFromEnum = (enumType) => {
122515
+ const textKeys = [];
122516
+ Object.keys(enumType).forEach((key) => {
122517
+ const isValueProperty = !isNaN(Number(key));
122518
+ if (isValueProperty) return;
122519
+ textKeys.push(key);
122520
+ });
122521
+ return textKeys;
122522
+ };
122523
+ const getTableLocationTypeNames = () => {
122524
+ return getTextKeysFromEnum(TableLocationType);
122525
+ };
122526
+ const getTableLocationTypeExtendedNames = () => {
122527
+ return getTextKeysFromEnum(TableLocationTypeExtended);
122528
+ };
122529
+ const getServerTypeNames = () => {
122530
+ return getTextKeysFromEnum(ServerType);
122531
+ };
122532
+ const getDBFileLocationTypeNames = () => {
122533
+ return getTextKeysFromEnum(DBFIleLocationType);
122534
+ };
122535
+ const getLocaleIdNames = () => {
122536
+ return getTextKeysFromEnum(LocaleId);
122537
+ };
122538
+ const getAuthenticationTypeNames = () => {
122539
+ return getTextKeysFromEnum(AuthenticationType);
122540
+ };
122541
+ const getDatabaseWizardFormName = (services, step, mode, form) => {
122542
+ const resourceKey = `DatabaseWizard${DatabaseWizardSteps[step]}${DatabaseWizardMode[mode] || ""}Form${form || ""}`;
122543
+ return services.resources[resourceKey];
122544
+ };
122545
+ const isStepClickable = (step, logic) => {
122546
+ const activeStep = logic.$activeStep.getState();
122547
+ if (activeStep.step === step.step) {
122548
+ return false;
122549
+ }
122550
+ if (activeStep.order <= step.order) {
122551
+ return false;
122552
+ }
122553
+ if (logic.$loading.getState() || !!logic.$processStatus.getState()) {
122554
+ return false;
122555
+ }
122556
+ if (logic.$mode.getState() === DatabaseWizardMode.Add && activeStep.step === DatabaseWizardSteps.Update) {
122557
+ return false;
122558
+ }
122559
+ if (activeStep.step === DatabaseWizardSteps.UploadSettings) {
122560
+ return false;
122561
+ }
122562
+ return true;
122563
+ };
122564
+ const isCancelButtonDisabled = (step, logic) => {
122565
+ if (logic.$loading.getState() || logic.$processStatus.getState()?.state === ProcessState.Running) {
122566
+ return true;
122567
+ }
122568
+ return false;
122569
+ };
122570
+ const isBackButtonDisabled = (step, logic) => {
122571
+ if (step === logic.$steps.getState()[0]) {
122572
+ return true;
122573
+ }
122574
+ if (logic.$loading.getState() || logic.$processStatus.getState()?.state === ProcessState.Running) {
122575
+ return true;
122576
+ }
122577
+ if (!!logic.$processStatus.getState()) {
122578
+ return true;
122579
+ }
122580
+ return false;
122581
+ };
122582
+ const isNextButtonDisabled = (step, logic) => {
122583
+ const $steps = logic.$steps.getState();
122584
+ const $loading = logic.$loading.getState();
122585
+ const $processStatus = logic.$processStatus.getState();
122586
+ return step === $steps[$steps.length - 1] || $loading || $processStatus?.state === ProcessState.Running || $processStatus?.state === ProcessState.Error;
122587
+ };
122588
+ const isDoneButtonDisabled = (step, logic) => {
122589
+ const $loading = logic.$loading.getState();
122590
+ const $processStatus = logic.$processStatus.getState();
122591
+ const $haveCheckedSolutions = logic.$haveCheckedSolutions.getState();
122592
+ if (!$haveCheckedSolutions) {
122593
+ return false;
122594
+ }
122595
+ return $loading || !$processStatus || $processStatus?.state === ProcessState.Running;
122596
+ };
122597
+ const getSelectedLibrariesArray = (logic) => {
122598
+ const disabledLibraries = logic.$disabledLibraries.getState().map((item) => item.id);
122599
+ const libraries = logic.$selectedLibraries.getState().reduce((acc, item) => {
122600
+ if (!disabledLibraries.includes(item.id)) {
122601
+ acc.push(item.id);
122602
+ }
122603
+ return acc;
122604
+ }, []);
122605
+ return libraries;
122606
+ };
122607
+ const isRequiredSolution = (solution) => {
122608
+ if (solution.id !== PLATFORM_SOLUTION_ID || !solution.canUpdate) {
122609
+ return false;
122610
+ }
122611
+ return true;
122612
+ };
122613
+ const checkRequiredLibrary = (availableLibraries, selectedLibraries) => {
122614
+ const requiredLibrary = availableLibraries.find((library) => library.id?.toLowerCase() === OFFICE_WORK_LIBRARY_ID && library.canUpdate && !selectedLibraries.some((selectedLibrary) => selectedLibrary.id === library.id));
122615
+ if (requiredLibrary && requiredLibrary.libraryDependencies.every((dependency) => selectedLibraries.some((selectedLibrary) => selectedLibrary.id === dependency.id))) {
122616
+ selectedLibraries.push(requiredLibrary);
122617
+ }
122618
+ return selectedLibraries;
122619
+ };
122620
+ const getLibraryTooltip = (library, services) => {
122621
+ if (library.id?.toLowerCase() === OFFICE_WORK_LIBRARY_ID) {
122622
+ return services.resources.DatabaseWizard_OfficeWorkLibraryTooltip;
122623
+ }
122624
+ return "";
122625
+ };
122626
+ async function createModeSQlServerFromSubmit(logic) {
122627
+ logic.setLoading(true);
122628
+ const result = await logic.options.services.databasesController.checkSqlServerConnection(logic.$serviceId.getState(), logic.getServerParameters());
122629
+ if (result.status === ConnectionStatus.Succesfull) {
122630
+ const result2 = await logic.options.services.databasesController.databases(logic.$serviceId.getState(), logic.getServerParameters());
122631
+ logic.setExistingBases(result2);
122632
+ logic.nextStep();
122633
+ } else if (result.status === ConnectionStatus.LoginFailed) {
122634
+ logic.setSubmitErrorMessage(formatString$1(logic.options.services.resources.DatabaseWizardErrors_InvalidPassword, logic.$login.getState()));
122635
+ } else if (result.status === ConnectionStatus.ServerNotExist) {
122636
+ logic.setSubmitErrorMessage(logic.options.services.resources.DatabaseWizardErrors_ServerNotExist);
122637
+ } else if (result.status === ConnectionStatus.AuthNotSupported) {
122638
+ logic.setSubmitErrorMessage(logic.options.services.resources.DatabaseWizardErrors_AuthNotSupported);
122639
+ } else {
122640
+ logic.setSubmitErrorMessage(logic.options.services.resources.DatabaseWizardErrors_Unknown);
122641
+ }
122642
+ logic.setLoading(false);
122643
+ }
122644
+ async function createModeDatabaseFromSubmit(logic) {
122645
+ const isExistingBase = logic.$existingBases.getState().includes(logic.$databaseName.getState());
122646
+ if (isExistingBase) {
122647
+ logic.setSubmitErrorMessage(logic.options.services.resources.DatabaseWizardErrors_DatabaseAlreadyExist);
122648
+ logic.setLoading(false);
122649
+ return;
122650
+ }
122651
+ logic.setLoading(true);
122652
+ try {
122653
+ const allBases = await logic.options.services.databasesConfigurationController.all(logic.$serviceId.getState());
122654
+ const isExistingAlias = allBases.some((item) => item.alias?.toLowerCase() === logic.$alias.getState() && item.databaseState !== DatabaseState.Creating);
122655
+ if (isExistingAlias) {
122656
+ logic.setSubmitErrorMessage(logic.options.services.resources.DatabaseWizardErrors_AliasAlreadyExist);
122657
+ logic.setLoading(false);
122658
+ return;
122659
+ }
122660
+ await logic.options.services.databaseMasterController.setState(logic.$serviceId.getState(), {
122661
+ serverParameters: logic.getServerParameters(),
122662
+ databaseParameters: logic.getDatabaseParameters(),
122663
+ scriptGenerationParameters: logic.$tablesPlacements.getState(),
122664
+ currentPageName: "Configuration",
122665
+ masterType: logic.$mode.getState()
122666
+ });
122667
+ logic.setStateWasChanged(true);
122668
+ await logic.getLibraries();
122669
+ logic.setLoading(false);
122670
+ logic.nextStep();
122671
+ } catch (error) {
122672
+ logic.setSubmitErrorMessage(error.message);
122673
+ logic.setLoading(false);
122674
+ }
122675
+ }
122676
+ async function createModeConfigurationFromSubmit(logic) {
122677
+ const libraries = getSelectedLibrariesArray(logic);
122678
+ logic.setLoading(true);
122679
+ await logic.options.services.databaseMasterController.setState(logic.$serviceId.getState(), {
122680
+ serverParameters: logic.getServerParameters(),
122681
+ databaseParameters: logic.getDatabaseParameters(),
122682
+ scriptGenerationParameters: logic.$tablesPlacements.getState(),
122683
+ currentPageName: "Confirmation",
122684
+ masterType: logic.$mode.getState(),
122685
+ libraries
122686
+ });
122687
+ logic.setStateWasChanged(true);
122688
+ logic.setLoading(false);
122689
+ logic.nextStep();
122690
+ }
122691
+ async function createModeConfirmationFromSubmit(logic) {
122692
+ if (logic.$processStatus.getState()?.state === ProcessState.Finished) {
122693
+ await logic.options.services.messageWindow.showConfirmation(logic.options.services.resources.DatabaseWizard_BeforeUploadSettingsStepAttention);
122694
+ logic.setLoading(true);
122695
+ await logic.getSolutions();
122696
+ logic.setLoading(false);
122697
+ logic.setProcessStatus(null);
122698
+ logic.nextStep();
122699
+ return;
122700
+ }
122701
+ const libraries = getSelectedLibrariesArray(logic);
122702
+ logic.setLoading(true);
122703
+ await logic.options.services.databaseMasterController.setState(logic.$serviceId.getState(), {
122704
+ serverParameters: logic.getServerParameters(),
122705
+ databaseParameters: logic.getDatabaseParameters(),
122706
+ scriptGenerationParameters: logic.$tablesPlacements.getState(),
122707
+ currentPageName: "Confirmation",
122708
+ masterType: logic.$mode.getState(),
122709
+ libraries,
122710
+ timeout: logic.$operationTimeout.getState(),
122711
+ localeId: logic.$localeId.getState() && Math.round(logic.$localeId.getState())
122712
+ });
122713
+ const checkStatus = async () => {
122714
+ const status = await logic.options.services.databasesController.status(logic.$serviceId.getState(), logic.$alias.getState());
122715
+ if (status.state === ProcessState.Running) {
122716
+ setTimeout(checkStatus, 5e3);
122717
+ } else if (status.state === ProcessState.Error) {
122718
+ logic.setSubmitErrorMessage(status.errorMessage);
122719
+ } else if (status.state === ProcessState.Finished) {
122720
+ await logic.options.services.databasesConfigurationController.add(logic.$serviceId.getState(), logic.$alias.getState());
122721
+ } else if (status.state === ProcessState.Canceled) {
122722
+ logic.setProcessIsCancelling(false);
122723
+ }
122724
+ logic.setProcessStatus(status);
122725
+ };
122726
+ try {
122727
+ await logic.options.services.databasesController.create(logic.$serviceId.getState(), logic.$alias.getState());
122728
+ logic.setProcessStatus({ state: ProcessState.Running });
122729
+ await checkStatus();
122730
+ } catch (e2) {
122731
+ logic.setSubmitErrorMessage(e2.message);
122732
+ }
122733
+ logic.setStateWasChanged(true);
122734
+ logic.setLoading(false);
122735
+ }
122736
+ async function cancelDatabaseProcess(logic) {
122737
+ logic.options.services.databasesController.stop(logic.$serviceId.getState(), logic.$alias.getState());
122738
+ logic.setProcessIsCancelling(true);
122739
+ logic.setStateWasChanged(true);
122740
+ }
122741
+ async function createModeUploadSettingsFromSubmit(logic) {
122742
+ const solutions = logic.$solutions.getState().reduce((acc, item) => {
122743
+ if (item.selected) {
122744
+ acc.push(item.id);
122745
+ }
122746
+ return acc;
122747
+ }, []);
122748
+ logic.setLoading(true);
122749
+ await logic.options.services.databaseMasterController.setState(logic.$serviceId.getState(), {
122750
+ serverParameters: logic.getServerParameters(),
122751
+ databaseParameters: logic.getDatabaseParameters(),
122752
+ scriptGenerationParameters: logic.$tablesPlacements.getState(),
122753
+ currentPageName: "UploadSettings",
122754
+ masterType: logic.$mode.getState(),
122755
+ timeout: logic.$operationTimeout.getState(),
122756
+ localeId: logic.$localeId.getState() && Math.round(logic.$localeId.getState())
122757
+ });
122758
+ const checkStatus = async () => {
122759
+ const status = await logic.options.services.databasesController.status(logic.$serviceId.getState(), logic.$alias.getState());
122760
+ if (status.state === ProcessState.Running) {
122761
+ setTimeout(checkStatus, 5e3);
122762
+ } else if (status.state === ProcessState.Error) {
122763
+ logic.setSubmitErrorMessage(status.errorMessage);
122764
+ } else if (status.state === ProcessState.Canceled) {
122765
+ logic.setProcessIsCancelling(false);
122766
+ }
122767
+ logic.setProcessStatus(status);
122768
+ };
122769
+ try {
122770
+ await logic.options.services.databasesController.installSolutions(
122771
+ logic.$serviceId.getState(),
122772
+ logic.$alias.getState(),
122773
+ solutions
122774
+ );
122775
+ logic.setProcessStatus({ state: ProcessState.Running });
122776
+ await checkStatus();
122777
+ } catch (e2) {
122778
+ logic.setSubmitErrorMessage(e2.message);
122779
+ }
122780
+ logic.setStateWasChanged(true);
122781
+ logic.setLoading(false);
122782
+ }
122783
+ async function addModeConfigurationFromSubmit(logic) {
122784
+ const libraries = getSelectedLibrariesArray(logic);
122785
+ logic.setLoading(true);
122786
+ try {
122787
+ await logic.options.services.databasesConfigurationController.add(logic.$serviceId.getState(), logic.$alias.getState());
122788
+ } catch (e2) {
122789
+ logic.setSubmitErrorMessage(e2.message);
122790
+ }
122791
+ await logic.options.services.databaseMasterController.setState(logic.$serviceId.getState(), {
122792
+ serverParameters: logic.getServerParameters(),
122793
+ databaseParameters: logic.getDatabaseParameters(),
122794
+ scriptGenerationParameters: logic.$tablesPlacements.getState(),
122795
+ currentPageName: "Update",
122796
+ masterType: logic.$mode.getState(),
122797
+ libraries,
122798
+ timeout: logic.$operationTimeout.getState(),
122799
+ localeId: logic.$localeId.getState() && Math.round(logic.$localeId.getState())
122800
+ });
122801
+ logic.setLoading(false);
122802
+ logic.nextStep();
122803
+ }
122804
+ async function addModeConfirmationFromSubmit(logic) {
122805
+ logic.setLoading(true);
122806
+ try {
122807
+ await logic.getLibraries();
122808
+ const libraries = getSelectedLibrariesArray(logic);
122809
+ await logic.options.services.databaseMasterController.setState(logic.$serviceId.getState(), {
122810
+ serverParameters: logic.getServerParameters(),
122811
+ databaseParameters: logic.getDatabaseParameters(),
122812
+ scriptGenerationParameters: logic.$tablesPlacements.getState(),
122813
+ currentPageName: "Configuration",
122814
+ masterType: logic.$mode.getState(),
122815
+ libraries,
122816
+ timeout: logic.$operationTimeout.getState(),
122817
+ localeId: logic.$localeId.getState() && Math.round(logic.$localeId.getState())
122818
+ });
122819
+ logic.setStateWasChanged(true);
122820
+ logic.setLoading(false);
122821
+ logic.nextStep();
122822
+ } catch (error) {
122823
+ logic.setSubmitErrorMessage(error.message);
122824
+ logic.setLoading(false);
122825
+ }
122826
+ }
122827
+ async function addModeDatabaseFromSubmit(logic) {
122828
+ const isExistingBase = logic.$existingBases.getState().includes(logic.$databaseName.getState());
122829
+ if (!isExistingBase) {
122830
+ logic.setSubmitErrorMessage(logic.options.services.resources.DatabaseWizard_DatabaseDoesNotExistError);
122831
+ logic.setLoading(false);
122832
+ return;
122833
+ }
122834
+ logic.setLoading(true);
122835
+ const databaseConnectionStatus = await logic.options.services.databasesController.checkSqlDatabaseConnectionFull(
122836
+ logic.$serviceId.getState(),
122837
+ logic.getServerParameters(),
122838
+ logic.getDatabaseParameters()
122839
+ );
122840
+ if (databaseConnectionStatus.status === ConnectionStatus.DatabaseAlreadyExists) {
122841
+ logic.setSubmitErrorMessage(logic.options.services.resources.DatabaseWizardErrors_DatabaseAlreadyExist);
122842
+ logic.setLoading(false);
122843
+ return;
122844
+ }
122845
+ if (databaseConnectionStatus.status === ConnectionStatus.AliasAlreadyExists) {
122846
+ logic.setSubmitErrorMessage(logic.options.services.resources.DatabaseWizardErrors_AliasAlreadyExist);
122847
+ logic.setLoading(false);
122848
+ return;
122849
+ }
122850
+ const libraries = getSelectedLibrariesArray(logic);
122851
+ await logic.options.services.databaseMasterController.setState(logic.$serviceId.getState(), {
122852
+ serverParameters: logic.getServerParameters(),
122853
+ databaseParameters: logic.getDatabaseParameters(),
122854
+ scriptGenerationParameters: logic.$tablesPlacements.getState(),
122855
+ currentPageName: "Confirmation",
122856
+ masterType: logic.$mode.getState(),
122857
+ libraries
122858
+ });
122859
+ logic.setLoading(false);
122860
+ logic.nextStep();
122861
+ }
122862
+ async function addModeUpdateFromSubmit(logic) {
122863
+ if (logic.$processStatus.getState()?.state === ProcessState.Finished) {
122864
+ await logic.options.services.messageWindow.showConfirmation(logic.options.services.resources.DatabaseWizard_BeforeUploadSettingsStepAttention);
122865
+ logic.setLoading(true);
122866
+ await logic.getSolutions();
122867
+ logic.setLoading(false);
122868
+ logic.setProcessStatus(null);
122869
+ logic.nextStep();
122870
+ return;
122871
+ }
122872
+ logic.setLoading(true);
122873
+ await logic.options.services.databaseMasterController.setState(logic.$serviceId.getState(), {
122874
+ serverParameters: logic.getServerParameters(),
122875
+ databaseParameters: logic.getDatabaseParameters(),
122876
+ scriptGenerationParameters: logic.$tablesPlacements.getState(),
122877
+ currentPageName: "Update",
122878
+ masterType: logic.$mode.getState(),
122879
+ libraries: getSelectedLibrariesArray(logic),
122880
+ timeout: logic.$operationTimeout.getState(),
122881
+ localeId: logic.$localeId.getState() && Math.round(logic.$localeId.getState())
122882
+ });
122883
+ await logic.options.services.databasesController.update(logic.$serviceId.getState(), logic.$alias.getState());
122884
+ const checkStatus = async () => {
122885
+ const status = await logic.options.services.databasesController.status(logic.$serviceId.getState(), logic.$alias.getState());
122886
+ if (status.state === ProcessState.Running) {
122887
+ setTimeout(checkStatus, 5e3);
122888
+ } else if (status.state === ProcessState.Error) {
122889
+ logic.setSubmitErrorMessage(status.errorMessage);
122890
+ } else if (status.state === ProcessState.Canceled) {
122891
+ logic.setProcessIsCancelling(false);
122892
+ }
122893
+ logic.setProcessStatus(status);
122894
+ };
122895
+ try {
122896
+ logic.setProcessStatus({ state: ProcessState.Running });
122897
+ await checkStatus();
122898
+ } catch (e2) {
122899
+ logic.setSubmitErrorMessage(e2.message);
122900
+ }
122901
+ logic.setStateWasChanged(true);
122902
+ logic.setLoading(false);
122903
+ }
122904
+ async function updateModeConfigurationFromSubmit(logic) {
122905
+ const libraries = getSelectedLibrariesArray(logic);
122906
+ logic.setLoading(true);
122907
+ await logic.options.services.databaseMasterController.setState(logic.$serviceId.getState(), {
122908
+ databaseParameters: logic.getDatabaseParameters(),
122909
+ scriptGenerationParameters: logic.$tablesPlacements.getState(),
122910
+ currentPageName: "Confirmation",
122911
+ masterType: logic.$mode.getState(),
122912
+ libraries
122913
+ });
122914
+ logic.setStateWasChanged(true);
122915
+ logic.setLoading(false);
122916
+ logic.nextStep();
122917
+ }
122918
+ async function updateModeConfirmationFromSubmit(logic) {
122919
+ logic.setLoading(true);
122920
+ await logic.options.services.databaseMasterController.setState(logic.$serviceId.getState(), {
122921
+ databaseParameters: logic.getDatabaseParameters(),
122922
+ scriptGenerationParameters: logic.$tablesPlacements.getState(),
122923
+ currentPageName: "Update",
122924
+ masterType: logic.$mode.getState(),
122925
+ libraries: getSelectedLibrariesArray(logic)
122926
+ });
122927
+ logic.setStateWasChanged(true);
122928
+ logic.setLoading(false);
122929
+ logic.nextStep();
122930
+ }
122931
+ async function updateModeUpdateFromSubmit(logic) {
122932
+ if (logic.$processStatus.getState()?.state === ProcessState.Finished) {
122933
+ await logic.options.services.messageWindow.showConfirmation(logic.options.services.resources.DatabaseWizard_BeforeUploadSettingsStepAttention);
122934
+ logic.setLoading(true);
122935
+ await logic.getSolutions();
122936
+ logic.setLoading(false);
122937
+ logic.setProcessStatus(null);
122938
+ logic.nextStep();
122939
+ return;
122940
+ }
122941
+ logic.setLoading(true);
122942
+ await logic.options.services.databaseMasterController.setState(logic.$serviceId.getState(), {
122943
+ databaseParameters: logic.getDatabaseParameters(),
122944
+ scriptGenerationParameters: logic.$tablesPlacements.getState(),
122945
+ currentPageName: "Update",
122946
+ masterType: logic.$mode.getState(),
122947
+ libraries: getSelectedLibrariesArray(logic)
122948
+ });
122949
+ await logic.options.services.databasesController.update(logic.$serviceId.getState(), logic.$alias.getState());
122950
+ const checkStatus = async () => {
122951
+ const status = await logic.options.services.databasesController.status(logic.$serviceId.getState(), logic.$alias.getState());
122952
+ if (status.state === ProcessState.Running) {
122953
+ setTimeout(checkStatus, 5e3);
122954
+ } else if (status.state === ProcessState.Error) {
122955
+ logic.setSubmitErrorMessage(status.errorMessage);
122956
+ } else if (status.state === ProcessState.Canceled) {
122957
+ logic.setProcessIsCancelling(false);
122958
+ }
122959
+ logic.setProcessStatus(status);
122960
+ };
122961
+ try {
122962
+ logic.setProcessStatus({ state: ProcessState.Running });
122963
+ await checkStatus();
122964
+ } catch (e2) {
122965
+ logic.setSubmitErrorMessage(e2.message);
122966
+ }
122967
+ logic.setStateWasChanged(true);
122968
+ logic.setLoading(false);
122969
+ }
122970
+ class DatabaseWizardLogic extends ComponentLogic {
122971
+ constructor() {
122972
+ super(...arguments);
122973
+ this.domain = y("DatabaseSettingsPanelLogic");
122974
+ this.$steps = this.domain.createStore([], { name: "$steps" });
122975
+ this.$isOpen = this.domain.createStore(true, { name: "$isOpen" });
122976
+ this.setIsOpen = this.domain.event("setIsOpen");
122977
+ this.setSteps = this.domain.event("setSteps");
122978
+ this.currentFormRef = React__default.createRef();
122979
+ this.$activeStep = this.domain.createStore(null, { name: "$activeStep" });
122980
+ this.setActiveStep = this.domain.event("setActiveStep");
122981
+ this.$serviceId = this.domain.createStore(null, { name: "$serviceId" });
122982
+ this.setServiceId = this.domain.event("setServiceId");
122983
+ this.$submitErrorMessage = this.domain.createStore(null, { name: "$submitErrorMessage" });
122984
+ this.setSubmitErrorMessage = this.domain.event("setSubmitErrorMessage");
122985
+ this.$existingBases = this.domain.createStore([], { name: "$existingBases" });
122986
+ this.setExistingBases = this.domain.event("setExistingBases");
122987
+ this.$loading = this.domain.createStore(false, { name: "$loading" });
122988
+ this.setLoading = this.domain.event("setLoading");
122989
+ this.$passwordChanged = this.domain.createStore(false, { name: "$passwordChanged" });
122990
+ this.setPasswordChanged = this.domain.event("setPasswordChanged");
122991
+ this.$processStatus = this.domain.createStore(null, { name: "$ProcessStatus" });
122992
+ this.setProcessStatus = this.domain.event("setProcessStatus");
122993
+ this.$processIsCancelling = this.domain.createStore(false, { name: "$processIsCancelling" });
122994
+ this.setProcessIsCancelling = this.domain.event("setProcessIsCancelling");
122995
+ this.$mode = this.domain.createStore(null, { name: "$mode" });
122996
+ this.setMode = this.domain.event("setMode");
122997
+ this.$scriptGeneratorVersion = this.domain.createStore(null, { name: "$scriptGeneratorVersion" });
122998
+ this.setScriptGeneratorVersion = this.domain.event("setScriptGeneratorVersion");
122999
+ this.$stateWasChanged = this.domain.createStore(false, { name: "$stateWasChanged" });
123000
+ this.setStateWasChanged = this.domain.event("setStateWasChanged");
123001
+ this.nextStep = this.domain.event("nextStep");
123002
+ this.previousStep = this.domain.event("previousStep");
123003
+ this.goToStep = this.domain.event("goToStep");
123004
+ this.componentDidMount = this.domain.event("componentDidMount");
123005
+ this.markStepsStatusFx = this.domain.effect((step) => {
123006
+ const steps = this.$steps.getState();
123007
+ steps.forEach((item) => {
123008
+ if (item.order > step.order) {
123009
+ item.status = DatabaseWizardStepStatus.New;
123010
+ } else if (item.order < step.order) {
123011
+ item.status = DatabaseWizardStepStatus.Finished;
123012
+ } else {
123013
+ item.status = DatabaseWizardStepStatus.Active;
123014
+ }
123015
+ });
123016
+ this.setSteps([...steps]);
123017
+ });
123018
+ this.stepFormSubmit = this.domain.event("stepFormOnsubmit");
123019
+ this.stepFormSubmitFx = this.domain.effect(async () => {
123020
+ const step = this.$activeStep.getState().step;
123021
+ if (this.$mode.getState() === DatabaseWizardMode.Create) {
123022
+ switch (step) {
123023
+ case DatabaseWizardSteps.SQLServer:
123024
+ await createModeSQlServerFromSubmit(this);
123025
+ break;
123026
+ case DatabaseWizardSteps.Database:
123027
+ await createModeDatabaseFromSubmit(this);
123028
+ break;
123029
+ case DatabaseWizardSteps.Configuration:
123030
+ await createModeConfigurationFromSubmit(this);
123031
+ break;
123032
+ case DatabaseWizardSteps.Confirmation:
123033
+ this.$processStatus.getState()?.state === ProcessState.Running ? await cancelDatabaseProcess(this) : await createModeConfirmationFromSubmit(this);
123034
+ break;
123035
+ case DatabaseWizardSteps.UploadSettings:
123036
+ await createModeUploadSettingsFromSubmit(this);
123037
+ break;
123038
+ }
123039
+ } else if (this.$mode.getState() === DatabaseWizardMode.Add) {
123040
+ switch (step) {
123041
+ case DatabaseWizardSteps.SQLServer:
123042
+ await createModeSQlServerFromSubmit(this);
123043
+ break;
123044
+ case DatabaseWizardSteps.Database:
123045
+ await addModeDatabaseFromSubmit(this);
123046
+ break;
123047
+ case DatabaseWizardSteps.Configuration:
123048
+ await addModeConfigurationFromSubmit(this);
123049
+ break;
123050
+ case DatabaseWizardSteps.Confirmation:
123051
+ await addModeConfirmationFromSubmit(this);
123052
+ break;
123053
+ case DatabaseWizardSteps.Update:
123054
+ await addModeUpdateFromSubmit(this);
123055
+ break;
123056
+ case DatabaseWizardSteps.UploadSettings:
123057
+ await createModeUploadSettingsFromSubmit(this);
123058
+ break;
123059
+ }
123060
+ } else if (this.$mode.getState() === DatabaseWizardMode.Update) {
123061
+ switch (step) {
123062
+ case DatabaseWizardSteps.Configuration:
123063
+ await updateModeConfigurationFromSubmit(this);
123064
+ break;
123065
+ case DatabaseWizardSteps.Confirmation:
123066
+ await updateModeConfirmationFromSubmit(this);
123067
+ break;
123068
+ case DatabaseWizardSteps.Update:
123069
+ await updateModeUpdateFromSubmit(this);
123070
+ break;
123071
+ case DatabaseWizardSteps.UploadSettings:
123072
+ await createModeUploadSettingsFromSubmit(this);
123073
+ break;
123074
+ }
123075
+ }
123076
+ });
123077
+ this.stepFormCancel = this.domain.event("stepFormCancel");
123078
+ this.stepFormCancelFx = this.domain.effect(async () => {
123079
+ if (this.$mode.getState() === DatabaseWizardMode.Create) {
123080
+ if (this.$activeStep.getState().step === DatabaseWizardSteps.Confirmation && this.$processStatus.getState()?.state === ProcessState.Running) {
123081
+ await this.options.services.messageWindow.showConfirmation(this.options.services.resources.DatabaseWizard_CancelCreationConfirmation);
123082
+ await cancelDatabaseProcess(this);
123083
+ }
123084
+ } else {
123085
+ if (this.$activeStep.getState().step === DatabaseWizardSteps.Update && this.$processStatus.getState()?.state === ProcessState.Running) {
123086
+ await this.options.services.messageWindow.showConfirmation(this.options.services.resources.DatabaseWizard_CancelCreationConfirmation);
123087
+ await cancelDatabaseProcess(this);
123088
+ }
123089
+ }
123090
+ if (!!this.$alias.getState()) {
123091
+ this.options.services.databaseMasterController.deleteState(this.$serviceId.getState(), this.$alias.getState());
123092
+ }
123093
+ this.setIsOpen(false);
123094
+ if (this.$stateWasChanged.getState()) {
123095
+ this.options.databaseChangeStateEvent?.();
123096
+ }
123097
+ });
123098
+ this.stepFormDone = this.domain.event("stepFormOnsubmit");
123099
+ this.stepFormDoneFx = this.domain.effect(async () => {
123100
+ this.options.services.databaseMasterController.deleteState(this.$serviceId.getState(), this.$alias.getState());
123101
+ this.setIsOpen(false);
123102
+ if (this.$stateWasChanged.getState()) {
123103
+ this.options.databaseChangeStateEvent?.();
123104
+ }
123105
+ });
123106
+ this.toggleLibrary = this.domain.event("toggleLibrary");
123107
+ this.toggleLibraryFx = this.domain.effect(async (library) => {
123108
+ let selectedLibraries = [...this.$selectedLibraries.getState()];
123109
+ const availableLibraries = this.$availableLibraries.getState();
123110
+ let haveDependencyLibrary = false;
123111
+ let confirmationMessage = "";
123112
+ let isUncheck = false;
123113
+ const toggleSelectedLibraries = (library2) => {
123114
+ if (isUncheck || selectedLibraries.find((l) => l.name === library2.name)) {
123115
+ selectedLibraries = selectedLibraries.filter((l) => l.name !== library2.name);
123116
+ isUncheck = true;
123117
+ selectedLibraries.forEach((selectedLibrary) => {
123118
+ selectedLibrary.libraryDependencies.forEach((dependency) => {
123119
+ if (library2.alias === dependency.alias) {
123120
+ const availableLibrary = availableLibraries.find((l) => selectedLibrary.alias === l.alias);
123121
+ if (availableLibrary) {
123122
+ haveDependencyLibrary = true;
123123
+ confirmationMessage = this.options.services.resources.DatabaseWizard_UncheckLibraryConfirmation;
123124
+ toggleSelectedLibraries(availableLibrary);
123125
+ }
123126
+ }
123127
+ });
123128
+ });
123129
+ } else {
123130
+ selectedLibraries.push(library2);
123131
+ library2.libraryDependencies.forEach((dependency) => {
123132
+ if (!selectedLibraries.some((selectedLibrary) => selectedLibrary.alias === dependency.alias)) {
123133
+ const availableLibrary = availableLibraries.find((l) => dependency.alias === l.alias);
123134
+ if (availableLibrary && availableLibrary.canUpdate) {
123135
+ haveDependencyLibrary = true;
123136
+ confirmationMessage = this.options.services.resources.DatabaseWizard_CheckLibraryConfirmation;
123137
+ toggleSelectedLibraries(availableLibrary);
123138
+ }
123139
+ }
123140
+ });
123141
+ }
123142
+ };
123143
+ toggleSelectedLibraries(library);
123144
+ if (!isUncheck) {
123145
+ selectedLibraries = checkRequiredLibrary(availableLibraries, selectedLibraries);
123146
+ }
123147
+ if (haveDependencyLibrary) {
123148
+ if (haveDependencyLibrary) {
123149
+ try {
123150
+ await this.options.services.messageWindow.showConfirmation(confirmationMessage);
123151
+ } catch (e2) {
123152
+ console.log("unconfirmed check library");
123153
+ return;
123154
+ }
123155
+ }
123156
+ }
123157
+ this.setSelectedLibraries([...selectedLibraries]);
123158
+ });
123159
+ this.$serverType = this.domain.createStore(ServerType.PostgreSQL, { name: "$serverType" });
123160
+ this.$serverName = this.domain.createStore("", { name: "$serverName" });
123161
+ this.$authentication = this.domain.createStore("SQLServer", { name: "$authentication" });
123162
+ this.$port = this.domain.createStore(DEFAULT_PORT, { name: "$port" });
123163
+ this.$login = this.domain.createStore("", { name: "$login" });
123164
+ this.$password = this.domain.createStore("", { name: "$password" });
123165
+ this.$databaseName = this.domain.createStore("", { name: "$databaseName" });
123166
+ this.$alias = this.domain.createStore("", { name: "$alias" });
123167
+ this.$locationType = this.domain.createStore(DBFIleLocationType.Standard, { name: "$placementType" });
123168
+ this.$locationPath = this.domain.createStore("", { name: "$placementPath" });
123169
+ this.$tablesPlacements = this.domain.createStore(getDefaultPlacementsTables(), { name: "$placementPath" });
123170
+ this.$localeId = this.domain.createStore(DEFAULT_LOCALE_ID, { name: "$language" });
123171
+ this.$availableLibraries = this.domain.createStore([], { name: "$availableLibraries" });
123172
+ this.$selectedLibraries = this.domain.createStore([], { name: "$selectedLibraries" });
123173
+ this.$disabledLibraries = this.domain.createStore([], { name: "$disabledLibraries" });
123174
+ this.$operationTimeout = this.domain.createStore(DEFAULT_OPERATION_TIMEOUT, { name: "$operationTimeout" });
123175
+ this.$solutions = this.domain.createStore([], { name: "$modules" });
123176
+ this.$haveCheckedSolutions = this.domain.createStore(false, { name: "$haveCheckedSolutions" });
123177
+ this.setServerType = this.domain.event();
123178
+ this.setServerName = this.domain.event();
123179
+ this.setAuthentication = this.domain.event();
123180
+ this.setPort = this.domain.event();
123181
+ this.setLogin = this.domain.event();
123182
+ this.setPassword = this.domain.event();
123183
+ this.setDatabaseName = this.domain.event();
123184
+ this.setAlias = this.domain.event();
123185
+ this.setLocationType = this.domain.event();
123186
+ this.setLocationPath = this.domain.event();
123187
+ this.setTablesPlacements = this.domain.event();
123188
+ this.setLocaleId = this.domain.event();
123189
+ this.setAvailableLibraries = this.domain.event();
123190
+ this.setSelectedLibraries = this.domain.event();
123191
+ this.setDisabledLibraries = this.domain.event();
123192
+ this.setOperationTimeout = this.domain.event();
123193
+ this.setSolutions = this.domain.event();
123194
+ this.setHaveCheckedSolutions = this.domain.event();
123195
+ this.onBeforeWindowUnload = (e2) => {
123196
+ if (this.$processStatus.getState()?.state !== ProcessState.Running) {
123197
+ if (e2) {
123198
+ e2.returnValue = this.options.services.resources.TabCloseConfirmation || true;
123199
+ }
123200
+ return this.options.services.resources.TabCloseConfirmation || true;
123201
+ }
123202
+ };
123203
+ }
123204
+ getServerParameters() {
123205
+ return {
123206
+ serverName: this.$serverName.getState(),
123207
+ serverType: this.$serverType.getState(),
123208
+ user: this.$login.getState(),
123209
+ password: this.$password.getState(),
123210
+ port: this.$port.getState(),
123211
+ integratedSecurity: this.$authentication.getState() === "SQL Server",
123212
+ passwordChanged: this.$password.getState() ? true : false
123213
+ };
123214
+ }
123215
+ getDatabaseParameters() {
123216
+ return {
123217
+ alias: this.$alias.getState(),
123218
+ databaseName: this.$databaseName.getState()
123219
+ };
123220
+ }
123221
+ initSettings() {
123222
+ if (!this.options?.services) {
123223
+ return;
123224
+ }
123225
+ }
123226
+ async initUpdateMode() {
123227
+ if (this.options.alias) {
123228
+ this.setAlias(this.options.alias);
123229
+ this.setLoading(true);
123230
+ const allDatabaseConfigurations = await this.options.services.databasesConfigurationController.all(this.options.serviceId);
123231
+ const databaseConfiguration = allDatabaseConfigurations.find((item) => item.alias === this.options.alias);
123232
+ if (!databaseConfiguration || databaseConfiguration.databaseState !== DatabaseState.Attached) {
123233
+ this.setSubmitErrorMessage(this.options.services.resources.DatabaseWizardErrors_DatabaseNotAttached);
123234
+ return;
123235
+ }
123236
+ this.setServerType(databaseConfiguration.databaseType === DatabaseType.SQL ? ServerType["MS SQL SERVER"] : ServerType.PostgreSQL);
123237
+ this.setServerName(databaseConfiguration.serverName);
123238
+ this.setDatabaseName(databaseConfiguration.databaseName);
123239
+ await this.options.services.databaseMasterController.setState(this.options.serviceId, {
123240
+ masterType: DatabaseWizardMode.Update,
123241
+ currentPageName: "Configuration",
123242
+ databaseParameters: {
123243
+ alias: this.options.alias,
123244
+ databaseName: databaseConfiguration.databaseName
123245
+ },
123246
+ scriptGenerationParameters: this.$tablesPlacements.getState()
123247
+ });
123248
+ await this.getLibraries();
123249
+ this.setLoading(false);
123250
+ }
123251
+ }
123252
+ async getLibraries() {
123253
+ const alias = this.$alias.getState() || this.options.alias;
123254
+ const scriptModel = await this.options.services.databasesController.libraries(this.options.serviceId, alias);
123255
+ this.setAvailableLibraries(scriptModel.libraries);
123256
+ const selectedLibraries = [];
123257
+ const disabledLibraries = [];
123258
+ scriptModel.libraries.forEach((library) => {
123259
+ if (library.canUpdate) {
123260
+ selectedLibraries.push(library);
123261
+ } else {
123262
+ disabledLibraries.push(library);
123263
+ }
123264
+ if (library.id?.toLowerCase() === OFFICE_WORK_LIBRARY_ID) {
123265
+ disabledLibraries.push(library);
123266
+ }
123267
+ });
123268
+ this.setSelectedLibraries(selectedLibraries);
123269
+ this.setDisabledLibraries(disabledLibraries);
123270
+ this.setScriptGeneratorVersion(scriptModel.scriptGeneratorVersion);
123271
+ }
123272
+ async getSolutions() {
123273
+ const alias = this.$alias.getState() || this.options.alias;
123274
+ let availableSolutions;
123275
+ try {
123276
+ availableSolutions = await this.options.services.databasesController.solutions(this.options.serviceId, alias);
123277
+ } catch (e2) {
123278
+ this.setSubmitErrorMessage(e2.message);
123279
+ }
123280
+ const solutions = availableSolutions.map((solution) => {
123281
+ return {
123282
+ ...solution,
123283
+ selected: solution.canUpdate || this.$mode.getState() === DatabaseWizardMode.Create || isRequiredSolution(solution),
123284
+ disabled: !solution.canUpdate && this.$mode.getState() !== DatabaseWizardMode.Create || isRequiredSolution(solution)
123285
+ };
123286
+ });
123287
+ this.setSolutions(solutions);
123288
+ }
123289
+ toggleSolution(solution) {
123290
+ if (solution.disabled) {
123291
+ return;
123292
+ }
123293
+ if (solution.selected) {
123294
+ solution.selected = false;
123295
+ } else {
123296
+ solution.selected = true;
123297
+ }
123298
+ this.setSolutions([...this.$solutions.getState()]);
123299
+ }
123300
+ initExitingModel() {
123301
+ const model = this.options.model;
123302
+ if (!model) return;
123303
+ model.databaseParameters?.alias && this.setAlias(model.databaseParameters.alias);
123304
+ model.databaseParameters?.databaseName && this.setDatabaseName(model.databaseParameters.databaseName);
123305
+ model.serverParameters?.serverName && this.setServerName(model.serverParameters.serverName);
123306
+ model.serverParameters?.serverType && this.setServerType(model.serverParameters.serverType);
123307
+ model.serverParameters?.user && this.setLogin(model.serverParameters.user);
123308
+ model.serverParameters?.port && this.setPort(model.serverParameters.port);
123309
+ model.serverParameters?.password && this.setPassword(model.serverParameters.password);
123310
+ model.serverParameters?.integratedSecurity && this.setAuthentication(model.serverParameters.integratedSecurity ? "SQL Server" : "Windows");
123311
+ model.scriptGenerationParameters && this.setTablesPlacements(model.scriptGenerationParameters);
123312
+ model.masterType && this.setMode(model.masterType);
123313
+ model.scriptGenerationParameters && this.setTablesPlacements(model.scriptGenerationParameters);
123314
+ model.localeId && this.setLocaleId(model.localeId);
123315
+ model.dbFilePath && this.setLocationPath(model.dbFilePath);
123316
+ model.timeout && this.setOperationTimeout(model.timeout);
123317
+ if (model.lastProcessError) {
123318
+ this.setSubmitErrorMessage(model.lastProcessError);
123319
+ this.setProcessStatus({ state: ProcessState.Error, errorMessage: model.lastProcessError });
123320
+ }
123321
+ if (model.state) {
123322
+ let processStatusState = null;
123323
+ switch (model.state) {
123324
+ case IDatabaseMasterState.SolutionInProcess:
123325
+ case IDatabaseMasterState.DatabaseInProcess:
123326
+ processStatusState = ProcessState.Running;
123327
+ break;
123328
+ case IDatabaseMasterState.SolutionProcessFinished:
123329
+ case IDatabaseMasterState.DatabaseProcessFinished:
123330
+ processStatusState = ProcessState.Finished;
123331
+ break;
123332
+ }
123333
+ this.setProcessStatus({ state: processStatusState });
123334
+ }
123335
+ if (model.currentPageName) {
123336
+ const step = this.$steps.getState().find((step2) => step2.step === DatabaseWizardSteps[model.currentPageName]);
123337
+ this.setActiveStep(step);
123338
+ }
123339
+ }
123340
+ init(options) {
123341
+ this.initSettings();
123342
+ this.$steps.on(this.setSteps, (_2, steps2) => steps2);
123343
+ this.$activeStep.on(this.setActiveStep, (_2, newStep) => newStep).on(this.goToStep, (_2, targetStep) => {
123344
+ return this.$steps.getState().find((step) => step.step === targetStep);
123345
+ });
123346
+ const steps = getDatabaseWizardModeSteps(options.mode, options.services);
123347
+ this.setActiveStep(steps[0]);
123348
+ this.setSteps(steps);
123349
+ this.markStepsStatusFx(steps[0]);
123350
+ this.stepFormSubmit.watch(() => {
123351
+ this.stepFormSubmitFx();
123352
+ });
123353
+ this.stepFormCancel.watch(() => {
123354
+ this.stepFormCancelFx();
123355
+ });
123356
+ this.stepFormDone.watch(() => {
123357
+ this.stepFormDoneFx();
123358
+ });
123359
+ v({
123360
+ source: this.$activeStep,
123361
+ target: [this.markStepsStatusFx]
123362
+ });
123363
+ this.nextStep.watch(() => {
123364
+ this.setSubmitErrorMessage(null);
123365
+ const currentStep = this.$activeStep.getState();
123366
+ const steps2 = this.$steps.getState();
123367
+ this.goToStep(steps2[currentStep.order].step);
123368
+ });
123369
+ this.previousStep.watch(() => {
123370
+ const currentStep = this.$activeStep.getState();
123371
+ const steps2 = this.$steps.getState();
123372
+ this.goToStep(steps2[currentStep.order - 2].step);
123373
+ });
123374
+ this.$existingBases.on(this.setExistingBases, (_2, value) => value);
123375
+ this.$serviceId.on(this.setServiceId, (_2, value) => value);
123376
+ this.$loading.on(this.setLoading, (_2, value) => value);
123377
+ this.$isOpen.on(this.setIsOpen, (_2, value) => value);
123378
+ this.$stateWasChanged.on(this.setStateWasChanged, (_2, value) => value);
123379
+ this.$serverType.on(this.setServerType, (_2, value) => value);
123380
+ this.$serverName.on(this.setServerName, (_2, value) => value);
123381
+ this.$authentication.on(this.setAuthentication, (_2, value) => value);
123382
+ this.$port.on(this.setPort, (_2, value) => value);
123383
+ this.$login.on(this.setLogin, (_2, value) => value);
123384
+ this.$password.on(this.setPassword, (_2, value) => value);
123385
+ this.$databaseName.on(this.setDatabaseName, (_2, value) => value);
123386
+ this.$alias.on(this.setAlias, (_2, value) => value?.toLowerCase());
123387
+ this.$locationType.on(this.setLocationType, (_2, value) => value);
123388
+ this.$locationPath.on(this.setLocationPath, (_2, value) => value);
123389
+ this.$tablesPlacements.on(this.setTablesPlacements, (_2, value) => value);
123390
+ this.$localeId.on(this.setLocaleId, (_2, value) => value);
123391
+ this.$availableLibraries.on(this.setAvailableLibraries, (_2, value) => value.sort((a2, b2) => a2.name.localeCompare(b2.name)));
123392
+ this.$selectedLibraries.on(this.setSelectedLibraries, (_2, value) => value);
123393
+ this.$disabledLibraries.on(this.setDisabledLibraries, (_2, value) => value);
123394
+ this.$operationTimeout.on(this.setOperationTimeout, (_2, value) => value);
123395
+ this.$solutions.on(this.setSolutions, (_2, value) => {
123396
+ this.setHaveCheckedSolutions(value.some((s2) => s2.selected));
123397
+ return value;
123398
+ });
123399
+ this.$haveCheckedSolutions.on(this.setHaveCheckedSolutions, (_2, value) => value);
123400
+ this.$passwordChanged.on(this.setPassword, () => true);
123401
+ this.$submitErrorMessage.on(this.setSubmitErrorMessage, (_2, value) => value);
123402
+ this.$processStatus.on(this.setProcessStatus, (_2, value) => value);
123403
+ this.$scriptGeneratorVersion.on(this.setScriptGeneratorVersion, (_2, value) => value);
123404
+ this.$mode.on(this.setMode, (_2, value) => value);
123405
+ this.setMode(options.mode);
123406
+ this.$processIsCancelling.on(this.setProcessIsCancelling, (_2, value) => value);
123407
+ this.setServiceId(options.serviceId);
123408
+ this.toggleLibrary.watch((library) => {
123409
+ this.toggleLibraryFx(library);
123410
+ });
123411
+ if (options.mode === DatabaseWizardMode.Update) {
123412
+ this.initUpdateMode();
123413
+ }
123414
+ if (options.model) {
123415
+ this.initExitingModel();
123416
+ }
123417
+ this.$isOpen.watch((value) => {
123418
+ if (!value) {
123419
+ window.removeEventListener("beforeunload", this.onBeforeWindowUnload);
123420
+ } else {
123421
+ window.addEventListener("beforeunload", this.onBeforeWindowUnload);
123422
+ }
123423
+ });
123424
+ }
123425
+ }
123426
+ function DatabaseWizardStepLabel(props) {
123427
+ let iconComponent = null;
123428
+ switch (props.stepStatus) {
123429
+ case DatabaseWizardStepStatus.Active:
123430
+ iconComponent = /* @__PURE__ */ jsx("svg", { className: "database-wizard__step-label-icon", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { fill: "white", d: "M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z" }) });
123431
+ break;
123432
+ case DatabaseWizardStepStatus.Finished:
123433
+ iconComponent = /* @__PURE__ */ jsx("svg", { className: "database-wizard__step-label-icon", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { fill: "white", d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" }) });
123434
+ break;
123435
+ default:
123436
+ iconComponent = /* @__PURE__ */ jsx("span", { className: "database-wizard__step-label-number", children: props.number });
123437
+ }
123438
+ return /* @__PURE__ */ jsxs("div", { className: classNames("database-wizard__step-label-wrapper", {
123439
+ "database-wizard__step-label-wrapper_active": props.stepStatus === DatabaseWizardStepStatus.Active,
123440
+ "database-wizard__step-label-wrapper_finished": props.stepStatus === DatabaseWizardStepStatus.Finished,
123441
+ "database-wizard__step-label-wrapper_no-clickable": !props.clickable
123442
+ }), ...props, children: [
123443
+ /* @__PURE__ */ jsx("div", { className: "database-wizard__step-label-icon-circle", children: iconComponent }),
123444
+ /* @__PURE__ */ jsx("span", { className: "database-wizard__step-label-text", children: props.text })
123445
+ ] });
123446
+ }
123447
+ function DatabaseWizardModal(props) {
123448
+ return /* @__PURE__ */ jsx(
123449
+ ModalDialog$2,
123450
+ {
123451
+ className: "database-wizard__modal",
123452
+ headerClass: "database-wizard__modal-header",
123453
+ closeButtonClass: "database-wizard__modal-close-button",
123454
+ showButtonsPanel: false,
123455
+ ...props
123456
+ }
123457
+ );
123458
+ }
123459
+ function DatabaseWizardHeader(props) {
123460
+ return /* @__PURE__ */ jsxs("h2", { className: "database-wizard__modal-header", ...props, children: [
123461
+ /* @__PURE__ */ jsx("svg", { className: "database-wizard__modal-header-icon", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { fill: "currentColor", d: "M21 22H3V20H21V22M19 19H5L11.1 2.6C11.3 2.2 11.6 2 12 2L18 5H13.9L19 19M10 7.5L11.04 7.97L11.5 9L11.97 7.97L13 7.5L11.97 7.03L11.5 6L11.04 7.03L10 7.5M13 15L10.94 14.07L10 12L9.07 14.07L7 15L9.07 15.93L10 18L10.94 15.93L13 15M13.97 11.97L15 11.5L13.97 11.03L13.5 10L13.04 11.03L12 11.5L13.04 11.97L13.5 13L13.97 11.97M15.97 15.97L17 15.5L15.97 15.03L15.5 14L15.04 15.03L14 15.5L15.04 15.97L15.5 17L15.97 15.97Z" }) }),
123462
+ props.text
123463
+ ] });
123464
+ }
123465
+ function DatabaseWizardStepLabelsWrapper(props) {
123466
+ return /* @__PURE__ */ jsx("div", { ...props, className: "database-wizard__step-labels-wrapper" });
123467
+ }
123468
+ function DatabaseWizardContentBlock(props) {
123469
+ const { expandable, expanded, header, ...divProps } = props;
123470
+ const [isExpanded, setIsExpanded] = useState(expandable || expanded);
123471
+ useEffect(() => {
123472
+ setIsExpanded(!expandable || expanded);
123473
+ }, [expanded]);
123474
+ const onExpand = () => {
123475
+ expandable && setIsExpanded(!isExpanded);
123476
+ };
123477
+ return /* @__PURE__ */ jsxs("div", { ...divProps, className: classNames("database-wizard__content-block", props.className, {
123478
+ "database-wizard__content-block_expandable": expandable,
123479
+ "database-wizard__content-block_expanded": isExpanded
123480
+ }), children: [
123481
+ header && /* @__PURE__ */ jsxs(
123482
+ "div",
123483
+ {
123484
+ className: classNames(
123485
+ "database-wizard__content-block-header",
123486
+ { "database-wizard__content-block-header_expandable": expandable }
123487
+ ),
123488
+ onClick: onExpand,
123489
+ children: [
123490
+ expandable && /* @__PURE__ */ jsx("svg", { className: "database-wizard__content-block-expand-icon", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { d: "M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z" }) }),
123491
+ header
123492
+ ]
123493
+ }
123494
+ ),
123495
+ divProps.children
123496
+ ] });
123497
+ }
123498
+ function DatabaseWizardButtonPanel(props) {
123499
+ const { active, ...divProps } = props;
123500
+ const activeClass = active ? "database-wizard__buttons-panel_active" : "";
123501
+ return /* @__PURE__ */ jsx("div", { className: `database-wizard__buttons-panel ${activeClass}`, ...divProps });
123502
+ }
123503
+ function DatabaseForm(props) {
123504
+ const { logic, view } = props;
123505
+ const $databaseName = e(logic.$databaseName);
123506
+ const $alias = e(logic.$alias);
123507
+ const $locationType = e(logic.$locationType);
123508
+ const $locationPath = e(logic.$locationPath);
123509
+ const $localeId = e(logic.$localeId);
123510
+ const $tablesPlacements = e(logic.$tablesPlacements);
123511
+ const $existingBases = e(logic.$existingBases);
123512
+ const $serverType = e(logic.$serverType);
123513
+ const $loading = e(logic.$loading);
123514
+ const $submitErrorMessage = e(logic.$submitErrorMessage);
123515
+ const $mode = e(logic.$mode);
123516
+ const { register, handleSubmit, control, ...methods } = useForm(
123517
+ {
123518
+ mode: "onTouched",
123519
+ values: {
123520
+ databaseName: $databaseName,
123521
+ alias: $alias,
123522
+ locationType: $locationType,
123523
+ locationPath: $locationPath,
123524
+ localeId: $localeId,
123525
+ tablesPlacements: $tablesPlacements
123526
+ }
123527
+ }
123528
+ );
123529
+ const onTablePlacementItemChange = (item, value) => {
123530
+ if (typeof value === "boolean") {
123531
+ $tablesPlacements[item] = value;
123532
+ } else {
123533
+ $tablesPlacements[item] = TableLocationTypeExtended[value];
123534
+ }
123535
+ logic.setTablesPlacements({ ...$tablesPlacements });
123536
+ };
123537
+ const getTableLocationItems = () => {
123538
+ const items = [];
123539
+ Object.keys($tablesPlacements).map((param, index) => {
123540
+ let options = [];
123541
+ let selectedDisplayValue = null;
123542
+ if (typeof $tablesPlacements[param] === "boolean") {
123543
+ options.push({ displayValue: props.services.resources.On, value: true });
123544
+ options.push({ displayValue: props.services.resources.Off, value: false });
123545
+ selectedDisplayValue = $tablesPlacements[param] ? true : false;
123546
+ } else if (param === "changedObjectDataBaseType") {
123547
+ options = getTableLocationTypeExtendedNames().map((typeLocationName) => {
123548
+ return { displayValue: typeLocationName, value: typeLocationName };
123549
+ });
123550
+ selectedDisplayValue = TableLocationTypeExtended[$tablesPlacements[param]];
123551
+ } else {
123552
+ options = getTableLocationTypeNames().map((typeLocationName) => {
123553
+ return { displayValue: typeLocationName, value: typeLocationName };
123554
+ });
123555
+ selectedDisplayValue = TableLocationType[$tablesPlacements[param]];
123556
+ }
123557
+ items.push(
123558
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-row-wrapper database-wizard__step-form-row-wrapper_table-location", children: [
123559
+ /* @__PURE__ */ jsxs("label", { className: "database-wizard__step-form-option-label-select", id: param, htmlFor: param, children: [
123560
+ /* @__PURE__ */ jsxs("span", { className: "database-wizard__step-form-option-title", children: [
123561
+ props.services.resources[`DatabaseWizardTableLocation_${param}`],
123562
+ ":"
123563
+ ] }),
123564
+ /* @__PURE__ */ jsx("span", { className: "database-wizard__step-form-option-description", children: param })
123565
+ ] }),
123566
+ /* @__PURE__ */ jsx(FormControl$3, { disabled: $loading, size: "small", children: /* @__PURE__ */ jsx(
123567
+ Select$3,
123568
+ {
123569
+ ...commonMuiProps.select,
123570
+ variant: "outlined",
123571
+ name: param,
123572
+ labelId: param,
123573
+ value: selectedDisplayValue,
123574
+ onChange: (e2) => {
123575
+ onTablePlacementItemChange(param, e2.target.value);
123576
+ },
123577
+ disabled: $loading,
123578
+ children: options.map((option, index2) => /* @__PURE__ */ jsx(MenuItem$2, { value: option.value, children: option.displayValue }, index2))
123579
+ }
123580
+ ) })
123581
+ ] }, index)
123582
+ );
123583
+ });
123584
+ return items;
123585
+ };
123586
+ const getDBFileLocationOptions = () => {
123587
+ return getDBFileLocationTypeNames().map((typeLocationName) => {
123588
+ return {
123589
+ displayValue: props.services.resources[`DBFileLocation_${typeLocationName}`],
123590
+ value: DBFIleLocationType[typeLocationName]
123591
+ };
123592
+ });
123593
+ };
123594
+ const getLocaleIdOptions = () => {
123595
+ return getLocaleIdNames().map((localeIdOption) => {
123596
+ return {
123597
+ displayValue: props.services.resources[`Locale_${localeIdOption}`],
123598
+ value: LocaleId[localeIdOption]
123599
+ };
123600
+ });
123601
+ };
123602
+ const onDataBaseNameChange = (value) => {
123603
+ logic.setDatabaseName(value);
123604
+ logic.setAlias(value);
123605
+ };
123606
+ const databaseNameField = register("databaseName", {
123607
+ required: props.services.resources.Dialog_ValidationRequired,
123608
+ onChange: (e2) => onDataBaseNameChange(e2.target.value)
123609
+ });
123610
+ const locationPathField = register("locationPath", {
123611
+ disabled: $locationType !== DBFIleLocationType.Other,
123612
+ required: props.services.resources.Dialog_ValidationRequired,
123613
+ onChange: (e2) => logic.setLocationPath(e2.target.value)
123614
+ });
123615
+ const aliasInputRef = React__default.useRef(null);
123616
+ const [aliasInputSelection, setAliasInputSelection] = React__default.useState({ start: 0, end: 0, direction: "forward" });
123617
+ useLayoutEffect(() => {
123618
+ aliasInputRef.current.setSelectionRange(aliasInputSelection.start, aliasInputSelection.end, aliasInputSelection.direction);
123619
+ }, [aliasInputSelection.start, aliasInputSelection.end, aliasInputSelection.direction]);
123620
+ const aliasField = register("alias", {
123621
+ required: props.services.resources.Dialog_ValidationRequired,
123622
+ onChange: (e2) => {
123623
+ const startPos = e2.target.selectionStart;
123624
+ const endPos = e2.target.selectionEnd;
123625
+ logic.setAlias(e2.target.value);
123626
+ setAliasInputSelection({ start: startPos, end: endPos, direction: "forward" });
123627
+ }
123628
+ });
123629
+ return /* @__PURE__ */ jsxs("form", { className: "database-wizard__step-form", ref: props.currentFormRef, onSubmit: handleSubmit(props.onSubmit), children: [
123630
+ /* @__PURE__ */ jsxs("fieldset", { disabled: $loading, className: "database-wizard__step-form-fieldset", children: [
123631
+ /* @__PURE__ */ jsxs(view.contentBlock, { header: getDatabaseWizardFormName(
123632
+ props.services,
123633
+ DatabaseWizardSteps.Database,
123634
+ $serverType === ServerType["MS SQL SERVER"] ? props.mode : DatabaseWizardMode.Add,
123635
+ "DBLocation"
123636
+ ), children: [
123637
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-row-wrapper", children: [
123638
+ /* @__PURE__ */ jsxs("label", { htmlFor: "databaseName", children: [
123639
+ props.services.resources.DatabaseWizardLabel_DatabaseName,
123640
+ ":"
123641
+ ] }),
123642
+ /* @__PURE__ */ jsx(
123643
+ TextField$3,
123644
+ {
123645
+ ...databaseNameField,
123646
+ id: "databaseName",
123647
+ value: $databaseName,
123648
+ error: !!methods.formState.errors.databaseName,
123649
+ helperText: methods.formState.errors.databaseName?.message,
123650
+ autoComplete: "off",
123651
+ variant: "outlined",
123652
+ size: "small",
123653
+ slotProps: { htmlInput: { list: "existing-bases" } },
123654
+ placeholder: props.services.resources.DatabaseWizard_DatabaseNamePlaceholder
123655
+ }
123656
+ ),
123657
+ /* @__PURE__ */ jsx("datalist", { id: "existing-bases", children: $existingBases && $existingBases.map((item, index) => /* @__PURE__ */ jsx("option", { value: item }, index)) })
123658
+ ] }),
123659
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-row-wrapper", children: [
123660
+ /* @__PURE__ */ jsxs("label", { htmlFor: "alias", children: [
123661
+ props.services.resources.DatabaseWizardLabel_Alias,
123662
+ ":"
123663
+ ] }),
123664
+ /* @__PURE__ */ jsx(
123665
+ TextField$3,
123666
+ {
123667
+ ...aliasField,
123668
+ id: "alias",
123669
+ value: $alias,
123670
+ error: !!methods.formState.errors.alias,
123671
+ helperText: methods.formState.errors.alias?.message,
123672
+ autoComplete: "off",
123673
+ variant: "outlined",
123674
+ size: "small",
123675
+ slotProps: {
123676
+ htmlInput: { ref: aliasInputRef },
123677
+ input: { style: { textTransform: "lowercase" } }
123678
+ }
123679
+ }
123680
+ )
123681
+ ] }),
123682
+ $mode === DatabaseWizardMode.Create && $serverType === ServerType["MS SQL SERVER"] && /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-row-wrapper", children: [
123683
+ /* @__PURE__ */ jsx("label", { id: "locationTypeLabel", htmlFor: "locationType", children: props.services.resources.DatabaseWizardLabel_LocationType }),
123684
+ /* @__PURE__ */ jsx(FormControl$3, { disabled: $loading, size: "small", children: /* @__PURE__ */ jsx(
123685
+ Select$3,
123686
+ {
123687
+ ...commonMuiProps.select,
123688
+ variant: "outlined",
123689
+ name: "locationType",
123690
+ labelId: "locationTypeLabel",
123691
+ value: $locationType,
123692
+ onChange: (e2) => {
123693
+ logic.setLocationType(e2.target.value);
123694
+ },
123695
+ disabled: $loading,
123696
+ children: getDBFileLocationOptions().map((option, index) => /* @__PURE__ */ jsx(MenuItem$2, { value: option.value, children: option.displayValue }, index))
123697
+ }
123698
+ ) })
123699
+ ] }),
123700
+ $locationType === DBFIleLocationType.Other && $serverType === ServerType["MS SQL SERVER"] && /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-row-wrapper", children: [
123701
+ /* @__PURE__ */ jsx("label", { htmlFor: "locationPath", children: props.services.resources.DatabaseWizardLabel_LocationPath }),
123702
+ /* @__PURE__ */ jsx(
123703
+ TextField$3,
123704
+ {
123705
+ ...locationPathField,
123706
+ id: "locationPath",
123707
+ value: $locationPath,
123708
+ error: !!methods.formState.errors.locationPath,
123709
+ helperText: methods.formState.errors.locationPath?.message,
123710
+ autoComplete: "off",
123711
+ variant: "outlined",
123712
+ size: "small"
123713
+ }
123714
+ )
123715
+ ] }),
123716
+ $serverType === ServerType["MS SQL SERVER"] && /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-row-wrapper", children: [
123717
+ /* @__PURE__ */ jsx("label", { id: "localeIdLabel", htmlFor: "localeId", children: props.services.resources.DatabaseWizardLabel_LocaleId }),
123718
+ /* @__PURE__ */ jsx(FormControl$3, { disabled: $loading, size: "small", children: /* @__PURE__ */ jsx(
123719
+ Select$3,
123720
+ {
123721
+ ...commonMuiProps.select,
123722
+ variant: "outlined",
123723
+ labelId: "localeIdLabel",
123724
+ name: "localeId",
123725
+ value: $localeId,
123726
+ onChange: (e2) => {
123727
+ logic.setLocaleId(e2.target.value);
123728
+ },
123729
+ disabled: $loading,
123730
+ children: getLocaleIdOptions().map((option, index) => /* @__PURE__ */ jsx(MenuItem$2, { value: option.value, children: option.displayValue }, index))
123731
+ }
123732
+ ) })
123733
+ ] })
123734
+ ] }),
123735
+ $serverType === ServerType["MS SQL SERVER"] && /* @__PURE__ */ jsx(
123736
+ view.contentBlock,
123737
+ {
123738
+ header: getDatabaseWizardFormName(props.services, DatabaseWizardSteps.Database, null, "TableLocation"),
123739
+ expandable: true,
123740
+ expanded: false,
123741
+ children: getTableLocationItems()
123742
+ }
123743
+ )
123744
+ ] }),
123745
+ /* @__PURE__ */ jsx("div", { className: "database-wizard__step-form-submit-error", children: $submitErrorMessage })
123746
+ ] });
123747
+ }
123748
+ function ConfigurationForm(props) {
123749
+ const { logic, view } = props;
123750
+ const $availableLibraries = e(logic.$availableLibraries);
123751
+ const $selectedLibraries = e(logic.$selectedLibraries);
123752
+ const $disabledLibraries = e(logic.$disabledLibraries);
123753
+ const $loading = e(logic.$loading);
123754
+ const $submitErrorMessage = e(logic.$submitErrorMessage);
123755
+ const $scriptGeneratorVersion = e(logic.$scriptGeneratorVersion);
123756
+ const { register, handleSubmit, control, ...methods } = useForm();
123757
+ return /* @__PURE__ */ jsxs("form", { className: "database-wizard__step-form", ref: props.currentFormRef, onSubmit: handleSubmit(props.onSubmit), children: [
123758
+ /* @__PURE__ */ jsx("fieldset", { disabled: $loading, className: "database-wizard__step-form-fieldset", children: /* @__PURE__ */ jsx(
123759
+ view.contentBlock,
123760
+ {
123761
+ className: "database-wizard__content-block_configuration",
123762
+ header: getDatabaseWizardFormName(props.services, DatabaseWizardSteps.Configuration),
123763
+ children: !!$availableLibraries.length ? $availableLibraries.map((library) => /* @__PURE__ */ jsx(
123764
+ view.library,
123765
+ {
123766
+ services: props.services,
123767
+ scriptGeneratorVersion: $scriptGeneratorVersion,
123768
+ library,
123769
+ checked: !!$selectedLibraries.some((selectedLibrary) => selectedLibrary.name === library.name),
123770
+ disabled: !!$disabledLibraries.some((disabledLibrary) => disabledLibrary.name === library.name),
123771
+ disabledLibraries: $disabledLibraries,
123772
+ onChange: () => logic.toggleLibrary(library),
123773
+ selectedLibraries: $selectedLibraries
123774
+ },
123775
+ library.name
123776
+ )) : /* @__PURE__ */ jsxs(Fragment, { children: [
123777
+ /* @__PURE__ */ jsx(
123778
+ ContentLoader,
123779
+ {
123780
+ style: { width: "100%", height: "50px" },
123781
+ width: "100px",
123782
+ height: "50px",
123783
+ viewBox: "0 0 100 35",
123784
+ preserveAspectRatio: "none",
123785
+ children: /* @__PURE__ */ jsx("rect", { x: "4", y: "12", rx: "5", ry: "5", width: "93", height: "50px" })
123786
+ }
123787
+ ),
123788
+ /* @__PURE__ */ jsx(
123789
+ ContentLoader,
123790
+ {
123791
+ style: { width: "100%", height: "50px" },
123792
+ width: "100px",
123793
+ height: "50px",
123794
+ viewBox: "0 0 100 35",
123795
+ preserveAspectRatio: "none",
123796
+ children: /* @__PURE__ */ jsx("rect", { x: "4", y: "12", rx: "5", ry: "5", width: "93", height: "50px" })
123797
+ }
123798
+ ),
123799
+ /* @__PURE__ */ jsx(
123800
+ ContentLoader,
123801
+ {
123802
+ style: { width: "100%", height: "50px" },
123803
+ width: "100px",
123804
+ height: "50px",
123805
+ viewBox: "0 0 100 35",
123806
+ preserveAspectRatio: "none",
123807
+ children: /* @__PURE__ */ jsx("rect", { x: "4", y: "12", rx: "5", ry: "5", width: "93", height: "50px" })
123808
+ }
123809
+ ),
123810
+ /* @__PURE__ */ jsx(
123811
+ ContentLoader,
123812
+ {
123813
+ style: { width: "100%", height: "50px" },
123814
+ width: "100px",
123815
+ height: "50px",
123816
+ viewBox: "0 0 100 35",
123817
+ preserveAspectRatio: "none",
123818
+ children: /* @__PURE__ */ jsx("rect", { x: "4", y: "12", rx: "5", ry: "5", width: "93", height: "50px" })
123819
+ }
123820
+ )
123821
+ ] })
123822
+ }
123823
+ ) }),
123824
+ /* @__PURE__ */ jsx("div", { className: "database-wizard__step-form-submit-error", children: $submitErrorMessage })
123825
+ ] });
123826
+ }
123827
+ function ConfirmationForm(props) {
123828
+ const { logic, view } = props;
123829
+ const $operationTimeout = e(logic.$operationTimeout);
123830
+ const $databaseName = e(logic.$databaseName);
123831
+ const $alias = e(logic.$alias);
123832
+ const $localeId = e(logic.$localeId);
123833
+ const $serverType = e(logic.$serverType);
123834
+ const $serverName = e(logic.$serverName);
123835
+ const $loading = e(logic.$loading);
123836
+ const $submitErrorMessage = e(logic.$submitErrorMessage);
123837
+ const $processStatus = e(logic.$processStatus);
123838
+ const $processIsCancelling = e(logic.$processIsCancelling);
123839
+ const $mode = e(logic.$mode);
123840
+ const $port = e(logic.$port);
123841
+ const { register, handleSubmit, control, formState: { errors }, ...methods } = useForm(
123842
+ {
123843
+ mode: "onTouched",
123844
+ values: {
123845
+ operationTimeout: $operationTimeout
123846
+ }
123847
+ }
123848
+ );
123849
+ const operationTimeoutField = register("operationTimeout", {
123850
+ required: props.services.resources.Dialog_ValidationRequired,
123851
+ onChange: (e2) => logic.setOperationTimeout(e2.target.value)
123852
+ });
123853
+ const isStartBlockVisible = () => {
123854
+ return !$processStatus || $processStatus?.state === ProcessState.Canceled;
123855
+ };
123856
+ return /* @__PURE__ */ jsxs("form", { className: "database-wizard__step-form", ref: props.currentFormRef, onSubmit: handleSubmit(props.onSubmit), children: [
123857
+ /* @__PURE__ */ jsxs("fieldset", { disabled: $loading, className: "database-wizard__step-form-fieldset", children: [
123858
+ /* @__PURE__ */ jsxs(view.contentBlock, { header: getDatabaseWizardFormName(props.services, DatabaseWizardSteps.Confirmation, $mode), children: [
123859
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-row-wrapper", children: [
123860
+ /* @__PURE__ */ jsx("label", { htmlFor: "databaseName", children: props.services.resources.DatabaseWizardLabel_DatabaseName }),
123861
+ /* @__PURE__ */ jsx("span", { className: "database-wizard__step-form-confirm-value", children: $databaseName })
123862
+ ] }),
123863
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-row-wrapper", children: [
123864
+ /* @__PURE__ */ jsx("label", { htmlFor: "alias", children: props.services.resources.DatabaseWizardLabel_Alias }),
123865
+ /* @__PURE__ */ jsx("span", { className: "database-wizard__step-form-confirm-value", children: $alias })
123866
+ ] }),
123867
+ $serverType === ServerType["MS SQL SERVER"] && /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-row-wrapper", children: [
123868
+ /* @__PURE__ */ jsx("label", { children: props.services.resources.DatabaseWizardLabel_LocaleId }),
123869
+ /* @__PURE__ */ jsx("span", { className: "database-wizard__step-form-confirm-value", children: props.services.resources[`Locale_${LocaleId[$localeId]}`] })
123870
+ ] }),
123871
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-row-wrapper", children: [
123872
+ /* @__PURE__ */ jsx("label", { htmlFor: "serverType", children: props.services.resources.DatabaseWizardLabel_ServerType }),
123873
+ /* @__PURE__ */ jsx("span", { className: "database-wizard__step-form-confirm-value", children: ServerType[$serverType] })
123874
+ ] }),
123875
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-row-wrapper", children: [
123876
+ /* @__PURE__ */ jsx("label", { htmlFor: "serverName", children: props.services.resources.DatabaseWizardLabel_ServerName }),
123877
+ /* @__PURE__ */ jsx("span", { className: "database-wizard__step-form-confirm-value", children: $serverName })
123878
+ ] }),
123879
+ $serverType === ServerType.PostgreSQL && /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-row-wrapper", children: [
123880
+ /* @__PURE__ */ jsx("label", { htmlFor: "port", children: props.services.resources.DatabaseWizardLabel_Port }),
123881
+ /* @__PURE__ */ jsx("span", { className: "database-wizard__step-form-confirm-value", children: $port })
123882
+ ] }),
123883
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-row-wrapper", children: [
123884
+ /* @__PURE__ */ jsx("label", { htmlFor: "operationTimeout", children: props.services.resources.DatabaseWizardLabel_OperationTimeout }),
123885
+ /* @__PURE__ */ jsx(
123886
+ TextField$3,
123887
+ {
123888
+ size: "small",
123889
+ className: "database-wizard__step-form-input database-wizard__step-form-input_timeout",
123890
+ variant: "outlined",
123891
+ type: "number",
123892
+ ...operationTimeoutField,
123893
+ value: $operationTimeout
123894
+ }
123895
+ ),
123896
+ errors.operationTimeout && /* @__PURE__ */ jsx(ErrorMessage, { message: errors.operationTimeout.message?.toString() })
123897
+ ] })
123898
+ ] }),
123899
+ $mode === DatabaseWizardMode.Create && /* @__PURE__ */ jsxs(view.contentBlock, { header: null, className: "database-wizard__step-form-confirmation-wrapper", children: [
123900
+ (!$processStatus || $processStatus?.state === ProcessState.Canceled) && /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-attention-wrapper", children: [
123901
+ /* @__PURE__ */ jsxs("span", { className: "database-wizard__step-form-attention-text", children: [
123902
+ /* @__PURE__ */ jsx(WarningIcon, { fontSize: "large" }),
123903
+ props.services.resources.Attention
123904
+ ] }),
123905
+ props.services.resources.DatabaseWizard_StartAttention
123906
+ ] }),
123907
+ $processStatus?.state === ProcessState.Error && /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-attention-wrapper", children: [
123908
+ /* @__PURE__ */ jsx("span", { className: "database-wizard__step-form-attention-text database-wizard__step-form-attention-text_warning", children: /* @__PURE__ */ jsx(ErrorIcon, { fontSize: "large", color: "error" }) }),
123909
+ props.services.resources.DatabaseWizard_CreateError
123910
+ ] }),
123911
+ isStartBlockVisible() && /* @__PURE__ */ jsx(
123912
+ Button$3,
123913
+ {
123914
+ disabled: $processIsCancelling || $loading && $processStatus?.state !== ProcessState.Running,
123915
+ type: "submit",
123916
+ color: "primary",
123917
+ variant: "contained",
123918
+ className: "database-wizard__step-form-start-button",
123919
+ children: $processStatus?.state === ProcessState.Running ? props.services.resources.Cancel : props.services.resources.StartCreation
123920
+ }
123921
+ ),
123922
+ $processStatus?.state === ProcessState.Finished && /* @__PURE__ */ jsxs("span", { className: "database-wizard__step-form-attention-text database-wizard__step-form-attention-text_finished", children: [
123923
+ /* @__PURE__ */ jsx(CheckIcon$1, { fontSize: "large" }),
123924
+ " ",
123925
+ props.services.resources.DatabaseWizard_CreateFinished
123926
+ ] }),
123927
+ $processStatus?.state === ProcessState.Running && /* @__PURE__ */ jsx(LinearProgress$1, { className: "database-wizard__step-form-progress" })
123928
+ ] }),
123929
+ $processStatus?.state === ProcessState.Finished && /* @__PURE__ */ jsx(
123930
+ view.contentBlock,
123931
+ {
123932
+ header: null,
123933
+ className: "database-wizard__step-form-confirmation-wrapper database-wizard__step-form-confirmation-wrapper_finished",
123934
+ children: /* @__PURE__ */ jsxs("span", { className: "database-wizard__step-form-attention-text database-wizard__step-form-attention-text_finished-attention", children: [
123935
+ /* @__PURE__ */ jsx(HandPointRightIcon, { fontSize: "large" }),
123936
+ " ",
123937
+ props.services.resources.DatabaseWizard_FinishAttention
123938
+ ] })
123939
+ }
123940
+ )
123941
+ ] }),
123942
+ /* @__PURE__ */ jsx("div", { className: "database-wizard__step-form-submit-error", children: $submitErrorMessage })
123943
+ ] });
123944
+ }
123945
+ function UpdateForm(props) {
123946
+ const { logic, view } = props;
123947
+ const $submitErrorMessage = e(logic.$submitErrorMessage);
123948
+ const $processStatus = e(logic.$processStatus);
123949
+ const $loading = e(logic.$loading);
123950
+ e(logic.$mode);
123951
+ const { register, handleSubmit, control, formState: { errors }, ...methods } = useForm();
123952
+ const isStartBlockVisible = () => !$processStatus || $processStatus?.state === ProcessState.Canceled;
123953
+ return /* @__PURE__ */ jsxs("form", { className: "database-wizard__step-form", ref: props.currentFormRef, onSubmit: handleSubmit(props.onSubmit), children: [
123954
+ /* @__PURE__ */ jsxs(view.contentBlock, { header: null, className: "database-wizard__step-form-confirmation-wrapper", children: [
123955
+ (!$processStatus || $processStatus?.state === ProcessState.Canceled) && /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-attention-wrapper", children: [
123956
+ /* @__PURE__ */ jsxs("span", { className: "database-wizard__step-form-attention-text database-wizard__step-form-attention-text_warning", children: [
123957
+ /* @__PURE__ */ jsx(WarningIcon, { fontSize: "large" }),
123958
+ props.services.resources.Attention
123959
+ ] }),
123960
+ props.services.resources.DatabaseWizard_UpdateAttention
123961
+ ] }),
123962
+ $processStatus?.state === ProcessState.Error && /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-attention-wrapper", children: [
123963
+ /* @__PURE__ */ jsx("span", { className: "database-wizard__step-form-attention-text database-wizard__step-form-attention-text_warning", children: /* @__PURE__ */ jsx(ErrorIcon, { fontSize: "large", color: "error" }) }),
123964
+ props.services.resources.DatabaseWizard_UpdateError
123965
+ ] }),
123966
+ isStartBlockVisible() && /* @__PURE__ */ jsx(
123967
+ Button$3,
123968
+ {
123969
+ disabled: $loading,
123970
+ type: "submit",
123971
+ color: "primary",
123972
+ variant: "contained",
123973
+ className: "database-wizard__step-form-start-button",
123974
+ children: props.services.resources.StartUpdate
123975
+ }
123976
+ ),
123977
+ $processStatus?.state === ProcessState.Finished && /* @__PURE__ */ jsxs("span", { className: "database-wizard__step-form-attention-text database-wizard__step-form-attention-text_finished", children: [
123978
+ /* @__PURE__ */ jsx(CheckIcon, { fontSize: "large" }),
123979
+ " ",
123980
+ props.services.resources.DatabaseWizard_UpdateFinished
123981
+ ] }),
123982
+ $processStatus?.state === ProcessState.Running && /* @__PURE__ */ jsx(LinearProgress$1, { className: "database-wizard__step-form-progress" })
123983
+ ] }),
123984
+ $processStatus?.state === ProcessState.Finished && /* @__PURE__ */ jsx(
123985
+ view.contentBlock,
123986
+ {
123987
+ header: null,
123988
+ className: "database-wizard__step-form-confirmation-wrapper database-wizard__step-form-confirmation-wrapper_finished",
123989
+ children: /* @__PURE__ */ jsxs("span", { className: "database-wizard__step-form-attention-text database-wizard__step-form-attention-text_finished-attention", children: [
123990
+ /* @__PURE__ */ jsx(HandPointRightIcon, { fontSize: "large" }),
123991
+ " ",
123992
+ props.services.resources.DatabaseWizard_FinishAttention
123993
+ ] })
123994
+ }
123995
+ ),
123996
+ /* @__PURE__ */ jsx("div", { className: "database-wizard__step-form-submit-error", children: $submitErrorMessage })
123997
+ ] });
123998
+ }
123999
+ function UploadSettingsForm(props) {
124000
+ const { logic, view } = props;
124001
+ const $loading = e(logic.$loading);
124002
+ const $submitErrorMessage = e(logic.$submitErrorMessage);
124003
+ const $solutions = e(logic.$solutions);
124004
+ const $processStatus = e(logic.$processStatus);
124005
+ const $haveCheckedSolutions = e(logic.$haveCheckedSolutions);
124006
+ const { register, handleSubmit, control, formState: { errors }, ...methods } = useForm(
124007
+ {
124008
+ mode: "onTouched"
124009
+ }
124010
+ );
124011
+ return /* @__PURE__ */ jsxs("form", { className: "database-wizard__step-form", ref: props.currentFormRef, onSubmit: handleSubmit(props.onSubmit), children: [
124012
+ /* @__PURE__ */ jsxs("fieldset", { disabled: $loading, className: "database-wizard__step-form-fieldset", children: [
124013
+ (!$processStatus || $processStatus?.state === ProcessState.Canceled) && /* @__PURE__ */ jsx(view.contentBlock, { header: null, className: "database-wizard__step-form-confirmation-wrapper", children: /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-attention-wrapper", children: [
124014
+ /* @__PURE__ */ jsxs("span", { className: "database-wizard__step-form-attention-text", children: [
124015
+ /* @__PURE__ */ jsx(WarningIcon, { fontSize: "large" }),
124016
+ props.services.resources.Attention
124017
+ ] }),
124018
+ props.services.resources.DatabaseWizard_BeforeUploadSettingsAttention
124019
+ ] }) }),
124020
+ /* @__PURE__ */ jsxs(
124021
+ view.contentBlock,
124022
+ {
124023
+ className: "database-wizard__content-block_configuration",
124024
+ header: getDatabaseWizardFormName(props.services, DatabaseWizardSteps.UploadSettings),
124025
+ children: [
124026
+ /* @__PURE__ */ jsx("div", { className: "database-wizard__step-form-content-wrapper database-wizard__step-form-content-wrapper_modules", children: $solutions.map((module2) => /* @__PURE__ */ jsxs("div", { className: classNames(
124027
+ "database-wizard__step-form-row-wrapper",
124028
+ "database-wizard__step-form-row-wrapper_modules",
124029
+ { "database-wizard__step-form-row-wrapper_modules-disabled": module2.disabled }
124030
+ ), children: [
124031
+ /* @__PURE__ */ jsx(
124032
+ Checkbox$1,
124033
+ {
124034
+ disabled: module2.disabled || !!$processStatus,
124035
+ name: module2.name,
124036
+ className: "database-wizard__step-form-fieldset-checkbox",
124037
+ checked: module2.selected,
124038
+ onChange: () => logic.toggleSolution(module2),
124039
+ id: module2.name
124040
+ }
124041
+ ),
124042
+ /* @__PURE__ */ jsx("label", { htmlFor: module2.name, className: "database-wizard__step-form-fieldset-label", children: module2.name })
124043
+ ] }, module2.name)) }),
124044
+ !$processStatus && /* @__PURE__ */ jsx(
124045
+ Button$3,
124046
+ {
124047
+ disabled: !$haveCheckedSolutions || $loading,
124048
+ type: "submit",
124049
+ color: "primary",
124050
+ variant: "contained",
124051
+ className: "database-wizard__step-form-start-upload-button",
124052
+ "data-testId": "upload-button",
124053
+ children: $processStatus?.state === ProcessState.Running ? props.services.resources.Cancel : props.services.resources.StartUpload
124054
+ }
124055
+ ),
124056
+ $processStatus?.state === ProcessState.Running && /* @__PURE__ */ jsx(LinearProgress$1, { className: "database-wizard__step-form-progress" }),
124057
+ $processStatus?.state === ProcessState.Finished && /* @__PURE__ */ jsxs("span", { className: "database-wizard__step-form-attention-text database-wizard__step-form-attention-text_finished", children: [
124058
+ /* @__PURE__ */ jsx(CheckIcon$1, { fontSize: "large" }),
124059
+ " ",
124060
+ props.services.resources.DatabaseWizard_CompletedSuccessfully
124061
+ ] }),
124062
+ $processStatus?.state === ProcessState.Error && /* @__PURE__ */ jsxs("span", { className: "database-wizard__step-form-attention-text database-wizard__step-form-attention-text_warning", children: [
124063
+ /* @__PURE__ */ jsx(ErrorIcon, { fontSize: "large", color: "error" }),
124064
+ " ",
124065
+ props.services.resources.DatabaseWizard_UploadError
124066
+ ] })
124067
+ ]
124068
+ }
124069
+ )
124070
+ ] }),
124071
+ /* @__PURE__ */ jsx("div", { className: "database-wizard__step-form-submit-error", children: $submitErrorMessage })
124072
+ ] });
124073
+ }
124074
+ function SqlServerForm(props) {
124075
+ const { logic, view } = props;
124076
+ const $serverType = e(logic.$serverType);
124077
+ const $authentication = e(logic.$authentication);
124078
+ const $serverName = e(logic.$serverName);
124079
+ const $port = e(logic.$port);
124080
+ const $login = e(logic.$login);
124081
+ const $password = e(logic.$password);
124082
+ const $loading = e(logic.$loading);
124083
+ const $submitErrorMessage = e(logic.$submitErrorMessage);
124084
+ const { register, handleSubmit, control, formState: { errors }, ...methods } = useForm(
124085
+ {
124086
+ mode: "onTouched",
124087
+ values: {
124088
+ authentication: $authentication,
124089
+ serverName: $serverName,
124090
+ serverType: $serverType,
124091
+ port: $port,
124092
+ login: $login,
124093
+ password: $password
124094
+ }
124095
+ }
124096
+ );
124097
+ const getServerTypeOptions = () => {
124098
+ return getServerTypeNames().map((serverTypeName) => {
124099
+ return { displayValue: serverTypeName, value: ServerType[serverTypeName] };
124100
+ });
124101
+ };
124102
+ const getAuthenticationOptions = () => {
124103
+ return getAuthenticationTypeNames().map((authenticationTypeName) => {
124104
+ return { displayValue: authenticationTypeName, value: authenticationTypeName };
124105
+ });
124106
+ };
124107
+ const portField = register("port", {
124108
+ required: props.services.resources.Dialog_ValidationRequired,
124109
+ onChange: (e2) => logic.setPort(e2.target.value)
124110
+ });
124111
+ const serverNameField = register("serverName", {
124112
+ required: props.services.resources.Dialog_ValidationRequired,
124113
+ onChange: (e2) => logic.setServerName(e2.target.value)
124114
+ });
124115
+ const loginField = register("login", {
124116
+ required: props.services.resources.Dialog_ValidationRequired,
124117
+ onChange: (e2) => logic.setLogin(e2.target.value)
124118
+ });
124119
+ const passwordField = register("password", {
124120
+ required: props.services.resources.Dialog_ValidationRequired,
124121
+ onChange: (e2) => logic.setPassword(e2.target.value)
124122
+ });
124123
+ return /* @__PURE__ */ jsxs("form", { className: "database-wizard__step-form", ref: props.currentFormRef, onSubmit: handleSubmit(props.onSubmit), children: [
124124
+ /* @__PURE__ */ jsx("fieldset", { disabled: $loading, className: "database-wizard__step-form-fieldset", children: /* @__PURE__ */ jsxs(view.contentBlock, { header: getDatabaseWizardFormName(props.services, DatabaseWizardSteps.SQLServer, props.mode), children: [
124125
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-row-wrapper", children: [
124126
+ /* @__PURE__ */ jsxs("label", { id: "serverTypeLabel", htmlFor: "serverType", children: [
124127
+ props.services.resources.DatabaseWizardLabel_ServerType,
124128
+ ":"
124129
+ ] }),
124130
+ /* @__PURE__ */ jsx(FormControl$3, { disabled: $loading, size: "small", children: /* @__PURE__ */ jsx(
124131
+ Select$3,
124132
+ {
124133
+ ...commonMuiProps.select,
124134
+ variant: "outlined",
124135
+ id: "serverType",
124136
+ name: "serverType",
124137
+ labelId: "serverTypeLabel",
124138
+ value: $serverType,
124139
+ onChange: (e2) => {
124140
+ logic.setServerType(e2.target.value);
124141
+ },
124142
+ disabled: $loading,
124143
+ children: getServerTypeOptions().map((option, index) => /* @__PURE__ */ jsx(MenuItem$2, { value: option.value, children: option.displayValue }, index))
124144
+ }
124145
+ ) })
124146
+ ] }),
124147
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-row-wrapper", children: [
124148
+ /* @__PURE__ */ jsxs("label", { htmlFor: "serverName", children: [
124149
+ props.services.resources.DatabaseWizardLabel_ServerName,
124150
+ ":"
124151
+ ] }),
124152
+ /* @__PURE__ */ jsx(
124153
+ TextField$3,
124154
+ {
124155
+ ...serverNameField,
124156
+ id: "serverName",
124157
+ value: $serverName,
124158
+ error: !!errors.serverName,
124159
+ helperText: errors.serverName?.message,
124160
+ autoComplete: "off",
124161
+ variant: "outlined",
124162
+ size: "small"
124163
+ }
124164
+ )
124165
+ ] }),
124166
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-row-wrapper", children: [
124167
+ /* @__PURE__ */ jsxs("label", { id: "authenticationLabel", htmlFor: "authentication", children: [
124168
+ props.services.resources.DatabaseWizardLabel_Authentication,
124169
+ ":"
124170
+ ] }),
124171
+ /* @__PURE__ */ jsx(FormControl$3, { disabled: $loading, size: "small", children: /* @__PURE__ */ jsx(
124172
+ Select$3,
124173
+ {
124174
+ ...commonMuiProps.select,
124175
+ variant: "outlined",
124176
+ name: "authentication",
124177
+ labelId: "authenticationLabel",
124178
+ value: $authentication,
124179
+ defaultValue: getAuthenticationOptions()[0].displayValue,
124180
+ onChange: (e2) => {
124181
+ logic.setAuthentication(e2.target.value);
124182
+ },
124183
+ disabled: $loading,
124184
+ children: getAuthenticationOptions().map((option, index) => /* @__PURE__ */ jsx(MenuItem$2, { value: option.value, children: option.displayValue }, index))
124185
+ }
124186
+ ) })
124187
+ ] }),
124188
+ $serverType === ServerType.PostgreSQL && /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-row-wrapper", children: [
124189
+ /* @__PURE__ */ jsxs("label", { htmlFor: "port", children: [
124190
+ props.services.resources.DatabaseWizardLabel_Port,
124191
+ ":"
124192
+ ] }),
124193
+ /* @__PURE__ */ jsx(
124194
+ TextField$3,
124195
+ {
124196
+ ...portField,
124197
+ id: "port",
124198
+ value: $port,
124199
+ error: !!errors.port,
124200
+ helperText: errors.port?.message,
124201
+ autoComplete: "off",
124202
+ variant: "outlined",
124203
+ type: "number",
124204
+ size: "small"
124205
+ }
124206
+ )
124207
+ ] }),
124208
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-row-wrapper", children: [
124209
+ /* @__PURE__ */ jsxs("label", { htmlFor: "login", children: [
124210
+ props.services.resources.DatabaseWizardLabel_Login,
124211
+ ":"
124212
+ ] }),
124213
+ /* @__PURE__ */ jsx(
124214
+ TextField$3,
124215
+ {
124216
+ ...loginField,
124217
+ id: "login",
124218
+ value: $login,
124219
+ error: !!errors.login,
124220
+ helperText: errors.login?.message,
124221
+ autoComplete: "off",
124222
+ variant: "outlined",
124223
+ size: "small"
124224
+ }
124225
+ )
124226
+ ] }),
124227
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__step-form-row-wrapper", children: [
124228
+ /* @__PURE__ */ jsxs("label", { htmlFor: "password", children: [
124229
+ props.services.resources.DatabaseWizardLabel_Password,
124230
+ ":"
124231
+ ] }),
124232
+ /* @__PURE__ */ jsx(
124233
+ TextField$3,
124234
+ {
124235
+ ...passwordField,
124236
+ id: "password",
124237
+ value: $password,
124238
+ error: !!errors.password,
124239
+ helperText: errors.password?.message,
124240
+ autoComplete: "off",
124241
+ variant: "outlined",
124242
+ size: "small",
124243
+ type: "password"
124244
+ }
124245
+ )
124246
+ ] })
124247
+ ] }) }),
124248
+ /* @__PURE__ */ jsx("div", { className: "database-wizard__step-form-submit-error", children: $submitErrorMessage })
124249
+ ] });
124250
+ }
124251
+ function DatabaseWizardLibrary(props) {
124252
+ const { library, checked, disabled, onChange } = props;
124253
+ const [isExpanded, setIsExpanded] = useState(false);
124254
+ const [unexpandedDependencies, setUnexpandedDependencies] = useState(/* @__PURE__ */ new Set());
124255
+ const onExpand = () => {
124256
+ setIsExpanded(!isExpanded);
124257
+ };
124258
+ const onDependencyClick = (dependency, level) => {
124259
+ if (level !== 0) {
124260
+ return;
124261
+ }
124262
+ if (unexpandedDependencies.has(dependency)) {
124263
+ unexpandedDependencies.delete(dependency);
124264
+ setUnexpandedDependencies(new Set(unexpandedDependencies));
124265
+ return;
124266
+ }
124267
+ setUnexpandedDependencies(new Set(unexpandedDependencies.add(dependency)));
124268
+ };
124269
+ const isDependencyExpanded = (dependency, level) => {
124270
+ return !unexpandedDependencies.has(dependency) && isExpandable(dependency, level);
124271
+ };
124272
+ const isDependencyChecked = (dependency) => {
124273
+ return props.selectedLibraries.some((selectedLibrary) => selectedLibrary.alias === dependency.alias) && !props.disabledLibraries.some((disabledLibrary) => disabledLibrary.alias === dependency.alias);
124274
+ };
124275
+ const getDescriptionClassNames = () => classNames(
124276
+ "database-wizard__library-description",
124277
+ { "database-wizard__library-description_expanded": isExpanded }
124278
+ );
124279
+ const isExpandable = (library2, level) => library2.libraryDependencies?.length > 0 && level === 0;
124280
+ const renderDependencies = (library2, level = 0) => {
124281
+ const dependencyClassNames = classNames(
124282
+ "database-wizard__library-dependency",
124283
+ { "database-wizard__library-dependency_level": level > 0 }
124284
+ );
124285
+ return library2.libraryDependencies.map(
124286
+ (dependency) => {
124287
+ const dependencyWrapperClassNames = classNames(
124288
+ "database-wizard__library-dependency-wrapper",
124289
+ {
124290
+ "database-wizard__library-dependency-wrapper_expandable": isExpandable(dependency, level),
124291
+ "database-wizard__library-dependency-wrapper_expanded": isDependencyExpanded(dependency, level),
124292
+ "database-wizard__library-dependency-wrapper_with-dependencies": level > 1 && dependency.libraryDependencies?.length > 0
124293
+ }
124294
+ );
124295
+ return /* @__PURE__ */ jsxs("div", { className: dependencyWrapperClassNames, children: [
124296
+ /* @__PURE__ */ jsxs("div", { onClick: () => onDependencyClick(dependency, level), className: dependencyClassNames, children: [
124297
+ isExpandable(dependency, level) && /* @__PURE__ */ jsx("svg", { className: "database-wizard__library-expand-icon", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { d: "M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z" }) }),
124298
+ /* @__PURE__ */ jsx(
124299
+ Checkbox$1,
124300
+ {
124301
+ style: { padding: 0 },
124302
+ "data-testid": `dependency-checkbox-${dependency.alias}`,
124303
+ className: "database-wizard__library-dependency-checkbox",
124304
+ checked: isDependencyChecked(dependency),
124305
+ disabled: true
124306
+ }
124307
+ ),
124308
+ dependency.alias
124309
+ ] }, dependency.alias),
124310
+ !!dependency.libraryDependencies?.length && level < 1 && renderDependencies(dependency, level + 1)
124311
+ ] }, dependency.alias);
124312
+ }
124313
+ );
124314
+ };
124315
+ let libraryName = library.name;
124316
+ if (libraryName !== library.alias) {
124317
+ libraryName += ` (${library.alias})`;
124318
+ }
124319
+ return /* @__PURE__ */ jsxs("div", { className: classNames("database-wizard__library", { "database-wizard__library_disabled": disabled }), children: [
124320
+ /* @__PURE__ */ jsx(LightTooltip, { title: getLibraryTooltip(library, props.services), placement: "top", children: /* @__PURE__ */ jsxs("div", { className: "database-wizard__library-header", onClick: onExpand, children: [
124321
+ /* @__PURE__ */ jsx(
124322
+ Checkbox$1,
124323
+ {
124324
+ className: "database-wizard__library-checkbox",
124325
+ "data-testid": `library-checkbox-${library.alias}`,
124326
+ inputProps: {
124327
+ "data-testid": `input-library-checkbox-${library.alias}`
124328
+ },
124329
+ checked,
124330
+ disabled,
124331
+ name: library.name,
124332
+ onChange: (e2) => onChange(e2),
124333
+ onClick: (e2) => e2.stopPropagation(),
124334
+ color: "primary"
124335
+ }
124336
+ ),
124337
+ /* @__PURE__ */ jsx("label", { className: "database-wizard__library-name", children: libraryName }),
124338
+ /* @__PURE__ */ jsx(ExpandMoreIcon, { "data-testid": "expand-icon", className: classNames(
124339
+ "database-wizard__library-expand-header-icon",
124340
+ { "database-wizard__library-expand-header-icon_expanded": isExpanded }
124341
+ ) })
124342
+ ] }) }),
124343
+ /* @__PURE__ */ jsxs("div", { className: getDescriptionClassNames(), children: [
124344
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__library-params", children: [
124345
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__library-params-label", children: [
124346
+ props.services.resources.DatabaseWizardLibraryParams_CardLibVersion,
124347
+ ":"
124348
+ ] }),
124349
+ /* @__PURE__ */ jsx("div", { className: "database-wizard__library-params-value", children: library.cardLibVersion || "-" }),
124350
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__library-params-label", children: [
124351
+ props.services.resources.DatabaseWizardLibraryParams_GeneratorVersion,
124352
+ ":"
124353
+ ] }),
124354
+ /* @__PURE__ */ jsx("div", { className: "database-wizard__library-params-value", children: props.scriptGeneratorVersion || "-" }),
124355
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__library-params-label", children: [
124356
+ props.services.resources.DatabaseWizardLibraryParams_DatabaseVersion,
124357
+ ":"
124358
+ ] }),
124359
+ /* @__PURE__ */ jsx("div", { className: "database-wizard__library-params-value", children: library.dbVersion || "-" }),
124360
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__library-params-label", children: [
124361
+ props.services.resources.DatabaseWizardLibraryParams_DatabaseSysVersion,
124362
+ ":"
124363
+ ] }),
124364
+ /* @__PURE__ */ jsx("div", { className: "database-wizard__library-params-value", children: library.dbSysVersion || "-" }),
124365
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__library-params-label", children: [
124366
+ props.services.resources.DatabaseWizardLibraryParams_HaveUserMetadata,
124367
+ ":"
124368
+ ] }),
124369
+ /* @__PURE__ */ jsx("div", { className: "database-wizard__library-params-value", children: library.haveUserMetadata ? props.services.resources.Yes : props.services.resources.No })
124370
+ ] }),
124371
+ /* @__PURE__ */ jsxs("div", { className: "database-wizard__library-dependencies", children: [
124372
+ /* @__PURE__ */ jsx("div", { className: "database-wizard__library-dependencies-title", children: props.services.resources.DatabaseWizardLibraryParams_Dependencies }),
124373
+ renderDependencies(library)
124374
+ ] })
124375
+ ] })
124376
+ ] });
124377
+ }
124378
+ function DatabaseWizardLoadingIcon(props) {
124379
+ return /* @__PURE__ */ jsx("div", { ...props, className: classNames("database-wizard__loading-icon-wrapper", props.className), children: /* @__PURE__ */ jsx(CircularProgress$3, { size: 20, color: "primary", className: "database-wizard__loading-icon" }) });
124380
+ }
124381
+ class DatabaseWizardParamsView {
124382
+ constructor() {
124383
+ this.modal = DatabaseWizardModal;
124384
+ this.header = DatabaseWizardHeader;
124385
+ this.labelsWrapper = DatabaseWizardStepLabelsWrapper;
124386
+ this.stepLabel = DatabaseWizardStepLabel;
124387
+ this.contentBlock = DatabaseWizardContentBlock;
124388
+ this.buttonsPanel = DatabaseWizardButtonPanel;
124389
+ this.sqlServerForm = SqlServerForm;
124390
+ this.databaseForm = DatabaseForm;
124391
+ this.configurationForm = ConfigurationForm;
124392
+ this.confirmationForm = ConfirmationForm;
124393
+ this.updateForm = UpdateForm;
124394
+ this.uploadSettingsForm = UploadSettingsForm;
124395
+ this.library = DatabaseWizardLibrary;
124396
+ this.loadingIcon = DatabaseWizardLoadingIcon;
124397
+ }
124398
+ }
124399
+ function DatabaseWizard(props) {
124400
+ const view = useView(props, DatabaseWizardParamsView);
124401
+ const logic = useLogic(props, DatabaseWizardLogic);
124402
+ const $activeStep = e(logic.$activeStep);
124403
+ const $steps = e(logic.$steps);
124404
+ const $loading = e(logic.$loading);
124405
+ const $isOpen = e(logic.$isOpen);
124406
+ e(logic.$processStatus);
124407
+ const currentFormRef = React__default.useRef(null);
124408
+ e(logic.$solutions);
124409
+ const handleStepClick = (step) => {
124410
+ logic.goToStep(step);
124411
+ };
124412
+ useEffect(() => {
124413
+ logic.componentDidMount();
124414
+ }, [logic]);
124415
+ const getActiveForm = () => {
124416
+ const ActiveForm = view[getStepFormComponent($activeStep.step)];
124417
+ return /* @__PURE__ */ jsx(
124418
+ ActiveForm,
124419
+ {
124420
+ services: props.services,
124421
+ mode: props.mode,
124422
+ onSubmit: () => logic.stepFormSubmit(),
124423
+ logic,
124424
+ currentFormRef,
124425
+ view
124426
+ }
124427
+ );
124428
+ };
124429
+ const getHeaderText = () => {
124430
+ return `${props.services.resources.DatabaseWizard} (${props.services.resources[`DatabaseWizard_${DatabaseWizardMode[props.mode]}`]})`;
124431
+ };
124432
+ return /* @__PURE__ */ jsxs(
124433
+ view.modal,
124434
+ {
124435
+ isOpen: $isOpen,
124436
+ onClickCloseButton: () => logic.stepFormCancel(),
124437
+ header: /* @__PURE__ */ jsx(view.header, { text: getHeaderText() }),
124438
+ children: [
124439
+ /* @__PURE__ */ jsx(view.labelsWrapper, { children: $steps.map((step) => /* @__PURE__ */ jsx(
124440
+ view.stepLabel,
124441
+ {
124442
+ text: step.name,
124443
+ number: step.order,
124444
+ stepStatus: step.status,
124445
+ onClick: () => handleStepClick(step.step),
124446
+ clickable: !!isStepClickable(step, logic)
124447
+ },
124448
+ step.step
124449
+ )) }),
124450
+ getActiveForm(),
124451
+ /* @__PURE__ */ jsxs(view.buttonsPanel, { active: true, children: [
124452
+ $activeStep !== $steps[$steps.length - 1] && /* @__PURE__ */ jsxs(Fragment, { children: [
124453
+ /* @__PURE__ */ jsx(
124454
+ Button$3,
124455
+ {
124456
+ color: "primary",
124457
+ className: "database-wizard__modal-button database-wizard__modal-button_cancel",
124458
+ onClick: () => logic.stepFormCancel(),
124459
+ disabled: isCancelButtonDisabled($activeStep, logic),
124460
+ type: "button",
124461
+ "data-testId": "cancel-button",
124462
+ children: props.services.resources.Cancel
124463
+ }
124464
+ ),
124465
+ /* @__PURE__ */ jsx(
124466
+ Button$3,
124467
+ {
124468
+ className: "database-wizard__modal-button database-wizard__modal-button_previous",
124469
+ color: "primary",
124470
+ onClick: () => logic.previousStep(),
124471
+ disabled: isBackButtonDisabled($activeStep, logic),
124472
+ type: "button",
124473
+ "data-testId": "previous-button",
124474
+ children: props.services.resources.Back
124475
+ }
124476
+ ),
124477
+ /* @__PURE__ */ jsx(
124478
+ Button$3,
124479
+ {
124480
+ variant: "contained",
124481
+ className: "database-wizard__modal-button database-wizard__modal-button_next",
124482
+ color: "primary",
124483
+ onClick: () => currentFormRef.current?.requestSubmit(),
124484
+ disabled: isNextButtonDisabled($activeStep, logic),
124485
+ type: "button",
124486
+ "data-testId": "next-button",
124487
+ children: props.services.resources.Next
124488
+ }
124489
+ )
124490
+ ] }),
124491
+ $loading && /* @__PURE__ */ jsx(view.loadingIcon, {}),
124492
+ $activeStep === $steps[$steps.length - 1] && /* @__PURE__ */ jsx(
124493
+ Button$3,
124494
+ {
124495
+ variant: "contained",
124496
+ className: "database-wizard__modal-button database-wizard__modal-button_next",
124497
+ color: "primary",
124498
+ onClick: () => logic.stepFormDone(),
124499
+ disabled: isDoneButtonDisabled($activeStep, logic),
124500
+ type: "button",
124501
+ children: props.services.resources.Done
124502
+ }
124503
+ )
124504
+ ] })
124505
+ ]
124506
+ }
124507
+ );
124508
+ }
124509
+ class DatabaseWizardService {
124510
+ constructor(services, rootElementId) {
124511
+ this.services = services;
124512
+ this.rootElementId = rootElementId;
124513
+ this.name = "DatabaseWizard";
124514
+ this.meta = null;
124515
+ }
124516
+ getRootElement() {
124517
+ const modalRoot = document.createElement("div");
124518
+ document.getElementById(this.rootElementId).prepend(modalRoot);
124519
+ return modalRoot;
124520
+ }
124521
+ openCreateMode(serviceId, databaseChangeStateEvent) {
124522
+ const rootElement = this.getRootElement();
124523
+ ReactDOM__default.render(/* @__PURE__ */ jsx(ThemeProvider$1, { theme, children: /* @__PURE__ */ jsx(
124524
+ DatabaseWizard,
124525
+ {
124526
+ serviceId,
124527
+ databaseChangeStateEvent,
124528
+ mode: DatabaseWizardMode.Create,
124529
+ services: this.services
124530
+ }
124531
+ ) }), rootElement);
124532
+ }
124533
+ openUpdateMode(serviceId, databaseAlias, databaseChangeStateEvent) {
124534
+ const rootElement = this.getRootElement();
124535
+ ReactDOM__default.render(/* @__PURE__ */ jsx(ThemeProvider$1, { theme, children: /* @__PURE__ */ jsx(
124536
+ DatabaseWizard,
124537
+ {
124538
+ serviceId,
124539
+ databaseChangeStateEvent,
124540
+ mode: DatabaseWizardMode.Update,
124541
+ services: this.services,
124542
+ alias: databaseAlias
124543
+ }
124544
+ ) }), rootElement);
124545
+ }
124546
+ openConnectMode(serviceId, databaseChangeStateEvent) {
124547
+ const rootElement = this.getRootElement();
124548
+ ReactDOM__default.render(/* @__PURE__ */ jsx(ThemeProvider$1, { theme, children: /* @__PURE__ */ jsx(
124549
+ DatabaseWizard,
124550
+ {
124551
+ serviceId,
124552
+ databaseChangeStateEvent,
124553
+ mode: DatabaseWizardMode.Add,
124554
+ services: this.services
124555
+ }
124556
+ ) }), rootElement);
124557
+ }
124558
+ }
124559
+ const $DatabaseMasterController = serviceName((s2) => s2.databaseMasterController);
124560
+ class DatabaseMasterController {
124561
+ constructor(requestService) {
124562
+ this.requestService = requestService;
124563
+ this.name = "DatabaseMaster";
124564
+ this.meta = null;
124565
+ this.baseUrl = "api/DatabaseMaster";
124566
+ }
124567
+ setState(serviceId, model) {
124568
+ return this.requestService.post(`${this.baseUrl}/state?serviceId=${serviceId}`, model);
124569
+ }
124570
+ getState(serviceId, databaseAlias) {
124571
+ return this.requestService.get(`${this.baseUrl}/state?serviceId=${serviceId}&databaseAlias=${databaseAlias}`);
124572
+ }
124573
+ deleteState(serviceId, databaseAlias) {
124574
+ return this.requestService.delete(`${this.baseUrl}/state?serviceId=${serviceId}&databaseAlias=${databaseAlias}`);
124575
+ }
124576
+ }
124577
+ const $DatabasesConfigurationController = serviceName((s2) => s2.databasesConfigurationController);
124578
+ class DatabasesConfigurationController {
124579
+ constructor(requestService) {
124580
+ this.requestService = requestService;
124581
+ this.name = "DatabasesConfiguration";
124582
+ this.meta = null;
124583
+ this.baseUrl = "api/DatabasesConfiguration";
124584
+ }
124585
+ all(serviceId) {
124586
+ return this.requestService.get(`${this.baseUrl}/all?serviceId=${serviceId}`);
124587
+ }
124588
+ getDefault(serviceId) {
124589
+ return this.requestService.get(`${this.baseUrl}/default?serviceId=${serviceId}`);
124590
+ }
124591
+ setDefault(serviceId, databaseAlias) {
124592
+ return this.requestService.post(`${this.baseUrl}/default?serviceId=${serviceId}&defaultDatabaseAlias=${databaseAlias}`, {});
124593
+ }
124594
+ add(serviceId, databaseAlias) {
124595
+ return this.requestService.post(`${this.baseUrl}/add?serviceId=${serviceId}&databaseAlias=${databaseAlias}`, {});
124596
+ }
124597
+ delete(serviceId, databaseAlias) {
124598
+ return this.requestService.delete(`${this.baseUrl}?serviceId=${serviceId}&databaseAlias=${databaseAlias}`, {});
124599
+ }
124600
+ }
124601
+ const $DatabasesController = serviceName((s2) => s2.databasesController);
124602
+ class DatabasesController {
124603
+ constructor(requestService) {
124604
+ this.requestService = requestService;
124605
+ this.name = "Databases";
124606
+ this.meta = null;
124607
+ this.baseUrl = "api/Databases";
124608
+ }
124609
+ create(serviceId, databaseAlias) {
124610
+ return this.requestService.post(`${this.baseUrl}/create?serviceId=${serviceId}&databaseAlias=${databaseAlias}`, {});
124611
+ }
124612
+ update(serviceId, databaseAlias) {
124613
+ return this.requestService.post(`${this.baseUrl}/update?serviceId=${serviceId}&databaseAlias=${databaseAlias}`, {});
124614
+ }
124615
+ status(serviceId, databaseAlias) {
124616
+ return this.requestService.get(`${this.baseUrl}/status?serviceId=${serviceId}&databaseAlias=${databaseAlias}`);
124617
+ }
124618
+ stop(serviceId, databaseAlias) {
124619
+ return this.requestService.post(`${this.baseUrl}/stop?serviceId=${serviceId}&databaseAlias=${databaseAlias}`, {});
124620
+ }
124621
+ databases(serviceId, serverParameters) {
124622
+ return this.requestService.post(`${this.baseUrl}/databases?serviceId=${serviceId}`, { ...serverParameters });
124623
+ }
124624
+ checkSqlServerConnection(serviceId, serverParameters) {
124625
+ return this.requestService.post(`${this.baseUrl}/CheckSqlServerConnection?serviceId=${serviceId}`, { ...serverParameters });
124626
+ }
124627
+ checkSqlDatabaseConnection(serviceId, serverParameters, databaseParameters) {
124628
+ return this.requestService.post(
124629
+ `${this.baseUrl}/CheckSqlDatabaseConnection?serviceId=${serviceId}`,
124630
+ { server: serverParameters, database: databaseParameters }
124631
+ );
124632
+ }
124633
+ checkSqlDatabaseConnectionFull(serviceId, serverParameters, databaseParameters) {
124634
+ return this.requestService.post(
124635
+ `${this.baseUrl}/CheckSqlDatabaseConnectionFull?serviceId=${serviceId}`,
124636
+ { server: serverParameters, database: databaseParameters }
124637
+ );
124638
+ }
124639
+ info(serviceId) {
124640
+ return this.requestService.get(`${this.baseUrl}/info?serviceId=${serviceId}`);
124641
+ }
124642
+ libraries(serviceId, databaseAlias) {
124643
+ return this.requestService.get(
124644
+ `${this.baseUrl}/libraries?serviceId=${serviceId}&databaseAlias=${databaseAlias}`,
124645
+ {},
124646
+ { disableDialogsOnErrors: true }
124647
+ );
124648
+ }
124649
+ solutions(serviceId, databaseAlias) {
124650
+ return this.requestService.get(
124651
+ `${this.baseUrl}/solutions?serviceId=${serviceId}&databaseAlias=${databaseAlias}`,
124652
+ {},
124653
+ { disableDialogsOnErrors: true }
124654
+ );
124655
+ }
124656
+ installSolutions(serviceId, databaseAlias, solutions) {
124657
+ return this.requestService.post(`${this.baseUrl}/installSolutions?serviceId=${serviceId}&databaseAlias=${databaseAlias}`, { solutions });
124658
+ }
124659
+ }
124660
+ const $DatabaseWizard = serviceName((s2) => s2.databaseWizardService);
121488
124661
  const $RealtimeCommunication = serviceName((s2) => s2.realtimeCommunication);
121489
124662
  class HttpError extends Error {
121490
124663
  /** Constructs a new instance of {@link @microsoft/signalr.HttpError}.
@@ -124545,12 +127718,6 @@ class ProcessTemplatesController {
124545
127718
  return this.requestService.post(`${this.baseUrl}?serviceId=${serviceId}`, data);
124546
127719
  }
124547
127720
  }
124548
- const $RootElement = serviceName((s2) => s2.rootElement);
124549
- class RootElementService {
124550
- constructor(rootElementId) {
124551
- this.rootElementId = rootElementId;
124552
- }
124553
- }
124554
127721
  class Application extends ServiceContainer {
124555
127722
  constructor(reactRootElementId) {
124556
127723
  super();
@@ -124620,12 +127787,15 @@ class Application extends ServiceContainer {
124620
127787
  this.registerService($ServersController, new ServersController(this.requestService));
124621
127788
  this.registerService($SettingsNavigation, new SettingsNavigationService(this));
124622
127789
  this.registerService($FormControl, new FormControlService());
127790
+ this.registerService($DatabaseMasterController, new DatabaseMasterController(this.requestService));
127791
+ this.registerService($DatabasesController, new DatabasesController(this.requestService));
127792
+ this.registerService($DatabasesConfigurationController, new DatabasesConfigurationController(this.requestService));
127793
+ this.registerService($DatabaseWizard, new DatabaseWizardService(this, this.reactRootElementId));
124623
127794
  this.registerService($RealtimeCommunication, new RealtimeCommunicationService(this.applicationSettings));
124624
127795
  this.registerService($ConfigurationLocksController, new ConfigurationLocksController(this.requestService));
124625
127796
  this.registerService($ExtendedConfigurationController, new ExtendedConfigurationController(this.requestService));
124626
127797
  this.registerService($SessionsController, new SessionsController(this.requestService));
124627
127798
  this.registerService($ProcessTemplatesController, new ProcessTemplatesController(this.requestService));
124628
- this.registerService($RootElement, new RootElementService(this.reactRootElementId));
124629
127799
  await this.registerLocalization();
124630
127800
  this.registerService($MessageWindow, new MessageWindowService({ resources: this.resources }));
124631
127801
  const about = await this.requestService.get("api/about");
@@ -124752,21 +127922,120 @@ function SectionContentWrapper(props) {
124752
127922
  }) })
124753
127923
  ] });
124754
127924
  }
124755
- function SettingsPageButtonPanel(props) {
124756
- const { buttons, ...rest } = props;
124757
- return /* @__PURE__ */ jsx("div", { className: "settings-page__button-panel", ...rest, children: buttons.map(
124758
- (buttonProps) => /* @__PURE__ */ jsx(
124759
- Button$3,
124760
- {
124761
- onClick: buttonProps.onClick,
124762
- variant: "contained",
124763
- size: "small",
124764
- color: "secondary",
124765
- children: buttonProps.value
124766
- },
124767
- buttonProps.value?.toString()
124768
- )
124769
- ) });
127925
+ var EngineType = /* @__PURE__ */ ((EngineType2) => {
127926
+ EngineType2[EngineType2["MsSQL"] = 0] = "MsSQL";
127927
+ EngineType2[EngineType2["PgSQL"] = 1] = "PgSQL";
127928
+ return EngineType2;
127929
+ })(EngineType || {});
127930
+ function renderColumn(values2, iconComponent) {
127931
+ const Icon2 = iconComponent;
127932
+ return values2.map((value, index) => /* @__PURE__ */ jsxs("div", { className: "database-selection-modal__value", children: [
127933
+ /* @__PURE__ */ jsx(Icon2, { fontSize: "small", color: "secondary" }),
127934
+ /* @__PURE__ */ jsx(CellTextContent, { content: value, multiline: true })
127935
+ ] }, `${value}-${index}`));
127936
+ }
127937
+ function DatabaseSelectionModal(props) {
127938
+ const { open, databases, onCancel, onApply, resources } = props;
127939
+ const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
127940
+ useEffect(() => {
127941
+ if (open) {
127942
+ setSelectedIds(/* @__PURE__ */ new Set());
127943
+ }
127944
+ }, [open]);
127945
+ const handleToggle = (id) => {
127946
+ setSelectedIds((prev) => {
127947
+ const next = new Set(prev);
127948
+ if (next.has(id)) {
127949
+ next.delete(id);
127950
+ } else {
127951
+ next.add(id);
127952
+ }
127953
+ return next;
127954
+ });
127955
+ };
127956
+ const handleApply = () => {
127957
+ const selectedItems = databases.filter((database) => selectedIds.has(database.hash));
127958
+ onApply(selectedItems);
127959
+ };
127960
+ const handleKeyDown2 = (event, databaseHash) => {
127961
+ if (event.key === "Enter") {
127962
+ handleToggle(databaseHash);
127963
+ }
127964
+ };
127965
+ const hasDatabases = databases.length > 0;
127966
+ const isApplyDisabled = !hasDatabases || !selectedIds.size;
127967
+ const columns = [resources.Alias, resources.ApplicationServer, resources.SqlServer, ""];
127968
+ return /* @__PURE__ */ jsxs(
127969
+ Dialog$2,
127970
+ {
127971
+ open,
127972
+ onClose: onCancel,
127973
+ fullWidth: true,
127974
+ maxWidth: "md",
127975
+ scroll: "paper",
127976
+ className: "database-selection-modal__dialog",
127977
+ slotProps: { paper: { className: "database-selection-modal__paper" } },
127978
+ children: [
127979
+ /* @__PURE__ */ jsxs(DialogTitle, { variant: "h6", className: "database-selection-modal__title", children: [
127980
+ resources.ConnectDatabase,
127981
+ /* @__PURE__ */ jsx(IconButton$3, { onClick: onCancel, children: /* @__PURE__ */ jsx(Close, {}) })
127982
+ ] }),
127983
+ /* @__PURE__ */ jsxs(DialogContent$2, { className: "database-selection-modal__content", children: [
127984
+ /* @__PURE__ */ jsx(Typography$3, { variant: "body1", className: "database-selection-modal__description", children: resources.SelectDatabasesToConnect }),
127985
+ !hasDatabases ? /* @__PURE__ */ jsx(Typography$3, { variant: "body2", className: "database-selection-modal__empty", children: resources.NoDatabasesAvailableForConnection }) : /* @__PURE__ */ jsx("div", { className: "database-selection-modal__table-wrapper", children: /* @__PURE__ */ jsx(TableContainer, { children: /* @__PURE__ */ jsxs(Table$1, { size: "small", children: [
127986
+ /* @__PURE__ */ jsx(TableHead, { children: columns.map((column) => /* @__PURE__ */ jsx(TableCell$2, { children: column }, column)) }),
127987
+ /* @__PURE__ */ jsx(TableBody$1, { children: databases.map((database) => {
127988
+ const hasError = !!database.error;
127989
+ const isSelected = selectedIds.has(database.hash);
127990
+ const handleRowClick = hasError ? void 0 : () => handleToggle(database.hash);
127991
+ return /* @__PURE__ */ jsx(
127992
+ LightTooltip,
127993
+ {
127994
+ title: database.error ?? "",
127995
+ arrow: true,
127996
+ placement: "top",
127997
+ disableHoverListener: !hasError,
127998
+ disableFocusListener: !hasError,
127999
+ disableTouchListener: !hasError,
128000
+ children: /* @__PURE__ */ jsxs(
128001
+ TableRow$1,
128002
+ {
128003
+ hover: !hasError,
128004
+ onClick: handleRowClick,
128005
+ className: classNames(
128006
+ "database-selection-modal__row",
128007
+ { "database-selection-modal__row_error": hasError }
128008
+ ),
128009
+ children: [
128010
+ /* @__PURE__ */ jsx(TableCell$2, { className: "database-selection-modal__cell", width: "30%", children: renderColumn([database.baseName], StorageRounded) }),
128011
+ /* @__PURE__ */ jsx(TableCell$2, { className: "database-selection-modal__cell", width: "30%", children: renderColumn(database.serverNames, ComputerRounded) }),
128012
+ /* @__PURE__ */ jsx(CellWithFixedWidth, { content: database.sqlServerName, maxWidth: "30%" }),
128013
+ /* @__PURE__ */ jsx(TableCell$2, { className: "database-selection-modal__cell", width: "10%", children: /* @__PURE__ */ jsx(
128014
+ Checkbox$1,
128015
+ {
128016
+ checked: isSelected,
128017
+ onChange: () => handleToggle(database.hash),
128018
+ onClick: (event) => event.stopPropagation(),
128019
+ onKeyDown: (event) => handleKeyDown2(event, database.hash),
128020
+ disabled: hasError
128021
+ }
128022
+ ) })
128023
+ ]
128024
+ }
128025
+ )
128026
+ },
128027
+ database.hash
128028
+ );
128029
+ }) })
128030
+ ] }) }) })
128031
+ ] }),
128032
+ /* @__PURE__ */ jsxs(DialogActions$2, { className: "database-selection-modal__actions", children: [
128033
+ /* @__PURE__ */ jsx(Button$3, { onClick: onCancel, color: "primary", children: resources.DialogButton_Cancel }),
128034
+ /* @__PURE__ */ jsx(Button$3, { onClick: handleApply, color: "primary", variant: "contained", disabled: isApplyDisabled, children: resources.DialogButton_Accept })
128035
+ ] })
128036
+ ]
128037
+ }
128038
+ );
124770
128039
  }
124771
128040
  export {
124772
128041
  $AboutSettings,
@@ -124781,7 +128050,6 @@ export {
124781
128050
  $LocalizationService,
124782
128051
  $Resources,
124783
128052
  $ResourcesManagement,
124784
- $RootElement,
124785
128053
  $RouteContentRender,
124786
128054
  $SettingsNavigation,
124787
128055
  $TenantsService,
@@ -124802,6 +128070,7 @@ export {
124802
128070
  DEFAULT_PAGE_SIZE,
124803
128071
  DOCSVISION_CONNECTION_SETTINGS_LAYOUT,
124804
128072
  DashboardConfigurationService,
128073
+ DatabaseSelectionModal,
124805
128074
  DatabaseSettingsCard,
124806
128075
  DateRangeCalendarIcon,
124807
128076
  DateRangeContainer,
@@ -124820,11 +128089,12 @@ export {
124820
128089
  EditorInnerWrapper,
124821
128090
  EditorName,
124822
128091
  EditorWrapper,
128092
+ EngineType,
124823
128093
  ErrorBlock,
124824
- ErrorIcon,
128094
+ ErrorIcon$1 as ErrorIcon,
124825
128095
  ErrorMessage,
124826
128096
  ExpandButton$1 as ExpandButton,
124827
- ExpandMoreIcon,
128097
+ ExpandMoreIcon$1 as ExpandMoreIcon,
124828
128098
  ExtensionsService,
124829
128099
  FormControlService,
124830
128100
  GroupPanel,
@@ -124850,7 +128120,6 @@ export {
124850
128120
  PageTable,
124851
128121
  PageTitle,
124852
128122
  ResourcesManagement,
124853
- RootElementService,
124854
128123
  RouteContentRenderService,
124855
128124
  SavePageStatus,
124856
128125
  SectionContentWrapper,