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

feat: floating windows example #1834

Merged
merged 26 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1ffd50f
rename workflow page
YohannParis Sep 7, 2023
9c94393
renaming workflow
YohannParis Sep 7, 2023
a9c6f96
do a first pass at floating window
YohannParis Sep 8, 2023
586a51a
Merge branch 'main' into yohannparis/pop-windows-example
YohannParis Sep 8, 2023
654eff3
Remove the route from route names
YohannParis Sep 8, 2023
57ef75a
Add the Worflow Node page
YohannParis Sep 8, 2023
39f6306
Update WorkflowNode.vue
YohannParis Sep 8, 2023
530e469
Remove the project as it is not needed in those cases
YohannParis Sep 8, 2023
fb85f20
Merge branch 'main' into yohannparis/pop-windows-example
YohannParis Sep 8, 2023
6ef7be3
clean up the route
YohannParis Sep 8, 2023
f7f5622
Simplify the workflow node
YohannParis Sep 8, 2023
9b098e1
add the workflow id for now
YohannParis Sep 8, 2023
c3890c4
Merge branch 'main' into yohannparis/pop-windows-example
YohannParis Sep 8, 2023
d3905b1
Update WorkflowNode.vue
YohannParis Sep 8, 2023
2d5ad13
Update WorkflowNode.vue
YohannParis Sep 11, 2023
e384fcf
Update WorkflowNode.vue
YohannParis Sep 11, 2023
4db31a1
Update WorkflowNode.vue
YohannParis Sep 11, 2023
902d6c7
Update tera-asset.vue
YohannParis Sep 11, 2023
f35e014
Update floating-window.ts
YohannParis Sep 11, 2023
191815d
Merge branch 'main' into yohannparis/pop-windows-example
YohannParis Sep 11, 2023
039cd0c
remove unnecessary project prop
YohannParis Sep 11, 2023
626aaa7
Merge branch 'main' into yohannparis/pop-windows-example
YohannParis Sep 11, 2023
f4cfb74
Remove project being needed as a prop
YohannParis Sep 11, 2023
ad6d854
Merge branch 'main' into yohannparis/pop-windows-example
YohannParis Sep 11, 2023
fa3c7ad
Merge branch 'main' into yohannparis/pop-windows-example
YohannParis Sep 12, 2023
4f3cb25
Remove projectId
YohannParis Sep 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<main @scroll="updateScrollPosition" id="tango">
<main @scroll="updateScrollPosition">
<slot name="nav" />
<header v-if="shrinkHeader || showStickyHeader" class="shrinked">
<h4 v-html="name" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ async function saveCode() {
toast.success('', `File saved as ${codeName.value}`);
codeAsset.value = newCodeAsset;
router.push({
name: RouteName.ProjectRoute,
name: RouteName.Project,
params: {
pageType: AssetType.Code,
projectId: props.project.id,
Expand All @@ -175,7 +175,7 @@ async function extractModel() {
);
if (extractedModelId) {
router.push({
name: RouteName.ProjectRoute,
name: RouteName.Project,
params: {
pageType: AssetType.Models,
projectId: props.project.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,21 +315,21 @@ const clearEvaluationScenario = () => {
};

const homeItem: MenuItem = {
label: RouteMetadata[RouteName.HomeRoute].displayName,
icon: RouteMetadata[RouteName.HomeRoute].icon,
label: RouteMetadata[RouteName.Home].displayName,
icon: RouteMetadata[RouteName.Home].icon,
command: () => router.push(RoutePath.Home)
};
const explorerItem: MenuItem = {
label: RouteMetadata[RouteName.DataExplorerRoute].displayName,
icon: RouteMetadata[RouteName.DataExplorerRoute].icon,
label: RouteMetadata[RouteName.DataExplorer].displayName,
icon: RouteMetadata[RouteName.DataExplorer].icon,
command: () => router.push(RoutePath.DataExplorer)
};
const navMenuItems = ref<MenuItem[]>([homeItem, explorerItem]);
const showNavigationMenu = (event) => {
navigationMenu.value.toggle(event);
};
const currentRoute = useCurrentRoute();
const isDataExplorer = computed(() => currentRoute.value.name === RouteName.DataExplorerRoute);
const isDataExplorer = computed(() => currentRoute.value.name === RouteName.DataExplorer);

/*
* User Menu
Expand Down Expand Up @@ -411,8 +411,7 @@ watch(
items.push({
label: project.name,
icon: 'pi pi-folder',
command: () =>
router.push({ name: RouteName.ProjectRoute, params: { projectId: project.id } })
command: () => router.push({ name: RouteName.Project, params: { projectId: project.id } })
});
});
navMenuItems.value = [homeItem, explorerItem, { label: 'Projects', items }];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function clearQuery() {

const initiateSearch = () => {
emit('query-changed', query.value);
router.push({ name: RouteName.DataExplorerRoute, query: { q: query.value } });
router.push({ name: RouteName.DataExplorer, query: { q: query.value } });
EventService.create(EventType.Search, resources.activeProject?.id, query.value);
};

Expand All @@ -179,7 +179,7 @@ function initiateSearchByExample() {
// used to update the search bar text with the name of the search by example asset
query.value = extractResourceName(searchByExampleItem.value);
router.push({
name: RouteName.DataExplorerRoute,
name: RouteName.DataExplorer,
query: { resourceId: getResourceID(searchByExampleItem.value!) }
});
}
Expand Down Expand Up @@ -253,7 +253,7 @@ watch(
// Clear the query if not on the data explorer view
watch(
() => route.name,
(name) => name !== RouteName.DataExplorerRoute && clearQuery()
(name) => name !== RouteName.DataExplorer && clearQuery()
);
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
@click="saveAsName = ''"
></i>
<i
v-if="projectId"
class="pi pi-check i"
:class="{ save: hasValidDatasetName }"
@click="
Expand Down Expand Up @@ -236,7 +237,7 @@ const dataLabelPlugin = [ChartDataLabels];

const props = defineProps<{
node: WorkflowNode;
project: IProject;
project?: IProject;
}>();

enum EnsembleTabs {
Expand Down Expand Up @@ -275,7 +276,7 @@ const extra = ref<EnsembleCalibrateExtraCiemss>(props.node.state.extra);
const completedRunId = computed<string>(
() => props?.node?.outputs?.[0]?.value?.[0].runId as string
);
const projectId = ref<string>(props.project.id);
const projectId = ref(props?.project?.id);

const customWeights = ref<boolean>(false);
// TODO: Does AMR contain weights? Can i check all inputs have the weights parameter filled in or the calibration boolean checked off?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { cloneDeep } from 'lodash';

const props = defineProps<{
node: WorkflowNode;
project: IProject;
project?: IProject;
}>();
const showKernels = ref(<boolean>false);
const showChatThoughts = ref(<boolean>false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ import TeraDataset from '@/components/dataset/tera-dataset.vue';

const props = defineProps<{
node: WorkflowNode;
project: IProject;
project?: IProject;
}>();
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { workflowEventBus } from '@/services/workflow';

const props = defineProps<{
node: WorkflowNode;
project: IProject;
project?: IProject;
}>();

// Send refresh event onto the eventBus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
@click="saveAsName = ''"
></i>
<i
v-if="projectId"
class="pi pi-check i"
:class="{ save: hasValidDatasetName }"
@click="
Expand Down Expand Up @@ -192,7 +193,7 @@ import InputText from 'primevue/inputtext';

const props = defineProps<{
node: WorkflowNode;
project: IProject;
project?: IProject;
}>();

const hasValidDatasetName = computed<boolean>(() => saveAsName.value !== '');
Expand All @@ -218,7 +219,7 @@ const selectedCols = ref<string[]>([]);
const paginatorRows = ref(10);
const paginatorFirst = ref(0);
const completedRunId = computed<string | undefined>(() => props?.node?.outputs?.[0]?.value?.[0]);
const projectId = ref<string>(props.project.id);
const projectId = ref(props?.project?.id);
YohannParis marked this conversation as resolved.
Show resolved Hide resolved

const configurationChange = (index: number, config: ChartConfig) => {
const state: SimulateCiemssOperationState = _.cloneDeep(props.node.state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
@click="saveAsName = ''"
></i>
<i
v-if="projectId"
class="pi pi-check i"
:class="{ save: hasValidDatasetName }"
@click="
Expand Down Expand Up @@ -227,7 +228,7 @@ const dataLabelPlugin = [ChartDataLabels];

const props = defineProps<{
node: WorkflowNode;
project: IProject;
project?: IProject;
}>();

enum EnsembleTabs {
Expand Down Expand Up @@ -258,7 +259,7 @@ const numSamples = ref<number>(props.node.state.numSamples);
const completedRunId = computed<string>(
() => props?.node?.outputs?.[0]?.value?.[0].runId as string
);
const projectId = ref<string>(props.project.id);
const projectId = ref(props?.project?.id);

const hasValidDatasetName = computed<boolean>(() => saveAsName.value !== '');
const showSaveInput = ref(<boolean>false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
@click="saveAsName = ''"
></i>
<i
v-if="projectId"
class="pi pi-check i"
:class="{ save: hasValidDatasetName }"
@click="
Expand Down Expand Up @@ -128,7 +129,7 @@ import TeraSimulateChart from './tera-simulate-chart.vue';

const props = defineProps<{
node: WorkflowNode;
project: IProject;
project?: IProject;
}>();

const timespan = ref<TimeSpan>(props.node.state.currentTimespan);
Expand All @@ -143,7 +144,7 @@ const activeTab = ref(SimulateTabs.input);
const model = ref<Model | null>(null);
const runResults = ref<RunResults>({});
const modelConfiguration = ref<ModelConfiguration | null>(null);
const projectId = ref<string>(props.project.id);
const projectId = ref(props?.project?.id);
const completedRunId = computed<string | undefined>(() => props?.node?.outputs?.[0]?.value?.[0]);
const hasValidDatasetName = computed<boolean>(() => saveAsName.value !== '');
const showSaveInput = ref(<boolean>false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
class="p-button-icon-only p-button-text p-button-rounded"
@click="showNodeDrilldown"
/>
<Button
icon="pi pi-bolt"
class="p-button-icon-only p-button-text p-button-rounded"
@click="openDrilldown"
/>
<!-- 3-dot options menu -->
<Button
icon="pi pi-ellipsis-v"
Expand Down Expand Up @@ -83,9 +88,13 @@ import {
import { ref, computed, onMounted, onBeforeUnmount } from 'vue';
import Button from 'primevue/button';
import Menu from 'primevue/menu';
import floatingWindow from '@/utils/floating-window';
import router from '@/router';
import { RouteName } from '@/router/routes';

const props = defineProps<{
node: WorkflowNode;
workflowId: string;
canDrag: boolean;
isActive: boolean;
}>();
Expand Down Expand Up @@ -176,6 +185,14 @@ function showNodeDrilldown() {
emit('drilldown', props.node);
}

function openDrilldown() {
const url = router.resolve({
name: RouteName.WorkflowNode,
params: { nodeId: props.node.id, workflowId: props.workflowId }
}).href;
floatingWindow.open(url);
}

function mouseoverPort(event) {
const el = event.target as HTMLElement;
const portElement = (el.firstChild as HTMLElement) ?? el;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
v-for="(node, index) in wf.nodes"
:key="index"
:node="node"
:workflowId="assetId"
@port-selected="(port: WorkflowPort, direction: WorkflowDirection) => createNewEdge(node, port, direction)"
@port-mouseover="onPortMouseover"
@port-mouseleave="onPortMouseleave"
Expand Down
2 changes: 1 addition & 1 deletion packages/client/hmi-client/src/page/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ const scroll = (direction: 'right' | 'left', event: MouseEvent) => {
};

function openProject(projectId: string) {
router.push({ name: RouteName.ProjectRoute, params: { projectId } });
router.push({ name: RouteName.Project, params: { projectId } });
}

async function createNewProject() {
Expand Down
63 changes: 63 additions & 0 deletions packages/client/hmi-client/src/page/WorkflowNode.vue
YohannParis marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<template>
<template v-if="node">
<tera-model-workflow-wrapper v-if="isNodeType(OperationType.MODEL)" :node="node" />
<tera-stratify v-else-if="isNodeType(OperationType.STRATIFY)" :node="node" />
<tera-dataset-transformer
v-else-if="isNodeType(OperationType.DATASET_TRANSFORMER)"
:node="node"
/>
<tera-dataset-workflow-wrapper v-else-if="isNodeType(OperationType.DATASET)" :node="node" />
<tera-calibration-julia v-else-if="isNodeType(OperationType.CALIBRATION_JULIA)" :node="node" />
<tera-simulate-julia v-else-if="isNodeType(OperationType.SIMULATE_JULIA)" :node="node" />
<tera-calibration-ciemss
v-else-if="isNodeType(OperationType.CALIBRATION_CIEMSS)"
:node="node"
/>
<tera-calibrate-ensemble-ciemss
v-else-if="isNodeType(OperationType.CALIBRATE_ENSEMBLE_CIEMSS)"
:node="node"
/>
<tera-simulate-ciemss v-else-if="isNodeType(OperationType.SIMULATE_CIEMSS)" :node="node" />
<tera-simulate-ensemble-ciemss
v-else-if="isNodeType(OperationType.SIMULATE_ENSEMBLE_CIEMSS)"
:node="node"
/>
</template>
YohannParis marked this conversation as resolved.
Show resolved Hide resolved
<template v-else>{{ node }}</template>
</template>

<script setup lang="ts">
import { watch, ref } from 'vue';
import { WorkflowNode, WorkflowOperationTypes as OperationType } from '@/types/workflow';
import TeraModelWorkflowWrapper from '@/components/workflow/tera-model-workflow-wrapper.vue';
import TeraDatasetWorkflowWrapper from '@/components/workflow/tera-dataset-workflow-wrapper.vue';
import TeraDatasetTransformer from '@/components/workflow/tera-dataset-transformer.vue';
import TeraCalibrationJulia from '@/components/workflow/tera-calibration-julia.vue';
import TeraSimulateJulia from '@/components/workflow/tera-simulate-julia.vue';
import TeraCalibrationCiemss from '@/components/workflow/tera-calibration-ciemss.vue';
import TeraCalibrateEnsembleCiemss from '@/components/workflow/tera-calibrate-ensemble-ciemss.vue';
import TeraSimulateCiemss from '@/components/workflow/tera-simulate-ciemss.vue';
import TeraSimulateEnsembleCiemss from '@/components/workflow/tera-simulate-ensemble-ciemss.vue';
import TeraStratify from '@/components/workflow/tera-stratify.vue';
import * as workflowService from '@/services/workflow';

const props = defineProps<{ nodeId: string; workflowId: string }>();

const node = ref<WorkflowNode>();

function isNodeType(type: OperationType): boolean {
return node.value?.operationType === type;
}

async function updateNode() {
const workflow = await workflowService.getWorkflow(props.workflowId);
const foundNode = workflow.nodes.find((n) => n.id === props.nodeId);
if (foundNode) node.value = foundNode;
}

watch(
() => props.nodeId,
() => updateNode(),
{ immediate: true }
);
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ async function createModelFromCode() {
await ProjectService.addAsset(props.project.id, AssetType.Models, model.id.toString());

router.push({
name: RouteName.ProjectRoute,
name: RouteName.Project,
params: {
assetName: newModelName,
assetId: model.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async function createNewModel() {
const modelId = await addNewModelToProject(newModelName.value.trim(), props.project);
if (modelId) {
router.push({
name: RouteName.ProjectRoute,
name: RouteName.Project,
params: {
pageType: AssetType.Models,
assetId: modelId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ async function editProject() {
}

async function openResource(data) {
router.push({ name: RouteName.ProjectRoute, params: data });
router.push({ name: RouteName.Project, params: data });
}

async function updateProjectName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
@vue:mounted="emit('asset-loaded')"
@open-new-asset="(assetType) => emit('open-new-asset', assetType)"
/>
<tera-simulation-workflow
<tera-workflow
v-else-if="pageType === AssetType.Workflows"
:asset-id="assetId ?? ''"
:project="project"
Expand Down Expand Up @@ -74,7 +74,7 @@ import TeraDataset from '@/components/dataset/tera-dataset.vue';
import TeraModel from '@/components/model/tera-model.vue';
import CodeEditor from '@/page/project/components/code-editor.vue';
import TeraProjectOverview from '@/page/project/components/tera-project-overview.vue';
import TeraSimulationWorkflow from '@/components/workflow/tera-simulation-workflow.vue';
import TeraWorkflow from '@/components/workflow/tera-workflow.vue';
import * as ProjectService from '@/services/project';
import { getArtifactArrayBuffer, getArtifactFileAsText } from '@/services/artifact';
import TeraPdfEmbed from '@/components/widgets/tera-pdf-embed.vue';
Expand Down Expand Up @@ -128,7 +128,7 @@ const getXDDuri = (assetId: Tab['assetId']): string =>

const openOverview = () => {
router.push({
name: RouteName.ProjectRoute,
name: RouteName.Project,
params: { pageType: ProjectPages.OVERVIEW, assetId: undefined }
});
};
Expand Down
Loading