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

Small fixes #2721

Merged
merged 8 commits into from
Feb 15, 2024
Merged
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 @@ -152,8 +141,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 TeraModelCard from '@/components/model/petrinet/tera-model-card.vue';
import { ModelServiceType } from '@/types/common';
Expand Down Expand Up @@ -237,16 +224,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
Loading