Coder Social home page Coder Social logo

undistro / cel-playground Goto Github PK

View Code? Open in Web Editor NEW
90.0 4.0 10.0 169.59 MB

CEL Playground provides a simple and user-friendly interface to write and quickly evaluate CEL expressions.

Home Page: https://playcel.undistro.io

License: Apache License 2.0

Makefile 4.24% Go 28.57% HTML 20.08% JavaScript 25.24% CSS 21.87%
cel common-expression-language golang playground wasm go hacktoberfest webassembly

cel-playground's People

Contributors

alfus avatar dependabot[bot] avatar joaovictor3g avatar knrc avatar lucasjct avatar marcelloale avatar matheusfm avatar monuelo avatar mrueg avatar pateldivyesh1323 avatar

Stargazers

 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  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  avatar

Watchers

 avatar  avatar  avatar

cel-playground's Issues

Top-level List as data is not supported

Description

A clear and concise description of the bug.

How to Reproduce

  1. Go to cel-playground
  2. Enter a valid JSON with a top-level array [ { "noun": "lion", "population": 123, "predator": true }, { "noun": "deer", "population": 456, "predator": false }, { "noun": "pigeon", "population": 789, "predator": false } ]
  3. Press Run
  4. View Output
  line 1: cannot unmarshal !!seq into map[string]interface {}

Expected Behavior

Top-level Array should be accepted as it's valid JSON. See: https://stackoverflow.com/questions/3833299/can-an-array-be-top-level-json-text

Screenshots

If applicable, add screenshots to help explain your problem.

System Information

  • OS: [e.g. MacOS]
  • OS Version: [e.g. 12.0]
  • Language Version: [e.g. Go 1.17.5, Node 16.13.1]
  • Package Manager Version: [e.g. NPM 6.14.1]
  • Browser (if applicable): [e.g. Google Chrome]
  • Browser Version (if applicable): [e.g. 81.0.4044.138]

Additional Context

Here's an example: https://playcel.undistro.io/?content=H4sIAAAAAAAAA4WQSQrDMAxFryK09qZz66tUWRiilICxjAcohNy9ciB006Qb8XkfPYQm7F1xaPFJAWBqA4AwSA2EVpMfRZNZiyixelcWaOFwPH2bxKqS1HhJlRufzYa1Z06b1vPl%2BtM6OJ%2F3tXF88c65t%2Fvjj5hChwb5rW3OuqWPIRxECHH%2BAMP1TOcrAQAA

Group examples by category

Feature Description

Iโ€™d like to suggest grouping examples by category.

Is your feature request related to a problem?

No.

What alternatives have you considered?

The categories could serve sections in the examples dropdown.

Additional Context

If you'd like to work on this or have questions, please comment below for more information.

Copy button for input fields

Feature Description

Propose adding a copy button for both the expression and input data fields in the CEL Playground.

Is this feature request related to a problem?

No

What alternatives have been considered?

An alternative solution could be implementing an icon button on top of the fields. Use phospor-icons for consistency.

Dark mode

Feature Description

I'd like to request the addition of a dark mode to the CEL Playground for a better user experience.

Is your feature request related to a problem?

No.

What alternatives have you considered?

Implement a toggle switch on the navbar for users to switch between light and dark mode.

Additional Context

If you'd like to work on this or have questions, please comment below for more information.

Add Istio example

Feature Description

Istio also uses CEL for custom metrics. I would like to suggest adding an example for Istio here.

Istio documentation: https://istio.io/latest/docs/tasks/observability/metrics/customize-metrics/#use-expressions-for-values

Is your feature request related to a problem?

No

What alternatives have you considered?

The examples are in the file: https://github.com/undistro/cel-playground/blob/main/examples.yaml

Additional Context

If you'd like to work on this or have questions, please comment below for more information.

Direct links for existing examples

Feature Description

