Просмотр исходного кода

Merge pull request #873 from porter-dev/master

Stage hide integrations tab for "Viewer" role
jusrhee 4 лет назад
Родитель
Сommit
4840edbbc3

+ 3 - 0
dashboard/src/main/home/Home.tsx

@@ -42,6 +42,9 @@ const GuardedProjectSettings = fakeGuardedRoute("settings", "", [
 const GuardedIntegrations = fakeGuardedRoute("integrations", "", [
 const GuardedIntegrations = fakeGuardedRoute("integrations", "", [
   "get",
   "get",
   "list",
   "list",
+  "update",
+  "create",
+  "delete",
 ])(Integrations);
 ])(Integrations);
 
 
 type PropsType = RouteComponentProps &
 type PropsType = RouteComponentProps &

+ 4 - 0
dashboard/src/main/home/cluster-dashboard/expanded-chart/ExpandedJobChart.tsx

@@ -430,6 +430,10 @@ class ExpandedJobChart extends Component<PropsType, StateType> {
       />
       />
     );
     );
 
 
+    if (!this.props.isAuthorized("job", "", ["get", "update", "create"])) {
+      saveButton = null;
+    }
+
     switch (currentTab) {
     switch (currentTab) {
       case "jobs":
       case "jobs":
         if (this.state.imageIsPlaceholder) {
         if (this.state.imageIsPlaceholder) {

+ 6 - 1
dashboard/src/main/home/sidebar/Sidebar.tsx

@@ -234,7 +234,12 @@ class Sidebar extends Component<PropsType, StateType> {
             Launch
             Launch
           </NavButton>
           </NavButton>
 
 
-          {this.props.isAuthorized("integrations", "", ["get"]) && (
+          {this.props.isAuthorized("integrations", "", [
+            "get",
+            "create",
+            "update",
+            "delete",
+          ]) && (
             <NavButton
             <NavButton
               selected={currentView === "integrations"}
               selected={currentView === "integrations"}
               onClick={() =>
               onClick={() =>