Skip to content

Commit

Permalink
fix: fix jump project show error and fix branch policy i18n show (#4046)
Browse files Browse the repository at this point in the history
* fix(dop): fix jump project detail show error in edge case

* fix(dop): fix branch i18n call

* fix(dop): add download in prokect release detail
  • Loading branch information
ruoqianfengshao authored Jun 17, 2024
1 parent 53127c5 commit 6706e61
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 15 deletions.
3 changes: 3 additions & 0 deletions shell/app/layout/stores/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ const layout = createStore({
}
siderInfoMap[key] = { ...siderInfoMap[key], ...rest };
},
clearSubSiderInfoMap(state, key) {
delete state.subSiderInfoMap[key];
},
setSubSiderSubList(state, payload: Obj) {
state.subList = { ...state.subList, ...payload };
},
Expand Down
3 changes: 1 addition & 2 deletions shell/app/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@
"Branch Rule": "Branch Rule",
"Branch binds environment in the platform. The branch code can only be deployed to the environment selected below by CI/CD pipeline.": "Branch binds environment in the platform. The branch code can only be deployed to the environment selected below by CI/CD pipeline.",
"Branch does not exist or has been deleted": "Branch does not exist or has been deleted",
"Branch policy": "Branch policy",
"Branch Policy": "Branch Policy",
"Branch protection": "Branch protection",
"Briefly describe your project. Please go to": "Briefly describe your project. Please go to",
"Build details": "Build details",
Expand Down Expand Up @@ -1490,7 +1490,6 @@
"branch deleted successfully": "branch deleted successfully",
"branch is protected, you have no permission yet": "branch is protected, you have no permission yet",
"branch management": "branches",
"branch policy": "branch policy",
"branch to commit": "branch to commit",
"branches": "branches",
"bug total": "bug total",
Expand Down
3 changes: 1 addition & 2 deletions shell/app/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@
"Branch Rule": "分支规则",
"Branch binds environment in the platform. The branch code can only be deployed to the environment selected below by CI/CD pipeline.": "平台中分支绑定环境,该分支代码通过平台 CI/CD 流水线后仅能部署到下面选择的环境中",
"Branch does not exist or has been deleted": "分支不存在或已被删除",
"Branch policy": "分支策略",
"Branch Policy": "分支策略",
"Branch protection": "分支保护",
"Briefly describe your project. Please go to": "用一句话讲述你的项目,让更多的人快速了解你的项目,前往",
"Build details": "构建详情",
Expand Down Expand Up @@ -1490,7 +1490,6 @@
"branch deleted successfully": "删除分支成功",
"branch is protected, you have no permission yet": "该分支被保护, 您暂无权限操作",
"branch management": "分支管理",
"branch policy": "分支策略",
"branch to commit": "提交分支",
"branches": "分支",
"bug total": "缺陷总数",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ const ReleaseProjectDetail = () => {
},
];

// 下载制品,列表页中是后端返回的下载路径,详情里暂时是前端拼接的
const handleDownload = () => {
goTo(`/api/terminus/releases/${releaseID}/actions/download`, { jumpOut: true });
};

return (
<div className="text-default">
<Tabs defaultActiveKey="1" className="h-full">
Expand Down Expand Up @@ -121,6 +126,9 @@ const ReleaseProjectDetail = () => {
{i18n.t('dop:To Formal')}
</Button>
) : null}
<Button className="mr-3 br-default" type="primary" onClick={handleDownload}>
{i18n.t('Download')}
</Button>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,15 @@ const ProjectSettings = () => {
),
},
{
tabTitle: i18n.s('branch policy', 'dop'),
tabTitle: i18n.t('dop:Branch Policy'),
tabKey: 'branchPolicy',
content: (
<ConfigLayout
sectionList={[
{
title: i18n.s('Branch policy', 'dop'),
desc: i18n.s(
'The project branch management specification mainly regulates which branch different branches are cut from and finally merged into that branch.',
'dop',
title: i18n.t('dop:Branch Policy'),
desc: i18n.t(
'dop:The project branch management specification mainly regulates which branch different branches are cut from and finally merged into that branch.',
),
children: (
<BranchPolicy projectId={projectId} editAuth={permMap.setting.customWorkflow.operation.pass} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ const BranchPolicyItem = ({
style={{ height: 100 }}
tip={
<div className="text-sm">
{i18n.s('current branch has no policy', 'dop')}
{i18n.t('dop:current branch has no policy')}
<If condition={editAuth}>
{', '}
<span
Expand All @@ -238,7 +238,7 @@ const BranchPolicyItem = ({
}}
className="text-purple-deep cursor-pointer"
>
{i18n.s('Click to add a branch policy', 'dop')}
{i18n.t('dop:Click to add a branch policy')}
</span>
</If>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ const FlowDrawer = ({
},
},
{
label: i18n.s('Branch policy', 'dop'),
label: i18n.t('dop:Branch Policy'),
showRequiredMark: true,
name: 'targetBranch',
icon: 'daimafenzhi',
Expand Down Expand Up @@ -263,7 +263,7 @@ const FlowDrawer = ({
}}
>
<div className="mx-3 text-purple-deep">
{i18n.t('edit {name}', { name: i18n.t('dop:branch policy') })}
{i18n.t('edit {name}', { name: i18n.t('dop:Branch Policy') })}
</div>
</Link>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const DevOpsWorkflow = (props: IProps) => {
dataIndex: 'name',
},
{
title: i18n.s('Branch policy', 'dop'),
title: i18n.t('dop:Branch Policy'),
dataIndex: 'targetBranch',
render: (_v: string) => {
const curPolicy = (data?.branchPolicies || []).find((item) => item.branch === _v);
Expand All @@ -140,7 +140,7 @@ const DevOpsWorkflow = (props: IProps) => {
{curPolicy ? (
<div>
<div className="flex-h-center">
<span className="text-default-6">{i18n.s('Branch policy', 'dop')}</span>
<span className="text-default-6">{i18n.t('dop:Branch Policy')}</span>
</div>
<BranchPolicyCard data={policyObj} />
</div>
Expand Down
1 change: 1 addition & 0 deletions shell/app/modules/project/stores/project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ const project = createStore({
if (isLeaving('project')) {
userStore.reducers.clearProjectList();
project.reducers.updateCurProjectId();
layoutStore.reducers.clearSubSiderInfoMap('project');
}
});
},
Expand Down

0 comments on commit 6706e61

Please sign in to comment.