How to use resolved method in storybook-root

Best JavaScript code snippet using storybook-root

messagingconScript.js

Source:messagingconScript.js Github

copy

Full Screen

1// variables that are used for pulling the api information from the browser storage2var consumerKey = 0;3var accountNum = 0;4var consumerSecret = 0;5var accessToken = 0;6var accessTokenSecret = 0;7var msgConskillSelect = 1;8var msgConskillIDList = null;9var msgConagentIDList = null;10var msgConAgentSelect = 1;11var msgConRange = 1;12getLocalStorageVariables();13//variable for the list of agents14var agentList = null;15//variable for the list of skills16var skillList = null;17$(document).ready(function() {18 setupTables();19 setTimeout(function() {20 var sel = 'div[role="main"]';21 agentList = angular.element(sel).scope().listUsers();22 skillList = angular.element(sel).scope().listSkills();23 getData();24 }, 100);25});26/**27 * @desc calls the messaging csat api28 * @return undefined29 */30function getData() {31 var oTable = $('#example').DataTable();32 $.ajax({33 type: 'GET',34 url: '/messagingConversation?cKey=' + consumerKey + '&accNum=' + accountNum + '&cSec=' + consumerSecret + '&tok=' + accessToken + '&tSec=' + accessTokenSecret + '&skill=' + msgConskillIDList + '&skS=' + msgConskillSelect + '&agent=' + msgConagentIDList + '&agS=' + msgConAgentSelect + '&range=' + msgConRange,35 success: function(data) {36 if (data.Fail != "undefined" && data.Fail != "404") {37 updateMessagingConData(data);38 } else {39 //window.location.href = "/error";40 $('#myModal2').modal('show');41 $('#errorDetails').html(JSON.stringify(data.Error));42 }43 }44 });45}46/**47 * @desc gets the api settings from the browser local storage48 * @return undefined49 */50function getLocalStorageVariables() {51 // Check browser support52 if (typeof(Storage) !== "undefined") {53 consumerKey = localStorage.getItem("consumerKeyM");54 accountNum = localStorage.getItem("accountNumM");55 consumerSecret = localStorage.getItem("consumerSecretM");56 accessToken = localStorage.getItem("accessTokenM");57 accessTokenSecret = localStorage.getItem("accessTokenSecretM");58 msgConskillSelect = localStorage.getItem("msgConskillSelect");59 msgConskillIDList = localStorage.getItem("msgConskillIDList");60 msgConagentIDList = localStorage.getItem("msgConagentIDList");61 msgConAgentSelect = localStorage.getItem("msgConAgentSelect");62 msgConRange = localStorage.getItem("msgConRange");63 } else {64 console.log("Sorry, your browser does not support Web Storage...");65 }66 return;67}68/**69 * @desc initializes the datatables70 * @return undefined71 */72function setupTables() {73 $('#example').DataTable({74 "initComplete": function(settings) {75 /* Apply the tooltips */76 $('#example thead th[title]').tooltip({77 "container": 'body'78 });79 },80 dom: 'Blfrtip',81 buttons: [82 'copy', 'csv', 'excel', 'print'83 ],84 aLengthMenu: [85 [10, 25, 50, 100, -1],86 [10, 25, 50, 100, "All"]87 ]88 });89 $('#example2').DataTable({90 "initComplete": function(settings) {91 /* Apply the tooltips */92 $('#example2 thead th[title]').tooltip({93 "container": 'body'94 });95 },96 dom: 'Blfrtip',97 buttons: [98 'copy', 'csv', 'excel', 'print'99 ],100 aLengthMenu: [101 [10, 25, 50, 100, -1],102 [10, 25, 50, 100, "All"]103 ]104 });105 $('#example3').DataTable({106 "initComplete": function(settings) {107 /* Apply the tooltips */108 $('#example3 thead th[title]').tooltip({109 "container": 'body'110 });111 },112 dom: 'Blfrtip',113 buttons: [114 'copy', 'csv', 'excel', 'print'115 ],116 aLengthMenu: [117 [10, 25, 50, 100, -1],118 [10, 25, 50, 100, "All"]119 ]120 });121 // hide the tables 122 $('#table1').hide();123 $('#table2').hide();124 $('#table3').hide();125}126/**127 * @desc updates the data table and the current queue dashboard with the data from the messaging csat api128 * @param data - JSON Object that is returned from the messaging csat API129 * @return undefined130 */131function updateMessagingConData(data) {132 var oTable = $('#example').DataTable();133 var oTable2 = $('#example2').DataTable();134 var oTable3 = $('#example3').DataTable();135 oTable136 .clear()137 .draw();138 oTable2139 .clear()140 .draw();141 oTable3142 .clear()143 .draw();144 var skillId = "";145 var agentId = "";146 var avgTime_resolvedConversations = 0;147 var avgTime_resolvedConversations_byCCP = 0;148 var avgTime_resolvedConversations_byConsumer = 0;149 var avgTime_resolvedConversations_bySystem = 0;150 var resolvedConversations_byCCP = 0;151 var resolvedConversations_byConsumer = 0;152 var resolvedConversations_bySystem = 0;153 var totalHandlingTime_resolvedConversations = 0;154 var totalHandlingTime_resolvedConversations_byCCP = 0;155 var totalHandlingTime_resolvedConversations_byConsumer = 0;156 var totalHandlingTime_resolvedConversations_bySystem = 0;157 var totalResolvedConversations = 0;158 if (data.hasOwnProperty("metricsTotals")) {159 $('#table3').show();160 avgTime_resolvedConversations = data.metricsTotals.avgTime_resolvedConversations;161 avgTime_resolvedConversations_byCCP = data.metricsTotals.avgTime_resolvedConversations_byCCP;162 avgTime_resolvedConversations_byConsumer = data.metricsTotals.avgTime_resolvedConversations_byConsumer;163 avgTime_resolvedConversations_bySystem = data.metricsTotals.avgTime_resolvedConversations_bySystem;164 resolvedConversations_byCCP = data.metricsTotals.resolvedConversations_byCCP;165 resolvedConversations_byConsumer = data.metricsTotals.resolvedConversations_byConsumer;166 resolvedConversations_bySystem = data.metricsTotals.resolvedConversations_bySystem;167 totalHandlingTime_resolvedConversations = data.metricsTotals.totalHandlingTime_resolvedConversations;168 totalHandlingTime_resolvedConversations_byCCP = data.metricsTotals.totalHandlingTime_resolvedConversations_byCCP;169 totalHandlingTime_resolvedConversations_byConsumer = data.metricsTotals.totalHandlingTime_resolvedConversations_byConsumer;170 totalHandlingTime_resolvedConversations_bySystem = data.metricsTotals.totalHandlingTime_resolvedConversations_bySystem;171 totalResolvedConversations = data.metricsTotals.totalResolvedConversations;172 avgTime_resolvedConversations = secondsToHms(avgTime_resolvedConversations/1000);173 avgTime_resolvedConversations_byCCP = secondsToHms(avgTime_resolvedConversations_byCCP/1000);174 avgTime_resolvedConversations_byConsumer = secondsToHms(avgTime_resolvedConversations_byConsumer/1000);175 avgTime_resolvedConversations_bySystem = secondsToHms(avgTime_resolvedConversations_bySystem/1000);176 totalHandlingTime_resolvedConversations = secondsToHms(totalHandlingTime_resolvedConversations/1000);177 totalHandlingTime_resolvedConversations_byCCP = secondsToHms(totalHandlingTime_resolvedConversations_byCCP/1000);178 totalHandlingTime_resolvedConversations_byConsumer = secondsToHms(totalHandlingTime_resolvedConversations_byConsumer/1000);179 totalHandlingTime_resolvedConversations_bySystem = secondsToHms(totalHandlingTime_resolvedConversations_bySystem/1000);180 oTable3.row.add([totalResolvedConversations, resolvedConversations_byCCP, resolvedConversations_byConsumer, resolvedConversations_bySystem, avgTime_resolvedConversations, avgTime_resolvedConversations_byCCP, avgTime_resolvedConversations_byConsumer, avgTime_resolvedConversations_bySystem,totalHandlingTime_resolvedConversations, totalHandlingTime_resolvedConversations_byCCP, totalHandlingTime_resolvedConversations_byConsumer, totalHandlingTime_resolvedConversations_bySystem]).draw();181 }182 if (data.hasOwnProperty("agentsMetrics")) {183 $('#table2').show();184 if (data.agentsMetrics.hasOwnProperty("metricsPerAgent")) {185 for (var agent in data.agentsMetrics.metricsPerAgent) {186 skillId = "All";187 if (agentList.hasOwnProperty(agent)) {188 agentId = agentList[agent].nickname;189 } else {190 agentId = agent;191 }192 avgTime_resolvedConversations = data.agentsMetrics.metricsPerAgent[agent].avgTime_resolvedConversations;193 avgTime_resolvedConversations_byCCP = data.agentsMetrics.metricsPerAgent[agent].avgTime_resolvedConversations_byCCP;194 avgTime_resolvedConversations_byConsumer = data.agentsMetrics.metricsPerAgent[agent].avgTime_resolvedConversations_byConsumer;195 avgTime_resolvedConversations_bySystem = data.agentsMetrics.metricsPerAgent[agent].avgTime_resolvedConversations_bySystem;196 resolvedConversations_byCCP = data.agentsMetrics.metricsPerAgent[agent].resolvedConversations_byCCP;197 resolvedConversations_byConsumer = data.agentsMetrics.metricsPerAgent[agent].resolvedConversations_byConsumer;198 resolvedConversations_bySystem = data.agentsMetrics.metricsPerAgent[agent].resolvedConversations_bySystem;199 totalHandlingTime_resolvedConversations = data.agentsMetrics.metricsPerAgent[agent].totalHandlingTime_resolvedConversations;200 totalHandlingTime_resolvedConversations_byCCP = data.agentsMetrics.metricsPerAgent[agent].totalHandlingTime_resolvedConversations_byCCP;201 totalHandlingTime_resolvedConversations_byConsumer = data.agentsMetrics.metricsPerAgent[agent].totalHandlingTime_resolvedConversations_byConsumer;202 totalHandlingTime_resolvedConversations_bySystem = data.agentsMetrics.metricsPerAgent[agent].totalHandlingTime_resolvedConversations_bySystem;203 totalResolvedConversations = data.agentsMetrics.metricsPerAgent[agent].totalResolvedConversations;204 avgTime_resolvedConversations = secondsToHms(avgTime_resolvedConversations/1000);205 avgTime_resolvedConversations_byCCP = secondsToHms(avgTime_resolvedConversations_byCCP/1000);206 avgTime_resolvedConversations_byConsumer = secondsToHms(avgTime_resolvedConversations_byConsumer/1000);207 avgTime_resolvedConversations_bySystem = secondsToHms(avgTime_resolvedConversations_bySystem/1000);208 totalHandlingTime_resolvedConversations = secondsToHms(totalHandlingTime_resolvedConversations/1000);209 totalHandlingTime_resolvedConversations_byCCP = secondsToHms(totalHandlingTime_resolvedConversations_byCCP/1000);210 totalHandlingTime_resolvedConversations_byConsumer = secondsToHms(totalHandlingTime_resolvedConversations_byConsumer/1000);211 totalHandlingTime_resolvedConversations_bySystem = secondsToHms(totalHandlingTime_resolvedConversations_bySystem/1000);212 oTable2.row.add([agentId, totalResolvedConversations, resolvedConversations_byCCP, resolvedConversations_byConsumer, resolvedConversations_bySystem, avgTime_resolvedConversations, avgTime_resolvedConversations_byCCP, avgTime_resolvedConversations_byConsumer, avgTime_resolvedConversations_bySystem,totalHandlingTime_resolvedConversations, totalHandlingTime_resolvedConversations_byCCP, totalHandlingTime_resolvedConversations_byConsumer, totalHandlingTime_resolvedConversations_bySystem]).draw();213 }214 }215 if (data.agentsMetrics.hasOwnProperty("metricsTotals")) {216 agentId = "All";217 avgTime_resolvedConversations = data.agentsMetrics.metricsTotals.avgTime_resolvedConversations;218 avgTime_resolvedConversations_byCCP = data.agentsMetrics.metricsTotals.avgTime_resolvedConversations_byCCP;219 avgTime_resolvedConversations_byConsumer = data.agentsMetrics.metricsTotals.avgTime_resolvedConversations_byConsumer;220 avgTime_resolvedConversations_bySystem = data.agentsMetrics.metricsTotals.avgTime_resolvedConversations_bySystem;221 resolvedConversations_byCCP = data.agentsMetrics.metricsTotals.resolvedConversations_byCCP;222 resolvedConversations_byConsumer = data.agentsMetrics.metricsTotals.resolvedConversations_byConsumer;223 resolvedConversations_bySystem = data.agentsMetrics.metricsTotals.resolvedConversations_bySystem;224 totalHandlingTime_resolvedConversations = data.agentsMetrics.metricsTotals.totalHandlingTime_resolvedConversations;225 totalHandlingTime_resolvedConversations_byCCP = data.agentsMetrics.metricsTotals.totalHandlingTime_resolvedConversations_byCCP;226 totalHandlingTime_resolvedConversations_byConsumer = data.agentsMetrics.metricsTotals.totalHandlingTime_resolvedConversations_byConsumer;227 totalHandlingTime_resolvedConversations_bySystem = data.agentsMetrics.metricsTotals.totalHandlingTime_resolvedConversations_bySystem;228 totalResolvedConversations = data.agentsMetrics.metricsTotals.totalResolvedConversations;229 avgTime_resolvedConversations = secondsToHms(avgTime_resolvedConversations/1000);230 avgTime_resolvedConversations_byCCP = secondsToHms(avgTime_resolvedConversations_byCCP/1000);231 avgTime_resolvedConversations_byConsumer = secondsToHms(avgTime_resolvedConversations_byConsumer/1000);232 avgTime_resolvedConversations_bySystem = secondsToHms(avgTime_resolvedConversations_bySystem/1000);233 totalHandlingTime_resolvedConversations = secondsToHms(totalHandlingTime_resolvedConversations/1000);234 totalHandlingTime_resolvedConversations_byCCP = secondsToHms(totalHandlingTime_resolvedConversations_byCCP/1000);235 totalHandlingTime_resolvedConversations_byConsumer = secondsToHms(totalHandlingTime_resolvedConversations_byConsumer/1000);236 totalHandlingTime_resolvedConversations_bySystem = secondsToHms(totalHandlingTime_resolvedConversations_bySystem/1000);237 oTable2.row.add([agentId, totalResolvedConversations, resolvedConversations_byCCP, resolvedConversations_byConsumer, resolvedConversations_bySystem, avgTime_resolvedConversations, avgTime_resolvedConversations_byCCP, avgTime_resolvedConversations_byConsumer, avgTime_resolvedConversations_bySystem,totalHandlingTime_resolvedConversations, totalHandlingTime_resolvedConversations_byCCP, totalHandlingTime_resolvedConversations_byConsumer, totalHandlingTime_resolvedConversations_bySystem]).draw();238 }239 }240 if (data.hasOwnProperty("skillsMetricsPerAgent")) {241 $('#table1').show();242 if (data.skillsMetricsPerAgent.hasOwnProperty("metricsPerSkill")) {243 for (var skill in data.skillsMetricsPerAgent.metricsPerSkill) {244 if (skillList.hasOwnProperty(skill)) {245 skillId = skillList[skill];246 } else {247 if (skill == -1) {248 skillId = "Unassigned"249 } else {250 skillId = skill;251 }252 }253 if (data.skillsMetricsPerAgent.metricsPerSkill[skill].hasOwnProperty("metricsPerAgent")) {254 for (var agent in data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsPerAgent) {255 if (agentList.hasOwnProperty(agent)) {256 agentId = agentList[agent].nickname;257 } else {258 agentId = agent;259 }260 avgTime_resolvedConversations = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsPerAgent[agent].avgTime_resolvedConversations;261 avgTime_resolvedConversations_byCCP = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsPerAgent[agent].avgTime_resolvedConversations_byCCP;262 avgTime_resolvedConversations_byConsumer = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsPerAgent[agent].avgTime_resolvedConversations_byConsumer;263 avgTime_resolvedConversations_bySystem = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsPerAgent[agent].avgTime_resolvedConversations_bySystem;264 resolvedConversations_byCCP = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsPerAgent[agent].resolvedConversations_byCCP;265 resolvedConversations_byConsumer = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsPerAgent[agent].resolvedConversations_byConsumer;266 resolvedConversations_bySystem = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsPerAgent[agent].resolvedConversations_bySystem;267 totalHandlingTime_resolvedConversations = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsPerAgent[agent].totalHandlingTime_resolvedConversations;268 totalHandlingTime_resolvedConversations_byCCP = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsPerAgent[agent].totalHandlingTime_resolvedConversations_byCCP;269 totalHandlingTime_resolvedConversations_byConsumer = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsPerAgent[agent].totalHandlingTime_resolvedConversations_byConsumer;270 totalHandlingTime_resolvedConversations_bySystem = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsPerAgent[agent].totalHandlingTime_resolvedConversations_bySystem;271 totalResolvedConversations = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsPerAgent[agent].totalResolvedConversations;272 avgTime_resolvedConversations = secondsToHms(avgTime_resolvedConversations/1000);273 avgTime_resolvedConversations_byCCP = secondsToHms(avgTime_resolvedConversations_byCCP/1000);274 avgTime_resolvedConversations_byConsumer = secondsToHms(avgTime_resolvedConversations_byConsumer/1000);275 avgTime_resolvedConversations_bySystem = secondsToHms(avgTime_resolvedConversations_bySystem/1000);276 totalHandlingTime_resolvedConversations = secondsToHms(totalHandlingTime_resolvedConversations/1000);277 totalHandlingTime_resolvedConversations_byCCP = secondsToHms(totalHandlingTime_resolvedConversations_byCCP/1000);278 totalHandlingTime_resolvedConversations_byConsumer = secondsToHms(totalHandlingTime_resolvedConversations_byConsumer/1000);279 totalHandlingTime_resolvedConversations_bySystem = secondsToHms(totalHandlingTime_resolvedConversations_bySystem/1000);280 oTable.row.add([skillId, agentId, totalResolvedConversations, resolvedConversations_byCCP, resolvedConversations_byConsumer, resolvedConversations_bySystem, avgTime_resolvedConversations, avgTime_resolvedConversations_byCCP, avgTime_resolvedConversations_byConsumer, avgTime_resolvedConversations_bySystem,totalHandlingTime_resolvedConversations, totalHandlingTime_resolvedConversations_byCCP, totalHandlingTime_resolvedConversations_byConsumer, totalHandlingTime_resolvedConversations_bySystem]).draw();281 }282 }283 if (data.skillsMetricsPerAgent.metricsPerSkill[skill].hasOwnProperty("metricsTotals")) {284 agentId = "All";285 avgTime_resolvedConversations = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsTotals.avgTime_resolvedConversations;286 avgTime_resolvedConversations_byCCP = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsTotals.avgTime_resolvedConversations_byCCP;287 avgTime_resolvedConversations_byConsumer = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsTotals.avgTime_resolvedConversations_byConsumer;288 avgTime_resolvedConversations_bySystem = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsTotals.avgTime_resolvedConversations_bySystem;289 resolvedConversations_byCCP = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsTotals.resolvedConversations_byCCP;290 resolvedConversations_byConsumer = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsTotals.resolvedConversations_byConsumer;291 resolvedConversations_bySystem = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsTotals.resolvedConversations_bySystem;292 totalHandlingTime_resolvedConversations = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsTotals.totalHandlingTime_resolvedConversations;293 totalHandlingTime_resolvedConversations_byCCP = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsTotals.totalHandlingTime_resolvedConversations_byCCP;294 totalHandlingTime_resolvedConversations_byConsumer = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsTotals.totalHandlingTime_resolvedConversations_byConsumer;295 totalHandlingTime_resolvedConversations_bySystem = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsTotals.totalHandlingTime_resolvedConversations_bySystem;296 totalResolvedConversations = data.skillsMetricsPerAgent.metricsPerSkill[skill].metricsTotals.totalResolvedConversations;297 298 avgTime_resolvedConversations = secondsToHms(avgTime_resolvedConversations/1000);299 avgTime_resolvedConversations_byCCP = secondsToHms(avgTime_resolvedConversations_byCCP/1000);300 avgTime_resolvedConversations_byConsumer = secondsToHms(avgTime_resolvedConversations_byConsumer/1000);301 avgTime_resolvedConversations_bySystem = secondsToHms(avgTime_resolvedConversations_bySystem/1000);302 totalHandlingTime_resolvedConversations = secondsToHms(totalHandlingTime_resolvedConversations/1000);303 totalHandlingTime_resolvedConversations_byCCP = secondsToHms(totalHandlingTime_resolvedConversations_byCCP/1000);304 totalHandlingTime_resolvedConversations_byConsumer = secondsToHms(totalHandlingTime_resolvedConversations_byConsumer/1000);305 totalHandlingTime_resolvedConversations_bySystem = secondsToHms(totalHandlingTime_resolvedConversations_bySystem/1000);306 oTable.row.add([skillId, agentId, totalResolvedConversations, resolvedConversations_byCCP, resolvedConversations_byConsumer, resolvedConversations_bySystem, avgTime_resolvedConversations, avgTime_resolvedConversations_byCCP, avgTime_resolvedConversations_byConsumer, avgTime_resolvedConversations_bySystem,totalHandlingTime_resolvedConversations, totalHandlingTime_resolvedConversations_byCCP, totalHandlingTime_resolvedConversations_byConsumer, totalHandlingTime_resolvedConversations_bySystem]).draw();307 }308 }309 }310 if (data.skillsMetricsPerAgent.hasOwnProperty("metricsTotals")) {311 skillId = "All";312 agentId = "All";313 avgTime_resolvedConversations = data.skillsMetricsPerAgent.metricsTotals.avgTime_resolvedConversations;314 avgTime_resolvedConversations_byCCP = data.skillsMetricsPerAgent.metricsTotals.avgTime_resolvedConversations_byCCP;315 avgTime_resolvedConversations_byConsumer = data.skillsMetricsPerAgent.metricsTotals.avgTime_resolvedConversations_byConsumer;316 avgTime_resolvedConversations_bySystem = data.skillsMetricsPerAgent.metricsTotals.avgTime_resolvedConversations_bySystem;317 resolvedConversations_byCCP = data.skillsMetricsPerAgent.metricsTotals.resolvedConversations_byCCP;318 resolvedConversations_byConsumer = data.skillsMetricsPerAgent.metricsTotals.resolvedConversations_byConsumer;319 resolvedConversations_bySystem = data.skillsMetricsPerAgent.metricsTotals.resolvedConversations_bySystem;320 totalHandlingTime_resolvedConversations = data.skillsMetricsPerAgent.metricsTotals.totalHandlingTime_resolvedConversations;321 totalHandlingTime_resolvedConversations_byCCP = data.skillsMetricsPerAgent.metricsTotals.totalHandlingTime_resolvedConversations_byCCP;322 totalHandlingTime_resolvedConversations_byConsumer = data.skillsMetricsPerAgent.metricsTotals.totalHandlingTime_resolvedConversations_byConsumer;323 totalHandlingTime_resolvedConversations_bySystem = data.skillsMetricsPerAgent.metricsTotals.totalHandlingTime_resolvedConversations_bySystem;324 totalResolvedConversations = data.skillsMetricsPerAgent.metricsTotals.totalResolvedConversations;325 326 avgTime_resolvedConversations = secondsToHms(avgTime_resolvedConversations/1000);327 avgTime_resolvedConversations_byCCP = secondsToHms(avgTime_resolvedConversations_byCCP/1000);328 avgTime_resolvedConversations_byConsumer = secondsToHms(avgTime_resolvedConversations_byConsumer/1000);329 avgTime_resolvedConversations_bySystem = secondsToHms(avgTime_resolvedConversations_bySystem/1000);330 totalHandlingTime_resolvedConversations = secondsToHms(totalHandlingTime_resolvedConversations/1000);331 totalHandlingTime_resolvedConversations_byCCP = secondsToHms(totalHandlingTime_resolvedConversations_byCCP/1000);332 totalHandlingTime_resolvedConversations_byConsumer = secondsToHms(totalHandlingTime_resolvedConversations_byConsumer/1000);333 totalHandlingTime_resolvedConversations_bySystem = secondsToHms(totalHandlingTime_resolvedConversations_bySystem/1000);334 oTable.row.add([skillId, agentId, totalResolvedConversations, resolvedConversations_byCCP, resolvedConversations_byConsumer, resolvedConversations_bySystem, avgTime_resolvedConversations, avgTime_resolvedConversations_byCCP, avgTime_resolvedConversations_byConsumer, avgTime_resolvedConversations_bySystem,totalHandlingTime_resolvedConversations, totalHandlingTime_resolvedConversations_byCCP, totalHandlingTime_resolvedConversations_byConsumer, totalHandlingTime_resolvedConversations_bySystem]).draw(); 335 }336 }...

