Skip to content

Commit a6c5394

Browse files
committed
ui: simplify progresses more with getProgressLogWithInfo
1 parent 54d3af1 commit a6c5394

File tree

4 files changed

+10
-22
lines changed

4 files changed

+10
-22
lines changed

ui/src/MainPage.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { getAlignmentChartSettings } from './charts/alignmentChartSettings';
2929
import { getChainsChartSettings } from './charts/chainsChartSettings';
3030
import { PlAgChartStackedBarCell, createAgGridColDef } from '@platforma-sdk/ui-vue';
3131
import { parseProgressString } from './parseProgress';
32-
import { ProgressLogWithInfo } from '@platforma-sdk/model';
32+
import type { ProgressLogWithInfo } from '@platforma-sdk/model';
3333
3434
const app = useApp();
3535
@@ -100,7 +100,7 @@ const columnDefs: ColDef<MiXCRResult>[] = [
100100
field: 'progress',
101101
headerName: 'Progress',
102102
progress(cellData) {
103-
const parsed = parseProgressString(cellData.value?.progressLine);
103+
const parsed = parseProgressString(cellData.value?.progressLine, cellData.value?.live);
104104
105105
if (parsed.stage === 'Queued') {
106106
return {

ui/src/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const sdkPlugin = defineApp(platforma, (app) => {
88
const qc = app.model.outputs.qc;
99
const progresses = app.model.outputs.progress?.data;
1010
if (!progresses || !qc) return undefined;
11-
const done = progresses.map(p => p.value?.live == false)
11+
const done = progresses.filter((p) => p.value?.live === false);
1212

1313
const result = done.length / qc.data.length;
1414

ui/src/parseProgress.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ProgressPattern } from '@platforma-open/milaboratories.mixcr-clonotyping.model';
1+
import { ProgressPattern, ProgressPrefix } from '@platforma-open/milaboratories.mixcr-clonotyping.model';
22

33
type ParsedProgress = {
44
raw?: string;
@@ -17,8 +17,10 @@ type ParsedProgress = {
1717
// 'Exporting clones: 11.1%'
1818
// 'Queued'
1919
// 'Done'
20-
export function parseProgressString(progressString: string | undefined | null): ParsedProgress {
21-
const raw = progressString ?? 'Unknown';
20+
export function parseProgressString(progressString: string | undefined | null, live: boolean | undefined): ParsedProgress {
21+
let raw = (progressString ?? 'Not started').replace(ProgressPrefix, '');
22+
if (live === false)
23+
raw = 'Done';
2224

2325
const res: ParsedProgress = {
2426
raw,

ui/src/results.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type {
33
import {
44
AlignReport,
55
AssembleReport,
6-
ProgressPrefix,
76
Qc,
87
} from '@platforma-open/milaboratories.mixcr-clonotyping.model';
98
import type { AnyLogHandle, ProgressLogWithInfo } from '@platforma-sdk/model';
@@ -107,21 +106,8 @@ export const MiXCRResultsFull = computed<MiXCRResult[] | undefined>(() => {
107106
// adding progress information
108107
for (const p of progress.data) {
109108
const sampleId = p.key[0] as string;
110-
if (resultMap.get(sampleId))
111-
if (p?.value) {
112-
const progress: ProgressLogWithInfo = {
113-
progressLine: 'Not started',
114-
live: true,
115-
};
116-
if ((p.value?.progressLine?.length ?? 0) > 0) {
117-
progress.progressLine = p.value.progressLine?.replace(ProgressPrefix, '');
118-
}
119-
if (p.value?.live == false) {
120-
progress.progressLine = 'Done';
121-
}
122-
123-
resultMap.get(sampleId)!.progress = progress;
124-
}
109+
if (resultMap.get(sampleId) && p?.value)
110+
resultMap.get(sampleId)!.progress = p.value;
125111
}
126112

127113
return [...resultMap.values()];

0 commit comments

Comments
 (0)