mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-12 00:06:14 +00:00
fix all cases where schema has been set to undefined
This commit is contained in:
@@ -206,39 +206,42 @@ async fn premium_info(
|
||||
}
|
||||
|
||||
async fn stripe_checkout(authed: Authed, Extension(base_url): Extension<Arc<BaseUrl>>) {
|
||||
// let client = stripe::Client::new(std::env::var("STRIPE_KEY").expect("STRIPE_KEY"));
|
||||
// let success_rd = format!(
|
||||
// "{}/workspace_settings?session={{CHECKOUT_SESSION_ID}}",
|
||||
// base_url.0
|
||||
// );
|
||||
// let failure_rd = format!("{}/workspace_settings", base_url.0);
|
||||
// let checkout_session = {
|
||||
// let mut params = stripe::CreateCheckoutSession::new(&failure_rd, &success_rd);
|
||||
// params.mode = Some(stripe::CheckoutSessionMode::Subscription);
|
||||
// params.line_items = Some(vec![
|
||||
// stripe::CreateCheckoutSessionLineItems {
|
||||
// quantity: None,
|
||||
// price: Some("price_1MQzMHGU3NdFi9eLWFC7IXEv".to_string()),
|
||||
// ..Default::default()
|
||||
// },
|
||||
// stripe::CreateCheckoutSessionLineItems {
|
||||
// quantity: None,
|
||||
// price: Some("price_1MR2BZGU3NdFi9eLNRuibxPx".to_string()),
|
||||
// ..Default::default()
|
||||
// },
|
||||
// ]);
|
||||
// params.customer_email = Some(&authed.email);
|
||||
// params.client_reference_id = Some("foo");
|
||||
// stripe::CheckoutSession::create(&client, params)
|
||||
// .await
|
||||
// .unwrap()
|
||||
// };
|
||||
#[cfg(feature = "enterprise")]
|
||||
{
|
||||
let client = stripe::Client::new(std::env::var("STRIPE_KEY").expect("STRIPE_KEY"));
|
||||
let success_rd = format!(
|
||||
"{}/workspace_settings?session={{CHECKOUT_SESSION_ID}}",
|
||||
base_url.0
|
||||
);
|
||||
let failure_rd = format!("{}/workspace_settings", base_url.0);
|
||||
let checkout_session = {
|
||||
let mut params = stripe::CreateCheckoutSession::new(&failure_rd, &success_rd);
|
||||
params.mode = Some(stripe::CheckoutSessionMode::Subscription);
|
||||
params.line_items = Some(vec![
|
||||
stripe::CreateCheckoutSessionLineItems {
|
||||
quantity: None,
|
||||
price: Some("price_1MQzMHGU3NdFi9eLWFC7IXEv".to_string()),
|
||||
..Default::default()
|
||||
},
|
||||
stripe::CreateCheckoutSessionLineItems {
|
||||
quantity: None,
|
||||
price: Some("price_1MR2BZGU3NdFi9eLNRuibxPx".to_string()),
|
||||
..Default::default()
|
||||
},
|
||||
]);
|
||||
params.customer_email = Some(&authed.email);
|
||||
params.client_reference_id = Some("foo");
|
||||
stripe::CheckoutSession::create(&client, params)
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
// println!(
|
||||
// "created a {} at {}",
|
||||
// checkout_session.payment_status,
|
||||
// checkout_session.url.unwrap()
|
||||
// );
|
||||
println!(
|
||||
"created a {} at {}",
|
||||
checkout_session.payment_status,
|
||||
checkout_session.url.unwrap()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async fn exists_workspace(
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { inferArgs } from '$lib/infer'
|
||||
import { initialCode, isInitialCode } from '$lib/script_helpers'
|
||||
import { userStore, workspaceStore } from '$lib/stores'
|
||||
import { encodeState, sendUserToast, setQueryWithoutLoad } from '$lib/utils'
|
||||
import { emptySchema, encodeState, sendUserToast, setQueryWithoutLoad } from '$lib/utils'
|
||||
import Path from './Path.svelte'
|
||||
import RadioButton from './RadioButton.svelte'
|
||||
import ScriptEditor from './ScriptEditor.svelte'
|
||||
@@ -58,6 +58,8 @@
|
||||
try {
|
||||
$dirtyStore = false
|
||||
localStorage.removeItem(script.path)
|
||||
|
||||
script.schema = script.schema ?? emptySchema()
|
||||
if (!script.schema) {
|
||||
await inferArgs(script.language, script.content, script.schema)
|
||||
}
|
||||
@@ -84,6 +86,7 @@
|
||||
|
||||
async function changeStep(step: number) {
|
||||
if (step > 1) {
|
||||
script.schema = script.schema ?? emptySchema()
|
||||
await inferArgs(script.language, script.content, script.schema)
|
||||
}
|
||||
goto(`?step=${step}`)
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
}
|
||||
|
||||
async function inferSchema(code: string) {
|
||||
schema = schema ?? emptySchema()
|
||||
let isDefault: string[] = []
|
||||
Object.entries(args).forEach(([k, v]) => {
|
||||
if (schema.properties[k].default == v) {
|
||||
|
||||
@@ -137,6 +137,9 @@
|
||||
on:change={async (e) => {
|
||||
if (inlineScript) {
|
||||
const oldSchema = JSON.stringify(inlineScript.schema)
|
||||
if (inlineScript.schema == undefined) {
|
||||
inlineScript.schema = emptySchema()
|
||||
}
|
||||
await inferInlineScriptSchema(inlineScript?.language, e.detail, inlineScript.schema)
|
||||
if (JSON.stringify(inlineScript.schema) != oldSchema) {
|
||||
inlineScript = inlineScript
|
||||
|
||||
Reference in New Issue
Block a user