Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8b74b12

Browse files
committed
fix: show org summary page if not entitled
You cannot edit the settings without being entitled, so show the summarypage instead.
1 parentbec6a26 commit8b74b12

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

‎site/src/pages/ManagementSettingsPage/OrganizationSettingsPage.stories.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const meta: Meta<typeof OrganizationSettingsPage> = {
1010
decorators:[withAuthProvider,withDashboardProvider],
1111
parameters:{
1212
user:MockUser,
13+
features:["multiple_organizations"],
1314
permissions:{viewDeploymentValues:true},
1415
queries:[
1516
{
@@ -61,3 +62,23 @@ export const CanEditOrganization: Story = {
6162
],
6263
},
6364
};
65+
66+
exportconstCanEditOrganizationNotEntitled:Story={
67+
parameters:{
68+
reactRouter:reactRouterParameters({
69+
location:{pathParams:{organization:MockDefaultOrganization.name}},
70+
routing:{path:"/organizations/:organization"},
71+
}),
72+
features:[],
73+
queries:[
74+
{
75+
key:["organizations",[MockDefaultOrganization.id],"permissions"],
76+
data:{
77+
[MockDefaultOrganization.id]:{
78+
editOrganization:true,
79+
},
80+
},
81+
},
82+
],
83+
},
84+
};

‎site/src/pages/ManagementSettingsPage/OrganizationSettingsPage.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type { Organization } from "api/typesGenerated";
77
import{EmptyState}from"components/EmptyState/EmptyState";
88
import{displaySuccess}from"components/GlobalSnackbar/utils";
99
import{Loader}from"components/Loader/Loader";
10+
import{useFeatureVisibility}from"modules/dashboard/useFeatureVisibility";
1011
importtype{FC}from"react";
1112
import{useMutation,useQuery,useQueryClient}from"react-query";
1213
import{Navigate,useNavigate,useParams}from"react-router-dom";
@@ -22,6 +23,7 @@ const OrganizationSettingsPage: FC = () => {
2223
organization?:string;
2324
};
2425
const{ organizations}=useOrganizationSettings();
26+
constfeats=useFeatureVisibility();
2527

2628
constnavigate=useNavigate();
2729
constqueryClient=useQueryClient();
@@ -69,7 +71,9 @@ const OrganizationSettingsPage: FC = () => {
6971
// The user may not be able to edit this org but they can still see it because
7072
// they can edit members, etc. In this case they will be shown a read-only
7173
// summary page instead of the settings form.
72-
if(!permissions[organization.id]?.editOrganization){
74+
// Similarly, if the feature is not entitled then the user will not be able to
75+
// edit the organization.
76+
if(!permissions[organization.id]?.editOrganization||!feats.multiple_organizations){
7377
return<OrganizationSummaryPageVieworganization={organization}/>;
7478
}
7579

‎site/src/testHelpers/storybook.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const withDashboardProvider = (
2424

2525
constentitlements:Entitlements={
2626
...MockEntitlements,
27+
has_license:features.length>0,
2728
features:withDefaultFeatures(
2829
Object.fromEntries(
2930
features.map((feature)=>[

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp