Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
dbolotin committed Sep 4, 2024
1 parent 8e9d9c7 commit bbbcf54
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 16 deletions.
24 changes: 13 additions & 11 deletions model/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export const platforma = BlockModel.create<BlockArgs>('Heavy')
)

.output('preset', (ctx) =>
ctx.prerun?.resolve({ field: 'preset', assertFieldType: 'Input' })?.getDataAsString()
ctx.prerun
?.resolve({ field: 'preset', assertFieldType: 'Input', allowPermanentAbsence: true })
?.getDataAsJson<any>()
)

.output('qc', (ctx) =>
Expand All @@ -34,19 +36,19 @@ export const platforma = BlockModel.create<BlockArgs>('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) => {
Expand Down
65 changes: 61 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@milaboratory/sdk-vue": "catalog:",
"utility-types": "catalog:",
"vue": "catalog:",
"@vueuse/core": "catalog:",
"zod": "catalog:"
},
"devDependencies": {
Expand Down
33 changes: 32 additions & 1 deletion ui/src/SettingsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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))
</script>

<template>
<div class="container">Hi!</div>
<div class="container">
<pl-dropdown :options="inputOptions ?? []" v-model="args.model.input" label="Select dataset" clearable />
<pl-dropdown :options="presetOptions ?? []" v-model="args.model.preset" label="Select preset" clearable />
<pre>{{ preset }}</pre>
</div>
</template>

<style lang="css">
Expand Down

0 comments on commit bbbcf54

Please sign in to comment.