Fleet UI: 1 new premium role (Observer+, GitOps is hidden) (#11028)

This commit is contained in:
RachelElysia
2023-04-07 11:36:47 -04:00
committed by GitHub
parent c7244add59
commit bfa257c8b5
31 changed files with 430 additions and 192 deletions
+13
View File
@@ -1,3 +1,5 @@
import { UserRole } from "interfaces/user";
/**
* Capitalizes the words of the string passed in.
* @param str un-capitalized string
@@ -6,6 +8,17 @@ const capitalize = (str: string): string => {
return str.replace(/\b\w/g, (letter) => letter.toUpperCase());
};
const capitalizeRole = (str: UserRole): UserRole => {
if (str === "observer_plus") {
return "Observer+";
}
if (str === "gitops") {
return "GitOps";
}
return str.replace(/\b\w/g, (letter) => letter.toUpperCase()) as UserRole;
};
export default {
capitalize,
capitalizeRole,
};