Skip to content

Commit 311dab7

Browse files
committed
working trees table
1 parent e604b0d commit 311dab7

File tree

11 files changed

+445
-131
lines changed

11 files changed

+445
-131
lines changed

model/src/index.ts

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
Ref,
55
Option,
66
InferOutputsType,
7+
PlDataTableState,
78
isPColumn,
89
isPColumnSpec
910
} from '@milaboratory/sdk-ui';
@@ -16,7 +17,11 @@ export type BlockArgs = {
1617
datasetColumns: (Ref | null)[];
1718
};
1819

19-
export const platforma = BlockModel.create<BlockArgs>('Heavy')
20+
export type UiState = {
21+
treeTableState?: PlDataTableState;
22+
};
23+
24+
export const platforma = BlockModel.create<BlockArgs, UiState>('Heavy')
2025

2126
.initialArgs({
2227
datasetColumns: [null]
@@ -86,29 +91,31 @@ export const platforma = BlockModel.create<BlockArgs>('Heavy')
8691
);
8792
})
8893

89-
// .output('allColumnSpecs', (ctx) => {
90-
// return ctx.resultPool
91-
// .getSpecsFromResultPool()
92-
// .entries
93-
// .filter((v) => {
94-
// return isPColumnSpec(v.obj);
95-
// });
96-
// })
94+
.output('allColumnSpecs', (ctx) => {
95+
return ctx.resultPool.getSpecsFromResultPool().entries.filter((v) => {
96+
return isPColumnSpec(v.obj);
97+
});
98+
})
9799

98100
.output('trees', (ctx) => {
99-
const collection = ctx.outputs
100-
?.resolve({ field: 'trees', assertFieldType: 'Input' })
101-
?.parsePObjectCollection();
102-
if (collection === undefined) return undefined;
103-
// if (collection === undefined || !collection.isComplete) return undefined;
104-
const pColumns = Object.entries(collection)
105-
.map(([id, obj]) => obj)
106-
.filter(isPColumn);
107-
return ctx.createPFrame(pColumns);
101+
const pCols = ctx.outputs?.resolve("trees")?.getPColumns();
102+
if (pCols === undefined) return undefined;
103+
return ctx.createPTable({
104+
columns: pCols,
105+
filters: ctx.uiState?.treeTableState?.pTableParams?.filters ?? [],
106+
sorting: ctx.uiState?.treeTableState?.pTableParams?.sorting ?? []
107+
});
108108
})
109109

110110
.output('temp', (ctx) => {
111-
return ctx.outputs?.resolve('trees')?.listInputFields();
111+
return {
112+
fields: ctx.outputs?.resolve('trees')?.listInputFields(),
113+
columns: ctx.outputs?.resolve("trees")?.getPColumns()?.map((o) => ({
114+
spec: o.spec,
115+
resourseType: o.data.resourceType,
116+
data: o.data.getDataAsJson()
117+
}))
118+
}
112119
})
113120

114121
.output('allelesLog', (ctx) => {
@@ -119,7 +126,10 @@ export const platforma = BlockModel.create<BlockArgs>('Heavy')
119126
return ctx.outputs?.resolve('treesLog')?.listInputFields();
120127
})
121128

122-
.sections([{ type: 'link', href: '/', label: 'Settings' }])
129+
.sections([
130+
{ type: 'link', href: '/', label: 'Settings' },
131+
{ type: 'link', href: '/trees', label: 'Trees Table' }
132+
])
123133

124134
.done();
125135

pnpm-lock.yaml

Lines changed: 35 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ packages:
66
- test
77

88
catalog:
9-
'@milaboratory/tengo-template-builder': 1.13.0
9+
'@milaboratory/tengo-template-builder': ^1.14.2
1010
'@milaboratory/pl-block-tools': ^2.1.5
1111
'@milaboratory/block-builder': ^1.2.3
1212

1313
'@milaboratory/sdk-ui': ^0.12.22
1414
'@milaboratory/sdk-test': ^1.5.5
1515

16-
'@milaboratory/tengo-sdk': ^1.2.1
16+
'@milaboratory/tengo-sdk': ^1.2.4
1717
'@milaboratory/pframes-conv': ^0.4.25
1818

1919
'@milaboratory/mixcr': 4.7.0-70-develop
2020

21-
'@milaboratory/platforma-uikit': ^1.1.4
22-
'@milaboratory/sdk-vue': ^1.1.1
21+
'@milaboratory/platforma-uikit': ^1.1.11
22+
'@milaboratory/sdk-vue': ^1.1.4
2323
'@milaboratory/helpers': ^1.5.3
2424

2525
'vue': ^3.4.38

ui/src/TreeTablePage.vue

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<script setup lang="ts">
2+
import { platforma } from '@milaboratory/milaboratories.mixcr-shm-trees.model';
3+
import { useApp } from './app';
4+
import { computed } from 'vue';
5+
import { PlAgDataTable, PlDataTableSettings } from '@milaboratory/sdk-vue';
6+
7+
const app = useApp();
8+
9+
const uiState = app.createUiModel({}, () => ({}))
10+
11+
const tableSettings = computed<PlDataTableSettings>(() => ({
12+
sourceType: "pframe",
13+
14+
pTable: app.outputs.trees,
15+
16+
// sheets: [
17+
// {
18+
// id: "trees",
19+
// axis: {
20+
// type: "String",
21+
// name: "pl7.app/sampleId",
22+
// },
23+
// options: [],
24+
// // defaultValue: ",
25+
// }
26+
// ],
27+
}));
28+
29+
</script>
30+
31+
<template>
32+
<div class="container">
33+
<PlAgDataTable v-model="uiState.model.treeTableState" :settings="tableSettings"></PlAgDataTable>
34+
</div>
35+
</template>

ui/src/app.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { platforma } from '@milaboratory/milaboratories.mixcr-shm-trees.model';
22
import { defineApp } from '@milaboratory/sdk-vue';
33
import SettingsPage from './SettingsPage.vue';
4+
import TreeTablePage from './TreeTablePage.vue';
45

56
export const sdkPlugin = defineApp(platforma, () => {
67
return {
78
routes: {
8-
'/': SettingsPage
9+
'/': SettingsPage,
10+
'/trees': TreeTablePage
911
}
1012
};
1113
});

workflow/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
declare type TemplateFromFile = { readonly type: "from-file"; readonly path: string; };
2-
declare type TplName = "reconstruct-shm-trees" | "main";
2+
declare type TplName = "reconstruct-shm-trees" | "process" | "main";
33
declare const Templates: Record<TplName, TemplateFromFile>;
44
export { Templates };

workflow/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = { Templates: {
22
'reconstruct-shm-trees': { type: 'from-file', path: require.resolve('./dist/tengo/tpl/reconstruct-shm-trees.plj.gz') },
3+
'process': { type: 'from-file', path: require.resolve('./dist/tengo/tpl/process.plj.gz') },
34
'main': { type: 'from-file', path: require.resolve('./dist/tengo/tpl/main.plj.gz') }
45
}}

0 commit comments

Comments
 (0)