Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/inspector/collection-data-source.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ export default {
const [firstRecord] = records?.dataRecordList || [];
if (firstRecord?.data) {
this.singleFieldOptions = [];
const dataObject = firstRecord.data;
for (const [key] of Object.entries(dataObject)) {
Expand Down
8 changes: 5 additions & 3 deletions src/components/inspector/column-setup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ export default {
this.editIndex = index;
this.optionContent = this.optionsList[index][this.valueField];
this.optionValue = this.optionsList[index][this.keyField];
this.optionContentCollection = this.optionsList[index][this.keyFieldCollection];
this.optionContentCollection = this.optionsList[index].label || this.optionsList[index][this.keyFieldCollection];
this.optionValueCollection = this.optionsList[index][this.valueField];
this.optionError = '';
},
Expand Down Expand Up @@ -535,15 +535,17 @@ export default {

this.optionsList.push(
{
[this.keyFieldCollection]: this.optionContentCollection,
[this.keyFieldCollection]: this.optionValueCollection,
[this.valueField]: this.optionValueCollection,
label: this.optionContentCollection,
}
);
this.optionsList = this.optionsList.filter(option => option["content"] !== "all");
}
else {
this.optionsList[this.editIndex][this.keyFieldCollection] = this.optionContentCollection;
this.optionsList[this.editIndex][this.keyFieldCollection] = this.optionValueCollection;
this.optionsList[this.editIndex][this.valueField] = this.optionValueCollection;
this.optionsList[this.editIndex].label = this.optionContentCollection;
}

this.jsonError = '';
Expand Down
74 changes: 37 additions & 37 deletions src/components/renderer/form-record-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
data-cy="table"
:tbody-tr-class="rowClass"
>

<!-- Slot header for checkbox (Select All) -->
<template #head(checkbox)="data">
<b-form-checkbox
Expand All @@ -47,8 +47,8 @@
</template>

<template #cell(checkbox)="{ index, item }">
<b-form-checkbox
v-model="selectedRows"
<b-form-checkbox
v-model="selectedRows"
:value="item"
@change="onMultipleSelectionChange(index)"
/>
Expand All @@ -59,12 +59,12 @@
v-model="selectedRow"
:value="item"
@change="onRadioChange(item, index)"

/>
</template>

<template #cell()="{ index, field, item }">

<template v-if="isFiledownload(field, item)">
<span href="#" @click="downloadFile(item, field.key, index)">{{
mustache(field.key, item)
Expand All @@ -79,7 +79,7 @@
<template v-else>
{{ formatIfDate(mustache(field.key, item)) }}
</template>

</template>
<template #cell(__actions)="{ index, item }">
<div class="actions">
Expand Down Expand Up @@ -110,8 +110,8 @@
:title="$t('Delete')"
data-cy="remove-row"
popover="manual"
@click="styleMode === 'Modern'
? togglePopover(index, $event, item.row_id)
@click="styleMode === 'Modern'
? togglePopover(index, $event, item.row_id)
: showDeleteConfirmation(index, item.row_id)"
ref="deleteButton"
>
Expand All @@ -128,7 +128,7 @@
</div>
</div>
</template>

</b-table>
<div class="d-flex justify-content-between align-items-center">
<div class="col text-left">
Expand Down Expand Up @@ -238,7 +238,7 @@
>
<p>{{ $t("The form to be displayed is not assigned.") }}</p>
</b-modal>

<div v-if="editable && selfReferenced" class="alert alert-danger">
{{
$t(
Expand Down Expand Up @@ -321,7 +321,7 @@ export default {
collectionData: {},
selectedRow: null,
selectedRows: [],
selectedIndex: null,
selectedIndex: null,
rows: [],
selectAll: false,
styleMode: "Classic",
Expand Down Expand Up @@ -419,11 +419,11 @@ export default {
this.value.forEach(item => {
if (item.hasOwnProperty('selectedRowsIndex')) {
this.selectedRows.push(data.data[item.selectedRowsIndex]);
}
}
});
}
}
return data;
return data;
},
// The fields used for our vue table
tableFields() {
Expand All @@ -434,15 +434,15 @@ export default {
}

// Adds radio buttons or checkbox to the table depending selected option
if(this.source?.sourceOptions === "Collection") {
if(this.source?.sourceOptions === "Collection") {
if (['single-field', 'single-record'].includes(this.source?.dataSelectionOptions)) {
fields.unshift({
key: 'radio',
label: '',
sortable: false,
});
}

if (this.source?.dataSelectionOptions === 'multiple-records') {
fields.unshift({
key: 'checkbox',
Expand All @@ -451,7 +451,7 @@ export default {
});
}
}

return fields;
},
// Determines if the form used for add/edit is self referencing. If so, we should not show it
Expand All @@ -474,7 +474,7 @@ export default {
handler(newValue, oldValue) {
if (this.source?.sourceOptions === "Collection" && this.source?.collectionFields?.pmql) {
this.onCollectionChange(
this.source?.collectionFields?.collectionId,
this.source?.collectionFields?.collectionId,
this.source?.collectionFields?.pmql
);
}
Expand All @@ -499,7 +499,7 @@ export default {
if(this.source?.sourceOptions === "Collection") {
this.onCollectionChange(this.source?.collectionFields?.collectionId, this.source?.collectionFields?.pmql);
}

this.setStyleMode(this.designerMode?.designerOptions);
this.$root.$emit("record-list-option", this.source?.sourceOptions);
},
Expand Down Expand Up @@ -588,15 +588,15 @@ export default {
this.fetchAllRecords(collectionId);
return;
}

// Process Mustache variables in PMQL
const processedPmql = this.processMustacheInPmql(pmql);

// If processing failed or resulted in invalid PMQL, return
if (!processedPmql) {
return;
}

// Fetch records with processed PMQL
this.fetchRecordsWithPmql(collectionId, processedPmql);
},
Expand All @@ -614,7 +614,7 @@ export default {
try {
// Get data from validationData
const data = this.validationData || {};

// First, process all Mustache variables (both quoted and unquoted)
let processedPmql = Mustache.render(pmql, data);

Expand All @@ -623,14 +623,14 @@ export default {
this.collectionData = [];
return null;
}

// Add quotes around string values in PMQL if they don't have them
// This regex now properly handles values with spaces by looking for the end of the comparison
processedPmql = processedPmql.replace(
/= ([^"'\s][^"']*[^"'\s]|[^"'\s]+)(?=\s|$)/g,
'= "$1"'
);

return processedPmql;
} catch (error) {
this.collectionData = [];
Expand All @@ -654,8 +654,8 @@ export default {
* @returns {boolean} - True if valid
*/
isValidPmql(processedPmql) {
return processedPmql &&
processedPmql.trim() !== "" &&
return processedPmql &&
processedPmql.trim() !== "" &&
!processedPmql.includes("{{");
},

Expand Down Expand Up @@ -686,9 +686,9 @@ export default {
this.collectionData = [];
return;
}

const param = { params: { pmql: processedPmql } };

this.$dataProvider
.getCollectionRecordsList(collectionId, param)
.then((response) => {
Expand All @@ -702,7 +702,7 @@ export default {
this.$emit("change", this.field);
},
changeCollectionColumns(collectionFieldsColumns,columnsSelected) {

const optionsList = columnsSelected.optionsList;

collectionFieldsColumns.forEach(column => {
Expand All @@ -721,7 +721,7 @@ export default {
});

this.setCollectionIntoList(collectionFieldsColumns);

},
setCollectionIntoList(arrayCollection) {
const result = [];
Expand Down Expand Up @@ -864,14 +864,14 @@ export default {
},
getTableFieldsFromDataSource() {
const { jsonData, key, value, dataName } = this.fields;

let convertToVuetableFormat = {};
if(this.source?.sourceOptions === "Collection") {
convertToVuetableFormat = (option) => {
return {
key: option[key || "key"],
sortable: true,
label: option[key || "key"],
label: option.label || option[key || "key"],
tdClass: "table-column"
};
};
Expand All @@ -880,7 +880,7 @@ export default {
return {
key: option[key || "value"],
sortable: true,
label: option[value || "content"],
label: option.label || option[value || "content"],
tdClass: "table-column"
};
};
Expand Down Expand Up @@ -1088,15 +1088,15 @@ export default {
background-color: #eaf2ff;
}
.class-button-modern {
font-size: 14px;
font-weight: bold;
font-size: 14px;
font-weight: bold;
text-decoration: none;
}

.record-list-table-base {
border-collapse: separate;
border-spacing: 0;

thead th {
border-top: 1px solid;
border-bottom: 1px solid;
Expand All @@ -1114,7 +1114,7 @@ export default {
td {
border-bottom: 1px solid;
}

td:first-child {
border-left: 1px solid;
}
Expand Down
Loading