Giter Site home page Giter Site logo

newrelic / nr1-graphiql-notebook Goto Github PK

View Code? Open in Web Editor NEW
8.0 28.0 9.0 2.15 MB

NR1 Graphiql Notebook allows you to explore New Relic data via our GraphQL API and share notebooks with colleagues.

Home Page: https://discuss.newrelic.com/t/graphiql-notebook-nerdpack/82933

License: Apache License 2.0

JavaScript 91.66% SCSS 8.34%
newrelic nerdpack nr1 nr1-graphiql-notebook graphiql-notebook graphiql graphql

nr1-graphiql-notebook's Introduction

Archived header

GraphiQL Notebook

CI GitHub release (latest SemVer including pre-releases) Snyk

Usage

GraphiQL Notebook allows you to explore and learn about the NerdGraph API dynamically.

Create notebooks that have context-aware, interactive elements.

Each notebook consists of cells, which each contains an independent GraphiQL instance, its own notes and rendered output.

You can create, update, save, and delete notebooks. Notebooks are exportable, and can be shared as blocks of Base64-encoded JSON.

Screenshot #1

Screenshot #1

If you're eager to jump in, see the Quick Start instructions.

Open Source License

This project is distributed under the Apache 2 license.

Dependencies

Requires no specific data or additional features.

Getting started

First, ensure that you have Git and NPM installed. If you're unsure whether you have one or both of them installed, run the following command(s) (If you have them installed these commands will return a version number, if not, the commands won't be recognized):

git --version
npm -v

Next, clone this repository and run the following scripts:

nr1 nerdpack:clone -r https://github.com/newrelic/nr1-graphiql-notebook.git
cd nr1-graphiql-notebook
nr1 nerdpack:serve

Visit https://one.newrelic.com/?nerdpacks=local, navigate to the Nerdpack, and โœจ

Quick Start

If you'd like a jumping-off point, click Import Notebook in the UI and paste in this Getting Started notebook:

eyJjZWxscyI6W3sicXVlcnkiOiJ7XG4gIGFjdG9yIHtcbiAgICB1c2VyIHtcbiAgICAgIGVtYWlsXG4gICAgICBuYW1lXG4gICAgfVxuICB9XG59Iiwibm90ZXMiOiJHcmFwaGlRTCBOb3RlYm9va3MgYXJlIGNvbXBvc2VkIG9mIGNlbGxzLiBBIGNlbGwsIGxpa2UgdGhpcyBvbmUsIGNvbnRhaW5zIGEgc2VjdGlvbiBmb3Igbm90ZXMgYW5kIGFuIGluc3RhbmNlIG9mIHRoZSBHcmFwaGlRTCBxdWVyeSBlZGl0b3IuIExldCdzIHJ1biBhIHF1ZXJ5IHRvIHNlZSB0aGUgb3V0cHV0LiJ9LHsicXVlcnkiOiJ7XG4gIGFjdG9yIHtcbiAgICBlbnRpdHlTZWFyY2gocXVlcnlCdWlsZGVyOiB7dHlwZTogQVBQTElDQVRJT059KSB7XG4gICAgICByZXN1bHRzIHtcbiAgICAgICAgZW50aXRpZXMge1xuICAgICAgICAgIGd1aWRcbiAgICAgICAgICBhY2NvdW50SWRcbiAgICAgICAgICBuYW1lXG4gICAgICAgICAgdGFncyB7XG4gICAgICAgICAgICBrZXlcbiAgICAgICAgICAgIHZhbHVlc1xuICAgICAgICAgIH1cbiAgICAgICAgICAuLi4gb24gQWxlcnRhYmxlRW50aXR5T3V0bGluZSB7XG4gICAgICAgICAgICBhbGVydFNldmVyaXR5XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuICB9XG59XG4iLCJub3RlcyI6IkdyYXBoaVFMIE5vdGVib29rIG91dHB1dCBpcyBcImNvbnRleHQgYXdhcmVcIi4gSXQgY29udGFpbnMgcmVuZGVyZXJzIHRoYXQgdHJ5IHRvIHNob3cgeW91IGludGVyZXN0aW5nIHRoaW5ncyBpbiB0aGUgb3V0cHV0LiBIZXJlJ3MgYW4gZXhhbXBsZSBvZiBhIHF1ZXJ5IHRoYXQgdGFrZXMgYWR2YW50YWdlIG9mIGN1c3RvbSByZW5kZXJpbmcuIn0seyJxdWVyeSI6IntcbiAgYWN0b3Ige1xuICAgIGFjY291bnQoaWQ6IDEpIHtcbiAgICAgIG5ycWwocXVlcnk6IFwiU0VMRUNUIGNvdW50KCopIEZST00gVHJhbnNhY3Rpb24gU0lOQ0UgMTAgbWludXRlcyBhZ29cIikge1xuICAgICAgICBzdWdnZXN0ZWRGYWNldHMge1xuICAgICAgICAgIG5ycWxcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cbiAgfVxufVxuIiwibm90ZXMiOiJJbiB0aGlzIG5leHQgZXhhbXBsZSB5b3UnbGwgc2VlIHdlIGRvIGEgTlJRTCBxdWVyeSBhbmQgc2hvdyBzb21lIGludGVyZXN0aW5nIHRoaW5ncyBhYm91dCB0aGUgc3VnZ2VzdGVkIGZhY2V0cy4ifSx7InF1ZXJ5Ijoie1xuICBhY3RvciB7XG4gICAgYWNjb3VudHMge1xuICAgICAgaWRcbiAgICAgIG5hbWVcbiAgICB9XG4gIH1cbn1cbiIsIm5vdGVzIjoiVGhlc2UgcmVuZGVyZXJzIGFyZSBlYXN5IHRvIGFkZCBhbmQgY3VzdG9taXplISBDaGVjayB0aGlzIHByb2plY3QncyByZXBvIFJFQURNRSBmb3IgYSBzYW1wbGUgcmVuZGVyZXIgdGhhdCB3aWxsIHR1cm4gYWNjb3VudCBpZHMgaW50byBsaW5rcy4uLi4ifV0sInV1aWQiOiI5MTYyMDMzNS01MmYzLTQ0MjUtOTczZC1hOGVkMTY3NTFhNjUiLCJ0aXRsZSI6IkdldHRpbmcgU3RhcnRlZCJ9

