sync
This commit is contained in:
		| @@ -1,58 +1,6 @@ | ||||
| <%@ Page Title="" Language="C#" MasterPageFile="~/Credentials/Credentials.master" AutoEventWireup="true" CodeFile="ManageAPICredential.aspx.cs" Inherits="ManageAPICredential" %> | ||||
|  | ||||
| <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server"> | ||||
|     <style type="text/css"> | ||||
|         .dialog .dialog-title .dialog-close { | ||||
|             float: right; | ||||
|             margin-right: 6px; | ||||
|             cursor: pointer; | ||||
|         } | ||||
|  | ||||
|             .dialog .dialog-title .dialog-close:before { | ||||
|                 content: '\e600'; | ||||
|             } | ||||
|  | ||||
|         .dialog-content table { | ||||
|             border-collapse: collapse; | ||||
|             width: 100%; | ||||
|         } | ||||
|  | ||||
|             .dialog-content table td { | ||||
|                 padding-top: 30px; | ||||
|             } | ||||
|  | ||||
|                 .dialog-content table td.label { | ||||
|                     width: 130px; | ||||
|                     text-align: right; | ||||
|                     padding-right: 10px; | ||||
|                     line-height: 24px; | ||||
|                     height: 24px; | ||||
|                     vertical-align: top; | ||||
|                 } | ||||
|  | ||||
|                 .dialog-content table td input, | ||||
|                 .dialog-content table td textarea { | ||||
|                     border: 1px solid #a9a9a9; | ||||
|                     width: 200px; | ||||
|                     height: 18px; | ||||
|                     padding: 1px; | ||||
|                 } | ||||
|  | ||||
|                     .dialog-content table td input[type="checkbox"] { | ||||
|                         border: none; | ||||
|                     } | ||||
|  | ||||
|                 .dialog-content table td textarea { | ||||
|                     height: 100px; | ||||
|                     max-width: 200px; | ||||
|                 } | ||||
|  | ||||
|         .icon { | ||||
|             font-family: CalciteWebCoreIcons; | ||||
|             cursor: default; | ||||
|         } | ||||
|     </style> | ||||
|  | ||||
|     <script type="text/javascript"> | ||||
|         var credentialType = "AEMP"; | ||||
|         var credentialList; | ||||
| @@ -80,6 +28,7 @@ | ||||
|             $('#tr_enabled').hide(); | ||||
|             creid = undefined; | ||||
|             $('#dialog_apiname').val('').removeAttr("disabled"); | ||||
|             $('#dialog_description').val(''); | ||||
|             $('#dialog_username').val(''); | ||||
|             $('#dialog_password').val(''); | ||||
|             $('#dialog_apikey').val(''); | ||||
| @@ -101,7 +50,7 @@ | ||||
|  | ||||
|         var creid; | ||||
|         function OnEdit() { | ||||
|             var cre = grid_dt.source[grid_dt.selectedIndex].Values; | ||||
|             var cre = grid_dt.source[grid_dt.selectedIndex]; | ||||
|             if (!cre) { | ||||
|                 creid = undefined; | ||||
|                 return; | ||||
| @@ -110,7 +59,12 @@ | ||||
|             $('#tr_enabled').show(); | ||||
|             creid = cre.ID; | ||||
|             $('#dialog_apiname').val(cre.ApiDefinitionId).attr("disabled", "disabled"); | ||||
|             //$('#td_description').show(); | ||||
|             //$('#tr_description').show(); | ||||
|             $('#dialog_description').val(cre.Description); | ||||
|             var lines = 0; | ||||
|             if (cre.HasUserName) { | ||||
|                 lines++; | ||||
|                 $('#tr_username').show(); | ||||
|                 $('#dialog_username').val(cre.UserName); | ||||
|             } | ||||
| @@ -120,6 +74,7 @@ | ||||
|             } | ||||
|  | ||||
|             if (cre.HasPassword) { | ||||
|                 lines++; | ||||
|                 $('#tr_password').show(); | ||||
|                 $('#dialog_password').val(cre.Password); | ||||
|             } | ||||
| @@ -129,6 +84,7 @@ | ||||
|             } | ||||
|  | ||||
|             if (cre.HasApiKey) { | ||||
|                 lines++; | ||||
|                 $('#tr_apikey').show(); | ||||
|                 $('#dialog_apikey').val(cre.ApiKey); | ||||
|             } | ||||
| @@ -138,6 +94,7 @@ | ||||
|             } | ||||
|  | ||||
|             if (cre.HasApiSecret) { | ||||
|                 lines++; | ||||
|                 $('#tr_apisecret').show(); | ||||
|                 $('#dialog_apisecret').val(cre.ApiSecret); | ||||
|             } | ||||
| @@ -147,6 +104,7 @@ | ||||
|             } | ||||
|  | ||||
|             if (cre.HasApiToken) { | ||||
|                 lines++; | ||||
|                 $('#tr_apitoken').show(); | ||||
|                 $('#dialog_apitoken').val(cre.ApiToken); | ||||
|             } | ||||
| @@ -156,6 +114,7 @@ | ||||
|             } | ||||
|  | ||||
|             if (cre.HasApiTokenSecret) { | ||||
|                 lines++; | ||||
|                 $('#tr_apitokensecret').show(); | ||||
|                 $('#dialog_apitokensecret').val(cre.ApiTokenSecret); | ||||
|             } | ||||
| @@ -164,6 +123,7 @@ | ||||
|                 $('#dialog_apitokensecret').val(''); | ||||
|             } | ||||
|  | ||||
|             $('#dialog_description').css('height', lines * 55 - 4); | ||||
|             $('#dialog_enabled').attr("checked", cre.IsEnabled); | ||||
|             $('#dialog_credential .dialog-title span.title').text(GetTextByKey("P_APICRE_EDITMANUFACTURE", 'Edit Credential')); | ||||
|             showmaskbg(true); | ||||
| @@ -216,8 +176,7 @@ | ||||
|             var rows = []; | ||||
|             for (var i = 0; i < data.length; i++) { | ||||
|                 var r = data[i]; | ||||
|                 var fr = { Values: r }; | ||||
|                 rows.push(fr); | ||||
|                 rows.push(r); | ||||
|             } | ||||
|  | ||||
|             grid_dt.setData(rows); | ||||
| @@ -227,16 +186,11 @@ | ||||
|         function InitGridData() { | ||||
|             $('#btnEdit').attr("disabled", "disabled"); | ||||
|  | ||||
|             grid_dt = new GridView('#credentiallist'); | ||||
|             grid_dt.lang = { | ||||
|                 all: GetTextByKey("P_GRID_ALL", "(All)"), | ||||
|                 ok: GetTextByKey("P_GRID_OK", "OK"), | ||||
|                 reset: GetTextByKey("P_GRID_RESET", "Reset") | ||||
|             }; | ||||
|             grid_dt = createGridView('#credentiallist'); | ||||
|             var list_columns = [ | ||||
|                 { name: 'ApiName', caption: GetTextByKey("P_APICRE_APINAME", "API Name"), valueIndex: 'ApiName', css: { 'width': 200, 'text-align': 'left' } }, | ||||
|                 { name: 'UserName', caption: GetTextByKey("P_APICRE_USERNAME", "User Name"), valueIndex: 'UserName', css: { 'width': 200, 'text-align': 'left' } }, | ||||
|                 { name: 'IsEnabled', caption: GetTextByKey("P_APICRE_ENABLED", "Enabled"), valueIndex: 'IsEnabled', css: { 'width': 200, 'text-align': 'left' } }, | ||||
|                 { name: 'ApiName', caption: GetTextByKey("P_APICRE_APINAME", "API Name"), valueIndex: 'ApiName', allowFilter: true, css: { 'width': 200, 'text-align': 'left' } }, | ||||
|                 { name: 'UserName', caption: GetTextByKey("P_APICRE_USERNAME", "User Name"), valueIndex: 'UserName', allowFilter: true, css: { 'width': 200, 'text-align': 'left' } }, | ||||
|                 { name: 'IsEnabled', caption: GetTextByKey("P_APICRE_ENABLED", "Enabled"), valueIndex: 'IsEnabled', allowFilter: true, css: { 'width': 200, 'text-align': 'left' } }, | ||||
|                 { name: 'Edit', caption: "", css: { 'width': 30, 'text-align': 'center' } }, | ||||
|                 { name: 'Delete', caption: "", css: { 'width': 30, 'text-align': 'center' } } | ||||
|             ]; | ||||
| @@ -251,9 +205,13 @@ | ||||
|                 col.width = list_columns[hd].css.width; | ||||
|                 col.align = list_columns[hd].css["text-align"] | ||||
|                 col.key = list_columns[hd].valueIndex; | ||||
|                 col.allowFilter = list_columns[hd].allowFilter; | ||||
|                 if (col.name === "Edit") { | ||||
|                     col.isurl = true; | ||||
|                     col.text = "\uf044"; | ||||
|                     col.sortable = false; | ||||
|                     col.resizable = false; | ||||
|                     col.type = GridView.ColumnTypes.Icon; | ||||
|                     col.text = 'edit'; | ||||
|                     col.iconType = 'fa-light'; | ||||
|                     col.events = { | ||||
|                         onclick: function () { | ||||
|                             OnEdit(); | ||||
| @@ -265,8 +223,11 @@ | ||||
|                     col.attrs = { 'title': GetTextByKey("P_APICRE_EDIT", 'Edit') }; | ||||
|                 } | ||||
|                 else if (col.name === "Delete") { | ||||
|                     col.isurl = true; | ||||
|                     col.text = "\uf00d"; | ||||
|                     col.sortable = false; | ||||
|                     col.resizable = false; | ||||
|                     col.type = GridView.ColumnTypes.Icon; | ||||
|                     col.text = 'times'; | ||||
|                     col.iconType = 'fa-light'; | ||||
|                     col.events = { | ||||
|                         onclick: function () { | ||||
|                             OnDelete(this); | ||||
| @@ -282,12 +243,12 @@ | ||||
|             grid_dt.canMultiSelect = false; | ||||
|             grid_dt.columns = columns; | ||||
|             grid_dt.init(); | ||||
|             grid_dt.rowdblclick = OnEdit; | ||||
|             grid_dt.onRowDblClicked = OnEdit; | ||||
|  | ||||
|             grid_dt.selectedrowchanged = function (rowindex) { | ||||
|             grid_dt.onSelectedRowChanged = function (rowindex) { | ||||
|                 var rowdata = grid_dt.source[rowindex]; | ||||
|                 if (rowdata) { | ||||
|                     creid = rowdata.Values.ID; | ||||
|                     creid = rowdata.ID; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| @@ -296,6 +257,7 @@ | ||||
|             var item = { | ||||
|                 'ApiDefinitionId': $('#dialog_apiname').val(), | ||||
|                 'ApiName': $("#dialog_apiname").find("option:selected").text(), | ||||
|                 'Description': encodeURIComponent($('#dialog_description').val()), | ||||
|                 'UserName': $('#dialog_username').val().replace(/(^\s*)|(\s*$)/g, ''), | ||||
|                 'Password': $('#dialog_password').val(), | ||||
|                 'ApiKey': $('#dialog_apikey').val().replace(/(^\s*)|(\s*$)/g, ''), | ||||
| @@ -337,12 +299,15 @@ | ||||
|         } | ||||
|  | ||||
|         function setInput(dic) { | ||||
|             //$('#td_description').hide(); | ||||
|             //$('#tr_description').hide(); | ||||
|             $('#tr_username').hide(); | ||||
|             $('#tr_password').hide(); | ||||
|             $('#tr_apikey').hide(); | ||||
|             $('#tr_apitoken').hide(); | ||||
|             $('#tr_apisecret').hide(); | ||||
|             $('#tr_apitokensecret').hide(); | ||||
|             $('#dialog_description').val(''); | ||||
|             $('#dialog_username').val(''); | ||||
|             $('#dialog_password').val(''); | ||||
|             $('#dialog_apikey').val(''); | ||||
| @@ -350,24 +315,34 @@ | ||||
|             $('#dialog_apitoken').val(''); | ||||
|             $('#dialog_apitokensecret').val(''); | ||||
|             if (dic) { | ||||
|                 var lines = 0; | ||||
|                 //$('#td_description').show(); | ||||
|                 //$('#tr_description').show(); | ||||
|                 if (dic.ApiUsername) { | ||||
|                     lines++; | ||||
|                     $('#tr_username').show(); | ||||
|                 } | ||||
|                 if (dic.ApiPassword) { | ||||
|                     lines++; | ||||
|                     $('#tr_password').show(); | ||||
|                 } | ||||
|                 if (dic.ApiKey) { | ||||
|                     lines++; | ||||
|                     $('#tr_apikey').show(); | ||||
|                 } | ||||
|                 if (dic.ApiSecret) { | ||||
|                     lines++; | ||||
|                     $('#tr_apisecret').show(); | ||||
|                 } | ||||
|                 if (dic.ApiToken) { | ||||
|                     lines++; | ||||
|                     $('#tr_apitoken').show(); | ||||
|                 } | ||||
|                 if (dic.ApiTokenSecret) { | ||||
|                     lines++; | ||||
|                     $('#tr_apitokensecret').show(); | ||||
|                 } | ||||
|                 $('#dialog_description').css('height', lines * 55 - 4); | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @@ -407,7 +382,7 @@ | ||||
|     <div id="mask_bg"> | ||||
|         <div class="loading c-spin"></div> | ||||
|     </div> | ||||
|     <div class="dialog" id="dialog_credential" style="display: none; width: 500px;"> | ||||
|     <div class="dialog" id="dialog_credential" style="display: none; width: 460px;"> | ||||
|         <div class="dialog-title"><span class="title" data-lgid="P_APICRE_ADDMANUFACTURE">Add Credential</span><em class="dialog-close"></em></div> | ||||
|         <div class="dialog-content" style="padding-left: 50px;"> | ||||
|             <table> | ||||
| @@ -416,6 +391,13 @@ | ||||
|                     <td> | ||||
|                         <select id="dialog_apiname" tabindex="1" style="width: 200px;"> | ||||
|                         </select></td> | ||||
|                     <td id="td_description" class="label" data-lgid="P_MA_DESCRIPTION_COLON" style="display: none; text-align: left; width: 400px">Description:</td> | ||||
|                 </tr> | ||||
|                 <tr id="tr_description" style="display: none"> | ||||
|                     <td colspan="2" style="padding-top: 0"></td> | ||||
|                     <td rowspan="7" style="vertical-align: top; padding-top: 0"> | ||||
|                         <textarea id="dialog_description" style="max-width: 100%; width: 380px; box-sizing: border-box"></textarea> | ||||
|                     </td> | ||||
|                 </tr> | ||||
|                 <tr id="tr_username" class="tr_aicredential" style="display: none;"> | ||||
|                     <td class="label" data-lgid="P_APICRE_USERNAME_COLON">User Name:</td> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user