@bindu-dashing/dam-solution-v2 5.8.148 → 5.8.150
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.
- package/build/CreateClient/CreateClientBtn.d.ts +6 -1
- package/build/CreateClient/CreateClientBtn.js +3 -2
- package/build/CreateClient/CreateClientForm.d.ts +6 -1
- package/build/CreateClient/CreateClientForm.js +7 -3
- package/build/CreateClient/index.d.ts +5 -0
- package/build/CreateClient/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
declare const CreateClient: ({ onSuccess, clientSubdomain, teamsApi, username, password, }: {
|
|
1
|
+
declare const CreateClient: ({ onSuccess, clientSubdomain, teamsApi, username, password, existingClientData, }: {
|
|
2
2
|
onSuccess: (data: any) => void;
|
|
3
3
|
clientSubdomain: string;
|
|
4
4
|
teamsApi: string;
|
|
5
5
|
username: string;
|
|
6
6
|
password: string;
|
|
7
|
+
existingClientData?: {
|
|
8
|
+
accessKey: string;
|
|
9
|
+
secretKey: string;
|
|
10
|
+
subdomain: string;
|
|
11
|
+
} | null;
|
|
7
12
|
}) => JSX.Element;
|
|
8
13
|
export default CreateClient;
|
|
@@ -2,11 +2,12 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { Button } from "antd";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import CreateClientForm from "./CreateClientForm";
|
|
5
|
-
const CreateClient = ({ onSuccess, clientSubdomain, teamsApi, username, password, }) => {
|
|
5
|
+
const CreateClient = ({ onSuccess, clientSubdomain, teamsApi, username, password, existingClientData, }) => {
|
|
6
6
|
const [showForm, setShowForm] = useState(false);
|
|
7
|
+
const isEditMode = !!existingClientData;
|
|
7
8
|
const toggleShow = () => {
|
|
8
9
|
setShowForm(!showForm);
|
|
9
10
|
};
|
|
10
|
-
return (_jsxs(_Fragment, { children: [_jsx(Button, { type: "primary", onClick: toggleShow, children: "Create Client" }), showForm && (_jsx(CreateClientForm, { toggleShow: toggleShow, onSuccess: onSuccess, clientSubdomain: clientSubdomain, teamsApi: teamsApi, username: username, password: password }))] }));
|
|
11
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { type: "primary", onClick: toggleShow, children: isEditMode ? "Edit Client" : "Create Client" }), showForm && (_jsx(CreateClientForm, { toggleShow: toggleShow, onSuccess: onSuccess, clientSubdomain: clientSubdomain, teamsApi: teamsApi, username: username, password: password, existingClientData: existingClientData }))] }));
|
|
11
12
|
};
|
|
12
13
|
export default CreateClient;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
declare const CreateClientForm: ({ teamsApi, username, password, toggleShow, onSuccess, clientSubdomain, }: {
|
|
1
|
+
declare const CreateClientForm: ({ teamsApi, username, password, toggleShow, onSuccess, clientSubdomain, existingClientData, }: {
|
|
2
2
|
teamsApi: string;
|
|
3
3
|
username: string;
|
|
4
4
|
password: string;
|
|
5
5
|
toggleShow: () => void;
|
|
6
6
|
onSuccess: (data: any) => void;
|
|
7
7
|
clientSubdomain: string;
|
|
8
|
+
existingClientData?: {
|
|
9
|
+
accessKey: string;
|
|
10
|
+
secretKey: string;
|
|
11
|
+
subdomain: string;
|
|
12
|
+
} | null;
|
|
8
13
|
}) => JSX.Element;
|
|
9
14
|
export default CreateClientForm;
|
|
@@ -19,7 +19,7 @@ import { CREATE_SUCCESS, SOMETHING_WENT_WRONG, } from "../utilities/constants/me
|
|
|
19
19
|
import { NotificationStatus } from "../utilities/constants/interface";
|
|
20
20
|
import { showNotification } from "../common/notifications";
|
|
21
21
|
import { get } from "lodash";
|
|
22
|
-
const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess, clientSubdomain, }) => {
|
|
22
|
+
const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess, clientSubdomain, existingClientData, }) => {
|
|
23
23
|
const damConfig = useDamConfig();
|
|
24
24
|
const { appType } = damConfig;
|
|
25
25
|
const [loading, setLoading] = useState(false);
|
|
@@ -27,6 +27,7 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
|
|
|
27
27
|
const [filteredTeams, setFilteredTeams] = useState([]);
|
|
28
28
|
const api = useMemo(() => createApiClient(damConfig), [damConfig]);
|
|
29
29
|
const [form] = Form.useForm();
|
|
30
|
+
const isEditMode = !!existingClientData;
|
|
30
31
|
const onChangeDamLocationType = (e) => {
|
|
31
32
|
setDamLocationType(e);
|
|
32
33
|
form.setFieldValue("dam_location_details", { type: e });
|
|
@@ -35,7 +36,10 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
|
|
|
35
36
|
if (clientSubdomain) {
|
|
36
37
|
form.setFieldValue("subdomain", clientSubdomain);
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
+
if (existingClientData === null || existingClientData === void 0 ? void 0 : existingClientData.subdomain) {
|
|
40
|
+
form.setFieldValue("subdomain", existingClientData.subdomain);
|
|
41
|
+
}
|
|
42
|
+
}, [existingClientData]);
|
|
39
43
|
const onFinish = (data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
44
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
41
45
|
try {
|
|
@@ -103,7 +107,7 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
|
|
|
103
107
|
console.log("Error while fetching external teams", err);
|
|
104
108
|
}
|
|
105
109
|
});
|
|
106
|
-
return (_jsx(Drawer, { open: true, title: "Create Client", onClose: toggleShow, width: 500, maskClosable: false, children: _jsxs(Form, { layout: "vertical", form: form, onFinish: onFinish, children: [_jsx(Form.Item, { label: "Name", name: "name", rules: [
|
|
110
|
+
return (_jsx(Drawer, { open: true, title: isEditMode ? "Edit Client" : "Create Client", onClose: toggleShow, width: 500, maskClosable: false, children: _jsxs(Form, { layout: "vertical", form: form, onFinish: onFinish, children: [_jsx(Form.Item, { label: "Name", name: "name", rules: [
|
|
107
111
|
{
|
|
108
112
|
required: true,
|
|
109
113
|
message: "Name is required",
|
|
@@ -10,5 +10,10 @@ declare function App(props: {
|
|
|
10
10
|
teamIds: string[] | number[];
|
|
11
11
|
styles: Record<string, any>;
|
|
12
12
|
appType: string;
|
|
13
|
+
existingClientData?: {
|
|
14
|
+
accessKey: string;
|
|
15
|
+
secretKey: string;
|
|
16
|
+
subdomain: string;
|
|
17
|
+
} | null;
|
|
13
18
|
}): JSX.Element;
|
|
14
19
|
export default App;
|
|
@@ -13,6 +13,6 @@ function App(props) {
|
|
|
13
13
|
styles: props === null || props === void 0 ? void 0 : props.styles,
|
|
14
14
|
appType: props === null || props === void 0 ? void 0 : props.appType,
|
|
15
15
|
};
|
|
16
|
-
return (_jsx(DamConfigProvider, { config: config, children: _jsxs(ThemeProvider, { styles: props === null || props === void 0 ? void 0 : props.styles, sessionTheme: ThemeModes.LIGHT, children: [_jsx(CreateClient, { teamsApi: props === null || props === void 0 ? void 0 : props.teamsApi, username: props === null || props === void 0 ? void 0 : props.username, password: props === null || props === void 0 ? void 0 : props.password, clientSubdomain: props === null || props === void 0 ? void 0 : props.clientSubdomain, onSuccess: props === null || props === void 0 ? void 0 : props.onSuccess }), _jsx(ToastProvider, {})] }) }));
|
|
16
|
+
return (_jsx(DamConfigProvider, { config: config, children: _jsxs(ThemeProvider, { styles: props === null || props === void 0 ? void 0 : props.styles, sessionTheme: ThemeModes.LIGHT, children: [_jsx(CreateClient, { teamsApi: props === null || props === void 0 ? void 0 : props.teamsApi, username: props === null || props === void 0 ? void 0 : props.username, password: props === null || props === void 0 ? void 0 : props.password, clientSubdomain: props === null || props === void 0 ? void 0 : props.clientSubdomain, onSuccess: props === null || props === void 0 ? void 0 : props.onSuccess, existingClientData: props === null || props === void 0 ? void 0 : props.existingClientData }), _jsx(ToastProvider, {})] }) }));
|
|
17
17
|
}
|
|
18
18
|
export default App;
|