Autodesk-Forge / forge-designautomation-tools

Migrated to https://github.com/autodesk-platform-services/aps-design-automation-tools
http://da-manager.autodesk.io
MIT License
18 stars 9 forks source link
forge-designautomation nodejs

Design Automation Manager

Node.js npm Platforms License

OAuth2 Design Automation

This utility app enables you to see and create new app bundles, activities and workitems - including creating new version of those and aliases for them

Thumbnail

thumbnail

Live version

https://da-manager.herokuapp.com

Usage

  1. In the top text boxes Provide the Client Id and Client Secret of the app you created on the Forge Developer Site and click Log In button

  2. On both the AppBundles and Activities tabs you'll find a list of all the items you have on Forge. \ In case of clicking on an Alias, the infomration box on the right will show the reply coming from the Forge server. \ You'll find three buttons on the bottom left:

    • Refresh: refreshes the content of the tree control on the left side
    • Create: creates a new item. Depending on which item in the tree is selected it will create a different element: e.g. if an Activity version is selected then it will enable you to create an Alias for that version
    • Delete: will try to delete the selected item
  3. Whenever you use the Create button a dialog box will pop up that enables you to provide the necessary info in order to create the specific item:

thumbnail

  1. In the Info dialog box, some of the input fields will have a drop down menu with various functions:
    • they might enable you to populate the control with some text - often these are just templates that need to be filled in with the relevant information
    • verify if the input is a valid json:

thumbnail

  1. When an Activity Alias is selected in the tree, the plus button will turn into a play/run button showing that you could start a Workitem based on the selected Activity

  2. Once you started a Workitem the WorkItems tab will be activated and it will show a list of the Workitems you started during this session \ There will be two buttons available:

    • Stop: it will try to stop the selected Workitem
    • Delete: it will remove the selected item from the list (it won't try to stop it)

thumbnail

If you click any of the items then an update will be requested from the server and the reply will be shown in the info box

  1. Whenever you are requested to provide a file (for an AppBundle or for a Workitem) you need to provide a publicly accessible URL to it \ One easy way to generate such URLs is to use the Forge OSS and a utility like https://oss-manager.autodesk.io to upload files and generate read/write URLs for them thumbnail

Setup

Prerequisites

  1. Forge Account: Learn how to create a Forge Account, activate subscription and create an app at this tutorial.
  2. Visual Studio: Either Community (Windows) or Code (Windows, MacOS).
  3. JavaScript basic knowledge with jQuery

Run locally

Install NodeJS.

Clone this project or download it. It's recommended to install GitHub desktop. To clone it via command line, use the following (Terminal on MacOSX/Linux, Git Shell on Windows):

git clone https://github.com/adamenagy/da.manager-nodejs

To run it, install the required packages, set the enviroment variables with your client ID & secret and finally start it. Via command line, navigate to the folder where this repository was cloned and use the following:

Mac OSX/Linux (Terminal) / Windows (use Node.js command line from Start menu)

npm install
npm start

Open the browser: http://localhost:3000.

Important: do not use npm start locally, this is intended for PRODUCTION only with HTTPS (SSL) secure cookies.

Deployment

To deploy this application to Heroku, the Callback URL for Forge must use your .herokuapp.com address. After clicking on the button below, at the Heroku Create New App page, set your Client ID, Secret and Callback URL for Forge.

Deploy

Watch this video on how deploy samples to Heroku.

Packages used

All Autodesk Forge NPM packages are included by default, see complete list of what's available at NPM website. OAuth, Model Derivative and OSS are used. Some other non-Autodesk packaged are used, including express and its session/cookie middlewares (express-session and cookie-parser) for user session handling. The front-end uses bootsrap and jquery.

Tips & tricks

For local development/testing, consider use nodemon package, which auto restart your node application after any modification on your code. To install it, use:

sudo npm install -g nodemon

Then, instead of npm run dev, use the following:

npm run nodemon

Which executes nodemon server.js --ignore www/, where the --ignore parameter indicates that the app should not restart if files under www folder are modified.

Further Reading

Documentation:

Tutorials:

Blogs:

License

This sample is licensed under the terms of the MIT License. Please see the LICENSE file for full details.

Written by

Adam Nagy (Forge Partner Development)
http://forge.autodesk.com