Deploying this Nerdpack

Open a command prompt in the nerdpack's directory and run the following commands.

# To create a new uuid for the nerdpack so that you can deploy it to your account:
# nr1 nerdpack:uuid -g [--profile=your_profile_name]

# To see a list of APIkeys / profiles available in your development environment:
# nr1 profiles:list

nr1 nerdpack:publish [--profile=your_profile_name]
nr1 nerdpack:deploy [-c [DEV|BETA|STABLE]] [--profile=your_profile_name]
nr1 nerdpack:subscribe [-c [DEV|BETA|STABLE]] [--profile=your_profile_name]

Visit https://one.newrelic.com, navigate to the Nerdpack, and โœจ

Renderers

Context-aware rendering is made possible by a set of custom renderers that know how to render certain types or fields.

Renderers are simply React component classes with an additional static method, test, that accepts a node in the output and determines whether it can render that node with a custom representation. You'll find existing renderers in nerdlets/notebook-nerdlet/renderers (epoch-milliseconds-renderer.js is a friendly one).

Documentation is a little lacking at the moment but you could drop your own renderer in today! Here's one you can try out that will link account IDs on account objects to the account page in APM.

Add this file to the nerdlets/notebook-nerdlet/renderers directory.

import React from 'react';

// Render account IDs as links to the account page in APM
export default class AccountIdRenderer extends React.Component {
  static test(node) {
    let parent = node.__meta.parent;

    if (!parent) return false;

    let isAccountTypeObject =
      parent.__meta.typename == 'Account' ||
      parent.__meta.typename == 'AccountOutline';

    return isAccountTypeObject && node.__meta.fieldName == 'id';
  }

  render() {
    let accountId = this.props.node.value;
    return (
      <a
        target="_blank"
        href={`https://rpm.newrelic.com/accounts/${accountId}`}
      >
        Visit Account {accountId}
      </a>
    );
  }
}

Next, import this class into nerdlets/notebook-nerdlet/renderers/render.js and add it to the RENDERERS array.

Now send a query that includes an account ID to see your new renderer in action!

{
  actor {
    accounts {
      name
      id
    }
  }
}

About __meta

GraphiQL Notebook augments the response data from the GraphQL server with additional information from...

  • your GraphQL query's AST
  • the standard GraphQL introspection response containing schema information

