/*
* Copyright (c) 2019 TOYOTA MOTOR CORPORATION
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var queryParam = function(param) {
//debugger;
param.orderColumn = param.order[0].column;
param.orderDir = param.order[0].dir;
param.keyWord = $('#t_keyWord').val();
param.typeId = TypeId;
param.deviceTypeId = deviceTypeId;
param.filepath = $('#t_filePath').val();
return param;
};
function initAppList(localStr, isListDev) {
debugger;
localAppList = eval(localStr);
$table.DataTable({
order : [ [ 1, 'asc' ] ],
lengthChange : false,
displayLength : 50,
retrieve: true,
ajax : {
url : $("#basePath").val() + '/appDev/search',
data : queryParam,
type : 'GET',
dataFilter : function(data) {
$errorArea.empty();
$errorArea.css("display", "none");
var json = $.parseJSON(data);
if (json.statusCode && json.statusCode != null) {
$errorArea.empty().append(
'
' + json.statusText + '
');
$errorArea.css("display", "block");
}
return data; // return JSON string
}
},
columns : [
{
className : 'td-operation',
data : null,
orderable : false,
defaultContent : '',
width : '80px',
render : function(data, type, row, meta) {
//button show (install update launch) S
var appStatus = 0; //button word(install:0,update:2,launch:1)
var localApp = "";
if (typeof(localAppList) != "undefined"){
for (var i = 0; i < localAppList.length; i++) {
var appInfo = localAppList[i];
if (appInfo.id.indexOf(data.appIdCustom) == 0){
if(appInfo.version.indexOf(data.versionName) == 0){
appStatus = 1; //launch
}else{
appStatus = 2; //update
}
localApp = appInfo;
break;
}
}
}
if(appStatus == 2){
downloadBtnOnclick = 'onclick=updateApp(this,"'+data.appId+'","'+data.typeId+'","'+data.verFilePath+'","'+localApp.id+'")>update';
}else if(appStatus == 1){
downloadBtnOnclick = 'onclick=launchApp("'+localApp.id+'")>launch';
}else{
downloadBtnOnclick = 'onclick=doDownload(this,"'+data.appId+'","'+data.typeId+'","'+data.verFilePath+'")>install';
}
var downloadBtn = '