Add UNKNOWN and NOT_IMPLEMENTED measure states
Introduce two new measure states across the full stack: database migration, Go coredata, GraphQL schema, MCP specification, and frontend UI (labels, badge variants, and colors). Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -19,6 +19,8 @@ export const measureStates = [
|
||||
"IN_PROGRESS",
|
||||
"NOT_APPLICABLE",
|
||||
"NOT_STARTED",
|
||||
"UNKNOWN",
|
||||
"NOT_IMPLEMENTED",
|
||||
] as const;
|
||||
|
||||
export function getMeasureStateLabel(__: Translator, state: string) {
|
||||
@@ -31,6 +33,10 @@ export function getMeasureStateLabel(__: Translator, state: string) {
|
||||
return __("Not Applicable");
|
||||
case "NOT_STARTED":
|
||||
return __("Not Started");
|
||||
case "UNKNOWN":
|
||||
return __("Unknown");
|
||||
case "NOT_IMPLEMENTED":
|
||||
return __("Not Implemented");
|
||||
default:
|
||||
return __("Unknown");
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ const stateToVariant: Record<
|
||||
IN_PROGRESS: "info",
|
||||
NOT_APPLICABLE: "neutral",
|
||||
NOT_STARTED: "neutral",
|
||||
UNKNOWN: "neutral",
|
||||
NOT_IMPLEMENTED: "danger",
|
||||
};
|
||||
|
||||
export function MeasureBadge({ state }: Props) {
|
||||
|
||||
@@ -25,7 +25,7 @@ export default {
|
||||
|
||||
type Story = StoryObj<typeof MeasureImplementation>;
|
||||
|
||||
type MeasureState = "IMPLEMENTED" | "IN_PROGRESS" | "NOT_APPLICABLE" | "NOT_STARTED";
|
||||
type MeasureState = "IMPLEMENTED" | "IN_PROGRESS" | "NOT_APPLICABLE" | "NOT_STARTED" | "UNKNOWN" | "NOT_IMPLEMENTED";
|
||||
|
||||
export const Default: Story = {
|
||||
args: {
|
||||
|
||||
@@ -31,6 +31,8 @@ const stateToColor: Record<MeasureState, string> = {
|
||||
IN_PROGRESS: "bg-border-warning",
|
||||
NOT_APPLICABLE: "bg-border-info",
|
||||
NOT_STARTED: "bg-highlight",
|
||||
UNKNOWN: "bg-highlight",
|
||||
NOT_IMPLEMENTED: "bg-border-danger",
|
||||
};
|
||||
|
||||
export function MeasureImplementation({ measures, className }: Props) {
|
||||
|
||||
@@ -28,6 +28,8 @@ const (
|
||||
MeasureStateInProgress
|
||||
MeasureStateNotApplicable
|
||||
MeasureStateImplemented
|
||||
MeasureStateUnknown
|
||||
MeasureStateNotImplemented
|
||||
)
|
||||
|
||||
func MeasureStates() []MeasureState {
|
||||
@@ -36,6 +38,8 @@ func MeasureStates() []MeasureState {
|
||||
MeasureStateInProgress,
|
||||
MeasureStateNotApplicable,
|
||||
MeasureStateImplemented,
|
||||
MeasureStateUnknown,
|
||||
MeasureStateNotImplemented,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +59,10 @@ func (ms *MeasureState) UnmarshalText(data []byte) error {
|
||||
*ms = MeasureStateNotApplicable
|
||||
case MeasureStateImplemented.String():
|
||||
*ms = MeasureStateImplemented
|
||||
case MeasureStateUnknown.String():
|
||||
*ms = MeasureStateUnknown
|
||||
case MeasureStateNotImplemented.String():
|
||||
*ms = MeasureStateNotImplemented
|
||||
default:
|
||||
return fmt.Errorf("invalid MeasureState value: %q", val)
|
||||
}
|
||||
@@ -74,6 +82,10 @@ func (ms MeasureState) String() string {
|
||||
val = "NOT_APPLICABLE"
|
||||
case MeasureStateImplemented:
|
||||
val = "IMPLEMENTED"
|
||||
case MeasureStateUnknown:
|
||||
val = "UNKNOWN"
|
||||
case MeasureStateNotImplemented:
|
||||
val = "NOT_IMPLEMENTED"
|
||||
}
|
||||
|
||||
return val
|
||||
|
||||
16
pkg/coredata/migrations/20260401T120000Z.sql
Normal file
16
pkg/coredata/migrations/20260401T120000Z.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
-- Copyright (c) 2025-2026 Probo Inc <hello@getprobo.com>.
|
||||
--
|
||||
-- Permission to use, copy, modify, and/or distribute this software for any
|
||||
-- purpose with or without fee is hereby granted, provided that the above
|
||||
-- copyright notice and this permission notice appear in all copies.
|
||||
--
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
-- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
-- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
-- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
-- PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
ALTER TYPE mitigation_state ADD VALUE IF NOT EXISTS 'UNKNOWN';
|
||||
ALTER TYPE mitigation_state ADD VALUE IF NOT EXISTS 'NOT_IMPLEMENTED';
|
||||
@@ -54,6 +54,14 @@ enum MeasureState
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.MeasureStateImplemented"
|
||||
)
|
||||
UNKNOWN
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.MeasureStateUnknown"
|
||||
)
|
||||
NOT_IMPLEMENTED
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.MeasureStateNotImplemented"
|
||||
)
|
||||
}
|
||||
|
||||
enum TaskState @goModel(model: "go.probo.inc/probo/pkg/coredata.TaskState") {
|
||||
|
||||
@@ -1350,6 +1350,8 @@ components:
|
||||
- IN_PROGRESS
|
||||
- NOT_APPLICABLE
|
||||
- IMPLEMENTED
|
||||
- UNKNOWN
|
||||
- NOT_IMPLEMENTED
|
||||
go.probo.inc/mcpgen/type: go.probo.inc/probo/pkg/coredata.MeasureState
|
||||
|
||||
MeasureOrderField:
|
||||
|
||||
Reference in New Issue
Block a user