Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- update blueprints-catalog plugin version;
- exclude dist folder of the plugin from .gitignore;
- Loading branch information
Showing
14 changed files
with
320 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
{ | ||
"name": "blueprints-catalog", | ||
"description": "AngularJS directive that displays the list of repositories containing blueprints that are ready to deploy.", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"homepage": "https://github.com/adubovsky/blueprints-catalog", | ||
"private": false, | ||
"dependencies": { | ||
"angular": ">= 1.2.0" | ||
}, | ||
"_release": "0.0.1", | ||
"_release": "0.0.2", | ||
"_resolution": { | ||
"type": "version", | ||
"tag": "v0.0.1", | ||
"commit": "579e6b5a3c5de06793823f7c781871966a1a7e5a" | ||
"tag": "v0.0.2", | ||
"commit": "cf805d7f9e62958d2015c58bad7888677d4419ad" | ||
}, | ||
"_source": "git@github.com:adubovsky/blueprints-catalog.git", | ||
"_target": "v0.0.1", | ||
"_originalSource": "git@github.com:adubovsky/blueprints-catalog.git", | ||
"_direct": true | ||
"_target": "v0.0.2", | ||
"_originalSource": "git@github.com:adubovsky/blueprints-catalog.git" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
source/bower_components/blueprints-catalog/dist/blueprinting_catalog_app.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
'use strict'; | ||
|
||
angular.module('blueprintingCatalogApp', ['blueprintingCatalogWidget']) | ||
|
||
.config(['$compileProvider', '$logProvider', function ($compileProvider, $logProvider) { | ||
$compileProvider.debugInfoEnabled(false); | ||
$logProvider.debugEnabled(false); | ||
}]); |
1 change: 1 addition & 0 deletions
1
source/bower_components/blueprints-catalog/dist/blueprinting_catalog_app.min.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
71 changes: 71 additions & 0 deletions
71
source/bower_components/blueprints-catalog/dist/blueprinting_catalog_base.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
.bl-catalog { | ||
margin-bottom: 30px; | ||
} | ||
|
||
.bl-catalog table { | ||
width: 100%; | ||
} | ||
|
||
.bl-catalog ul { | ||
display: inline; | ||
list-style-type: none; | ||
margin: 0; | ||
} | ||
|
||
.bl-catalog ul li { | ||
display: inline; | ||
padding-right: 10px; | ||
} | ||
|
||
.bl-catalog .action-links { | ||
float: right; | ||
} | ||
|
||
.bl-catalog .to-list { | ||
float: left; | ||
} | ||
|
||
.bl-catalog .to-list:before { | ||
content: '\3008'; | ||
} | ||
|
||
.bl-catalog .upload-backdrop { | ||
position: fixed; | ||
top: 0; | ||
right: 0; | ||
left: 0; | ||
bottom: 0; | ||
opacity: 0.5; | ||
z-index: 3000; | ||
background-color: #000; | ||
} | ||
|
||
.bl-catalog .upload-popup { | ||
position: fixed; | ||
top: 30px; | ||
left: 0; | ||
right: 0; | ||
width: 400px; | ||
margin: auto; | ||
z-index: 3001; | ||
background-color: #fff; | ||
border-radius: 3px; | ||
padding: 10px 15px; | ||
overflow: hidden; | ||
} | ||
|
||
.bl-catalog .upload-popup .close-popup { | ||
float: right; | ||
} | ||
|
||
.bl-catalog .upload-popup .upload-content form label { | ||
display: block; | ||
} | ||
|
||
.bl-catalog .upload-popup .upload-content form select { | ||
width: 314px; | ||
} | ||
|
||
.bl-catalog .upload-popup .upload-content form input { | ||
width: 300px; | ||
} |
1 change: 1 addition & 0 deletions
1
source/bower_components/blueprints-catalog/dist/blueprinting_catalog_base.min.css
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
207 changes: 207 additions & 0 deletions
207
source/bower_components/blueprints-catalog/dist/blueprinting_catalog_widget.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,207 @@ | ||
'use strict'; | ||
|
||
(function () { | ||
var catalog = angular.module('blueprintingCatalogWidget', []); | ||
|
||
var LOG_TAG = 'BLUEPRINTING CATALOG WIDGET'; | ||
var defaultError = 'unexpected error occurred'; | ||
|
||
var endpoint = 'https://api.github.com'; | ||
var githubQuery = '/search/repositories?q=*-example+user:cloudify-examples'; | ||
var blueprintsEndpoint = ''; | ||
|
||
catalog.directive('blueprintingCatalog', ['Github', 'CloudifyManager', 'CatalogHelper', '$log', function (Github, CloudifyManager, CatalogHelper, $log) { | ||
|
||
return { | ||
restrict: 'A', | ||
scope: { | ||
githubQuery: '@catalogGithubQuery', | ||
listTitle: '@catalogListTitle', | ||
listDescription: '@catalogListDescription', | ||
blueprintsEndpoint: '@catalogDefaultManager' | ||
}, | ||
templateUrl: 'blueprinting_catalog_widget_tpl.html', | ||
link: function ($scope) { | ||
if ($scope.githubQuery) { | ||
githubQuery = $scope.githubQuery; | ||
|
||
$log.debug(LOG_TAG, 'default search query was overridden with', githubQuery); | ||
} | ||
if ($scope.blueprintsEndpoint) { | ||
blueprintsEndpoint = $scope.blueprintsEndpoint; | ||
|
||
$log.debug(LOG_TAG, 'default manager endpoint was overridden with', blueprintsEndpoint); | ||
} | ||
|
||
$scope.loading = true; | ||
Github.getRepositories().then(function (response) { | ||
$log.debug(LOG_TAG, 'fetched repos', response); | ||
|
||
$scope.repos = response.data && response.data.items || []; | ||
}).finally(function () { | ||
$scope.loading = false; | ||
}); | ||
|
||
$scope.showDetails = function (repo) { | ||
$log.debug(LOG_TAG, 'show details', repo); | ||
|
||
CatalogHelper.fillTags(repo); | ||
CatalogHelper.fillReadme(repo); | ||
|
||
$scope.currentRepo = repo; | ||
}; | ||
|
||
$scope.showList = function () { | ||
$scope.currentRepo = undefined; | ||
}; | ||
|
||
$scope.showUpload = function (repo) { | ||
$log.debug(LOG_TAG, 'show upload', repo); | ||
|
||
CatalogHelper.fillTags(repo); | ||
CatalogHelper.fillBranches(repo); | ||
|
||
$scope.managerEndpoint = blueprintsEndpoint; | ||
$scope.blueprint = { | ||
path: 'blueprint.yaml', | ||
id: repo.name, | ||
url: repo.html_url + '/archive/' + repo.default_branch + '.zip' | ||
}; | ||
|
||
$scope.uploadRepo = repo; | ||
}; | ||
|
||
$scope.closeUpload = function () { | ||
$scope.uploadRepo = undefined; | ||
}; | ||
|
||
$scope.uploadBlueprint = function () { | ||
$log.debug(LOG_TAG, 'do upload'); | ||
|
||
if ($scope.blueprintForm.$valid) { | ||
|
||
$scope.processing = true; | ||
$scope.error = undefined; | ||
CloudifyManager.upload($scope.managerEndpoint, $scope.blueprint) | ||
.then(function () { | ||
$scope.uploadRepo = undefined; | ||
}, function (response) { | ||
$scope.error = CatalogHelper.getErrorFromResponse(response); | ||
}) | ||
.finally(function () { | ||
$scope.processing = false; | ||
}); | ||
} | ||
}; | ||
} | ||
}; | ||
|
||
}]); | ||
|
||
catalog.factory('CatalogHelper', ['Github', '$sce', function (Github, $sce) { | ||
|
||
return { | ||
fillTags: function (repo) { | ||
if (!repo.tagsList) { | ||
Github.getTags(repo.url).then(function (response) { | ||
repo.tagsList = response.data || []; | ||
}, function () { | ||
repo.tagsList = []; | ||
}); | ||
} | ||
}, | ||
fillBranches: function (repo) { | ||
if (!repo.branchesList) { | ||
Github.getBranches(repo.url).then(function (response) { | ||
repo.branchesList = response.data || []; | ||
}, function () { | ||
repo.branchesList = []; | ||
}); | ||
} | ||
}, | ||
fillReadme: function (repo) { | ||
if (!repo.readmeContent) { | ||
Github.getReadme(repo.url).then(function (response) { | ||
repo.readmeContent = $sce.trustAsHtml(response.data || 'No Readme File'); | ||
}, function () { | ||
repo.readmeContent = $sce.trustAsHtml('No Readme File'); | ||
}); | ||
} | ||
}, | ||
|
||
getErrorFromResponse: function (response) { | ||
if (response && response.data) { | ||
if (typeof response.data === 'string') { | ||
return response.data; | ||
} else { | ||
return response.data.message || defaultError; | ||
} | ||
} else { | ||
return defaultError; | ||
} | ||
} | ||
}; | ||
}]); | ||
|
||
catalog.factory('Github', ['$http', function ($http) { | ||
|
||
return { | ||
getRepositories: function () { | ||
return $http({ | ||
method: 'GET', | ||
url: endpoint + githubQuery | ||
}); | ||
}, | ||
getTags: function (repo_url) { | ||
return $http({ | ||
method: 'GET', | ||
url: repo_url + '/tags' | ||
}); | ||
}, | ||
getBranches: function (repo_url) { | ||
return $http({ | ||
method: 'GET', | ||
url: repo_url + '/branches' | ||
}); | ||
}, | ||
getReadme: function (repo_url) { | ||
return $http({ | ||
method: 'GET', | ||
url: repo_url + '/readme', | ||
headers: { | ||
'Accept': 'application/vnd.github.html+json' | ||
} | ||
}); | ||
} | ||
}; | ||
}]); | ||
|
||
catalog.factory('CloudifyManager', ['$http', function ($http) { | ||
|
||
return { | ||
upload: function doUpload(endpoint, blueprint) { | ||
var queryParams = [], query; | ||
if (blueprint.path) { | ||
queryParams.push('application_file_name=' + encodeURIComponent(blueprint.path)); | ||
} | ||
if (blueprint.url) { | ||
queryParams.push('blueprint_archive_url=' + encodeURIComponent(blueprint.url)); | ||
} | ||
query = queryParams.length ? ('?' + queryParams.join('&')) : ''; | ||
|
||
return $http({ | ||
method: 'PUT', | ||
url: endpoint + '/blueprints/' + encodeURIComponent(blueprint.id) + query | ||
}); | ||
} | ||
}; | ||
}]); | ||
})(); | ||
angular.module('blueprintingCatalogWidget').run(['$templateCache', function($templateCache) { | ||
'use strict'; | ||
|
||
$templateCache.put('blueprinting_catalog_widget_tpl.html', | ||
"<section class=\"bl-catalog\"> <div ng-show=\"!currentRepo\"> <div> <h1>{{::listTitle}}</h1> <p>{{::listDescription}}</p> </div> <div> <table> <thead> <tr> <th>Name</th> <th>Description</th> <th>Source</th> <th>Action</th> </tr> </thead> <tr ng-show=\"!loading && !repos.length\"> <td colspan=\"4\">No Data Found</td> </tr> <tr ng-show=\"loading\"> <td colspan=\"4\">Loading...</td> </tr> <tr ng-repeat=\"repo in repos\"> <td> <a href ng-click=\"showDetails(repo);\">{{::repo.name}}</a> </td> <td> {{::repo.description}} </td> <td> <a href=\"{{::repo.html_url}}\" target=\"_tab_{{::repo.id}}\">Source</a> </td> <td> <a href ng-click=\"showUpload(repo);\">Upload to Manager</a> </td> </tr> </table> </div> </div> <div ng-show=\"currentRepo\"> <div> <a href ng-click=\"showList();\" class=\"to-list\">Back</a> <h1>{{currentRepo.name}}</h1> <ul class=\"action-links\"> <li><a href=\"{{currentRepo.html_url}}\" target=\"_tab_{{currentRepo.id}}\">Source</a></li> <li><a href=\"{{currentRepo.html_url}}/archive/{{currentRepo.default_branch}}.zip\">Download</a></li> <li><a href ng-click=\"showUpload(currentRepo);\">Upload to Manager</a></li> </ul> </div> <section> <div> README <hr> </div> <div ng-bind-html=\"currentRepo.readmeContent\"></div> </section> <section> <label>Available Tags:</label> <ul> <li ng-show=\"!currentRepo.tagsList.length\">(None)</li> <li ng-repeat=\"tag in currentRepo.tagsList\"> <span class=\"label\">{{tag.name}}</span> </li> </ul> </section> </div> <div ng-show=\"uploadRepo\" class=\"upload-backdrop\"></div> <div ng-show=\"uploadRepo\" class=\"upload-popup\"> <div class=\"upload-content\"> <div class=\"upload-header\"> <a href ng-click=\"closeUpload();\" class=\"close-popup\">×</a> </div> <div class=\"upload-content\"> <form novalidate name=\"blueprintForm\"> <label> Blueprint Name<br> <input type=\"text\" ng-model=\"blueprint.id\" placeholder=\"enter blueprint name\" required> </label> <label> Manager Endpoint URL<br> <input type=\"text\" ng-model=\"managerEndpoint\" placeholder=\"enter manager url\" required> </label> <label> Blueprint File Name<br> <input type=\"text\" ng-model=\"blueprint.path\" placeholder=\"enter blueprint file name\" required> </label> <label> Source<br> <select ng-model=\"blueprint.url\"> <optgroup label=\"Branches\"> <option ng-repeat=\"b in uploadRepo.branchesList\" value=\"{{uploadRepo.html_url}}/archive/{{b.name}}.zip\" ng-selected=\"b.name === uploadRepo.default_branch\"> {{b.name}} </option> </optgroup> <optgroup label=\"Tags\"> <option ng-repeat=\"tag in uploadRepo.tagsList\" value=\"{{uploadRepo.html_url}}/archive/{{tag.name}}.zip\"> {{tag.name}} </option> </optgroup> </select> </label> <div class=\"alert alert-error\">{{error}}</div> </form> </div> <div class=\"upload-buttons\"> <button class=\"btn btn-default\" ng-disabled=\"processing\" ng-click=\"closeUpload();\">Cancel</button> <button class=\"btn btn-primary\" ng-disabled=\"processing || blueprintForm.$invalid\" ng-click=\"uploadBlueprint();\"> <span ng-show=\"processing\">Uploading...</span> <span ng-hide=\"processing\">Upload</span> </button> </div> </div> </div> </section>" | ||
); | ||
|
||
}]); |
Oops, something went wrong.