opendash
Version:
open.DASH data visualization framework
24 lines • 1.33 kB
JavaScript
import * as React from "react";
import { Modal, Input } from "antd";
import { useOpenDashServices, useTranslation } from "..";
export var DashboardCreationModal = React.memo(function (_a) {
var open = _a.open, close = _a.close, onSave = _a.onSave;
var t = useTranslation(["opendash"])[0];
var DashboardService = useOpenDashServices().DashboardService;
var _b = React.useState(undefined), name = _b[0], setName = _b[1];
React.useEffect(function () {
setName(undefined);
}, [open]);
return (React.createElement(Modal, { visible: open, title: t("dashboards.create_modal_title"), okText: t("ui.create"), onOk: function () {
// @ts-ignore
DashboardService.createDashboard({ name: name }).then(function (id) {
if (onSave) {
onSave(id);
}
});
close();
}, cancelText: t("ui.cancel"), onCancel: function (e) { return close(); }, okButtonProps: { disabled: !name } },
React.createElement("p", null, t("dashboards.create_modal_description")),
React.createElement(Input, { value: name, onChange: function (e) { return setName(e.target.value); }, placeholder: t("dashboards.create_modal_placeholder") })));
});
//# sourceMappingURL=DashboardCreationModal.js.map