Skip to content

Commit

Permalink
HPCC-30612 Warn user when Platform is too old
Browse files Browse the repository at this point in the history
  • Loading branch information
GordonSmith committed Nov 15, 2023
1 parent 2c7cbae commit 769732b
Show file tree
Hide file tree
Showing 11 changed files with 1,197 additions and 151 deletions.
24 changes: 23 additions & 1 deletion esp/src/eclwatch/HPCCPlatformWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ define([
"src/react/index",
"src-react/components/About",
"src-react/components/controls/ComingSoon",
"src-react/hooks/platform",

"hpcc/_TabContainerWidget",
"src/ESPRequest",
Expand Down Expand Up @@ -74,7 +75,7 @@ define([
], function (declare, lang, nlsHPCCMod, arrayUtil, dom, domConstruct, domClass, domForm, domStyle, domGeo, cookie, query, topic, xhr,
registry, Tooltip,
UpgradeBar, ColorPicker,
CodeMirror, srcReact, AboutModule, ComingSoonModule,
CodeMirror, srcReact, AboutModule, ComingSoonModule, platformModule,
_TabContainerWidget, ESPRequest, ESPActivity, ESPUtil, WsAccount, WsAccess, WsSMC, WsTopology, WsMachine, LockDialogWidget, EnvironmentTheme, Utility,
template,

Expand Down Expand Up @@ -162,6 +163,27 @@ define([
/* */
var teaserNode = dom.byId(this.id + "teaser");
srcReact.render(ComingSoonModule.ComingSoon, { style: { color: "white" } }, teaserNode);

const DAY = 1000 * 60 * 60 * 24;
platformModule.fetchCheckFeatures().then(function (features) {
const age = Math.floor((Date.now() - new Date(features.BuildTagTimestamp).getTime()) / DAY);
const message = nlsHPCC.PlatformIsNNNDaysOld.replace("NNN", `${age}`);
let severity = "Info";
if (age > 90) {
severity = "Alert";
} else if (age > 60) {
severity = "Error";
} else if (age > 30) {
severity = "Warning";
} else {
severity = "Info";
}
dojo.publish("hpcc/brToaster", {
Severity: severity,
Source: "eclwatch/HPCCPlatformWidget.js",
Exceptions: [{ Source: "", Message: message }]
});
});
},

// Implementation ---
Expand Down
3 changes: 2 additions & 1 deletion esp/src/eclwatch/InfoGridWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ define([
if (severity === "Error") {
row.customStyles += "background-color: red;";
} else if (severity === "Alert") {
row.customStyles += "background-color: #febe47;";
row.customStyles += "background-color: #fe8147;";
} else if (severity === "Warning") {
row.customStyles += "background-color: yellow;";
}
Expand Down Expand Up @@ -337,6 +337,7 @@ define([
break;
case "Alert":
this._counts.alert++;
this._counts.errorWarning++;
if (errorChecked) {
data.push(item);
}
Expand Down
26 changes: 17 additions & 9 deletions esp/src/eclwatch/css/hpcc.css
Original file line number Diff line number Diff line change
Expand Up @@ -1646,19 +1646,27 @@ margin-left:-20px;
color:#fff;
}

.dijitToasterWarning,
.dijitToasterAlert,
.dijitToasterWarning {
font-weight: bold;
}

.dijitToasterError,
.dijitToasterFatal{
font-weight:bold;
color:#fff;
.dijitToasterFatal {
font-weight: bold;
color: #fff;
}

.dijitToasterWarning .dijitToasterContent {
background: rgb(255, 238, 0);
}

.dijitToasterWarning .dijitToasterContent{
background:#d4d943;
}
.dijitToasterError .dijitToasterContent {
background: rgb(255, 30, 0);
}

.dijitToasterError .dijitToasterContent{
background:#c46600;
.dijitToasterAlert .dijitToasterContent {
background: #fe8147;
}

/* imported from dijit.css */
Expand Down
Loading

0 comments on commit 769732b

Please sign in to comment.