Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

feat: HUMSIG-37: Enhancing ML backend connection experience #310

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/components/DataManager/Toolbar/ActionsButton.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import { inject, observer } from "mobx-react";
import { useRef } from "react";
import { FaAngleDown, FaChevronDown, FaChevronUp, FaTrash } from "react-icons/fa";
import { useCallback, useRef, useState } from "react";
import {
FaAngleDown,
FaChevronDown,
FaChevronRight,
FaChevronUp,
FaTrash
} from "react-icons/fa";
import { Block, Elem } from "../../../utils/bem";
import { FF_LOPS_E_10, FF_LOPS_E_3, isFF } from "../../../utils/feature-flags";
import { Button } from "../../Common/Button/Button";
import { Dropdown } from "../../Common/Dropdown/DropdownComponent";
import Form from "../../Common/Form/Form";
import { Menu } from "../../Common/Menu/Menu";
import { Modal } from "../../Common/Modal/ModalPopup";
import { useState } from "react";
import { FaChevronRight } from "react-icons/fa";
import "./ActionsButton.styl";
import { useCallback } from "react";

const isFFLOPSE3 = isFF(FF_LOPS_E_3);
const isNewUI = isFF(FF_LOPS_E_10);
Expand Down Expand Up @@ -48,11 +51,11 @@ export const ActionsButton = injector(observer(({ store, size, hasSelected, ...r

const invokeAction = (action, destructive) => {
if (action.dialog) {
const { type: dialogType, text, form } = action.dialog;
const { type: dialogType, text, form, title } = action.dialog;
const dialog = Modal[dialogType] ?? Modal.confirm;

dialog({
title: destructive ? "Destructive action." : "Confirm action.",
title: title ? title : destructive ? "Destructive action" : "Confirm action",
body: buildDialogContent(text, form, formRef),
buttonLook: destructive ? "destructive" : "primary",
onOk() {
Expand Down
3 changes: 2 additions & 1 deletion src/stores/Action.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { types } from "mobx-state-tree";
import { FF_LOPS_E_3, isFF } from "../utils/feature-flags";
import { CustomCalback, HtmlOrReact, StringOrNumberID } from "./types";

const SelectOptions = types.model('SelectOptions', {
const SelectOptions = types.model("SelectOptions", {
label: types.string,
value: types.string,
});
Expand Down Expand Up @@ -41,6 +41,7 @@ const ActionFormRow = types.model('ActionFormRow', {
});

const ActionDialog = types.model("ActionDialog", {
title: types.maybeNull(types.string),
text: types.string,
type: types.enumeration(["confirm", "prompt"]),
form: types.maybeNull(types.array(ActionFormRow)),
Expand Down