// tslint:disable:max-line-length import { CellType } from "@nteract/commutable"; import { Action, HasCell, makeActionFunction, MaybeHasCell } from "../utils"; export const TOGGLE_TAG_IN_CELL = "CORE/TOGGLE_TAG_IN_CELL"; export const CHANGE_CELL_TYPE = "CHANGE_CELL_TYPE"; export const UPDATE_CELL_STATUS = "UPDATE_CELL_STATUS"; export const MARK_CELL_AS_DELETING = "MARK_CELL_AS_DELETING"; export const UNMARK_CELL_AS_DELETING = "UNMARK_CELL_AS_DELETING"; export const SET_IN_CELL = "SET_IN_CELL"; export type ChangeCellType = Action; export type UpdateCellStatus = Action; export type ToggleTagInCell = Action; export type MarkCellAsDeleting = Action; export type UnmarkCellAsDeleting = Action; export type SetInCell = Action; export const changeCellType = makeActionFunction (CHANGE_CELL_TYPE); export const updateCellStatus = makeActionFunction (UPDATE_CELL_STATUS); export const toggleTagInCell = makeActionFunction (TOGGLE_TAG_IN_CELL); export const markCellAsDeleting = makeActionFunction (MARK_CELL_AS_DELETING); export const unmarkCellAsDeleting = makeActionFunction(UNMARK_CELL_AS_DELETING); export const setInCell = (payload: SetInCell["payload"]) => makeActionFunction>(SET_IN_CELL)(payload); export const toggleParameterCell = (payload: HasCell) => toggleTagInCell({...payload, tag: "parameters"}); // Tag comes via Papermill export const updateCellSource = (payload: HasCell & { value: string }) => setInCell({...payload, path: ["source"]}); export const updateCellExecutionCount = (payload: HasCell & { value: number }) => setInCell({...payload, path: ["execution_count"]});