From b631b0f27133f9cfc181f6e24e32e51471f73ac4 Mon Sep 17 00:00:00 2001 From: Sam Chow Date: Thu, 14 Jun 2018 17:18:58 -0400 Subject: [PATCH] Add missing files changed directive to upload --- config_app/js/components/files-changed.js | 18 +++++++++++++++ .../load-config/load-config.component.ts | 23 ++++++++++++++++++- .../components/load-config/load-config.html | 6 ++++- 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 config_app/js/components/files-changed.js diff --git a/config_app/js/components/files-changed.js b/config_app/js/components/files-changed.js new file mode 100644 index 000000000..997dd9144 --- /dev/null +++ b/config_app/js/components/files-changed.js @@ -0,0 +1,18 @@ +/** + * Raises the 'filesChanged' event on the scope if a file on the marked exists. + */ +angular.module('quay-config').directive("filesChanged", [function () { + return { + restrict: 'A', + scope: { + 'filesChanged': "&" + }, + link: function (scope, element, attributes) { + element.bind("change", function (changeEvent) { + scope.$apply(function() { + scope.filesChanged({'files': changeEvent.target.files}); + }); + }); + } + } +}]); diff --git a/config_app/js/components/load-config/load-config.component.ts b/config_app/js/components/load-config/load-config.component.ts index f8a3ba47a..933a5469e 100644 --- a/config_app/js/components/load-config/load-config.component.ts +++ b/config_app/js/components/load-config/load-config.component.ts @@ -6,6 +6,27 @@ const templateUrl = require('./load-config.html'); templateUrl, }) export class LoadConfigComponent { - constructor() { + private resetUpload: number = 0; + + private handleTarballSelected(files, callback) { + console.log('hi world') + /* + $scope.certsUploading = true; + $upload.upload({ + url: '/api/v1/superuser/customcerts/' + files[0].name, + method: 'POST', + data: {'_csrf_token': window.__token}, + file: files[0] + }).success(function() { + callback(true); + $scope.resetUpload++; + loadCertificates(); + }).error(function(r) { + bootbox.alert('Could not upload certificate') + callback(false); + $scope.resetUpload++; + loadCertificates(); + }); + */ } } \ No newline at end of file diff --git a/config_app/js/components/load-config/load-config.html b/config_app/js/components/load-config/load-config.html index 60f78ff2b..3a5d0606e 100644 --- a/config_app/js/components/load-config/load-config.html +++ b/config_app/js/components/load-config/load-config.html @@ -10,7 +10,11 @@
Please upload a tarball -
+