From ed27f48bd29a29505536680f2c5d5e319ce28236 Mon Sep 17 00:00:00 2001 From: ChangHyun Lee Date: Wed, 15 Mar 2017 17:23:54 +0900 Subject: [PATCH] [TIC-Web] fix the warning of deepscan - remove unused variable - init for variable Change-Id: Ic044a13ca2c4a0c9cca37340c0b8770b5af35b64 Signed-off-by: ChangHyun Lee --- public/src/js/model/JobStatusModel.js | 8 ++------ public/src/js/page/image.js | 5 +---- public/src/js/page/job.js | 19 ++++++++----------- public/src/js/page/package.js | 2 +- public/src/js/util.js | 6 +++--- public/src/js/widget/ImageEmptyItem.js | 8 ++------ public/src/js/widget/ImageItem.js | 10 +++------- public/src/js/widget/JobLog.js | 8 ++------ public/src/js/widget/JobTableEmptyItem.js | 8 ++------ public/src/js/widget/JobTableItem.js | 10 +++------- 10 files changed, 27 insertions(+), 57 deletions(-) diff --git a/public/src/js/model/JobStatusModel.js b/public/src/js/model/JobStatusModel.js index 2f4324a..677c953 100644 --- a/public/src/js/model/JobStatusModel.js +++ b/public/src/js/model/JobStatusModel.js @@ -1,14 +1,10 @@ define([ - 'lodash', - 'js/logger' + 'lodash' ], function ( - _, - Logger + _ ) { 'use strict'; - var logger = Logger('model/JobStatusModel.js'); - // define the default status var DEFAULT_STATUS = 'READY'; diff --git a/public/src/js/page/image.js b/public/src/js/page/image.js index b9031d6..4ff916f 100644 --- a/public/src/js/page/image.js +++ b/public/src/js/page/image.js @@ -34,7 +34,6 @@ define([ function _update(pageNum) { ModelImageList = []; - ModelImagePaging; function _updateView(arrImages) { return new Promise(function (resolve, reject) { @@ -113,10 +112,8 @@ define([ return new Promise(function (resolve, reject) { logger.info('_updatePagingModel'); - var totalCount, pagingCount; - // initialize - totalCount = 0; + var totalCount = 0; $('#tic-image-list-pagination').empty(); // set totalCount diff --git a/public/src/js/page/job.js b/public/src/js/page/job.js index fa1fbe5..cb2f823 100644 --- a/public/src/js/page/job.js +++ b/public/src/js/page/job.js @@ -50,7 +50,6 @@ define([ function _update(pageNum) { ModelJobList = []; - ModelJobPaging; function _updateView (arrJobs) { return new Promise(function (resolve, reject) { @@ -129,10 +128,8 @@ define([ return new Promise(function (resolve, reject) { logger.info('_updatePagingModel'); - var totalCount, pagingCount; - // initialize - totalCount = 0; + var totalCount = 0; $('#tic-job-list-pagination').empty(); // set totalCount @@ -141,7 +138,7 @@ define([ if (_.isEmpty(ModelJobPaging)) { ModelJobPaging = new JobPagingModel({ totalCount: totalCount, - currentPageNum: pageNum + currentPageNum: pageNum }) } @@ -228,7 +225,7 @@ define([ * AppConfig.EVENT.SOCKET.FS_IMAGE_ADD_FINISH = 'ws/fs/image/add/finish' */ client.on(AppConfig.EVENT.SOCKET.FS_IMAGE_ADD_FINISH, function (dataObj) { - var jobId, imageName, logItem1, logItem2, msgObj; + var jobId, imageName; // jobId jobId = dataObj.jobId; @@ -238,10 +235,10 @@ define([ imageName = imageName.substring(imageName.lastIndexOf('/')+1); // log - logItem1 = new JobLog(dataObj); + new JobLog(dataObj); // log - logItem2 = new JobLog({ + new JobLog({ msg: 'Image created successfully.', jobId: jobId }); @@ -338,16 +335,16 @@ define([ * AppConfig.EVENT.SOCKET.FS_IMAGE_ADD_FAIL = 'ws/fs/image/add/fail' */ client.on(AppConfig.EVENT.SOCKET.FS_IMAGE_ADD_FAIL, function (dataObj) { - var jobId, logItem, msgObj; + var jobId, msgObj; // jobId jobId = dataObj.jobId; // log - logItem = new JobLog(dataObj); + new JobLog(dataObj); // log - logItem = new JobLog({ + new JobLog({ msg: 'Failed to create image.', jobId: jobId }); diff --git a/public/src/js/page/package.js b/public/src/js/page/package.js index c380cdf..5dfe363 100644 --- a/public/src/js/page/package.js +++ b/public/src/js/page/package.js @@ -131,7 +131,7 @@ define([ function onSuccessGetRecipeFile(responseObj) { var msgObj, strKsName, strKsPath, strArch; - if (responseObj && responseObj.result === "false") { + if (!_.isEmpty(responseObj) && responseObj.result === "false") { logger.error(responseObj.message); throw responseObj; } diff --git a/public/src/js/util.js b/public/src/js/util.js index c83d5dc..a66999d 100644 --- a/public/src/js/util.js +++ b/public/src/js/util.js @@ -15,18 +15,18 @@ define([ getAppConfig(); } - function readLog () { + function readLog(linkid) { POST(config.EVENT.JOB.JOB_READ_LOG + linkid) .then(function (line) { $('#log-view-content-body').append(line); }); } - function getClientWidth () { + function getClientWidth() { return (window.innerWidth) ? window.innerWidth : document.documentElement.clientWidth || document.body.clientWidth || 0; } - function getClientHeight () { + function getClientHeight() { return(window.innerHeight) ? window.innerHeight : document.documentElement.clientHeight || document.body.clientHeight || 0; } diff --git a/public/src/js/widget/ImageEmptyItem.js b/public/src/js/widget/ImageEmptyItem.js index a2032bc..2700709 100644 --- a/public/src/js/widget/ImageEmptyItem.js +++ b/public/src/js/widget/ImageEmptyItem.js @@ -1,18 +1,14 @@ define([ 'jquery', 'lodash', - 'js/util', - 'js/logger' + 'js/util' ], function ( $, _, - Util, - Logger + Util ) { 'use strict'; - var logger = Logger('widget/ImageEmptyItem.js'); - var strEmptyItem = [ '
  • ', '

    There is no data.

    ', diff --git a/public/src/js/widget/ImageItem.js b/public/src/js/widget/ImageItem.js index a228e41..aa294c9 100644 --- a/public/src/js/widget/ImageItem.js +++ b/public/src/js/widget/ImageItem.js @@ -1,18 +1,14 @@ define([ 'jquery', 'lodash', - 'js/util', - 'js/logger' + 'js/util' ], function ( $, _, - Util, - Logger + Util ) { 'use strict'; - var logger = Logger('widget/ImageItem.js'); - // config var AppConfig = null; @@ -44,7 +40,7 @@ define([ var ImageItem = function (modelObj) { this.model = modelObj; - this.template; + this.template = null; this.init(this.model); diff --git a/public/src/js/widget/JobLog.js b/public/src/js/widget/JobLog.js index 9decd49..5ad60c3 100644 --- a/public/src/js/widget/JobLog.js +++ b/public/src/js/widget/JobLog.js @@ -1,18 +1,14 @@ define([ 'jquery', 'lodash', - 'js/util', - 'js/logger' + 'js/util' ], function ( $, _, - Util, - Logger + Util ) { 'use strict'; - var logger = Logger('widget/JobLog.js'); - var strLog = [ '

    <%= log %>

    ' ]; diff --git a/public/src/js/widget/JobTableEmptyItem.js b/public/src/js/widget/JobTableEmptyItem.js index 781e84f..a21e7e2 100644 --- a/public/src/js/widget/JobTableEmptyItem.js +++ b/public/src/js/widget/JobTableEmptyItem.js @@ -1,18 +1,14 @@ define([ 'jquery', 'lodash', - 'js/util', - 'js/logger' + 'js/util' ], function ( $, _, - Util, - Logger + Util ) { 'use strict'; - var logger = Logger('widget/JobTableEmptyItem.js'); - var strEmptyRow = [ '', 'There is no data.', diff --git a/public/src/js/widget/JobTableItem.js b/public/src/js/widget/JobTableItem.js index ae31304..d2f15f9 100644 --- a/public/src/js/widget/JobTableItem.js +++ b/public/src/js/widget/JobTableItem.js @@ -1,18 +1,14 @@ define([ 'jquery', 'lodash', - 'js/util', - 'js/logger' + 'js/util' ], function ( $, _, - Util, - Logger + Util ) { 'use strict'; - var logger = Logger('widget/JobTableItem.js'); - var strRow = [ '', '<%= jobNum %>', @@ -50,7 +46,7 @@ define([ var JobTableItem = function (modelObj) { this.model = modelObj; - this.template; + this.template = null; this.init(); }; -- 2.7.4