Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: JSONSchema generated forms for contexts #257

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ShubhranshuSanjeev
Copy link
Collaborator

Problem

Describe the problem you are trying to solve here

Solution

Provide a brief summary of your solution so that reviewers can understand your code

Environment variable changes

What ENVs need to be added or changed

Pre-deployment activity

Things needed to be done before deploying this change (if any)

Post-deployment activity

Things needed to be done after deploying this change (if any)

API changes

Endpoint Method Request body Response Body
API GET/POST, etc request response

Possible Issues in the future

Describe any possible issues that could occur because of this change

@ShubhranshuSanjeev ShubhranshuSanjeev force-pushed the fix/context-form branch 2 times, most recently from 25de1f1 to d86f41d Compare October 8, 2024 08:11
impl Operand {
pub fn from_operand_json(value: Value) -> Self {
match value {
Value::Object(ref o) if o.contains_key("var") => Operand::Dimension(value),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If ref required here ?
Can we remove it ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want a reference.

@ShubhranshuSanjeev ShubhranshuSanjeev force-pushed the fix/context-form branch 2 times, most recently from 0cca50a to 5346aa1 Compare October 23, 2024 10:22
@ShubhranshuSanjeev ShubhranshuSanjeev changed the title Fix/context form fix: JSONSchema generated forms for contexts Oct 23, 2024
@ShubhranshuSanjeev ShubhranshuSanjeev marked this pull request as ready for review October 28, 2024 08:25
@ShubhranshuSanjeev ShubhranshuSanjeev requested a review from a team as a code owner October 28, 2024 08:25
@ShubhranshuSanjeev ShubhranshuSanjeev force-pushed the fix/context-form branch 2 times, most recently from 0b7248b to 533787b Compare November 18, 2024 09:39
Operands(
iter.into_iter()
.map(Operand::from_operand_json)
.collect::<Vec<Operand>>(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make a type for Vec as Operands as we made for Conditions ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't really understand the point.

let on_context_edit = Callback::new(move |data: (Context, Map<String, Value>)| {
let (context, overrides) = data;
let conditions =
Conditions::from_context_json(&context.condition.into()).unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid using plain unwrap here ?

let on_context_clone = Callback::new(move |data: (Context, Map<String, Value>)| {
let (context, overrides) = data;
let conditions =
Conditions::from_context_json(&context.condition.into()).unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here


open_drawer("context_and_override_drawer");
});
open_drawer("context_and_override_drawer");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we create ENUMs for these strings , it's a little dangerous to keep it as strings

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drawers are going away in my next PR, so this will be redundant work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants