Skip to content

Commit

Permalink
Bug 1539566 - Request server version on about page load
Browse files Browse the repository at this point in the history
  • Loading branch information
spadgett committed Jan 30, 2018
1 parent 320367b commit e5f23ed
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 30 deletions.
35 changes: 29 additions & 6 deletions app/scripts/controllers/about.js
Expand Up @@ -7,14 +7,37 @@
* Controller of the openshiftConsole
*/
angular.module('openshiftConsole')
.controller('AboutController', function ($scope, AuthService, Constants) {
.controller('AboutController',
function($scope,
$q,
AuthService,
Constants,
DataService) {
AuthService.withUser();

$scope.version = {
master: {
openshift: Constants.VERSION.openshift,
kubernetes: Constants.VERSION.kubernetes,
},
console: Constants.VERSION.console
master: {},
console: Constants.VERSION.console || 'unknown'
};

var masterVersion = $scope.version.master;
var requests = [];

// Request the latest versions from the server. The version in constants
// might be stale since it's only requested at startup.
requests.push(DataService.getKubernetesMasterVersion().then(function(version) {
masterVersion.kubernetes = version.data.gitVersion;
}));

requests.push(DataService.getOpenShiftMasterVersion().then(function(version) {
masterVersion.openshift = version.data.gitVersion;
}));

$q.all(requests).finally(function() {
// Fall back to the versions in Constants if we could not get the version
// from the server. Set the value to 'unknown' only after the requests
// have completed to avoid it flickering on page load.
masterVersion.kubernetes = masterVersion.kubernetes || Constants.VERSION.kubernetes || 'unknown';
masterVersion.openshift = masterVersion.openshift || Constants.VERSION.openshift || 'unknown';
});
});
34 changes: 26 additions & 8 deletions app/views/about.html
Expand Up @@ -11,26 +11,44 @@
<div class="col-md-9">
<h1>Red Hat OpenShift <span class="about-reg">&reg;</span></h1>
<h2>About</h2>
<p><a target="_blank" href="https://openshift.com">OpenShift</a> is Red Hat's Platform-as-a-Service (PaaS) that allows developers to quickly develop, host, and scale applications in a cloud environment.</p>
<p>
<a target="_blank" href="https://openshift.com">OpenShift</a> is Red Hat's Platform-as-a-Service
(PaaS) that allows developers to quickly develop, host, and scale applications in a cloud environment.
</p>

<h2 id="version">Version</h2>
<dl class="dl-horizontal left">
<dt>OpenShift Master:</dt>
<dd>{{version.master.openshift || 'unknown'}}</dd>
<dd>
{{version.master.openshift}}
</dd>
<dt>Kubernetes Master:</dt>
<dd>{{version.master.kubernetes || 'unknown'}}</dd>
<dd>
{{version.master.kubernetes}}
</dd>
<dt>OpenShift Web Console:</dt>
<dd>{{version.console || 'unknown'}}</dd>
<dd>
{{version.console}}
</dd>
</dl>

<p>The <a target="_blank" ng-href="{{'welcome' | helpLink}}">documentation</a> helps you learn about OpenShift and start exploring its features. From getting started with creating your first application to trying out more advanced build and deployment techniques, it provides guidance on setting up and managing your OpenShift environment as an application developer.</p>
<p>
The <a target="_blank" ng-href="{{'welcome' | helpLink}}">documentation</a> helps you learn about
OpenShift and start exploring its features. From getting started with creating your first application
to trying out more advanced build and deployment techniques, it provides guidance on setting up and
managing your OpenShift environment as an application developer.
</p>

<p>With the OpenShift command line interface (CLI), you can create applications and manage OpenShift projects from a terminal. To get started using the CLI, visit <a href="command-line">Command Line Tools</a>.
<p>
With the OpenShift command line interface (CLI), you can create applications and manage OpenShift
projects from a terminal. To get started using the CLI, visit
<a href="command-line">Command Line Tools</a>.
</p>

<h2>Account</h2>
<p>You are currently logged in under the user account <strong>{{user.metadata.name}}</strong>.</p>

<p>
You are currently logged in under the user account <strong>{{user.metadata.name}}</strong>.
</p>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Expand Up @@ -46,7 +46,7 @@
"angular-moment": "1.0.0",
"angular-utf8-base64": "0.0.5",
"file-saver": "1.3.3",
"origin-web-common": "3.9.0-alpha.8",
"origin-web-common": "3.9.0-alpha.9",
"origin-web-catalog": "3.9.0-alpha.8"
},
"devDependencies": {
Expand Down
21 changes: 13 additions & 8 deletions dist/scripts/scripts.js
Expand Up @@ -8936,14 +8936,19 @@ type: e.homePagePreference
}, e.cancel = function() {
t.dismiss("cancel");
};
} ]), angular.module("openshiftConsole").controller("AboutController", [ "$scope", "AuthService", "Constants", function(e, t, n) {
t.withUser(), e.version = {
master: {
openshift: n.VERSION.openshift,
kubernetes: n.VERSION.kubernetes
},
console: n.VERSION.console
};
} ]), angular.module("openshiftConsole").controller("AboutController", [ "$scope", "$q", "AuthService", "Constants", "DataService", function(e, t, n, r, a) {
n.withUser(), e.version = {
master: {},
console: r.VERSION.console || "unknown"
};
var o = e.version.master, i = [];
i.push(a.getKubernetesMasterVersion().then(function(e) {
o.kubernetes = e.data.gitVersion;
})), i.push(a.getOpenShiftMasterVersion().then(function(e) {
o.openshift = e.data.gitVersion;
})), t.all(i).finally(function() {
o.kubernetes = o.kubernetes || r.VERSION.kubernetes || "unknown", o.openshift = o.openshift || r.VERSION.openshift || "unknown";
});
} ]), angular.module("openshiftConsole").controller("CommandLineController", [ "$scope", "DataService", "AuthService", "Constants", function(e, t, n, r) {
n.withUser(), e.cliDownloadURL = r.CLI, e.cliDownloadURLPresent = e.cliDownloadURL && !_.isEmpty(e.cliDownloadURL), e.loginBaseURL = t.openshiftAPIBaseUrl(), r.DISABLE_COPY_LOGIN_COMMAND || (e.sessionToken = n.UserStore().getToken());
} ]), angular.module("openshiftConsole").controller("CreatePersistentVolumeClaimController", [ "$filter", "$routeParams", "$scope", "$window", "APIService", "ApplicationGenerator", "AuthorizationService", "DataService", "Navigate", "NotificationsService", "ProjectsService", "keyValueEditorUtils", function(e, t, n, r, a, o, i, s, c, l, u, d) {
Expand Down
28 changes: 21 additions & 7 deletions dist/scripts/templates.js
Expand Up @@ -715,21 +715,35 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<div class=\"col-md-9\">\n" +
"<h1>Red Hat OpenShift <span class=\"about-reg\">&reg;</span></h1>\n" +
"<h2>About</h2>\n" +
"<p><a target=\"_blank\" href=\"https://openshift.com\">OpenShift</a> is Red Hat's Platform-as-a-Service (PaaS) that allows developers to quickly develop, host, and scale applications in a cloud environment.</p>\n" +
"<p>\n" +
"<a target=\"_blank\" href=\"https://openshift.com\">OpenShift</a> is Red Hat's Platform-as-a-Service (PaaS) that allows developers to quickly develop, host, and scale applications in a cloud environment.\n" +
"</p>\n" +
"<h2 id=\"version\">Version</h2>\n" +
"<dl class=\"dl-horizontal left\">\n" +
"<dt>OpenShift Master:</dt>\n" +
"<dd>{{version.master.openshift || 'unknown'}}</dd>\n" +
"<dd>\n" +
"{{version.master.openshift}}\n" +
"</dd>\n" +
"<dt>Kubernetes Master:</dt>\n" +
"<dd>{{version.master.kubernetes || 'unknown'}}</dd>\n" +
"<dd>\n" +
"{{version.master.kubernetes}}\n" +
"</dd>\n" +
"<dt>OpenShift Web Console:</dt>\n" +
"<dd>{{version.console || 'unknown'}}</dd>\n" +
"<dd>\n" +
"{{version.console}}\n" +
"</dd>\n" +
"</dl>\n" +
"<p>The <a target=\"_blank\" ng-href=\"{{'welcome' | helpLink}}\">documentation</a> helps you learn about OpenShift and start exploring its features. From getting started with creating your first application to trying out more advanced build and deployment techniques, it provides guidance on setting up and managing your OpenShift environment as an application developer.</p>\n" +
"<p>With the OpenShift command line interface (CLI), you can create applications and manage OpenShift projects from a terminal. To get started using the CLI, visit <a href=\"command-line\">Command Line Tools</a>.\n" +
"<p>\n" +
"The <a target=\"_blank\" ng-href=\"{{'welcome' | helpLink}}\">documentation</a> helps you learn about OpenShift and start exploring its features. From getting started with creating your first application to trying out more advanced build and deployment techniques, it provides guidance on setting up and managing your OpenShift environment as an application developer.\n" +
"</p>\n" +
"<p>\n" +
"With the OpenShift command line interface (CLI), you can create applications and manage OpenShift projects from a terminal. To get started using the CLI, visit\n" +
"<a href=\"command-line\">Command Line Tools</a>.\n" +
"</p>\n" +
"<h2>Account</h2>\n" +
"<p>You are currently logged in under the user account <strong>{{user.metadata.name}}</strong>.</p>\n" +
"<p>\n" +
"You are currently logged in under the user account <strong>{{user.metadata.name}}</strong>.\n" +
"</p>\n" +
"</div>\n" +
"</div>\n" +
"</div>\n" +
Expand Down
15 changes: 15 additions & 0 deletions dist/scripts/vendor.js
Expand Up @@ -75773,6 +75773,21 @@ return new URI({
protocol: e,
hostname: t
}).toString();
}, f.prototype._getAPIServerVersion = function(e) {
var n = "http:" === window.location.protocol ? "http" : "https", i = new URI({
protocol: n,
hostname: o.k8s.hostPort,
path: e
}).toString();
return t.get(i, {
headers: {
Accept: "application/json"
}
});
}, f.prototype.getKubernetesMasterVersion = function() {
return this._getAPIServerVersion("/version");
}, f.prototype.getOpenShiftMasterVersion = function() {
return this._getAPIServerVersion("/version/openshift");
}, f.prototype.createData = function(e) {
return new d(e);
};
Expand Down

0 comments on commit e5f23ed

Please sign in to comment.