Skip to content

Commit

Permalink
added back in support for Juju 2.9.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Pihach committed Dec 9, 2021
1 parent 2d6f1cb commit 39ccb4e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "juju-dashboard",
"version": "0.9.1",
"version": "0.9.2",
"description": "A dashboard for Juju and JAAS (Juju as a service)",
"bugs": {
"url": "https://github.com/canonical-web-and-design/jaas-dashboard/issues"
Expand Down
12 changes: 12 additions & 0 deletions public/config.js.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var jujuDashboardConfig = {
// API host to allow app to connect and retrieve models
baseControllerURL: null,
// Configurable base url to allow deploying to different paths.
baseAppURL: "{{.baseAppURL}}",
// If true then identity will be provided by a third party provider.
identityProviderAvailable: {{.identityProviderAvailable}},
// Is this application being rendered in Juju and not JAAS. This flag should
// only be used for superficial updates like logos. Use feature detection
// for other environment features.
isJuju: {{.isJuju}},
};
14 changes: 12 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,19 @@ function bootstrap() {
// If we were provided with a relative path for the endpoint then we need
// to build the full correct path for the websocket to connect to.
const controllerAPIEndpoint = config.controllerAPIEndpoint;
if (!controllerAPIEndpoint.includes("://")) {
if (controllerAPIEndpoint) {
if (!controllerAPIEndpoint.includes("://")) {
const protocol = window.location.protocol.includes("https")
? "wss"
: "ws";
config.controllerAPIEndpoint = `${protocol}://${window.location.host}${controllerAPIEndpoint}`;
}
}
// Support Juju 2.9 deployments with the old configuration values.
// XXX This can be removed once we drop support for 2.9 with the 3.0 release.
if (config.baseControllerURL === null) {
const protocol = window.location.protocol.includes("https") ? "wss" : "ws";
config.controllerAPIEndpoint = `${protocol}://${window.location.host}${controllerAPIEndpoint}`;
config.controllerAPIEndpoint = `${protocol}://${window.location.host}/api`;
}

if (process.env.NODE_ENV === "production") {
Expand Down

0 comments on commit 39ccb4e

Please sign in to comment.