How to use myAppId method in ng-mocks

Best JavaScript code snippet using ng-mocks

profile.js

Source:profile.js Github

copy

Full Screen

1if (location.hash) {2 window.scrollTo(0, 0);3 setTimeout(function() {4 window.scrollTo(0, 0);5 }, 1);6}7// Views to append into the scroll container8var html = '';9// Boolean to record the number of times the scroll hits the floor10var triggered = 0;11// Individual trackers for each tab12var lastGiftsId = 0;13var lastWantsId = 0;14var lastThanksId = 0;15var lastFriendsId = 0;16var lastItem = 0;17// Number of items to load every AJAX18var numItems = 12;19var canAJAX = false;20var firstGifts = true;21var firstWants = true;22var firstThanks = true;23var firstFriends = true;24var isFirst = true;25var urlAJAX = null;26// AJAX Infinite Scrolling Function27function addRealViews(html) {28 var currentTab = $(".nav-pills").find(".active").attr('id');29 switch (currentTab) {30 case "tab-gifts":31 $("#my-tabs-contents").find(".active").removeClass("active");32 $("#my-tabs-contents").find(".active").removeClass("in");33 $("#gifts").addClass("active");34 $("#gifts").addClass("in");35 window.location.hash = "gifts";36 currentTab = "gifts";37 isFirst = firstGifts;38 if (firstGifts) {39 urlAJAX = '/api/myItems/' + 0 + '/' + numItems + '/' + appProfileId;40 } else {41 urlAJAX = '/api/myItems/' + lastGiftsId + '/' + numItems + '/' + appProfileId;42 }43 firstGifts = false;44 lastItem = lastGiftsId;45 break;46 case "tab-wants":47 $("#my-tabs-contents").find(".active").removeClass("active");48 $("#my-tabs-contents").find(".active").removeClass("in");49 $("#wants").addClass("active");50 $("#wants").addClass("in");51 window.location.hash = "wants";52 currentTab = "wants";53 isFirst = firstWants;54 if (firstWants) {55 urlAJAX = '/api/myWants/' + 0 + '/' + numItems + '/' + appProfileId;56 } else {57 urlAJAX = '/api/myWants/' + lastWantsId + '/' + numItems + '/' + appProfileId;58 }59 firstWants = false;60 lastItem = lastWantsId;61 break;62 case "tab-thanks":63 $("#my-tabs-contents").find(".active").removeClass("active");64 $("#my-tabs-contents").find(".active").removeClass("in");65 $("#thanks").addClass("active");66 $("#thanks").addClass("in");67 window.location.hash = "thanks";68 currentTab = "thanks";69 isFirst = firstThanks;70 urlAJAX = null;71 firstThanks = false;72 lastItem = lastThanksId;73 break;74 case "tab-friends":75 $("#my-tabs-contents").find(".active").removeClass("active");76 $("#my-tabs-contents").find(".active").removeClass("in");77 $("#friends").addClass("active");78 $("#friends").addClass("in");79 window.location.hash = "friends";80 currentTab = "friends";81 isFirst = firstFriends;82 urlAJAX = null;83 firstFriends = false;84 lastItem = lastFriendsId;85 break;86 default:87 break;88 }89 if (urlAJAX != null && lastItem >= 1 || isFirst) {90 // AJAX to fetch JSON objects from server91 $.ajax({92 url: urlAJAX,93 dataType: "json",94 method: 'get',95 cache: false,96 // Success Callback97 success: function(data) {98 canAJAX = true;99 // Data available to display / append100 if (data.length > 0) {101 // Increment tracker102 switch (currentTab) {103 case "gifts":104 lastGiftsId = data[data.length - 1].itemID;105 break;106 case "wants":107 lastWantsId = data[data.length - 1].itemID;108 break;109 case "thanks":110 lastThanksId = data[data.length - 1].itemID;111 break;112 case "friends":113 lastFriendsId = data[data.length - 1].itemID;114 break;115 default:116 break;117 }118 // lastItemId = data[data.length - 1].itemID;119 /*** Factory for views ***/120 $.each(data, function(key, value) {121 if (value.giverID !== myAppId && value.takerID !== null && value.takerID !== myAppId) {122 html = '<div class="col-xs-6 col-sm-3 single-item">';123 } else if (value.giverID !== myAppId && value.takerID !== null && value.takerID === myAppId) {124 html = '<div class="col-xs-6 col-sm-3 single-item">';125 } else if (loggedIn && value.giverID !== myAppId && value.meWant === 0 && !value.expired) { // NEED TO ADD NOT EXPIRED126 html = '<div class="col-xs-6 col-sm-3 single-item">';127 } else if (loggedIn && value.giverID !== myAppId && value.meWant > 0 && !value.expired) {128 html = '<div class="col-xs-6 col-sm-3 single-item">';129 } else if (value.giverID !== myAppId && value.expired) {130 html = '<div class="col-xs-6 col-sm-3 single-item">';131 } else if (value.giverID === myAppId && value.takerID !== null) {132 html = '<div class="col-xs-6 col-sm-3 single-item">';133 } else if (value.giverID === myAppId && value.takerID === null) {134 html = '<div class="col-xs-6 col-sm-3 single-item">';135 } else {136 html = '<div class="col-xs-6 col-sm-3 single-item">';137 }138 html += '<div class="panel">';139 html += '<a href="/item/' + value.itemID + '"><img src="https://d24uwljj8haz6q.cloudfront.net/' + value.imageLocation + '" alt="" class="img-responsive"/></a>';140 html += '<a href="/item/' + value.itemID + '">';141 html += '<div class="item-info">';142 html += '<a href="/item/' + value.itemID + '"><p class="hide-overflow">' + value.title + '</p></a>';143 html += '<a href="/profile/' + value.userID + '" class="seller-info row">';144 html += '<img src="https://graph.facebook.com/' + value.fbID + '/picture" alt="" />';145 html += '<span class="hide-overflow name-on-card">' + value.name + '</span>';146 html += '</a>';147 html += '<p>';148 if (value.donationAmount % 1 == 0) {149 html += '<span style="inline-block"><img src="../images/upload/charity' + value.charityID + '.png" alt="" class="small-charity-logo" /> $' + value.donationAmount + " donation";150 } else {151 html += '<span style="inline-block"><img src="../images/upload/charity' + value.charityID + '.png" alt="" class="small-charity-logo" /> $' + value.donationAmount.toFixed(2) + " donation";152 }153 html += '</span>';154 if (value.meWant) {155 html += '<span class="pull-right"><i class="fa fa-heart addition-info pull-right me-want"></i>' + value.numWants + '</span>';156 } else {157 html += '<span class="pull-right"><i class="fa fa-heart addition-info pull-right"></i>' + value.numWants + '</span>';158 }159 html += '</p>';160 if (value.giverID !== myAppId && value.takerID !== null && value.takerID !== myAppId) {161 html += '<div class="ribbon-wrapper-green">';162 html += '<div class="ribbon-grey">';163 html += 'given away';164 html += '</div>';165 html += '</div>';166 } else if (value.giverID !== myAppId && value.takerID !== null && value.takerID === myAppId) {167 html += '<div class="ribbon-wrapper-green">';168 html += '<div class="ribbon-red">';169 html += 'given to you';170 html += '</div>';171 html += '</div>';172 } else if (loggedIn && value.giverID !== myAppId && value.meWant === 0 && !value.expired) { // NEED TO ADD NOT EXPIRED173 } else if (loggedIn && value.giverID !== myAppId && value.meWant > 0 && !value.expired) {174 html += '<div class="ribbon-wrapper-green">';175 html += '<div class="ribbon-green">';176 html += 'wanted';177 html += '</div>';178 html += '</div>';179 } else if (value.giverID === myAppId && value.takerID !== null) { // IF I GAVE180 html += '<div class="ribbon-wrapper-green">';181 html += '<div class="ribbon-grey">';182 html += 'given away';183 html += '</div>';184 html += '</div>';185 } else if (value.giverID === myAppId && value.takerID === null && !value.expired) {186 html += '<div class="ribbon-wrapper-green">';187 html += '<div class="ribbon-green">';188 html += 'ongoing';189 html += '</div>';190 html += '</div>';191 } else if (value.expired) {192 html += '<div class="ribbon-wrapper-green">';193 if (value.giverID === myAppId) {194 html += '<div class="ribbon-red">';195 } else {196 html += '<div class="ribbon-grey">';197 }198 html += 'expired';199 html += '</div>';200 html += '</div>';201 }202 html += '</div>';203 html += '</div></a>';204 html += '</div>';205 switch (currentTab) {206 case "gifts":207 firstGifts = false;208 $('#infinite-scroll-container-gifts').append(html);209 $('#gifts-banner-empty').hide();210 $('#gifts-banner').removeClass('hidden');211 $("#gift-loader-wrapper").addClass('hidden');212 break;213 case "wants":214 firstWants = false;215 $('#infinite-scroll-container-wants').append(html);216 $('#wants-banner-empty').hide();217 $('#wants-banner').removeClass('hidden');218 $("#want-loader-wrapper").addClass('hidden');219 break;220 case "thanks":221 firstThanks = false;222 $('#thanks').append(html);223 $('#thanks-placeholder').hide();224 break;225 case "friends":226 firstFriends = false;227 $('#friends').append(html);228 $('#friends-placeholder').hide();229 break;230 default:231 break;232 }233 });234 triggered = 0;235 } else {236 switch (currentTab) {237 case "gifts":238 $("#gift-loader-wrapper").addClass('hidden');239 break;240 case "wants":241 $("#want-loader-wrapper").addClass('hidden');242 break;243 }244 }245 },246 error: function(data) {247 canAJAX = true;248 triggered = 0;249 switch (currentTab) {250 case "gifts":251 $("#gift-loader-wrapper").addClass('hidden');252 break;253 case "wants":254 $("#want-loader-wrapper").addClass('hidden');255 break;256 }257 }258 });259 }260}261// Main Navigation and Load Logic262$(document).ready(function() {263 var currentHash = window.location.hash;264 switch (currentHash) {265 case "#gifts":266 $(".nav-pills").find(".active").removeClass("active");267 $("#tab-gifts").addClass("active");268 break;269 case "#wants":270 $(".nav-pills").find(".active").removeClass("active");271 $("#tab-wants").addClass("active");272 break;273 case "#thanks":274 $(".nav-pills").find(".active").removeClass("active");275 $("#tab-thanks").addClass("active");276 break;277 case "#friends":278 $(".nav-pills").find(".active").removeClass("active");279 $("#tab-friends").addClass("active");280 break;281 default:282 break;283 }284 switch (currentHash) {285 case "#gifts":286 $("#gift-loader-wrapper").removeClass('hidden');287 break;288 case "#wants":289 $("#want-loader-wrapper").removeClass('hidden');290 break;291 }292 addRealViews(html);293 $('.nav-pills a').click(function() {294 $(".nav-pills").find(".active").removeClass("active");295 $(this).parent().addClass("active");296 triggered = 0;297 setTimeout(addRealViews, 300, html);298 currentHash = window.location.hash;299 switch (currentHash) {300 case "#gifts":301 $("#gift-loader-wrapper").removeClass('hidden');302 break;303 case "#wants":304 $("#want-loader-wrapper").removeClass('hidden');305 break;306 }307 addRealViews(html);308 });309 $('#confirm-delete').on('show.bs.modal', function(e) {310 $(this).find('.btn-ok').click(function() {311 $.ajax({312 type: 'post',313 url: '/api/delete-user',314 success: function(){315 document.location = "/logout";316 }317 });318 });319 });320 $.ajaxSetup({321 headers: {'X-CSRF-Token': $('meta[name="_csrf"]').attr('content')}322 });323 $('#comments-container').comments({324 readOnly: loggedIn ? false : true,325 roundProfilePictures: true,326 noCommentsText: 'No Thank You Messages.',327 textareaPlaceholderText: isMine ? 'Reply to your Thank You Messages' :'Leave a Thank You Message',328 profilePictureURL: 'https://graph.facebook.com/' + userFbId + '/picture',329 getComments: function(success, error) {330 $.ajax({331 url: '/profile/' + appProfileId + '/thank',332 dataType: "json",333 method: 'get',334 cache: false,335 // Success Callback336 success: function(data) {337 var thanksArray = [];338 for (var i=0; i<data.length; ++i) {339 var upvoted = false;340 for (var j=0; j<data[i].upvote.length; ++j) {341 if (data[i].upvote[j].userID === myAppId) {342 upvoted = true;343 break;344 }345 }346 thanksArray.push({347 id: data[i].thankID,348 created: data[i].timeCreated,349 content: data[i].message,350 fullname: data[i].thankedBy.name,351 // fullname: data[i].commentedBy.name,352 upvote_count: data[i].upvote.length,353 user_has_upvoted: upvoted,354 profile_picture_url: 'https://graph.facebook.com/' + data[i].thankedBy.fbID + '/picture',355 parent: data[i].parentThank,356 created_by_current_user: data[i].thankedBy.userID === myAppId357 })358 }359 success(thanksArray);360 },361 error: function(error) {362 console.log("error loading");363 }364 });365 },366 postComment: function(commentJSON, success, error) {367 $.ajax({368 method: 'post',369 url: '/api/thank/profile/' + appProfileId,370 data: commentJSON,371 dataType: "json",372 success: function(data) {373 var upvoted = false;374 for (var i=0; i<data.upvote.length; ++i) {375 if (data.upvote[i].userID === myAppId) {376 upvoted = true;377 break;378 }379 }380 success({381 id: data.thankID,382 created: data.timeCreated,383 content: data.message,384 fullname: data.thankedBy.name,385 upvote_count: data.upvote.length,386 user_has_upvoted: upvoted,387 profile_picture_url: 'https://graph.facebook.com/' + data.thankedBy.fbID + '/picture',388 parent: data.parentThank,389 created_by_current_user: data.thankedBy.userID === myAppId390 });391 },392 error: function(error) {393 console.log("error posting");394 }395 });396 },397 putComment: function(commentJSON, success, error) {398 $.ajax({399 type: 'post',400 url: '/api/updatethank/profile/' + commentJSON.id,401 data: commentJSON,402 dataType: "json",403 success: function(data) {404 var upvoted = false;405 for (var i=0; i<data.upvote.length; ++i) {406 if (data.upvote[i].userID === myAppId) {407 upvoted = true;408 break;409 }410 }411 if (data) {412 success({413 id: data.thankID,414 created: data.timeCreated,415 content: data.message,416 fullname: data.thankedBy.name,417 upvote_count: data.upvote.length,418 user_has_upvoted: upvoted,419 profile_picture_url: 'https://graph.facebook.com/' + data.thankedBy.fbID + '/picture',420 parent: data.parentThank,421 created_by_current_user: data.thankedBy.userID === myAppId422 });423 } else {424 success({});425 }426 },427 error: function(error) {428 console.log("error editing");429 }430 });431 },432 deleteComment: function(commentJSON, success, error) {433 $.ajax({434 type: 'post',435 url: '/api/deletethank/profile/' + commentJSON.id,436 success: function(data) {437 success();438 },439 error: function(error) {440 console.log("error editing");441 }442 });443 },444 upvoteComment: function(commentJSON, success, error) {445 var upvotesURL = '/api/thank/profile/upvotes/' + commentJSON.id;446 var downvotesURL = '/api/thank/profile/downvotes/' + commentJSON.id;447 if(commentJSON.user_has_upvoted) {448 $.ajax({449 type: 'post',450 url: upvotesURL,451 success: function(data) {452 var upvoted = false;453 for (var i=0; i<data.upvote.length; ++i) {454 if (data.upvote[i].userID === userId) {455 upvoted = true;456 break;457 }458 }459 if (data) {460 success({461 id: data.thankID,462 created: data.timeCreated,463 content: data.message,464 fullname: data.thankedBy.name,465 upvote_count: data.upvote.length,466 user_has_upvoted: upvoted,467 profile_picture_url: 'https://graph.facebook.com/' + data.thankedBy.fbID + '/picture',468 parent: data.parentThank,469 created_by_current_user: data.thankedBy.userID === userId470 });471 } else {472 success({});473 }474 },475 error: function() {476 console.log("error upvoting");477 }478 });479 } else {480 $.ajax({481 type: 'post',482 url: downvotesURL,483 success: function(data) {484 var upvoted = false;485 for (var i=0; i<data.upvote.length; ++i) {486 if (data.upvote[i].userID === userId) {487 upvoted = true;488 break;489 }490 }491 if (data) {492 success({493 id: data.thankID,494 created: data.timeCreated,495 content: data.message,496 fullname: data.thankedBy.name,497 upvote_count: data.upvote.length,498 user_has_upvoted: upvoted,499 profile_picture_url: 'https://graph.facebook.com/' + data.thankedBy.fbID + '/picture',500 parent: data.parentThank,501 created_by_current_user: data.thankedBy.userID === userId502 });503 } else {504 success({})505 }506 },507 error: function() {508 console.log("error downvoting");509 }510 });511 }512 }513 });514});515$(window).scroll(function() {516 if ($(window).scrollTop() + $(window).height() == $(document).height()) {517 // no_data = true;518 triggered += 1;519 if (canAJAX && triggered == 1) {520 var currentHash = window.location.hash;521 switch (currentHash) {522 case "#gifts":523 $("#gift-loader-wrapper").removeClass('hidden');524 break;525 case "#wants":526 $("#want-loader-wrapper").removeClass('hidden');527 break;528 }529 canAJAX = false;530 addRealViews(html);531 }532 }533});534function handleBrokenImage(image) {535 image.onerror = "";536 image.src = "/images/common/default-placeholder.png";537 return true;538}539$(window).load(function() {540 $('.thumbnail').find('img').each(function() {541 var imgClass = (this.width / this.height > 1) ? 'wide' : 'tall';542 $(this).addClass(imgClass);543 })544});545$(document).scroll(function() {546 var y = $(document).scrollTop();547 var floatingBar = $('.floating-bar-full');548 if(y >= 377) {549 floatingBar.css({"position": "fixed", "top": "87px", "padding-right": "30px"});550 } else {551 floatingBar.css({"position": "relative", "top": "0px", "padding-right": "15px"});552 }...

