Skip to content

Commit

Permalink
fix: Lowercase support level for quickstart artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
josephgregoryii committed Oct 15, 2024
1 parent ad0308c commit 3484fd6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
9 changes: 7 additions & 2 deletions utils/lib/Quickstart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type {
QuickstartSupportLevel,
} from '../types/QuickstartMutationVariable';
import type { QuickstartConfig } from '../types/QuickstartConfig';
import { ArtifactQuickstartConfig } from '../types/Artifact';
import { ArtifactQuickstartConfig, ArtifactQuickstartConfigSupportLevel } from '../types/Artifact';

export interface QuickstartMutationResponse {
quickstart: {
Expand All @@ -35,6 +35,9 @@ interface SupportLevelMap {
[key: string]: QuickstartSupportLevel;
}

// FIXME: We will want to clean this up and conform to the `Artifact` types
// when we go to cleanup the deprecated mutation functionality after we have
// finalized the new quickstart publishing pipeline.
const SUPPORT_LEVEL_ENUMS: SupportLevelMap = {
'New Relic': 'NEW_RELIC',
Community: 'COMMUNITY',
Expand Down Expand Up @@ -243,7 +246,9 @@ class Quickstart {
Component.removeBasePath(path.dirname(this.configPath), this.basePath)
),
summary: summary && summary.trim(),
supportLevel: SUPPORT_LEVEL_ENUMS[level],
supportLevel: SUPPORT_LEVEL_ENUMS[
level
].toLowerCase() as ArtifactQuickstartConfigSupportLevel,
dataSourceIds: dataSourceIds,
alertConditions: alertPolicies,
dashboards,
Expand Down
2 changes: 1 addition & 1 deletion utils/schema/artifact.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
}
},
"supportLevel": {
"enum": ["NEW_RELIC", "COMMUNITY", "VERIFIED", "ENTERPRISE"]
"enum": ["new_relic", "community", "verified", "enterprise"]
},
"iconUrl": {
"type": "string"
Expand Down
19 changes: 8 additions & 11 deletions utils/types/Artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ type QuickstartConfigDocumentation = {
url: string;
};

export type QuickstartConfigSupportLevel =
| 'NEW_RELIC'
| 'COMMUNITY'
| 'VERIFIED'
export type ArtifactQuickstartConfigSupportLevel =
| 'new_relic'
| 'community'
| 'verified'
// Enterprise is deprecated. However some quickstarts still have this support
// level within their config.
| 'ENTERPRISE';
| 'enterprise';

type QuickstartConfig = {
export interface ArtifactQuickstartConfig {
quickstartUuid: string;
description: string;
displayName: string;
Expand All @@ -60,15 +60,12 @@ type QuickstartConfig = {
iconUrl: string;
keywords?: string[];
summary: string;
supportLevel: QuickstartConfigSupportLevel;
supportLevel: ArtifactQuickstartConfigSupportLevel;
alertConditions?: string[];
dashboards?: string[];
dataSourceIds?: string[];
};

export interface ArtifactQuickstartConfig extends QuickstartConfig {
authors: Array<{ name: string }>;
}
};

/* -- Dashboard -- */

Expand Down

0 comments on commit 3484fd6

Please sign in to comment.