From 53214cc77db4a5a273f437ac9640aeb501255426 Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Sat, 4 Nov 2023 12:48:44 +0000 Subject: [PATCH] FE2/Automate: Viewer Page Integration (#1851) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(ui): adds link to all models from project dashboard card * feat(ui): refactoring layout to focus on function runs * chore(server): a bunch of comments regarding some unclear automate api parts * feat(fe2/automate): cleans up automate results dialog summary * feat(fe2/automate): adds automation status to model list view * feat(fe2/automate): adds automation status to version card * feat(fe2/automate): adds automation status to version card properly * feat(fe2/automate): linting & adds id back to func name for refs * fix(fe2): linting errs/fe2 tests * fix(fe2): types * fix(fe2): types... * fix(fe2/automate): brings back status update tracking 🤞 * fix(fe2/automate): scaffolds viewer automate panel * fix(fe2/automate): revamps viewer resource query to include automation status, adds proper sidebar button for automation status * fix(fe2/automate): more WIP work on automation status integration in viewer page * feat(fe2/automate): adds important note to self * feat(fe2/automate): more results display wokr * feat(fe2/automate): adds resulting models to query, improves layout * feat(fe2/automate): wraps up result model overlays * feat(fe2/automate): fixes up multiple attachment layout errors * feat(fe2/automate): adds view results button in lieu of context view, but in the presence of resultVersions * feat(fe2/automate): minor fix to viewer layout panel to only show actions if slot is populated * feat(fe2/automate): cleanup and type fixes * feat(fe2/automate): automate dialog main action > view model WIP * feat(fe2/automate): wraps up view model in automation status dialog * feat(fe2/automate): copy change in automation status dialog * feat(fe2/automate): eslint fix * feat(fe2/automate): prettier :/ * feat(fe2/automate): adds gradient colouring * feat(fe2/automate): comments * feat(fe2/automate): limits initial length of displayed runs, adds poor man's pagination, and reverts to run result click click behaviour * feat(fe2/automate): lint --- .../AttachmentButton.vue} | 30 +- .../automation/ViewerFunctionRunItem.vue | 209 +++++++++++++ .../automation/ViewerResultRowItem.vue | 176 +++++++++++ .../page/models/card/AutomationRun.vue | 8 +- .../page/models/card/AutomationStatus.vue | 288 ------------------ .../models/card/AutomationStatusRefactor.vue | 42 ++- .../project/page/models/card/FunctionRun.vue | 87 +++++- .../frontend-2/components/viewer/Controls.vue | 96 +++++- .../components/viewer/automate/Panel.vue | 60 ++++ .../components/viewer/layout/Panel.vue | 4 +- .../lib/common/generated/gql/gql.ts | 8 +- .../lib/common/generated/gql/graphql.ts | 62 ++-- .../lib/core/composables/fileImport.ts | 4 +- .../frontend-2/lib/viewer/graphql/queries.ts | 33 ++ ...tailwind.config.cjs => tailwind.config.js} | 0 15 files changed, 742 insertions(+), 365 deletions(-) rename packages/frontend-2/components/{project/page/models/card/AutomationRunAttachmentButton.vue => automation/AttachmentButton.vue} (70%) create mode 100644 packages/frontend-2/components/automation/ViewerFunctionRunItem.vue create mode 100644 packages/frontend-2/components/automation/ViewerResultRowItem.vue delete mode 100644 packages/frontend-2/components/project/page/models/card/AutomationStatus.vue create mode 100644 packages/frontend-2/components/viewer/automate/Panel.vue rename packages/frontend-2/{tailwind.config.cjs => tailwind.config.js} (100%) diff --git a/packages/frontend-2/components/project/page/models/card/AutomationRunAttachmentButton.vue b/packages/frontend-2/components/automation/AttachmentButton.vue similarity index 70% rename from packages/frontend-2/components/project/page/models/card/AutomationRunAttachmentButton.vue rename to packages/frontend-2/components/automation/AttachmentButton.vue index a80f734c1b..79e7144549 100644 --- a/packages/frontend-2/components/project/page/models/card/AutomationRunAttachmentButton.vue +++ b/packages/frontend-2/components/automation/AttachmentButton.vue @@ -1,10 +1,10 @@ diff --git a/packages/frontend-2/components/automation/ViewerResultRowItem.vue b/packages/frontend-2/components/automation/ViewerResultRowItem.vue new file mode 100644 index 0000000000..2978211631 --- /dev/null +++ b/packages/frontend-2/components/automation/ViewerResultRowItem.vue @@ -0,0 +1,176 @@ + + diff --git a/packages/frontend-2/components/project/page/models/card/AutomationRun.vue b/packages/frontend-2/components/project/page/models/card/AutomationRun.vue index d48e9f4e5f..4b50854c55 100644 --- a/packages/frontend-2/components/project/page/models/card/AutomationRun.vue +++ b/packages/frontend-2/components/project/page/models/card/AutomationRun.vue @@ -8,6 +8,9 @@ :key="fRun.id" :automation-name="run.automationName" :function-run="(fRun as RemoveOnceBEIsHappy)" + :project-id="projectId" + :model-id="modelId" + :version-id="versionId" /> @@ -23,7 +26,10 @@ type RemoveOnceBEIsHappy = AutomationFunctionRun & { results: { values: { blobIds: string[] } } } -/* const props = */ defineProps<{ +defineProps<{ run: AutomationRun + projectId: string + modelId: string + versionId?: string }>() diff --git a/packages/frontend-2/components/project/page/models/card/AutomationStatus.vue b/packages/frontend-2/components/project/page/models/card/AutomationStatus.vue deleted file mode 100644 index 8432374243..0000000000 --- a/packages/frontend-2/components/project/page/models/card/AutomationStatus.vue +++ /dev/null @@ -1,288 +0,0 @@ - - diff --git a/packages/frontend-2/components/project/page/models/card/AutomationStatusRefactor.vue b/packages/frontend-2/components/project/page/models/card/AutomationStatusRefactor.vue index efc7a365e1..89e9409f16 100644 --- a/packages/frontend-2/components/project/page/models/card/AutomationStatusRefactor.vue +++ b/packages/frontend-2/components/project/page/models/card/AutomationStatusRefactor.vue @@ -5,11 +5,6 @@ class="h-6 w-6 bg-foundation rounded-full flex items-center justify-center" @click="showDialog = true" > -
- +
@@ -43,7 +43,12 @@ Learn more about Automate here! - Close +
+ Close + + Open {{ versionId ? 'Version' : 'Model' }} + +
@@ -62,10 +67,11 @@ import { // eslint-disable-next-line @typescript-eslint/no-unused-vars import dayjs from 'dayjs' // eslint-disable-next-line @typescript-eslint/no-unused-vars -import { automationDataPageRoute, modelRoute } from '~~/lib/common/helpers/route' +import { modelRoute } from '~~/lib/common/helpers/route' import { SpeckleViewer } from '@speckle/shared' import { useServerInfo } from '~~/lib/core/composables/server' import { resolveStatusMetadata } from '~~/lib/automations/helpers/resolveStatusMetadata' +import { useModelVersionCardAutomationsStatusUpdateTracking } from '~~/lib/automations/composables/automationsStatus' // TODO: Clean up unnecessary fields // Remember about stories @@ -116,6 +122,10 @@ graphql(` results resultVersions { id + model { + id + name + } } } } @@ -147,11 +157,24 @@ const props = defineProps<{ modelId: string }>() +useModelVersionCardAutomationsStatusUpdateTracking(props.projectId) + const { serverInfo } = useServerInfo() const showDialog = ref(false) const automationStatus = computed(() => props.modelOrVersion.automationStatus) + +const versionId = computed(() => { + return !isModel(props.modelOrVersion) ? props.modelOrVersion.id : undefined +}) + +const viewModelLink = computed(() => { + return !versionId.value + ? modelRoute(props.projectId, props.modelId) + : modelRoute(props.projectId, `${props.modelId}@${versionId.value}`) +}) + // eslint-disable-next-line @typescript-eslint/no-unused-vars const statusIconAndColor = computed(() => resolveStatusMetadata(automationStatus.value.status) @@ -186,6 +209,7 @@ const allFunctionRuns = computed(() => { return allRuns }) +// TODO: move to somewhere central, it's copy pasted around currently const summary = computed(() => { const result = { failed: 0, diff --git a/packages/frontend-2/components/project/page/models/card/FunctionRun.vue b/packages/frontend-2/components/project/page/models/card/FunctionRun.vue index 1e561ad95c..896e027715 100644 --- a/packages/frontend-2/components/project/page/models/card/FunctionRun.vue +++ b/packages/frontend-2/components/project/page/models/card/FunctionRun.vue @@ -1,7 +1,7 @@