mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
fix: ui for array/required attributes creation
This commit is contained in:
@@ -589,14 +589,6 @@ $logs = $this->getParam('logs', null);
|
||||
(() => {
|
||||
const form = document.getElementById("add-string-attribute");
|
||||
const fields = {
|
||||
required: {
|
||||
array: ["disable", "uncheck"],
|
||||
required: ["enable"]
|
||||
},
|
||||
array: {
|
||||
required: ["disable", "uncheck"],
|
||||
array: ["enable"]
|
||||
},
|
||||
xdefault: {
|
||||
oneOf: {
|
||||
if: ["array", "required"],
|
||||
@@ -680,14 +672,6 @@ $logs = $this->getParam('logs', null);
|
||||
(() => {
|
||||
const form = document.getElementById("add-integer-attribute");
|
||||
const fields = {
|
||||
required: {
|
||||
array: ["disable", "uncheck"],
|
||||
required: ["enable"]
|
||||
},
|
||||
array: {
|
||||
required: ["disable", "uncheck"],
|
||||
array: ["enable"]
|
||||
},
|
||||
xdefault: {
|
||||
oneOf: {
|
||||
if: ["array", "required"],
|
||||
@@ -769,14 +753,6 @@ $logs = $this->getParam('logs', null);
|
||||
(() => {
|
||||
const form = document.getElementById("add-float-attribute");
|
||||
const fields = {
|
||||
required: {
|
||||
array: ["disable", "uncheck"],
|
||||
required: ["enable"]
|
||||
},
|
||||
array: {
|
||||
required: ["disable", "uncheck"],
|
||||
array: ["enable"]
|
||||
},
|
||||
xdefault: {
|
||||
oneOf: {
|
||||
if: ["array", "required"],
|
||||
@@ -847,14 +823,6 @@ $logs = $this->getParam('logs', null);
|
||||
(() => {
|
||||
const form = document.getElementById("add-email-attribute");
|
||||
const fields = {
|
||||
required: {
|
||||
array: ["disable", "uncheck"],
|
||||
required: ["enable"]
|
||||
},
|
||||
array: {
|
||||
required: ["disable", "uncheck"],
|
||||
array: ["enable"]
|
||||
},
|
||||
xdefault: {
|
||||
oneOf: {
|
||||
if: ["array", "required"],
|
||||
@@ -927,14 +895,6 @@ $logs = $this->getParam('logs', null);
|
||||
(() => {
|
||||
const form = document.getElementById("add-boolean-attribute");
|
||||
const fields = {
|
||||
required: {
|
||||
array: ["disable", "uncheck"],
|
||||
required: ["enable"]
|
||||
},
|
||||
array: {
|
||||
required: ["disable", "uncheck"],
|
||||
array: ["enable"]
|
||||
},
|
||||
xdefault: {
|
||||
oneOf: {
|
||||
if: ["array", "required"],
|
||||
@@ -1006,14 +966,6 @@ $logs = $this->getParam('logs', null);
|
||||
(() => {
|
||||
const form = document.getElementById("add-ip-attribute");
|
||||
const fields = {
|
||||
required: {
|
||||
array: ["disable", "uncheck"],
|
||||
required: ["enable"]
|
||||
},
|
||||
array: {
|
||||
required: ["disable", "uncheck"],
|
||||
array: ["enable"]
|
||||
},
|
||||
xdefault: {
|
||||
oneOf: {
|
||||
if: ["array", "required"],
|
||||
@@ -1084,14 +1036,6 @@ $logs = $this->getParam('logs', null);
|
||||
(() => {
|
||||
const form = document.getElementById("add-url-attribute");
|
||||
const fields = {
|
||||
required: {
|
||||
array: ["disable", "uncheck"],
|
||||
required: ["enable"]
|
||||
},
|
||||
array: {
|
||||
required: ["disable", "uncheck"],
|
||||
array: ["enable"]
|
||||
},
|
||||
xdefault: {
|
||||
oneOf: {
|
||||
if: ["array", "required"],
|
||||
@@ -1179,14 +1123,6 @@ $logs = $this->getParam('logs', null);
|
||||
(() => {
|
||||
const form = document.getElementById("add-enum-attribute");
|
||||
const fields = {
|
||||
required: {
|
||||
array: ["disable", "uncheck"],
|
||||
required: ["enable"]
|
||||
},
|
||||
array: {
|
||||
required: ["disable", "uncheck"],
|
||||
array: ["enable"]
|
||||
},
|
||||
xdefault: {
|
||||
oneOf: {
|
||||
if: ["array", "required"],
|
||||
|
||||
@@ -280,15 +280,6 @@ $logs = $this->getParam('logs', null);
|
||||
<button type="button" class="margin-end margin-bottom-small reverse" @click="doc = addAttribute(doc, attr.key)"> Add Attribute </button>
|
||||
</div>
|
||||
</template>
|
||||
<script type="text/javascript">
|
||||
function addAttribute(doc, key) {
|
||||
if (!Array.isArray(doc[key])) {
|
||||
doc[key] = [];
|
||||
}
|
||||
doc[key].push(null);
|
||||
return doc;
|
||||
}
|
||||
</script>
|
||||
</li>
|
||||
</template>
|
||||
</ul>
|
||||
|
||||
+16
-1
@@ -207,5 +207,20 @@ window.formValidation = (form, fields) => {
|
||||
element.dispatchEvent(new Event("change"));
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Method to add attribute for the UI on array attributes.
|
||||
*
|
||||
* Needs to be global - since client side routing will break it.
|
||||
* @param {*} doc
|
||||
* @param {*} key
|
||||
* @returns
|
||||
*/
|
||||
function addAttribute(doc, key) {
|
||||
if (!Array.isArray(doc[key])) {
|
||||
doc[key] = [];
|
||||
}
|
||||
doc[key].push(null);
|
||||
return doc;
|
||||
}
|
||||
Reference in New Issue
Block a user