This allows you to write renderers that know a lot about the data they are looking at. You can ask questions like:

  • What's this fields's type?
  • What's this field's parent's type?
  • Does this field have any arguments with the name "guid"?
  • Does this field have any ancestors anywhere that took an argument called "accountId"? What was the value of that argument?
  • Is this field pointing to a list? What of?
  • etc

To provide this, the response data tree is walked and the following modifications are made:

  • Metadata is added to objects
  • Leaf nodes (scalars) are expanded into objects so that they can contain meta data
  • Lists are expanded into objects with metadata and a values properties linking to the original array.
  • The metadata is under the key __meta and contains things like:
    • type name
    • leaf and list booleans
    • field name
    • a reference to the parent node
    • the path so far
    • if applicable, arguments provided to the field in the original query (for example, nrql, accountId, entity guid, etc)

The code that does this work is in nerdlets/notebook-nerdlet/results/augmentation.js. There are some dragons in there.

Note: metadata is omitted from the rendered results.

Community Support

New Relic hosts and moderates an online forum where you can interact with New Relic employees as well as other customers to get help and share best practices. Like all New Relic open source community projects, there's a related topic in the New Relic Explorers Hub. You can find this project's topic/threads here:

https://discuss.newrelic.com/t/graphiql-notebook-nerdpack/82933

Please do not report issues with GraphiQL Notebook to New Relic Global Technical Support. Instead, visit the Explorers Hub for troubleshooting and best-practices.

Issues / Enhancement Requests

Issues and enhancement requests can be submitted in the Issues tab of this repository. Please search for and review the existing open issues before submitting a new issue.

Security

As noted in our security policy, New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.

If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through HackerOne.

Contributing

Contributions are welcome (and if you submit a Enhancement Request, expect to be invited to contribute it yourself ๐Ÿ˜). Please review our Contributors Guide.

Keep in mind that when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. If you'd like to execute our corporate CLA, or if you have any questions, please drop us an email at [email protected].

nr1-graphiql-notebook's People

Contributors

austin-schaefer avatar danielgolden avatar devfreddy avatar jaesius avatar jbeveland27 avatar lizbaker avatar mattbaker avatar michellosier avatar nr-opensource-bot avatar prototypicalpro avatar rudouglas avatar semantic-release-bot avatar snyk-bot avatar tangollama avatar tyreer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nr1-graphiql-notebook's Issues

[Repolinter] Open Source Policy Issues

Repolinter Report

๐Ÿค–This issue was automatically generated by repolinter-action, developed by the Open Source and Developer Advocacy team at New Relic. This issue will be automatically updated or closed when changes are pushed. If you have any problems with this tool, please feel free to open a GitHub issue or give us a ping in #help-opensource.

This Repolinter run generated the following results:

โ— Error โŒ Fail โš ๏ธ Warn โœ… Pass Ignored Total
0 1 0 12 0 13

Fail #

โŒ readme-starts-with-nr1-catalog-header #

