Skip to content
Snippets Groups Projects
Commit 594b16a1 authored by Steve Reis's avatar Steve Reis
Browse files

Merge branch 'feat/message-result' into 'develop'

Added new result type AlertResult

See merge request sibmip/gateway!81
parents 533ce2dc cc2a3b4c
No related branches found
No related tags found
No related merge requests found
import { Field, ObjectType, registerEnumType } from '@nestjs/graphql';
import { Result } from './common/result.model';
export enum AlertLevel {
INFO,
SUCCESS,
WARNING,
ERROR,
}
registerEnumType(AlertLevel, {
name: 'AlertLevel',
});
@ObjectType()
export class AlertResult extends Result {
@Field({ nullable: true })
title?: string;
@Field()
message: string;
@Field(() => AlertLevel, { defaultValue: AlertLevel.INFO, nullable: true })
level?: AlertLevel;
}
import { createUnionType } from '@nestjs/graphql';
import { AlertResult } from '../alert-result.model';
import { BarChartResult } from '../bar-chart-result.model';
import { GroupsResult } from '../groups-result.model';
import { HeatMapResult } from '../heat-map-result.model';
import { LineChartResult } from '../line-chart-result.model';
import { MeanChartResult } from '../means-chart-result.model';
import { RawResult } from '../raw-result.model';
import { TableResult } from '../table-result.model';
import { BarChartResult } from '../bar-chart-result.model';
import { MeanChartResult } from '../means-chart-result.model';
export const ResultUnion = createUnionType({
name: 'ResultUnion',
......@@ -17,6 +18,7 @@ export const ResultUnion = createUnionType({
LineChartResult,
BarChartResult,
MeanChartResult,
AlertResult,
],
resolveType(value) {
if (value.headers) {
......@@ -43,6 +45,10 @@ export const ResultUnion = createUnionType({
return MeanChartResult;
}
if (value.message) {
return AlertResult;
}
return RawResult;
},
});
......@@ -174,13 +174,21 @@ type FormulaOperation {
operationTypes: [String!]!
}
type ChartAxis {
"""label of the Axis"""
label: String
"""label of each element on this Axis"""
categories: [String!]
}
type GroupResult {
name: String!
description: String
results: [ResultUnion!]!
}
union ResultUnion = TableResult | RawResult | GroupsResult | HeatMapResult | LineChartResult | BarChartResult | MeanChartResult
union ResultUnion = TableResult | RawResult | GroupsResult | HeatMapResult | LineChartResult | BarChartResult | MeanChartResult | AlertResult
type TableResult {
name: String!
......@@ -248,12 +256,17 @@ type MeanChartResult {
pointCIs: [PointCI!]!
}
type ChartAxis {
"""label of the Axis"""
label: String
type AlertResult {
title: String
message: String!
level: AlertLevel
}
"""label of each element on this Axis"""
categories: [String!]
enum AlertLevel {
INFO
SUCCESS
WARNING
ERROR
}
type ExtraLineInfo {
......@@ -274,17 +287,17 @@ enum LineType {
DASHED
}
type Header {
name: String!
type: String!
}
type PointCI {
min: Float
mean: Float!
max: Float
}
type Header {
name: String!
type: String!
}
type Author {
username: String
fullname: String
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment