Giter Site home page Giter Site logo

rowyactions's Introduction

Rowy Actions

This package provides a firebase cloud functions project with a callable cloud function wrapper that handles role permission and the required fields validation for Rowy action columns.

Installation

yarn add rowy-actions

Usage

This library can be used as an alternative to directly using functions.https.onCall function to deploy a callable cloud functions for use in Rowy action fields. It can be installed and used in an existing firebase cloud functions project

// import and intialize firebase admin SDK
import * as admin from "firebase-admin";
admin.initializeApp();


import callableAction from "rowy-actions";
export const ExampleCallableAction = callableAction(async ({row, callableData, context}) =>{
  const {ref, column, schemaDocPath, action} = callableData;
  console.log({
    row, // docSnapshot of the called column
    context, // callable context contains data such as the time and the user running the action
    ref, // contains document id and other references related to the row
    column, // contains key of the action column
    schemaDocPath, // table schema Doc Path
    action, // latest action state
  });

  // switch statement can be used to perform different processes based on the state of the action cell
  switch (action) {
    case "run":
    case "undo":
    case "redo":
    default:
      break;
  }

  return {
    success: true, // return if the operation was success
    message: "hello world", // message shown in snackbar on Rowy after the completion of action
    cellStatus: "greeted", // optional cell label, to indicate the latest state of the cell/row
    newState: "redo", // "redo" | "undo" | "disabled" are options set the behavior of action button next time it runs
  };
});

Demo

To experiment with this package you can clone this repo then modify the example here.

git clone https://github.com/rowyio/RowyActions
cd RowyActions/functions
yarn install
firebase deploy --only functions --project [projectId]

rowyactions's People

Contributors

shamsmosowi avatar bofeiw avatar

Stargazers

Roman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.