Better handle missing cluster node info fields (#30844)

A recent change to the enterprise cluster code introduced the possibility that we could get cluster info with empty fields. This happens when we can't properly communicate with the related cluster node. In that case, we now show a warning to the admin.
Этот коммит содержится в:
David Krauser
2025-05-12 13:38:10 -04:00
коммит произвёл GitHub
родитель 4b64eb0e39
Коммит a6a4674a21
3 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@@ -74,7 +74,7 @@ export default class ClusterTable extends PureComponent<Props> {
<WarningIcon/>
<FormattedMessage
id='admin.cluster.version_mismatch_warning'
defaultMessage='WARNING: Multiple versions of Mattermost has been detected in your HA cluster. Unless you are currently performing an upgrade please ensure all nodes in your cluster are running the same Mattermost version to avoid platform disruption.'
defaultMessage='WARNING: Multiple Mattermost versions have been detected in your HA cluster, or the running versions cannot be properly identified. Unless upgrading, ensure all nodes are on the same version and can communicate via Gossip to prevent platform issues.'
/>
</div>
);
@@ -94,10 +94,12 @@ export default class ClusterTable extends PureComponent<Props> {
});
const items = this.props.clusterInfos.map((clusterInfo) => {
let hasUnknownFields = false;
let status = null;
let hostname: React.ReactNode = clusterInfo.hostname;
if (hostname === '') {
hasUnknownFields = true;
hostname = (
<FormattedMessage
id='admin.cluster.unknown'
@@ -108,6 +110,7 @@ export default class ClusterTable extends PureComponent<Props> {
let version: React.ReactNode = clusterInfo.version;
if (version === '') {
hasUnknownFields = true;
version = (
<FormattedMessage
id='admin.cluster.unknown'
@@ -118,6 +121,7 @@ export default class ClusterTable extends PureComponent<Props> {
let configHash: React.ReactNode = clusterInfo.config_hash;
if (configHash === '') {
hasUnknownFields = true;
configHash = (
<FormattedMessage
id='admin.cluster.unknown'
@@ -126,7 +130,7 @@ export default class ClusterTable extends PureComponent<Props> {
);
}
if (singleItem) {
if (singleItem || hasUnknownFields) {
status = (
<img
alt='Cluster status'

Просмотреть файл

@@ -17,6 +17,7 @@ const ClusterTableContainer = () => {
const [clusterInfos, setClusterInfos] = useState<ClusterInfo[] | null>(null);
const load = useCallback(() => {
setClusterInfos(null);
getClusterStatus(setClusterInfos, null);
}, []);

Просмотреть файл

@@ -567,7 +567,7 @@
"admin.cluster.unknown": "unknown",
"admin.cluster.UseIPAddress": "Use IP Address:",
"admin.cluster.UseIPAddressDesc": "When true, the cluster will attempt to communicate via IP Address vs using the hostname.",
"admin.cluster.version_mismatch_warning": "WARNING: Multiple versions of Mattermost has been detected in your HA cluster. Unless you are currently performing an upgrade please ensure all nodes in your cluster are running the same Mattermost version to avoid platform disruption.",
"admin.cluster.version_mismatch_warning": "WARNING: Multiple Mattermost versions have been detected in your HA cluster, or the running versions cannot be properly identified. Unless upgrading, ensure all nodes are on the same version and can communicate via Gossip to prevent platform issues.",
"admin.compliance_export_feature_discovery.copy": "Run daily compliance reports and export them to a variety of formats consumable by third-party integration tools such as Smarsh (Actiance).",
"admin.compliance_export_feature_discovery.title": "Run compliance exports with Mattermost Enterprise",
"admin.compliance_reports.desc": "Job Name:",