Skip to content

Commit 2025eba

Browse files
MarkDeMariaMarkDeMaria
MarkDeMaria
authored and
MarkDeMaria
committed
Make browseCategory Promise Compliant
1 parent 264b265 commit 2025eba

File tree

3 files changed

+137
-163
lines changed

3 files changed

+137
-163
lines changed

app/scripts/controllers/create/browseCategory.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ angular.module('openshiftConsole')
101101

102102
// List image streams and templates in the both the shared `openshift`
103103
// namespace and the project namespace.
104-
DataService.list("imagestreams", {namespace: "openshift"}, function(imageStreams) {
105-
$scope.openshiftImageStreams = imageStreams.by("metadata.name");
104+
DataService.list("imagestreams", {namespace: "openshift"}).then(function(resp) {
105+
$scope.openshiftImageStreams = resp.by("metadata.name");
106106
});
107107

108-
DataService.list("templates", {namespace: "openshift"}, function(templates) {
109-
$scope.openshiftTemplates = templates.by("metadata.name");
108+
DataService.list("templates", {namespace: "openshift"}).then(function(resp) {
109+
$scope.openshiftTemplates = resp.by("metadata.name");
110110
});
111111

112112
// If the current namespace is `openshift`, don't request the same
@@ -115,12 +115,12 @@ angular.module('openshiftConsole')
115115
$scope.projectImageStreams = [];
116116
$scope.projectTemplates = [];
117117
} else {
118-
DataService.list("imagestreams", context, function(imageStreams) {
119-
$scope.projectImageStreams = imageStreams.by("metadata.name");
118+
DataService.list("imagestreams", context).then(function(resp) {
119+
$scope.projectImageStreams = resp.by("metadata.name");
120120
});
121121

122-
DataService.list("templates", context, function(templates) {
123-
$scope.projectTemplates = templates.by("metadata.name");
122+
DataService.list("templates", context).then(function(resp) {
123+
$scope.projectTemplates = resp.by("metadata.name");
124124
});
125125
}
126126
}));

dist/scripts/scripts.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -8132,15 +8132,15 @@ title:a.category.label
81328132
}), void l.get(e.project).then(_.spread(function(c, d) {
81338133
a.project = c, a.context = d, a.breadcrumbs[0].title = b("displayName")(c), i.list("imagestreams", {
81348134
namespace:"openshift"
8135-
}, function(b) {
8135+
}).then(function(b) {
81368136
a.openshiftImageStreams = b.by("metadata.name");
81378137
}), i.list("templates", {
81388138
namespace:"openshift"
8139-
}, function(b) {
8139+
}).then(function(b) {
81408140
a.openshiftTemplates = b.by("metadata.name");
8141-
}), "openshift" === e.project ? (a.projectImageStreams = [], a.projectTemplates = []) :(i.list("imagestreams", d, function(b) {
8141+
}), "openshift" === e.project ? (a.projectImageStreams = [], a.projectTemplates = []) :(i.list("imagestreams", d).then(function(b) {
81428142
a.projectImageStreams = b.by("metadata.name");
8143-
}), i.list("templates", d, function(b) {
8143+
}), i.list("templates", d).then(function(b) {
81448144
a.projectTemplates = b.by("metadata.name");
81458145
}));
81468146
})));

dist/scripts/vendor.js

+125-151
Original file line numberDiff line numberDiff line change
@@ -57824,173 +57824,147 @@ a.put("selectize/choices.tpl.html", '<div ng-show="$select.open" class="ui-selec
5782457824
a.put("selectize/select.tpl.html", '<div class="ui-select-container selectize-control single" ng-class="{\'open\': $select.open}"><div class="selectize-input" ng-class="{\'focus\': $select.open, \'disabled\': $select.disabled, \'selectize-focus\' : $select.focus}" ng-click="$select.open && !$select.searchEnabled ? $select.toggle($event) : $select.activate()"><div class="ui-select-match"></div><input type="search" autocomplete="off" tabindex="-1" class="ui-select-search ui-select-toggle" ng-class="{\'ui-select-search-hidden\':!$select.searchEnabled}" ng-click="$select.toggle($event)" placeholder="{{$select.placeholder}}" ng-model="$select.search" ng-hide="!$select.isEmpty() && !$select.open" ng-disabled="$select.disabled" aria-label="{{ $select.baseTitle }}"></div><div class="ui-select-choices"></div><div class="ui-select-no-choice"></div></div>');
5782557825
} ]), function() {
5782657826
"use strict";
57827-
function a(a) {
57827+
var a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t = [].slice;
57828+
e = angular.module("angular-inview", []).directive("inView", [ "$parse", function(a) {
5782857829
return {
5782957830
restrict:"A",
57830-
require:"?^^inViewContainer",
57831-
link:function(b, g, h, i) {
57832-
var l = {};
57833-
h.inViewOptions && (l = b.$eval(h.inViewOptions)), l.offset && (l.offset = e(l.offset)), l.viewportOffset && (l.viewportOffset = e(l.viewportOffset));
57834-
var m = k({
57835-
type:"initial"
57836-
}).merge(j(window, "checkInView click ready wheel mousewheel DomMouseScroll MozMousePixelScroll resize scroll touchmove mouseup keydown"));
57837-
i && (m = m.merge(i.eventsSignal)), l.throttle && (m = m.throttle(l.throttle));
57838-
var n = m.map(function(a) {
57839-
var b;
57840-
b = i ? i.getViewportRect() :c(), b = f(b, l.viewportOffset);
57841-
var e = f(g[0].getBoundingClientRect(), l.offset), h = !!(g[0].offsetWidth || g[0].offsetHeight || g[0].getClientRects().length), j = {
57842-
inView:h && d(e, b),
57843-
event:a,
57844-
element:g,
57845-
elementRect:e,
57846-
viewportRect:b
57847-
};
57848-
return l.generateParts && j.inView && (j.parts = {}, j.parts.top = e.top >= b.top, j.parts.left = e.left >= b.left, j.parts.bottom = e.bottom <= b.bottom, j.parts.right = e.right <= b.right), j;
57849-
}).scan({}, function(a, b) {
57850-
return l.generateDirection && b.inView && a.elementRect && (b.direction = {
57851-
horizontal:b.elementRect.left - a.elementRect.left,
57852-
vertical:b.elementRect.top - a.elementRect.top
57853-
}), b.changed = b.inView !== a.inView || !angular.equals(b.parts, a.parts) || !angular.equals(b.direction, a.direction), b;
57854-
}).filter(function(a) {
57855-
return !!a.changed && !("initial" === a.event.type && !a.inView);
57856-
}), o = a(h.inView), p = n.subscribe(function(a) {
57857-
b.$applyAsync(function() {
57858-
o(b, {
57859-
$inview:a.inView,
57860-
$inviewInfo:a
57861-
});
57862-
});
57831+
require:"?^inViewContainer",
57832+
link:function(b, c, e, f) {
57833+
var i, j, k, l, n, o;
57834+
if (e.inView) return i = a(e.inView), j = {
57835+
element:c,
57836+
wasInView:!1,
57837+
offset:0,
57838+
customDebouncedCheck:null,
57839+
callback:function(a, d, e) {
57840+
return null == a && (a = {}), b.$evalAsync(function(f) {
57841+
return function() {
57842+
return a.inViewTarget = c[0], i(b, {
57843+
$event:a,
57844+
$inview:d,
57845+
$inviewpart:e
5786357846
});
57864-
b.$on("$destroy", p);
57865-
}
5786657847
};
57848+
}(this));
5786757849
}
57868-
function b() {
57869-
return {
57870-
restrict:"A",
57871-
controller:[ "$element", function(a) {
57872-
this.element = a, this.eventsSignal = j(a, "scroll"), this.getViewportRect = function() {
57873-
return a[0].getBoundingClientRect();
57874-
};
57875-
} ]
57876-
};
57877-
}
57878-
function c() {
57879-
var a = {
57880-
top:0,
57881-
left:0,
57882-
width:window.innerWidth,
57883-
right:window.innerWidth,
57884-
height:window.innerHeight,
57885-
bottom:window.innerHeight
57886-
};
57887-
if (a.height) return a;
57888-
var b = document.compatMode;
57889-
return "CSS1Compat" === b ? (a.width = a.right = document.documentElement.clientWidth, a.height = a.bottom = document.documentElement.clientHeight) :(a.width = a.right = document.body.clientWidth, a.height = a.bottom = document.body.clientHeight), a;
57890-
}
57891-
function d(a, b) {
57892-
return !(b.left > a.right || b.right < a.left || b.top > a.bottom || b.bottom < a.top);
57893-
}
57894-
function e(a) {
57895-
return angular.isArray(a) ? 2 == a.length ? a.concat(a) :3 == a.length ? a.concat([ a[1] ]) :a :[ a, a, a, a ];
57850+
}, null != e.inViewOptions && (k = b.$eval(e.inViewOptions)) && (j.offset = k.offset || [ k.offsetTop || 0, k.offsetBottom || 0 ], k.debounce && (j.customDebouncedCheck = h(function(a) {
57851+
return g([ j ], c[0], a);
57852+
}, k.debounce))), l = null != (n = null != (o = j.customDebouncedCheck) ? o :null != f ? f.checkInView :void 0) ? n :r, null != f ? f.addItem(j) :d(j), setTimeout(l), b.$on("$destroy", function() {
57853+
return null != f && f.removeItem(j), m(j);
57854+
});
5789657855
}
57897-
function f(a, b) {
57898-
if (!b) return a;
57899-
var c = {
57900-
top:g(b[0]) ? parseFloat(b[0]) * a.height :b[0],
57901-
right:g(b[1]) ? parseFloat(b[1]) * a.width :b[1],
57902-
bottom:g(b[2]) ? parseFloat(b[2]) * a.height :b[2],
57903-
left:g(b[3]) ? parseFloat(b[3]) * a.width :b[3]
5790457856
};
57857+
} ]).directive("inViewContainer", function() {
5790557858
return {
57906-
top:a.top - c.top,
57907-
left:a.left - c.left,
57908-
bottom:a.bottom + c.bottom,
57909-
right:a.right + c.right,
57910-
height:a.height + c.top + c.bottom,
57911-
width:a.width + c.left + c.right
57912-
};
57913-
}
57914-
function g(a) {
57915-
return angular.isString(a) && a.indexOf("%") > 0;
57916-
}
57917-
function h(a) {
57918-
this.didSubscribeFunc = a;
57919-
}
57920-
function i() {
57921-
var a = arguments;
57922-
return new h(function(b) {
57923-
for (var c = [], d = a.length - 1; d >= 0; d--) c.push(a[d].subscribe(function() {
57924-
b.apply(null, arguments);
57925-
}));
57926-
b.$dispose = function() {
57927-
for (var a = c.length - 1; a >= 0; a--) c[a] && c[a]();
57859+
restrict:"AC",
57860+
controller:[ "$element", function(a) {
57861+
return this.items = [], this.addItem = function(a) {
57862+
return this.items.push(a);
57863+
}, this.removeItem = function(a) {
57864+
var b;
57865+
return this.items = function() {
57866+
var c, d, e, f;
57867+
for (e = this.items, f = [], c = 0, d = e.length; c < d; c++) b = e[c], b !== a && f.push(b);
57868+
return f;
57869+
}.call(this);
57870+
}, this.checkInView = function(b) {
57871+
return function(c) {
57872+
var d, e, f, h;
57873+
for (h = b.items, e = 0, f = h.length; e < f; e++) d = h[e], null != d.customDebouncedCheck && d.customDebouncedCheck();
57874+
return g(function() {
57875+
var a, b, c, e;
57876+
for (c = this.items, e = [], a = 0, b = c.length; a < b; a++) d = c[a], null == d.customDebouncedCheck && e.push(d);
57877+
return e;
57878+
}.call(b), a[0], c);
5792857879
};
57880+
}(this), this;
57881+
} ],
57882+
link:function(a, b, c, d) {
57883+
return b.bind("scroll", d.checkInView), n(d), a.$on("$destroy", function() {
57884+
return b.unbind("scroll", d.checkInView), q(d);
5792957885
});
5793057886
}
57931-
function j(a, b) {
57932-
return new h(function(c) {
57933-
var d = function(a) {
57934-
c(a);
57935-
}, e = angular.element(a);
57936-
e.on(b, d), c.$dispose = function() {
57937-
e.off(b, d);
5793857887
};
57939-
});
57888+
}), c = [], d = function(a) {
57889+
return c.push(a), f();
57890+
}, m = function(a) {
57891+
var b;
57892+
return c = function() {
57893+
var d, e, f;
57894+
for (f = [], d = 0, e = c.length; d < e; d++) b = c[d], b !== a && f.push(b);
57895+
return f;
57896+
}(), p();
57897+
}, a = [], n = function(b) {
57898+
return a.push(b), f();
57899+
}, q = function(b) {
57900+
var c;
57901+
return a = function() {
57902+
var d, e, f;
57903+
for (f = [], d = 0, e = a.length; d < e; d++) c = a[d], c !== b && f.push(c);
57904+
return f;
57905+
}(), p();
57906+
}, b = !1, s = function(b) {
57907+
var d, e, f;
57908+
for (e = 0, f = a.length; e < f; e++) d = a[e], d.checkInView(b);
57909+
if (c.length) return r(b);
57910+
}, f = function() {
57911+
if (!b) return b = !0, angular.element(window).bind("checkInView click ready wheel mousewheel DomMouseScroll MozMousePixelScroll resize scroll touchmove mouseup", s);
57912+
}, p = function() {
57913+
if (b && !c.length && !a.length) return b = !1, angular.element(window).unbind("checkInView click ready wheel mousewheel DomMouseScroll MozMousePixelScroll resize scroll touchmove mouseup", s);
57914+
}, o = function(a, b, c, d, e) {
57915+
var f, g;
57916+
if (c) {
57917+
if (f = i(b.element[0]).top + window.pageYOffset, g = d && e && "neither" || d && "top" || e && "bottom" || "both", !b.wasInView || b.wasInView !== g || f !== b.lastOffsetTop) return b.lastOffsetTop = f, b.wasInView = g, b.callback(a, !0, g);
57918+
} else if (b.wasInView) return b.wasInView = !1, b.callback(a, !1);
57919+
}, g = function(a, b, c) {
57920+
var d, e, f, g, h, m, n, p, q, r, s, t, u, v, w;
57921+
if (w = {
57922+
top:0,
57923+
bottom:k()
57924+
}, b && b !== window) {
57925+
if (d = i(b), d.top > w.bottom || d.bottom < w.top) {
57926+
for (m = 0, p = a.length; m < p; m++) h = a[m], o(c, h, !1);
57927+
return;
5794057928
}
57941-
function k(a) {
57942-
return new h(function(b) {
57943-
setTimeout(function() {
57944-
b(a);
57945-
});
57946-
});
57929+
d.top > w.top && (w.top = d.top), d.bottom < w.bottom && (w.bottom = d.bottom);
5794757930
}
57948-
var l = angular.module("angular-inview", []).directive("inView", [ "$parse", a ]).directive("inViewContainer", b);
57949-
h.prototype.subscribe = function(a) {
57950-
this.didSubscribeFunc(a);
57951-
var b = function() {
57952-
a.$dispose && (a.$dispose(), a.$dispose = null);
57931+
for (v = [], n = 0, q = a.length; n < q; n++) h = a[n], g = h.element[0], d = i(g), f = d.top + (l(h.offset) ? j(d, h.offset) :parseInt(null != (r = null != (s = h.offset) ? s[0] :void 0) ? r :h.offset)), e = d.bottom + (l(h.offset) ? j(d, h.offset) :parseInt(null != (t = null != (u = h.offset) ? u[1] :void 0) ? t :h.offset)), f < w.bottom && e >= w.top ? v.push(o(c, h, !0, e > w.bottom, f < w.top)) :v.push(o(c, h, !1));
57932+
return v;
57933+
}, l = function(a) {
57934+
return "string" == typeof a && "%" === a.slice(-1);
57935+
}, j = function(a, b) {
57936+
var c;
57937+
return c = b.substring(0, b.length - 1), (a.bottom - a.top) * (c / 100);
57938+
}, k = function() {
57939+
var a, b, c;
57940+
return (a = window.innerHeight) ? a :(b = document.compatMode, !b && ("undefined" != typeof $ && null !== $ && null != (c = $.support) ? c.boxModel :void 0) || (a = "CSS1Compat" === b ? document.documentElement.clientHeight :document.body.clientHeight), a);
57941+
}, i = function(a) {
57942+
var b, c, d;
57943+
if (null != a.getBoundingClientRect) return a.getBoundingClientRect();
57944+
for (d = 0, b = a; b; ) d += b.offsetTop, b = b.offsetParent;
57945+
for (c = a.parentElement; c; ) null != c.scrollTop && (d -= c.scrollTop), c = c.parentElement;
57946+
return {
57947+
top:d,
57948+
bottom:d + a.offsetHeight
5795357949
};
57954-
return b;
57955-
}, h.prototype.map = function(a) {
57956-
var b = this;
57957-
return new h(function(c) {
57958-
c.$dispose = b.subscribe(function(b) {
57959-
c(a(b));
57960-
});
57961-
});
57962-
}, h.prototype.filter = function(a) {
57963-
var b = this;
57964-
return new h(function(c) {
57965-
c.$dispose = b.subscribe(function(b) {
57966-
a(b) && c(b);
57967-
});
57968-
});
57969-
}, h.prototype.scan = function(a, b) {
57970-
var c = this;
57971-
return new h(function(d) {
57972-
var e = a;
57973-
d.$dispose = c.subscribe(function(a) {
57974-
e = b(e, a), d(e);
57975-
});
57976-
});
57977-
}, h.prototype.merge = function(a) {
57978-
return i(this, a);
57979-
}, h.prototype.throttle = function(a) {
57980-
var b, c, d = this;
57981-
return new h(function(e) {
57982-
var f = d.subscribe(function() {
57983-
var d = +new Date(), f = arguments;
57984-
b && d < b + a ? (clearTimeout(c), c = setTimeout(function() {
57985-
b = d, e.apply(null, f);
57986-
}, a)) :(b = d, e.apply(null, f));
57987-
});
57988-
e.$dispose = function() {
57989-
clearTimeout(c), f && f();
57950+
}, h = function(a, b) {
57951+
var c;
57952+
return c = null, function() {
57953+
var d;
57954+
return d = 1 <= arguments.length ? t.call(arguments, 0) :[], null != c && clearTimeout(c), c = setTimeout(function() {
57955+
return a.apply(null, d);
57956+
}, null != b ? b :100);
5799057957
};
57991-
});
57992-
}, "function" == typeof define && define.amd ? define([ "angular" ], l) :"undefined" != typeof module && module && module.exports && (module.exports = l);
57993-
}(), function(a) {
57958+
}, r = function(a) {
57959+
var b, d, e;
57960+
for (d = 0, e = c.length; d < e; d++) b = c[d], null != b.customDebouncedCheck && b.customDebouncedCheck();
57961+
return g(function() {
57962+
var a, d, e;
57963+
for (e = [], a = 0, d = c.length; a < d; a++) b = c[a], null == b.customDebouncedCheck && e.push(b);
57964+
return e;
57965+
}(), null, a);
57966+
}, "function" == typeof define && define.amd ? define([ "angular" ], e) :"undefined" != typeof module && module && module.exports && (module.exports = e);
57967+
}.call(this), function(a) {
5799457968
if ("object" == typeof exports && "undefined" != typeof module) module.exports = a(); else if ("function" == typeof define && define.amd) define([], a); else {
5799557969
var b;
5799657970
b = "undefined" != typeof window ? window :"undefined" != typeof global ? global :"undefined" != typeof self ? self :this, b.jsyaml = a();

0 commit comments

Comments
 (0)