Skip to content

Instantly share code, notes, and snippets.

View EliJDonahue's full-sized avatar
😃
Working on exciting new projects for the Aras Community!

Eli J. Donahue EliJDonahue

😃
Working on exciting new projects for the Aras Community!
View GitHub Profile
@EliJDonahue
EliJDonahue / araslabs_GetOAuthToken.js
Last active June 24, 2019 20:59
Get an Innovator OAuth token. For definitions of httpReq() and getJSON(), check out https://github.com/ArasLabs/rest-upload-example/blob/master/Code/js/my-upload.js.
/**
* Retrieves a token from the Innovator auth server using the provided user credentials.
* Returns a new OAuth token string.
*
* @param creds An object containing credentials for connecting to an Innovator instance.
* @param {string} creds.url Innovator url. Ex: http://localhost/Innovator12
* @param {string} creds.db Innovator database name.
* @param {string} creds.user User's login name.
* @param {string} creds.pwd MD5 hash of the user's password.
*
@EliJDonahue
EliJDonahue / araslabs_PartViewCard3.json
Created February 13, 2019 20:43
View Card template with custom cell styles
{
"container": {
"type": "grid",
"style": {
"width": 290,
"height": 90,
"color": "#D8C6DA",
"padding": {
"left": 12,
"right": 12,
@EliJDonahue
EliJDonahue / araslabs_PartViewCard2.json
Created February 13, 2019 19:44
View Card template with increased column width
{
"container": {
"type": "grid",
"style": {
"width": 290,
"height": 90,
"color": "#D8C6DA",
"padding": {
"left": 12,
"right": 12,
@EliJDonahue
EliJDonahue / araslabs_PartViewCard1.json
Created February 13, 2019 18:51
View Card template with custom colors for Parts
{
"container": {
"type": "grid",
"style": {
"width": 200,
"height": 90,
"color": "#D8C6DA",
"padding": {
"left": 12,
"right": 12,
@EliJDonahue
EliJDonahue / araslabs_GenericViewCard.json
Created February 13, 2019 18:11
Sample template from Graph Navigation Administrator Guide documentation
{
"container": {
"type": "grid",
"style": {
"width": 200,
"height": 90,
"color": "#F7F7F7",
"padding": {
"left": 12,
"right": 12,
@EliJDonahue
EliJDonahue / araslabs_ViewCardStartingSample.json
Created February 12, 2019 18:31
Sample template for a Graph Navigation View Card
{
"container": {
"type": "grid",
"style": {
"width": 200,
"height": 90,
"color": "#F7F7F7",
"padding": {
"left": 12,
"right": 12,
@EliJDonahue
EliJDonahue / araslabs_NodeTemplateStructure.json
Created February 12, 2019 16:06
Sample template for Graph Navigation View Card
{
"container": {
"type": "grid",
"style": {
"rows": [
{
"height": 20
},
{
"height": 25
@EliJDonahue
EliJDonahue / araslabs_ShowMyGraph.js
Created February 11, 2019 18:18
Sample method code for opening a specific graph view
return ModulesManager.using(
['aras.innovator.GraphView/GraphWindowView',
'aras.innovator.core.ItemWindow/DefaultItemWindowCreator'
]).then(function (View, Creator) {
require(['GraphView/Scripts/GraphDataLoader'], function (GraphDataLoader) {
inArgs = {
// Specify the ID of the GVD to be used
gvdId: 'F04DC7C054CA48DA886A0B336BD61E37'
};
var view = new View(inDom, inArgs);
@EliJDonahue
EliJDonahue / araslabs_view_card_style.json
Created January 29, 2019 19:12
Sample View Card style for Aras Graph Navigation
{
"container": {
"type": "grid",
"style": {
"width": 200,
"height": 90,
"color": "#FCDAC8",
"padding": {
"left": 12,
"right": 12,
@EliJDonahue
EliJDonahue / araslabs_CheckPickedOrCreated.js
Created August 21, 2018 20:40
Demonstrates how to determine whether a related item was picked or created
/** this method throws an alert that says whether a related item was picked or created **/
// get the parent item
var parent_item = parent.thisItem;
// get the related item
var related_item = parent_item.getItemsByXPath("//Item[@id='" + relatedID + "']");
if (related_item.getItemCount() > 1)
related_item = related_item.getItemByIndex(0);