mirror of
https://github.com/openfaas/faas.git
synced 2025-06-22 23:03:24 +00:00
Added function url field and copy action to the UI
This change adds a function URL field to the UI and a 'copy to clipboard' button next to it. If the browser does not support the copy command, the copy icon will be hidden. Signed-off-by: Ken Fukuyama <kenfdev@gmail.com>
This commit is contained in:
19
gateway/assets/script/bootstrap.js
vendored
19
gateway/assets/script/bootstrap.js
vendored
@ -21,6 +21,25 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$interval', '$f
|
||||
contentType: "text"
|
||||
};
|
||||
|
||||
$scope.baseUrl = $location.absUrl().replace(/\ui\/$/, '');
|
||||
try {
|
||||
$scope.canCopyToClipboard = document.queryCommandSupported('copy');
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
$scope.canCopyToClipboard = false;
|
||||
}
|
||||
$scope.copyClicked = function(e) {
|
||||
e.target.parentElement.querySelector('input').select()
|
||||
var copySuccessful = false;
|
||||
try {
|
||||
copySuccessful = document.execCommand('copy');
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
var msg = copySuccessful ? 'Copied to Clipboard' : 'Copy failed. Please copy it manually';
|
||||
showPostInvokedToast(msg);
|
||||
}
|
||||
|
||||
$scope.toggleSideNav = function() {
|
||||
$mdSidenav('left').toggle();
|
||||
};
|
||||
|
Reference in New Issue
Block a user