Skip to content

Commit

Permalink
merge 2.31.5 back into main (#6419)
Browse files Browse the repository at this point in the history
Co-authored-by: Cole Blanchard <33158416+blanchco@users.noreply.github.com>
Co-authored-by: Nelson Liu <nliu@uncharted.software>
Co-authored-by: Yohann Paris <github@yohannparis.com>
Co-authored-by: Cole Blanchard <cblanchard@Coles-MacBook-Pro.local>
Co-authored-by: Derek Vince <dvince@uncharted.software>
Co-authored-by: Daniel Chang <mwdchang@gmail.com>
Co-authored-by: Tom Szendrey <T.Szendrey@hotmail.com>
Co-authored-by: Shawn Yama <syama@uncharted.software>
Co-authored-by: Jamie Waese <120480244+jamiewaese-uncharted@users.noreply.github.com>
Co-authored-by: Jaehwan Ryu <jryu@uncharted.software>
Co-authored-by: Adrian <95376249+asylves1@users.noreply.github.com>
  • Loading branch information
12 people authored Feb 5, 2025
1 parent a5a1290 commit 358d9b6
Show file tree
Hide file tree
Showing 25 changed files with 605 additions and 346 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@

<script setup lang="ts">
import { computed, ref } from 'vue';
import { debounce } from 'lodash';
import Button from 'primevue/button';
import Dropdown from 'primevue/dropdown';
import TeraConcept from '@/components/widgets/tera-concept.vue';
Expand All @@ -90,25 +91,29 @@ const props = defineProps<{
const emit = defineEmits(['update-item']);
const debouncer = debounce((key: string, value: string = '') => {
emit('update-item', { key, value });
}, 300);
const nameText = computed({
get: () => props.name,
set: (newName) => emit('update-item', { key: 'name', value: newName })
set: (newName) => debouncer('name', newName)
});
const unitExpression = computed({
get: () => props.unitExpression,
set: (newUnitExpression) => emit('update-item', { key: 'unitExpression', value: newUnitExpression })
set: (newUnitExpression) => debouncer('unitExpression', newUnitExpression)
});
const descriptionText = computed({
get: () => props.description,
set: (newDescription) => {
emit('update-item', { key: 'description', value: newDescription });
debouncer('description', newDescription);
showDescription.value = !!newDescription;
}
});
const showDescription = ref<boolean>(!!descriptionText.value);
const grounding = computed({
get: () => props.grounding,
set: (newGrounding) => emit('update-item', { key: 'grounding', value: newGrounding })
set: (newGrounding) => debouncer('grounding', newGrounding)
});
// If we are in preview mode and there is no content, show nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ onMounted(async () => {
.empty {
border-left: 4px solid var(--error-color);
}
.empty:hover {
border-left: 4px solid var(--error-color);
background-color: var(--red-50);
}
header {
display: flex;
flex-direction: column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,22 @@
<ul>
<li v-for="{ baseInitial, childInitials, isVirtual } in initialList" :key="baseInitial">
<!-- Stratified -->
<section v-if="isVirtual" class="initial-entry-stratified">
<section
v-if="isVirtual"
class="initial-entry-stratified"
:class="{ warning: hasEmptyExpressions({ baseInitial }) }"
>
<Accordion multiple>
<AccordionTab>
<template #header>
<span>{{ baseInitial }}</span>
<Button label="Open Matrix" text size="small" @click.stop="matrixModalId = baseInitial" />
<Button
label="Open matrix"
text
size="small"
@click.stop="matrixModalId = baseInitial"
class="ml-3"
/>
</template>
<ul>
<li v-for="{ target } in childInitials" :key="target">
Expand Down Expand Up @@ -110,6 +120,12 @@ const initialList = computed<
.filter(({ baseInitial }) => baseInitial.toLowerCase().includes(filterText.value.toLowerCase()));
});
const hasEmptyExpressions = computed(() => ({ baseInitial }) => {
const semanticsForThisInitial = props.modelConfiguration.initialSemanticList.filter((s) =>
s.target.startsWith(`${baseInitial}_`)
);
return semanticsForThisInitial.some((s) => !s.expression);
});
const currentActiveIndicies = ref([0]);
const matrixModalId = ref('');
Expand Down Expand Up @@ -138,15 +154,13 @@ ul {
border-left: 4px solid var(--surface-300);
padding-left: var(--gap-1);
}
.initial-entry-stratified:hover {
border-left-color: var(--primary-color);
background: var(--surface-highlight);
.initial-entry-stratified.warning {
border-left-color: var(--error-color);
}
/* But set a lighter hover state when hovering over child elements */
.initial-entry-stratified:hover:has(.initial-entry:hover) {
border-left: 4px solid var(--primary-color-light);
background: color-mix(in srgb, var(--surface-highlight) 30%, var(--surface-0) 70%);
.initial-entry-stratified.warning:hover {
border-left-color: var(--error-color);
}
.artifact-amount {
font-size: var(--font-caption);
color: var(--text-color-subdued);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="parameter-entry flex flex-column flex-1" :class="{ empty: isParameterEmpty }">
<div class="parameter-entry flex flex-column flex-1" :class="{ empty: computedIsParameterEmpty }">
<header class="gap-1 pt-2 pb-2">
<div class="flex">
<strong>{{ parameterId }}</strong>
Expand Down Expand Up @@ -82,7 +82,7 @@
</template>

<script setup lang="ts">
import { computed, ref, onMounted } from 'vue';
import { computed, ref, onMounted, watch } from 'vue';
import { Model, ModelConfiguration } from '@/types/Types';
import {
getParameterSource,
Expand Down Expand Up @@ -149,6 +149,19 @@ onMounted(async () => {
const parameter = getParameterDistribution(props.modelConfiguration, props.parameterId, true);
isParameterEmpty.value = inferredDistribution.value ? false : isParameterInputEmpty(parameter);
});
const computedIsParameterEmpty = computed(() => {
const parameter = getParameterDistribution(props.modelConfiguration, props.parameterId);
return inferredDistribution.value ? false : isParameterInputEmpty(parameter);
});
watch(
[inferredDistribution, () => getParameterDistribution(props.modelConfiguration, props.parameterId)],
([newInferredDist, newParameter]) => {
isParameterEmpty.value = newInferredDist ? false : isParameterInputEmpty(newParameter);
},
{ immediate: true }
);
</script>

<style scoped>
Expand All @@ -162,7 +175,7 @@ onMounted(async () => {
transition: all 0.15s;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.parameter-entry:hover {
.parameter-entry:hover:not(.empty) {
border-left: 4px solid var(--primary-color);
background: var(--surface-highlight);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@
<ul class="pl-1">
<li v-for="{ baseParameter, childParameters, isVirtual } in parameterList" :key="baseParameter">
<!-- Stratified -->
<section v-if="isVirtual" class="parameter-entry-stratified">
<section
v-if="isVirtual"
class="parameter-entry-stratified"
:class="{ warning: hasEmptyParameters({ baseParameter }) }"
>
<Accordion multiple>
<AccordionTab>
<template #header>
Expand All @@ -82,7 +86,7 @@
text
size="small"
@click.stop="matrixModalId = baseParameter"
class="ml-auto"
class="ml-3"
/>
</div>
</template>
Expand Down Expand Up @@ -225,6 +229,17 @@ const parameterList = computed<{ baseParameter: string; childParameters: Paramet
}
);
const hasEmptyParameters = computed(() => ({ baseParameter }) => {
const parametersForThisGroup = props.modelConfiguration.parameterSemanticList.filter((s) =>
s.referenceId.startsWith(`${baseParameter}_`)
);
return parametersForThisGroup.some((p) => {
const value = p.distribution?.parameters?.value;
return value === null || value === undefined || value === '' || Number.isNaN(value);
});
});
const matrixModalId = ref('');
const onAddUncertainty = () => {
Expand Down Expand Up @@ -335,14 +350,19 @@ ul {
border-left: 4px solid var(--surface-300);
padding-left: var(--gap-1);
}
.parameter-entry-stratified:hover {
border-left-color: var(--primary-color);
background: var(--surface-highlight);
.parameter-entry-stratified {
border: 1px solid var(--surface-border-light);
border-radius: var(--border-radius);
background: var(--surface-0);
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
border-left: 4px solid var(--surface-300);
padding-left: var(--gap-1);
}
.parameter-entry-stratified.warning {
border-left-color: var(--error-color);
}
/* But set a lighter hover state when hovering over child elements */
.parameter-entry-stratified:hover:has(.parameter-entry:hover) {
border-left: 4px solid var(--primary-color-light);
background: color-mix(in srgb, var(--surface-highlight) 30%, var(--surface-0) 70%);
.parameter-entry-stratified.warning:hover {
border-left-color: var(--error-color);
}
.stratified {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,12 @@ const runResultSummaryPre = ref<DataArray>([]);
const showSaveModal = ref(false);
const configuredModelConfig = ref<ModelConfiguration | null>(null);
const isLoading = ref(false);
const isLoading = computed<boolean>(
() =>
props.node.state.inProgressCalibrationId !== '' ||
props.node.state.inProgressPreForecastId !== '' ||
props.node.state.inProgressForecastId !== ''
);
const mapping = ref<CalibrateMap[]>(props.node.state.mapping);
Expand Down Expand Up @@ -1116,11 +1121,9 @@ watch(
[() => props.node.state.inProgressCalibrationId, lossChartSize],
([id, size]) => {
if (id === '') {
isLoading.value = false;
updateLossChartSpec(lossValues.value, size);
unsubscribeToUpdateMessages([id], ClientEventType.SimulationPyciemss, messageHandler);
} else {
isLoading.value = true;
updateLossChartSpec(LOSS_CHART_DATA_SOURCE, size);
subscribeToUpdateMessages([id], ClientEventType.SimulationPyciemss, messageHandler);
}
Expand Down
Loading

0 comments on commit 358d9b6

Please sign in to comment.