Remove debug entry from main menu
This commit is contained in:
@@ -220,7 +220,6 @@
|
|||||||
<li ng-show="user.admin"><a href="#/graphs"><i class="fa fa-bar-chart fa-fw"></i> Graphs</a></li>
|
<li ng-show="user.admin"><a href="#/graphs"><i class="fa fa-bar-chart fa-fw"></i> Graphs</a></li>
|
||||||
<li ng-show="user.admin"><a href="#/settings"><i class="fa fa-wrench fa-fw"></i> Settings</a></li>
|
<li ng-show="user.admin"><a href="#/settings"><i class="fa fa-wrench fa-fw"></i> Settings</a></li>
|
||||||
<li ng-show="user.admin" class="divider"></li>
|
<li ng-show="user.admin" class="divider"></li>
|
||||||
<li ng-show="user.admin"><a href="#/debug"><i class="fa fa-terminal fa-fw"></i> Terminal</a></li>
|
|
||||||
<li ng-show="user.admin"><a href="#/support"><i class="fa fa-comment fa-fw"></i> Support</a></li>
|
<li ng-show="user.admin"><a href="#/support"><i class="fa fa-comment fa-fw"></i> Support</a></li>
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li><a href="" ng-click="logout($event)"><i class="fa fa-sign-out fa-fw"></i> Logout</a></li>
|
<li><a href="" ng-click="logout($event)"><i class="fa fa-sign-out fa-fw"></i> Logout</a></li>
|
||||||
|
|||||||
@@ -52,9 +52,6 @@ app.config(['$routeProvider', function ($routeProvider) {
|
|||||||
}).when('/graphs', {
|
}).when('/graphs', {
|
||||||
controller: 'GraphsController',
|
controller: 'GraphsController',
|
||||||
templateUrl: 'views/graphs.html'
|
templateUrl: 'views/graphs.html'
|
||||||
}).when('/debug', {
|
|
||||||
controller: 'DebugController',
|
|
||||||
templateUrl: 'views/debug.html'
|
|
||||||
}).when('/domains', {
|
}).when('/domains', {
|
||||||
controller: 'DomainsController',
|
controller: 'DomainsController',
|
||||||
templateUrl: 'views/domains.html'
|
templateUrl: 'views/domains.html'
|
||||||
|
|||||||
@@ -1,119 +0,0 @@
|
|||||||
<!-- Modal download file -->
|
|
||||||
<div class="modal fade" id="downloadFileModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h4 class="modal-title">Download from {{ selected.name }}</h4>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<form name="downloadFileForm" ng-submit="downloadFile.submit()">
|
|
||||||
<div class="form-group" ng-class="{ 'has-error': downloadFileForm.filePath.$dirty && downloadFile.error }">
|
|
||||||
<label class="control-label" for="inputDownloadFilePath">Path to file or directory</label>
|
|
||||||
<div class="control-label" ng-show="{ 'has-error': downloadFileForm.filePath.$dirty && downloadFile.error }">
|
|
||||||
<small>{{ downloadFile.error }}</small>
|
|
||||||
</div>
|
|
||||||
<input type="text" class="form-control" name="filePath" ng-model="downloadFile.filePath" required autofocus>
|
|
||||||
</div>
|
|
||||||
<input id="inputDownloadFilePath" class="ng-hide" type="submit" ng-disabled="!downloadFile.filePath"/>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<a id="fileDownloadLink" class="" ng-href="{{ downloadFile.downloadUrl() }}" target="_blank"></a>
|
|
||||||
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
|
||||||
<button type="button" class="btn btn-success" ng-click="downloadFile.submit()" ng-disabled="!downloadFile.filePath"><i class="fa fa-circle-o-notch fa-spin" ng-show="downloadFile.busy"></i> Download</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Modal upload progress -->
|
|
||||||
<div class="modal fade" id="uploadProgressModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h4 class="modal-title">Uploading file to {{ selected.name }}</h4>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<span><b>{{ (uploadProgress.current/1000/1000).toFixed(2) }}mb</b> (total {{ (uploadProgress.total/1000/1000).toFixed(2) }}mb)</span>
|
|
||||||
<div class="progress progress-striped active">
|
|
||||||
<div class="progress-bar progress-bar-success" role="progressbar" style="width: {{ 100*(uploadProgress.current/uploadProgress.total) }}%"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Modal repair info -->
|
|
||||||
<div class="modal fade" id="repairAppModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h4 class="modal-title">Repair app {{ selected.name }} ?</h4>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<p>This will restart the app in repair mode. The app will start in a paused state and can be used to fix broken plugins or database content.</p>
|
|
||||||
<p class="text-danger text-bold">The app will not be reachable in repair mode!</p>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
|
||||||
<button type="button" class="btn btn-danger" ng-click="repairAppBegin()">Repair</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="terminal-controls">
|
|
||||||
<div class="col-md-10 col-md-offset-1">
|
|
||||||
<h3>Terminal</h3>
|
|
||||||
<select class="form-control pull-right inline" ng-options="app.name for app in apps track by app.value" ng-model="selected">
|
|
||||||
<option value="" disabled selected>Select App</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<input type="file" id="fileUpload" class="hide"/>
|
|
||||||
|
|
||||||
<!-- terminal actions -->
|
|
||||||
<div class="btn-group pull-right" style="margin-left: 10px;">
|
|
||||||
<button class="btn btn-default" ng-click="restartApp()" ng-show="selected.type === 'app'" ng-disabled="restartAppBusy"><i class="fa fa-refresh" ng-class="{ 'fa-spin': restartAppBusy }"></i> Restart</button>
|
|
||||||
<button class="btn btn-default" ng-click="uploadFile()" ng-show="selected.type === 'app' && !uploadProgress.busy"><i class="fa fa-upload"></i> Upload to /tmp</button>
|
|
||||||
<button class="btn btn-default" ng-click="uploadProgress.show()" ng-show="uploadProgress.busy"><i class="fa fa-circle-o-notch fa-spin"></i> Uploading...</button>
|
|
||||||
<button class="btn btn-default" ng-click="downloadFile.show()" ng-show="selected.type === 'app'"><i class="fa fa-download"></i> Download</button>
|
|
||||||
<button class="btn btn-default" ng-click="repairApp()" ng-show="selected.type === 'app' && !selectedAppInfo.debugMode && !appBusy"><i class="fa fa-wrench"></i> Repair</button>
|
|
||||||
<button class="btn btn-danger" ng-click="repairAppDone()" ng-show="selectedAppInfo.debugMode && !appBusy"><i class="fa fa-wrench"></i> Repair Done</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="btn-group pull-right" style="margin-left: 10px;">
|
|
||||||
<button class="btn btn-default" ng-click="terminalInject('mysql')" ng-show="usesAddon('mysql')">MySQL</button>
|
|
||||||
<button class="btn btn-default" ng-click="terminalInject('postgresql')" ng-show="usesAddon('postgresql')">Postgres</button>
|
|
||||||
<button class="btn btn-default" ng-click="terminalInject('mongodb')" ng-show="usesAddon('mongodb')">MongoDB</button>
|
|
||||||
<button class="btn btn-default" ng-click="terminalInject('redis')" ng-show="usesAddon('redis')">Redis</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="terminal-container" id="terminalContainer" ng-hide="appBusy"></div>
|
|
||||||
<div class="terminal-container placeholder" ng-show="appBusy">
|
|
||||||
<h4>
|
|
||||||
<span ng-show="selectedAppInfo.installationState === 'pending_configure' && selectedAppInfo.debugMode">Restarting app for repair...</span>
|
|
||||||
<span ng-show="selectedAppInfo.installationState === 'pending_configure' && !selectedAppInfo.debugMode ">App is being reconfigured...</span>
|
|
||||||
<span ng-show="selectedAppInfo.installationState === 'installed' && !selectedAppInfo.debugMode">Waiting for app to start...</span>
|
|
||||||
<span ng-show="selectedAppInfo.installationState === 'pending_installed'">App is being installed...</span>
|
|
||||||
</h4>
|
|
||||||
|
|
||||||
<div class="progress" ng-show="appBusy" style="width: 80%">
|
|
||||||
<div class="progress-bar progress-bar-striped active" role="progressbar" style="width: 100%">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="contextMenuBackdrop">
|
|
||||||
<ul class="dropdown-menu" id="terminalContextMenu" style="position: absolute; display:none;">
|
|
||||||
<li><a href="" ng-click="terminalCopy()">Copy</a></li>
|
|
||||||
<li class="disabled"><a>For Paste use Ctrl+v</a></li>
|
|
||||||
<li role="separator" class="divider"></li>
|
|
||||||
<li><a href="" ng-click="terminalClear()">Clear</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
@@ -1,329 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
/* global Terminal */
|
|
||||||
|
|
||||||
angular.module('Application').controller('DebugController', ['$scope', '$location', 'Client', function ($scope, $location, Client) {
|
|
||||||
Client.onReady(function () { if (!Client.getUserInfo().admin) $location.path('/'); });
|
|
||||||
|
|
||||||
$scope.config = Client.getConfig();
|
|
||||||
$scope.user = Client.getUserInfo();
|
|
||||||
|
|
||||||
$scope.apps = [];
|
|
||||||
$scope.selected = '';
|
|
||||||
$scope.terminal = null;
|
|
||||||
$scope.terminalSocket = null;
|
|
||||||
$scope.restartAppBusy = false;
|
|
||||||
$scope.appBusy = false;
|
|
||||||
$scope.selectedAppInfo = null;
|
|
||||||
|
|
||||||
$scope.downloadFile = {
|
|
||||||
error: '',
|
|
||||||
filePath: '',
|
|
||||||
busy: false,
|
|
||||||
|
|
||||||
downloadUrl: function () {
|
|
||||||
if (!$scope.downloadFile.filePath) return '';
|
|
||||||
|
|
||||||
var filePath = $scope.downloadFile.filePath.replace(/\/*\//g, '/');
|
|
||||||
|
|
||||||
return Client.apiOrigin + '/api/v1/apps/' + $scope.selected.value + '/download?file=' + filePath + '&access_token=' + Client.getToken();
|
|
||||||
},
|
|
||||||
|
|
||||||
show: function () {
|
|
||||||
$scope.downloadFile.busy = false;
|
|
||||||
$scope.downloadFile.error = '';
|
|
||||||
$scope.downloadFile.filePath = '';
|
|
||||||
$('#downloadFileModal').modal('show');
|
|
||||||
},
|
|
||||||
|
|
||||||
submit: function () {
|
|
||||||
$scope.downloadFile.busy = true;
|
|
||||||
|
|
||||||
Client.checkDownloadableFile($scope.selected.value, $scope.downloadFile.filePath, function (error) {
|
|
||||||
$scope.downloadFile.busy = false;
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
$scope.downloadFile.error = 'The requested file does not exist.';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we have to click the link to make the browser do the download
|
|
||||||
// don't know how to prevent the browsers
|
|
||||||
$('#fileDownloadLink')[0].click();
|
|
||||||
|
|
||||||
$('#downloadFileModal').modal('hide');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.uploadProgress = {
|
|
||||||
busy: false,
|
|
||||||
total: 0,
|
|
||||||
current: 0,
|
|
||||||
|
|
||||||
show: function () {
|
|
||||||
$scope.uploadProgress.total = 0;
|
|
||||||
$scope.uploadProgress.current = 0;
|
|
||||||
|
|
||||||
$('#uploadProgressModal').modal('show');
|
|
||||||
},
|
|
||||||
|
|
||||||
hide: function () {
|
|
||||||
$('#uploadProgressModal').modal('hide');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.uploadFile = function () {
|
|
||||||
var fileUpload = document.querySelector('#fileUpload');
|
|
||||||
|
|
||||||
fileUpload.onchange = function (e) {
|
|
||||||
if (e.target.files.length === 0) return;
|
|
||||||
|
|
||||||
$scope.uploadProgress.busy = true;
|
|
||||||
$scope.uploadProgress.show();
|
|
||||||
|
|
||||||
Client.uploadFile($scope.selected.value, e.target.files[0], function progress(e) {
|
|
||||||
$scope.uploadProgress.total = e.total;
|
|
||||||
$scope.uploadProgress.current = e.loaded;
|
|
||||||
}, function (error) {
|
|
||||||
if (error) console.error(error);
|
|
||||||
|
|
||||||
$scope.uploadProgress.busy = false;
|
|
||||||
$scope.uploadProgress.hide();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
fileUpload.click();
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.populateDropdown = function () {
|
|
||||||
Client.getInstalledApps().forEach(function (app) {
|
|
||||||
$scope.apps.push({
|
|
||||||
type: 'app',
|
|
||||||
value: app.id,
|
|
||||||
name: app.fqdn + ' (' + app.manifest.title + ')',
|
|
||||||
addons: app.manifest.addons
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// $scope.selected = $scope.apps[0];
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.usesAddon = function (addon) {
|
|
||||||
if (!$scope.selected || !$scope.selected.addons) return false;
|
|
||||||
return !!Object.keys($scope.selected.addons).find(function (a) { return a === addon; });
|
|
||||||
};
|
|
||||||
|
|
||||||
function reset() {
|
|
||||||
if ($scope.terminal) {
|
|
||||||
$scope.terminal.destroy();
|
|
||||||
$scope.terminal = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($scope.terminalSocket) {
|
|
||||||
$scope.terminalSocket = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.selectedAppInfo = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.restartApp = function () {
|
|
||||||
$scope.restartAppBusy = true;
|
|
||||||
var appId = $scope.selected.value;
|
|
||||||
|
|
||||||
function waitUntilStopped(callback) {
|
|
||||||
Client.refreshInstalledApps(function (error) {
|
|
||||||
if (error) return callback(error);
|
|
||||||
|
|
||||||
Client.getApp(appId, function (error, result) {
|
|
||||||
if (error) return callback(error);
|
|
||||||
|
|
||||||
if (result.runState === 'stopped') return callback();
|
|
||||||
setTimeout(waitUntilStopped.bind(null, callback), 2000);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Client.stopApp(appId, function (error) {
|
|
||||||
if (error) return console.error('Failed to stop app.', error);
|
|
||||||
|
|
||||||
waitUntilStopped(function (error) {
|
|
||||||
if (error) return console.error('Failed to get app status.', error);
|
|
||||||
|
|
||||||
Client.startApp(appId, function (error) {
|
|
||||||
if (error) console.error('Failed to start app.', error);
|
|
||||||
|
|
||||||
$scope.restartAppBusy = false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.repairApp = function () {
|
|
||||||
$('#repairAppModal').modal('show');
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.repairAppBegin = function () {
|
|
||||||
$scope.appBusy = true;
|
|
||||||
|
|
||||||
Client.debugApp($scope.selected.value, true, function (error) {
|
|
||||||
if (error) return console.error(error);
|
|
||||||
|
|
||||||
Client.refreshInstalledApps(function (error) {
|
|
||||||
if (error) console.error(error);
|
|
||||||
|
|
||||||
$('#repairAppModal').modal('hide');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.repairAppDone = function () {
|
|
||||||
$scope.appBusy = true;
|
|
||||||
|
|
||||||
Client.debugApp($scope.selected.value, false, function (error) {
|
|
||||||
if (error) return console.error(error);
|
|
||||||
|
|
||||||
Client.refreshInstalledApps(function (error) {
|
|
||||||
if (error) console.error(error);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.showTerminal = function (retry) {
|
|
||||||
reset();
|
|
||||||
|
|
||||||
if (!$scope.selected) return;
|
|
||||||
|
|
||||||
// fetch current app state
|
|
||||||
Client.refreshInstalledApps(function (error) {
|
|
||||||
if (error) console.error(error);
|
|
||||||
|
|
||||||
$scope.terminal = new Terminal();
|
|
||||||
$scope.terminal.open(document.querySelector('#terminalContainer'));
|
|
||||||
$scope.terminal.fit();
|
|
||||||
|
|
||||||
try {
|
|
||||||
// websocket cannot use relative urls
|
|
||||||
var url = Client.apiOrigin.replace('https', 'wss') + '/api/v1/apps/' + $scope.selected.value + '/execws?tty=true&rows=' + $scope.terminal.rows + '&columns=' + $scope.terminal.cols + '&access_token=' + Client.getToken();
|
|
||||||
$scope.terminalSocket = new WebSocket(url);
|
|
||||||
$scope.terminal.attach($scope.terminalSocket);
|
|
||||||
|
|
||||||
$scope.terminalSocket.onclose = function () {
|
|
||||||
// retry in one second only if terminal view is still selected
|
|
||||||
$scope.terminalReconnectTimeout = setTimeout(function () {
|
|
||||||
// if the scope was already destroyed, do not reconnect
|
|
||||||
if ($scope.$$destroyed) return;
|
|
||||||
$scope.showTerminal(true);
|
|
||||||
}, 1000);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Let the browser handle paste
|
|
||||||
$scope.terminal.attachCustomKeyEventHandler(function (e) {
|
|
||||||
if (e.key === 'v' && (e.ctrlKey || e.metaKey)) return false;
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (retry) $scope.terminal.writeln('Reconnecting...');
|
|
||||||
else $scope.terminal.writeln('Connecting...');
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.terminalInject = function (addon) {
|
|
||||||
if (!$scope.terminalSocket) return;
|
|
||||||
|
|
||||||
var cmd;
|
|
||||||
if (addon === 'mysql') cmd = 'mysql --user=${MYSQL_USERNAME} --password=${MYSQL_PASSWORD} --host=${MYSQL_HOST} ${MYSQL_DATABASE}';
|
|
||||||
else if (addon === 'postgresql') cmd = 'PGPASSWORD=${POSTGRESQL_PASSWORD} psql -h ${POSTGRESQL_HOST} -p ${POSTGRESQL_PORT} -U ${POSTGRESQL_USERNAME} -d ${POSTGRESQL_DATABASE}';
|
|
||||||
else if (addon === 'mongodb') cmd = 'mongo -u "${MONGODB_USERNAME}" -p "${MONGODB_PASSWORD}" ${MONGODB_HOST}:${MONGODB_PORT}/${MONGODB_DATABASE}';
|
|
||||||
else if (addon === 'redis') cmd = 'redis-cli -h "${REDIS_HOST}" -p "${REDIS_PORT}" -a "${REDIS_PASSWORD}"';
|
|
||||||
|
|
||||||
if (!cmd) return;
|
|
||||||
|
|
||||||
cmd += ' ';
|
|
||||||
|
|
||||||
$scope.terminalSocket.send(cmd);
|
|
||||||
$scope.terminal.focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.$watch('selected', function (newVal) {
|
|
||||||
if (!newVal) return;
|
|
||||||
|
|
||||||
$scope.showTerminal();
|
|
||||||
});
|
|
||||||
|
|
||||||
Client.onReady($scope.populateDropdown);
|
|
||||||
|
|
||||||
Client.onApps(function () {
|
|
||||||
if ($scope.$$destroyed) return;
|
|
||||||
if ($scope.selected.type !== 'app') return $scope.appBusy = false;
|
|
||||||
|
|
||||||
var appId = $scope.selected.value;
|
|
||||||
|
|
||||||
Client.getApp(appId, function (error, result) {
|
|
||||||
if (error) return console.error(error);
|
|
||||||
|
|
||||||
// we expect this to be called _after_ a reconfigure was issued
|
|
||||||
if (result.installationState === 'pending_configure') {
|
|
||||||
$scope.appBusy = true;
|
|
||||||
} else if (result.installationState === 'installed') {
|
|
||||||
$scope.appBusy = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.selectedAppInfo = result;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.$on('$destroy', function () {
|
|
||||||
if ($scope.terminal) {
|
|
||||||
$scope.terminal.destroy();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// terminal right click handling
|
|
||||||
$scope.terminalClear = function () {
|
|
||||||
if (!$scope.terminal) return;
|
|
||||||
$scope.terminal.clear();
|
|
||||||
$scope.terminal.focus();
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.terminalCopy = function () {
|
|
||||||
if (!$scope.terminal) return;
|
|
||||||
|
|
||||||
// execCommand('copy') would copy any selection from the page, so do this only if terminal has a selection
|
|
||||||
if (!$scope.terminal.getSelection()) return;
|
|
||||||
|
|
||||||
document.execCommand('copy');
|
|
||||||
$scope.terminal.focus();
|
|
||||||
};
|
|
||||||
|
|
||||||
$('.contextMenuBackdrop').on('click', function (e) {
|
|
||||||
$('#terminalContextMenu').hide();
|
|
||||||
$('.contextMenuBackdrop').hide();
|
|
||||||
|
|
||||||
$scope.terminal.focus();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#terminalContainer').on('contextmenu', function (e) {
|
|
||||||
if (!$scope.terminal) return true;
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
$('.contextMenuBackdrop').show();
|
|
||||||
$('#terminalContextMenu').css({
|
|
||||||
display: 'block',
|
|
||||||
left: e.pageX,
|
|
||||||
top: e.pageY
|
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
// setup all the dialog focus handling
|
|
||||||
['downloadFileModal'].forEach(function (id) {
|
|
||||||
$('#' + id).on('shown.bs.modal', function () {
|
|
||||||
$(this).find("[autofocus]:first").focus();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}]);
|
|
||||||
Reference in New Issue
Block a user