Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1495491 - Show events tab on build config page #2168

Merged
merged 1 commit into from
Sep 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions app/scripts/controllers/buildConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ angular.module('openshiftConsole')
var buildStrategy = $filter('buildStrategy');
var watches = [];

var requestContext;

// copy buildConfig and ensure it has env so that we can edit env vars using key-value-editor
var copyBuildConfigAndEnsureEnv = function(buildConfig) {
$scope.updatedBuildConfig = angular.copy(buildConfig);
Expand Down Expand Up @@ -94,7 +92,7 @@ angular.module('openshiftConsole')
$scope.envVars = _.filter($scope.envVars, 'name');
buildStrategy($scope.updatedBuildConfig).env = keyValueEditorUtils.compactEntries(angular.copy($scope.envVars));
DataService
.update("buildconfigs", $routeParams.buildconfig, $scope.updatedBuildConfig, requestContext)
.update("buildconfigs", $routeParams.buildconfig, $scope.updatedBuildConfig, $scope.projectContext)
.then(function success() {
NotificationsService.addNotification({
type: "success",
Expand Down Expand Up @@ -179,7 +177,7 @@ angular.module('openshiftConsole')
.get($routeParams.project)
.then(_.spread(function(project, context) {
$scope.project = project;
requestContext = context;
$scope.projectContext = context;
DataService
.get($scope.buildConfigsVersion, $routeParams.buildconfig, context, { errorNotification: false })
.then(function(buildConfig) {
Expand Down
4 changes: 4 additions & 0 deletions app/views/browse/build-config.html
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,10 @@ <h3>Environment Variables</h3>
show-header></key-value-editor>
</ng-form>
</uib-tab>
<uib-tab active="selectedTab.events" ng-if="('events' | canI : 'watch')">
<uib-tab-heading>Events</uib-tab-heading>
<events api-objects="[ buildConfig ]" project-context="projectContext" ng-if="selectedTab.events"></events>
</uib-tab>
</uib-tabset>
</div><!-- /col-* -->
</div>
Expand Down
28 changes: 14 additions & 14 deletions dist/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -5267,13 +5267,13 @@ title: n.buildconfig
var t = e.getSession();
t.setOption("tabSize", 2), t.setOption("useSoftTabs", !0), e.$blockScrolling = 1 / 0;
};
var p, m = t("buildConfigForBuild"), f = t("buildStrategy"), g = [], h = function(t) {
e.updatedBuildConfig = angular.copy(t), e.envVars = f(e.updatedBuildConfig).env || [];
var p = t("buildConfigForBuild"), m = t("buildStrategy"), f = [], g = function(t) {
e.updatedBuildConfig = angular.copy(t), e.envVars = m(e.updatedBuildConfig).env || [];
};
e.compareTriggers = function(e, t) {
return _.isNumber(e.value) ? -1 : "ConfigChange" === e.value ? -1 : "ConfigChange" === t.value ? 1 : "ImageChange" === e.value ? -1 : "ImageChange" === t.value ? 1 : e.value.localeCompare(t.value);
}, e.saveEnvVars = function() {
l.hideNotification("save-bc-env-error"), e.envVars = _.filter(e.envVars, "name"), f(e.updatedBuildConfig).env = d.compactEntries(angular.copy(e.envVars)), i.update("buildconfigs", n.buildconfig, e.updatedBuildConfig, p).then(function() {
l.hideNotification("save-bc-env-error"), e.envVars = _.filter(e.envVars, "name"), m(e.updatedBuildConfig).env = d.compactEntries(angular.copy(e.envVars)), i.update("buildconfigs", n.buildconfig, e.updatedBuildConfig, e.projectContext).then(function() {
l.addNotification({
type: "success",
message: "Environment variables for build config " + e.buildConfigName + " were successfully updated."
Expand All @@ -5287,25 +5287,25 @@ details: t("getErrorDetails")(n)
});
});
}, e.clearEnvVarUpdates = function() {
h(e.buildConfig), e.forms.bcEnvVars.$setPristine();
g(e.buildConfig), e.forms.bcEnvVars.$setPristine();
};
var v, y = function(n, s) {
var h, v = function(n, s) {
e.loaded = !0, e.buildConfig = n, e.buildConfigPaused = r.isPaused(e.buildConfig), e.buildConfig.spec.source.images && (e.imageSources = e.buildConfig.spec.source.images, e.imageSourcesPaths = [], e.imageSources.forEach(function(n) {
e.imageSourcesPaths.push(t("destinationSourcePair")(n.paths));
}));
var c = _.get(f(n), "from", {}), l = c.kind + "/" + c.name + "/" + (c.namespace || e.projectName);
v !== l && (_.includes([ "ImageStreamTag", "ImageStreamImage" ], c.kind) ? (v = l, i.get(a.kindToResource(c.kind), c.name, {
var c = _.get(m(n), "from", {}), l = c.kind + "/" + c.name + "/" + (c.namespace || e.projectName);
h !== l && (_.includes([ "ImageStreamTag", "ImageStreamImage" ], c.kind) ? (h = l, i.get(a.kindToResource(c.kind), c.name, {
namespace: c.namespace || e.projectName
}, {
errorNotification: !1
}).then(function(t) {
e.BCEnvVarsFromImage = o.getEnvironment(t);
}, function() {
e.BCEnvVarsFromImage = [];
})) : e.BCEnvVarsFromImage = []), h(n), "DELETED" === s && (e.alerts.deleted = {
})) : e.BCEnvVarsFromImage = []), g(n), "DELETED" === s && (e.alerts.deleted = {
type: "warning",
message: "This build configuration has been deleted."
}, e.buildConfigDeleted = !0), !e.forms.bcEnvVars || e.forms.bcEnvVars.$pristine ? h(n) : e.alerts.background_update = {
}, e.buildConfigDeleted = !0), !e.forms.bcEnvVars || e.forms.bcEnvVars.$pristine ? g(n) : e.alerts.background_update = {
type: "warning",
message: "This build configuration has been updated in the background. Saving your changes may create a conflict or cause loss of data.",
links: [ {
Expand All @@ -5323,19 +5323,19 @@ type: "warning",
details: "The active filters are hiding all builds."
};
}
e.project = a, p = o, i.get(e.buildConfigsVersion, n.buildconfig, o, {
e.project = a, e.projectContext = o, i.get(e.buildConfigsVersion, n.buildconfig, o, {
errorNotification: !1
}).then(function(t) {
y(t), g.push(i.watchObject(e.buildConfigsVersion, n.buildconfig, o, y));
v(t), f.push(i.watchObject(e.buildConfigsVersion, n.buildconfig, o, v));
}, function(n) {
e.loaded = !0, e.alerts.load = {
type: "error",
message: 404 === n.status ? "This build configuration can not be found, it may have been deleted." : "The build configuration details could not be loaded.",
details: 404 === n.status ? "Any remaining build history for this build will be shown." : t("getErrorDetails")(n)
};
}), g.push(i.watch(e.buildsVersion, o, function(t, a, o) {
}), f.push(i.watch(e.buildsVersion, o, function(t, a, o) {
if (e.emptyMessage = "No builds to show", a) {
if (m(o) === n.buildconfig) {
if (p(o) === n.buildconfig) {
var i = o.metadata.name;
switch (a) {
case "ADDED":
Expand Down Expand Up @@ -5367,7 +5367,7 @@ r.startBuild(e.buildConfig);
}, e.showJenkinsfileExamples = function() {
c.showJenkinsfileExamples();
}, e.$on("$destroy", function() {
i.unwatchAll(g);
i.unwatchAll(f);
});
}));
} ]), angular.module("openshiftConsole").controller("BuildController", [ "$scope", "$filter", "$routeParams", "APIService", "BuildsService", "DataService", "ModalsService", "Navigate", "ProjectsService", function(e, t, n, a, r, o, i, s, c) {
Expand Down
4 changes: 4 additions & 0 deletions dist/scripts/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -2036,6 +2036,10 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<key-value-editor ng-if=\"!(buildConfigsVersion | canI : 'update')\" entries=\"envVars\" key-placeholder=\"Name\" value-placeholder=\"Value\" is-readonly cannot-add cannot-sort cannot-delete show-header></key-value-editor>\n" +
"</ng-form>\n" +
"</uib-tab>\n" +
"<uib-tab active=\"selectedTab.events\" ng-if=\"('events' | canI : 'watch')\">\n" +
"<uib-tab-heading>Events</uib-tab-heading>\n" +
"<events api-objects=\"[ buildConfig ]\" project-context=\"projectContext\" ng-if=\"selectedTab.events\"></events>\n" +
"</uib-tab>\n" +
"</uib-tabset>\n" +
"</div>\n" +
"</div>\n" +
Expand Down