Skip to content

Commit

Permalink
Small fixes (#2721)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
  • Loading branch information
YohannParis and renovate[bot] authored Feb 15, 2024
1 parent 94d8ce1 commit f9f5416
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,20 @@ const forkMenuItem = {
}
}
};
const separatorMenuItem = { separator: true };
const projectMenuItems = computed(() => {
const items = [] as any[];
if (props.project?.publicProject) {
return [forkMenuItem];
items.push(forkMenuItem);
}
if (props.project?.userPermission === 'creator') {
return [renameMenuItem, shareMenuItem, separatorMenuItem, removeMenuItem];
items.push(renameMenuItem, shareMenuItem, separatorMenuItem, removeMenuItem);
}
if (props.project?.userPermission === 'writer') {
return [renameMenuItem, shareMenuItem];
}
if (props.project?.userPermission === 'reader') {
return [];
items.push(renameMenuItem, shareMenuItem);
}
return [];
return items;
});
function toggle(event) {
Expand Down
4 changes: 3 additions & 1 deletion packages/client/hmi-client/src/page/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ const viewOptions = ref([
const myFilteredSortedProjects = computed(() => {
const projects = useProjects().allProjects.value;
if (!projects) return [];
const myProjects = projects.filter(({ publicProject }) => publicProject === false);
const myProjects = projects.filter(({ userPermission }) =>
['creator', 'writer'].includes(userPermission ?? '')
);
return filterAndSortProjects(myProjects);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ watch(
if (!props.node.outputs.find((port) => port.type === 'documentId')) {
emit('append-output-port', {
type: 'documentId',
label: `${document.value.name}`,
label: `document`,
value: [document.value.id]
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export interface ModelFromDocumentState {

export const ModelFromDocumentOperation: Operation = {
name: WorkflowOperationTypes.MODEL_FROM_DOCUMENT,
description: 'Create model from document',
displayName: 'Create model from document',
description: 'Create model from equations',
displayName: 'Create model from equations',
isRunnable: true,
inputs: [
{ type: 'equations', label: 'Equations' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,53 +13,42 @@
</template>
<div>
<tera-drilldown-section :is-loading="assetLoading">
<Steps
:model="formSteps"
:readonly="false"
@update:active-step="activeStepperIndex = $event"
/>

<div class="equation-view" v-if="activeStepperIndex === 0">
<header class="header-group">
<p>These equations will be used to create your model.</p>
<Button label="Add an equation" icon="pi pi-plus" text @click="addEquation" />
</header>
<ul class="blocks-container">
<li v-for="(equation, i) in clonedState.equations" :key="i">
<tera-asset-block
:is-included="equation.includeInProcess"
@update:is-included="onUpdateInclude(equation)"
:is-deletable="!instanceOfEquationFromImageBlock(equation.asset)"
@delete="removeEquation(i)"
>
<template #header>
<h5>{{ equation.name }}</h5>
</template>
<div class="block-container">
<template v-if="instanceOfEquationFromImageBlock(equation.asset)">
<label>Extracted Image:</label>
<Image
id="img"
:src="getAssetUrl(equation as AssetBlock<EquationFromImageBlock>)"
:alt="''"
preview
/>
</template>
<label>Interpreted As:</label>
<tera-math-editor :latex-equation="equation.asset.text" :is-editable="false" />
<InputText
v-model="equation.asset.text"
placeholder="Unable to automatically extract LaTeX from the image. Please manually input the expression."
@update:model-value="emit('update-state', clonedState)"
<header class="header-group">
<p>These equations will be used to create your model.</p>
<Button label="Add an equation" icon="pi pi-plus" text @click="addEquation" />
</header>
<ul class="blocks-container">
<li v-for="(equation, i) in clonedState.equations" :key="i">
<tera-asset-block
:is-included="equation.includeInProcess"
@update:is-included="onUpdateInclude(equation)"
:is-deletable="!instanceOfEquationFromImageBlock(equation.asset)"
@delete="removeEquation(i)"
>
<template #header>
<h5>{{ equation.name }}</h5>
</template>
<div class="block-container">
<template v-if="instanceOfEquationFromImageBlock(equation.asset)">
<label>Extracted Image:</label>
<Image
id="img"
:src="getAssetUrl(equation as AssetBlock<EquationFromImageBlock>)"
:alt="''"
preview
/>
</div>
</tera-asset-block>
</li>
</ul>
</div>
<div v-if="activeStepperIndex === 1">
<Textarea v-model="clonedState.text" autoResize disabled style="width: 100%" />
</div>
</template>
<label>Interpreted As:</label>
<tera-math-editor :latex-equation="equation.asset.text" :is-editable="false" />
<InputText
v-model="equation.asset.text"
placeholder="Unable to automatically extract LaTeX from the image. Please manually input the expression."
@update:model-value="emit('update-state', clonedState)"
/>
</div>
</tera-asset-block>
</li>
</ul>
<template #footer>
<span>
<label>Model framework:</label>
Expand Down Expand Up @@ -146,8 +135,6 @@ import TeraOperatorPlaceholder from '@/components/operator/tera-operator-placeho
import { useProjects } from '@/composables/project';
import TeraMathEditor from '@/components/mathml/tera-math-editor.vue';
import InputText from 'primevue/inputtext';
import Steps from 'primevue/steps';
import Textarea from 'primevue/textarea';
import TeraModelModal from '@/page/project/components/tera-model-modal.vue';
import { ModelServiceType } from '@/types/common';
import TeraOutputDropdown from '@/components/drilldown/tera-output-dropdown.vue';
Expand Down Expand Up @@ -231,16 +218,6 @@ const selectedModel = ref<Model | null>(null);
const card = ref<Card | null>(null);
const goLLMCard = computed<any>(() => document.value?.metadata?.gollmCard);
const formSteps = ref([
{
label: 'Equations'
},
{
label: 'Text'
}
]);
const activeStepperIndex = ref<number>(0);
const isNewModelModalVisible = ref(false);
const savingAsset = ref(false);
Expand Down

0 comments on commit f9f5416

Please sign in to comment.