Full Screen

Full Screen

utils-abap-flp.js

Source:utils-abap-flp.js Github

copy

Full Screen

1var app_excludes = ["Shell", "explace", "UserDefaults","dlm", "MarketingAPI", "ConfigurationObject", "uitype=advanced", "*-", "copilot", "quickview", "quickcreate"];2var debug = false;3var logger;4//CONSTRUCTOR5function utilsabapflp(_user, _logger)6{7 this.user = _user;8 this.logger = _logger;9}10/**11 * getSuffix12 */13function getSuffix() {14 var suffix = "/sap/opu/odata/UI2/PAGE_BUILDER_PERS/Pages('%2FUI2%2FFiori2LaunchpadHome')/allCatalogs?$expand=Chips/ChipBags/ChipProperties&$orderby=title&$filter=type";15 suffix += "%20eq%20%27CATALOG_PAGE%27%20or%20type%20eq%20%27H%27%20or%20type%20eq%20%27SM_CATALOG%27%20or%20type%20eq%20%27REMOTE%27&$format=json";16 17 return suffix;18};19//CHECKS IF SEARCHTERM IS IN LIST/ARRAY20function StringInArray(searchterm, list) {21 for (var i = 0; i < list.length; i++) {22 if (searchterm.includes(list[i])) {23 return true;24 }25 }26 return false;27}28function getTitlefromChips(tile)29{30 var title = "";31 if(tile.ChipBags.results.length > 0)32 {33 for (var l = 0; l< tile.ChipBags.results.length; l++) 34 {35 if(tile.ChipBags.results[l].ChipProperties.results.length > 0)36 {37 for (var p = 0; p< tile.ChipBags.results[l].ChipProperties.results.length; p++) 38 {39 if(tile.ChipBags.results[l].ChipProperties.results[p].name == "display_title_text" || tile.ChipBags.results[l].ChipProperties.results[p].name == "title")40 {41 title = tile.ChipBags.results[l].ChipProperties.results[p].value;42 }43 if(tile.ChipBags.results[l].ChipProperties.results[p].name == "display_subtitle_text")44 {45 var value = tile.ChipBags.results[l].ChipProperties.results[p].value;46 if(value != "")47 title += " - "+value;48 }49 }50 }51 }52 }53 return title;54}55function sortByTargetMapping(a,b) {56 if(isTargetMapping(a))57 return -1;58 else59 return 1;60}61function sortByTile(a,b) {62 if(!isTargetMapping(a))63 return -1;64 else65 return 1;66}67 68function sortAlhpabetically(a,b) {69 if (a.appid < b.appid)70 return -1;71 else72 return 1;73}74function removeTechTag(text)75{76 text = text.replace("?sap-ui-tech-hint=GUI","");77 text = text.replace("?sap-ui-tech-hint=WDA","");78 text = text.replace("?sap-ui-tech-hint=UI5","");79 return text;80}81 82function IsDuplicate(item, list)83{84 //CHECK FOR DUPLICATES85 var found = false;86 for (var i = 0; i < list.length; i++) 87 {88 //REMOVE TECH PARAMS89 if(removeTechTag(item.appid) == removeTechTag(list[i].appid) && item.type == list[i].type)90 {found = true;}91 if(item.ui5_component != "" && item.ui5_component == list[i].ui5_component && !removeTechTag(item.appid).includes("?"))92 {found = true;}93 }94 95 return found;96}97function isTargetMapping(tile)98{99 if(tile.url.includes("action") || tile.title.includes("Target Mapping"))100 {return true;}101 else102 {return false;}103}104function checkIfIsMatch(tile, target_mapping, type)105{106 if(tile.semanticObject == target_mapping.semanticObject 107 && tile.semanticAction == target_mapping.semanticAction 108 && type == target_mapping.type) 109 {return true;}110 else if (tile.semanticAction == "analyzeSBKPIDetailsS4HANA" && target_mapping.semanticAction == "analyzeSBKPIDetailsS4HANA" && target_mapping.semanticObject == "*")111 {return true;}112 else113 {return false;}114}115//FIND URL PARAMS FOR URL116//function extractAdditionalParams(mytile,myappid)117utilsabapflp.prototype.extractAdditionalParams = function(mytile, myappid)118{119 var paramObj = {};120 var blacklist = "";121 var params = "";122 var that = this;123 if(mytile.signature && mytile.signature.parameters){124 var myparams = mytile.signature.parameters;125 for (var key in myparams) {126 var obj = myparams[key];127 128 if(obj.required){129 var value = "";130 131 if(obj.filter && obj.filter.value)132 {133 value = obj.filter.value; 134 }135 136 if(value == "")137 {138 that.logger.log('debug', "["+that.user+"] Target Mapping " + myappid + " blacklisted! (No default value for mandatory parameter "+key+" found!");139 blacklist = "BLACKLISTED_MANDATORY_PARAM;";140 }141 142 if(!myappid.includes(key))143 {144 if(myappid.includes("?") || params.includes("?"))145 {146 params += "&"+key+"="+value;147 }148 else149 {150 params += "?"+key+"="+value;151 }152 }153 }154 else155 {156 if(obj.defaultValue && obj.defaultValue.value && obj.defaultValue.value != "" && !obj.defaultValue.value.includes("UserDefault"))157 {158 value = obj.defaultValue.value; 159 if(!myappid.includes(key))160 {161 if(myappid.includes("?") || params.includes("?"))162 {163 params += "&"+key+"="+value;164 }165 else166 {167 params += "?"+key+"="+value;168 }169 }170 }171 }172 }173 }174 paramObj.params = params;175 paramObj.blacklist = blacklist;176 return paramObj;177};178/**179 * getIntents180 * @param {json} data181 */182//function getIntents(data) {183utilsabapflp.prototype.getIntents = function(data) {184 var target_mappings = [];185 var allChips = 0;186 var that = this;187 //PROCESS ALL TARGET MAPPINGS188 data.d.results.forEach(function(oCatalog) {189 190 oCatalog.Chips.results.forEach(function(target_mapping)191 {192 allChips++;193 if(isTargetMapping(target_mapping))194 {195 if (target_mapping.configuration != "") 196 {197 //LOAD DATA198 var target_mapping_config = JSON.parse(target_mapping.configuration);199 var mytarget_mapping = JSON.parse(target_mapping_config.tileConfiguration);200 //EXTRACT TYPE201 var mytype = "";202 if (mytarget_mapping.navigation_provider) {203 mytype = mytarget_mapping.navigation_provider;204 }205 206 //EXTRACT TITLE207 var mydesc = "";208 if(mytarget_mapping.display_title_text && mytarget_mapping.display_title_text != "" && mytarget_mapping.display_title_text != "Analyze KPI Details")209 {mydesc = mytarget_mapping.display_title_text;}210 else211 {mydesc = getTitlefromChips(target_mapping);}212 //EXTRACT INTENT213 var myappid = "#" + mytarget_mapping.semantic_object + "-" + mytarget_mapping.semantic_action;214 var paramsObj = that.extractAdditionalParams(mytarget_mapping,myappid);215 var blacklist = "";216 if(paramsObj.blacklist != ""){blacklist = paramsObj.blacklist;}217 myappid += paramsObj.params;218 var target_mapping_obj = {219 catalogId: oCatalog.id.replace("X-SAP-UI2-CATALOGPAGE:", ""),220 catalogTitle: oCatalog.title,221 appid: myappid,222 semanticObject: mytarget_mapping.semantic_object,223 semanticAction: mytarget_mapping.semantic_action,224 desc: mydesc,225 type: mytype,226 category: "TargetMapping",227 category_tech: target_mapping.baseChipId,228 ui5_component: mytarget_mapping.ui5_component,229 url: mytarget_mapping.url,230 blacklist: blacklist231 //targetmapping: mytarget_mapping232 };233 if(debug)234 target_mapping_obj.targetmapping = mytarget_mapping235 //console.log(target_mapping);236 target_mappings.push(target_mapping_obj);237 }238 else239 {240 that.logger.log('error', "["+that.user+"] Tile could not be parsed - no config for <"+target_mapping.title+">");241 allChips--;242 }243 }244 });245 });246 var tiles = [];247 //PROCESS ALL TILES248 data.d.results.forEach(function(oCatalog) {249 250 oCatalog.Chips.results.forEach(function(tile)251 {252 if(!isTargetMapping(tile))253 {254 if (tile.configuration != "") 255 {256 //LOAD DATA257 var tile_config = JSON.parse(tile.configuration);258 var mytile = JSON.parse(tile_config.tileConfiguration);259 var mytype = "";260 //HANDLE SSB ANALYTICAL TILES261 if(mytile.TILE_PROPERTIES)262 {263 mytile = JSON.parse(mytile.TILE_PROPERTIES);264 mytile.semantic_object = mytile.semanticObject;265 mytile.semantic_action = mytile.semanticAction;266 myappid = "#" + mytile.semantic_object + "-" + mytile.semantic_action;267 evaluationId = mytile.evaluationId268 if(evaluationId && evaluationId != "")269 {myappid += "?EvaluationId="+evaluationId;}270 }271 else272 {273 mytile.semantic_object = mytile.navigation_semantic_object;274 mytile.semantic_action = mytile.navigation_semantic_action;275 myappid = mytile.navigation_target_url;276 }277 if(myappid.includes("GUI") || myappid.includes("uitype=advanced"))278 mytype = "TR";279 if(myappid.includes("WDA"))280 mytype = "WDA";281 //EXTRACT TITLE282 var mydesc = "";283 if(mytile.display_title_text && mytile.display_title_text != "" && mytile.display_title_text != "Analyze KPI Details")284 {mydesc = mytile.display_title_text;}285 else286 {mydesc = getTitlefromChips(tile);}287 var tile_obj = {288 catalogId: oCatalog.id.replace("X-SAP-UI2-CATALOGPAGE:", ""),289 catalogTitle: oCatalog.title,290 appid: myappid,291 semanticObject: mytile.semantic_object,292 semanticAction: mytile.semantic_action,293 desc: mydesc,294 type: mytype,295 category: "Tile",296 category_tech: tile.baseChipId,297 blacklist: "",298 tile: mytile299 };300 tiles.push(tile_obj);301 }302 else303 {304 that.logger.log('error', "["+that.user+"] Tile could not be parsed - no config for <"+tile.title+">");305 allChips--;306 }307 }308 });309 });310 //FIND TARGET MAPPING FOR TILE311 var merged = [];312 tiles.forEach(function(tile) {313 var found = false;314 var found_num = 0;315 target_mappings.forEach(function(target_mapping) {316 var type = tile.type;317 if(type == "")318 type = target_mapping.type;319 //CHECK IF IS A MATCH320 if(checkIfIsMatch(tile,target_mapping,type) && !found)321 {322 //OVERRIDE APPID IN CASE IT IS LONGER / HAS PARAMS323 newappid = target_mapping.appid;324 if(target_mapping.appid.length < tile.appid.length || target_mapping.appid.includes("*"))325 newappid = tile.appid;326 //OVERRIDE BLACKLIST IF MATCHED327 blacklist = target_mapping.blacklist;328 if(target_mapping.blacklist.includes("BLACKLISTED_MANDATORY_PARAM"))329 blacklist = "";330 var tileTM = {331 catalogId: target_mapping.catalogId,332 catalogTitle: target_mapping.catalogTitle,333 appid: newappid,334 semanticObject: tile.semanticObject,335 semanticAction: tile.semanticAction,336 desc: tile.desc,337 type: target_mapping.type,338 category: "TileTM",339 category_tech: tile.category_tech,340 ui5_component: target_mapping.ui5_component,341 url: target_mapping.url,342 blacklist: blacklist343 //tile: tile.tile,344 //targetmapping: target_mapping.targetmapping345 };346 if(that.logger.level == "silly")347 tileTM.targetmapping = target_mapping.targetmapping348 //Check if same catalog349 if(tile.catalogId != target_mapping.catalogId)350 {351 that.logger.log('warn', "["+that.user+"] Matched TM #"+tileTM.appid+", but not in same catalog! "+tile.catalogId+ " <> "+target_mapping.catalogId);352 }353 else354 {355 that.logger.log('debug', "["+that.user+"] Matched TM #"+tileTM.appid+" in same catalog! "+tile.catalogId+ " = "+target_mapping.catalogId);356 }357 if(IsDuplicate(tileTM,merged))358 {359 tileTM.blacklist += "BLACKLIST_DUPLICATE_TILE;";360 }361 merged.push(tileTM);362 found = true;363 found_num++;364 }365 });366 //CONSISTENCY CHECK1367 if(!found)368 {369 that.logger.log('error', '['+that.user+'] Tile could not be matched to any target mapping!', {370 details: tile.catalogId+ " -> "+tile.appid+ " (Tile Name <"+tile.desc+"> Object <"+tile.semanticObject+"> Action <"+tile.semanticAction+"> Type <"+tile.type+">)"371 })372 }373 if(found_num > 1)374 {375 that.logger.log('warn', '['+that.user+'] Multiple potential target mappings found for tile!', {376 details: tile.catalogId+ " -> "+tile.appid+ " (Tile Name <"+tile.desc+"> Object <"+tile.semanticObject+"> Action <"+tile.semanticAction+"> Type <"+tile.type+">)"377 })378 }379 });380 //ADD REMAINING TARGET MAPPINGS, FLAG DUPLICATE381 target_mappings.forEach(function(target_mapping) {382 if(IsDuplicate(target_mapping,merged))383 {384 target_mapping.blacklist += "BLACKLIST_DUPLICATE_TM;";385 }386 merged.push(target_mapping);387 });388 //APPLY BLACKLIST389 merged.forEach(function(merged) {390 if (merged.type === "TR") {391 that.logger.log('debug', '['+that.user+'] WebGUI Transaction ' + merged.appid + ' blacklisted!');392 merged.blacklist += "BLACKLISTED_TR;";393 }394 if (merged.type === "WDA") {395 that.logger.log('debug', '['+that.user+'] WDA Application ' + merged.appid + ' blacklisted!');396 merged.blacklist += "BLACKLISTED_WDA;";397 }398 if (merged.type === "URL") {399 that.logger.log('debug', '['+that.user+'] URL ' + merged.appid + ' blacklisted!');400 merged.blacklist += "BLACKLISTED_URL;";401 }402 403 if(StringInArray(merged.appid, app_excludes))404 {405 that.logger.log('debug', '['+that.user+'] Application ' + merged.appid + ' blacklisted! (Exclude List)');406 merged.blacklist += "BLACKLISTED_EXCLUDE_LIST;";407 }408 });409 //CONSISTENCY CHECK2410 that.logger.log('info', '['+that.user+'] Tiles found ' + tiles.length);411 that.logger.log('info', '['+that.user+'] Target Mappings found ' + target_mappings.length);412 that.logger.log('info', '['+that.user+'] Total Chips ' + allChips);413 var total = target_mappings.length + tiles.length;414 if(total != merged.length || total != allChips)415 {416 that.logger.log('error', '['+that.user+'] Data Processing inconsistent, as # tiles and # target mappings do not match!', {417 details: "Sum Tiles/TargetMapping "+total+ " -> Merged Actual "+merged.length+" -> Target "+ allChips418 })419 }420 //return target_mappings;421 //return tiles;422 return merged;423};424//function filterByNotBlacklisted(item)425utilsabapflp.prototype.filterByNotBlacklisted = function(item)426{427 return item.blacklist == "";428};429module.exports = {430 utilsabapflp: utilsabapflp,431 getSuffix: getSuffix...

