-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove jsonb_array and fix jsonb data types such that it can be …
…used in schema design and graphql api (#4409)
- Loading branch information
Showing
29 changed files
with
421 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
apps/molgenis-components/src/components/forms/InputJson.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<template> | ||
<FormGroup | ||
:id="id" | ||
:label="label" | ||
:required="required" | ||
:description="description" | ||
:errorMessage="stringError" | ||
> | ||
<InputGroup> | ||
<textarea | ||
:id="id" | ||
:ref="id" | ||
:name="name" | ||
:value="modelValue" | ||
@input=" | ||
$emit('update:modelValue', ($event.target as HTMLInputElement).value) | ||
" | ||
type="text" | ||
class="form-control" | ||
:class="{ 'is-invalid': stringError }" | ||
:aria-describedby="id" | ||
:placeholder="placeholder" | ||
:readonly="readonly" | ||
/> | ||
</InputGroup> | ||
</FormGroup> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import FormGroup from "./FormGroup.vue"; | ||
import InputGroup from "./InputGroup.vue"; | ||
import BaseInput from "./baseInputs/BaseInput.vue"; | ||
import { isJsonObjectOrArray } from "./formUtils/formUtils"; | ||
export default { | ||
name: "InputJson", | ||
components: { FormGroup, InputGroup }, | ||
extends: BaseInput, | ||
props: { | ||
modelValue: { | ||
type: [String, null], | ||
default: null, | ||
}, | ||
}, | ||
computed: { | ||
stringError() { | ||
if (typeof this.modelValue === "string") { | ||
try { | ||
if (!isJsonObjectOrArray(JSON.parse(this.modelValue))) { | ||
return `Root element must be an object or array`; | ||
} | ||
} catch { | ||
return `Please enter valid JSON`; | ||
} | ||
return this.errorMessage; | ||
} else { | ||
return this.errorMessage; | ||
} | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style scoped> | ||
.is-invalid { | ||
background-image: none; | ||
} | ||
span:hover .hoverIcon { | ||
visibility: visible; | ||
} | ||
</style> | ||
|
||
<docs> | ||
<template> | ||
<div> | ||
<InputJson | ||
id="input-json" | ||
v-model="value" | ||
label="My JSON input label" | ||
description="Some help needed?" | ||
/> | ||
You typed: {{ value }}<br /> | ||
<b>Readonly</b> | ||
<InputJson | ||
id="input-json2" | ||
:readonly="true" | ||
v-model="readOnlyValue" | ||
description="Should not be able to edit this" | ||
/> | ||
</div> | ||
</template> | ||
<script> | ||
export default { | ||
data: function () { | ||
return { | ||
value: '{"name":"bofke"}', | ||
readOnlyValue: '{"name":"bofke"}', | ||
}; | ||
}, | ||
}; | ||
</script> | ||
</docs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ export default [ | |
"HYPERLINK_ARRAY", | ||
"INT", | ||
"INT_ARRAY", | ||
"JSON", | ||
"LONG", | ||
"LONG_ARRAY", | ||
"ONTOLOGY", | ||
|
38 changes: 38 additions & 0 deletions
38
...end/molgenis-emx2-graphql/src/main/java/org/molgenis/emx2/graphql/GraphqlCustomTypes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.