feat: complete deployment codebase for BackOne DPI dashboard with dynamic telemetry, rebranding, database size tracking, and modular design
This commit is contained in:
1 parent
6cf3c6c7e5
commit
c316f3171b
226 files changed
+21152
-8397
No files matched your search
@@ -0,0 +1,36 @@
|
||||
export function sortAppOptions(options: string[]): string[] {
|
||||
const KNOWN_PORTS = new Set([
|
||||
"1433", "1434", "1521", "1812", "1813", "1900", "3306", "3389",
|
||||
"5060", "5061", "5353", "5432", "5900", "6379", "8000", "8080",
|
||||
"8443", "9200", "27017"
|
||||
]);
|
||||
|
||||
const getPortInfo = (opt: string) => {
|
||||
const m = opt.trim().match(/^(?:Port\s+)?(\d+)$/i);
|
||||
if (!m) {
|
||||
return { isPort: false, portNum: 0, isStandard: true, name: opt };
|
||||
}
|
||||
const portNum = parseInt(m[1], 10);
|
||||
const isStandard = portNum < 1024 || KNOWN_PORTS.has(String(portNum));
|
||||
return { isPort: true, portNum, isStandard, name: opt };
|
||||
};
|
||||
|
||||
return [...options].sort((a, b) => {
|
||||
const infoA = getPortInfo(a);
|
||||
const infoB = getPortInfo(b);
|
||||
|
||||
if (infoA.isStandard && !infoB.isStandard) return -1;
|
||||
if (!infoA.isStandard && infoB.isStandard) return 1;
|
||||
|
||||
if (infoA.isStandard && infoB.isStandard) {
|
||||
if (!infoA.isPort && infoB.isPort) return -1;
|
||||
if (infoA.isPort && !infoB.isPort) return 1;
|
||||
if (!infoA.isPort && !infoB.isPort) {
|
||||
return infoA.name.localeCompare(infoB.name);
|
||||
}
|
||||
return infoA.portNum - infoB.portNum;
|
||||
}
|
||||
|
||||
return infoA.portNum - infoB.portNum;
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user