| | |
| | | formSubmit : formSubmit, |
| | | remove : remove, |
| | | find : find, |
| | | formCheck : formCheck |
| | | formCheck : formCheck, |
| | | copyToken : copyToken |
| | | }; |
| | | |
| | | $scope.vm = { |
| | |
| | | }); |
| | | } |
| | | |
| | | // navigator.clipboard 는 브라우저 보안이나 활성화 여부에 따라 사용이 안될때가 있음 |
| | | function copyToClipboard(textToCopy) { |
| | | // navigator clipboard api needs a secure context (https) |
| | | if (navigator.clipboard && window.isSecureContext) { |
| | | // navigator clipboard api method' |
| | | return navigator.clipboard.writeText(textToCopy); |
| | | } else { |
| | | // text area method |
| | | let textArea = document.createElement("textarea"); |
| | | textArea.value = textToCopy; |
| | | // make the textarea out of viewport |
| | | textArea.style.position = "fixed"; |
| | | textArea.style.left = "-999999px"; |
| | | textArea.style.top = "-999999px"; |
| | | document.body.appendChild(textArea); |
| | | textArea.focus(); |
| | | textArea.select(); |
| | | return new Promise((res, rej) => { |
| | | // here the magic happens |
| | | document.execCommand('copy') ? res() : rej(); |
| | | textArea.remove(); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | function copyToken() { |
| | | copyToClipboard($scope.vm.form.token) |
| | | .then(() => |
| | | SweetAlert.swal($filter("translate")("api.successToApiTokenCopy")) |
| | | ) |
| | | .catch(() => SweetAlert.error($filter("translate")("api.failedToApiTokenCopy"))) |
| | | } |
| | | |
| | | function find() { |
| | | var conditions = { |
| | | appName : $scope.vm.form.appName |