Skip to content

Commit

Permalink
fix(config-ui): project name not encoded
Browse files Browse the repository at this point in the history
  • Loading branch information
mintsweet committed Nov 8, 2023
1 parent 88cdbda commit 3d7e2bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion config-ui/src/pages/project/detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import { PageHeader, PageLoading } from '@/components';
import { useRefreshData } from '@/hooks';
import { BlueprintDetail, FromEnum } from '@/pages';

import { encodeName } from '../utils';

import { WebhooksPanel } from './webhooks-panel';
import { SettingsPanel } from './settings-panel';
import * as S from './styled';
Expand All @@ -36,7 +38,7 @@ export const ProjectDetailPage = () => {
const { pname } = useParams() as { pname: string };
const [query, setQuery] = useUrlState({ tabId: 'blueprint' });

const { ready, data } = useRefreshData(() => API.project.get(pname), [pname, version]);
const { ready, data } = useRefreshData(() => API.project.get(encodeName(pname)), [pname, version]);

const handleChangeTabId = (tabId: string) => {
setQuery({ tabId });
Expand Down
6 changes: 3 additions & 3 deletions config-ui/src/pages/project/detail/settings-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { Card, FormItem, Buttons, toast, Dialog } from '@/components';
import { IProject } from '@/types';
import { operator } from '@/utils';

import { validName } from '../utils';
import { validName, encodeName } from '../utils';

import * as S from './styled';

Expand Down Expand Up @@ -57,7 +57,7 @@ export const SettingsPanel = ({ project, onRefresh }: Props) => {

const [success] = await operator(
() =>
API.project.update(project.name, {
API.project.update(encodeName(project.name), {
name,
description: '',
metrics: [
Expand All @@ -75,7 +75,7 @@ export const SettingsPanel = ({ project, onRefresh }: Props) => {

if (success) {
onRefresh();
navigate(`/projects/${name}?tabId=settings`);
navigate(`/projects/${encodeName(name)}?tabId=settings`);
}
};

Expand Down

0 comments on commit 3d7e2bd

Please sign in to comment.