@bindu-dashing/dam-solution-v2 5.9.240 → 5.9.242
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -25,7 +25,7 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
|
|
|
25
25
|
const { appType } = damConfig;
|
|
26
26
|
const [loading, setLoading] = useState(false);
|
|
27
27
|
const [fetchingClientData, setFetchingClientData] = useState(false);
|
|
28
|
-
const [damLocationType, setDamLocationType] = useState("external");
|
|
28
|
+
const [damLocationType, setDamLocationType] = useState(existingClientData ? "external" : "internal");
|
|
29
29
|
const [filteredTeams, setFilteredTeams] = useState([]);
|
|
30
30
|
const [clientData, setClientData] = useState(null);
|
|
31
31
|
const [teamsFetched, setTeamsFetched] = useState(false);
|
|
@@ -381,7 +381,7 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
|
|
|
381
381
|
}
|
|
382
382
|
}, [teamsApi, username, password, teamsApiFromData, usernameFromData, passwordFromData, teamsFetched]);
|
|
383
383
|
const fetchTeams = (apiUrl, apiUsername, apiPassword) => __awaiter(void 0, void 0, void 0, function* () {
|
|
384
|
-
var _a, _b;
|
|
384
|
+
var _a, _b, _c, _d;
|
|
385
385
|
try {
|
|
386
386
|
const response = yield axios.get(apiUrl, {
|
|
387
387
|
headers: {
|
|
@@ -396,12 +396,26 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
|
|
|
396
396
|
};
|
|
397
397
|
});
|
|
398
398
|
setFilteredTeams(options);
|
|
399
|
+
if (!isEditMode) {
|
|
400
|
+
const brandTeam = (_d = (_c = response === null || response === void 0 ? void 0 : response.data) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.find((team) => (team === null || team === void 0 ? void 0 : team.type) === "Brand");
|
|
401
|
+
if (brandTeam === null || brandTeam === void 0 ? void 0 : brandTeam.id) {
|
|
402
|
+
form.setFieldValue("adminTeams", [brandTeam.id]);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
399
405
|
}
|
|
400
406
|
catch (err) {
|
|
401
407
|
}
|
|
402
408
|
});
|
|
403
409
|
const shouldShowExternalFields = damLocationType === "external" || isEditMode;
|
|
404
|
-
return (_jsx(Drawer, { open: true, title: isEditMode ? "Edit Client" : "Create Client", onClose: toggleShow, width: 500, maskClosable: false, zIndex: 99999, children: fetchingClientData ? (_jsx("div", { style: { textAlign: "center", padding: "20px" }, children: _jsx(Typography.Text, { children: "Loading client data..." }) })) : (_jsxs(Form, { layout: "vertical", form: form, onFinish: onFinish,
|
|
410
|
+
return (_jsx(Drawer, { open: true, title: isEditMode ? "Edit Client" : "Create Client", onClose: toggleShow, width: 500, maskClosable: false, zIndex: 99999, children: fetchingClientData ? (_jsx("div", { style: { textAlign: "center", padding: "20px" }, children: _jsx(Typography.Text, { children: "Loading client data..." }) })) : (_jsxs(Form, { layout: "vertical", form: form, onFinish: onFinish, initialValues: !isEditMode
|
|
411
|
+
? {
|
|
412
|
+
accessTypes: ["WEBSITE", "IFRAME", "COMPONENT"],
|
|
413
|
+
damLocationDetails: {
|
|
414
|
+
type: "internal",
|
|
415
|
+
rootPath: "/",
|
|
416
|
+
},
|
|
417
|
+
}
|
|
418
|
+
: undefined, children: [_jsx(Form.Item, { label: "Name", name: "name", rules: [
|
|
405
419
|
{
|
|
406
420
|
required: true,
|
|
407
421
|
message: "Name is required",
|