Skip to content

Commit

Permalink
Merge pull request #394 from jeff-phillips-18/browse
Browse files Browse the repository at this point in the history
Add Select from Project option to the services view.
  • Loading branch information
jeff-phillips-18 authored Aug 28, 2017
2 parents 3942b5d + cc0a497 commit 04496bf
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 16 deletions.
47 changes: 38 additions & 9 deletions dist/origin-web-catalogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ webpackJsonp([ 0, 1 ], [ function(e, t) {
baseProjectUrl: "@",
catalogItems: "<",
onDeployImageSelected: "<",
onFromFileSelected: "<"
onFromFileSelected: "<",
onCreateFromProject: "<"
},
controller: r.ServicesViewController,
template: n(41)
Expand Down Expand Up @@ -615,6 +616,32 @@ webpackJsonp([ 0, 1 ], [ function(e, t) {
}).finally(function() {
t.returnCatalogItems(n, r, ++s, i, a);
})), n.promise;
}, e.prototype.getProjectCatalogItems = function(e, t, n, r) {
var i = this;
void 0 === t && (t = !0), void 0 === n && (n = !0), void 0 === r && (r = !1);
var s = this.$q.defer(), a = {
imageStreams: [],
templates: []
}, o = 0, c = 0, l = [];
return t && (o++, this.dataService.list("imagestreams", {
namespace: e
}).then(function(e) {
a.imageStreams = e.by("metadata.name");
}, function() {
l.push("builder images");
}).finally(function() {
i.returnCatalogItems(s, a, ++c, o, l);
})), n && (o++, this.dataService.list("templates", {
namespace: e
}, null, {
partialObjectMetadataList: r
}).then(function(e) {
a.templates = e.by("metadata.name");
}, function() {
l.push("templates");
}).finally(function() {
i.returnCatalogItems(s, a, ++c, o, l);
})), s.promise;
}, e.prototype.convertToServiceItems = function(e, t, n) {
var r = this, s = i.map(e, function(e) {
return r.getServiceItem(e);
Expand Down Expand Up @@ -826,7 +853,7 @@ webpackJsonp([ 0, 1 ], [ function(e, t) {
}, function(e, t) {
e.exports = '<ng-form name="$ctrl.forms.selectProjectForm">\n <div class="form-group" ng-class="{\'has-error\' : $ctrl.forms.selectProjectForm.selectProject.$error.cannotAddToProject ||\n ($ctrl.forms.selectProjectForm.selectProject.$touched &&\n $ctrl.forms.selectProjectForm.selectProject.$invalid)}">\n <label class="control-label required">Add to Project</label>\n <ui-select\n name="selectProject"\n ng-model="$ctrl.selectedProject"\n ng-change="$ctrl.onSelectProjectChange()"\n ng-required="true"\n search-enabled="$ctrl.searchEnabled">\n <ui-select-match>\n {{$select.selected | displayName}}\n </ui-select-match>\n <ui-select-choices repeat="project in $ctrl.projects | searchProjects : $select.search track by (project | uid)">\n <span ng-bind-html="project | displayName | highlightKeywords : $select.search"></span>\n <span ng-if="project | displayName : true" class="small text-muted">\n <span ng-if="project.metadata.name">&ndash;</span>\n <span ng-bind-html="project.metadata.name | highlightKeywords : $select.search"></span>\n </span>\n </ui-select-choices>\n </ui-select>\n <div ng-if="$ctrl.forms.selectProjectForm.selectProject.$error.cannotAddToProject">\n <span class="help-block">\n You are not authorized to add to this project\n </span>\n </div>\n <div class="has-error" ng-if="$ctrl.forms.selectProjectForm.selectProject.$error.required &&\n $ctrl.forms.selectProjectForm.selectProject.$touched">\n <span class="help-block">\n Please select or create a project\n </span>\n </div>\n </div>\n</ng-form>\n\n<ng-form name="$ctrl.forms.createProjectForm"\n ng-if="$ctrl.isNewProject()">\n <div class="form-group">\n <label for="name" class="control-label required">Project Name</label>\n <div ng-class="{\'has-error\': ($ctrl.forms.createProjectForm.name.$error.pattern && $ctrl.forms.createProjectForm.name.$touched) || $ctrl.nameTaken}">\n <input class="form-control"\n name="name"\n id="name"\n placeholder="my-project"\n type="text"\n required\n take-focus\n minlength="2"\n maxlength="63"\n pattern="[a-z0-9]([-a-z0-9]*[a-z0-9])?"\n aria-describedby="nameHelp"\n ng-model="$ctrl.selectedProject.metadata.name"\n osc-unique="$ctrl.existingProjectNames"\n ng-model-options="{ updateOn: \'default blur\' }"\n ng-change="$ctrl.onNewProjectNameChange()"\n autocorrect="off"\n autocapitalize="off"\n spellcheck="false">\n <div class="help-block">A unique name for the project.</div>\n <div class="has-error" ng-if="$ctrl.forms.createProjectForm.name.$error.minlength && $ctrl.forms.createProjectForm.name.$touched">\n <span id="nameHelp" class="help-block">\n Name must have at least two characters.\n </span>\n </div>\n <div class="has-error" ng-if="$ctrl.forms.createProjectForm.name.$error.pattern && $ctrl.forms.createProjectForm.name.$touched">\n <span id="nameHelp" class="help-block">\n Project names may only contain lower-case letters, numbers, and dashes.\n They may not start or end with a dash.\n </span>\n </div>\n <div class="has-error" ng-if="$ctrl.nameTaken || $ctrl.forms.createProjectForm.name.$error.oscUnique">\n <span class="help-block">\n This name is already in use. Please choose a different name.\n </span>\n </div>\n </div>\n </div>\n\n <div class="form-group">\n <label for="displayName" class="control-label">Project Display Name</label>\n <input class="form-control"\n name="displayName"\n id="displayName"\n placeholder="My Project"\n type="text"\n ng-model="$ctrl.selectedProject.metadata.annotations[\'new-display-name\']">\n </div>\n\n <div class="form-group">\n <label for="description" class="control-label">Project Description</label>\n <textarea class="form-control"\n name="description"\n id="description"\n placeholder="A short description."\n ng-model="$ctrl.selectedProject.metadata.annotations[\'openshift.io/description\']"></textarea>\n </div>\n</ng-form>\n';
}, function(e, t) {
e.exports = '<div class="services-view" ng-style="$ctrl.viewStyle">\n <div ng-if="!$ctrl.loaded" class="spinner-container">\n <div class="spinner spinner-xl"></div>\n </div>\n <div ng-if="$ctrl.loaded" class="services-view-container mobile-{{$ctrl.mobileView}}-view">\n <div class="add-methods">\n <h1>Browse Catalog</h1>\n <div ng-if="$ctrl.onDeployImageSelected || $ctrl.onFromFileSelected">\n <ul class="add-other hidden-md hidden-lg">\n <li uib-dropdown="" class="dropdown">\n <a uib-dropdown-toggle="" class="dropdown-toggle" id="add-methods-dropdown" href="" aria-haspopup="true" aria-expanded="false">\n Custom Add\n <span class="caret" aria-hidden="true"></span>\n </a>\n <ul class="uib-dropdown-menu dropdown-menu pull-right" aria-labelledby="add-methods-dropdown">\n \x3c!-- note these are duplicated below --\x3e\n <li ng-if="$ctrl.onDeployImageSelected">\n <a href="" ng-click="$ctrl.onDeployImageSelected()">Deploy Image</a>\n </li>\n <li ng-if="$ctrl.onFromFileSelected">\n <a href="" ng-click="$ctrl.onFromFileSelected()">Import YAML / JSON</a>\n </li>\n </ul>\n </li>\n </ul>\n <ul class="add-other hidden-xs hidden-sm">\n \x3c!-- note these are duplicated above --\x3e\n <li ng-if="$ctrl.onDeployImageSelected">\n <a href="" ng-click="$ctrl.onDeployImageSelected()">Deploy Image</a>\n </li>\n <li ng-if="$ctrl.onFromFileSelected">\n <a href="" ng-click="$ctrl.onFromFileSelected()">Import YAML / JSON</a>\n </li>\n </ul>\n </div>\n </div>\n <ul class="nav nav-tabs nav-tabs-pf services-categories">\n <li ng-repeat="category in $ctrl.categories"\n ng-if="category.hasItems"\n ng-class="{ active: $ctrl.currentFilter === category.id }">\n <a href="" id="{{\'category-\'+category.id}}" class="services-category-heading" ng-click="$ctrl.selectCategory(category.id)">{{category.label}}</a>\n <a ng-click="$ctrl.mobileView = \'categories\'" class="services-back-link" href="">Back</a>\n </li>\n </ul>\n\n <div class="services-inner-container">\n \x3c!-- Do not show sub-category items for \'All\' or \'Other\' main categories --\x3e\n <ul class="services-sub-categories"\n ng-if="$ctrl.currentFilter !== \'other\' && $ctrl.currentFilter !== \'all\'">\n <li ng-repeat="subCategory in $ctrl.subCategories track by subCategory.id"\n ng-if="subCategory.hasItems"\n ng-attr-id="{{subCategory.id}}"\n class="services-sub-category"\n ng-class="{ active: $ctrl.currentSubFilter === subCategory.id }">\n <a href="" id="{{\'services-sub-category-\'+subCategory.id}}"\n class="services-sub-category-tab" ng-click="$ctrl.selectSubCategory(subCategory.id)">\n <div class="services-sub-category-tab-image" ng-if="subCategory.imageUrl">\n <img ng-src="{{subCategory.imageUrl}}" alt="">\n </div>\n <div class="services-sub-category-tab-icon {{subCategory.icon}}" ng-if="subCategory.icon && !subCategory.imageUrl"></div>\n <div class="services-sub-category-tab-name">{{subCategory.label}}</div>\n </a>\n <a ng-click="$ctrl.mobileView = \'subcategories\'" class="services-back-link" href="">Back</a>\n <div ng-if="$ctrl.currentSubFilter === subCategory.id" class="services-items">\n <pf-filter config="$ctrl.filterConfig" class="services-items-filter"></pf-filter>\n <a href="" class="services-item" ng-repeat="item in $ctrl.filteredItems track by item.resource.metadata.uid" ng-click="$ctrl.serviceViewItemClicked(item)">\n <div ng-if="!item.imageUrl" class="services-item-icon">\n <span class="{{item.iconClass}}"></span>\n </div>\n <div ng-if="item.imageUrl" class="services-item-icon">\n <img ng-src="{{item.imageUrl}}" alt="">\n </div>\n <div class="services-item-name" title="{{item.name}}">\n {{item.name}}\n </div>\n </a>\n </div>\n </li>\n </ul>\n\n \x3c!-- Show catalog item for \'All\' and \'Other\' main categories --\x3e\n <div ng-if="$ctrl.currentFilter === \'other\' || $ctrl.currentFilter === \'all\'" class="services-no-sub-categories">\n <div class="services-items">\n <div ng-if="$ctrl.isEmpty">There are no catalog items.</div>\n <pf-filter ng-if="!$ctrl.isEmpty" config="$ctrl.filterConfig" class="services-items-filter"></pf-filter>\n <a href="" class="services-item" ng-repeat="item in $ctrl.filteredItems track by item.resource.metadata.uid" ng-click="$ctrl.serviceViewItemClicked(item)">\n <div ng-if="!item.imageUrl" class="services-item-icon">\n <span class="{{item.iconClass}}"></span>\n </div>\n <div ng-if="item.imageUrl" class="services-item-icon">\n <img ng-src="{{item.imageUrl}}" alt="">\n </div>\n <div class="services-item-name" title="{{item.name}}">\n {{item.name}}\n </div>\n </a>\n </div>\n </div>\n </div>\n </div>\n</div>\n';
e.exports = '<div class="services-view" ng-style="$ctrl.viewStyle">\n <div ng-if="!$ctrl.loaded" class="spinner-container">\n <div class="spinner spinner-xl"></div>\n </div>\n <div ng-if="$ctrl.loaded" class="services-view-container mobile-{{$ctrl.mobileView}}-view">\n <div class="add-methods">\n <h1>Browse Catalog</h1>\n <div ng-if="$ctrl.onDeployImageSelected || $ctrl.onFromFileSelected || $ctrl.onCreateFromProject">\n <ul class="add-other hidden-md hidden-lg">\n <li uib-dropdown="" class="dropdown">\n <a uib-dropdown-toggle="" class="dropdown-toggle" id="add-methods-dropdown" href="" aria-haspopup="true" aria-expanded="false">\n Custom Add\n <span class="caret" aria-hidden="true"></span>\n </a>\n <ul class="uib-dropdown-menu dropdown-menu pull-right" aria-labelledby="add-methods-dropdown">\n \x3c!-- note these are duplicated below --\x3e\n <li ng-if="$ctrl.onDeployImageSelected">\n <a href="" ng-click="$ctrl.onDeployImageSelected()">Deploy Image</a>\n </li>\n <li ng-if="$ctrl.onFromFileSelected">\n <a href="" ng-click="$ctrl.onFromFileSelected()">Import YAML / JSON</a>\n </li>\n <li ng-if="$ctrl.onCreateFromProject">\n <a href="" ng-click="$ctrl.onCreateFromProject()">Select from Project</a>\n </li>\n </ul>\n </li>\n </ul>\n <ul class="add-other hidden-xs hidden-sm">\n \x3c!-- note these are duplicated above --\x3e\n <li ng-if="$ctrl.onDeployImageSelected">\n <a href="" ng-click="$ctrl.onDeployImageSelected()">Deploy Image</a>\n </li>\n <li ng-if="$ctrl.onFromFileSelected">\n <a href="" ng-click="$ctrl.onFromFileSelected()">Import YAML / JSON</a>\n </li>\n <li ng-if="$ctrl.onCreateFromProject">\n <a href="" ng-click="$ctrl.onCreateFromProject()">Select from Project</a>\n </li>\n </ul>\n </div>\n </div>\n <ul class="nav nav-tabs nav-tabs-pf services-categories">\n <li ng-repeat="category in $ctrl.categories"\n ng-if="category.hasItems"\n ng-class="{ active: $ctrl.currentFilter === category.id }">\n <a href="" id="{{\'category-\'+category.id}}" class="services-category-heading" ng-click="$ctrl.selectCategory(category.id)">{{category.label}}</a>\n <a ng-click="$ctrl.mobileView = \'categories\'" class="services-back-link" href="">Back</a>\n </li>\n </ul>\n\n <div class="services-inner-container">\n \x3c!-- Do not show sub-category items for \'All\' or \'Other\' main categories --\x3e\n <ul class="services-sub-categories"\n ng-if="$ctrl.currentFilter !== \'other\' && $ctrl.currentFilter !== \'all\'">\n <li ng-repeat="subCategory in $ctrl.subCategories track by subCategory.id"\n ng-if="subCategory.hasItems"\n ng-attr-id="{{subCategory.id}}"\n class="services-sub-category"\n ng-class="{ active: $ctrl.currentSubFilter === subCategory.id }">\n <a href="" id="{{\'services-sub-category-\'+subCategory.id}}"\n class="services-sub-category-tab" ng-click="$ctrl.selectSubCategory(subCategory.id)">\n <div class="services-sub-category-tab-image" ng-if="subCategory.imageUrl">\n <img ng-src="{{subCategory.imageUrl}}" alt="">\n </div>\n <div class="services-sub-category-tab-icon {{subCategory.icon}}" ng-if="subCategory.icon && !subCategory.imageUrl"></div>\n <div class="services-sub-category-tab-name">{{subCategory.label}}</div>\n </a>\n <a ng-click="$ctrl.mobileView = \'subcategories\'" class="services-back-link" href="">Back</a>\n <div ng-if="$ctrl.currentSubFilter === subCategory.id" class="services-items">\n <pf-filter config="$ctrl.filterConfig" class="services-items-filter"></pf-filter>\n <a href="" class="services-item" ng-repeat="item in $ctrl.filteredItems track by item.resource.metadata.uid" ng-click="$ctrl.serviceViewItemClicked(item)">\n <div ng-if="!item.imageUrl" class="services-item-icon">\n <span class="{{item.iconClass}}"></span>\n </div>\n <div ng-if="item.imageUrl" class="services-item-icon">\n <img ng-src="{{item.imageUrl}}" alt="">\n </div>\n <div class="services-item-name" title="{{item.name}}">\n {{item.name}}\n </div>\n </a>\n </div>\n </li>\n </ul>\n\n \x3c!-- Show catalog item for \'All\' and \'Other\' main categories --\x3e\n <div ng-if="$ctrl.currentFilter === \'other\' || $ctrl.currentFilter === \'all\'" class="services-no-sub-categories">\n <div class="services-items">\n <div ng-if="$ctrl.isEmpty">There are no catalog items.</div>\n <pf-filter ng-if="!$ctrl.isEmpty" config="$ctrl.filterConfig" class="services-items-filter"></pf-filter>\n <a href="" class="services-item" ng-repeat="item in $ctrl.filteredItems track by item.resource.metadata.uid" ng-click="$ctrl.serviceViewItemClicked(item)">\n <div ng-if="!item.imageUrl" class="services-item-icon">\n <span class="{{item.iconClass}}"></span>\n </div>\n <div ng-if="item.imageUrl" class="services-item-icon">\n <img ng-src="{{item.imageUrl}}" alt="">\n </div>\n <div class="services-item-name" title="{{item.name}}">\n {{item.name}}\n </div>\n </a>\n </div>\n </div>\n </div>\n </div>\n</div>\n';
}, function(e, t, n) {
"use strict";
t.__esModule = !0;
Expand Down Expand Up @@ -1606,20 +1633,22 @@ webpackJsonp([ 0, 1 ], [ function(e, t) {
var n = this;
if ("all" !== this.ctrl.currentFilter && "other" !== this.ctrl.currentFilter && this.ctrl.currentSubFilter && this.htmlService.isWindowAboveBreakpoint(this.htmlService.WINDOW_SIZE_XS)) {
if (this.resizeRetries > e.MAX_RESIZE_RETRIES) return void (this.resizeRetries = 0);
var r = s("#" + this.ctrl.currentSubFilter), a = r.find(".services-items"), o = a.outerHeight(!0);
o || (this.resizeRetries++, setTimeout(function() {
var r = s("#" + this.ctrl.currentSubFilter), i = r.find(".services-items"), a = i.outerHeight(!0);
a || (this.resizeRetries++, setTimeout(function() {
return n.resizeExpansion(t);
}, 50)), t ? (s(".services-sub-category").removeAttr("style").removeClass("items-shown"),
r.css("margin-bottom", this.previousSubCategoryHeight + "px"), r.animate({
"margin-bottom": o
"margin-bottom": a
}, 100, "swing", function() {
r.addClass("items-shown");
})) : (r.css("margin-bottom", o + "px"), r.addClass("items-shown")), this.previousSubCategoryHeight = o;
})) : (r.css("margin-bottom", a + "px"), r.addClass("items-shown")), this.previousSubCategoryHeight = a;
} else s(".services-sub-category").removeAttr("style").removeClass("items-shown"),
this.previousSubCategoryHeight = 0, this.resizeRetries = 0;
this.htmlService.isWindowAboveBreakpoint(this.htmlService.WINDOW_SIZE_SM) ? this.scrollParent && !i.get(this.ctrl.viewStyle, "min-height") && (this.ctrl.viewStyle = {
"min-height": "calc(100vh - " + this.scrollParent.getBoundingClientRect().top + "px)"
}) : this.ctrl.viewStyle = void 0;
this.$scope.$evalAsync(function() {
n.scrollParent = n.getScrollParent(n.element), n.htmlService.isWindowAboveBreakpoint(n.htmlService.WINDOW_SIZE_SM) && n.scrollParent ? n.ctrl.viewStyle = {
"min-height": "calc(100vh - " + n.scrollParent.getBoundingClientRect().top + "px)"
} : n.ctrl.viewStyle = void 0;
});
}, e.prototype.updateActiveCardStyles = function() {
var e = this;
this.$timeout(function() {
Expand Down
Loading

0 comments on commit 04496bf

Please sign in to comment.