Skip to content

Commit

Permalink
update to match units schema
Browse files Browse the repository at this point in the history
  • Loading branch information
duranb committed Aug 31, 2023
1 parent 583c428 commit 1ec5a02
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 18 deletions.
Binary file modified e2e-tests/data/banananation-develop.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion src/components/parameters/ParameterBaseBoolean.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
use:useActions={use}
/>
<div class="parameter-right" slot="right">
<ParameterUnits units={formParameter.units} />
<ParameterUnits unit={formParameter.unit} />
<ParameterBaseRightAdornments
{disabled}
hidden={hideRightAdornments}
Expand Down
2 changes: 1 addition & 1 deletion src/components/parameters/ParameterBaseNumber.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
on:change={() => dispatch('change', formParameter)}
/>
<div class="parameter-right" slot="right">
<ParameterUnits units={formParameter.units} />
<ParameterUnits unit={formParameter.unit} />
<ParameterBaseRightAdornments
{disabled}
hidden={hideRightAdornments}
Expand Down
2 changes: 1 addition & 1 deletion src/components/parameters/ParameterBaseString.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
on:change={() => dispatch('change', formParameter)}
/>
<div class="parameter-right" slot="right">
<ParameterUnits units={formParameter.units} />
<ParameterUnits unit={formParameter.unit} />
<ParameterBaseRightAdornments
{disabled}
hidden={hideRightAdornments}
Expand Down
11 changes: 6 additions & 5 deletions src/components/parameters/ParameterInfo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
let isTooltipHovered: boolean = false;
let leaveTimeout: NodeJS.Timeout | null = null;
let source: ValueSource;
let units: string | undefined = undefined;
let unit: string | undefined = undefined;
$: if (formParameter) {
source = formParameter.valueSource;
units = formParameter.units;
unit = formParameter.unit;
}
function leaveCallback() {
Expand Down Expand Up @@ -71,16 +71,16 @@
}
</script>

{#if units || source !== 'none'}
{#if unit || source !== 'none'}
<div class="parameter-info-container" role="contentinfo" on:mouseenter={onIconOver} on:mouseleave={onIconOut}>
<div><InfoIcon /></div>
<ContextMenu hideAfterClick={false} bind:this={contextMenu}>
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div class="parameter-info-tooltip" on:mouseenter={onTooltipOver} on:mouseleave={onTooltipOut}>
<div class="parameter-info-values">
{#if units}
{#if unit}
<div class="parameter-info-label">Units</div>
<div class="parameter-info-value">{units}</div>
<div class="parameter-info-value">{unit}</div>
{/if}
{#if source !== 'none'}
<div class="parameter-info-label">Source</div>
Expand All @@ -102,6 +102,7 @@
.parameter-info-values {
display: grid;
grid-template-columns: 1fr 1fr;
row-gap: 12px;
}
.parameter-info-label {
Expand Down
2 changes: 1 addition & 1 deletion src/components/parameters/ParameterRecSeries.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
name: `[${i}]`,
order: i,
schema: schema.items,
units: formParameter.units,
unit: formParameter.unit,
value: getArgument(value[i], schema.items).value,
valueSource: formParameter.valueSource,
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/parameters/ParameterRecStruct.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
name: key,
order: index,
schema: schema.items[key],
units: formParameter.units,
unit: formParameter.unit,
value: value !== null ? value[key] : null,
valueSource: formParameter.valueSource,
};
Expand Down
6 changes: 3 additions & 3 deletions src/components/parameters/ParameterUnits.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<svelte:options immutable={true} />

<script lang="ts">
export let units: string | undefined = undefined;
export let unit: string | undefined = undefined;
</script>

{#if units}
<span class="parameter-units">{units}</span>
{#if unit}
<span class="parameter-units">{unit}</span>
{/if}

<style>
Expand Down
4 changes: 2 additions & 2 deletions src/types/parameter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type FormParameter<T = ValueSchema> = {
order: number;
required?: boolean;
schema: T;
units?: string;
unit?: string;
value: Argument;
valueSource: ValueSource;
};
Expand All @@ -24,7 +24,7 @@ export type Argument = any;

export type ArgumentsMap = Record<ParameterName, Argument>;

export type Parameter = { order: number; schema: ValueSchema; units?: string };
export type Parameter = { order: number; schema: ValueSchema; unit?: string };

export type ParameterError = { message: string; schema: ValueSchema };

Expand Down
2 changes: 1 addition & 1 deletion src/utilities/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ const gql = {
jar_id
name
parameters {
parameters
parameter_definitions
}
version
}
Expand Down
4 changes: 2 additions & 2 deletions src/utilities/parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function getFormParameters(
presetArgumentsMap: ArgumentsMap = {},
defaultArgumentsMap: ArgumentsMap = {},
): FormParameter[] {
const formParameters = Object.entries(parametersMap).map(([name, { order, schema, units }]) => {
const formParameters = Object.entries(parametersMap).map(([name, { order, schema, unit }]) => {
const arg: Argument = argumentsMap[name];
const preset: Argument = presetArgumentsMap[name];
const defaultArg: Argument | undefined = defaultArgumentsMap[name];
Expand All @@ -76,7 +76,7 @@ export function getFormParameters(
order,
required,
schema,
units,
unit,
value,
valueSource,
};
Expand Down

0 comments on commit 1ec5a02

Please sign in to comment.