From bbbcf54a1a63d97476d6e953867e7cbca78b5fa4 Mon Sep 17 00:00:00 2001 From: Dmitry Bolotin Date: Wed, 4 Sep 2024 14:14:26 +0200 Subject: [PATCH] wip --- model/src/index.ts | 24 ++++++++------- pnpm-lock.yaml | 65 ++++++++++++++++++++++++++++++++++++++--- pnpm-workspace.yaml | 2 ++ ui/package.json | 1 + ui/src/SettingsPage.vue | 33 ++++++++++++++++++++- 5 files changed, 109 insertions(+), 16 deletions(-) diff --git a/model/src/index.ts b/model/src/index.ts index 878a1ec..81be2ac 100644 --- a/model/src/index.ts +++ b/model/src/index.ts @@ -18,7 +18,9 @@ export const platforma = BlockModel.create('Heavy') ) .output('preset', (ctx) => - ctx.prerun?.resolve({ field: 'preset', assertFieldType: 'Input' })?.getDataAsString() + ctx.prerun + ?.resolve({ field: 'preset', assertFieldType: 'Input', allowPermanentAbsence: true }) + ?.getDataAsJson() ) .output('qc', (ctx) => @@ -34,19 +36,19 @@ export const platforma = BlockModel.create('Heavy') ) .output('clones', (ctx) => { - // const collection = ctx.outputs - // ?.resolve({ field: 'clones', assertFieldType: 'Input' }) - // ?.parsePObjectCollection(); - // if (collection === undefined) return undefined; - // // if (collection === undefined || !collection.isComplete) return undefined; - // const pColumns = Object.entries(collection) - // .map(([id, obj]) => obj) - // .filter(isPColumn); - // return ctx.createPFrame(pColumns); + const collection = ctx.outputs + ?.resolve({ field: 'clones', assertFieldType: 'Input' }) + ?.parsePObjectCollection(); + if (collection === undefined) return undefined; + // if (collection === undefined || !collection.isComplete) return undefined; + const pColumns = Object.entries(collection) + .map(([id, obj]) => obj) + .filter(isPColumn); + return ctx.createPFrame(pColumns); // parseResourceMap(ctx.outputs?.resolve({ field: 'clones', assertFieldType: 'Input' }), (acc) => // acc.listInputFields() // ) - return ctx.outputs?.resolve({ field: 'clones', assertFieldType: 'Input' })?.listInputFields(); + // return ctx.outputs?.resolve({ field: 'clones', assertFieldType: 'Input' })?.listInputFields(); }) .output('inputOptions', (ctx) => { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b51f74b..1c180d3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -54,6 +54,9 @@ catalogs: '@vitejs/plugin-vue': specifier: ^5.1.3 version: 5.1.3 + '@vueuse/core': + specifier: ^11.0.3 + version: 11.0.3 tsup: specifier: ~8.1.2 version: 8.1.2 @@ -79,6 +82,9 @@ catalogs: specifier: ^3.23.8 version: 3.23.8 +overrides: + '@milaboratory/pl-middle-layer': file:/Volumes/Data/Projects/MiLaboratory/platforma/ts-pl-middle-layer + importers: .: @@ -176,6 +182,9 @@ importers: '@milaboratory/sdk-vue': specifier: 'catalog:' version: 1.0.44(@milaboratory/helpers@1.5.3)(@milaboratory/sdk-ui@0.12.21)(typescript@5.5.4)(vue@3.4.38(typescript@5.5.4)) + '@vueuse/core': + specifier: 'catalog:' + version: 11.0.3(vue@3.4.38(typescript@5.5.4)) utility-types: specifier: 'catalog:' version: 3.11.0 @@ -868,8 +877,8 @@ packages: '@milaboratory/pl-middle-layer-model@1.2.16': resolution: {integrity: sha512-WT5TKDSOQ/iLUDFF3QW1En/YnbR/J5TZlHY0endrYpxVR40qfLpoOkCrHJki0EXG0j9AWcyTyFSrpxYX7OIkeQ==, tarball: https://npm.pkg.github.com/download/@milaboratory/pl-middle-layer-model/1.2.16/900734158fde8d99b72533ed6b82c3a9b66f4b8c} - '@milaboratory/pl-middle-layer@1.10.2': - resolution: {integrity: sha512-FmJFm26RV5UefRSHJx1miqumMBA46Ms6rcLsSao0hstPwga8SJ8e6Ys6bhbSp+oQqi6kPKSlYFtWH8l/5aD9Ig==, tarball: https://npm.pkg.github.com/download/@milaboratory/pl-middle-layer/1.10.2/d0b1677253d88332f0dd44a2ec3afe11563b6abb} + '@milaboratory/pl-middle-layer@file:../../platforma/ts-pl-middle-layer': + resolution: {directory: ../../platforma/ts-pl-middle-layer, type: directory} hasBin: true '@milaboratory/pl-tree@1.3.5': @@ -1392,6 +1401,9 @@ packages: '@types/triple-beam@1.3.5': resolution: {integrity: sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==} + '@types/web-bluetooth@0.0.20': + resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==} + '@vitejs/plugin-vue@5.1.3': resolution: {integrity: sha512-3xbWsKEKXYlmX82aOHufFQVnkbMC/v8fLpWwh6hWOUrK5fbbtBh9Q/WWse27BFgSy2/e2c0fz5Scgya9h2GLhw==} engines: {node: ^18.0.0 || >=20.0.0} @@ -1469,6 +1481,15 @@ packages: '@vue/shared@3.4.38': resolution: {integrity: sha512-q0xCiLkuWWQLzVrecPb0RMsNWyxICOjPrcrwxTUEHb1fsnvni4dcuyG7RT/Ie7VPTvnjzIaWzRMUBsrqNj/hhw==} + '@vueuse/core@11.0.3': + resolution: {integrity: sha512-RENlh64+SYA9XMExmmH1a3TPqeIuJBNNB/63GT35MZI+zpru3oMRUA6cEFr9HmGqEgUisurwGwnIieF6qu3aXw==} + + '@vueuse/metadata@11.0.3': + resolution: {integrity: sha512-+FtbO4SD5WpsOcQTcC0hAhNlOid6QNLzqedtquTtQ+CRNBoAt9GuV07c6KNHK1wCmlq8DFPwgiLF2rXwgSHX5Q==} + + '@vueuse/shared@11.0.3': + resolution: {integrity: sha512-0rY2m6HS5t27n/Vp5cTDsKTlNnimCqsbh/fmT2LgE+aaU42EMfXo8+bNX91W9I7DDmxfuACXMmrd7d79JxkqWA==} + abbrev@1.1.1: resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} @@ -2859,6 +2880,17 @@ packages: vscode-uri@3.0.8: resolution: {integrity: sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==} + vue-demi@0.14.10: + resolution: {integrity: sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==} + engines: {node: '>=12'} + hasBin: true + peerDependencies: + '@vue/composition-api': ^1.0.0-rc.1 + vue: ^3.0.0-0 || ^2.6.0 + peerDependenciesMeta: + '@vue/composition-api': + optional: true + vue-router@4.4.0: resolution: {integrity: sha512-HB+t2p611aIZraV2aPSRNXf0Z/oLZFrlygJm+sZbdJaW6lcFqEDQwnzUBXn+DApw+/QzDU/I9TeWx9izEjTmsA==} peerDependencies: @@ -4016,7 +4048,7 @@ snapshots: utility-types: 3.11.0 zod: 3.23.8 - '@milaboratory/pl-middle-layer@1.10.2(@milaboratory/sdk-model@1.3.9)': + '@milaboratory/pl-middle-layer@file:../../platforma/ts-pl-middle-layer(@milaboratory/sdk-model@1.3.9)': dependencies: '@milaboratory/computable': 2.1.2 '@milaboratory/pframes-node': 0.4.22(@milaboratory/sdk-model@1.3.9) @@ -4090,7 +4122,7 @@ snapshots: dependencies: '@milaboratory/computable': 2.1.2 '@milaboratory/pl-client-v2': 2.4.10 - '@milaboratory/pl-middle-layer': 1.10.2(@milaboratory/sdk-model@1.3.9) + '@milaboratory/pl-middle-layer': file:../../platforma/ts-pl-middle-layer(@milaboratory/sdk-model@1.3.9) '@milaboratory/pl-tree': 1.3.5 '@milaboratory/sdk-ui': 0.12.21 '@milaboratory/ts-helpers': 1.0.19 @@ -4722,6 +4754,8 @@ snapshots: '@types/triple-beam@1.3.5': {} + '@types/web-bluetooth@0.0.20': {} + '@vitejs/plugin-vue@5.1.3(vite@5.4.3(@types/node@22.0.0))(vue@3.4.38(typescript@5.5.4))': dependencies: vite: 5.4.3(@types/node@22.0.0) @@ -4846,6 +4880,25 @@ snapshots: '@vue/shared@3.4.38': {} + '@vueuse/core@11.0.3(vue@3.4.38(typescript@5.5.4))': + dependencies: + '@types/web-bluetooth': 0.0.20 + '@vueuse/metadata': 11.0.3 + '@vueuse/shared': 11.0.3(vue@3.4.38(typescript@5.5.4)) + vue-demi: 0.14.10(vue@3.4.38(typescript@5.5.4)) + transitivePeerDependencies: + - '@vue/composition-api' + - vue + + '@vueuse/metadata@11.0.3': {} + + '@vueuse/shared@11.0.3(vue@3.4.38(typescript@5.5.4))': + dependencies: + vue-demi: 0.14.10(vue@3.4.38(typescript@5.5.4)) + transitivePeerDependencies: + - '@vue/composition-api' + - vue + abbrev@1.1.1: {} ag-charts-types@10.1.0: {} @@ -6199,6 +6252,10 @@ snapshots: vscode-uri@3.0.8: {} + vue-demi@0.14.10(vue@3.4.38(typescript@5.5.4)): + dependencies: + vue: 3.4.38(typescript@5.5.4) + vue-router@4.4.0(vue@3.4.38(typescript@5.5.4)): dependencies: '@vue/devtools-api': 6.6.3 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index e5e7bae..e39b9a7 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -32,6 +32,8 @@ catalog: 'vitest': ^2.0.5 '@vitejs/plugin-vue': ^5.1.3 + '@vueuse/core': ^11.0.3 + '@ag-grid-community/core': ^32.1.0 '@ag-grid-community/client-side-row-model': ^32.1.0 '@ag-grid-community/vue3': ^32.1.0 diff --git a/ui/package.json b/ui/package.json index e82928e..67165e4 100644 --- a/ui/package.json +++ b/ui/package.json @@ -20,6 +20,7 @@ "@milaboratory/sdk-vue": "catalog:", "utility-types": "catalog:", "vue": "catalog:", + "@vueuse/core": "catalog:", "zod": "catalog:" }, "devDependencies": { diff --git a/ui/src/SettingsPage.vue b/ui/src/SettingsPage.vue index a6de9ec..684acc6 100644 --- a/ui/src/SettingsPage.vue +++ b/ui/src/SettingsPage.vue @@ -2,15 +2,46 @@ import '@ag-grid-community/styles/ag-grid.css'; import '@ag-grid-community/styles/ag-theme-quartz.css'; +import { platforma } from '@milaboratory/milaboratories.mixcr-clonotyping.model'; import { useApp } from './app'; +import { PlDropdown } from '@milaboratory/platforma-uikit'; +import { computed } from 'vue'; +import { asyncComputed } from '@vueuse/core'; const app = useApp(); app.createArgsModel(); + +const inputOptions = computed(() => + app.getOutputFieldOkOptional("inputOptions")?.map((v) => ({ + text: v.label, + value: v.ref, + })) +); + +const args = app.createArgsModel(); + +const presets = asyncComputed(async () => { + const presetsFile = app.getOutputFieldOkOptional("presets") + if (presetsFile === undefined) + return undefined; + return JSON.parse(new TextDecoder().decode(await platforma.blobDriver.getContent(presetsFile.handle))) +}) + +const presetOptions = computed(() => { + return presets.value?.map((preset: any) => ({ text: `${preset.label}${preset.vendor ? ' - ' + preset.vendor : ''}`, value: preset.presetName })) +}) + +const preset = computed(() => app.args.preset === undefined ? undefined : presets.value?.find((p: any) => p.presetName === app.args.preset)) +