Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
var mainWindow = null;
// Quit when all windows are closed.
app.on('window-all-closed', function() {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform != 'darwin') {
app.quit();
}
});
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
app.on('ready', function() {
function requestHandler(req, res) {
var
file = req.url == '/' ? '/app.html' : req.url,
root = __dirname + '/',
page404 = root + '/404.html';
console.log((root + file))
getFile((root + file), res, page404);
};
// start a simple server that can serve an html page and resolve local file loading.
var server = http.createServer(requestHandler).listen(3000);
// Put the app on a secondary display if availalbe
var atomScreen = require('screen');
var displays = atomScreen.getAllDisplays();
// Report crashes to our server.
require('crash-reporter').start();
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the javascript object is GCed.
var mainWindow = null;
app.on('window-all-closed', function() {
if(process.platform !== 'darwin') {
app.quit();
}
});
// This method will be called when Electron has done everything
// initialization and ready for creating browser windows.
app.on('ready', function() {
// Register a 'ctrl+x' shortcut listener.
var ret = globalShortcut.register(process.platform === 'win32' ? 'ctrl+g' : 'cmd+g', function() {
console.log('cmd+g/ctrl+g is pressed');
console.log(clipboard.readText('selection'));
var url = clipboard.readText('selection');
mainWindow.webContents.executeJavaScript("addNewURL('"+url+"');");
});
if (!ret) {
console.log('registration failed');
}
if (app.dock) app.dock.hide();
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the javascript object is GCed.
var mainWindow = null;
// Quit when all windows are closed.
app.on('window-all-closed', function() {
app.quit();
});
var Menu = require('menu');
// This method will be called when Electron has done everything
// initialization and ready for creating browser windows.
app.on('ready', function() {
initWindow();
function initWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({width: 1058, height: 640, resizable: false});
// and load the index.html of the app.
mainWindow.loadUrl(hosturl + '#/setup')
// Emitted when the window is closed.
mainWindow.on('closed', function() {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
onNext = function (data) {
modeNext += 1;
switch (modeNext) {
case 1:
/* istanbul ignore next */
if (process.env.npm_config_mode_auto_restart) {
return;
}
// wait for electron to init
try {
require("app").on("ready", onNext);
} catch (ignore) {
require("electron").app.once("ready", onNext);
}
break;
case 2:
// init options
options = {
frame: false,
height: 768,
width: 1024,
x: 0,
y: 0
};
// init browserWindow;
try {
options.BrowserWindow = require("browser-window");
var $ = require('jquery');
var _ = require('underscore');
var Util = require('util');
var App = require('app');
var Localization = require('localization');
var MarkdownViewer = require('components/markdown/MarkdownViewer');
var SingletonDefectTypeCollection = require('defectType/SingletonDefectTypeCollection');
var LaunchItemMenuView = require('launches/launchLevel/LaunchItemMenuView');
var LaunchSuiteDefectsView = require('launches/common/LaunchSuiteDefectsView');
var ItemDurationView = require('launches/common/ItemDurationView');
var ItemStartTimeView = require('launches/common/ItemStartTimeView');
var SingletonLaunchFilterCollection = require('filters/SingletonLaunchFilterCollection');
var ModalLaunchItemEdit = require('modals/modalLaunchItemEdit');
var CommonItemView = require('launches/common/CommonItemView');
var config = App.getInstance();
var LaunchSuiteItemView = CommonItemView.extend({
template: 'tpl-launch-suite-item',
className: 'row rp-table-row',
statusTpl: 'tpl-launch-suite-item-status',
events: {
click: 'onClickView',
'click [data-js-name-link]': 'onClickName', // common method
'click [data-js-launch-menu]': 'showItemMenu',
'click [data-js-item-edit]': 'onClickEdit',
'click [data-js-tag]': 'onClickTag',
'click [data-js-owner-name]': 'onClickOwnerName',
'click [data-js-statistics-to-investigate]': 'onClickToInvestigate',
'click [data-js-toggle-open]': 'onClickOpen',
'click [data-js-select-label]': 'onClickSelectLabel',
'click [data-js-select-item]': 'onClickSelectInput'
define(function (require) {
'use strict';
var $ = require('jquery');
var _ = require('underscore');
var Epoxy = require('backbone-epoxy');
var Util = require('util');
var App = require('app');
var CallService = require('callService');
var memberService = require('memberService');
var Urls = require('dataUrlResolver');
var ModalConfirm = require('modals/modalConfirm');
var Localization = require('localization');
var DropDownComponent = require('components/DropDownComponent');
var config = App.getInstance();
var MembersItemView = Epoxy.View.extend({
tpl: 'tpl-users-projects-item',
className: 'row rp-table-row user-projects-row',
bindings: {
'[data-js-project]': 'text: projectId',
'[data-js-project-role]': 'text: getProjectRole',
'[data-js-dropdown-roles]': 'updateRoleDropDown: projectRole',
'[data-js-unassign]': 'classes: {disabled: not(canUnAssign)}, attr: {disabled: not(canUnAssign)}',
// '[data-js-user-select-role]': 'classes: {hide: isAdmin}',
// '[data-js-admin-role]': 'classes: {hide: not(isAdmin)}',
},
computeds: {
addToolTip: function() {
/* istanbul ignore next */
if (this.get('controller.isAllServicesInstalled')) {
App.tooltip($('.add-service-button a'), {title: Em.I18n.t('services.nothingToAdd')});
}
}.observes('controller.isAllServicesInstalled')
});
var target = path.basename(process.execPath);
switch (squirrelCommand) {
case "--squirrel-install":
case "--squirrel-updated":
updateCmd(["--createShortcut", target], app.quit);
break;
case "--squirrel-uninstall":
updateCmd(["--removeShortcut", target], app.quit);
break;
case "--squirrel-obsolete":
app.quit();
break;
}
}
app.on("ready", function() {
var appIcon = new Tray(iconIdle);
initWindow();
if (process.platform === "darwin") {
applySettings();
}
function initWindow() {
var defaults = {
frame: false,
height: 600,
resizable: false,
width: 360
};
appIcon.window = new BrowserWindow(defaults);
changeCategoryOnHa: function (serviceConfigs, stepConfigs) {
var hdfsService = serviceConfigs.findProperty('serviceName', 'HDFS');
if (hdfsService) {
var properties = stepConfigs.findProperty('serviceName', 'HDFS').get('configs');
var configCategories = hdfsService.configCategories;
if ((App.get('testMode') && App.get('testNameNodeHA')) || (this.get('content.isNnHa') === 'true')) {
this.removeConfigCategory(properties, configCategories, 'SNameNode');
} else {
this.removeConfigCategory(properties, configCategories, 'JournalNode');
}
return true;
}
return false;
},
/**
monitorInactivity: function() {
var timeout = Number(App.router.get('clusterController.ambariProperties')['user.inactivity.timeout.default']);
var readonly_timeout = Number(App.router.get('clusterController.ambariProperties')['user.inactivity.timeout.role.readonly.default']);
var isAdmin = App.get('isAdmin');
if (isAdmin && timeout > 0) {
this.set('userTimeOut', timeout * 1000);
} else if (!isAdmin && readonly_timeout > 0) {
this.set('userTimeOut', readonly_timeout * 1000);
}
if (this.get('userTimeOut') > 0) {
this.startMonitorInactivity();
}
},