mirror of
https://github.com/cockpit-project/cockpit.git
synced 2026-11-03 21:49:50 -09:00
selinux: Apply strict equality everywhere
This commit is contained in:
parent
12dc5d5578
commit
5ea7b33c00
4 changed files with 18 additions and 18 deletions
|
|
@ -66,15 +66,15 @@ export function init(statusChangedCallback) {
|
||||||
return;
|
return;
|
||||||
const key = items[0].trim();
|
const key = items[0].trim();
|
||||||
const value = items[1].trim();
|
const value = items[1].trim();
|
||||||
if (key == "SELinux status") {
|
if (key === "SELinux status") {
|
||||||
status.enabled = (value == "enabled");
|
status.enabled = (value === "enabled");
|
||||||
} else if (key == "Current mode") {
|
} else if (key === "Current mode") {
|
||||||
status.enforcing = (value == "enforcing");
|
status.enforcing = (value === "enforcing");
|
||||||
} else if (key == "Mode from config file") {
|
} else if (key === "Mode from config file") {
|
||||||
if (value == 'error (Permission denied)') {
|
if (value === 'error (Permission denied)') {
|
||||||
status.configEnforcing = undefined;
|
status.configEnforcing = undefined;
|
||||||
} else {
|
} else {
|
||||||
status.configEnforcing = (value == "enforcing");
|
status.configEnforcing = (value === "enforcing");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -177,7 +177,7 @@ export function getModifications(statusChangedCallback) {
|
||||||
const items = mod.split(" ");
|
const items = mod.split(" ");
|
||||||
|
|
||||||
// Skip enumeration of types, e.g. 'boolean -D'
|
// Skip enumeration of types, e.g. 'boolean -D'
|
||||||
if (items.length === 2 && items[1] == "-D")
|
if (items.length === 2 && items[1] === "-D")
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
if (manageditems.indexOf(items[0]) < 0) {
|
if (manageditems.indexOf(items[0]) < 0) {
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ const initStore = function(rootElement) {
|
||||||
const runFix = function(alertId, analysisId, fixId, runCommand) {
|
const runFix = function(alertId, analysisId, fixId, runCommand) {
|
||||||
let idx;
|
let idx;
|
||||||
for (idx = dataStore.entries.length - 1; idx >= 0; --idx) {
|
for (idx = dataStore.entries.length - 1; idx >= 0; --idx) {
|
||||||
if (dataStore.entries[idx].key == alertId)
|
if (dataStore.entries[idx].key === alertId)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
|
|
@ -119,7 +119,7 @@ const initStore = function(rootElement) {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
let idx;
|
let idx;
|
||||||
for (idx = dataStore.entries.length - 1; idx >= 0; --idx) {
|
for (idx = dataStore.entries.length - 1; idx >= 0; --idx) {
|
||||||
if (dataStore.entries[idx].key == alertId)
|
if (dataStore.entries[idx].key === alertId)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (idx < 0)
|
if (idx < 0)
|
||||||
|
|
@ -168,7 +168,7 @@ const initStore = function(rootElement) {
|
||||||
// we start at the back because that's where we push new entries
|
// we start at the back because that's where we push new entries
|
||||||
// if we receive an alert multiple times, this is where it will be
|
// if we receive an alert multiple times, this is where it will be
|
||||||
for (let idx = dataStore.entries.length - 1; idx >= 0; --idx) {
|
for (let idx = dataStore.entries.length - 1; idx >= 0; --idx) {
|
||||||
if (dataStore.entries[idx].key == localId) {
|
if (dataStore.entries[idx].key === localId) {
|
||||||
if (description === undefined || count === undefined) {
|
if (description === undefined || count === undefined) {
|
||||||
dataStore.entries[idx].details = details;
|
dataStore.entries[idx].details = details;
|
||||||
return;
|
return;
|
||||||
|
|
@ -199,7 +199,7 @@ const initStore = function(rootElement) {
|
||||||
*/
|
*/
|
||||||
const handleMultipleMessages = function(entries) {
|
const handleMultipleMessages = function(entries) {
|
||||||
const detailPromises = [];
|
const detailPromises = [];
|
||||||
for (let idxEntry = 0; idxEntry != entries.length; ++idxEntry) {
|
for (let idxEntry = 0; idxEntry !== entries.length; ++idxEntry) {
|
||||||
const entry = entries[idxEntry];
|
const entry = entries[idxEntry];
|
||||||
maybeUpdateAlert(entry.localId, entry.summary, entry.reportCount, undefined);
|
maybeUpdateAlert(entry.localId, entry.summary, entry.reportCount, undefined);
|
||||||
detailPromises.push(dataStore.getAlertDetails(entry.localId));
|
detailPromises.push(dataStore.getAlertDetails(entry.localId));
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ client.init = function() {
|
||||||
client.alertCallback = null;
|
client.alertCallback = null;
|
||||||
|
|
||||||
function handleSignal(event, name, args) {
|
function handleSignal(event, name, args) {
|
||||||
if (client.alertCallback && name == "alert") {
|
if (client.alertCallback && name === "alert") {
|
||||||
const level = args[0];
|
const level = args[0];
|
||||||
const localId = args[1];
|
const localId = args[1];
|
||||||
client.alertCallback(level, localId);
|
client.alertCallback(level, localId);
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ class SELinuxEventDetails extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fixable) {
|
if (fixable) {
|
||||||
if ((itm.fix) && (itm.fix.plugin == itm.analysisId)) {
|
if ((itm.fix) && (itm.fix.plugin === itm.analysisId)) {
|
||||||
if (itm.fix.running) {
|
if (itm.fix.running) {
|
||||||
msg = (
|
msg = (
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -127,7 +127,7 @@ class SELinuxEventDetails extends React.Component {
|
||||||
const lines = itm.doText.split("\n");
|
const lines = itm.doText.split("\n");
|
||||||
let lastCommand = false;
|
let lastCommand = false;
|
||||||
lines.forEach(l => {
|
lines.forEach(l => {
|
||||||
if (l[0] == "#") { // command
|
if (l[0] === "#") { // command
|
||||||
if (lastCommand) // When appending command remove "# ". Only the first command keeps it and it is removed later on
|
if (lastCommand) // When appending command remove "# ". Only the first command keeps it and it is removed later on
|
||||||
parts[parts.length - 1] += ("\n" + l.substring(2));
|
parts[parts.length - 1] += ("\n" + l.substring(2));
|
||||||
else
|
else
|
||||||
|
|
@ -138,7 +138,7 @@ class SELinuxEventDetails extends React.Component {
|
||||||
lastCommand = false;
|
lastCommand = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
doElement = parts.map((p, index) => p[0] == "#"
|
doElement = parts.map((p, index) => p[0] === "#"
|
||||||
? codeBlock(p.substring(2), index)
|
? codeBlock(p.substring(2), index)
|
||||||
: <span key={p}>{p}</span>);
|
: <span key={p}>{p}</span>);
|
||||||
}
|
}
|
||||||
|
|
@ -160,7 +160,7 @@ class SELinuxEventDetails extends React.Component {
|
||||||
</div>
|
</div>
|
||||||
{fixit}
|
{fixit}
|
||||||
</div>
|
</div>
|
||||||
{itmIdx != self.props.details.pluginAnalysis.length - 1 && <Divider />}
|
{itmIdx !== self.props.details.pluginAnalysis.length - 1 && <Divider />}
|
||||||
</StackItem>
|
</StackItem>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
@ -353,7 +353,7 @@ export class SETroubleshootPage extends React.Component {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
// if the alert has level "red", it's critical
|
// if the alert has level "red", it's critical
|
||||||
const criticalAlert = (itm.details && 'level' in itm.details && itm.details.level == "red")
|
const criticalAlert = (itm.details && 'level' in itm.details && itm.details.level === "red")
|
||||||
? <ExclamationTriangleIcon className="ct-icon-exclamation-triangle pf-v6-c-icon pf-m-lg" />
|
? <ExclamationTriangleIcon className="ct-icon-exclamation-triangle pf-v6-c-icon pf-m-lg" />
|
||||||
: null;
|
: null;
|
||||||
const columns = [
|
const columns = [
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue