-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into feature/SOF-7326-1
- Loading branch information
Showing
17 changed files
with
553 additions
and
57 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
dist/components/3d_editor/advanced_geometry/PythonTransformation.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export default PythonTransformation; | ||
declare class PythonTransformation extends React.Component<any, any, any> { | ||
constructor(props: any); | ||
state: { | ||
pyodide: null; | ||
}; | ||
onLoad: (pyodideInstance: any) => void; | ||
render(): React.JSX.Element; | ||
} | ||
declare namespace PythonTransformation { | ||
namespace propTypes { | ||
const show: PropTypes.Validator<boolean>; | ||
const onHide: PropTypes.Validator<(...args: any[]) => any>; | ||
} | ||
} | ||
import React from "react"; | ||
import PropTypes from "prop-types"; |
27 changes: 27 additions & 0 deletions
27
dist/components/3d_editor/advanced_geometry/PythonTransformation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import PyodideLoader from "@exabyte-io/cove.js/dist/other/pyodide"; | ||
import Dialog from "@mui/material/Dialog"; | ||
import PropTypes from "prop-types"; | ||
import React from "react"; | ||
class PythonTransformation extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.onLoad = (pyodideInstance) => { | ||
this.setState({ pyodide: pyodideInstance }); | ||
}; | ||
this.state = { | ||
pyodide: null, | ||
}; | ||
} | ||
render() { | ||
const { show, onHide } = this.props; | ||
return (React.createElement(React.Fragment, null, | ||
React.createElement(PyodideLoader, { onLoad: this.onLoad, triggerLoad: show }), | ||
React.createElement(Dialog, { open: show, onClose: onHide, fullWidth: true, maxWidth: "lg", PaperProps: { sx: { width: "60vw", height: "60vh", padding: "20px" } } }, | ||
React.createElement("div", null, this.state.pyodide ? "Pyodide is loaded" : "Pyodide is not loaded")))); | ||
} | ||
} | ||
PythonTransformation.propTypes = { | ||
show: PropTypes.bool.isRequired, | ||
onHide: PropTypes.func.isRequired, | ||
}; | ||
export default PythonTransformation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export default SAlertContentTmpl; | ||
declare function SAlertContentTmpl({ id, classNames, condition, styles, message, handleClose, }: { | ||
id: any; | ||
classNames: any; | ||
condition: any; | ||
styles: any; | ||
message: any; | ||
handleClose: any; | ||
}): import("react/jsx-runtime").JSX.Element; | ||
declare namespace SAlertContentTmpl { | ||
namespace propTypes { | ||
const id: PropTypes.Validator<string>; | ||
const classNames: PropTypes.Validator<string>; | ||
const condition: PropTypes.Validator<string>; | ||
const styles: PropTypes.Validator<object>; | ||
const message: PropTypes.Validator<NonNullable<NonNullable<string | object | null | undefined>>>; | ||
const handleClose: PropTypes.Validator<(...args: any[]) => any>; | ||
} | ||
} | ||
import PropTypes from "prop-types"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
/* eslint-disable jsx-a11y/label-has-associated-control, jsx-a11y/control-has-associated-label */ | ||
import PropTypes from "prop-types"; | ||
import React from "react"; | ||
const SAlertContentTmpl = function SAlertContentTmpl({ id, classNames, condition, styles, message, handleClose, }) { | ||
return (_jsxs("div", { id: id, style: styles, className: `alert alert-${condition} ${classNames} growl-animated animated`, children: [_jsx("button", { type: "button", "data-growl": "dismiss", className: "close s-alert-close", onClick: handleClose }), _jsx("span", { children: message })] })); | ||
}; | ||
SAlertContentTmpl.propTypes = { | ||
id: PropTypes.string.isRequired, | ||
classNames: PropTypes.string.isRequired, | ||
condition: PropTypes.string.isRequired, | ||
// eslint-disable-next-line react/forbid-prop-types | ||
styles: PropTypes.object.isRequired, | ||
// eslint-disable-next-line react/forbid-prop-types | ||
message: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired, | ||
handleClose: PropTypes.func.isRequired, | ||
}; | ||
export default SAlertContentTmpl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { MaterialSchema } from "@exabyte-io/code.js/dist/types"; | ||
import { Made } from "@exabyte-io/made.js"; | ||
import React from "react"; | ||
interface StandataImportModalProps { | ||
show: boolean; | ||
onClose: () => void; | ||
onSubmit: (materials: Made.Material[]) => void; | ||
defaultMaterialConfigs: MaterialSchema[]; | ||
} | ||
interface StandataImportModalState { | ||
selectedMaterialConfigs: MaterialSchema[]; | ||
} | ||
declare class StandataImportModal extends React.Component<StandataImportModalProps, StandataImportModalState> { | ||
constructor(props: StandataImportModalProps); | ||
handleMaterialSelect: (materialConfigs: MaterialSchema[] | []) => void; | ||
handleRemoveMaterial: (index: number) => void; | ||
addMaterials: () => void; | ||
render(): import("react/jsx-runtime").JSX.Element; | ||
} | ||
export default StandataImportModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
import Dialog from "@exabyte-io/cove.js/dist/mui/components/dialog/Dialog"; | ||
import IconByName from "@exabyte-io/cove.js/dist/mui/components/icon/IconByName"; | ||
import { Made } from "@exabyte-io/made.js"; | ||
import CheckBoxOutlineBlank from "@mui/icons-material/CheckBoxOutlineBlank"; | ||
import Autocomplete from "@mui/material/Autocomplete"; | ||
import Checkbox from "@mui/material/Checkbox"; | ||
import Grid from "@mui/material/Grid"; | ||
import IconButton from "@mui/material/IconButton"; | ||
import TextField from "@mui/material/TextField"; | ||
import { DataGrid } from "@mui/x-data-grid"; | ||
import React from "react"; | ||
class StandataImportModal extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.handleMaterialSelect = (materialConfigs) => { | ||
this.setState({ | ||
selectedMaterialConfigs: [...materialConfigs], | ||
}); | ||
}; | ||
this.handleRemoveMaterial = (index) => { | ||
this.setState((prevState) => ({ | ||
selectedMaterialConfigs: prevState.selectedMaterialConfigs.filter((_, i) => i !== index), | ||
})); | ||
}; | ||
this.addMaterials = () => { | ||
const { selectedMaterialConfigs } = this.state; | ||
const materials = selectedMaterialConfigs.map((config) => new Made.Material(config)); | ||
const { onSubmit } = this.props; | ||
onSubmit(materials); | ||
this.setState({ selectedMaterialConfigs: [] }); | ||
}; | ||
this.state = { | ||
selectedMaterialConfigs: [], | ||
}; | ||
} | ||
render() { | ||
const { show, onClose, defaultMaterialConfigs } = this.props; | ||
const { selectedMaterialConfigs } = this.state; | ||
const selectedMaterials = selectedMaterialConfigs.map((config) => new Made.Material(config)); | ||
const columns = [ | ||
{ field: "name", headerName: "Name", flex: 1, headerAlign: "center", align: "center" }, | ||
{ | ||
field: "lattice", | ||
headerName: "Lattice", | ||
flex: 1, | ||
headerAlign: "center", | ||
align: "center", | ||
}, | ||
{ | ||
field: "formula", | ||
headerName: "Formula", | ||
flex: 1, | ||
headerAlign: "center", | ||
align: "center", | ||
}, | ||
{ | ||
field: "actions", | ||
headerName: "Actions", | ||
headerAlign: "center", | ||
align: "center", | ||
flex: 1, | ||
sortable: false, | ||
filterable: false, | ||
disableColumnMenu: true, | ||
renderCell: (params) => (_jsx(IconButton, { id: `${params.row.name.replace(/\s+/g, "-")}-remove-button`, color: "inherit", onClick: () => this.handleRemoveMaterial(params.row.id), children: _jsx(IconByName, { name: "actions.remove", fontSize: "small" }) })), | ||
}, | ||
]; | ||
return (_jsx(Dialog, { open: show, id: "standataImportModalDialog", title: "Import from Standata", onClose: onClose, onSubmit: this.addMaterials, children: _jsxs(Grid, { container: true, spacing: 2, children: [_jsx(Grid, { item: true, xs: 12, children: _jsx(Autocomplete, { multiple: true, id: "materials-autocomplete", "data-tid": "materials-selector", disableCloseOnSelect: true, options: defaultMaterialConfigs || [], value: selectedMaterialConfigs || null, getOptionLabel: (material) => material.name || "Not available", onChange: (event, newValues) => this.handleMaterialSelect(newValues), renderOption: (props, option, { selected }) => ( | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
_jsxs("li", { ...props, "data-tid": "select-material", children: [_jsx(Checkbox, { icon: _jsx(CheckBoxOutlineBlank, { fontSize: "small" }), checkedIcon: _jsx(IconByName, { name: "shapes.check", fontSize: "small" }), checked: selected }), option.name] })), renderInput: (params) => (_jsx(TextField | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
, { ...params, label: "Selected Materials", placeholder: "Select materials" })) }) }), _jsx(Grid, { item: true, xs: 12, style: { minHeight: 300 }, children: _jsx(DataGrid, { "data-name": "data-grid", hideFooter: true, rows: selectedMaterials.map((material, index) => { | ||
var _a; | ||
return ({ | ||
name: material.name, | ||
lattice: ((_a = material.lattice) === null || _a === void 0 ? void 0 : _a.type) || "TRI", | ||
formula: material.formula || "Not available", | ||
id: index, | ||
}); | ||
}), columns: columns }) })] }) })); | ||
} | ||
} | ||
export default StandataImportModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const DarkMaterialUITheme: import("@mui/material").Theme; | ||
export const LightMaterialUITheme: import("@mui/material").Theme; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { createTheme } from "@mui/material"; | ||
// adopted from: https://material-ui.com/customization/themes/#theme-configuration-variables | ||
const DarkThemeConfig = { | ||
palette: { | ||
// Switching the dark mode on is a single property value change. | ||
mode: "dark", | ||
}, | ||
typography: { | ||
// Tell Material-UI what's the font-size on the html element is. | ||
htmlFontSize: 12, | ||
}, | ||
overrides: { | ||
MuiFormControl: { | ||
root: { | ||
margin: 10, | ||
minWidth: 120, | ||
}, | ||
}, | ||
MuiOutlinedInput: { | ||
root: { | ||
"& .MuiOutlinedInput-notchedOutline": { | ||
border: "none", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
export const DarkMaterialUITheme = createTheme(DarkThemeConfig); | ||
export const LightMaterialUITheme = createTheme({ | ||
typography: DarkThemeConfig.typography, | ||
palette: { | ||
mode: "light", | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
dist/tests-legacy/cucumber/support/step_definitions/Then I see DefaultImportModalDialog.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"use strict"; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = _default; | ||
var _material_designer_page = require("../widgets/material_designer_page"); | ||
function _default() { | ||
this.Then(/^I see UploadDialog$/, () => { | ||
_material_designer_page.materialDesignerPage.designerWidget.defaultImportModalDialog.isVisible(); | ||
}); | ||
} |
12 changes: 12 additions & 0 deletions
12
...y/cucumber/support/step_definitions/Then the DefaultImportModalDialog should be closed.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"use strict"; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = _default; | ||
var _material_designer_page = require("../widgets/material_designer_page"); | ||
function _default() { | ||
this.Then(/^the UploadDialog should be closed$/, () => { | ||
_material_designer_page.materialDesignerPage.designerWidget.defaultImportModalDialog.waitForDisappear(); | ||
}); | ||
} |
12 changes: 12 additions & 0 deletions
12
dist/tests-legacy/cucumber/support/step_definitions/When I open DefaultImportModalDialog.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"use strict"; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = _default; | ||
var _material_designer_page = require("../widgets/material_designer_page"); | ||
function _default() { | ||
this.When(/^I open UploadDialog/, () => { | ||
_material_designer_page.materialDesignerPage.designerWidget.headerMenu.selectMenuItemByNameAndItemNumber("Input/Output", 1); | ||
}); | ||
} |
35 changes: 35 additions & 0 deletions
35
dist/tests-legacy/cucumber/support/widgets/alert/s_alert_widget.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"use strict"; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.SAlertWidget = void 0; | ||
var _logger = require("../../logger"); | ||
var _selectors = require("../../selectors"); | ||
var _utils = require("../../utils"); | ||
var _alert_widget = require("./alert_widget"); | ||
class SAlertWidget extends _alert_widget.AlertWidget { | ||
getAlertSelectorByType(type) { | ||
return this.getWrappedSelector(_selectors.SELECTORS.sAlertWidget.alertByType(type), ""); | ||
} | ||
isVisibleByType(type) { | ||
return exabrowser.isVisible(this.getAlertSelectorByType(type)); | ||
} | ||
isVisibleSuccess() { | ||
return this.isVisibleByType("success"); | ||
} | ||
close() { | ||
exabrowser.scrollAndClick(this.getWrappedSelector(_selectors.SELECTORS.sAlertWidget.closeButton)); | ||
} | ||
closeAllSuccess() { | ||
(0, _utils.retry)(() => { | ||
if (this.isVisible()) { | ||
_logger.logger.debug("sAlertSuccess closed"); | ||
this.close(); | ||
// eslint-disable-next-line no-throw-literal | ||
throw "Something is wrong: there should be no sAlertSuccess shown!"; | ||
} | ||
}); | ||
} | ||
} | ||
exports.SAlertWidget = SAlertWidget; |
Oops, something went wrong.