awing-library 2.1.119-beta → 2.1.121-beta
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/lib/ACM-AXN/AuthenticationProfile/Container.d.ts +2 -0
- package/lib/ACM-AXN/AuthenticationProfile/Container.js +82 -0
- package/lib/ACM-AXN/AuthenticationProfile/Container.test.d.ts +1 -0
- package/lib/ACM-AXN/AuthenticationProfile/Container.test.js +184 -0
- package/lib/ACM-AXN/AuthenticationProfile/Context.d.ts +3 -0
- package/lib/ACM-AXN/AuthenticationProfile/Context.js +5 -0
- package/lib/ACM-AXN/AuthenticationProfile/CreateOrEdit/CreateOrEdit.test.d.ts +1 -0
- package/lib/ACM-AXN/AuthenticationProfile/CreateOrEdit/CreateOrEdit.test.js +203 -0
- package/lib/ACM-AXN/AuthenticationProfile/CreateOrEdit/index.d.ts +2 -0
- package/lib/ACM-AXN/AuthenticationProfile/CreateOrEdit/index.js +129 -0
- package/lib/ACM-AXN/AuthenticationProfile/Hooks.d.ts +2 -0
- package/lib/ACM-AXN/AuthenticationProfile/Hooks.js +12 -0
- package/lib/ACM-AXN/AuthenticationProfile/Types.d.ts +75 -0
- package/lib/ACM-AXN/AuthenticationProfile/Types.js +2 -0
- package/lib/ACM-AXN/AuthenticationProfile/Utils.d.ts +11 -0
- package/lib/ACM-AXN/AuthenticationProfile/Utils.js +14 -0
- package/lib/ACM-AXN/AuthenticationProfile/index.d.ts +3 -0
- package/lib/ACM-AXN/AuthenticationProfile/index.js +40 -0
- package/lib/ACM-AXN/CampaignPlan/Container.js +1 -1
- package/lib/ACM-AXN/CampaignPlan/index.js +1 -1
- package/lib/ACM-AXN/Common/Constant.d.ts +2 -0
- package/lib/ACM-AXN/Common/Constant.js +2 -0
- package/lib/ACM-AXN/Page/Constant.d.ts +0 -10
- package/lib/ACM-AXN/Page/Constant.js +1 -11
- package/lib/ACM-AXN/Page/Container.js +9 -10
- package/lib/ACM-AXN/Page/CreateOrEdit/Components/useListPageView.js +2 -2
- package/lib/ACM-AXN/Page/index.js +9 -7
- package/lib/ACM-AXN/Wizard/Container.js +1 -1
- package/lib/ACM-AXN/Wizard/Container.test.js +1 -1
- package/lib/ACM-AXN/Wizard/index.js +1 -1
- package/lib/translate/en/translation.json +11 -0
- package/lib/translate/vi/translation.json +11 -0
- package/package.json +1 -1
- package/lib/ACM-AXN/CampaignPlan/Constant.d.ts +0 -8
- package/lib/ACM-AXN/CampaignPlan/Constant.js +0 -11
- package/lib/ACM-AXN/Wizard/Constant.d.ts +0 -4
- package/lib/ACM-AXN/Wizard/Constant.js +0 -7
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
var react_1 = require("react");
|
|
8
|
+
var react_i18next_1 = require("react-i18next");
|
|
9
|
+
var Context_1 = require("../../Context");
|
|
10
|
+
var Utils_1 = require("./Utils");
|
|
11
|
+
var Constant_1 = require("../Common/Constant");
|
|
12
|
+
var Router_1 = require("../../AWING/Router");
|
|
13
|
+
var Hooks_1 = __importDefault(require("./Hooks"));
|
|
14
|
+
var AWING_1 = require("../../AWING");
|
|
15
|
+
function Container() {
|
|
16
|
+
var _a;
|
|
17
|
+
var navigate = (0, Router_1.useNavigate)();
|
|
18
|
+
var t = (0, react_i18next_1.useTranslation)().t;
|
|
19
|
+
var service = (0, Hooks_1.default)().service;
|
|
20
|
+
var _b = (0, Context_1.useAwing)().appHelper, confirm = _b.confirm, snackbar = _b.snackbar;
|
|
21
|
+
var _c = (0, react_1.useState)(false), loading = _c[0], setLoading = _c[1];
|
|
22
|
+
var _d = (0, react_1.useState)(), authenticationProfiles = _d[0], setAuthenticationProfiles = _d[1];
|
|
23
|
+
var getAuthenticationProfile = (0, react_1.useCallback)(function (queryParams) {
|
|
24
|
+
setLoading(true);
|
|
25
|
+
service
|
|
26
|
+
.authenticationProfilesPaging(queryParams.searchString, queryParams.pageSize, queryParams.pageIndex)
|
|
27
|
+
.then(setAuthenticationProfiles)
|
|
28
|
+
.finally(function () {
|
|
29
|
+
setLoading(false);
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
|
+
[]);
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(AWING_1.PageManagement, { title: t('AuthenticationProfile.Title'), inputSearchPlaceholder: t('AuthenticationProfile.SearchPlaceholder'), onChangeQueryInput: getAuthenticationProfile, getRowId: function (obj) { return obj.authenticationProfileId; }, columns: [
|
|
35
|
+
{
|
|
36
|
+
field: 'authenticationProfileId',
|
|
37
|
+
headerName: 'STT',
|
|
38
|
+
width: 60,
|
|
39
|
+
valueGetter: function (_unUse, idx, stt) { return stt; },
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
field: 'authenticationMethodCode',
|
|
43
|
+
headerName: 'Method Code',
|
|
44
|
+
width: 130,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
field: 'apControllerCode',
|
|
48
|
+
headerName: (0, jsx_runtime_1.jsx)("b", { children: "AP Controller Code" }),
|
|
49
|
+
width: 170,
|
|
50
|
+
valueGetter: function (row) {
|
|
51
|
+
return row.apControllerCode === Utils_1.AP_CONTROLLER_CODE.All ||
|
|
52
|
+
!row.apControllerCode
|
|
53
|
+
? t('AuthenticationProfile.All')
|
|
54
|
+
: row.apControllerCode;
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
field: 'name',
|
|
59
|
+
headerName: t('Common.Name'),
|
|
60
|
+
width: 250,
|
|
61
|
+
dynamicTableCellProps: function () {
|
|
62
|
+
return {
|
|
63
|
+
style: { wordBreak: 'break-all' },
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
field: 'parameters',
|
|
69
|
+
headerName: 'Params',
|
|
70
|
+
dynamicTableCellProps: function () {
|
|
71
|
+
return {
|
|
72
|
+
style: { wordBreak: 'break-all' },
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
], loading: loading, rows: (authenticationProfiles === null || authenticationProfiles === void 0 ? void 0 : authenticationProfiles.items) || [], onCreateButtonClick: function () {
|
|
77
|
+
return navigate("/".concat(Constant_1.Constants.AUTHENTICATION_PROFILE_PATH, "/").concat(Constant_1.Constants.CREATE_PATH));
|
|
78
|
+
}, totalOfRows: (authenticationProfiles === null || authenticationProfiles === void 0 ? void 0 : authenticationProfiles.totalItemCount) || 0, onDelete: (_a = service.authenticationProfilesDelete) === null || _a === void 0 ? void 0 : _a.bind(service), onRowClick: function (id) {
|
|
79
|
+
return navigate("/".concat(Constant_1.Constants.AUTHENTICATION_PROFILE_PATH, "/").concat(Constant_1.Constants.EDIT_PATH, "/").concat(id));
|
|
80
|
+
}, confirmDelete: confirm, showNotificationSuccess: function () { return snackbar('success'); } }));
|
|
81
|
+
}
|
|
82
|
+
exports.default = Container;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
54
|
+
var react_1 = require("@testing-library/react");
|
|
55
|
+
var Router_1 = require("../../AWING/Router");
|
|
56
|
+
var Constant_1 = require("../Common/Constant");
|
|
57
|
+
var Container_1 = __importDefault(require("./Container"));
|
|
58
|
+
var items = [
|
|
59
|
+
{
|
|
60
|
+
authenticationProfileId: '4798649175639457397',
|
|
61
|
+
name: 'TCI UNIFI TEST VP API',
|
|
62
|
+
directoryId: '4960166916046400365',
|
|
63
|
+
directoryPath: '.0.90.100.4960166916046400365.4798649175639457397.',
|
|
64
|
+
authenticationMethodCode: 'api',
|
|
65
|
+
apControllerCode: 'ruckusvirtualsmartzone',
|
|
66
|
+
parameters: '{"BaseUrl": "118.70.206.198:8443","SiteId": "24g5ytl0","Username": "admin","Password": "Awing@2018", "Up":10000,"Down":10000,"Minutes":90,"Mbytes":10000}',
|
|
67
|
+
description: '',
|
|
68
|
+
createdDate: {
|
|
69
|
+
seconds: '1702977561',
|
|
70
|
+
nanos: 0,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
authenticationProfileId: '5044439137295001011',
|
|
75
|
+
name: 'Radius 120',
|
|
76
|
+
directoryId: '4960166916046400365',
|
|
77
|
+
directoryPath: '.0.90.100.4960166916046400365.5044439137295001011.',
|
|
78
|
+
authenticationMethodCode: 'radius',
|
|
79
|
+
apControllerCode: 'extreme',
|
|
80
|
+
parameters: '{"Username":"awing120","Password":"Awing120@2018","SecretKey":"awing"}',
|
|
81
|
+
description: '',
|
|
82
|
+
createdDate: {
|
|
83
|
+
seconds: '1636731568',
|
|
84
|
+
nanos: 0,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
var clientMethod = {
|
|
89
|
+
authenticationProfilesPaging: function () {
|
|
90
|
+
return Promise.resolve({
|
|
91
|
+
items: items,
|
|
92
|
+
totalItemCount: items.length,
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
authenticationProfilesDelete: function () { return function (_id) { }; },
|
|
96
|
+
};
|
|
97
|
+
// Mock Hooks
|
|
98
|
+
jest.mock('./Hooks', function () { return ({
|
|
99
|
+
__esModule: true,
|
|
100
|
+
default: function () { return ({
|
|
101
|
+
service: {
|
|
102
|
+
authenticationProfilesPaging: jest.fn(function (_param) {
|
|
103
|
+
return Promise.resolve(clientMethod.authenticationProfilesPaging());
|
|
104
|
+
}),
|
|
105
|
+
authenticationProfilesDelete: jest.fn(function (_id) {
|
|
106
|
+
return Promise.resolve(clientMethod.authenticationProfilesDelete());
|
|
107
|
+
}),
|
|
108
|
+
},
|
|
109
|
+
}); },
|
|
110
|
+
}); });
|
|
111
|
+
// Mock đa ngữ
|
|
112
|
+
jest.mock('react-i18next', function () { return (__assign(__assign({}, jest.requireActual('react-i18next')), { useTranslation: function () { return ({ t: jest.fn(function (key) { return key; }) }); } })); });
|
|
113
|
+
// Mock PageManagement
|
|
114
|
+
jest.mock('../../AWING', function () { return ({
|
|
115
|
+
PageManagement: function (props) {
|
|
116
|
+
props.onChangeQueryInput({
|
|
117
|
+
searchString: '',
|
|
118
|
+
pageIndex: 0,
|
|
119
|
+
pageSize: 10,
|
|
120
|
+
});
|
|
121
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { "data-testid": "title", children: "t('AuthenticationProfile.Title')" }), props.columns
|
|
122
|
+
.filter(function (item) { return item.valueGetter; })
|
|
123
|
+
.map(function (getter, idx) { return ((0, jsx_runtime_1.jsx)("span", { children: getter.valueGetter(items[0], idx) }, idx)); }), (0, jsx_runtime_1.jsx)("span", { "data-testid": "rowid", children: props.getRowId(items[0]) }), (0, jsx_runtime_1.jsx)("button", { "data-testid": "Rowclick", onClick: function () {
|
|
124
|
+
props.onRowClick(items[0].authenticationProfileId);
|
|
125
|
+
}, children: "Rowclick" }), (0, jsx_runtime_1.jsx)("button", { "data-testid": "CreateBtn", onClick: props.onCreateButtonClick, children: "CreateBtn" }), (0, jsx_runtime_1.jsx)("button", { onClick: function () {
|
|
126
|
+
props.onChangeQueryInput({
|
|
127
|
+
pageIndex: 1,
|
|
128
|
+
pageSize: 10,
|
|
129
|
+
});
|
|
130
|
+
}, children: "ChangeInput" }), (0, jsx_runtime_1.jsx)("button", { "data-testid": "onDelete", onClick: function () {
|
|
131
|
+
props.onDelete('onDelete');
|
|
132
|
+
}, children: "Remove Btn" }), (0, jsx_runtime_1.jsx)("p", { children: JSON.stringify(props.rows) }), (0, jsx_runtime_1.jsxs)("span", { children: ["totalItemCount:", props.totalOfRows] })] }));
|
|
133
|
+
},
|
|
134
|
+
}); });
|
|
135
|
+
var renderUi = function () {
|
|
136
|
+
return (0, react_1.render)((0, jsx_runtime_1.jsx)(Router_1.BrowserRouter, { children: (0, jsx_runtime_1.jsx)(Container_1.default, {}) }));
|
|
137
|
+
};
|
|
138
|
+
describe('AuthenticationProfileId Container component', function () {
|
|
139
|
+
it('Check renders component(Container).', function () {
|
|
140
|
+
renderUi();
|
|
141
|
+
expect(react_1.screen.getByTestId('title')).toBeInTheDocument();
|
|
142
|
+
expect(react_1.screen.getByTestId('CreateBtn')).toBeInTheDocument();
|
|
143
|
+
});
|
|
144
|
+
it('Chuyển đến trang thêm mới.', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
145
|
+
return __generator(this, function (_a) {
|
|
146
|
+
switch (_a.label) {
|
|
147
|
+
case 0:
|
|
148
|
+
renderUi();
|
|
149
|
+
expect(react_1.screen.getByTestId('CreateBtn')).toBeInTheDocument();
|
|
150
|
+
react_1.fireEvent.click(react_1.screen.getByTestId('CreateBtn'));
|
|
151
|
+
return [4 /*yield*/, (0, react_1.waitFor)(function () {
|
|
152
|
+
return expect(window.location.href).toContain([
|
|
153
|
+
'http://localhost',
|
|
154
|
+
Constant_1.Constants.AUTHENTICATION_PROFILE_PATH,
|
|
155
|
+
Constant_1.Constants.CREATE_PATH,
|
|
156
|
+
].join('/'));
|
|
157
|
+
})];
|
|
158
|
+
case 1:
|
|
159
|
+
_a.sent();
|
|
160
|
+
return [2 /*return*/];
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}); });
|
|
164
|
+
it('Chuyến đến trang Edit.', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
165
|
+
return __generator(this, function (_a) {
|
|
166
|
+
switch (_a.label) {
|
|
167
|
+
case 0:
|
|
168
|
+
renderUi();
|
|
169
|
+
react_1.fireEvent.click(react_1.screen.getByTestId('Rowclick'));
|
|
170
|
+
return [4 /*yield*/, (0, react_1.waitFor)(function () {
|
|
171
|
+
return expect(window.location.href).toContain([
|
|
172
|
+
'http://localhost',
|
|
173
|
+
Constant_1.Constants.AUTHENTICATION_PROFILE_PATH,
|
|
174
|
+
Constant_1.Constants.EDIT_PATH,
|
|
175
|
+
items[0].authenticationProfileId,
|
|
176
|
+
].join('/'));
|
|
177
|
+
})];
|
|
178
|
+
case 1:
|
|
179
|
+
_a.sent();
|
|
180
|
+
return [2 /*return*/];
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}); });
|
|
184
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
54
|
+
/* eslint-disable testing-library/no-wait-for-side-effects */
|
|
55
|
+
var react_1 = require("@testing-library/react");
|
|
56
|
+
var Router_1 = require("../../../AWING/Router");
|
|
57
|
+
var index_1 = __importDefault(require("./index"));
|
|
58
|
+
var id = 'idEdit11081999';
|
|
59
|
+
var apControllers = [
|
|
60
|
+
{ text: 'Chọn tất cả', value: 'all' },
|
|
61
|
+
{ text: 'Aerohive', value: 'aerohive' },
|
|
62
|
+
{ text: 'Allied AP', value: 'allied' },
|
|
63
|
+
{ text: 'Aruba AP', value: 'aruba' },
|
|
64
|
+
{ text: 'Aruba IAP', value: 'arubaiap' },
|
|
65
|
+
{ text: 'Aruba Instant', value: 'arubainstant' },
|
|
66
|
+
];
|
|
67
|
+
var authenticationProfile = {
|
|
68
|
+
authenticationProfileId: '4761184776632900642',
|
|
69
|
+
name: 'TCI',
|
|
70
|
+
directoryId: '4960166916046400365',
|
|
71
|
+
directoryPath: '.0.90.100.4960166916046400365.4761184776632900642.',
|
|
72
|
+
authenticationMethodCode: 'api',
|
|
73
|
+
apControllerCode: 'unifi',
|
|
74
|
+
parameters: '{"Username": "admin","Password": "Awing@2018"}',
|
|
75
|
+
description: '',
|
|
76
|
+
createdDate: {
|
|
77
|
+
seconds: '1703131590',
|
|
78
|
+
nanos: 0,
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
var clientMethod = {
|
|
82
|
+
authenticationProfilesGet: function () { return function (_id) {
|
|
83
|
+
Promise.resolve(authenticationProfile);
|
|
84
|
+
}; },
|
|
85
|
+
apsGetApControllers: function () { return Promise.resolve(apControllers); },
|
|
86
|
+
authenticationProfilesPut: function (_id, body) { },
|
|
87
|
+
authenticationProfilesPost: function (body) { },
|
|
88
|
+
};
|
|
89
|
+
jest.mock('../Types', function () { return ({
|
|
90
|
+
__esModule: true,
|
|
91
|
+
AuthenticationProfile: {},
|
|
92
|
+
IAuthenticationProfile: {},
|
|
93
|
+
}); });
|
|
94
|
+
// mock Router
|
|
95
|
+
jest.mock('../../../AWING/Router', function () { return (__assign(__assign({}, jest.requireActual('../../../AWING/Router')), { useParams: jest.fn() })); });
|
|
96
|
+
// Mock đa ngữ
|
|
97
|
+
jest.mock('react-i18next', function () { return (__assign(__assign({}, jest.requireActual('react-i18next')), { useTranslation: function () { return ({ t: jest.fn(function (key) { return key; }) }); } })); });
|
|
98
|
+
// Mock Hooks
|
|
99
|
+
jest.mock('../Hooks', function () { return ({
|
|
100
|
+
__esModule: true,
|
|
101
|
+
default: function () { return ({
|
|
102
|
+
service: {
|
|
103
|
+
authenticationProfilesGet: jest.fn(function (_id) {
|
|
104
|
+
return Promise.resolve(clientMethod.authenticationProfilesGet());
|
|
105
|
+
}),
|
|
106
|
+
apsGetApControllers: jest.fn(function () {
|
|
107
|
+
return Promise.resolve(clientMethod.apsGetApControllers());
|
|
108
|
+
}),
|
|
109
|
+
authenticationProfilesPut: jest.fn(function (_id, body) {
|
|
110
|
+
return Promise.resolve(clientMethod.authenticationProfilesPut(_id, body));
|
|
111
|
+
}),
|
|
112
|
+
authenticationProfilesPost: jest.fn(function (body) {
|
|
113
|
+
return Promise.resolve(clientMethod.authenticationProfilesPost(body));
|
|
114
|
+
}),
|
|
115
|
+
},
|
|
116
|
+
}); },
|
|
117
|
+
}); });
|
|
118
|
+
// Mock Drawer
|
|
119
|
+
jest.mock('../../../Commons/Components/ClassicDrawer', function () { return function (props) { return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { "data-testid": "title-drawer", children: id ? 'Common.Edit' : 'Common.Create' }), (0, jsx_runtime_1.jsx)("button", { "data-testid": "onSubmit", onClick: props.onSubmit, children: "submit" }), props.children] })); }; });
|
|
120
|
+
// mock BasicDataForm
|
|
121
|
+
jest.mock('../../../AWING', function () { return ({
|
|
122
|
+
BasicDataForm: function (props) {
|
|
123
|
+
props.fields.forEach(function (element) {
|
|
124
|
+
if (element === null || element === void 0 ? void 0 : element.onValidate) {
|
|
125
|
+
element === null || element === void 0 ? void 0 : element.onValidate();
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
return ((0, jsx_runtime_1.jsxs)("div", { "data-testid": "BasicDataForm", children: [(0, jsx_runtime_1.jsx)("p", { children: JSON.stringify(props.oldValue) }), (0, jsx_runtime_1.jsx)("button", { "data-testid": "onUpdate", onClick: function () {
|
|
129
|
+
props.onUpdate(true, {
|
|
130
|
+
name: 'TCI',
|
|
131
|
+
authenticationMethodCode: 'api',
|
|
132
|
+
apControllerCode: 'unifi',
|
|
133
|
+
parameters: '{"Username": "QuanDX","Password": "Awing@2018"}',
|
|
134
|
+
description: '',
|
|
135
|
+
});
|
|
136
|
+
} })] }));
|
|
137
|
+
},
|
|
138
|
+
CircularProgress: function () { return (0, jsx_runtime_1.jsx)("div", { children: "CircularProgress" }); },
|
|
139
|
+
}); });
|
|
140
|
+
describe('AddOrEdit component', function () {
|
|
141
|
+
beforeEach(function () {
|
|
142
|
+
;
|
|
143
|
+
Router_1.useParams.mockReturnValue({ id: '' });
|
|
144
|
+
});
|
|
145
|
+
var renderUi = function () {
|
|
146
|
+
return (0, react_1.render)((0, jsx_runtime_1.jsx)(Router_1.BrowserRouter, { children: (0, jsx_runtime_1.jsx)(index_1.default, {}) }));
|
|
147
|
+
};
|
|
148
|
+
it('Render component', function () {
|
|
149
|
+
renderUi();
|
|
150
|
+
expect(react_1.screen.getByTestId('title-drawer')).toBeInTheDocument();
|
|
151
|
+
expect(react_1.screen.getByTestId('onSubmit')).toBeInTheDocument();
|
|
152
|
+
});
|
|
153
|
+
it('handleSubmit-create', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
154
|
+
var authenticationProfilesPostSpy;
|
|
155
|
+
return __generator(this, function (_a) {
|
|
156
|
+
switch (_a.label) {
|
|
157
|
+
case 0:
|
|
158
|
+
authenticationProfilesPostSpy = jest.spyOn(clientMethod, 'authenticationProfilesPost');
|
|
159
|
+
renderUi();
|
|
160
|
+
return [4 /*yield*/, (0, react_1.waitFor)(function () {
|
|
161
|
+
react_1.fireEvent.click(react_1.screen.getByTestId('onUpdate'));
|
|
162
|
+
react_1.fireEvent.click(react_1.screen.getByTestId('onSubmit'));
|
|
163
|
+
expect(authenticationProfilesPostSpy).toHaveBeenCalledWith({
|
|
164
|
+
name: 'TCI',
|
|
165
|
+
authenticationMethodCode: 'api',
|
|
166
|
+
apControllerCode: 'unifi',
|
|
167
|
+
parameters: '{"Username": "QuanDX","Password": "Awing@2018"}',
|
|
168
|
+
description: '',
|
|
169
|
+
});
|
|
170
|
+
})];
|
|
171
|
+
case 1:
|
|
172
|
+
_a.sent();
|
|
173
|
+
return [2 /*return*/];
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}); });
|
|
177
|
+
it('handleSubmit-edit', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
178
|
+
var authenticationProfilesPutSpy;
|
|
179
|
+
return __generator(this, function (_a) {
|
|
180
|
+
switch (_a.label) {
|
|
181
|
+
case 0:
|
|
182
|
+
;
|
|
183
|
+
Router_1.useParams.mockReturnValue({ id: id });
|
|
184
|
+
authenticationProfilesPutSpy = jest.spyOn(clientMethod, 'authenticationProfilesPut');
|
|
185
|
+
renderUi();
|
|
186
|
+
return [4 /*yield*/, (0, react_1.waitFor)(function () {
|
|
187
|
+
react_1.fireEvent.click(react_1.screen.getByTestId('onUpdate'));
|
|
188
|
+
react_1.fireEvent.click(react_1.screen.getByTestId('onSubmit'));
|
|
189
|
+
return expect(authenticationProfilesPutSpy).toHaveBeenCalledWith(id, {
|
|
190
|
+
name: 'TCI',
|
|
191
|
+
authenticationMethodCode: 'api',
|
|
192
|
+
apControllerCode: 'unifi',
|
|
193
|
+
parameters: '{"Username": "QuanDX","Password": "Awing@2018"}',
|
|
194
|
+
description: '',
|
|
195
|
+
});
|
|
196
|
+
})];
|
|
197
|
+
case 1:
|
|
198
|
+
_a.sent();
|
|
199
|
+
return [2 /*return*/];
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}); });
|
|
203
|
+
});
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var react_1 = require("react");
|
|
17
|
+
var react_i18next_1 = require("react-i18next");
|
|
18
|
+
var Router_1 = require("../../../AWING/Router");
|
|
19
|
+
var Hooks_1 = __importDefault(require("../Hooks"));
|
|
20
|
+
var ClassicDrawer_1 = __importDefault(require("../../../Commons/Components/ClassicDrawer"));
|
|
21
|
+
var Utils_1 = require("../Utils");
|
|
22
|
+
var AWING_1 = require("../../../AWING");
|
|
23
|
+
var CreateOrEdit = function () {
|
|
24
|
+
var id = (0, Router_1.useParams)().id;
|
|
25
|
+
var t = (0, react_i18next_1.useTranslation)().t;
|
|
26
|
+
var service = (0, Hooks_1.default)().service;
|
|
27
|
+
var _a = (0, react_1.useState)(true), loading = _a[0], setLoading = _a[1];
|
|
28
|
+
var _b = (0, react_1.useState)(false), formValid = _b[0], setFromValid = _b[1];
|
|
29
|
+
var _c = (0, react_1.useState)(false), confirmExit = _c[0], setConfirmExit = _c[1];
|
|
30
|
+
var _d = (0, react_1.useState)([]), apControllers = _d[0], setApControllers = _d[1];
|
|
31
|
+
var _e = (0, react_1.useState)(), authenticationProfile = _e[0], setAuthenticationProfile = _e[1];
|
|
32
|
+
(0, react_1.useEffect)(function () {
|
|
33
|
+
!apControllers.length &&
|
|
34
|
+
service.apsGetApControllers().then(function (apController) {
|
|
35
|
+
var apControllers = __spreadArray([
|
|
36
|
+
{
|
|
37
|
+
text: t('Common.SelectAll'),
|
|
38
|
+
value: null,
|
|
39
|
+
}
|
|
40
|
+
], apController.map(function (item) { return ({
|
|
41
|
+
text: (item === null || item === void 0 ? void 0 : item.name) || '',
|
|
42
|
+
value: (item === null || item === void 0 ? void 0 : item.apControllerCode) || '',
|
|
43
|
+
}); }), true);
|
|
44
|
+
setApControllers(apControllers);
|
|
45
|
+
});
|
|
46
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
|
+
}, [apControllers]);
|
|
48
|
+
(0, react_1.useEffect)(function () {
|
|
49
|
+
if (id) {
|
|
50
|
+
service
|
|
51
|
+
.authenticationProfilesGet(id)
|
|
52
|
+
.then(function (authenticationProfile_) {
|
|
53
|
+
authenticationProfile_.apControllerCode =
|
|
54
|
+
(authenticationProfile_ === null || authenticationProfile_ === void 0 ? void 0 : authenticationProfile_.apControllerCode) ===
|
|
55
|
+
Utils_1.AP_CONTROLLER_CODE.All
|
|
56
|
+
? null
|
|
57
|
+
: (authenticationProfile_ === null || authenticationProfile_ === void 0 ? void 0 : authenticationProfile_.apControllerCode) ||
|
|
58
|
+
null;
|
|
59
|
+
setAuthenticationProfile(authenticationProfile_);
|
|
60
|
+
})
|
|
61
|
+
.finally(function () {
|
|
62
|
+
setLoading(false);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
setLoading(false);
|
|
67
|
+
}
|
|
68
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
|
+
}, [id]);
|
|
70
|
+
var handleSubmit = function () {
|
|
71
|
+
return id
|
|
72
|
+
? service.authenticationProfilesPut(id, authenticationProfile)
|
|
73
|
+
: service.authenticationProfilesPost(authenticationProfile);
|
|
74
|
+
};
|
|
75
|
+
return ((0, jsx_runtime_1.jsx)(ClassicDrawer_1.default, { title: id ? t('Common.Edit') : t('Common.Create'), onSubmit: handleSubmit, confirmExit: confirmExit, childrenWrapperStyle: { padding: 0 }, disableButtonSubmit: !(formValid && confirmExit), children: loading ? ((0, jsx_runtime_1.jsx)(AWING_1.CircularProgress, {})) : ((0, jsx_runtime_1.jsx)(AWING_1.BasicDataForm, { fields: [
|
|
76
|
+
{
|
|
77
|
+
fieldName: 'authenticationMethodCode',
|
|
78
|
+
type: 'autocomplete',
|
|
79
|
+
label: 'Authentication Method code',
|
|
80
|
+
required: true,
|
|
81
|
+
defaultValue: Utils_1.AUTHENTICATION_METHOD_CODE.MethodByLocalAP,
|
|
82
|
+
options: Object.entries(Utils_1.AUTHENTICATION_METHOD_CODE).map(function (_a) {
|
|
83
|
+
var key = _a[0], value = _a[1];
|
|
84
|
+
return ({
|
|
85
|
+
value: value,
|
|
86
|
+
text: t(['AuthenticationProfile', key].join('.')),
|
|
87
|
+
});
|
|
88
|
+
}),
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
fieldName: 'apControllerCode',
|
|
92
|
+
type: 'autocomplete',
|
|
93
|
+
label: 'AP Controller Code',
|
|
94
|
+
required: true,
|
|
95
|
+
options: apControllers,
|
|
96
|
+
defaultValue: null,
|
|
97
|
+
checkValid: function (value) {
|
|
98
|
+
return value === null || value;
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
fieldName: 'name',
|
|
103
|
+
type: 'text',
|
|
104
|
+
label: t('Common.Name'),
|
|
105
|
+
required: true,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
fieldName: 'parameters',
|
|
109
|
+
type: 'text',
|
|
110
|
+
label: t('AuthenticationProfile.Params'),
|
|
111
|
+
required: true,
|
|
112
|
+
length: 500,
|
|
113
|
+
pattern: /.*/g,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
fieldName: 'description',
|
|
117
|
+
type: 'text-area',
|
|
118
|
+
label: t('Common.Description'),
|
|
119
|
+
length: 500,
|
|
120
|
+
},
|
|
121
|
+
], onUpdate: function (validState, valueForm) {
|
|
122
|
+
if (valueForm) {
|
|
123
|
+
setConfirmExit(true);
|
|
124
|
+
setFromValid(validState);
|
|
125
|
+
setAuthenticationProfile(valueForm);
|
|
126
|
+
}
|
|
127
|
+
}, oldValue: authenticationProfile })) }));
|
|
128
|
+
};
|
|
129
|
+
exports.default = CreateOrEdit;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var react_1 = require("react");
|
|
4
|
+
var Context_1 = require("./Context");
|
|
5
|
+
var useAuthenticationProfileProps = function () {
|
|
6
|
+
var authenticationProfileProps = (0, react_1.useContext)(Context_1.authenticationProfilePropsContext);
|
|
7
|
+
var props = (0, react_1.useMemo)(function () {
|
|
8
|
+
return authenticationProfileProps;
|
|
9
|
+
}, [authenticationProfileProps]);
|
|
10
|
+
return props;
|
|
11
|
+
};
|
|
12
|
+
exports.default = useAuthenticationProfileProps;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export interface Cancel {
|
|
2
|
+
message: string | undefined;
|
|
3
|
+
}
|
|
4
|
+
export interface CancelToken {
|
|
5
|
+
promise: Promise<Cancel>;
|
|
6
|
+
reason?: Cancel;
|
|
7
|
+
throwIfRequested(): void;
|
|
8
|
+
}
|
|
9
|
+
export interface AuthenticationProfileService {
|
|
10
|
+
/**
|
|
11
|
+
* API authenticationProfilesPaging: Lấy tất cả authenticationProfiles.
|
|
12
|
+
**/
|
|
13
|
+
authenticationProfilesPaging: (searchString: string | undefined, pageSize: number | undefined, pageIndex: number | undefined, cancelToken?: CancelToken) => Promise<PagedList_1OfAuthenticationProfile>;
|
|
14
|
+
/**
|
|
15
|
+
* API authenticationProfilesDelete: xóa authenticationProfile.
|
|
16
|
+
**/
|
|
17
|
+
authenticationProfilesDelete: (id: string, cancelToken?: CancelToken) => Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* API authenticationProfilesGet: chi tiết authenticationProfile.
|
|
20
|
+
**/
|
|
21
|
+
authenticationProfilesGet: (id: string, cancelToken?: CancelToken) => Promise<AuthenticationProfile>;
|
|
22
|
+
apsGetApControllers: (cancelToken?: CancelToken) => Promise<ApController[]>;
|
|
23
|
+
/**
|
|
24
|
+
* API authenticationProfilesPut: cập nhật authenticationProfile.
|
|
25
|
+
**/
|
|
26
|
+
authenticationProfilesPut: (id: string, body: AuthenticationProfile | undefined, cancelToken?: CancelToken) => Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* API authenticationProfilesPost: thêm mới authenticationProfile.
|
|
29
|
+
**/
|
|
30
|
+
authenticationProfilesPost: (body: AuthenticationProfile | undefined, cancelToken?: CancelToken) => Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
export interface ApController {
|
|
33
|
+
apControllerCode?: string | undefined;
|
|
34
|
+
name?: string | undefined;
|
|
35
|
+
clientAddress?: string | undefined;
|
|
36
|
+
apAddress?: string | undefined;
|
|
37
|
+
}
|
|
38
|
+
export interface AuthenticationProfileFeatureProps {
|
|
39
|
+
service: AuthenticationProfileService;
|
|
40
|
+
}
|
|
41
|
+
export interface Timestamp {
|
|
42
|
+
seconds?: string;
|
|
43
|
+
nanos?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface AuthenticationProfile {
|
|
46
|
+
authenticationProfileId?: string;
|
|
47
|
+
name?: string | undefined;
|
|
48
|
+
directoryId?: string;
|
|
49
|
+
directoryPath?: string | undefined;
|
|
50
|
+
authenticationMethodCode?: string | undefined;
|
|
51
|
+
apControllerCode?: string | undefined;
|
|
52
|
+
parameters?: string | undefined;
|
|
53
|
+
description?: string | undefined;
|
|
54
|
+
createdDate?: Timestamp;
|
|
55
|
+
}
|
|
56
|
+
export interface PagedList_1OfAuthenticationProfile {
|
|
57
|
+
items?: AuthenticationProfile[] | undefined;
|
|
58
|
+
pageCount?: number;
|
|
59
|
+
totalItemCount?: number;
|
|
60
|
+
pageNumber?: number;
|
|
61
|
+
pageSize?: number;
|
|
62
|
+
hasPreviousPage?: boolean;
|
|
63
|
+
hasNextPage?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export interface IAuthenticationProfile {
|
|
66
|
+
authenticationProfileId?: string;
|
|
67
|
+
name?: string | undefined;
|
|
68
|
+
directoryId?: string;
|
|
69
|
+
directoryPath?: string | undefined;
|
|
70
|
+
authenticationMethodCode?: string | undefined;
|
|
71
|
+
apControllerCode?: string | undefined;
|
|
72
|
+
parameters?: string | undefined;
|
|
73
|
+
description?: string | undefined;
|
|
74
|
+
createdDate?: Timestamp;
|
|
75
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const AUTHENTICATION_METHOD_CODE: {
|
|
2
|
+
MethodByLocalAP: string;
|
|
3
|
+
MethodByApi: string;
|
|
4
|
+
MethodByRadius: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const AP_CONTROLLER_CODE: {
|
|
7
|
+
/**
|
|
8
|
+
* All => là trường "Chọn tất cả" trong AP Controller Code
|
|
9
|
+
**/
|
|
10
|
+
All: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AP_CONTROLLER_CODE = exports.AUTHENTICATION_METHOD_CODE = void 0;
|
|
4
|
+
exports.AUTHENTICATION_METHOD_CODE = {
|
|
5
|
+
MethodByLocalAP: 'standard',
|
|
6
|
+
MethodByApi: 'api',
|
|
7
|
+
MethodByRadius: 'radius',
|
|
8
|
+
};
|
|
9
|
+
exports.AP_CONTROLLER_CODE = {
|
|
10
|
+
/**
|
|
11
|
+
* All => là trường "Chọn tất cả" trong AP Controller Code
|
|
12
|
+
**/
|
|
13
|
+
All: 'all',
|
|
14
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.AuthenticationProfileFeature = void 0;
|
|
18
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
var react_i18next_1 = require("react-i18next");
|
|
20
|
+
var i18n_1 = __importDefault(require("../../i18n"));
|
|
21
|
+
var Container_1 = __importDefault(require("./Container"));
|
|
22
|
+
var CreateOrEdit_1 = __importDefault(require("./CreateOrEdit"));
|
|
23
|
+
var Constant_1 = require("../Common/Constant");
|
|
24
|
+
var Router_1 = require("../../AWING/Router");
|
|
25
|
+
var Context_1 = require("./Context");
|
|
26
|
+
var AuthenticationProfile = function (props) {
|
|
27
|
+
var paths = [
|
|
28
|
+
{
|
|
29
|
+
path: Constant_1.Constants.CREATE_PATH,
|
|
30
|
+
element: (0, jsx_runtime_1.jsx)(CreateOrEdit_1.default, {}),
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
path: Constant_1.Constants.EDIT_PATH + '/:id',
|
|
34
|
+
element: (0, jsx_runtime_1.jsx)(CreateOrEdit_1.default, {}),
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Container_1.default, {}), (0, jsx_runtime_1.jsx)(Router_1.Routes, { children: paths.map(function (p) { return ((0, jsx_runtime_1.jsx)(Router_1.Route, { path: p.path, element: p.element }, p.path)); }) })] }));
|
|
38
|
+
};
|
|
39
|
+
var AuthenticationProfileFeature = function (props) { return ((0, jsx_runtime_1.jsx)(react_i18next_1.I18nextProvider, { i18n: i18n_1.default, children: (0, jsx_runtime_1.jsx)(Context_1.authenticationProfilePropsContext.Provider, { value: props, children: (0, jsx_runtime_1.jsx)(AuthenticationProfile, __assign({}, props)) }) })); };
|
|
40
|
+
exports.AuthenticationProfileFeature = AuthenticationProfileFeature;
|
|
@@ -24,7 +24,7 @@ var react_1 = require("react");
|
|
|
24
24
|
var material_1 = require("@mui/material");
|
|
25
25
|
var react_i18next_1 = require("react-i18next");
|
|
26
26
|
var Filter_1 = __importDefault(require("./Filter"));
|
|
27
|
-
var Constant_1 = require("
|
|
27
|
+
var Constant_1 = require("../Common/Constant");
|
|
28
28
|
var Hooks_1 = __importDefault(require("./Hooks"));
|
|
29
29
|
var Router_1 = require("../../AWING/Router");
|
|
30
30
|
var Utils_1 = require("./Utils");
|
|
@@ -19,8 +19,8 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
19
19
|
var react_i18next_1 = require("react-i18next");
|
|
20
20
|
var i18n_1 = __importDefault(require("../../i18n"));
|
|
21
21
|
var Container_1 = __importDefault(require("./Container"));
|
|
22
|
-
var Constant_1 = require("./Constant");
|
|
23
22
|
var Detail_1 = __importDefault(require("./Detail"));
|
|
23
|
+
var Constant_1 = require("../Common/Constant");
|
|
24
24
|
var Router_1 = require("../../AWING/Router");
|
|
25
25
|
var Context_1 = require("./Context");
|
|
26
26
|
var CampaignPlan = function (props) {
|
|
@@ -1,13 +1,3 @@
|
|
|
1
1
|
import { ViewModel } from './Types';
|
|
2
2
|
export declare const PAGE_LOGIN_DIRECTORY_SELECTED = "pageLoginDirectorySelected";
|
|
3
|
-
export declare const pageConstants: {
|
|
4
|
-
PAGE: string;
|
|
5
|
-
PAGE_LOGIN: string;
|
|
6
|
-
PAGE_WELCOME: string;
|
|
7
|
-
CREATE_PAGE: string;
|
|
8
|
-
IMPORT_PAGE: string;
|
|
9
|
-
EDIT_PAGE: string;
|
|
10
|
-
CLONE_PAGE: string;
|
|
11
|
-
PAGE_CREATE_DIRECTORY: string;
|
|
12
|
-
};
|
|
13
3
|
export declare const defaultView: ViewModel;
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultView = exports.
|
|
3
|
+
exports.defaultView = exports.PAGE_LOGIN_DIRECTORY_SELECTED = void 0;
|
|
4
4
|
var enums_1 = require("./enums");
|
|
5
5
|
exports.PAGE_LOGIN_DIRECTORY_SELECTED = 'pageLoginDirectorySelected';
|
|
6
|
-
exports.pageConstants = {
|
|
7
|
-
PAGE: 'Page',
|
|
8
|
-
PAGE_LOGIN: 'Page/Login',
|
|
9
|
-
PAGE_WELCOME: 'Page/Welcome',
|
|
10
|
-
CREATE_PAGE: 'Create',
|
|
11
|
-
IMPORT_PAGE: 'Import',
|
|
12
|
-
EDIT_PAGE: 'Edit',
|
|
13
|
-
CLONE_PAGE: 'Clone',
|
|
14
|
-
PAGE_CREATE_DIRECTORY: 'CreateDirectory',
|
|
15
|
-
};
|
|
16
6
|
exports.defaultView = {
|
|
17
7
|
templateId: '',
|
|
18
8
|
directoryId: '',
|
|
@@ -28,7 +28,7 @@ var AWING_1 = require("../../AWING");
|
|
|
28
28
|
var ClassicDrawer_1 = require("../../Commons/Components/ClassicDrawer");
|
|
29
29
|
var Context_1 = require("../../Context");
|
|
30
30
|
var Helpers_1 = require("../../Utils/Helpers");
|
|
31
|
-
var Constant_1 = require("
|
|
31
|
+
var Constant_1 = require("../Common/Constant");
|
|
32
32
|
var Context_2 = __importDefault(require("./Context"));
|
|
33
33
|
var enums_1 = require("./enums");
|
|
34
34
|
var PageContainer = function () {
|
|
@@ -135,10 +135,10 @@ var PageContainer = function () {
|
|
|
135
135
|
});
|
|
136
136
|
};
|
|
137
137
|
var handleRowClick = function (id) {
|
|
138
|
-
navigate([Constant_1.
|
|
138
|
+
navigate([Constant_1.Constants.EDIT_PATH, id].join('/'));
|
|
139
139
|
};
|
|
140
140
|
var handleClone = function (id) {
|
|
141
|
-
navigate([Constant_1.
|
|
141
|
+
navigate([Constant_1.Constants.CLONE_PATH, id].join('/'));
|
|
142
142
|
};
|
|
143
143
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
144
144
|
var handleFetchPaging = (0, react_1.useCallback)((0, lodash_1.debounce)(function (searchString, pageSize, pageIndex, directoryId) {
|
|
@@ -189,11 +189,11 @@ var PageContainer = function () {
|
|
|
189
189
|
options: directories.map(function (directory) { return (__assign(__assign({}, directory), { text: directory.name, value: directory.directoryId })); }),
|
|
190
190
|
},
|
|
191
191
|
], columns: columnDefinitions, rows: pageList.items, onChangeQueryInput: getPagePaging, getRowId: function (obj) { return obj.pageId; }, loading: loading, totalOfRows: pageList.totalItemCount, onCreateButtonClick: function () {
|
|
192
|
-
navigate(Constant_1.
|
|
192
|
+
navigate(Constant_1.Constants.CREATE_PATH);
|
|
193
193
|
}, onCreateFolderButtonClick: function () {
|
|
194
194
|
var _a;
|
|
195
195
|
navigate([
|
|
196
|
-
Constant_1.
|
|
196
|
+
Constant_1.Constants.PAGE_CREATE_DIRECTORY,
|
|
197
197
|
(_a = (0, lodash_1.minBy)(directories, 'level')) === null || _a === void 0 ? void 0 : _a.directoryId,
|
|
198
198
|
].join('/'));
|
|
199
199
|
}, rowActions: [
|
|
@@ -220,10 +220,9 @@ var PageContainer = function () {
|
|
|
220
220
|
], onRowClick: handleRowClick, onDelete: service.pagesDelete, showNotificationSuccess: function () { return snackbar('success'); }, confirmDelete: confirm, customActions: (0, jsx_runtime_1.jsx)(material_1.Button, { sx: {
|
|
221
221
|
marginLeft: function (theme) { return theme.spacing(1); },
|
|
222
222
|
}, color: "inherit", variant: "outlined", onClick: function () {
|
|
223
|
-
navigate(Constant_1.
|
|
224
|
-
}, children: t('Common.Import') }) })), open &&
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}, service: service })] }));
|
|
223
|
+
navigate(Constant_1.Constants.IMPORT_PATH);
|
|
224
|
+
}, children: t('Common.Import') }) })), open && ((0, jsx_runtime_1.jsx)(PreviewButton_1.default, { anchorEl: anchorEl, open: open, domainIds: [], handlePreviewClose: handlePreviewClose, handlePreviewDomain: function (event, domainId) {
|
|
225
|
+
handlePreview(previewId, domainId);
|
|
226
|
+
}, service: service }))] }));
|
|
228
227
|
};
|
|
229
228
|
exports.default = PageContainer;
|
|
@@ -36,7 +36,7 @@ var react_i18next_1 = require("react-i18next");
|
|
|
36
36
|
var react_router_dom_1 = require("react-router-dom");
|
|
37
37
|
var recoil_1 = require("recoil");
|
|
38
38
|
var Recoil_2 = require("../Recoil");
|
|
39
|
-
var Constant_1 = require("../../../
|
|
39
|
+
var Constant_1 = require("../../../Common/Constant");
|
|
40
40
|
var Context_1 = __importDefault(require("../../../../ACM-AXN/Page/Context"));
|
|
41
41
|
var useListPageView = function () {
|
|
42
42
|
var _a;
|
|
@@ -47,7 +47,7 @@ var useListPageView = function () {
|
|
|
47
47
|
var _b = (0, Context_1.default)(), configs = _b.configs, service = _b.service, pageCode = _b.pageCode;
|
|
48
48
|
var pageId = (0, recoil_1.useRecoilValue)((0, Recoil_1.pageState)('page')).page.pageId;
|
|
49
49
|
var rootDirectory = (0, recoil_1.useRecoilValue)(Recoil_1.pageRootDeirectory);
|
|
50
|
-
var isCreate = !Boolean((_a = params['*']) === null || _a === void 0 ? void 0 : _a.includes(Constant_1.
|
|
50
|
+
var isCreate = !Boolean((_a = params['*']) === null || _a === void 0 ? void 0 : _a.includes(Constant_1.Constants.EDIT_PATH));
|
|
51
51
|
react_1.default.useEffect(function () {
|
|
52
52
|
setDrawerState(AWING_1.DrawerStateEnum[!Object.values(formValid).includes(false) ? 'VALID' : 'INVALID']);
|
|
53
53
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -23,7 +23,7 @@ var react_router_dom_1 = require("react-router-dom");
|
|
|
23
23
|
var recoil_1 = require("recoil");
|
|
24
24
|
var CreateDirectory_1 = __importDefault(require("../../AWING/Directory/CreateDirectory"));
|
|
25
25
|
var i18n_1 = __importDefault(require("../../i18n"));
|
|
26
|
-
var Constant_1 = require("
|
|
26
|
+
var Constant_1 = require("../Common/Constant");
|
|
27
27
|
var Container_1 = __importDefault(require("./Container"));
|
|
28
28
|
var Context_1 = require("./Context");
|
|
29
29
|
var enums_1 = require("./enums");
|
|
@@ -32,22 +32,24 @@ var index_1 = __importDefault(require("./Import/index"));
|
|
|
32
32
|
var Enum_1 = require("../../ACM-AXN/Campaign/Enum");
|
|
33
33
|
var Page = function (props) {
|
|
34
34
|
var paths = [
|
|
35
|
-
{ path: Constant_1.
|
|
35
|
+
{ path: Constant_1.Constants.IMPORT_PATH, element: (0, jsx_runtime_1.jsx)(index_1.default, {}) },
|
|
36
36
|
{
|
|
37
|
-
path: Constant_1.
|
|
37
|
+
path: Constant_1.Constants.CREATE_PATH,
|
|
38
38
|
element: (0, jsx_runtime_1.jsx)(CreateOrEdit_1.default, { type: enums_1.PathType.CREATE }),
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
|
-
path: Constant_1.
|
|
41
|
+
path: Constant_1.Constants.EDIT_PATH + '/:pageId',
|
|
42
42
|
element: (0, jsx_runtime_1.jsx)(CreateOrEdit_1.default, { type: enums_1.PathType.EDIT }),
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
|
-
path: Constant_1.
|
|
45
|
+
path: Constant_1.Constants.CLONE_PATH + '/:pageId',
|
|
46
46
|
element: (0, jsx_runtime_1.jsx)(CreateOrEdit_1.default, { type: enums_1.PathType.CLONE }),
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
|
-
path: Constant_1.
|
|
50
|
-
element: ((0, jsx_runtime_1.jsx)(CreateDirectory_1.default, __assign({ directoryRoot: Enum_1.DirectoryRoot[props.pageCode === enums_1.PageCode.Lgn
|
|
49
|
+
path: Constant_1.Constants.PAGE_CREATE_DIRECTORY + '/:directoryId',
|
|
50
|
+
element: ((0, jsx_runtime_1.jsx)(CreateDirectory_1.default, __assign({ directoryRoot: Enum_1.DirectoryRoot[props.pageCode === enums_1.PageCode.Lgn
|
|
51
|
+
? 'PageLogin'
|
|
52
|
+
: 'PageWelcome'], parentDirectory: props.pageCode === enums_1.PageCode.Lgn
|
|
51
53
|
? 'pageLogin'
|
|
52
54
|
: 'pageWelcome' }, props))),
|
|
53
55
|
},
|
|
@@ -7,7 +7,7 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
var react_1 = require("react");
|
|
8
8
|
var react_i18next_1 = require("react-i18next");
|
|
9
9
|
var Hooks_1 = __importDefault(require("./Hooks"));
|
|
10
|
-
var Constant_1 = require("
|
|
10
|
+
var Constant_1 = require("../Common/Constant");
|
|
11
11
|
var Context_1 = require("../../Context");
|
|
12
12
|
var Router_1 = require("../../AWING/Router");
|
|
13
13
|
var AWING_1 = require("../../AWING");
|
|
@@ -54,7 +54,7 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
54
54
|
var react_1 = require("@testing-library/react");
|
|
55
55
|
var Router_1 = require("../../AWING/Router");
|
|
56
56
|
var Container_1 = __importDefault(require("./Container"));
|
|
57
|
-
var Constant_1 = require("
|
|
57
|
+
var Constant_1 = require("../Common/Constant");
|
|
58
58
|
var items = [
|
|
59
59
|
{
|
|
60
60
|
campaignPriority: 0,
|
|
@@ -19,8 +19,8 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
19
19
|
var react_i18next_1 = require("react-i18next");
|
|
20
20
|
var i18n_1 = __importDefault(require("../../i18n"));
|
|
21
21
|
var Container_1 = __importDefault(require("./Container"));
|
|
22
|
-
var Constant_1 = require("./Constant");
|
|
23
22
|
var CreateOrEdit_1 = __importDefault(require("./CreateOrEdit"));
|
|
23
|
+
var Constant_1 = require("../Common/Constant");
|
|
24
24
|
var Router_1 = require("../../AWING/Router");
|
|
25
25
|
var Context_1 = require("./Context");
|
|
26
26
|
var Wizard = function (props) {
|
|
@@ -785,5 +785,16 @@
|
|
|
785
785
|
"Directory": "Directory",
|
|
786
786
|
"SelectTemplate": "Select template",
|
|
787
787
|
"FieldNames": "Field Names"
|
|
788
|
+
},
|
|
789
|
+
"AuthenticationProfile": {
|
|
790
|
+
"Title": "Authentication Profile Management",
|
|
791
|
+
"SearchPlaceholder": "Search By Name",
|
|
792
|
+
"Params": "Params",
|
|
793
|
+
"TitleDialog": "Warning",
|
|
794
|
+
"ContentDialog": "Your changes have not been saved. Do you want to continue?",
|
|
795
|
+
"MethodByLocalAP": "Verify local in AP - Controller",
|
|
796
|
+
"MethodByApi": "Verify by Api",
|
|
797
|
+
"MethodByRadius": "Verify by Radius",
|
|
798
|
+
"All": "All"
|
|
788
799
|
}
|
|
789
800
|
}
|
|
@@ -787,5 +787,16 @@
|
|
|
787
787
|
"Directory": "Tên thư mục",
|
|
788
788
|
"SelectTemplate": "Chọn template",
|
|
789
789
|
"FieldNames": "Các trường dữ liệu"
|
|
790
|
+
},
|
|
791
|
+
"AuthenticationProfile": {
|
|
792
|
+
"Title": "Quản trị thông tin xác thực",
|
|
793
|
+
"SearchPlaceholder": "Tìm kiếm theo tên",
|
|
794
|
+
"Params": "Thông số",
|
|
795
|
+
"TitleDialog": "Cảnh báo",
|
|
796
|
+
"ContentDialog": "Các thay đổi vẫn chưa được lưu. Bạn có muốn tiếp tục?",
|
|
797
|
+
"MethodByLocalAP": "Xác thực tại AP - Controller",
|
|
798
|
+
"MethodByApi": "Xác thực qua Api",
|
|
799
|
+
"MethodByRadius": "Xác thực qua Radius",
|
|
800
|
+
"All": "Tất cả"
|
|
790
801
|
}
|
|
791
802
|
}
|
package/package.json
CHANGED