The README of a community plus project should have a NR1 Catalog header at the start of the README. If you already have a NR1 Catalog header and this rule is failing, your header may be out of date, and you should update your header with the suggested one below. For more information please visit https://opensource.newrelic.com/oss-category/. Below is a list of files or patterns that failed:

  • README.md: The first 1 lines do not contain the pattern(s): Open source NR1 Catalog header (see https://opensource.newrelic.com/oss-category).
    • ๐Ÿ”จ Suggested Fix: prepend [![New Relic One Catalog Project header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/New_Relic_One_Catalog_Project.png)](https://opensource.newrelic.com/oss-category/#new-relic-one-catalog-project) to file

Passed #

Click to see rules

โœ… license-file-exists #

Found file (LICENSE). New Relic requires that all open source projects have an associated license contained within the project. This license must be permissive (e.g. non-viral or copyleft), and we recommend Apache 2.0 for most use cases. For more information please visit https://docs.google.com/document/d/1vML4aY_czsY0URu2yiP3xLAKYufNrKsc7o4kjuegpDw/edit.

โœ… readme-file-exists #

Found file (README.md). New Relic requires a README file in all projects. This README should give a general overview of the project, and should point to additional resources (security, contributing, etc.) where developers and users can learn further. For more information please visit https://github.com/newrelic/open-source-tools/tree/master/javascript/oss-template.

โœ… readme-contains-security-section #

Contains a security section (README.md). New Relic recommends having a Security section in your README to address concerns such as vulnerability reporting. This security section should also contain a link to the security policy (found under the "Security" tab of the repository). For an example of this section, please see the NR1 Catalog Template. For more information please visit https://nerdlife.datanerd.us/new-relic/security-guidelines-for-publishing-source-code.

โœ… readme-contains-link-to-security-policy #

Contains a link to the security policy for this repository (README.md). New Relic recommends referencing the open source security policy (https://github.com/newrelic/<repo-name>/security/policy or ../../security/policy) in a Security section in the README. For an example of this, please see the NR1 Catalog Template. For more information please visit https://nerdlife.datanerd.us/new-relic/security-guidelines-for-publishing-source-code.

โœ… readme-contains-discuss-topic #

Contains a link to the appropriate discuss.newrelic.com topic (README.md). New Relic recommends directly linking the your appropriate discuss.newrelic.com topic in the README, allowing developer an alternate method of getting support. For more information please visit https://nerdlife.datanerd.us/new-relic/security-guidelines-for-publishing-source-code.

โœ… third-party-notices-file-exists #

Found file (THIRD_PARTY_NOTICES.md). A THIRD_PARTY_NOTICES.md file must be present to grant attribution to all dependencies being used by this project. For JavaScript projects, you can generate this file using the oss-cli. For more information please visit https://docs.google.com/document/d/1y644Pwi82kasNP5VPVjDV8rsmkBKclQVHFkz8pwRUtE/view.

โœ… code-of-conduct-should-not-exist-here #

New Relic has moved the CODE_OF_CONDUCT file to a centralized location where it is referenced automatically by every repository in the New Relic organization. Because of this change, any other CODE_OF_CONDUCT file in a repository is now redundant and should be removed. For more information please visit https://docs.google.com/document/d/1y644Pwi82kasNP5VPVjDV8rsmkBKclQVHFkz8pwRUtE/view. Did not find a file matching the specified patterns. All files passed this test.

โœ… github-actions-workflow-file-exists #

Found file (.github/workflows/catalog.yml). Any Community Plus project must integrate with GitHub actions. For more information please visit https://docs.google.com/document/d/1y644Pwi82kasNP5VPVjDV8rsmkBKclQVHFkz8pwRUtE/view.

โœ… nr1-catalog-config-file-exists #

Found file (catalog/config.json).

โœ… nr1-catalog-screenshots-directory-exists #

Found file (catalog/screenshots).

โœ… nr1-catalog-documentation-file-exists #

Found file (catalog/documentation.md).

โœ… package-scripts-present #

An eslint-check and eslint-fix npm script found in file (package.json). NPM scripts for ESLint (eslint-check and eslint-fix) are required to properly integrate with the nerdpack system.

Upgrade the project meta data to support new catalog commands

Add metadata to the repository that matches the example laid out here.

  • Add a config.json file to a catalog directory in the repo root, matching this format.
  • Move the /screenshots directory into catalog:
    • Update the screenshot file names (matching this format)
    • Update the screenshot links in the README.md.
  • Add a documentation.md file to a catalog directory in the repo root, matching this format.
  • (Optional) If there's additional documentation referenced in the repo, add a additionalInfo.md file to a catalog directory in the repo root, matching this format.
  • Update the relative paths in documentation.md to be absolute paths
  • Add the new header image to the top of README.md and catalog/documentation.md.
  • Ensure the README.md commands section matches Justin's snippet.
  • Run npm start and let the CLI move the nr1.json
    • Edit that file to make sure the name and description make sense.

[Repolinter] Open Source Policy Issues

Repolinter Report

๐Ÿค–This issue was automatically generated by repolinter-action, developed by the Open Source and Developer Advocacy team at New Relic. This issue will be automatically updated or closed when changes are pushed. If you have any problems with this tool, please feel free to open a GitHub issue or give us a ping in #help-opensource.

This Repolinter run generated the following results:

โ— Error โŒ Fail โš ๏ธ Warn โœ… Pass Ignored Total
0 3 0 9 0 12

Fail #

โŒ readme-starts-with-nr1-catalog-header #

The README of a community plus project should have a NR1 Catalog header at the start of the README. If you already have a NR1 Catalog header and this rule is failing, your header may be out of date. For more information please visit https://opensource.newrelic.com/oss-category/. Below is a list of files or patterns that failed:

  • README.md: The first 1 lines do not contain the pattern(s): Open source NR1 Catalog header (see https://opensource.newrelic.com/oss-category).
    • ๐Ÿ”จ Suggested Fix: prepend [![New Relic One Catalog Project header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/New_Relic_One_Catalog_Project.png)](https://opensource.newrelic.com/oss-category/#new-relic-one-catalog-project) to file

โŒ readme-contains-security-section #

Doesn't contain a security section (README.md). New Relic recommends having a Security section in your README to address concerns such as vulnerability reporting. This security section should also contain a link to the security policy (found under the "Security" tab of the repository). For an example of this section, please see the NR1 Catalog Template. For more information please visit https://nerdlife.datanerd.us/new-relic/security-guidelines-for-publishing-source-code.

โŒ readme-contains-link-to-security-policy #

Doesn't contain a link to the security policy for this repository (README.md). New Relic recommends referencing the open source security policy (https://github.com/newrelic/<repo-name>/security/policy or ../../security/policy) in a Security section in the README. For an example of this, please see the NR1 Catalog Template. For more information please visit https://nerdlife.datanerd.us/new-relic/security-guidelines-for-publishing-source-code.

Passed #

Click to see rules

โœ… license-file-exists #

Found file (LICENSE). New Relic requires that all open source projects have an associated license contained within the project. This license must be permissive (e.g. non-viral or copyleft), and we recommend Apache 2.0 for most use cases. For more information please visit https://docs.google.com/document/d/1vML4aY_czsY0URu2yiP3xLAKYufNrKsc7o4kjuegpDw/edit.

โœ… readme-file-exists #

Found file (README.md). New Relic requires a README file in all projects. This README should give a general overview of the project, and should point to additional resources (security, contributing, etc.) where developers and users can learn further. For more information please visit https://github.com/newrelic/open-source-tools/tree/master/javascript/oss-template.

โœ… readme-contains-discuss-topic #

Contains a link to the appropriate discuss.newrelic.com topic (README.md). New Relic recommends directly linking the your appropriate discuss.newrelic.com topic in the README, allowing developer an alternate method of getting support. For more information please visit https://nerdlife.datanerd.us/new-relic/security-guidelines-for-publishing-source-code.

โœ… third-party-notices-file-exists #

Found file (THIRD_PARTY_NOTICES.md). A THIRD_PARTY_NOTICES.md file must be present to grant attribution to all dependencies being used by this project. For JavaScript projects, you can generate this file using the oss-cli. For more information please visit https://docs.google.com/document/d/1y644Pwi82kasNP5VPVjDV8rsmkBKclQVHFkz8pwRUtE/view.

โœ… github-actions-workflow-file-exists #

Found file (.github/workflows/pr.yml). Any Community Plus project must integrate with GitHub actions. For more information please visit https://docs.google.com/document/d/1y644Pwi82kasNP5VPVjDV8rsmkBKclQVHFkz8pwRUtE/view.

โœ… nr1-catalog-config-file-exists #

Found file (catalog/config.json).

โœ… nr1-catalog-screenshots-directory-exists #

Found file (catalog/screenshots).

โœ… nr1-catalog-documentation-file-exists #

Found file (catalog/documentation.md).

โœ… package-scripts-present #

An eslint-check and eslint-fix npm script found in file (package.json). NPM scripts for ESLint (eslint-check and eslint-fix) are required to properly integrate with the nerdpack system.

`__meta` information should include interfaces

The metadata for a node should include interface information as well as the concrete typename. We want renderers to be able to say "for any Entity (an interface) render this..."

Right now we're stuck enumerating through concrete types.

Modal related JS error?

With the introduction of the modal component we started seeing this in the logs:

wanda--wanda-ec-ui--third-party-sdk-release-576.js:153 Uncaught (in promise) TypeError: Cannot convert undefined or null to object

It's very possible we're simply using the modal component incorrectly. I am not a React developer.

Thanks for pulling in our palette

This is clever. For having done all of this in the whirlwind of that week, this impressive haha. You saved me a bunch of time by doing this. Thanks :)

export function notebookJsonTreeStyling() {
const palette = {
"brand-050": "#f0fcfc",
"brand-100": "#c9f3f5",
"brand-400": "#52c6cc",
"brand-800": "#007e8a",
"brand-900": "#005054",
"neutral-050": "#fafbfb",
"neutral-100": "#f4f5f5",
"neutral-400": "#d5d7d7",
"neutral-800": "#2a3434",
"neutral-900": "#000e0e",
"neutral-extended-050": "#fafbfb",
"neutral-extended-100": "#f4f5f5",
"neutral-extended-200": "#edeeee",
"neutral-extended-300": "#e3e4e4",
"neutral-extended-400": "#d5d7d7",
"neutral-extended-500": "#b9bdbd",
"neutral-extended-600": "#8e9494",
"neutral-extended-700": "#464e4e",
"neutral-extended-800": "#2a3434",
"neutral-extended-900": "#000e0e",
"blue-050": "#f2fafc",
"blue-100": "#d0f0ff",
"blue-400": "#6cf",
"blue-800": "#0079bf",
"blue-900": "#003555",
"green-050": "#f2fcf3",
"green-100": "#d0ffd1",
"green-400": "#68f261",
"green-800": "#11a600",
"green-900": "#085400",
"yellow-050": "#fcf9f2",
"yellow-100": "#fff4d1",
"yellow-400": "#ffd966",
"yellow-800": "#bf9600",
"yellow-900": "#544c00",
"red-050": "#fcf2f3",
"red-100": "#ffd1d7",
"red-400": "#ff667a",
"red-800": "#bf0016",
"red-900": "#54000b"
}
const colors = {
BACKGROUND_COLOR: "none",
LABEL_COLOR: palette["blue-800"],
ARROW_COLOR: palette["neutral-extended-500"],
ITEM_STRING_EXPANDED_COLOR: palette["neutral-extended-500"],
ITEM_STRING_COLOR: palette["neutral-extended-500"],
STRING_COLOR: palette["red-400"],
DATE_COLOR: palette["green-400"],
NUMBER_COLOR: palette["blue-400"],
BOOLEAN_COLOR: palette["green-800"],
NULL_COLOR: palette["neutral-extended-500"],
UNDEFINED_COLOR: "#aaa",
FUNCTION_COLOR: "#aaa",
SYMBOL_COLOR: "#aaa",
}
const valueColorMap = colors => ({
String: colors.STRING_COLOR,
Date: colors.DATE_COLOR,
Number: colors.NUMBER_COLOR,
Boolean: colors.BOOLEAN_COLOR,
Null: colors.NULL_COLOR,
Undefined: colors.UNDEFINED_COLOR,
Function: colors.FUNCTION_COLOR,
Symbol: colors.SYMBOL_COLOR
});

Select a better default account

When you first enter the NRQL notebook and select account, a random number come us. This is confusing. Add an account picker and/or default to the first account of the user. (Or maybe the account associated with the API key??)

Below is what I see, even though I'm on account 1.
{
actor {
user {
email
name
}
account(id: 10)
}
}

Hide the time picker

The time picker is not relevant to this app. When the SDK supports it, hide it.

'Add New Query' throws error

[NOTE]: Hitting the Add New Query button throws console errors & returns the Opps! Something went wrong error message.

Description

[NOTE]: Hitting the Add New Query button throws console errors & returns the Opps! Something went wrong error message.

Steps to Reproduce

[NOTE]: Locally serving GraphiQl Notebook Nerdpack; try to Add New Query, watch error appear in console and in UI.

Relevant Logs / Console output.

Screenshot 2020-01-06 at 13 48 55

[NOTE]: nr1 nerdpack:serve --verbose did not reveal anything of interest for me.

Your Environment

  • NR1 CLI version used: @datanerd/nr1/1.10.10 darwin-x64 node-v10.16.3
  • Browser name and version: Safari 13.0.3 (15608.3.10.1.4)
  • Operating System and version: MacOS Catalina: 10.15.1 (19B88)

This issue originated in the Explorers Hub: https://discuss.newrelic.com/t/graphiql-notebook/90812

Notes multi-line textbox (<TextField>) behaving strangely

A notes field that's already populated with content that spans more than one line in the text area will be cut off, and the size of the text area will not automatically expand to fit. Typing in the box will cause the textarea to reset and size accordingly.

This may be a bug in the UI component itself, so worth reaching out to the NR1 SDK development team

Need support for complete graphiql

If my primary account that GraphiQL Notebook is associated with has feature flags for features like EventsToMetrics, these should be supported in the UI. If someone makes a call where feature flag is not supported, it should error.

If run a call like...
{

actor {
account(id: xxxxx) {
eventsToMetrics {
allRules {
rules {
accountId
description
enabled
id
name
nrql
}
}
}
}
}
}

If I pointed this query to an account that supports this, it just hangs.

[Repolinter] Open Source Policy Issues

Repolinter Report

๐Ÿค–This issue was automatically generated by repolinter-action, developed by the Open Source and Developer Advocacy team at New Relic. This issue will be automatically updated or closed when changes are pushed. If you have any problems with this tool, please feel free to open a GitHub issue or give us a ping in #help-opensource.

This Repolinter run generated the following results:

โ— Error โŒ Fail โš ๏ธ Warn โœ… Pass Ignored Total
0 1 0 12 0 13

Fail #

โŒ code-of-conduct-file-does-not-exist #

New Relic has moved the CODE_OF_CONDUCT file to a centralized location where it is referenced automatically by every repository in the New Relic organization. Because of this change, any other CODE_OF_CONDUCT file in a repository is now redundant and should be removed. For more information please visit https://docs.google.com/document/d/1y644Pwi82kasNP5VPVjDV8rsmkBKclQVHFkz8pwRUtE/view. Found files. Below is a list of files or patterns that failed:

  • CODE_OF_CONDUCT.md
    • ๐Ÿ”จ Suggested Fix: Remove file

Passed #

Click to see rules

โœ… license-file-exists #

Found file (LICENSE). New Relic requires that all open source projects have an associated license contained within the project. This license must be permissive (e.g. non-viral or copyleft), and we recommend Apache 2.0 for most use cases. For more information please visit https://docs.google.com/document/d/1vML4aY_czsY0URu2yiP3xLAKYufNrKsc7o4kjuegpDw/edit.

โœ… readme-file-exists #

Found file (README.md). New Relic requires a README file in all projects. This README should give a general overview of the project, and should point to additional resources (security, contributing, etc.) where developers and users can learn further. For more information please visit https://github.com/newrelic/open-source-tools/tree/master/javascript/oss-template.

โœ… readme-starts-with-nr1-catalog-header #

The first 1 lines contain all of the requested patterns. (README.md). The README of a community plus project should have a NR1 Catalog header at the start of the README. If you already have a NR1 Catalog header and this rule is failing, your header may be out of date, and you should update your header with the suggested one below. For more information please visit https://opensource.newrelic.com/oss-category/.

โœ… readme-contains-security-section #

Contains a security section (README.md). New Relic recommends having a Security section in your README to address concerns such as vulnerability reporting. This security section should also contain a link to the security policy (found under the "Security" tab of the repository). For an example of this section, please see the NR1 Catalog Template. For more information please visit https://nerdlife.datanerd.us/new-relic/security-guidelines-for-publishing-source-code.

โœ… readme-contains-link-to-security-policy #

Contains a link to the security policy for this repository (README.md). New Relic recommends referencing the open source security policy (https://github.com/newrelic/<repo-name>/security/policy or ../../security/policy) in a Security section in the README. For an example of this, please see the NR1 Catalog Template. For more information please visit https://nerdlife.datanerd.us/new-relic/security-guidelines-for-publishing-source-code.

โœ… readme-contains-discuss-topic #

Contains a link to the appropriate discuss.newrelic.com topic (README.md). New Relic recommends directly linking the your appropriate discuss.newrelic.com topic in the README, allowing developer an alternate method of getting support. For more information please visit https://nerdlife.datanerd.us/new-relic/security-guidelines-for-publishing-source-code.

โœ… third-party-notices-file-exists #

Found file (THIRD_PARTY_NOTICES.md). A THIRD_PARTY_NOTICES.md file must be present to grant attribution to all dependencies being used by this project. For JavaScript projects, you can generate this file using the oss-cli. For more information please visit https://docs.google.com/document/d/1y644Pwi82kasNP5VPVjDV8rsmkBKclQVHFkz8pwRUtE/view.

โœ… github-actions-workflow-file-exists #

Found file (.github/workflows/catalog.yml). Any Community Plus project must integrate with GitHub actions. For more information please visit https://docs.google.com/document/d/1y644Pwi82kasNP5VPVjDV8rsmkBKclQVHFkz8pwRUtE/view.

โœ… nr1-catalog-config-file-exists #

Found file (catalog/config.json).

โœ… nr1-catalog-screenshots-directory-exists #

Found file (catalog/screenshots).

โœ… nr1-catalog-documentation-file-exists #

Found file (catalog/documentation.md).

โœ… package-scripts-present #

An eslint-check and eslint-fix npm script found in file (package.json). NPM scripts for ESLint (eslint-check and eslint-fix) are required to properly integrate with the nerdpack system.

aliases are not supported

We should support aliases, but right now a query with aliases will just crash. This will require some adjustment to the augmentation phase, and can leverage the query document context we build

Fails to return Graphql results

Description

Some queries throw a JS error and never return results. While I use the example notebook for the example below, I also observed this behavior with a new notebook.

First example fails:
Screen Shot 2021-04-01 at 10 59 37 AM
With a JS error
Screen Shot 2021-04-01 at 11 00 57 AM

Second example works fine:
Screen Shot 2021-04-01 at 10 59 58 AM

Steps to Reproduce

  1. Open the Graphql Notebook
  2. Run the first example
  3. Notice that it never returns results

Expected Behaviour

The Graphql results are displayed.

Relevant Logs / Console output

Your Environment

  • NR1 CLI version used: @datanerd/nr1/1.32.0 darwin-x64 node-v10.16.3
  • Browser name and version: Chrome 89.0.4389.90 (Official Build) (x86_64)
  • Operating System and version: MacOS Big Sur 11.2.3

Graphiql notebook won't run locally

I was attempting to run the graphql notebook app locally to look at the console errors, but I'm getting a ton of errors from running NPM start. Not sure what that issue is, I've tried all my tricks.. ๐Ÿช„

Steps to reproduce

  • Pull down the most current code
  • run npm install
  • run npm start
  • view the terminal output

Expected

User can run this app locally

Errors

There were probably a 100 of these, this is just a small sample.


ERROR in ./node_modules/graphql/index.mjs 25:0-49
    Can't reexport the named export 'version' from non EcmaScript module (only default export is available)
     @ ./nerdlets/notebook-nerdlet/index.js
    
    ERROR in ./node_modules/graphql/index.mjs 25:0-49
    Can't reexport the named export 'versionInfo' from non EcmaScript module (only default export is available)
     @ ./nerdlets/notebook-nerdlet/index.js
    
    ERROR in ./node_modules/graphql/index.mjs 42:0-48:205
    Can't reexport the named export 'visit' from non EcmaScript module (only default export is available)
     @ ./nerdlets/notebook-nerdlet/index.js
    
    ERROR in ./node_modules/graphql/index.mjs 42:0-48:205
    Can't reexport the named export 'visitInParallel' from non EcmaScript module (only default export is available)
     @ ./nerdlets/notebook-nerdlet/index.js
    
    ERROR in ./node_modules/graphql/index.mjs 42:0-48:205
    Can't reexport the named export 'visitWithTypeInfo' from non EcmaScript module (only default export is available)
     @ ./nerdlets/notebook-nerdlet/index.js

Add welcome text comment...

Add text as comment to the default query to help orient the user to what's possible in the graphiql notebook. For example...
*** Note *** This text assumes that default notebooks are present when the application is loaded for the first time (see issue #11 )

Welcome to GraphiQL Notebooks!

Open the "Your Notebooks" dropdown to see the collection of default notebooks

to get you started!

Import other cool notebooks from https://github.com/newrelic/nr1-graphiql-notebook/notebooks

or add your own through a pull request!

Errors should be shown

Right now if the gql query comes back with an error we just fail to render, the only way to see what went wrong is literally looking at the response in the network tab.

We just need to detect errors and spit them out so they're visible, it doesn't need to be fancy.

Write tests

This nerdpack was produced in a time crunched hackathon. Great for making progress, poor for providing test coverage.

Things that would benefit from testing โ€”

  • Anything related to response augmentation. For example, different kinds of queries, queries with fragments, args, aliases, etc
  • Persistence
  • Sharing
  • Serialization
  • General tests of the components themselves (?)

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.