Full Screen

Full Screen

parse-dashboard-config.js

Source:parse-dashboard-config.js Github

copy

Full Screen

1module.exports = function() {2 const config = {3 "apps": [{4 "serverURL": process.env.SERVER_URL || "http://localhost:1337/parse",5 "appId": process.env.APP_ID || "myAppId",6 "masterKey": process.env.MASTER_KEY || "myMasterKey",7 "readOnlyMasterKey": process.env.READ_ONLY_MASTER_KEY || "myReadOnlyMasterKey",8 "appName": "MYAPP",9 "production": true10 }],11 "users": [{12 "user": "admin",13 "pass": "nimda",14 "apps": [{ "appId": "myAppId" }]15 }, {16 "user": "viewer",17 "pass": "reweiv",18 "apps": [{ "appId": "myAppId", "readOnly": true }]19 }],20 "trustProxy": true,21 "useEncryptedPasswords": false22 }23 return config;...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { myAppId } from 'ng-mocks';2describe('TestComponent', () => {3 let component: TestComponent;4 let fixture: ComponentFixture<TestComponent>;5 beforeEach(async(() => {6 TestBed.configureTestingModule({7 imports: [MatButtonModule, MatIconModule, MatMenuModule],8 }).compileComponents();9 }));10 beforeEach(() => {11 fixture = TestBed.createComponent(TestComponent);12 component = fixture.componentInstance;13 fixture.detectChanges();14 });15 it('should create', () => {16 expect(component).toBeTruthy();17 });18 it('should have a menu button', () => {19 expect(myAppId('menu-button')).toBeTruthy();20 });21});22import { Component, OnInit } from '@angular/core';23@Component({24})25export class TestComponent implements OnInit {26 constructor() {}27 ngOnInit(): void {}28}

Full Screen

Using AI Code Generation

copy

Full Screen

1import { myAppId } from 'ng-mocks';2describe('AppComponent', () => {3 beforeEach(async(() => {4 TestBed.configureTestingModule({5 imports: [RouterTestingModule],6 }).compileComponents();7 }));8 it('should create the app', () => {9 const fixture = TestBed.createComponent(AppComponent);10 const app = fixture.debugElement.componentInstance;11 expect(app).toBeTruthy();12 });13 it('should render title in a h1 tag', () => {14 const fixture = TestBed.createComponent(AppComponent);15 fixture.detectChanges();16 const compiled = fixture.debugElement.nativeElement;17 expect(compiled.querySelector(myAppId).textContent).toContain('Welcome to myApp!');18 });19});20import { Component } from '@angular/core';21@Component({22})23export class AppComponent {24 title = 'myApp';25}26<h1 data-app-id="my-app-title">Welcome to {{ title }}!</h1>27h1[data-app-id="my-app-title"] {28 color: #369;29 font-family: Arial, Helvetica, sans-serif;30 font-size: 250%;31}32import { myAppId } from 'ng-mocks';33describe('AppComponent', () => {34 beforeEach(async(() => {35 TestBed.configureTestingModule({36 imports: [RouterTestingModule],37 }).compileComponents();38 }));39 it('should create the app', () => {40 const fixture = TestBed.createComponent(AppComponent);41 const app = fixture.debugElement.componentInstance;42 expect(app).toBeTruthy();43 });44 it('should render title in a h1 tag', () => {45 const fixture = TestBed.createComponent(AppComponent);46 fixture.detectChanges();47 const compiled = fixture.debugElement.nativeElement;48 expect(compiled.querySelector(myAppId).textContent).toContain('Welcome to myApp!');49 });50});51import { Component } from '@angular/core';52@Component({53})54export class AppComponent {

Full Screen

Using AI Code Generation

copy

Full Screen

1import { myAppId } from 'ng-mocks';2import { AppComponent } from './app.component';3describe('AppComponent', () => {4 it('should render title', () => {5 const fixture = TestBed.createComponent(AppComponent);6 fixture.detectChanges();7 const compiled = fixture.nativeElement;8 expect(myAppId(compiled, 'title')).toBeTruthy();9 });10});11<h1 data-app-id="title">{{ title }}</h1>12import { Component } from '@angular/core';13@Component({14})15export class AppComponent {16 title = 'my-app';17}18import { TestBed } from '@angular/core/testing';19import { RouterTestingModule } from '@angular/router/testing';20import { AppComponent } from './app.component';21describe('AppComponent', () => {22 beforeEach(async () => {23 await TestBed.configureTestingModule({24 imports: [25 }).compileComponents();26 });27 it('should create the app', () => {28 const fixture = TestBed.createComponent(AppComponent);29 const app = fixture.componentInstance;30 expect(app).toBeTruthy();31 });32 it(`should have as title 'my-app'`, () => {33 const fixture = TestBed.createComponent(AppComponent);34 const app = fixture.componentInstance;35 expect(app.title).toEqual('my-app');36 });37 it('should render title', () => {38 const fixture = TestBed.createComponent(AppComponent);39 fixture.detectChanges();40 const compiled = fixture.nativeElement;41 expect(compiled.querySelector('[data-app-id="title"]').textContent).toContain('my-app');42 });43});44h1[data-app-id="title"] {45 color: #369;46 font-family: Arial, Helvetica, sans-serif;47 font-size: 250%;48}49module.exports = function (config) {50 config.set({51 { pattern: 'src/**/*.ts' },52 { pattern: 'test/**/*.ts' },53 preprocessors: {54 },

Full Screen

Using AI Code Generation

copy

Full Screen

1import { myAppId } from 'ng-mocks';2import { myAppId } from 'ng-mocks';3import { myAppId } from 'ng-mocks';4import { myAppId } from 'ng-mocks';5import { myAppId } from 'ng-mocks';6import { myAppId } from 'ng-mocks';7import { myAppId } from 'ng-mocks';8import { myAppId } from 'ng-mocks';9import { myAppId } from 'ng-mocks';10import { myAppId } from 'ng-mocks';11import { myAppId } from 'ng-mocks';12import { myAppId } from 'ng-mocks';13import { myAppId } from 'ng-mocks';14import { myAppId } from 'ng-mocks';15import { myAppId } from 'ng-mocks';16import { myAppId } from 'ng-mocks';17import { myAppId } from 'ng-mocks';18import { myAppId } from 'ng-mocks';

Full Screen

Using AI Code Generation

copy

Full Screen

1import { myAppId } from "ng-mocks";2describe("AppComponent", () => {3 let component: AppComponent;4 let fixture: ComponentFixture<AppComponent>;5 beforeEach(async(() => {6 TestBed.configureTestingModule({7 imports: [AppModule]8 }).compileComponents();9 }));10 beforeEach(() => {11 fixture = TestBed.createComponent(AppComponent);12 component = fixture.componentInstance;13 fixture.detectChanges();14 });15 it("should create", () => {16 expect(component).toBeTruthy();17 });18 it("should have expected <h1> text", () => {19 expect(h1.textContent).toContain("Welcome to app!");20 });21});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { myAppId } from 'ng-mocks';2import { myAppId } from 'ng-mocks/dist/lib/common/my-app-id';3import { myAppId } from 'ng-mocks/dist/lib/common/my-app-id/my-app-id';4import { myAppId } from 'ng-mocks/dist/lib/common/my-app-id/my-app-id';5import { myAppId } from 'ng-mocks/dist/lib/common/my-app-id/my-app-id/my-app-id';6import { myAppId } from 'ng-mocks/dist/lib/common/my-app-id/my-app-id/my-app-id';7import { myAppId } from 'ng-mocks/dist/lib/common/my-app-id/my-app-id/my-app-id/my-app-id';8import { myAppId } from 'ng-mocks/dist/lib/common/my-app-id/my-app-id/my-app-id/my-app-id';9import { myAppId } from 'ng-mocks/dist/lib/common/my-app-id/my-app-id/my-app-id/my-app-id/my-app-id';10import { myAppId } from 'ng-mocks/dist/lib/common/my-app-id/my-app-id/my-app-id/my-app-id/my-app-id';11import { myAppId } from 'ng-mocks/dist/lib/common/my-app-id/my-app-id/my-app-id/my-app-id/my-app-id/my-app-id';12import { myAppId } from 'ng-mocks/dist/lib/common/my-app-id/my-app-id/my-app-id/my-app-id/my-app-id/my-app-id';13import { myAppId } from

Full Screen

Using AI Code Generation

copy

Full Screen

1import { myAppId } from 'ng-mocks';2import { getMock } from 'ng-mocks';3import { mockProvider } from 'ng-mocks';4import { mockPipe } from 'ng-mocks';5import { mockProvider } from 'ng-mocks';6import { mockRender } from 'ng-mocks';7import { mockReset } from 'ng-mocks';8import { mockService } from 'ng-mocks';9import { mockPipe } from 'ng-mocks';10import { mockProvider } from 'ng-mocks';11import { mockRender } from 'ng-mocks';12import { mockReset } from 'ng-mocks';

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ng-mocks automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful