Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): use correct JSON schema URL in YAML editors #2208

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions ui/src/features/common/code-editor/yaml-editor-lazy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface YamlEditorProps {
isHideManagedFieldsDisplayed?: boolean;
label?: string;
toolbar?: React.ReactNode;
resourceType?: string;
}

const YamlEditor: FC<YamlEditorProps> = (props) => {
Expand All @@ -39,7 +40,8 @@ const YamlEditor: FC<YamlEditorProps> = (props) => {
isLoading,
isHideManagedFieldsDisplayed,
label,
toolbar
toolbar,
resourceType
} = props;
const [hideManagedFields, setHideManagedFields] = React.useState(!!isHideManagedFieldsDisplayed);
const [managedFieldsValue, setManagedFieldsValue] = React.useState<object | null>(null);
Expand Down Expand Up @@ -89,7 +91,7 @@ const YamlEditor: FC<YamlEditorProps> = (props) => {
format: true,
schemas: schema && [
{
uri: 'http://myserver/foo-schema.json',
uri: `https://raw.githubusercontent.com/akuity/kargo/${__UI_VERSION__ && __UI_VERSION__ !== 'development' ? __UI_VERSION__ : 'main'}/ui/src/gen/schema/${resourceType || 'stages'}.kargo.akuity.io_v1alpha1.json`,
fileMatch: ['*'],
schema
}
Expand Down
1 change: 1 addition & 0 deletions ui/src/features/project/list/create-project-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export const CreateProjectModal = ({ visible, hide }: ModalComponentProps) => {
height='500px'
schema={schema as JSONSchema4}
placeholder={yaml.stringify(projectYAMLExample)}
resourceType='projects'
/>
)}
</FieldContainer>
Expand Down
1 change: 1 addition & 0 deletions ui/src/features/project/pipelines/create-stage-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const CreateStageModal = ({ visible, hide, project }: Props) => {
height='500px'
schema={schema as JSONSchema4}
placeholder={getStageYAMLExample(project)}
resourceType='stages'
/>
)}
</FieldContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const CreateWarehouseModal = ({ visible, hide, project }: Props) => {
height='500px'
schema={schema as JSONSchema4}
placeholder={getWarehouseYAMLExample(project)}
resourceType='warehouses'
/>
)}
</FieldContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export const EditWarehouse = ({ projectName, warehouseName }: Props) => {
isLoading={isLoading}
isHideManagedFieldsDisplayed
disabled={!editing}
resourceType='warehouses'
toolbar={
<>
{editing && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const EditProjectModal = ({ visible, hide }: ModalComponentProps) => {
schema={schema as JSONSchema4}
placeholder={yaml.stringify(projectYAMLExample)}
isLoading={isLoading}
resourceType='projects'
isHideManagedFieldsDisplayed
/>
)}
Expand Down
1 change: 1 addition & 0 deletions ui/src/features/stage/edit-stage-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export const EditStageModal = ({ visible, hide, projectName, stageName }: Props)
isLoading={isLoading}
isHideManagedFieldsDisplayed
label='YAML'
resourceType='stages'
/>
)}
</FieldContainer>
Expand Down
Loading