Fix label text
In [1] we changed our factory methods to actually use QueryStatus when
creating remote query & variant analysis history items.
Previously we were just setting the value to `in progress`...
... which made the tests for history-item-label-provider.test.ts pass...
... but that value did not reflect reality ...
What we actually need to do is introduce a method to map different
query statuses to human readable strings, e.g.
QueryStatus.InProgress becomes 'in progress'
[1]: 4b9db6a298 (diff-217b085c45cd008d938c3da4714b5782db6ad31438b27b07e969254feec8298aL28)
This commit is contained in:
@@ -7,6 +7,7 @@ import { RemoteQueryHistoryItem } from './remote-queries/remote-query-history-it
|
||||
import { VariantAnalysisHistoryItem } from './remote-queries/variant-analysis-history-item';
|
||||
import { assertNever } from './pure/helpers-pure';
|
||||
import { pluralize } from './pure/word';
|
||||
import { humanizeQueryStatus } from './query-status';
|
||||
|
||||
interface InterpolateReplacements {
|
||||
t: string; // Start time
|
||||
@@ -86,7 +87,7 @@ export class HistoryItemLabelProvider {
|
||||
q: `${item.remoteQuery.queryName} (${item.remoteQuery.language})`,
|
||||
d: buildRepoLabel(item),
|
||||
r: resultCount,
|
||||
s: item.status,
|
||||
s: humanizeQueryStatus(item.status),
|
||||
f: path.basename(item.remoteQuery.queryFilePath),
|
||||
'%': '%'
|
||||
};
|
||||
@@ -99,7 +100,7 @@ export class HistoryItemLabelProvider {
|
||||
q: `${item.variantAnalysis.query.name} (${item.variantAnalysis.query.language})`,
|
||||
d: buildRepoLabel(item),
|
||||
r: resultCount,
|
||||
s: item.status,
|
||||
s: humanizeQueryStatus(item.status),
|
||||
f: path.basename(item.variantAnalysis.query.filePath),
|
||||
'%': '%',
|
||||
};
|
||||
|
||||
@@ -21,3 +21,16 @@ export function variantAnalysisStatusToQueryStatus(status: VariantAnalysisStatus
|
||||
assertNever(status);
|
||||
}
|
||||
}
|
||||
|
||||
export function humanizeQueryStatus(status: QueryStatus): string {
|
||||
switch (status) {
|
||||
case QueryStatus.InProgress:
|
||||
return 'in progress';
|
||||
case QueryStatus.Completed:
|
||||
return 'completed';
|
||||
case QueryStatus.Failed:
|
||||
return 'failed';
|
||||
default:
|
||||
return 'unknown';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,7 @@ import { HistoryItemLabelProvider } from '../../history-item-label-provider';
|
||||
import { createMockLocalQueryInfo } from '../factories/local-queries/local-query-history-item';
|
||||
import { createMockRemoteQueryHistoryItem } from '../factories/remote-queries/remote-query-history-item';
|
||||
|
||||
|
||||
describe('HistoryItemLabelProvider', () => {
|
||||
|
||||
let labelProvider: HistoryItemLabelProvider;
|
||||
let config: QueryHistoryConfig;
|
||||
const date = new Date('2022-01-01T00:00:00.000Z');
|
||||
|
||||
Reference in New Issue
Block a user