Full Screen

Full Screen

memfs.ts

Source:memfs.ts Github

copy

Full Screen

1import type { FileSystemDriver, FileSystemNode } from './index';2import { asyncIterator2ReadableStream } from '../../utils';3type MemNode = MemFile | MemDirectory;4interface MemFile {5 type: 'file';6 content: Blob;7 url: string | null;8 lock: Promise<unknown>;9}10interface MemDirectory {11 type: 'directory';12 content: Record<string, MemNode>;13}14function expectedExists(node: MemNode | null): asserts node is MemNode {15 if (!node)16 throw new Error('ENOTFOUND');17}18function expectedDirectory(node: MemNode): asserts node is MemDirectory {19 if (node.type !== 'directory')20 throw new Error('ENOTADIR');21}22function expectedFile(node: MemNode): asserts node is MemFile {23 if (node.type !== 'file')24 throw new Error('EISDIR');25}26export class MemFS implements FileSystemDriver {27 #filetree: MemDirectory = { type: 'directory', content: Object.create(null) };28 async resolveUri(path: string[]): Promise<string> {29 let resolved: MemNode = this.#filetree;30 for (const segment of path) {31 expectedDirectory(resolved);32 const found: MemNode | null = resolved.content[segment] || null;33 expectedExists(found);34 resolved = found;35 }36 expectedFile(resolved);37 return resolved.url ??= URL.createObjectURL(resolved.content);38 }39 async access(path: string[]): Promise<boolean> {40 let resolved: MemNode = this.#filetree;41 for (const segment of path) {42 expectedDirectory(resolved);43 const found: MemNode | null = resolved.content[segment] || null;44 if (!found)45 return false;46 resolved = found;47 }48 return true;49 }50 async readDir(path: string[]): Promise<ReadableStream<FileSystemNode>> {51 let resolved: MemNode = this.#filetree;52 for (const segment of path) {53 const found: MemNode | null = resolved.content[segment] || null;54 expectedExists(found);55 expectedDirectory(found);56 resolved = found;57 }58 return asyncIterator2ReadableStream(59 Object60 .entries(resolved.content)61 .map(([name, { type }]) => ({62 type,63 name64 }))[Symbol.iterator]()65 )66 }67 async readFile(path: string[], offset = 0, length?: number): Promise<ReadableStream<Uint8Array>> {68 let resolved: MemNode = this.#filetree;69 for (const segment of path) {70 expectedDirectory(resolved);71 const found: MemNode | null = resolved.content[segment] || null;72 expectedExists(found);73 resolved = found;74 }75 expectedFile(resolved);76 const file = resolved;77 const result = resolved.lock78 .catch(() => (new Error().stack, null))79 .then(() => file.content.slice(offset, length ? offset + length : undefined).stream());80 resolved.lock = result;81 return result;82 }83 async writeFile(path: string[], offset: 'before' | 'after' | 'override', create: boolean): Promise<WritableStream<Uint8Array>> {84 let parent = this.#filetree, resolved: MemNode | null = parent;85 for (let i = 0; i < path.length; i++) {86 const segment = path[i]!;87 if (resolved)88 expectedDirectory(resolved);89 else if (create)90 resolved = parent.content[path[i - 1]!] = { type: 'directory', content: Object.create(null) };91 else92 expectedExists(resolved);93 const found: MemNode | null = resolved.content[segment] || null;94 parent = resolved;95 resolved = found;96 }97 if (resolved)98 expectedFile(resolved);99 else if (create)100 resolved = parent.content[path[path.length - 1]!] = {101 type: 'file',102 content: new Blob([]),103 url: null,104 lock: Promise.resolve()105 };106 else107 expectedExists(resolved);108 const strategy = new ByteLengthQueuingStrategy({ highWaterMark: 65535 });109 const { readable, writable } = new TransformStream<Uint8Array, Uint8Array>({}, strategy, strategy);110 const file = resolved;111 const result = Promise.all([112 resolved.lock.catch(() => null),113 new Response(readable).blob()114 ])115 .then(([, blob]) => {116 let content;117 switch (offset) {118 case 'override':119 content = blob;120 break;121 case 'before':122 content = new Blob([blob, file.content]);123 break;124 case 'after':125 content = new Blob([file.content, blob]);126 break;127 }128 if (file.url)129 URL.revokeObjectURL(file.url);130 file.url = null;131 file.content = content;132 new Error().stack;133 });134 resolved.lock = result;135 return Promise.resolve(writable);136 }137 async deleteNode(path: string[], recursive: boolean): Promise<void> {138 let parent = this.#filetree, resolved: MemNode | null = this.#filetree;139 for (const segment of path) {140 if (!resolved)141 resolved = parent.content[segment] = { type: 'directory', content: Object.create(null) };142 else143 expectedDirectory(resolved);144 const found: MemNode | null = resolved.content[segment] || null;145 parent = resolved;146 resolved = found;147 }148 if (resolved)149 if (parent === resolved)150 throw new Error('EBUSY'); // cannot delete root151 else152 delete parent.content[path[path.length - 1]!];153 }...

Full Screen

Full Screen

resolved-options.js

Source:resolved-options.js Github

copy

Full Screen

1// Copyright 2013 the V8 project authors. All rights reserved.2// Redistribution and use in source and binary forms, with or without3// modification, are permitted provided that the following conditions are4// met:5//6// * Redistributions of source code must retain the above copyright7// notice, this list of conditions and the following disclaimer.8// * Redistributions in binary form must reproduce the above9// copyright notice, this list of conditions and the following10// disclaimer in the documentation and/or other materials provided11// with the distribution.12// * Neither the name of Google Inc. nor the names of its13// contributors may be used to endorse or promote products derived14// from this software without specific prior written permission.15//16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.27// Test if resolvedOptions() returns expected fields/values.28// Default (year, month, day) formatter.29var dtfDefault = Intl.DateTimeFormat('en-US');30var resolved = dtfDefault.resolvedOptions();31assertTrue(resolved.hasOwnProperty('locale'));32assertEquals('en-US', resolved.locale);33assertTrue(resolved.hasOwnProperty('numberingSystem'));34assertEquals('latn', resolved.numberingSystem);35assertTrue(resolved.hasOwnProperty('calendar'));36assertEquals('gregory', resolved.calendar);37assertTrue(resolved.hasOwnProperty('timeZone'));38assertEquals(getDefaultTimeZone(), resolved.timeZone);39// These are in by default.40assertTrue(resolved.hasOwnProperty('year'));41assertEquals('numeric', resolved.year);42assertTrue(resolved.hasOwnProperty('month'));43assertEquals('numeric', resolved.month);44assertTrue(resolved.hasOwnProperty('day'));45assertEquals('numeric', resolved.day);46// These shouldn't be in by default.47assertFalse(resolved.hasOwnProperty('era'));48assertFalse(resolved.hasOwnProperty('timeZoneName'));49assertFalse(resolved.hasOwnProperty('weekday'));50assertFalse(resolved.hasOwnProperty('hour12'));51assertFalse(resolved.hasOwnProperty('hour'));52assertFalse(resolved.hasOwnProperty('minute'));53assertFalse(resolved.hasOwnProperty('second'));54// Time formatter.55var dtfTime = Intl.DateTimeFormat(56 'sr-RS', {hour: 'numeric', minute: 'numeric', second: 'numeric'});57resolved = dtfTime.resolvedOptions();58assertTrue(resolved.hasOwnProperty('locale'));59assertTrue(resolved.hasOwnProperty('numberingSystem'));60assertTrue(resolved.hasOwnProperty('calendar'));61assertTrue(resolved.hasOwnProperty('timeZone'));62assertTrue(resolved.hasOwnProperty('hour12'));63assertEquals(false, resolved.hour12);64assertTrue(resolved.hasOwnProperty('hour'));65assertEquals('2-digit', resolved.hour);66assertTrue(resolved.hasOwnProperty('minute'));67assertEquals('2-digit', resolved.minute);68assertTrue(resolved.hasOwnProperty('second'));69assertEquals('2-digit', resolved.second);70// Didn't ask for them.71assertFalse(resolved.hasOwnProperty('year'));72assertFalse(resolved.hasOwnProperty('month'));73assertFalse(resolved.hasOwnProperty('day'));74assertFalse(resolved.hasOwnProperty('era'));75assertFalse(resolved.hasOwnProperty('timeZoneName'));76assertFalse(resolved.hasOwnProperty('weekday'));77// Full formatter.78var dtfFull = Intl.DateTimeFormat(79 'en-US', {weekday: 'short', era: 'short', year: 'numeric', month: 'short',80 day: 'numeric', hour: 'numeric', minute: 'numeric',81 second: 'numeric', timeZoneName: 'short', timeZone: 'UTC'});82resolved = dtfFull.resolvedOptions();83assertTrue(resolved.hasOwnProperty('locale'));84assertTrue(resolved.hasOwnProperty('numberingSystem'));85assertTrue(resolved.hasOwnProperty('calendar'));86assertTrue(resolved.hasOwnProperty('timeZone'));87assertTrue(resolved.hasOwnProperty('hour12'));88assertEquals(true, resolved.hour12);89assertTrue(resolved.hasOwnProperty('hour'));90assertTrue(resolved.hasOwnProperty('minute'));91assertTrue(resolved.hasOwnProperty('second'));92assertTrue(resolved.hasOwnProperty('year'));93assertTrue(resolved.hasOwnProperty('month'));94assertTrue(resolved.hasOwnProperty('day'));95assertTrue(resolved.hasOwnProperty('era'));96assertEquals('short', resolved.era);97assertTrue(resolved.hasOwnProperty('timeZoneName'));98assertEquals('short', resolved.timeZoneName);99assertTrue(resolved.hasOwnProperty('weekday'));...

Full Screen

Full Screen

reflective_provider.d.ts

Source:reflective_provider.d.ts Github

copy

Full Screen

1import { Type } from '../facade/lang';2import { Provider } from './provider';3import { ReflectiveKey } from './reflective_key';4/**5 * `Dependency` is used by the framework to extend DI.6 * This is internal to Angular and should not be used directly.7 */8export declare class ReflectiveDependency {9 key: ReflectiveKey;10 optional: boolean;11 lowerBoundVisibility: any;12 upperBoundVisibility: any;13 properties: any[];14 constructor(key: ReflectiveKey, optional: boolean, lowerBoundVisibility: any, upperBoundVisibility: any, properties: any[]);15 static fromKey(key: ReflectiveKey): ReflectiveDependency;16}17/**18 * An internal resolved representation of a {@link Provider} used by the {@link Injector}.19 *20 * It is usually created automatically by `Injector.resolveAndCreate`.21 *22 * It can be created manually, as follows:23 *24 * ### Example ([live demo](http://plnkr.co/edit/RfEnhh8kUEI0G3qsnIeT?p%3Dpreview&p=preview))25 *26 * ```typescript27 * var resolvedProviders = Injector.resolve([new Provider('message', {useValue: 'Hello'})]);28 * var injector = Injector.fromResolvedProviders(resolvedProviders);29 *30 * expect(injector.get('message')).toEqual('Hello');31 * ```32 *33 * @experimental34 */35export interface ResolvedReflectiveProvider {36 /**37 * A key, usually a `Type`.38 */39 key: ReflectiveKey;40 /**41 * Factory function which can return an instance of an object represented by a key.42 */43 resolvedFactories: ResolvedReflectiveFactory[];44 /**45 * Indicates if the provider is a multi-provider or a regular provider.46 */47 multiProvider: boolean;48}49/**50 * See {@link ResolvedReflectiveProvider} instead.51 *52 * @deprecated53 */54export interface ResolvedReflectiveBinding extends ResolvedReflectiveProvider {55}56export declare class ResolvedReflectiveProvider_ implements ResolvedReflectiveBinding {57 key: ReflectiveKey;58 resolvedFactories: ResolvedReflectiveFactory[];59 multiProvider: boolean;60 constructor(key: ReflectiveKey, resolvedFactories: ResolvedReflectiveFactory[], multiProvider: boolean);61 resolvedFactory: ResolvedReflectiveFactory;62}63/**64 * An internal resolved representation of a factory function created by resolving {@link Provider}.65 * @experimental66 */67export declare class ResolvedReflectiveFactory {68 /**69 * Factory function which can return an instance of an object represented by a key.70 */71 factory: Function;72 /**73 * Arguments (dependencies) to the `factory` function.74 */75 dependencies: ReflectiveDependency[];76 constructor(77 /**78 * Factory function which can return an instance of an object represented by a key.79 */80 factory: Function, 81 /**82 * Arguments (dependencies) to the `factory` function.83 */84 dependencies: ReflectiveDependency[]);85}86/**87 * Resolve a single provider.88 */89export declare function resolveReflectiveFactory(provider: Provider): ResolvedReflectiveFactory;90/**91 * Converts the {@link Provider} into {@link ResolvedProvider}.92 *93 * {@link Injector} internally only uses {@link ResolvedProvider}, {@link Provider} contains94 * convenience provider syntax.95 */96export declare function resolveReflectiveProvider(provider: Provider): ResolvedReflectiveProvider;97/**98 * Resolve a list of Providers.99 */100export declare function resolveReflectiveProviders(providers: Array<Type | Provider | {101 [k: string]: any;102} | any[]>): ResolvedReflectiveProvider[];103/**104 * Merges a list of ResolvedProviders into a list where105 * each key is contained exactly once and multi providers106 * have been merged.107 */108export declare function mergeResolvedReflectiveProviders(providers: ResolvedReflectiveProvider[], normalizedProvidersMap: Map<number, ResolvedReflectiveProvider>): Map<number, ResolvedReflectiveProvider>;...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { configure } from '@storybook/react';2configure(require.context('../src', true, /\.stories\.js$/), module);3{4 "scripts": {5 }6}

Full Screen

Using AI Code Generation

copy

Full Screen

1import { resolve } from 'path';2import { root } from 'storybook-root';3const path = resolve(root, 'src', 'components', 'Button', 'Button.js');4import { configure } from '@storybook/react';5import { root } from 'storybook-root';6import '../test.js';7configure(require.context(root, true, /\.stories\.js$/), module);8const path = require('path');9const { root } = require('storybook-root');10const custom = require('../webpack.config.js');11module.exports = (baseConfig, env, defaultConfig) => {12 defaultConfig.module.rules.push({13 include: path.resolve(root, 'src'),14 {15 loader: require.resolve('babel-loader'),16 options: {17 },18 },19 });20 return defaultConfig;21};22import 'storybook-root/register';23import { root } from 'storybook-root';24import '../test.js';25import { addons } from '@storybook/addons';26import { root } from 'storybook-root';27import '../test.js';28 window.__STORYBOOK_ROOT__ = '{{root}}';29 console.log('Root:', window.__STORYBOOK_ROOT__);30 window.__STORYBOOK_ROOT__ = '{{root}}';31 console.log('Root:', window.__STORYBOOK_ROOT__);

Full Screen

Using AI Code Generation

copy

Full Screen

1import { storiesOf } from 'storybook-root';2import { storiesOf } from '../../../.storybook';3module . exports = { stories : [ '../src/**/*.stories.@(js|jsx|ts|tsx)' ] , addons : [ '@storybook/addon-links' , '@storybook/addon-essentials' ] , webpackFinal : async ( config ) => { config . resolve . alias [ 'storybook-root' ] = path . resolve ( __dirname , '../' ) ; return config ; } , } ;4module . exports = ( { config } ) => { config . resolve . alias [ 'storybook-root' ] = path . resolve ( __dirname , '../' ) ; return config ; } ;5module . exports = ( { config } ) => { config . resolve . alias [ '@storybook/addon-docs/blocks' ] = require . resolve ( '@storybook/addon-docs/blocks' ) ; return config ; } ;6module . exports = ( { config } ) => { config . resolve . alias [ '@storybook/addon-docs/dist/frameworks/common/config' ] = require . resolve ( '@storybook/addon-docs/dist/frameworks/common/config' ) ; return config ; } ;7module . exports = ( { config }

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 storybook-root 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