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

Drilldown layout, behaviour, and preview #2303

Merged
merged 8 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
@@ -0,0 +1,93 @@
<template>
<div class="preview">
<div class="content-container">
<header>
<h5>Preview</h5>
<Dropdown
v-if="options"
class="output-dropdown"
:model-value="output"
:options="options"
@update:model-value="emit('update:output', $event)"
></Dropdown>
</header>
<main>
<slot />
</main>
</div>
<footer>
<Button
v-if="canSaveAsset"
outlined
label="Save Model"
@click="emit('save-asset')"
class="save-asset-button"
></Button>
<Button outlined label="Cancel" @click="emit('cancel')"></Button>
<Button label="Apply Changes and Close" @click="emit('apply-changes')"></Button>
</footer>
</div>
</template>

<script setup lang="ts">
import Button from 'primevue/button';
import Dropdown from 'primevue/dropdown';

defineProps<{
options?: string[]; // subject to change based on how we want to pass in output data
output?: string;
canSaveAsset?: boolean;
}>();

const emit = defineEmits(['cancel', 'apply-changes', 'save-asset', 'update:output']);
</script>

<style scoped>
.preview {
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
gap: 0.5rem;
}
.content-container {
display: flex;
flex-direction: column;
background-color: var(--surface-50);
flex-grow: 1;
padding: 1rem;
border-radius: var(--border-radius-medium);
box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.25) inset;
overflow: hidden;
}

footer {
display: flex;
justify-content: flex-end;
gap: 0.5rem;
}
.save-asset-button {
margin-right: auto;
}

header {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 0.5rem;
}

.content-container > main {
overflow-y: auto;
flex-grow: 1;
}

.output-dropdown:deep(.p-inputtext) {
padding: 0.75rem 1rem;
font-size: var(--font-body-small);
}

.output-dropdown:deep(.pi) {
font-size: var(--font-body-small);
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
>
<main>
<section
v-for="(view, index) in views"
v-for="(tab, index) in tabs"
class="slot-container"
:class="{ 'hide-slot': hideSlot(index) }"
:key="index"
>
<slot :name="view" />
<component :is="tab" class="drilldown-panel" />
</section>
</main>
</section>
Expand All @@ -36,7 +36,17 @@ const props = defineProps<{
const emit = defineEmits(['on-close-clicked']);
const slots = useSlots();

const views = computed(() => Object.keys(slots));
/**
* This will retrieve and filter all top level components in the default slot if they have the tabName prop.
*/
const tabs = computed(() => {
if (slots.default?.()) {
return slots.default().filter((vnode) => vnode.props?.tabName);
}
return [];
});

const views = computed(() => tabs.value.map((vnode) => vnode.props?.tabName));

const selectedViewIndex = ref<number>(0);

Expand Down Expand Up @@ -85,4 +95,12 @@ main {
.hide-slot {
display: none;
}

:deep(.drilldown-panel) {
display: grid;
grid-auto-flow: column;
height: 100%;
grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
padding: 1rem 1.5rem;
}
</style>
blanchco marked this conversation as resolved.
Show resolved Hide resolved
16 changes: 9 additions & 7 deletions packages/client/hmi-client/src/workflow/tera-workflow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,15 @@
:title="currentActiveNode.displayName"
:tooltip="'A brief description of the operator.'"
>
<component
:is="registry.getDrilldown(currentActiveNode.operationType)"
:node="currentActiveNode"
@append-output-port="(event: any) => appendOutputPort(currentActiveNode, event)"
@update-state="(event: any) => updateWorkflowNodeState(currentActiveNode, event)"
>
</component>
<section tabName="Wizard">
<component
:is="registry.getDrilldown(currentActiveNode.operationType)"
:node="currentActiveNode"
@append-output-port="(event: any) => appendOutputPort(currentActiveNode, event)"
@update-state="(event: any) => updateWorkflowNodeState(currentActiveNode, event)"
>
</component>
</section>
</tera-drilldown>
</Teleport>
</template>
Expand Down