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

chore: consolidate onshowOrganizations usage#14756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
aslilac merged 2 commits intomainfromlilac/show-organizations
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletionssite/src/modules/dashboard/Navbar/Navbar.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,15 +12,14 @@ export const Navbar: FC = () => {
const { metadata } = useEmbeddedMetadata();
const buildInfoQuery = useQuery(buildInfo(metadata["build-info"]));

const { appearance,experiments } = useDashboard();
const { appearance,showOrganizations } = useDashboard();
const { user: me, permissions, signOut } = useAuthenticated();
const featureVisibility = useFeatureVisibility();
const canViewAuditLog =
featureVisibility.audit_log && Boolean(permissions.viewAnyAuditLog);
const canViewDeployment = Boolean(permissions.viewDeploymentValues);
const canViewOrganizations =
Boolean(permissions.editAnyOrganization) &&
experiments.includes("multi-organization");
Boolean(permissions.editAnyOrganization) && showOrganizations;
const canViewAllUsers = Boolean(permissions.viewAllUsers);
const proxyContextValue = useProxy();
const canViewHealth = canViewDeployment;
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,18 +27,13 @@ export const ImportStarterTemplateView: FC<CreateTemplatePageViewProps> = ({
isCreating,
}) => {
const navigate = useNavigate();
const { entitlements, experiments } = useDashboard();
const { multiple_organizations: organizationsEnabled } =
useFeatureVisibility();
const { entitlements, showOrganizations } = useDashboard();
const [searchParams] = useSearchParams();
const templateExamplesQuery = useQuery(templateExamples());
const templateExample = templateExamplesQuery.data?.find(
(e) => e.id === searchParams.get("exampleId")!,
);

const showOrganizationPicker =
experiments.includes("multi-organization") && organizationsEnabled;

const isLoading = templateExamplesQuery.isLoading;
const loadingError = templateExamplesQuery.error;

Expand DownExpand Up@@ -77,7 +72,7 @@ export const ImportStarterTemplateView: FC<CreateTemplatePageViewProps> = ({
onCancel={() => navigate(-1)}
jobError={isJobError ? error.job.error : undefined}
logs={templateVersionLogsQuery.data}
showOrganizationPicker={showOrganizationPicker}
showOrganizationPicker={showOrganizations}
onSubmit={async (formData) => {
await onCreateTemplate({
organization: formData.organization,
Expand Down
9 changes: 2 additions & 7 deletionssite/src/pages/CreateTemplatePage/UploadTemplateView.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,14 +21,9 @@ export const UploadTemplateView: FC<CreateTemplatePageViewProps> = ({
error,
}) => {
const navigate = useNavigate();
const { entitlements, experiments } = useDashboard();
const { multiple_organizations: organizationsEnabled } =
useFeatureVisibility();
const { entitlements, showOrganizations } = useDashboard();
const formPermissions = getFormPermissions(entitlements);

const showOrganizationPicker =
experiments.includes("multi-organization") && organizationsEnabled;

const uploadFileMutation = useMutation(uploadFile());
const uploadedFile = uploadFileMutation.data;

Expand DownExpand Up@@ -61,7 +56,7 @@ export const UploadTemplateView: FC<CreateTemplatePageViewProps> = ({
onRemove: uploadFileMutation.reset,
file: uploadFileMutation.variables,
}}
showOrganizationPicker={showOrganizationPicker}
showOrganizationPicker={showOrganizations}
onSubmit={async (formData) => {
await onCreateTemplate({
organization: formData.organization,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,20 +10,19 @@ import { CreateTemplatesPageView } from "./CreateTemplatesPageView";
import { StarterTemplatesPageView } from "./StarterTemplatesPageView";

const CreateTemplatesGalleryPage: FC = () => {
const {experiments } = useDashboard();
const {showOrganizations } = useDashboard();
const templateExamplesQuery = useQuery(templateExamples());
const starterTemplatesByTag = templateExamplesQuery.data
? // Currently, the scratch template should not be displayed on the starter templates page.
getTemplatesByTag(removeScratchExample(templateExamplesQuery.data))
: undefined;
const multiOrgExperimentEnabled = experiments.includes("multi-organization");

return (
<>
<Helmet>
<title>{pageTitle("Create a Template")}</title>
</Helmet>
{multiOrgExperimentEnabled ? (
{showOrganizations ? (
<CreateTemplatesPageView
error={templateExamplesQuery.error}
starterTemplatesByTag={starterTemplatesByTag}
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,11 +31,9 @@ export const useDeploySettings = (): DeploySettingsContextValue => {
};

export const DeploySettingsLayout: FC = () => {
const {experiments } = useDashboard();
const {showOrganizations } = useDashboard();

const canViewOrganizations = experiments.includes("multi-organization");

return canViewOrganizations ? (
return showOrganizations ? (
<ManagementSettingsLayout />
) : (
<DeploySettingsLayoutInner />
Expand Down
33 changes: 14 additions & 19 deletionssite/src/pages/TemplatesPage/TemplatesPageView.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,6 @@ import {
TableRowSkeleton,
} from "components/TableLoader/TableLoader";
import { useClickableTableRow } from "hooks/useClickableTableRow";
import { useDashboard } from "modules/dashboard/useDashboard";
import { linkToTemplate, useLinks } from "modules/navigation";
import type { FC } from "react";
import { useNavigate } from "react-router-dom";
Expand DownExpand Up@@ -193,31 +192,27 @@ export const TemplatesPageView: FC<TemplatesPageViewProps> = ({
examples,
templates,
}) => {
const { experiments } = useDashboard();
const isLoading = !templates;
const isEmpty = templates && templates.length === 0;
const navigate = useNavigate();
const multiOrgExperimentEnabled = experiments.includes("multi-organization");

const createTemplateAction = () => {
return multiOrgExperimentEnabled ? (
<Button
startIcon={<AddIcon />}
variant="contained"
onClick={() => {
navigate("/starter-templates");
}}
>
Create Template
</Button>
) : (
<CreateTemplateButton onNavigate={navigate} />
);
};
const createTemplateAction = showOrganizations ? (
<Button
startIcon={<AddIcon />}
variant="contained"
onClick={() => {
navigate("/starter-templates");
}}
>
Create Template
</Button>
) : (
<CreateTemplateButton onNavigate={navigate} />
);

return (
<Margins>
<PageHeader actions={canCreateTemplates && createTemplateAction()}>
<PageHeader actions={canCreateTemplates && createTemplateAction}>
<PageHeaderTitle>
<Stack spacing={1} direction="row" alignItems="center">
Templates
Expand Down
6 changes: 2 additions & 4 deletionssite/src/pages/UsersPage/UsersLayout.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,14 +19,12 @@ import {

export const UsersLayout: FC = () => {
const { permissions } = useAuthenticated();
const {experiments } = useDashboard();
const {showOrganizations } = useDashboard();
const navigate = useNavigate();
const feats = useFeatureVisibility();
const location = useLocation();
const activeTab = location.pathname.endsWith("groups") ? "groups" : "users";

const canViewOrganizations = experiments.includes("multi-organization");

return (
<>
<Margins>
Expand DownExpand Up@@ -59,7 +57,7 @@ export const UsersLayout: FC = () => {
</PageHeader>
</Margins>

{!canViewOrganizations && (
{!showOrganizations && (
<Tabs
css={{ marginBottom: 40, marginTop: -TAB_PADDING_Y }}
active={activeTab}
Expand Down
7 changes: 3 additions & 4 deletionssite/src/pages/UsersPage/UsersPage.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,7 +40,7 @@ const UsersPage: FC = () => {
const navigate = useNavigate();
const location = useLocation();
const searchParamsResult = useSearchParams();
const { entitlements,experiments } = useDashboard();
const { entitlements,showOrganizations } = useDashboard();
const [searchParams] = searchParamsResult;

const groupsByUserIdQuery = useQuery(groupsByUserId());
Expand DownExpand Up@@ -102,8 +102,7 @@ const UsersPage: FC = () => {
authMethodsQuery.isLoading ||
groupsByUserIdQuery.isLoading;

const canViewOrganizations = experiments.includes("multi-organization");
if (canViewOrganizations && location.pathname !== "/deployment/users") {
if (showOrganizations && location.pathname !== "/deployment/users") {
return <Navigate to={`/deployment/users${location.search}`} replace />;
}

Expand DownExpand Up@@ -160,7 +159,7 @@ const UsersPage: FC = () => {
menus: { status: statusMenu },
}}
usersQuery={usersQuery}
canViewOrganizations={canViewOrganizations}
canViewOrganizations={showOrganizations}
canCreateUser={canCreateUser}
/>

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp