@@ -141,32 +141,35 @@ $(document).ready(function(){
141141 cockpit . spawn ( [ '/usr/share/cockpit/ablestack/python/license/register_license.py' , '--status' ] )
142142 . then ( function ( data ) {
143143 const result = JSON . parse ( data ) ;
144- if ( result . code === '200' ) {
145- const licenseInfo = result . val ;
146- $ ( '#license-status' ) . text ( '활성화' ) ;
147- $ ( '#license-expired' ) . text ( licenseInfo . expired ) ;
148- $ ( '#license-issued' ) . text ( licenseInfo . issued ) ; // 시작일 표시 추가
149- $ ( '#license-file-path' ) . text ( licenseInfo . file_path ) ;
150- } else {
151- $ ( '#license-status' ) . text ( '비활성화' ) ;
152- $ ( '#license-expired' ) . text ( '-' ) ;
153- $ ( '#license-issued' ) . text ( '-' ) ; // 시작일 표시 추가
154- $ ( '#license-file-path' ) . text ( '-' ) ;
155- }
144+
145+ // 라이센스 상태에 따른 UI 업데이트
146+ updateLicenseUI ( result ) ;
147+
148+ // 라이센스 버튼은 항상 표시되도록 수정
149+ $ ( '#button-open-modal-license-register' ) . show ( ) ;
150+
151+ return result ;
156152 } )
157153 . catch ( function ( error ) {
158- console . error ( '라이센스 상태 확인 중 오류:' , error ) ;
159- $ ( '#license-status' ) . text ( '오류' ) ;
160- $ ( '#license-expired' ) . text ( '-' ) ;
161- $ ( '#license-issued' ) . text ( '-' ) ; // 시작일 표시 추가
162- $ ( '#license-file-path' ) . text ( '-' ) ;
154+ console . error ( "라이센스 상태 확인 실패:" , error ) ;
155+ // 에러 시에도 버튼은 표시
156+ $ ( '#button-open-modal-license-register' ) . show ( ) ;
157+
158+ // 에러 UI 업데이트
159+ $ ( '#div-license-description' ) . html ( `
160+ <div class="license-info error">
161+ <p><i class="fas fa-exclamation-triangle" style="color: var(--pf-global--danger-color--100);"></i> 라이센스 상태를 확인할 수 없습니다.</p>
162+ <p>시스템 오류가 발생했습니다.</p>
163+ </div>
164+ ` ) ;
165+ throw error ;
163166 } ) ;
164167 }
165168
166169 // 라이센스 상태에 따른 UI 업데이트 함수
167170 function updateLicenseUI ( result ) {
168171 let licenseDescription = '' ;
169-
172+
170173 if ( result . code == "200" && result . val && result . val . status === 'active' ) {
171174 // 유효한 라이센스가 있는 경우
172175 licenseDescription = `
@@ -195,7 +198,7 @@ $(document).ready(function(){
195198 </div>
196199 ` ;
197200 }
198-
201+
199202 $ ( '#div-license-description' ) . html ( licenseDescription ) ;
200203 }
201204
@@ -235,7 +238,7 @@ $(document).ready(function(){
235238 reader . onload = function ( e ) {
236239 const fileContent = e . target . result ;
237240 const base64Content = btoa ( fileContent ) ;
238-
241+
239242 // 라이센스 등록 API 호출
240243 cockpit . spawn ( [
241244 'python3' ,
@@ -2332,15 +2335,75 @@ function setDiskAction(type, action){
23322335 </div>
23332336 ` ;
23342337 }
2335- } else {
2338+ } else {
23362339 output = '데이터가 존재하지 않습니다.<br>' ;
23372340 }
23382341
23392342 $ ( '#gfs-disk-delete-list' ) . append ( output ) ;
23402343 } ) ;
23412344
2345+ } else if ( type == "hba" && action == "list" ) {
2346+ var cmd = [ "python3" , pluginpath + "/python/clvm/disk_manage.py" , "--list-hba-wwn" ] ;
2347+
2348+ cockpit . spawn ( cmd ) . then ( function ( data ) {
2349+ // 초기화
2350+ $ ( '#hba-wwn-list' ) . empty ( ) ;
2351+
2352+ // JSON 데이터 파싱
2353+ var result = JSON . parse ( data ) ;
2354+
2355+ // 결과 리스트 가져오기
2356+ var wwnList = result . val ;
2357+
2358+ // 테이블 생성
2359+ var output = `
2360+ <table border="1" style="width: 100%; border-collapse: collapse; text-align: left;">
2361+ <thead>
2362+ <tr>
2363+ <th style="padding: 8px; background-color: #f2f2f2;">호스트명</th>
2364+ <th style="padding: 8px; background-color: #f2f2f2;">WWN</th>
2365+ </tr>
2366+ </thead>
2367+ <tbody>
2368+ ` ;
2369+
2370+ if ( wwnList . length > 0 ) {
2371+ // 데이터를 순회하면서 테이블 행 추가
2372+ for ( var i = 0 ; i < wwnList . length ; i ++ ) {
2373+ var wwn = wwnList [ i ] ;
2374+ output += `
2375+ <tr>
2376+ <td style="padding: 8px; border-bottom: 1px solid #ddd;">${ wwn . hostname } </td>
2377+ <td style="padding: 8px; border-bottom: 1px solid #ddd;">
2378+ ${ wwn . wwn . join ( '<br>' ) }
2379+ </td>
2380+ </tr>
2381+ ` ;
2382+ }
2383+ } else {
2384+ output += `
2385+ <tr>
2386+ <td colspan="2" style="padding: 8px; text-align: center;">데이터가 존재하지 않습니다.</td>
2387+ </tr>
2388+ ` ;
2389+ }
2390+
2391+ // 테이블 닫기
2392+ output += `
2393+ </tbody>
2394+ </table>
2395+ ` ;
2396+
2397+ // 출력 데이터 추가
2398+ $ ( '#hba-wwn-list' ) . append ( output ) ;
2399+
2400+ } ) . catch ( function ( ) {
2401+ createLoggerInfo ( "setDiskAction error" ) ;
2402+ } ) ;
23422403 }
2404+
23432405}
2406+
23442407$ ( '#menu-item-set-gfs-clvm-disk-add' ) . on ( 'click' , function ( ) {
23452408 setDiskAction ( "clvm" , "add" )
23462409 $ ( '#div-modal-clvm-disk-add' ) . show ( ) ;
@@ -2352,6 +2415,9 @@ $('#menu-item-set-hci-clvm-disk-add').on('click',function(){
23522415$ ( '#button-close-modal-clvm-disk-add, #button-cancel-modal-clvm-disk-add' ) . on ( 'click' , function ( ) {
23532416 $ ( '#div-modal-clvm-disk-add' ) . hide ( ) ;
23542417} ) ;
2418+ $ ( '#button-close-modal-hba-wwn-list, #button-execution-modal-hba-wwn-list' ) . on ( 'click' , function ( ) {
2419+ $ ( '#div-modal-hba-wwn-list' ) . hide ( ) ;
2420+ } )
23552421$ ( '#button-execution-modal-clvm-disk-add' ) . on ( 'click' , function ( ) {
23562422 $ ( '#div-modal-clvm-disk-add' ) . hide ( ) ;
23572423 $ ( '#div-modal-spinner-header-txt' ) . text ( "CLVM 디스크 논리 볼륨을 구성 중입니다." )
@@ -2446,13 +2512,21 @@ $('#div-modal-clvm-disk-delete').on('change', 'input[type=checkbox][name="form-c
24462512 $ ( '#button-execution-modal-clvm-disk-delete' ) . prop ( 'disabled' , ! isChecked ) ;
24472513} ) ;
24482514$ ( '#menu-item-set-gfs-clvm-disk-info' ) . on ( 'click' , function ( ) {
2449- setDiskAction ( "clvm" , "list" )
2515+ setDiskAction ( "clvm" , "list" ) ;
24502516 $ ( '#div-modal-clvm-disk-info' ) . show ( ) ;
24512517} ) ;
24522518$ ( '#menu-item-set-hci-clvm-disk-info' ) . on ( 'click' , function ( ) {
2453- setDiskAction ( "clvm" , "list" )
2519+ setDiskAction ( "clvm" , "list" ) ;
24542520 $ ( '#div-modal-clvm-disk-info' ) . show ( ) ;
24552521} ) ;
2522+ $ ( '#menu-item-hci-hba-wwn-list' ) . on ( 'click' , function ( ) {
2523+ setDiskAction ( "hba" , "list" ) ;
2524+ $ ( '#div-modal-hba-wwn-list' ) . show ( ) ;
2525+ } ) ;
2526+ $ ( '#menu-item-gfs-hba-wwn-list' ) . on ( 'click' , function ( ) {
2527+ setDiskAction ( "hba" , "list" ) ;
2528+ $ ( '#div-modal-hba-wwn-list' ) . show ( ) ;
2529+ } ) ;
24562530$ ( '#button-execution-modal-clvm-disk-info, #button-close-modal-clvm-disk-info' ) . on ( 'click' , function ( ) {
24572531 $ ( '#div-modal-clvm-disk-info' ) . hide ( ) ;
24582532} ) ;
@@ -3138,7 +3212,7 @@ function updateLicenseStatus() {
31383212 . then ( function ( data ) {
31393213 const result = JSON . parse ( data ) ;
31403214 let licenseDescription = '' ;
3141-
3215+
31423216 if ( result . code == "200" && result . val && result . val . status === 'active' ) {
31433217 // 유효한 라이센스가 있는 경우
31443218 licenseDescription = `
@@ -3167,7 +3241,7 @@ function updateLicenseStatus() {
31673241 </div>
31683242 ` ;
31693243 }
3170-
3244+
31713245 $ ( '#div-license-description' ) . html ( licenseDescription ) ;
31723246 } )
31733247 . catch ( function ( error ) {
@@ -3250,7 +3324,7 @@ function initializeLicenseHandlers() {
32503324 reader . onload = function ( e ) {
32513325 const fileContent = e . target . result ;
32523326 const base64Content = btoa ( fileContent ) ;
3253-
3327+
32543328 // 라이센스 등록 API 호출
32553329 cockpit . spawn ( [
32563330 'python3' ,
0 commit comments