Commit Graph

7 Commits

Author SHA1 Message Date
Phillip Rak 6c96a5bdce Default to unlimited line width when dumping yaml blocks
Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
2024-04-09 09:49:08 -07:00
Francesco Torchia 6525a5b069
Fix type errors in create-yaml.test.ts
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2024-04-09 12:20:18 +02:00
Richard Cox b464d15ee0
Integrate new schemaDefinitions endpoint (#10141)
* resource edit AS yaml

* fix cruresource (yaml from form)
- lazy load the schemaDefinitions when needed, avoids sync all to createYaml before we have an async chance to fetch schemaDefinitions

* Fix questions
- there are only four places we use questions, none of which use schema, this is just to be safe

* cluster scan, plugins/fieldsForDriver, defaultFor, validationErrors

* pathExistsInSchema
- used to optionally show conditions tab/list in resource detail view
- logs of things in ingress list/edit

* createPopulated / defaultFor
defaultFor requires resourceFields, it's only used by createPopulated in one place to support machine configs without components

* wip

* WIP MONITORING.SPOOFED
- these aren't spoofed types, but secondary schemas
- testing fix blocked, primary schema's have resourceFields

* Move steve specific (resourceField) code to steve models
- create models for steve schemas and apply to cluster and management stores
- move resoureField based validationto steve model
- move pathExistsInSchema to steve store getter
- don't fetch schemaDefinitions on start up when saving prefs (not needed and blocking)

* comments / improvements

* (untested) refactoring

* Fix alertmanager definitions, add retry definition fetch

* Fix pathExistsInSchema for path length > 2

* Fix questions that accept schemas
- tested by adding Questions to random page and the node schema

* Fix to saving configmap part 1
- the save works but doesn't show data. the yaml is the same as before. debug info added

* Validation by resourceFields is a norman specific thing, so make it such

* small refactor

* Tidying up

* Remove rebase junk

* fix linting and unit tests

* fix unit tests

* fix linting from fix for test....

* Tidying up, fix alertmanagerconfig

* Remove unit test todos

* add unit tests for resource fields

* sdssdf

* Add unit tests for pathExistsInSchema

* JS --> TS

* Store schemas in local singleton cache to avoid hitting store

* fix minor changes from review

* cruresource changes following review
- improvement - remove spurious canDiff
- createResourceYaml - pass in resource to use instead of calc in code

* WIP changes to parseType

* Fix generic cloud credential and node driver forms

* handle missing reactivity given schema definitions not in store

* fix and add unit tests for `parseType`

* Fix create-yaml test

* Changes following review
- improved comments
- SchemaDefinitionCache is now per store (and is reset as such)
- typeRef now uses parseType

* Fix dep loop by moving route based helps in auth out to utils file

* fix unit tests

* Changes following review
2024-02-28 17:08:35 +00:00
Mo Mesgin e934c8bd55 check string type before creating blocks in dumpBlock 2024-02-07 10:59:28 -08:00
Phillip Rak a9d7d4bf4d Prevent mutating yaml when a header isn't found
This prevents `dumpBlock()` from mutating parsed yaml when a header can't be located. More investigation might be warranted to discover why the regex used by `getBlockHeader()` isn't matching the keys when parsing the example yaml:

```
 apiVersion: v1
data:
  a: "a\nb\tc"
  b: "a\nb\tc"
kind: ConfigMap
metadata:
  name: yaml-tab-test
```

but the crux of the issue still comes down to the fact that `dumpBlock()` will indiscriminately mutate yaml output when a key can't be located; it's important that this behavior is corrected.  

Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
2023-12-15 11:38:17 -07:00
Phillip Rak 2b482f8293 Add new unit test for `create-yaml` `dumpBlock()`
This unit test asserts that `dumpBlock()` can properly accept dump options for `jsyaml` and will output the expected string when long lines (over 80 characters) are present in a block.

Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
2023-12-12 10:58:42 -07:00
Francesco Torchia 12f2f1d290
[create-yaml] add unit tests
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2023-05-11 17:12:08 +02:00