Add direct links using query strings (e.g., ?example=example-id) for existing examples, allowing users to access them directly through URL.

Is this feature request related to a problem?

No

What alternatives have been considered?

Implementing query strings for direct links as it offers a straightforward and user-friendly solution.

Additional Context

Examples can be found at /web/assets/data.json, and they are loaded at main.js. Consider add an id to the examples JSON.

Output without error feedback

Description

When I run a wrong cel expression, the output don't show me the error, just show "evaluating ..." without error feedback.

How to Reproduce

  1. Go to CEL
  2. Click on 'Run'
  3. See error on output

Expected Behavior

Show the feedback error when I run the wrong expression. Like example below:
image

Additional Context

When reverting to previous commits, I've noticed that the bug started occurring after the merge of PR: #43.

Dropdown not showing all options for minor resolutions

Description

When we open dropdown menu 'Example' in minor resolutions (for example HD or zoom in on screen), the layout is broken to options CEL examples and it is hidden behind the footer.

How to Reproduce

  1. Go to https://playcel.undistro.io/
  2. Click on "Examples"
  3. Make a zoon in on screen
  4. See error when to click on Droopdown.

Expected Behavior

The dropdown should be responsible or create a scroll.

Screenshots

layoutcel

FR: save input and expression as a share link

Feature Description

I would like to be able to save my expression and input and share it as link, similar to the Go Playground

Is your feature request related to a problem?

No.

What alternatives have you considered?

None.

Additional Context

I totally understand that this requires making the app stateful and increases the operational costs. Feel free to reject if it's not reasonable or impose additional constraints like an expiration.

Random Praise

Thanks for making this! It is extremely helpful for experimenting with CEL for Kubernetes CRD field validations :)

Expand Kubernetes examples for multiple categories of CEL use

Feature Description

The existing Kubernetes examples in the drop-down are really nice, but CEL is supported in multiple contexts in Kubernetes, which have their own distinct inputs, documentation, and expected return types:

  1. CRD validation rules
    • self / oldSelf variables contain data
    • boolean return value is expected
  2. Admission webhook matchConditions and ValidatingAdmissionPolicy expressions
    • object / oldObject variables contain data, request..., params, namespaceObject variables contain metadata, authorizer variable allows access to authorization functions
    • boolean return value is expected
  3. OIDC claim mapping and user validation rules (new in 1.29, configured via file in kube-apiserver arg, design, in-progress docs)
    • claims variable contains claim data for validation (boolean return value) or extracting (string / string array return value, depending on the context)
    • user variable contains user info for validation
    • boolean return value is expected
  4. Authorization matchConditions (new in 1.29, configured via file in kube-apiserver arg, design, in-progress docs)
    • request variable contains SubjectAccessReview data
    • boolean return value is expected

The existing examples could be even more useful with some additions:

  1. examples per category
  2. links to docs for that category
  3. access to functions (like authorizer) with mocked return values available to that category
  4. type checking of the expected return value(s) for that category

Support full suite of cel-go extensions

Feature Description

Support cel-go extensions and document the set of extensions supported.

Better yet, allow an option box in the playground that enables/disables extensions (atleast cel-go extensions)

eg right now only the "strings" is supported

https://github.com/undistro/cel-playground/blob/main/eval/eval.go#L31

so this works now but not the stuff like base64.*

jwt.iss.lowerAscii() == 'auth.acme.com:12350'

Integrated with CEL cost system as in Kubernetes

Feature Description

For resource constraint purpose, the existing CEL related features in Kubernetes has been integrated with CEL cost system with cost budget specified. Ref: https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#resource-use-by-validation-functions

It would be great if cel-playground could offer the similar power so that user would have a idea on the cost of the cel expression they are going to run.

Is your feature request related to a problem?

n/a

What alternatives have you considered?

A clear and concise description of any alternative solutions or features you've considered.

Additional Context

Add any other context or screenshots about the feature request here.

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.