Skip to content

Conversation

cdavernas
Copy link
Member

Many thanks for submitting your Pull Request ❤️!

What this PR does / why we need it:

  • Fixes the ResourceEditor component's store to properly serialize resources upon initialization, thus resolving casing issues with V1Pod

…y serialize resources upon initialization, thus resolving casing issues with V1Pod

Signed-off-by: Charles d'Avernas <[email protected]>
@cdavernas cdavernas added app: dashboard Concerns the Dashboard UI priority: medium Indicates an average priority issue weight: 1 An issue that has a very low development impact type: fix labels Sep 12, 2024
@cdavernas cdavernas added this to the v1.0.0 milestone Sep 12, 2024
@cdavernas
Copy link
Member Author

To test, update an operator by setting the podTemplate of its runtime.kubernetes property. Once updated, the template should remain camel cased, unlike previously.

#sample operator configuration
apiVersion: synapse.io/v1
kind: Operator
metadata:
  name: operator-1
  namespace: default
  creationTimestamp: 2024-09-12T09:35:25.2104316+02:00
  generation: 3
  resourceVersion: EB00AE1
spec:
  runner:
    api:
      uri: http://localhost:5257
    runtime:
      native:
        directory: ..\..\..\..\..\runner\Synapse.Runner\bin\Debug\net8.0\
        executable: Synapse.Runner.exe
      kubernetes:
        podTemplate:
          metadata: {}
          spec:
            containers:
            - image: someimagexx
              name: test
        secrets:
          volumeName: secrets
          mountPath: /run/secrets/synapse
    containerPlatform: docker
    publishLifecycleEvents: true
status:
  phase: running

Copy link
Member

@JBBianchi JBBianchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with the provided sample, LGTM

Comment on lines +123 to +124
if (monacoEditorHelper.PreferredLanguage == PreferredLanguage.YAML) this.SetEditorValue(yamlSerializer.ConvertFromJson(jsonSerializer.SerializeToText(resource)));
else this.SetEditorValue(jsonSerializer.SerializeToText(resource));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional but the following might be "prettier"

var editorValue = jsonSerializer.SerializeToText(resource);
if (monacoEditorHelper.PreferredLanguage == PreferredLanguage.YAML) editorValue = yamlSerializer.ConvertFromJson(editorValue);
this.SetEditorValue(editorValue):

@cdavernas cdavernas merged commit a127e94 into main Sep 12, 2024
4 checks passed
@cdavernas cdavernas deleted the fix-dashboard-resource-editor-serialization branch September 12, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app: dashboard Concerns the Dashboard UI priority: medium Indicates an average priority issue type: fix weight: 1 An issue that has a very low development impact
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants