dbmsv2_init...1

This commit is contained in:
choi.jh 2025-09-04 18:32:01 +09:00
parent 730e90a2aa
commit 5eed7114a9
16 changed files with 336 additions and 300 deletions

View File

@ -60,6 +60,24 @@ class ServerController extends EquipmentController
}
return $result;
}
protected function getFormData(string $field, array $requestDatas, array $formDatas): array
{
switch ($field) {
case 'CPU':
case 'RAM':
$formDatas[$field] = $requestDatas[$field] ?? null;
$formDatas["{$field}_cnt"] = $requestDatas["{$field}_cnt"] ?? null;
break;
case 'DISK':
$formDatas[$field] = $requestDatas[$field] ?? null;
$formDatas["{$field}_cnt"] = $requestDatas["{$field}_cnt"] ?? null;
$formDatas["{$field}_extra"] = $requestDatas["{$field}_extra"] ?? null;
break;
default:
$formDatas = parent::getFormData($field, $requestDatas, $formDatas);
}
return $formDatas;
}
//생성
protected function create_form_process(): void
{
@ -74,8 +92,6 @@ class ServerController extends EquipmentController
(int)env("Server.Default.code", 0)
)
]);
//서버파트연결용
$this->serverPartHelper = new ServerPartHelper();
parent::create_form_process();
}
//생성
@ -92,15 +108,8 @@ class ServerController extends EquipmentController
$this->getService()->codeCheck($formDatas);
return parent::modify_process($entity, $formDatas);
}
protected function view_process(mixed $entity): mixed
{
//서버파트연결용
$this->serverPartHelper = new ServerPartHelper();
return parent::view_process($entity);
}
protected function index_process(array $entities = []): array
{
//서버파트연결용
$this->serverPartHelper = new ServerPartHelper();
return parent::index_process($entities);
}

View File

@ -2,7 +2,6 @@
namespace App\Controllers\Admin\Equipment;
use App\Entities\Equipment\ServerPartEntity;
use App\Helpers\Equipment\ServerPartHelper;
use App\Services\Equipment\ServerPartService;

View File

@ -4,7 +4,6 @@ namespace App\Controllers;
use App\Controllers\BaseController;
use App\Entities\FormOptionEntity;
use App\Libraries\LogCollector;
use App\Services\MyLogService;
use CodeIgniter\HTTP\DownloadResponse;

View File

@ -4,9 +4,9 @@
"settings": {
"width": 3000,
"height": 3000,
"scrollTop": -1805.1278,
"scrollLeft": -1141.7503,
"zoomLevel": 1,
"scrollTop": -1503.4046,
"scrollLeft": -1269.8532,
"zoomLevel": 0.73,
"show": 511,
"database": 4,
"databaseName": "",
@ -112,15 +112,15 @@
"w_EuwbTwtLEPAgYjS1aYq"
],
"ui": {
"x": 1598.9121,
"y": 219.9426,
"x": 1423.9121,
"y": 72.4426,
"zIndex": 2,
"widthName": 60,
"widthComment": 62,
"color": ""
},
"meta": {
"updateAt": 1756951973898,
"updateAt": 1756961389352,
"createAt": 1745819764136
}
},
@ -174,15 +174,15 @@
"JEk5AASiK6MpT9QBRWjMX"
],
"ui": {
"x": 689.465,
"y": 922.0675,
"x": 864.465,
"y": 1069.5675,
"zIndex": 2,
"widthName": 60,
"widthComment": 60,
"color": ""
},
"meta": {
"updateAt": 1756951977870,
"updateAt": 1756961419032,
"createAt": 1745819764137
}
},
@ -318,15 +318,15 @@
"aY2pn1J3VHF_qV5XFM_zf"
],
"ui": {
"x": 1216.2756,
"y": 1620.1057,
"x": 948.7756,
"y": 2042.6057,
"zIndex": 2,
"widthName": 60,
"widthComment": 60,
"color": ""
},
"meta": {
"updateAt": 1756951983406,
"updateAt": 1756961447384,
"createAt": 1745819764137
}
},
@ -367,15 +367,15 @@
"xvHi50lODgZs-Ke-lH95g"
],
"ui": {
"x": 889.129,
"y": 2138.0891,
"x": 111.629,
"y": 2093.0891,
"zIndex": 2,
"widthName": 60,
"widthComment": 60,
"color": ""
},
"meta": {
"updateAt": 1756951951547,
"updateAt": 1756961442460,
"createAt": 1745819764138
}
},
@ -420,15 +420,15 @@
"ZgRRNC6OFpn87uomKBHbH"
],
"ui": {
"x": 55.2992,
"y": 1309.3218,
"x": 65.2992,
"y": 1149.3218,
"zIndex": 2,
"widthName": 60,
"widthComment": 60,
"color": ""
},
"meta": {
"updateAt": 1756951933749,
"updateAt": 1756961428954,
"createAt": 1745819764138
}
},
@ -486,15 +486,15 @@
"CX9ODlVw-gFnxgfMJ1JyV"
],
"ui": {
"x": 201.8242,
"y": 1753.7017,
"x": 84.3242,
"y": 1608.7017,
"zIndex": 2,
"widthName": 60,
"widthComment": 60,
"color": ""
},
"meta": {
"updateAt": 1756951935884,
"updateAt": 1756961435521,
"createAt": 1745819764138
}
},
@ -730,15 +730,15 @@
"2fzVlWt1Skh-391N_z9Ci"
],
"ui": {
"x": 1530.1399,
"y": 808.6469,
"x": 2012.6399,
"y": 1161.1469,
"zIndex": 2395,
"widthName": 60,
"widthComment": 62,
"color": ""
},
"meta": {
"updateAt": 1756951967284,
"updateAt": 1756961453341,
"createAt": 1748485662214
}
},
@ -779,15 +779,15 @@
"qOLH2re1rmaG-63c08R8x"
],
"ui": {
"x": 2465.5679,
"y": 1164.3837,
"x": 1433.0679,
"y": 494.3837,
"zIndex": 2509,
"widthName": 60,
"widthComment": 62,
"color": ""
},
"meta": {
"updateAt": 1756952096387,
"updateAt": 1756961382553,
"createAt": 1750898626895
}
},
@ -834,15 +834,15 @@
"S-_BBM4Qv5LCTvGVKmQQw"
],
"ui": {
"x": 2218.7142,
"y": 1669.2031,
"x": 1953.7142,
"y": 1801.7031,
"zIndex": 4045,
"widthName": 60,
"widthComment": 201,
"color": ""
},
"meta": {
"updateAt": 1756952094110,
"updateAt": 1756961412059,
"createAt": 1755244574868
}
},
@ -855,6 +855,7 @@
"l2g7xess8DY86_ZOm7Ca1",
"IbWdZlEEF70bGqUDkU5ub",
"eu4eV0U7BRaP7Zk-oyBhV",
"cHqRVW_Ce77LXwoPpG3OP",
"mYEan5gjLS5bBthtFCc6w",
"tmSvn-3Kqlf7oUbiedFDh",
"SioEINPlR0iyL87vqa4N-",
@ -872,6 +873,7 @@
"IbWdZlEEF70bGqUDkU5ub",
"eu4eV0U7BRaP7Zk-oyBhV",
"czO0QNJkidvlfvj3hL6xs",
"cHqRVW_Ce77LXwoPpG3OP",
"mYEan5gjLS5bBthtFCc6w",
"tmSvn-3Kqlf7oUbiedFDh",
"SioEINPlR0iyL87vqa4N-",
@ -884,15 +886,15 @@
"IMTeN4-Evbpr5MMraE__C"
],
"ui": {
"x": 1790.8624,
"y": 2142.2793,
"x": 2243.3624,
"y": 2299.7793,
"zIndex": 4514,
"widthName": 76,
"widthComment": 74,
"color": ""
},
"meta": {
"updateAt": 1756953821847,
"updateAt": 1756961728419,
"createAt": 1755476453282
}
},
@ -8277,6 +8279,26 @@
"updateAt": 1756778069722,
"createAt": 1756778058760
}
},
"cHqRVW_Ce77LXwoPpG3OP": {
"id": "cHqRVW_Ce77LXwoPpG3OP",
"tableId": "8GYAVBvZGaMFeq3QuXk_B",
"name": "type",
"comment": "구분",
"dataType": "VARCHAR(20)",
"default": "",
"options": 8,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 75,
"widthDefault": 60
},
"meta": {
"updateAt": 1756961786936,
"createAt": 1756961726238
}
}
},
"relationshipEntities": {
@ -8290,8 +8312,8 @@
"columnIds": [
"7B0zaLoZnOoMNW8OHZlrQ"
],
"x": 306.7992,
"y": 1605.3218,
"x": 316.7992,
"y": 1445.3218,
"direction": 8
},
"end": {
@ -8299,8 +8321,8 @@
"columnIds": [
"f7_MGvRjkwL1xkCWrAgDR"
],
"x": 467.8242,
"y": 1753.7017,
"x": 350.3242,
"y": 1608.7017,
"direction": 4
},
"meta": {
@ -8318,17 +8340,17 @@
"columnIds": [
"mfHtgzc_Aeocr6xkgwYWh"
],
"x": 1851.4121,
"y": 515.9426,
"direction": 8
"x": 1928.9121,
"y": 319.1092666666667,
"direction": 2
},
"end": {
"tableId": "B8haiEbPc1lRBWTv1g25G",
"columnIds": [
"Vf3bNvvEPfu1zCs4rcHTU"
],
"x": 1856.6399,
"y": 808.6469,
"x": 2121.473233333333,
"y": 1161.1469,
"direction": 4
},
"meta": {
@ -8346,8 +8368,8 @@
"columnIds": [
"mfHtgzc_Aeocr6xkgwYWh"
],
"x": 2103.9121,
"y": 441.94259999999997,
"x": 1928.9121,
"y": 220.44260000000003,
"direction": 2
},
"end": {
@ -8356,7 +8378,7 @@
"s1Az-lXWK0NlVQqFEEK8o"
],
"x": 2338.5336,
"y": 587.9663333333334,
"y": 618.633,
"direction": 1
},
"meta": {
@ -8374,8 +8396,8 @@
"columnIds": [
"mfHtgzc_Aeocr6xkgwYWh"
],
"x": 2103.9121,
"y": 293.94259999999997,
"x": 1928.9121,
"y": 121.77593333333334,
"direction": 2
},
"end": {
@ -8402,17 +8424,17 @@
"columnIds": [
"mfHtgzc_Aeocr6xkgwYWh"
],
"x": 1598.9121,
"y": 478.94259999999997,
"direction": 1
"x": 1676.4121,
"y": 368.44259999999997,
"direction": 8
},
"end": {
"tableId": "6ajvOCaGuXU9pzV0Y9jEi",
"columnIds": [
"hrPg0uHAdEjamOj--BVzO"
],
"x": 1133.6316666666667,
"y": 922.0675,
"x": 1330.8400000000001,
"y": 1069.5675,
"direction": 4
},
"meta": {
@ -8430,8 +8452,8 @@
"columnIds": [
"mfHtgzc_Aeocr6xkgwYWh"
],
"x": 1598.9121,
"y": 256.94259999999997,
"x": 1423.9121,
"y": 121.77593333333334,
"direction": 1
},
"end": {
@ -8458,8 +8480,8 @@
"columnIds": [
"mfHtgzc_Aeocr6xkgwYWh"
],
"x": 1598.9121,
"y": 330.94259999999997,
"x": 1423.9121,
"y": 220.44260000000003,
"direction": 1
},
"end": {
@ -8486,8 +8508,8 @@
"columnIds": [
"mfHtgzc_Aeocr6xkgwYWh"
],
"x": 1598.9121,
"y": 404.94259999999997,
"x": 1423.9121,
"y": 319.1092666666667,
"direction": 1
},
"end": {
@ -8514,8 +8536,8 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 689.465,
"y": 1142.0675,
"x": 864.465,
"y": 1142.9008333333334,
"direction": 1
},
"end": {
@ -8542,8 +8564,8 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 955.9649999999999,
"y": 922.0675,
"x": 1064.3400000000001,
"y": 1069.5675,
"direction": 4
},
"end": {
@ -8570,8 +8592,8 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 778.2983333333333,
"y": 922.0675,
"x": 931.09,
"y": 1069.5675,
"direction": 4
},
"end": {
@ -8598,8 +8620,8 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 1222.4650000000001,
"y": 977.0675,
"x": 1397.4650000000001,
"y": 1142.9008333333334,
"direction": 2
},
"end": {
@ -8608,7 +8630,7 @@
"8mPFhDdUY8QLPvc8rNw1B"
],
"x": 2338.5336,
"y": 833.2996666666667,
"y": 802.633,
"direction": 1
},
"meta": {
@ -8626,8 +8648,8 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 1222.4650000000001,
"y": 1087.0675,
"x": 1397.4650000000001,
"y": 1289.5675,
"direction": 2
},
"end": {
@ -8635,8 +8657,8 @@
"columnIds": [
"N-2m8O_JzS6-sDEcL5zTv"
],
"x": 1530.1399,
"y": 918.6469,
"x": 2012.6399,
"y": 1234.4802333333334,
"direction": 1
},
"meta": {
@ -8654,18 +8676,18 @@
"columnIds": [
"nNWsAWbHfKWqx8EwxvuM1"
],
"x": 2183.1399,
"y": 881.9802333333332,
"direction": 2
"x": 2556.806566666666,
"y": 1161.1469,
"direction": 4
},
"end": {
"tableId": "QCNA57Pi6A9dJDgybxS5v",
"columnIds": [
"vxhl-9RMNJ8zU9oqzEWo8"
],
"x": 2338.5336,
"y": 710.633,
"direction": 1
"x": 2649.0336,
"y": 894.633,
"direction": 8
},
"meta": {
"updateAt": 1755653412891,
@ -8682,18 +8704,18 @@
"columnIds": [
"RITMHZcQAJ7KvtxkTtMv-"
],
"x": 1740.2756,
"y": 1718.1057,
"direction": 2
"x": 1341.7756,
"y": 2042.6057,
"direction": 4
},
"end": {
"tableId": "IsMoJXzvtuoOFFt93qS0w",
"columnIds": [
"wi1XbZM3emknh42sOMkYq"
],
"x": 2465.5679,
"y": 1391.050366666667,
"direction": 1
"x": 1691.5679,
"y": 766.3837,
"direction": 8
},
"meta": {
"updateAt": 1755653724845,
@ -8710,8 +8732,8 @@
"columnIds": [
"RITMHZcQAJ7KvtxkTtMv-"
],
"x": 1740.2756,
"y": 1914.1057,
"x": 1472.7756,
"y": 2238.6057,
"direction": 2
},
"end": {
@ -8719,8 +8741,8 @@
"columnIds": [
"GtBqjKsmtYWvsd0fckBc0"
],
"x": 2218.7142,
"y": 1963.2031,
"x": 1953.7142,
"y": 2095.7030999999997,
"direction": 1
},
"meta": {
@ -8738,18 +8760,18 @@
"columnIds": [
"nNWsAWbHfKWqx8EwxvuM1"
],
"x": 1693.3899,
"y": 1248.6469,
"direction": 8
"x": 2012.6399,
"y": 1527.813566666667,
"direction": 1
},
"end": {
"tableId": "B4qGh3KZsXHQ3_4EOgwJZ",
"columnIds": [
"4iRyOhmW3b7kbiZT8lQyY"
],
"x": 1478.2756,
"y": 1620.1057,
"direction": 4
"x": 1472.7756,
"y": 2107.9390333333336,
"direction": 2
},
"meta": {
"updateAt": 1755653818593,
@ -8766,8 +8788,8 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 1133.6316666666667,
"y": 1362.0675,
"x": 1130.9650000000001,
"y": 1509.5675,
"direction": 8
},
"end": {
@ -8775,9 +8797,9 @@
"columnIds": [
"JRdeV7n53lb1iSmmYnhHX"
],
"x": 1216.2756,
"y": 1718.1057,
"direction": 1
"x": 1079.7756,
"y": 2042.6057,
"direction": 4
},
"meta": {
"updateAt": 1755653851900,
@ -8794,17 +8816,17 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 778.2983333333333,
"y": 1362.0675,
"direction": 8
"x": 864.465,
"y": 1289.5675,
"direction": 1
},
"end": {
"tableId": "ZLEpY5EjuZV21718zf-Y1",
"columnIds": [
"60w6M5QqxGAvJa3EEMDbR"
],
"x": 733.8242,
"y": 1891.7017,
"x": 616.3242,
"y": 1654.7017,
"direction": 2
},
"meta": {
@ -8822,8 +8844,8 @@
"columnIds": [
"RITMHZcQAJ7KvtxkTtMv-"
],
"x": 1216.2756,
"y": 1914.1057,
"x": 948.7756,
"y": 2238.6057,
"direction": 1
},
"end": {
@ -8831,8 +8853,8 @@
"columnIds": [
"QznZ6PY_T3OGj3YD4GdOX"
],
"x": 733.8242,
"y": 2075.7017,
"x": 616.3242,
"y": 1930.7017,
"direction": 2
},
"meta": {
@ -8850,17 +8872,17 @@
"columnIds": [
"RITMHZcQAJ7KvtxkTtMv-"
],
"x": 1478.2756,
"y": 2012.1057,
"direction": 8
"x": 1472.7756,
"y": 2369.2723666666666,
"direction": 2
},
"end": {
"tableId": "8GYAVBvZGaMFeq3QuXk_B",
"columnIds": [
"IbWdZlEEF70bGqUDkU5ub"
],
"x": 1790.8624,
"y": 2290.2793,
"x": 2243.3624,
"y": 2459.7793,
"direction": 1
},
"meta": {
@ -8878,8 +8900,8 @@
"columnIds": [
"nNWsAWbHfKWqx8EwxvuM1"
],
"x": 1530.1399,
"y": 1138.6469,
"x": 2012.6399,
"y": 1381.1469000000002,
"direction": 1
},
"end": {
@ -8887,8 +8909,8 @@
"columnIds": [
"sJfMcwfDgXnsZ89DVVDA2"
],
"x": 733.8242,
"y": 1799.7017,
"x": 616.3242,
"y": 1838.7017,
"direction": 2
},
"meta": {
@ -8906,18 +8928,18 @@
"columnIds": [
"nNWsAWbHfKWqx8EwxvuM1"
],
"x": 2183.1399,
"y": 1028.6469,
"direction": 2
"x": 2339.1398999999997,
"y": 1161.1469,
"direction": 4
},
"end": {
"tableId": "IsMoJXzvtuoOFFt93qS0w",
"columnIds": [
"E30sHnqJytLlBmfL7ueOG"
],
"x": 2465.5679,
"y": 1209.7170333333336,
"direction": 1
"x": 1950.0679,
"y": 630.3837,
"direction": 2
},
"meta": {
"updateAt": 1755664567491,
@ -8934,17 +8956,17 @@
"columnIds": [
"nNWsAWbHfKWqx8EwxvuM1"
],
"x": 2183.1399,
"y": 1175.3135666666667,
"direction": 2
"x": 2175.8899,
"y": 1601.1469,
"direction": 8
},
"end": {
"tableId": "SEgsi7mbM-56Rsx5-qj8K",
"columnIds": [
"7Tqt0jVOln16nire8AE2K"
],
"x": 2487.7142,
"y": 1669.2031,
"x": 2222.7142,
"y": 1801.7031,
"direction": 4
},
"meta": {
@ -8962,8 +8984,8 @@
"columnIds": [
"nNWsAWbHfKWqx8EwxvuM1"
],
"x": 2019.8899,
"y": 1248.6469,
"x": 2502.3899,
"y": 1601.1469,
"direction": 8
},
"end": {
@ -8971,8 +8993,8 @@
"columnIds": [
"eu4eV0U7BRaP7Zk-oyBhV"
],
"x": 2087.8624,
"y": 2142.2793,
"x": 2540.3624,
"y": 2299.7793,
"direction": 4
},
"meta": {
@ -8990,17 +9012,17 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 1222.4650000000001,
"y": 1197.0675,
"direction": 2
"x": 1197.5900000000001,
"y": 1069.5675,
"direction": 4
},
"end": {
"tableId": "IsMoJXzvtuoOFFt93qS0w",
"columnIds": [
"9FYinSR3C6jDrEsRsCMpl"
],
"x": 2465.5679,
"y": 1300.3837000000003,
"x": 1433.0679,
"y": 630.3837,
"direction": 1
},
"meta": {
@ -9018,8 +9040,8 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 1222.4650000000001,
"y": 1307.0675,
"x": 1397.4650000000001,
"y": 1436.2341666666669,
"direction": 2
},
"end": {
@ -9027,8 +9049,8 @@
"columnIds": [
"q_IaRBb367b9mgGozh6jB"
],
"x": 2218.7142,
"y": 1767.2031,
"x": 1953.7142,
"y": 1899.7031,
"direction": 1
},
"meta": {
@ -9046,17 +9068,17 @@
"columnIds": [
"V6BuLrtFrGgCWaHSUkSLb"
],
"x": 955.9649999999999,
"y": 1362.0675,
"direction": 8
"x": 864.465,
"y": 1436.2341666666669,
"direction": 1
},
"end": {
"tableId": "ZLEpY5EjuZV21718zf-Y1",
"columnIds": [
"4sj8hIYAiLSSF89eeNXdQ"
],
"x": 733.8242,
"y": 1983.7017,
"x": 616.3242,
"y": 1746.7017,
"direction": 2
},
"meta": {

File diff suppressed because one or more lines are too long

View File

@ -10,11 +10,11 @@ class ServerPartEntity extends EquipmentEntity
const TITLE = ServerPartModel::TITLE;
const DEFAULT_STATUS = null;
public function setPartEntity(PartEntity $entity): void
public function setPartEntity(mixed $entity): void
{
$this->attributes['partEntity'] = $entity;
}
public function getPartEntity(): PartEntity|null
public function getPartEntity(): mixed
{
return $this->attributes['partEntity'] ?? null;
}

View File

@ -394,7 +394,6 @@ class CommonHelper
{
switch ($action) {
case 'create':
// echo current_url() . '/' . $action . '?' . $viewDatas['uri']->getQuery();
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
$action = form_label(
$label ? $label : '입력',

View File

@ -6,10 +6,16 @@ use App\Models\Equipment\ServerModel;
class ServerHelper extends EquipmentHelper
{
private ?ServerPartHelper $_serverPartHelper = null;
public function __construct()
{
parent::__construct();
$this->setTitleField(field: ServerModel::TITLE);
$this->_serverPartHelper = new ServerPartHelper();
}
private function getServerPartHelper(): ServerPartHelper
{
return $this->_serverPartHelper;
}
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
@ -18,38 +24,20 @@ class ServerHelper extends EquipmentHelper
// $extras['readonly'] = in_array($viewDatas['control']['action'], ['modify_form']) ? ' readonly' : '';
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
break;
case 'switchinfo_uid':
if (array_key_exists('entity', $viewDatas)) {
$value = $viewDatas['entity']->getSwitchEntity() !== null ? $viewDatas['entity']->getSwitchEntity()->getPK() : $value;
}
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
break;
case 'ipinfo_uid':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = "";
if (array_key_exists('entity', $viewDatas)) {
foreach ($viewDatas['entity']->getIPEntities() as $ipEntity) {
$form .= "<div>" . $this->form_dropdown_custom($field, $ipEntity->getPK(), $viewDatas, $extras) . "</div>";
}
}
$form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
break;
case 'csinfo_uid':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = "";
if (array_key_exists('entity', $viewDatas)) {
foreach ($viewDatas['entity']->getCSEntities() as $csEntity) {
$form .= "<div>" . $this->form_dropdown_custom($field, $csEntity->getPK(), $viewDatas, $extras) . "</div>";
}
}
$form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
break;
case 'manufactur_at':
case 'format_at':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender';
$form = form_input($field, $value ?? "", $extras);
break;
case 'CPU':
case 'CPU_cnt':
case 'RAM':
case 'RAM_cnt':
case 'DISK':
case 'DISK_cnt':
case 'DISK_extra':
$form = $this->getServerPartHelper()->getFieldForm($field, $value, $viewDatas, $extras);
break;
default:
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
break;

View File

@ -2,6 +2,7 @@
namespace App\Helpers\Equipment;
use App\Entities\FormOptionEntity;
use App\Models\Equipment\ServerPartModel;
class ServerPartHelper extends EquipmentHelper
@ -30,44 +31,54 @@ class ServerPartHelper extends EquipmentHelper
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
switch ($field) {
case 'CPU':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'CPU');
break;
case 'CPU_cnt':
$form = form_dropdown($field, SERVERPART['CNT_RANGE'], $value, $extras) . "";
break;
case 'RAM':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'RAM',);
break;
case 'RAM_cnt':
$form = form_dropdown($field, SERVERPART['CNT_RANGE'], $value, $extras) . "";
break;
case 'DISK':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'DISK');
break;
case 'DISK_cnt':
$form = form_dropdown($field, SERVERPART['CNT_RANGE'], $value, $extras) . "";
break;
case 'DISK_extra':
case 'SWITCH':
if (array_key_exists('entity', $viewDatas)) {
$value = $viewDatas['entity']->getSwitchEntity() !== null ? $viewDatas['entity']->getSwitchEntity()->getPK() : $value;
}
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
break;
case 'OS':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'OS');
case 'IP':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = "";
if (array_key_exists('entity', $viewDatas)) {
foreach ($viewDatas['entity']->getIPEntities() as $ipEntity) {
$form .= "<div>" . $this->form_dropdown_custom($field, $ipEntity->getPK(), $viewDatas, $extras) . "</div>";
}
}
$form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
break;
case 'OS_cnt':
$form = form_dropdown($field, SERVERPART['CNT_RANGE'], $value, $extras) . "";
case 'CS':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = "";
if (array_key_exists('entity', $viewDatas)) {
foreach ($viewDatas['entity']->getCSEntities() as $csEntity) {
$form .= "<div>" . $this->form_dropdown_custom($field, $csEntity->getPK(), $viewDatas, $extras) . "</div>";
}
}
$form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
break;
case 'CPU':
case 'RAM':
case 'DISK':
case 'DB':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'DB');
case 'OS':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, $field);
break;
case 'CPU_cnt':
case 'RAM_cnt':
case 'DISK_cnt':
case 'DB_cnt':
$form = form_dropdown($field, SERVERPART['CNT_RANGE'], $value, $extras) . "";
case 'OS_cnt':
$form = "*" . form_dropdown($field, SERVERPART['CNT_RANGE'], $value, $extras) . "";
break;
case 'SOFTWARE':
$form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'SOFTWARE');
break;
case 'SOFTWARE_cnt':
$form = form_dropdown($field, SERVERPART['CNT_RANGE'], $value, $extras) . "";
case 'DISK_extra':
$formOptionDatas = lang("Equipment/ServerPart.EXTRA");
if (!is_array($formOptionDatas)) {
throw new \Exception(__FUNCTION__ . "에서 {$field}}의 formOptionDatas 값이 array가 아닙니다.\n" . var_export($formOptionDatas, true));
}
$options = ["" => lang("Equipment/ServerPart.label.extra") . " 선택", ...$formOptionDatas];
$form = form_dropdown($field, $options, $value, $extras);
break;
default:
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
@ -79,6 +90,9 @@ class ServerPartHelper extends EquipmentHelper
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
{
switch ($field) {
case 'SWITCH':
case 'IP':
case 'CS':
case 'CPU':
case 'RAM':
case 'DISK':
@ -86,12 +100,12 @@ class ServerPartHelper extends EquipmentHelper
case 'DB':
case 'SOFTWARE':
$temps = [];
foreach ($viewDatas['entity']->getServerPartEntities($field) as $serverPartEntity) {
foreach ($viewDatas['entity']->getServerPartEntities($field) as $partEntity) {
$modal = form_label(
ICONS['SETUP'],
$field,
[
"data-src" => "/admin/equipment/serverpart/modify/{$serverPartEntity->getPK()}?ActionTemplate=popup",
"data-src" => "/admin/equipment/serverpart/modify/{$partEntity->getPK()}?ActionTemplate=popup",
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
"class" => "btn btn-sm btn-outline btn-circle",
@ -101,9 +115,9 @@ class ServerPartHelper extends EquipmentHelper
$temps[] = sprintf(
"%s%s%s %s",
$modal,
$serverPartEntity->getTitle(),
$serverPartEntity->getCnt() >= 1 ? "*" . $serverPartEntity->getCnt() . "" : "",
$serverPartEntity->getExtra() ?? ""
$partEntity->getTitle(),
$partEntity->getCnt() >= 1 ? "*" . $partEntity->getCnt() . "" : "",
$partEntity->getExtra() ?? ""
);
}
$value .= implode("<BR>", $temps);
@ -121,6 +135,9 @@ class ServerPartHelper extends EquipmentHelper
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'SWITCH':
case 'IP':
case 'CS':
case 'CPU':
case 'RAM':
case 'DISK':

View File

@ -23,14 +23,10 @@ return [
'RAM' => "RAM",
'RAM_cnt' => "RAM갯수",
'DISK' => "DISK",
'DISK_cnt' => "DISK갯수",
'DISK_extra' => "RAID설정",
'OS' => "OS",
'OS_cnt' => "OS갯수",
'DB' => "DB",
'DB_cnt' => "DB갯수",
'SOFTWARE' => "기타SW",
'SOFTWARE_cnt' => "SOFTWARE갯수",
],
"TITLE" => [
'HP DL360 Gen6' => "HP DL360 Gen6",
@ -50,11 +46,4 @@ return [
STATUS['OCCUPIED'] => "서비스중",
STATUS['FORBIDDEN'] => "사용불가",
],
"DISK_EXTRA" => [
'RAID0' => "RAID0",
'RAID1' => "RAID1",
'RAID5' => "RAID5",
'RAID6' => "RAID6",
'RAID10' => "RAID10",
],
];

View File

@ -152,7 +152,7 @@ abstract class CommonModel extends Model
$field,
$formDatas
);
if ($value !== null) {
if ($value !== '' && $value !== null) {
$convertedFormDatas[$field] = $value;
}
}

View File

@ -2,12 +2,8 @@
namespace App\Services\Equipment;
use App\Entities\Customer\ServiceEntity;
use App\Entities\Equipment\CSEntity;
use App\Entities\Equipment\IPEntity;
use App\Entities\Equipment\ServerEntity;
use App\Entities\Equipment\ServerPartEntity;
use App\Entities\Equipment\SwitchEntity;
use App\Helpers\Equipment\ServerPartHelper;
use App\Models\Equipment\ServerPartModel;
use App\Services\Equipment\EquipmentService;
@ -46,7 +42,7 @@ class ServerPartService extends EquipmentService
}
public function getBatchjobFields(): array
{
return ['billing', 'type', 'partinfo_uid'];
return ['billing', 'type'];
}
final public function getSwitchService(): SwitchService
{
@ -79,8 +75,7 @@ class ServerPartService extends EquipmentService
//partEntity 정보 추가
protected function getEntity_process(mixed $entity): ServerPartEntity
{
//부품정보 정의
$partEntity = $this->getPartService()->getEntity($entity->getPartInfoUID());
$partEntity = $this->getPartService()->getEntity($entity->getPartUID());
if ($entity) {
$entity->setPartEntity($partEntity);
}
@ -91,6 +86,9 @@ class ServerPartService extends EquipmentService
public function getFormOption(string $field, array $options = []): array
{
switch ($field) {
case 'part_uid':
$options = $this->getPartService()->getEntities();
break;
case 'SWITCH':
$options = $this->getSwitchService()->getEntities();
break;
@ -118,6 +116,12 @@ class ServerPartService extends EquipmentService
case 'CS':
$options = $this->getCSService()->getEntities();
break;
default:
$options = parent::getFormOption($field, $options);
break;
}
if (!is_array($options)) {
throw new \Exception(__FUNCTION__ . "에서 {$field}의 options 값이 array가 아닙니다.\n" . var_export($options, true));
}
return $options;
}
@ -155,7 +159,12 @@ class ServerPartService extends EquipmentService
if (!$partEntity) {
throw new \Exception(__METHOD__ . "에서 오류:{$partType}{$entity->getPartUID()}에 해닫하는 정보가 없습니다.");
}
$serverEntity->addServerPartEntity($partType, $partEntity);
$partService->modify($partEntity, [
'serverinfo_uid' => $serverEntity->getPK(),
'serviceinfo_uid' => $serverEntity->getServiceInfoUID(),
]);
$entity->setPartEntity($partEntity);
$serverEntity->addServerPartEntity($partType, $entity);
}
}
return $serverEntity;
@ -233,7 +242,7 @@ class ServerPartService extends EquipmentService
$entity->setPartEntity($partEntity);
return $entity;
}
public function show(int $serverinfo_uid): string
public function show(mixed $serverinfo_uid): string
{
//서버파트연결용
$viewDatas = [
@ -250,6 +259,6 @@ class ServerPartService extends EquipmentService
$viewDatas['action'] = __FUNCTION__;
//기존 Entity 가져오기
$viewDatas['entities'] = $this->getEntities(['serverinfo_uid' => $serverinfo_uid]);
return view('serverpart/' . __FUNCTION__, ['viewDatas' => $viewDatas]);
return view('admin/serverpart/' . __FUNCTION__, ['viewDatas' => $viewDatas]);
}
}

View File

@ -27,12 +27,8 @@ class ServerService extends EquipmentService
"format_at",
"status",
"CPU",
"CPU_cnt",
"RAM",
"RAM_cnt",
"DISK",
"DISK_cnt",
"DISK_extra",
];
}
public function getFormFilters(): array
@ -45,7 +41,6 @@ class ServerService extends EquipmentService
"CPU",
"RAM",
"DISK",
"DISK_extra",
"status"
];
}
@ -96,6 +91,29 @@ class ServerService extends EquipmentService
}
//기본 기능부분
//FieldForm관련용
public function getFormOption(string $field, array $options = []): array
{
switch ($field) {
case 'SWITCH':
case 'IP':
case 'CS':
case 'CPU':
case 'RAM':
case 'DISK':
case 'OS':
case 'DB':
case 'SOFTWARE':
$options = $this->getServerPartService()->getFormOption($field, $options);
break;
default:
$options = parent::getFormOption($field, $options);
break;
}
if (!is_array($options)) {
throw new \Exception(__FUNCTION__ . "에서 {$field}의 options 값이 array가 아닙니다.\n" . var_export($options, true));
}
return $options;
}
//create용 장비코드 마지막번호 가져오기
final public function getLastestCode(string $format, int $default): string
{

View File

@ -17,7 +17,7 @@
<?php foreach (["code", "type", "title", "price", "amount", "manufactur_at", "format_at", "status",] as $field): ?>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
<td nowrap class="text-start">
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['control']['form_datas'][$field] ?? null), $viewDatas) ?>
<?= $viewDatas['helper']->getFieldForm($field, old($field, $viewDatas['control']['form_datas'][$field] ?? null), $viewDatas) ?>
<span><?= validation_show_error($field); ?></span>
</td>
</tr>
@ -26,15 +26,16 @@
</td>
<td>
<table class="table table-bordered">
<?php foreach (SERVERPART['PARTTYPES'] as $partType): ?>
<?php foreach (['CPU', 'RAM', 'DISK'] as $field): ?>
<tr>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("{$partType}", lang("{$viewDatas['class_path']}.label.{$partType}"), $viewDatas) ?></th>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
<td nowrap class="text-start">
<?= $viewDatas['helper']->getFieldForm("{$partType}", old("{$partType}") ?? ($viewDatas['control']['form_datas']["{$partType}"] ?? null), $viewDatas) ?>
<?= $viewDatas['helper']->getFieldForm("{$partType}_cnt", old("{$partType}_cnt") ?? ($viewDatas['control']['form_datas']["{$partType}_cnt"] ?? null), $viewDatas) ?>
<?php if ($partType == 'DISK'): ?>
<?= $viewDatas['helper']->getFieldForm("{$partType}_extra", old("{$partType}_extra") ?? ($viewDatas['control']['form_datas']["{$partType}_extra"] ?? null), $viewDatas) ?>
<?= $viewDatas['helper']->getFieldForm($field, old($field, $viewDatas['control']['form_datas'][$field] ?? null), $viewDatas) ?>
<?= $viewDatas['helper']->getFieldForm("{$field}_cnt", old("{$field}_cnt", $viewDatas['control']['form_datas']["{$field}_cnt"] ?? 1), $viewDatas) ?>
<?php if ($field === 'DISK'): ?>
<?= $viewDatas['helper']->getFieldForm("{$field}_extra", old("{$field}_extra", $viewDatas['control']['form_datas']["{$field}_extra"] ?? null), $viewDatas) ?>
<?php endif ?>
<span><?= validation_show_error($field); ?></span>
</td>
</tr>
<?php endforeach; ?>

View File

@ -69,16 +69,13 @@
</td>
<td><?= $viewDatas['helper']->getFieldView('status', $entity->status, $viewDatas) ?></td>
<td nowrap>
<?= view_cell('\App\Services\ServerPartService::show', ['serverinfo_uid' => $entity->getPK()]) ?>
<table class="table table-bordered table-striped m-0 p-0">
<?php foreach (SERVERPART['PARTTYPES'] as $partType): ?>
<tr class="m-0 p-0">
<th class="m-0 p-0">IP</th>
<td class="m-0 p-0"><?= $viewDatas['helper']->getFieldView("ipinfo_uid", "", $viewDatas) ?></td>
</tr>
<tr class="m-0 p-0">
<th class="m-0 p-0">CS</th>
<td class="m-0 p-0"><?= $viewDatas['helper']->getFieldView("csinfo_uid", "", $viewDatas) ?></td>
<th class="text-end m-0 p-0"><?= $viewDatas['serverPartHelper']->getListButton($partType, $partType, $viewDatas) ?></th>
<td class="text-start m-0 p-0"><?= $viewDatas['serverPartHelper']->getFieldView($partType, "", $viewDatas) ?></td>
</tr>
<?php endforeach ?>
</table>
</td>
<td nowrap>

View File

@ -1,8 +0,0 @@
<table class="table table-bordered table-striped m-0 p-0">
<?php foreach (SERVERPART['PARTTYPES'] as $partType): ?>
<tr class="m-0 p-0">
<th class="text-end m-0 p-0"><?= $viewDatas['helper']->getListButton($partType, $partType, $viewDatas) ?></th>
<td class="text-start m-0 p-0"><?= $viewDatas['helper']->getFieldView($partType, "", $viewDatas) ?></td>
</tr>
<?php endforeach ?>
</table>