How to use interruptProcess method in root

Best JavaScript code snippet using root

em_languages.js

Source:em_languages.js Github

copy

Full Screen

1/**2 * ExtJS for the extension manager.3 *4 *5 * @author Steffen Kamper <info@sk-typo3.de>6 * @package TYPO37 * @subpackage extension manager8 */9Ext.ns('TYPO3.EM');10/** override mousedown for grid to select checkbox respecting singleSelect */11Ext.override(Ext.grid.CheckboxSelectionModel, {12 handleMouseDown: function(g, rowIndex, e) {13 e.stopEvent();14 if (this.isSelected(rowIndex)) {15 this.deselectRow(rowIndex);16 } else {17 this.selectRow(rowIndex, true);18 this.grid.getView().focusRow(rowIndex);19 }20 }21});22Ext.grid.DynamicColumnModelForLanguages = function(store){23 var cols = [];24 var recordType = store.recordType;25 var fields = recordType.prototype.fields;26 for (var i = 0; i < fields.keys.length; i++) {27 var fieldName = fields.keys[i];28 var field = recordType.getField(fieldName);29 if (i === 0) {30 cols[i] = {31 header: 'Extension',32 dataIndex: field.name,33 width: 200,34 fixed: true,35 sortable: false,36 hidable: false,37 menuDisabled: true,38 renderer: function(value, metaData, record, rowIndex, colIndex, store){39 metaData.css += ' extLangTitleWithIcon';40 return record.data.icon + ' <strong>' + value + '</strong>';41 }42 };43 } else if (i === 1 || i === 2 || i === 3) {44 //bypass45 } else {46 cols[i - 3] = {47 header: field.name,48 dataIndex: field.name,49 hidden: true,50 fixed: true,51 sortable: false,52 hidable: false,53 menuDisabled: true,54 renderer: function(value, metaData, record, rowIndex, colIndex, store) {55 if (value == TYPO3.l10n.localize('translation_checking')) {56 return '<span class="x-mask-loading">&nbsp;</span>' + value;57 }58 return '<span class="x-mask-loading">&nbsp;</span>' + value;;59 }60 };61 }62 }63 Ext.grid.DynamicColumnModelForLanguages.superclass.constructor.call(this, cols);64};65Ext.extend(Ext.grid.DynamicColumnModelForLanguages, Ext.grid.ColumnModel, {defaultWidth: 170});66TYPO3.EM.LanguagesSelectionModel = new Ext.grid.CheckboxSelectionModel({67 singleSelect: false,68 header: '',69 dataIndex: 'selected',70 checkOnly: false71});72TYPO3.EM.LanguagesColumnModel = new Ext.grid.ColumnModel([73 TYPO3.EM.LanguagesSelectionModel, {74 id: 'lang-label',75 header: TYPO3.l10n.localize('lang_language'),76 sortable: true,77 menuDisabled: true,78 dataIndex: 'label',79 hidable: false,80 renderer: function(value, metaData, record, rowIndex, colIndex, store) {81 return '<span class="' + record.data.cls + '">&nbsp</span>' + value;82 }83 },{84 id: 'lang-key',85 header: TYPO3.l10n.localize('lang_short'),86 menuDisabled: true,87 sortable: true,88 dataIndex: 'lang',89 hidable: false90 }91]);92TYPO3.EM.LanguagesProgressBar = new Ext.ProgressBar ({93 id: 'langpb',94 cls: 'left-align',95 autoWidth: true,96 style: 'margin: 0 0 20px 0',97 animate: true,98 height: 20,99 hidden: true100});101TYPO3.EM.Languages = Ext.extend(Ext.FormPanel, {102 border:false,103 layout: 'form',104 id: 'em-labguage-modul',105 extCount: 0,106 fetchType: 0,107 extkeyArray : [],108 selectedLanguages: [],109 cb: null,110 initComponent: function() {111 var langExtStore = new Ext.data.DirectStore({112 storeId : 'em-languageext-store',113 autoLoad : false,114 directFn : TYPO3.EM.ExtDirect.getInstalledExtkeys,115 root : 'data',116 idProperty : 'extkey',117 fields : [{name : 'extkey'},{name : 'icon'},{name: 'stype'}],118 baseParams: {119 repository: TYPO3.settings.EM.selectedRepository120 },121 listeners : {122 'load': function(store, records, options){123 if(records.length) {124 Ext.getCmp('lang-checkbutton').enable();125 Ext.getCmp('lang-updatebutton').enable();126 this.restoreExtLanguageGrid();127 }128 this.languageLoaded = true;129 },130 scope : this131 }132 });133 this.langStore = new Ext.data.DirectStore({134 storeId : 'em-language-store',135 autoLoad : false,136 directFn : TYPO3.EM.ExtDirect.getLanguages,137 paramsAsHash: false,138 root : 'data',139 idProperty : 'lang',140 fields : [141 {name : 'lang', type : 'string'},142 {name : 'label', type : 'string'},143 {name : 'cls', type : 'string'},144 {name : 'selected', type: 'bool'}145 ],146 listeners : {147 'load': function(store, records){148 // get selected languages and update selection and extGrid149 TYPO3.settings.LangLoaded = false;150 var a = [];151 for (var i=0; i<records.length; i++) {152 if(records[i].data.selected) {153 a.push(records[i]);154 }155 }156 TYPO3.EM.LanguagesSelectionModel.selectRecords(a);157 langExtStore.load();158 store.sort('label', 'ASC');159 },160 scope: this161 }162 });163 Ext.apply(this, {164 languagesLoaded: false,165 layout:'hbox',166 bodyStyle: 'padding: 10px 5px 0 5px;',167 layoutConfig: {168 align: 'stretch'169 },170 defaults: {171 border: false172 },173 items: [{174 width: 250,175 layout: 'fit',176 items: [{177 xtype: 'grid',178 id: 'em-languagegrid',179 stripeRows: true,180 store: this.langStore,181 cm: TYPO3.EM.LanguagesColumnModel,182 sm: TYPO3.EM.LanguagesSelectionModel,183 enableColumnMove: false,184 onRowClick: Ext.emptyFn,185 viewConfig: {186 forceFit: true187 }188 }]189 }, {190 flex: 1,191 layout: 'fit',192 items: [{193 xtype:'fieldset',194 //title: TYPO3.l10n.localize('translation_status'),195 collapsible: false,196 items: [197 TYPO3.EM.LanguagesActionPanel,198 {199 xtype: 'container',200 layout: 'hbox',201 height: 40,202 id: 'LanguagesActionPanel',203 layoutConfig: {204 align: 'stretch'205 },206 defaults: {207 border:false,208 flex: 1209 },210 items: [{211 xtype: 'button',212 text: TYPO3.l10n.localize('translation_check_status_button'),213 id: 'lang-checkbutton',214 margins: '0 10 10 0'215 }, {216 xtype: 'button',217 text: TYPO3.l10n.localize('translation_update_button'),218 id: 'lang-updatebutton',219 margins: '0 0 10 10'220 }]221 },222 TYPO3.EM.LanguagesProgressBar,223 {224 xtype: 'grid',225 id: 'em-extlanguagegrid',226 stripeRows: true,227 store: langExtStore,228 loadMask: {msg: TYPO3.l10n.localize('translation_refresh_languages')},229 enableColumnMove: false,230 enableHdMenu : false,231 autoheight: true,232 cm: new Ext.grid.DynamicColumnModelForLanguages(langExtStore),233 margins: '0 10 0 0',234 anchor: '100% -40',235 listeners: {236 render: this.onExtensionLangguageGridRender237 }238 }]239 }]240 }]241 });242 // call parent243 TYPO3.EM.Languages.superclass.initComponent.apply(this, arguments);244 this.langGrid = Ext.getCmp('em-languagegrid');245 this.langGrid.getSelectionModel().on('selectionchange', function(){246 if (this.languageLoaded) {247 this.langGrid.disable();248 this.saveSelection();249 }250 }, this);251 Ext.getCmp('lang-checkbutton').handler = this.langActionHandler.createDelegate(this);252 Ext.getCmp('lang-updatebutton').handler = this.langActionHandler.createDelegate(this);253 } ,254 onExtensionLangguageGridRender: function(grid) {255 grid.fetchingProcess = false;256 this.on('cellclick', function(grid, rowIndex, columnIndex, event) {257 if (!grid.fetchingProcess && columnIndex > 0) {258 var record = grid.store.getAt(rowIndex);259 var lang = grid.colModel.config[columnIndex].dataIndex;260 Ext.Msg.confirm(261 TYPO3.l10n.localize('menu_language_packges'),262 String.format(TYPO3.l10n.localize('translation_singleCheckQuestion'), lang, '<strong>' + record.data.extkey + '</strong>'),263 function(btn) {264 if (btn === 'yes') {265 this.waitBox = Ext.Msg.wait(266 String.format(TYPO3.l10n.localize('translation_singleCheck'), lang, '<strong>' + record.data.extkey + '</strong>'),267 TYPO3.l10n.localize('translation_checking')268 );269 TYPO3.EM.ExtDirect.fetchTranslations(record.data.extkey, 1, [lang], function(response) {270 if (response && Ext.isArray(response)) {271 record.set(lang, response[lang]);272 record.commit();273 } else {274 TYPO3.Flashmessage.display(TYPO3.Severity.error, TYPO3.l10n.localize('extDirect_timeoutHeader'), TYPO3.l10n.localize('extDirect_timeoutMessage'), 5);275 }276 this.waitBox.hide()277 }, this);278 }279 },280 this281 );282 }283 }, this);284 },285 langActionHandler: function(button, event) {286 var languagegrid = Ext.getCmp('em-languagegrid');287 var buttonPanel = Ext.getCmp('LanguagesActionPanel');288 var progressBar = Ext.getCmp('langpb');289 var grid = Ext.getCmp('em-extlanguagegrid');290 buttonPanel.hide();291 progressBar.show();292 languagegrid.disable();293 if (button.id === 'lang-checkbutton') {294 // check languages295 this.startFetchLanguages(0, Ext.StoreMgr.get('em-languageext-store'), function(){296 TYPO3.EM.LanguagesProgressBar.updateText(this.interruptProcess ? TYPO3.l10n.localize('msg_interrupted') : TYPO3.l10n.localize('msg_finished'));297 (function() {298 progressBar.hide();299 buttonPanel.show();300 languagegrid.enable();301 grid.fetchingProcess = false;302 }).defer(1000, this);303 if (!this.interruptProcess) {304 TYPO3.Flashmessage.display(TYPO3.Severity.information, TYPO3.l10n.localize('translation_checking_extension'), TYPO3.l10n.localize('translation_check_done'), 3);305 Ext.getCmp('em-extlanguagegrid').getSelectionModel().clearSelections();306 }307 });308 } else {309 // update languages310 this.startFetchLanguages(1, Ext.StoreMgr.get('em-languageext-store'), function(){311 TYPO3.EM.LanguagesProgressBar.updateText(this.interruptProcess ? TYPO3.l10n.localize('msg_interrupted') : TYPO3.l10n.localize('msg_finished'));312 if (!this.interruptProcess) {313 TYPO3.Flashmessage.display(TYPO3.Severity.information, TYPO3.l10n.localize('translation_update_extension'), TYPO3.l10n.localize('translation_update_done'), 3);314 Ext.getCmp('em-extlanguagegrid').getSelectionModel().clearSelections();315 }316 progressBar.hide();317 buttonPanel.show();318 languagegrid.enable();319 grid.fetchingProcess = false;320 });321 }322 },323 getSelectedLanguages: function() {324 var selLanguages = this.langGrid.getSelectionModel().getSelections();325 this.selectedLanguages = [];326 if (selLanguages.length > 0 ) {327 for (var i=0; i<selLanguages.length; i++) {328 this.selectedLanguages.push(selLanguages[i].data.lang);329 }330 }331 },332 saveSelection: function() {333 if (this.languageLoaded === true) {334 this.getSelectedLanguages();335 TYPO3.EM.ExtDirect.saveLanguageSelection(this.selectedLanguages, function(response) {336 this.languageLoaded = false;337 if (response.success) {338 for (var i = 0; i < response.diff.length; i++) {339 record = this.langStore.getById(response.diff[i]);340 this.addRemoveExtLanguageGridColumn(record.data);341 if (response.dir > 0) {342 // Languages were added343 this.langGrid.getSelectionModel().selectRow(this.langGrid.store.indexOf(record), true);344 } else {345 // Languages were removed346 this.langGrid.getSelectionModel().deselectRow(this.langGrid.store.indexOf(record), true);347 }348 }349 } else {350 // Action not possible because of dependencies351 // Select all languages saved again and output the message352 for (var i = 0; i < response.languages.length; i++) {353 record = this.langStore.getById(response.languages[i]);354 this.langGrid.getSelectionModel().selectRow(this.langGrid.store.indexOf(record), true);355 }356 TYPO3.Flashmessage.display(TYPO3.Severity.error, TYPO3.l10n.localize('translation_settings'), TYPO3.l10n.localize('translation_selection_impossible'), 5);357 this.langGrid.enable();358 }359 this.languageLoaded = true;360 }, this);361 if (this.selectedLanguages.length) {362 Ext.getCmp('lang-checkbutton').enable();363 Ext.getCmp('lang-updatebutton').enable();364 } else {365 Ext.getCmp('lang-checkbutton').disable();366 Ext.getCmp('lang-updatebutton').disable();367 }368 }369 },370 startFetchLanguages: function(type, store, callback) {371 this.fetchType = type;372 this.extCount = store.data.items.length;373 this.cb = callback;374 // fill arrays375 this.extkeyArray = [];376 for (var i = 0; i < this.extCount; i++) {377 this.extkeyArray.push(store.data.items[i].data.extkey);378 }379 if (!this.selectedLanguages.length) {380 this.getSelectedLanguages();381 }382 // start process383 this.interruptProcess = false;384 Ext.getCmp('em-extlanguagegrid').fetchingProcess = true;385 this.fetchLanguage();386 },387 fetchLanguage: function(response) {388 var grid = Ext.getCmp('em-extlanguagegrid');389 var row = this.extCount - this.extkeyArray.length;390 var record = grid.store.getAt(row);391 var i;392 if (response) {393 // update fetched record394 var fetchedRecord = grid.store.getAt(row - 1);395 for (i = 0; i < this.selectedLanguages.length; i++) {396 fetchedRecord.set(this.selectedLanguages[i], response[this.selectedLanguages[i]]);397 }398 fetchedRecord.commit();399 }400 if(this.extkeyArray.length > 0 && !this.interruptProcess) {401 var ext = this.extkeyArray.shift();402 //update Grid403 grid.getView().focusRow(row);404 grid.getSelectionModel().selectRow(row);405 for (i = 0; i < this.selectedLanguages.length; i++) {406 record.set(this.selectedLanguages[i], '<span class="loading-indicator"></span>' + TYPO3.l10n.localize('translation_checking'));407 }408 record.commit();409 var prefix = TYPO3.l10n.localize('msg_checking');410 if (this.fetchType === 1) {411 prefix = TYPO3.l10n.localize('msg_updating');412 }413 // update Progressbar414 Ext.getCmp('langpb').updateProgress(415 (row + 1) / this.extCount,416 prefix+ ': ' +417 String.format(TYPO3.l10n.localize('translation_fetch_extension'), ext, (row+1), this.extCount));418 // fetch language request419 TYPO3.EM.ExtDirect.fetchTranslations(ext, this.fetchType, this.selectedLanguages, function(response) {420 this.fetchLanguage(response);421 }, this);422 } else {423 // finished424 Ext.getCmp('lang-checkbutton').enable();425 Ext.getCmp('lang-updatebutton').enable();426 Ext.getCmp('em-extlanguagegrid').getSelectionModel().clearSelections();427 // call callback428 this.cb();429 }430 },431 restoreExtLanguageGrid: function() {432 var extLangGrid = Ext.getCmp('em-extlanguagegrid');433 var i;434 var selLanguages = Ext.getCmp('em-languagegrid').getSelectionModel().getSelections();435 var columns = extLangGrid.getColumnModel();436 var count = columns.getColumnCount();437 if (selLanguages.length > 0 ) {438 for (i=0; i < selLanguages.length; i++) {439 this.addRemoveExtLanguageGridColumn(selLanguages[i].data);440 }441 }442 },443 addRemoveExtLanguageGridColumn: function(record) {444 var extLangGrid = Ext.getCmp('em-extlanguagegrid');445 var columns = extLangGrid.getColumnModel();446 var index = columns.getIndexById(record.lang);447 if (index === -1) {448 extLangGrid.addColumn({449 name: record.lang,450 defaultValue: TYPO3.l10n.localize('translation_status_notchecked')451 }, {452 header: '<span class="' + record.cls + '">&nbsp</span>' + record.label,453 dataIndex: record.lang,454 id: record.lang,455 css: 'cursor:pointer;',456 tooltip: TYPO3.l10n.localize('translation_singleCheckTip')457 });458 } else {459 columns.removeColumn(index);460 }461 this.langGrid.enable();462 },463 afterRender: function() {464 // call parent465 TYPO3.EM.Languages.superclass.afterRender.apply(this, arguments);466 //The following are all of the possible keys that can be implemented: enter, left, right, up, down, tab, esc, pageUp, pageDown, del, home, end467 this.progressNavigation = new Ext.KeyNav(this.getEl(),{468 'esc': function() {469 this.interruptProcess = true;470 },471 scope: this472 });473 }474});...

Full Screen

Full Screen

exec.interruptProcess.test.js

Source:exec.interruptProcess.test.js Github

copy

Full Screen

1jest.mock('./logger');2const { interruptProcess, spawnAndLog } = require('./exec');3describe(interruptProcess.name, () => {4 it('should interrupt a child process promise', async () => {5 await interruptProcess(spawnAndLog('sleep', ['3']));6 }, 500);7 it('should throw exception if child process exited with an error', async () => {8 const script =9 "process.on('SIGINT', () => {});" +10 "setTimeout(()=>process.exit(1), 100);";11 await interruptProcess(spawnAndLog('node', ['-e', script]));12 }, 1000);...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1function interruptProcess() {2 var root = require("root");3 root.interruptProcess();4}5function interruptProcess() {6 var root = require("root");7 root.interruptProcess();8}9function interruptProcess() {10 var root = require("root");11 root.interruptProcess();12}13function interruptProcess() {14 var root = require("root");15 root.interruptProcess();16}17function interruptProcess() {18 var root = require("root");19 root.interruptProcess();20}21function interruptProcess() {22 var root = require("root");23 root.interruptProcess();24}25function interruptProcess() {26 var root = require("root");27 root.interruptProcess();28}29function interruptProcess() {30 var root = require("root");31 root.interruptProcess();32}33function interruptProcess() {34 var root = require("root");35 root.interruptProcess();36}37function interruptProcess() {38 var root = require("root");39 root.interruptProcess();40}

Full Screen

Using AI Code Generation

copy

Full Screen

1'use strict';2angular.module('myApp').controller('test', ['$scope', '$rootScope', '$location', '$timeout', 'testService', function ($scope, $rootScope, $location, $timeout, testService) {3 $scope.test = function () {4 $rootScope.interruptProcess = true;5 $timeout(function () {6 $rootScope.interruptProcess = false;7 }, 5000);8 };9}]);

Full Screen

Using AI Code Generation

copy

Full Screen

1var root = require('sdk/system/xul-app');2root.interruptProcess();3var { Cc, Ci } = require('chrome');4var root = {5 interruptProcess: function() {6 var pid = OS.File.getCurrentProcess();7 var process = Cc['@mozilla.org/process/util;1'].createInstance(Ci.nsIProcess);8 process.init(pid);9 process.kill();10 }11};12exports.root = root;13var root = require('sdk/system/xul-app');14root.interruptProcess();15var root = require('sdk/system/xul-app');16root.interruptProcess();

Full Screen

Using AI Code Generation

copy

Full Screen

1var root = this;2root.interruptProcess();3The `processInterrupted` event is fired when the process is interrupted. This event is fired on the root component. This event is fired when the process is interrupted using the [interruptProcess](#interruptprocess) method. The event is fired with the following parameters:4var root = this;5root.on("processInterrupted", function(interrupted) {6 console.log("Process interrupted: " + interrupted);7});8var root = this;9var process = root.getProcess();10var root = this;11var process = new Process();12process.setProcess(function() {13 console.log("Process started");14});15root.setProcess(process);

Full Screen

Using AI Code Generation

copy

Full Screen

1const root = require('root-path')2const { interruptProcess } = root('lib/util/process')3interruptProcess(1, 'SIGINT')4const { interruptProcess } = require('root-path/lib/util/process')5interruptProcess(1, 'SIGINT')6[MIT](

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