Best JavaScript code snippet using devicefarmer-stf
esd.js
Source:esd.js
1/**2 * Shopware 53 * Copyright (c) shopware AG4 *5 * According to our dual licensing model, this program can be used either6 * under the terms of the GNU Affero General Public License, version 3,7 * or under a proprietary license.8 *9 * The texts of the GNU Affero General Public License with an additional10 * permission and of our proprietary license can be found at and11 * in the LICENSE file you have received along with this program.12 *13 * This program is distributed in the hope that it will be useful,14 * but WITHOUT ANY WARRANTY; without even the implied warranty of15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 * GNU Affero General Public License for more details.17 *18 * "Shopware" is a registered trademark of shopware AG.19 * The licensing of the program under the AGPLv3 does not imply a20 * trademark license. Therefore any rights, title and interest in21 * our trademarks remain entirely with us.22 *23 * @category Shopware24 * @package Article25 * @subpackage Esd26 * @version $Id$27 * @author shopware AG28 */29/**30 * Shopware Controller - Article backend module31 */32//{namespace name=backend/article/view/main}33//{block name="backend/article/controller/esd"}34Ext.define('Shopware.apps.Article.controller.Esd', {35 /**36 * The parent class that this class extends.37 * @string38 */39 extend: 'Ext.app.Controller',40 /**41 * Set component references for easy access42 * @array43 */44 refs: [45 { ref: 'mainWindow', selector: 'article-detail-window' },46 { ref: 'saveButton', selector: 'article-detail-window button[name=save-article-button]' },47 { ref: 'cancelButton', selector: 'article-detail-window button[name=cancel-button]' },48 { ref: 'esdSaveButton', selector: 'article-detail-window button[name=esd-save-button]' },49 { ref: 'esdBackButton', selector: 'article-detail-window button[name=esd-back-button]' },50 { ref: 'esdListing', selector: 'article-detail-window article-esd-list' },51 { ref: 'mediaDropZone', selector: 'article-detail-window article-esd-detail html5fileupload' },52 { ref: 'esdSerialsListing', selector: 'article-detail-window article-esd-serials' },53 { ref: 'esdTab', selector: 'article-detail-window container[name=esd-tab]' }54 ],55 /**56 * Contains all snippets for the component.57 * @object58 */59 snippets: {60 growlMessage: '{s name=growl_message}Article{/s}',61 addSerialsTitle: '{s name=esd/add_serials_title}Add Serials{/s}',62 error: {63 title: '{s name=esd/error/title}Error{/s}',64 noFolder: '{s name=esd/error/no_folder}The ESD folder could not be found.{/s}'65 },66 success: {67 title: '{s name=esd/success/title}Success{/s}',68 esdSaved: '{s name=esd/success/esd_saved}The ESD has been saved.{/s}',69 esdCreated: '{s name=esd/success/esd_created}The ESD has been created.{/s}',70 esdRemoved: '{s name=esd/success/esd_removed}The selected ESDs have been removed{/s}',71 serialsAdded: '{s name=esd/success/serials_added}Serialnumbers have been added{/s}',72 unusedSerialsRemoved: '{s name=esd/success/unused_serials_removed}All unused serialnumbers have been removed{/s}',73 serialRemoved: '{s name=esd/success/serial_removed}The selected serialnumbers have been removed{/s}'74 },75 messages: {76 esdRemove: '{s name=esd/message/remove_esd}Are you sure you want to delete the selected ESD(s)?{/s}',77 serialsRemoveUnused: '{s name=esd/message/remove_unused_serials}Are you sure you want to delete all unused serialnumbers?{/s}',78 serialRemove: '{s name=esd/message/remove_serial}Are you sure you want to delete the selected serialnumber(s)?{/s}',79 addSerials: '{s name=esd/message/add_serials}Add new Serials (separated by newlines){/s}'80 },81 buttons: {82 addSerials: '{s name=esd/buttons/add_serials}Add serials{/s}',83 cancel: '{s name=esd/message/cancel}Cancel{/s}'84 }85 },86 /**87 * A template method that is called when your application boots.88 * It is called before the Application's launch function is executed89 * so gives a hook point to run any code before your Viewport is created.90 *91 * @params orderId - The main controller can handle a orderId parameter to open the order detail page directly92 * @return void93 */94 init: function () {95 var me = this;96 me.control({97 'article-detail-window tabpanel[name=main-tab-panel]': {98 beforetabchange: me.onMainTabChange99 },100 'article-detail-window article-esd-list': {101 addEsd: me.onAddEsd,102 editEsd: me.onEditEsd,103 deleteEsd: me.onDeleteEsd,104 searchEsd: me.onSearchEsd,105 backToList: me.onBackToList,106 saveEsd: me.onSaveEsd107 },108 'article-detail-window article-esd-detail': {109 activate: me.onActivate,110 deactivate: me.onDeactivate,111 downloadFile: me.onDownloadFile,112 mediaUpload: me.onMediaUpload,113 hasSerialsChanged: me.onHasSerialsChanged,114 fileChanged: me.onFileChanged115 },116 'article-esd-detail html5fileupload': {117 uploadReady: me.onUploadReady118 },119 'article-detail-window article-esd-serials': {120 addSerials: me.onAddSerials,121 deleteUnusedSerials: me.onDeleteUnusedSerials,122 deleteSerials: me.onDeleteSerials,123 searchSerials: me.onSearchSerials,124 openCustomer: me.onOpenCustomer125 }126 });127 me.callParent(arguments);128 },129 /**130 * Event listener function of the main tab panel in the detail window.131 * Fired when the user changes the tab.132 */133 onMainTabChange: function(panel, newTab, oldTab) {134 if (newTab.name !== 'esd-tab' && oldTab.name !== 'esd-tab') {135 return;136 }137 var me = this;138 var esdTab = me.getEsdTab();139 var store = me.getEsdListing().getStore();140 var activeCard = esdTab.getLayout().getActiveItem();141 var isDetail = (activeCard.xtype === 'article-esd-detail');142 if (newTab.name === 'esd-tab') {143 store.load();144 } else {145 if (isDetail) {146 esdTab.getLayout().setActiveItem(0);147 esdTab.remove(activeCard);148 }149 }150 },151 /**152 * Event listener function of the detail panel153 */154 onActivate: function() {155 var me = this;156 me.enableEsdButtons();157 },158 /**159 * Event listener function of the detail panel160 */161 onDeactivate: function() {162 var me = this;163 me.disableEsdButtons();164 },165 /**166 * Event listener function of the detail panel167 */168 onSaveEsd: function() {169 var me = this,170 record = me.detailWindow.esdRecord;171 record.save({172 callback: function() {173 Shopware.Notification.createGrowlMessage(me.snippets.success.title, me.snippets.success.esdSaved, me.snippets.growlMessage);174 me.detailWindow.infoView.update(record.data);175 }176 });177 },178 /**179 * Internal helper function to enable esd related buttons180 */181 enableEsdButtons: function() {182 var me = this,183 saveButton = me.getSaveButton(),184 cancelButton = me.getCancelButton(),185 esdBackButton = me.getEsdBackButton(),186 esdSaveButton = me.getEsdSaveButton();187 saveButton.hide();188 cancelButton.hide();189 esdBackButton.show();190 esdSaveButton.show();191 },192 /**193 * Internal helper function to disable esd related buttons194 */195 disableEsdButtons: function() {196 var me = this,197 cancelButton = me.getCancelButton(),198 esdBackButton = me.getEsdBackButton(),199 esdSaveButton = me.getEsdSaveButton();200 cancelButton.show();201 esdBackButton.hide();202 esdSaveButton.hide();203 },204 /**205 * Event will be fired when the user clicks the add button in the toolbar206 * @param [string] articleDetailId207 */208 onAddEsd: function(articleDetailId) {209 var me = this,210 store = me.getEsdListing().getStore();211 Ext.Ajax.request({212 url: '{url action="createEsd"}',213 method: 'POST',214 params: {215 articleDetailId: articleDetailId216 },217 success: function(response, opts) {218 Shopware.Notification.createGrowlMessage(me.snippets.success.title, me.snippets.success.esdCreated, me.snippets.growlMessage);219 store.load();220 }221 });222 },223 /**224 * Event will be fired when the user clicks the back button in the toolbar225 */226 onBackToList: function() {227 var me = this,228 esdTab = me.getEsdTab(),229 saveButton = me.getSaveButton(),230 cardToRemove = esdTab.getLayout().getActiveItem();231 esdTab.getLayout().setActiveItem(0);232 esdTab.remove(cardToRemove);233 me.getEsdListing().getStore().load();234 saveButton.show();235 },236 resetToList: function() {237 var me = this,238 esdTab = me.getEsdTab(),239 saveButton = me.getSaveButton(),240 cardToRemove = esdTab.getLayout().getActiveItem();241 if(cardToRemove.$className === 'Shopware.apps.Article.view.esd.List') {242 return false;243 }244 esdTab.getLayout().setActiveItem(0);245 esdTab.remove(cardToRemove);246 me.getEsdListing().getStore().load();247 saveButton.show();248 },249 /**250 * @param [string] value251 */252 onSearchEsd: function(value) {253 var me = this,254 esdListing = me.getEsdListing(),255 store = esdListing.getStore();256 value = Ext.String.trim(value);257 store.filters.clear();258 store.currentPage = 1;259 if (value.length > 0) {260 store.filter({ property: 'free', value: value });261 } else {262 store.load();263 }264 },265 /**266 * Event listener function of the esd list. Fired when the267 * user clicks on the pencil action column.268 *269 * @param [Ext.data.Model] The selected record270 */271 onEditEsd: function(record) {272 var me = this,273 esdTab = me.getEsdTab(),274 serialStore = Ext.create('Shopware.apps.Article.store.Serial'),275 fileStore = Ext.create('Shopware.apps.Article.store.EsdFile').load(276 function(records, operation, success) {277 if (success == false && operation.error == 'noFolder') {278 Shopware.Notification.createGrowlMessage(me.snippets.error.title, me.snippets.error.noFolder, me.snippets.growlMessage);279 }280 }281 );282 me.fileStore = fileStore;283 serialStore.getProxy().extraParams.esdId = record.get('id');284 serialStore.load();285 me.detailWindow = Ext.create('Shopware.apps.Article.view.esd.Detail', {286 esdRecord: record,287 serialStore: serialStore,288 fileStore: fileStore,289 article: me.article290 });291 esdTab.add(me.detailWindow);292 esdTab.getLayout().setActiveItem(1);293 },294 /**295 * Event listener function which fired when the user selects esd in the listing296 * and clicks the delete button in the toolbar.297 * @param records298 */299 onDeleteEsd: function(records) {300 var me = this,301 esdListing = me.getEsdListing(),302 store = esdListing.getStore();303 if (records.length > 0) {304 // we do not just delete - we are polite and ask the user if he is sure.305 Ext.MessageBox.confirm(me.snippets.growlMessage, me.snippets.messages.esdRemove , function (response) {306 if ( response !== 'yes' ) {307 return;308 }309 store.remove(records);310 store.sync({311 callback: function() {312 Shopware.Notification.createGrowlMessage(me.snippets.success.title, me.snippets.success.esdRemoved, me.snippets.growlMessage);313 store.currentPage = 1;314 store.load();315 }316 });317 });318 }319 },320 /**321 * Creates window322 *323 * @return [Enlight.app.Window]324 */325 getAddSerialsWindow: function() {326 var me = this;327 var win = Ext.create('Enlight.app.Window', {328 title: me.snippets.addSerialsTitle,329 width: 400,330 height: 400,331 layout: 'fit',332 subApplication: me.subApplication,333 subApp: me.subApplication,334 items: [{335 xtype: 'form',336 layout: 'anchor',337 bodyPadding: 10,338 border: false,339 defaults: {340 anchor: '100%'341 },342 dockedItems: [{343 xtype: 'toolbar',344 dock: 'bottom',345 cls: 'shopware-toolbar',346 items: [{347 text: me.snippets.buttons.addSerials,348 cls: 'primary',349 formBind: true,350 handler: function() {351 var form = this.up('form').getForm();352 if (form.isValid()) {353 var serials = form.getValues().serials;354 me.saveNewSerials(serials);355 win.close();356 }357 }358 }, {359 text: me.snippets.buttons.cancel,360 cls: 'secondary',361 handler: function() {362 win.close();363 }364 }]365 }],366 items: [{367 bodyPadding: 10,368 html: me.snippets.messages.addSerials369 }, {370 name: 'serials',371 xtype: 'textarea',372 height: 250,373 allowBlank: false374 }]375 }]376 });377 return win;378 },379 /**380 * Event will be fired when the user clicks the add button in the toolbar381 */382 onAddSerials: function() {383 var me = this;384 me.getAddSerialsWindow().show();385 },386 /**387 * @param [string] serials388 */389 saveNewSerials: function(serials) {390 var me = this;391 Ext.Ajax.request({392 url: '{url action="saveSerials"}',393 method: 'POST',394 params: {395 esdId: me.detailWindow.esdRecord.get('id'),396 serials: serials397 },398 success: function(response, opts) {399 Shopware.Notification.createGrowlMessage(me.snippets.success.title, me.snippets.success.serialsAdded, me.snippets.growlMessage);400 me.getEsdSerialsListing().getStore().load();401 }402 });403 },404 /**405 * Event will be fired when the user clicks the add button in the toolbar406 */407 onDeleteUnusedSerials: function() {408 var me = this;409 Ext.MessageBox.confirm(me.snippets.growlMessage, me.snippets.messages.serialsRemoveUnused , function (response) {410 if ( response !== 'yes' ) {411 return;412 }413 Ext.Ajax.request({414 url: '{url action="deleteUnusedSerials"}',415 method: 'POST',416 params: {417 esdId: me.detailWindow.esdRecord.get('id')418 },419 success: function(response, opts) {420 Shopware.Notification.createGrowlMessage(me.snippets.success.title, me.snippets.success.unusedSerialsRemoved, me.snippets.growlMessage);421 me.getEsdSerialsListing().getStore().load();422 }423 });424 });425 },426 /**427 * Event listener function which fired when the user selects esd in the listing428 * and clicks the delete button in the toolbar.429 * @param records430 */431 onDeleteSerials: function(records) {432 var me = this,433 serialsListing = me.getEsdSerialsListing(),434 store = serialsListing.getStore();435 if (records.length > 0) {436 Ext.MessageBox.confirm(me.snippets.growlMessage, me.snippets.messages.serialRemove , function (response) {437 if ( response !== 'yes' ) {438 return;439 }440 store.remove(records);441 store.sync({442 callback: function() {443 Shopware.Notification.createGrowlMessage(me.snippets.success.title, me.snippets.success.serialRemoved, me.snippets.growlMessage);444 store.currentPage = 1;445 store.load();446 }447 });448 });449 }450 },451 /**452 * Event will be fired when the user clicks the download button in the toolbar453 */454 onDownloadFile: function() {455 var me = this;456 var record = me.detailWindow.esdRecord;457 var url = '{url action="getEsdDownload"}' + '/filename/' + record.get('file');458 window.open(url, '_blank');459 },460 /**461 * @param [string] value462 */463 onSearchSerials: function(value) {464 var me = this,465 serialsListing = me.getEsdSerialsListing(),466 store = serialsListing.getStore();467 value = Ext.String.trim(value);468 store.filters.clear();469 store.currentPage = 1;470 if (value.length > 0) {471 store.filter({ property: 'free', value: value });472 } else {473 store.load();474 }475 },476 /**477 * Event listener method which fired when the user clicks the customer button478 * in the order list to show the customer detail page.479 *480 * @param [Ext.data.Model] record - The row record481 */482 onOpenCustomer: function(record) {483 Shopware.app.Application.addSubApplication({484 name: 'Shopware.apps.Customer',485 action: 'detail',486 params: {487 customerId: record.get('customerId')488 }489 });490 },491 /**492 * @param [boolean]493 */494 onHasSerialsChanged: function(checked) {495 var me = this,496 record = me.detailWindow.esdRecord,497 serialsListing = me.getEsdSerialsListing();498 if (checked) {499 record.set('hasSerials', true);500 serialsListing.enable();501 } else {502 record.set('hasSerials', false);503 serialsListing.disable();504 }505 },506 /**507 * @param [string]508 */509 onFileChanged: function(filename) {510 var me = this,511 record = me.detailWindow.esdRecord;512 record.set('file', filename);513 },514 onUploadReady: function() {515 var me = this;516 me.fileStore.load();517 },518 /**519 * Event will be fired when the user want to upload images over the button on the image tab.520 *521 * @event522 * @param [object]523 */524 onMediaUpload: function(field) {525 var dropZone = this.getMediaDropZone();526 this.uploadMedia(field, dropZone);527 },528 /**529 * Internal helper function to upload article images.530 * @param field531 * @param dropZone532 */533 uploadMedia: function(field, dropZone) {534 var fileField = field.getEl().down('input[type=file]').dom;535 dropZone.iterateFiles(fileField.files);536 }537});...
serials.js
Source:serials.js
1/**2 * Shopware 53 * Copyright (c) shopware AG4 *5 * According to our dual licensing model, this program can be used either6 * under the terms of the GNU Affero General Public License, version 3,7 * or under a proprietary license.8 *9 * The texts of the GNU Affero General Public License with an additional10 * permission and of our proprietary license can be found at and11 * in the LICENSE file you have received along with this program.12 *13 * This program is distributed in the hope that it will be useful,14 * but WITHOUT ANY WARRANTY; without even the implied warranty of15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 * GNU Affero General Public License for more details.17 *18 * "Shopware" is a registered trademark of shopware AG.19 * The licensing of the program under the AGPLv3 does not imply a20 * trademark license. Therefore any rights, title and interest in21 * our trademarks remain entirely with us.22 *23 * @category Shopware24 * @package Article25 * @subpackage Esd26 * @version $Id$27 * @author shopware AG28 */29/**30 * Shopware UI - Article ESD serials page31 */32//{namespace name=backend/article/view/main}33//{block name="backend/article/view/esd/serials"}34Ext.define('Shopware.apps.Article.view.esd.Serials', {35 /**36 * Extend from the standard ExtJS 437 * @string38 */39 extend: 'Ext.grid.Panel',40 /**41 * List of short aliases for class names. Most useful for defining xtypes for widgets.42 * @string43 */44 alias: 'widget.article-esd-serials',45 /**46 * Set css class47 * @string48 */49 cls: Ext.baseCSSPrefix + 'article-esd-serials',50 /**51 * The view needs to be scrollable52 * @string53 */54 autoScroll: true,55 /**56 * Contains all snippets for the view component57 * @object58 */59 snippets:{60 title:'{s name=esd/serials/title}Serialnumber Administration{/s}',61 columns:{62 serial:'{s name=esd/serials/column/serial}Serialnumber{/s}',63 assignedCustomer:'{s name=esd/serials/column/assigned_customer}Assigned Customer{/s}',64 assignedDate:'{s name=esd/serialsals/column/assigned_date}Assigned at{/s}',65 remove: '{s name=esd/serials/column/remove}Delete serial{/s}',66 openCustomer: '{s name=esd/serials/column/open_customer}Open Customer{/s}',67 guest: '{s name=esd/serials/column/guest}Guest{/s}'68 },69 toolbar:{70 add:'{s name=esd/serials/toolbar/button_add}Add Serials{/s}',71 remove:'{s name=esd/serials/toolbar/button_delete}Delete selected{/s}',72 search:'{s name=esd/serials/toolbar/search_empty_text}Search...{/s}',73 removeUnused: '{s name=esd/serials/toolbar/button_delete_unused}Delete not assigned Serials{/s}'74 }75 },76 /**77 * Initialize the Shopware.apps.Article.view.esd.Serials and defines the necessary default configuration78 * @return void79 */80 initComponent: function () {81 var me = this;82 me.registerEvents();83 me.title = me.snippets.title;84 me.selModel = me.getGridSelectionModel();85 me.columns = me.getColumns();86 me.toolbar = me.getToolbar();87 me.pagingbar = me.getPagingBar();88 me.dockedItems = [ me.toolbar, me.pagingbar ];89 me.callParent(arguments);90 },91 /**92 * Defines additional events which will be fired from the component93 *94 * @return void95 */96 registerEvents:function () {97 this.addEvents(98 /**99 * Event will be fired when the user clicks the delete button100 * in the toolbar or the action column of the grid101 * @event deleteSerials102 * @param [array] Records - The selected records103 */104 'deleteSerials',105 /**106 * @event addSerials107 */108 'addSerials',109 /**110 * @event deleteUnusedSerials111 */112 'deleteUnusedSerials',113 /**114 * @event searchSerials115 */116 'searchSerials',117 /**118 * @event openCustomer119 * @param [Ext.data.Model] Record - The selected record120 */121 'openCustomer'122 );123 },124 /**125 * Creates the grid columns126 *127 * @return [array] grid columns128 */129 getColumns: function() {130 var me = this;131 return [132 {133 header: me.snippets.columns.serial,134 dataIndex: 'serialnumber',135 flex: 2136 },137 {138 header: me.snippets.columns.assignedCustomer,139 flex: 2,140 renderer: me.assignedCustomerColumnRenderer141 },142 {143 header: me.snippets.columns.assignedDate,144 xtype: 'datecolumn',145 dataIndex: 'date',146 flex: 1147 },148 {149 /**150 * Special column type which provides clickable icons in each row151 */152 xtype: 'actioncolumn',153 width: 70,154 items:[155 {156 iconCls: 'sprite-minus-circle-frame',157 action: 'deleteSerial',158 tooltip: me.snippets.columns.remove,159 handler: function (view, rowIndex, colIndex, item, opts, record) {160 var serials = [ record ];161 me.fireEvent('deleteSerials', serials);162 }163 },164 {165 iconCls: 'sprite-user--arrow',166 action: 'openCustomer',167 tooltip: me.snippets.columns.openCustomer,168 handler: function (view, rowIndex, colIndex, item, opts, record) {169 me.fireEvent('openCustomer', record);170 },171 getClass: function(value, metadata, record) {172 if (!record.get('customerId')) {173 return 'x-hidden';174 }175 if (record.get('accountMode') !== 0) {176 return 'x-hidden';177 }178 }179 }180 ]181 }182 ];183 },184 /**185 * Creates the grid selection model for checkboxes186 *187 * @return [Ext.selection.CheckboxModel] grid selection model188 */189 getGridSelectionModel: function() {190 var me = this;191 return Ext.create('Ext.selection.CheckboxModel', {192 listeners:{193 // Unlocks the delete button if the user has checked at least one checkbox194 selectionchange: function(sm, selections) {195 me.deleteButton.setDisabled(selections.length === 0);196 }197 }198 });199 },200 /**201 * Creates the grid toolbar with the different buttons.202 * @return [Ext.toolbar.Toolbar] grid toolbar203 */204 getToolbar: function() {205 var me = this;206 me.deleteButton = Ext.create('Ext.button.Button', {207 iconCls: 'sprite-minus-circle-frame',208 text: me.snippets.toolbar.remove,209 disabled: true,210 action: 'deleteSerials',211 handler: function() {212 var selectionModel = me.getSelectionModel(),213 records = selectionModel.getSelection();214 if (records.length > 0) {215 me.fireEvent('deleteSerials', records);216 }217 }218 });219 me.searchField = Ext.create('Ext.form.field.Text', {220 name: 'searchfield',221 cls: 'searchfield',222 width: 170,223 emptyText: me.snippets.toolbar.search,224 enableKeyEvents:true,225 checkChangeBuffer: 500,226 listeners: {227 change: function(field, value) {228 me.fireEvent('searchSerials', value);229 }230 }231 });232 return {233 xtype: 'toolbar',234 dock: 'top',235 items: [236 {237 xtype: 'button',238 text: me.snippets.toolbar.add,239 iconCls:'sprite-plus-circle-frame',240 handler: function() {241 me.fireEvent('addSerials');242 }243 },244 me.deleteButton,245 { xtype: 'tbseparator' },246 {247 xtype: 'button',248 iconCls: 'sprite-minus-circle-frame',249 text: me.snippets.toolbar.removeUnused,250 handler: function() {251 me.fireEvent('deleteUnusedSerials');252 }253 },254 { xtype: 'tbfill' },255 me.searchField,256 { xtype: 'tbspacer' }257 ]258 };259 },260 /**261 * Creates the paging toolbar for the grid to allow store paging. The paging toolbar uses the same store as the Grid262 *263 * @return [Ext.toolbar.Paging] The paging toolbar for the serials grid264 */265 getPagingBar: function() {266 var me = this;267 return {268 store: me.store,269 xtype: 'pagingtoolbar',270 displayInfo: true,271 dock: 'bottom'272 };273 },274 /**275 * Formats the customer column276 *277 * @param [string] value - Name of the disptach278 * @param [object] metaData - Meta data for this column279 * @param [object] record - current record280 */281 assignedCustomerColumnRenderer: function(value, metaData, record) {282 var me = this;283 if (!record.get('customerId')) {284 return '';285 }286 if (record.get('accountMode') === 0) {287 return record.get('customerEmail');288 } else {289 return Ext.String.format('{literal}{0} ({1})</b>{/literal}', record.get('customerEmail'), me.snippets.guest);290 }291 }292});...
serial.js
Source:serial.js
1export default {2 state: {3 serials: [],4 filterSerials: []5 },6 actions: {7 async getSerials(ctx) {8 const response = await fetch('http://api.tvmaze.com/schedule')9 const serials = await response.json()10 ctx.commit("updateSerials", serials)11 console.log(serials)12 }13 },14 mutations: {15 updateSerials(state, serials) {16 state.serials = serials17 state.filterSerials = serials18 },19 filtered(state, search) {20 let regexp = new RegExp(search, 'i')21 state.filterSerials = state.serials.filter(serial => regexp.test(serial.name))22 }23 },24 getters: {25 allSerials: state => state.filterSerials26 }...
Using AI Code Generation
1var serials = require('devicefarmer-stf').serials;2serials(function(err, serials) {3 if (err) {4 console.error(err);5 process.exit(1);6 }7 console.log(serials);8});9var stf = require('devicefarmer-stf');10stf.getSerials(function(err, serials) {11 if (err) {12 console.error(err);13 process.exit(1);14 }15 console.log(serials);16});17var stf = require('devicefarmer-stf');18stf.getSerials(function(err, serials) {19 if (err) {20 console.error(err);21 process.exit(1);22 }23 console.log(serials);24});25var stf = require('devicefarmer-stf');26stf.getSerials(function(err, serials) {27 if (err) {28 console.error(err);29 process.exit(1);30 }31 console.log(serials);32});33var stf = require('devicefarmer-stf');34stf.getSerials(function(err, serials) {35 if (err) {36 console.error(err);37 process.exit(1);38 }39 console.log(serials);40});41var stf = require('devicefarmer-stf');
Using AI Code Generation
1var devicefarmer = require('devicefarmer-stf');2var serials = devicefarmer.serials;3serials(function(err, data) {4 if (err) {5 console.log(err);6 } else {7 console.log(data);8 }9});10var devicefarmer = require('devicefarmer-stf');11var devices = devicefarmer.devices;12devices(function(err, data) {13 if (err) {14 console.log(err);15 } else {16 console.log(data);17 }18});19var devicefarmer = require('devicefarmer-stf');20var device = devicefarmer.device;21device('serialno', function(err, data) {22 if (err) {23 console.log(err);24 } else {25 console.log(data);26 }27});28var devicefarmer = require('devicefarmer-stf');29var device = devicefarmer.device;30device('serialno', function(err, data) {31 if (err) {32 console.log(err);33 } else {34 console.log(data);35 }36});37var devicefarmer = require('devicefarmer-stf');38var screenshot = devicefarmer.screenshot;39screenshot('serialno', function(err, data) {40 if (err) {41 console.log(err);42 } else {43 console.log(data);44 }45});46var devicefarmer = require('devicefarmer-stf');47var video = devicefarmer.video;48video('serialno', function(err, data) {49 if (err) {50 console.log(err);51 } else {52 console.log(data);53 }54});55var devicefarmer = require('devicefarmer-stf');56var forward = devicefarmer.forward;57forward('serialno', 8080, 8080, function(err, data) {58 if (err) {59 console.log(err);60 } else {
Using AI Code Generation
1var Serials = require('devicefarmer-stf').Serials;2var serials = new Serials();3serials.getSerials(function (err, serials) {4 if (err) {5 console.log(err);6 return;7 }8 console.log(serials);9});10Serials.getSerials(function (err, serials) {11 if (err) {12 console.log(err);13 return;14 }15 console.log(serials);16});17var Devices = require('devicefarmer-stf').Devices;18var devices = new Devices();19devices.getDevices(function (err, devices) {20 if (err) {21 console.log(err);22 return;23 }24 console.log(devices);25});26Devices.getDevices(function (err, devices) {27 if (err) {28 console.log(err);29 return;30 }31 console.log(devices);32});33var Device = require('devicefarmer-stf').Device;34var device = new Device();35device.getDevice('serial', function (err, device) {36 if (err) {37 console.log(err);38 return;39 }40 console.log(device);41});42Device.getDevice('serial', function (err, device) {43 if (err) {44 console.log(err);45 return;46 }47 console.log(device);48});49var Device = require('devicefarmer-stf').Device;50var device = new Device();51device.getDevice('serial', function (err, device) {52 if (err) {53 console.log(err);54 return;55 }56 console.log(device);57});58Device.getDevice('serial', function (err, device) {59 if (err) {60 console.log(err);61 return;62 }63 console.log(device);64});65var Device = require('devicefarmer-stf').Device;66var device = new Device();67device.getDevice('serial', function (err, device) {68 if (err) {69 console.log(err);70 return;71 }72 console.log(device);73});74Device.getDevice('serial', function (err,
Using AI Code Generation
1var Serials = require('devicefarmer-stf').Serials;2serials.serials(function(err, result) {3 if (err) {4 console.log('Error: ' + err);5 } else {6 console.log('Result: ' + result);7 }8});9var Devices = require('devicefarmer-stf').Devices;10devices.devices(function(err, result) {11 if (err) {12 console.log('Error: ' + err);13 } else {14 console.log('Result: ' + result);15 }16});17var Device = require('devicefarmer-stf').Device;18device.device('deviceID', function(err, result) {19 if (err) {20 console.log('Error: ' + err);21 } else {22 console.log('Result: ' + result);23 }24});25var Device = require('devicefarmer-stf').Device;26device.device('deviceID', function(err, result) {27 if (err) {28 console.log('Error: ' + err);29 } else {30 console.log('Result: ' + result);31 }32});33var Device = require('devicefarmer-stf').Device;34device.device('deviceID', function(err, result) {35 if (err) {36 console.log('Error: ' + err);37 } else {38 console.log('Result: ' + result);39 }40});41var Device = require('devicefarmer-stf').Device;42device.device('deviceID', function(err, result) {43 if (err) {44 console.log('Error:
Using AI Code Generation
1var serials = require('devicefarmer-stf').serials;2serials(function(err, serials){3 if(err){4 console.log("Error getting serials");5 }6 else{7 console.log("Serials: " + serials);8 }9});10var serials = require('devicefarmer-stf').serials;11serials(function(err, serials){12 if(err){13 console.log("Error getting serials");14 }15 else{16 console.log("Serials: " + serials);17 }18});19var request = require('request');20module.exports = function(callback){21 if(err){22 callback(err);23 }24 else{25 var devices = JSON.parse(body);26 var serials = [];27 for(var i = 0; i < devices.length; i++){28 serials.push(devices[i].serial);29 }30 callback(null, serials);31 }32 });33};34var request = require('request');35module.exports = function(callback){36 if(err){37 callback(err);38 }39 else{40 var devices = JSON.parse(body);41 var serials = [];42 for(var i = 0; i < devices.length; i++){43 serials.push(devices[i].serial);44 }45 callback(null, serials);46 }47 });48};
Using AI Code Generation
1var DeviceFarmer = require('devicefarmer-stf-client');2df.getDevices()3 .then(function(devices) {4 console.log(devices);5 })6 .catch(function(err) {7 console.log(err);8 });9df.getDevices({10 })11 .then(function(devices) {12 console.log(devices);13 })14 .catch(function(err) {15 console.log(err);16 });
Using AI Code Generation
1const { Serials } = require('devicefarmer-stf');2const serials = new Serials();3serials.list().then(function (serials) {4 console.log(serials);5 serials.forEach(function (serial) {6 console.log(serial);7 });8});9const { Devices } = require('devicefarmer-stf');10const devices = new Devices();11devices.list().then(function (devices) {12 console.log(devices);13 devices.forEach(function (device) {14 console.log(device);15 });16});17const { Device } = require('devicefarmer-stf');18const device = new Device('deviceid');19device.info().then(function (info) {20 console.log(info);21});22const { Device } = require('devicefarmer-stf');23const device = new Device('deviceid');24device.info().then(function (info) {25 console.log(info);26});27const { Device } = require('devicefarmer-stf');28const device = new Device('deviceid');29device.info().then(function (info) {30 console.log(info);31});32const { Device } = require('devicefarmer-stf');33const device = new Device('deviceid');34device.info().then(function (info) {35 console.log(info);36});37const { Device } = require('devicefarmer-stf');38const device = new Device('deviceid');39device.info().then(function (info) {40 console.log(info);41});42const { Device } = require('devicefarmer-stf');43const device = new Device('deviceid');44device.info().then(function (info) {45 console.log(info);46});47const { Device } = require('devicefarmer-stf');48const device = new Device('deviceid');49device.info().then(function (info) {50 console.log(info);51});52const { Device } = require
Using AI Code Generation
1var serials = require('devicefarmer-stf').serials;2var args = process.argv.slice(2);3var serial = args[0];4var port = 7100;5var stf = new serials(port);6stf.connect();7stf.on('connect', function(){8 stf.getSerials(function(err, result){9 if(err){10 console.log(err);11 }12 else{13 console.log(result);14 }15 });16});17stf.on('serials', function(result){18 console.log(result);19});20stf.on('error', function(err){21 console.log(err);22});23stf.on('disconnect', function(){24 console.log('Disconnected');25});26stf.on('reconnect', function(){27 console.log('Reconnected');28});29stf.on('timeout', function(){30 console.log('timeout');31});32stf.on('close', function(){33 console.log('close');34});35stf.on('end', function(){36 console.log('end');37});38stf.on('connect_error', function(err){39 console.log(err);40});41stf.on('connect_timeout', function(){42 console.log('connection timeout');43});44stf.on('reconnect_error', function(err){45 console.log(err);46});47stf.on('reconnect_timeout', function(){48 console.log('reconnection timeout');49});50stf.on('reconnect_failed', function(){51 console.log('reconnection failed');52});53stf.on('connect_failed', function(){54 console.log('connection failed');55});56stf.on('error', function(err){57 console.log(err);58});59stf.on('close', function(){60 console.log('close');61});62stf.on('end', function(){63 console.log('end');64});65stf.on('connect_error', function(err){66 console.log(err);67});68stf.on('connect_timeout', function(){69 console.log('connection timeout');70});71stf.on('reconnect_error', function(err){72 console.log(err);73});74stf.on('reconnect_timeout', function(){75 console.log('reconnection timeout');76});77stf.on('reconnect_failed', function(){78 console.log('reconnection failed');79});80stf.on('connect_failed', function(){81 console.log('connection failed');82});83stf.on('error', function(err){84 console.log(err);85});86stf.on('close', function(){87 console.log('close');88});89stf.on('end', function(){
Using AI Code Generation
1var serials = require('devicefarmer-stf').serials;2var devices = serials.getDevices();3console.log(devices);4console.log("Total Devices: "+devices.length);5var stf = require('devicefarmer-stf').stf;6var devices = stf.getDevices();7console.log(devices);8console.log("Total Devices: "+devices.length);9var stf = require('devicefarmer-stf').stf;10var devices = stf.getDevices();11console.log(devices);12console.log("Total Devices: "+devices.length);13var stf = require('devicefarmer-stf').stf;14var devices = stf.getDevices();15console.log(devices);16console.log("Total Devices: "+devices.length);17var stf = require('devicefarmer-stf').stf;18var devices = stf.getDevices();19console.log(devices);20console.log("Total Devices: "+devices.length);21var stf = require('devicefarmer-stf').stf;22var devices = stf.getDevices();23console.log(devices);24console.log("Total Devices: "+devices.length);25var stf = require('devicefarmer-stf').stf;26var devices = stf.getDevices();27console.log(devices);28console.log("Total Devices: "+devices.length);29var stf = require('devicefarmer-stf').stf;30var devices = stf.getDevices();31console.log(devices);32console.log("Total Devices: "+devices.length);33var stf = require('devicefarmer-stf').stf;34var devices = stf.getDevices();35console.log(devices);36console.log("Total Devices: "+devices.length);37var stf = require('devicefarmer-stf').stf;38var devices = stf.getDevices();39console.log(devices);40console.log("Total Devices: "+devices.length);41var stf = require('devicefarmer-stf').stf;
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!