Skip to content

Commit

Permalink
Merge pull request #69 from KelvinTegelaar/dev
Browse files Browse the repository at this point in the history
[pull] dev from KelvinTegelaar:dev
  • Loading branch information
pull[bot] authored Feb 5, 2025
2 parents 37f9b17 + 0584d61 commit 5608787
Show file tree
Hide file tree
Showing 7 changed files with 440 additions and 23 deletions.
34 changes: 34 additions & 0 deletions src/components/CippComponents/CippApiDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,40 @@ export const CippApiDialog = (props) => {
const onSubmit = (data) => handleActionClick(row, api, data);
const selectedType = api.type === "POST" ? actionPostRequest : actionGetRequest;

if (api?.setDefaultValues) {
fields.map((field) => {
if (
((typeof row[field.name] === "string" && field.type === "textField") ||
(typeof row[field.name] === "boolean" && field.type === "switch")) &&
row[field.name] !== undefined &&
row[field.name] !== null &&
row[field.name] !== ""
) {
formHook.setValue(field.name, row[field.name]);
} else if (Array.isArray(row[field.name]) && field.type === "autoComplete") {
var values = [];
row[field.name].map((element) => {
values.push({
label: element,
value: element,
});
});
formHook.setValue(field.name, values);
} else if (
field.type === "autoComplete" &&
row[field.name] !== undefined &&
row[field.name] !== null &&
row[field.name] !== "" &&
typeof row[field.name] === "string"
) {
formHook.setValue(field.name, {
label: row[field.name],
value: row[field.name],
});
}
});
}

// Handling link navigation
if (api.link) {
const getNestedValue = (obj, path) => {
Expand Down
1 change: 1 addition & 0 deletions src/components/CippComponents/CippTranslations.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ export const CippTranslations = {
"commitmentTerm.renewalConfiguration.renewalDate": "Renewal Date",
storageUsedInBytes: "Storage Used",
prohibitSendReceiveQuotaInBytes: "Quota",
ClientId: "Client ID",
};
Loading

0 comments on commit 5608787

Please sign in to comment.