Coder Social home page Coder Social logo

mrgcohen / domo-node-embed-filters Goto Github PK

View Code? Open in Web Editor NEW

This project forked from domoinc/domo-node-embed-filters

1.0 1.0 0.0 36 KB

Example express server demonstrating private embed with programmatic filtering

Home Page: https://developer.domo.com

License: MIT License

JavaScript 69.16% HTML 14.65% CSS 16.07% Shell 0.12%

domo-node-embed-filters's Introduction

NodeJS - Private Embed with Programmatic Filtering Example Code

License

About

  • Example express server demonstrating private embed with programmatic filtering

Setup

  1. Install nodejs https://nodejs.org/en/download/

  2. Install yarn - https://yarnpkg.com/en/docs/install

  3. Locate or create the dashboard or card that you would like to embed in Domo.

  4. Embed the card or dashboard using the 'Private' Embed option.

  5. In the base folder of the repository run yarn to install the necessary dependencies.

    # yarn
    
  6. Create a file in the base folder of the project named .env

  7. Inside of this file add the following configuration settings but using your own values:

    CLIENT_ID=YOUR_CLIENT_ID
    CLIENT_SECRET=YOUR_CLIENT_SECRET
    EMBED_ID=YOUR_EMBED_ID
    EMBED_TYPE=dashboard
    
    # optional settings
    USE_XHR=true
    

    The CLIENT_ID and CLIENT_SECRET is used to create the access token which will be used to then create an embed token for use with the private embed. For more information about creating the CLIENT_ID and CLIENT_SECRET see https://developer.domo.com/docs/authentication/overview-4.
    The EMBED_ID references the card or the dashboard you are embedding.
    The EMBED_TYPE must be either the word 'dashboard' or 'card' (without the quotes).
    Include the USE_XHR setting only if cookie based authentication won't work for the endpoint you create on your server.

  8. Start the express server like this in the base folder of the project

    # yarn start
    
  9. In your browser go to the url localhost:3001 and verify that you are able to see you the card or dashboard appearing there after you login. The available usernames to login with are listed in the express.js file and they are as follows: mike, susan, tom and rachael. The password is not verified and so any will work.

  10. Once you have verified your card or dashboard is showing up in the example site, open up the file users.js in a text editor and modify the filter settings for each user to customize the filtering that each user will have applied to them. Currently each user has an empty filter being applied to them "[]". There are some example filters in the file that are commented out that you can use that give you an idea of the format expected for the filters. Once you make filter changes to the users.js file, you will need to save the file, restart the express server, refresh the page, and then log back in to see your filter changes. The complete list of available operators for use in filters are as follows: "IN", "NOT_IN", "EQUALS", "NOT_EQUALS", "GREATER_THAN", "GREAT_THAN_EQUALS_TO", "LESS_THAN", "LESS_THAN_EQUALS_TO".

  11. For information on how the javascript api works to both send and receive messages from Domo embedded iframes see the jsapi.js file. To test out the api you can apply a filter to all of the cards by using the forms at the top of the page. You can also click on the charts and see how the code in the jsapi.js file uses events sent from the iframe to route the iframe to a different url including the filters as part of the new url.

domo-node-embed-filters's People

Contributors

andrewjensen avatar angelica-jared avatar john-aldridge avatar

Stargazers

 avatar

Watchers

 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.