Skip to content

Commit

Permalink
feat: support for extra field in registry type (#2927)
Browse files Browse the repository at this point in the history
<!--
Please precisely, concisely, and concretely describe what this PR changes, the rationale behind codes,
and how it affects the users and other developers.
-->

### This PR resolves [#2914](#2914) issue

related Core PR: [#3208](lablup/backend.ai#3208)

24.09~24.09.2 : Using `container_registry_nodes` but does not support extra fields.
24.09.3 ~ : support extra field

**Changes:**
Extra field and argument are supported from version 24.09.3 onwards.
Because the arguments for each mutation are not provided as input types, you must create a separate mutation if you want to exclude a specific argument.

- Added `extra` field to container registry nodes to support additional JSON metadata
- Added JSON editor UI component for managing extra information in container registry editor
- Added validation for proper JSON formatting with error messages
- Made `value` and `onChange` props optional in BAICodeEditor component
- Added translations for JSON format validation messages across all languages

**How to test:**
1. move to registry page
2. enter Extra Information to verify that the request succeeds only for valid JSON types.

|dark|light|
|---|---|
|![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/lSyr8xXz1wdXALkJKzVx/2d12bdad-402f-4fdf-a3ca-f3a33c7839a2.png)|![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/lSyr8xXz1wdXALkJKzVx/1b44f9a6-384d-4f6d-9d3b-a51ed8b79e51.png)|

**Checklist:** (if applicable)

- [ ] Mention to the original issue
- [ ] Documentation
- [ ] Minium required manager version
- [ ] Specific setting for review (eg., KB link, endpoint or how to setup)
- [ ] Minimum requirements to check during review
- [ ] Test case(s) to demonstrate the difference of before/after
  • Loading branch information
ironAiken2 committed Dec 23, 2024
1 parent ed3d2b5 commit d288132
Show file tree
Hide file tree
Showing 24 changed files with 432 additions and 157 deletions.
26 changes: 22 additions & 4 deletions react/data/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,11 @@ type Queries {

"""Added in 24.03.4."""
vfolder_nodes(
"""Added in 24.12.0."""
scope_id: ScopeField

"""Added in 24.09.0."""
project_id: UUID!
project_id: UUID @deprecated(reason: "Deprecated since 24.12.0. use `scope_id` instead.")

"""Added in 24.09.0."""
permission: VFolderPermissionValueField
Expand All @@ -155,17 +158,23 @@ type Queries {
compute_session_node(
id: GlobalIDField!

"""Added in 24.12.0."""
scope_id: ScopeField

"""Added in 24.09.0."""
project_id: UUID!
project_id: UUID @deprecated(reason: "Deprecated since 24.12.0. use `scope_id` instead.")

"""Added in 24.09.0. Default is read_attribute."""
permission: SessionPermissionValueField = "read_attribute"
): ComputeSessionNode

"""Added in 24.09.0."""
compute_session_nodes(
"""Added in 24.12.0."""
scope_id: ScopeField

"""Added in 24.09.0."""
project_id: UUID!
project_id: UUID @deprecated(reason: "Deprecated since 24.12.0. use `scope_id` instead.")

"""Added in 24.09.0. Default is read_attribute."""
permission: SessionPermissionValueField = "read_attribute"
Expand Down Expand Up @@ -411,7 +420,7 @@ type DomainNode implements Node {
scaling_groups(filter: String, order: String, offset: Int, before: String, after: String, first: Int, last: Int): ScalinGroupConnection
}

"""Added in 24.12.0."""
"""Added in 24.09.1."""
scalar Bytes

"""Added in 24.12.0."""
Expand Down Expand Up @@ -1493,6 +1502,9 @@ type ContainerRegistryNode implements Node {

"""Added in 24.09.0."""
ssl_verify: Boolean

"""Added in 24.09.3."""
extra: JSONString
}

"""Added in 24.09.0."""
Expand Down Expand Up @@ -1710,6 +1722,9 @@ type Mutations {

"""Added in 24.09.0."""
create_container_registry_node(
"""Added in 24.09.3."""
extra: JSONString

"""Added in 24.09.0."""
is_global: Boolean

Expand Down Expand Up @@ -1739,6 +1754,9 @@ type Mutations {

"""Added in 24.09.0."""
modify_container_registry_node(
"""Added in 24.09.3."""
extra: JSONString

"""Object id. Can be either global id or object id. Added in 24.09.0."""
id: String!

Expand Down
6 changes: 3 additions & 3 deletions react/src/components/BAICodeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import CodeMirror, { ReactCodeMirrorProps } from '@uiw/react-codemirror';
import { EditorView } from '@uiw/react-codemirror';

interface BAICodeEditorProps extends Omit<ReactCodeMirrorProps, 'language'> {
value: string;
onChange: (value: string) => void;
value?: string;
onChange?: (value: string) => void;
language: LanguageName;
editable?: boolean;
showLineNumbers?: boolean;
Expand Down Expand Up @@ -39,9 +39,9 @@ const BAICodeEditor: React.FC<BAICodeEditorProps> = ({
basicSetup={{
lineNumbers: showLineNumbers,
}}
{...CodeMirrorProps}
value={script}
onChange={(value, viewUpdate) => setScript(value)}
{...CodeMirrorProps}
/>
);
};
Expand Down
Loading

0 comments on commit d288132

Please sign in to comment.