fix(ui): unify table controls and organization layouts
This commit is contained in:
@@ -28,9 +28,8 @@ import {
|
||||
} from '../../components/common/PageGuide';
|
||||
import OrgPanel from './components/OrgPanel';
|
||||
import './org-skills.css';
|
||||
import OrgBreadcrumb from './components/OrgBreadcrumb';
|
||||
|
||||
const { Title, Text, Paragraph } = Typography;
|
||||
const { Paragraph } = Typography;
|
||||
const blankSkill = {
|
||||
canonical_id: '',
|
||||
body: '# Method\n\nDescribe a safe, evidence-led method.',
|
||||
@@ -57,6 +56,20 @@ const split = (value) =>
|
||||
|
||||
const OrgPrivateSkills = ({ orgId }) => {
|
||||
const { t } = useTranslation();
|
||||
const editorLabels = {
|
||||
name_zh: t('中文名称'),
|
||||
name_en: t('英文名称'),
|
||||
description_zh: t('中文说明'),
|
||||
description_en: t('说明') + ' (EN)',
|
||||
triggers_zh: t('触发词') + ' (ZH)',
|
||||
triggers_en: t('触发词') + ' (EN)',
|
||||
scenarios_zh: t('适用场景') + ' (ZH)',
|
||||
scenarios_en: t('适用场景') + ' (EN)',
|
||||
compact_constraint_zh: t('限制') + ' (ZH)',
|
||||
compact_constraint_en: t('限制') + ' (EN)',
|
||||
tags: t('标签'),
|
||||
change_statement: t('版本说明'),
|
||||
};
|
||||
const isMobile = useIsMobile();
|
||||
const headers = useMemo(() => ({ 'X-Org-Id': String(orgId) }), [orgId]);
|
||||
const [items, setItems] = useState([]);
|
||||
@@ -199,9 +212,10 @@ const OrgPrivateSkills = ({ orgId }) => {
|
||||
const isReviewer =
|
||||
currentUserId > 0 && Number(row.review?.reviewer_id) === currentUserId;
|
||||
return (
|
||||
<div className='flex flex-wrap gap-2'>
|
||||
<div className='org-private-skill-actions'>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
disabled={row.definition.emergency_stopped}
|
||||
onClick={() => {
|
||||
setEditingSkill(row.definition);
|
||||
@@ -214,11 +228,16 @@ const OrgPrivateSkills = ({ orgId }) => {
|
||||
>
|
||||
{t('新版本')}
|
||||
</Button>
|
||||
<Button size='small' onClick={() => openHistory(row.definition)}>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
onClick={() => openHistory(row.definition)}
|
||||
>
|
||||
{t('历史版本')}
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
disabled={!versionId}
|
||||
onClick={() => {
|
||||
// Clear residue from a previous version's test before reopening.
|
||||
@@ -230,6 +249,7 @@ const OrgPrivateSkills = ({ orgId }) => {
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
disabled={!versionId || row.review?.status !== 'pending' || isAuthor}
|
||||
onClick={() =>
|
||||
action(`/api/org/skills/private/versions/${versionId}/review/start`)
|
||||
@@ -241,6 +261,7 @@ const OrgPrivateSkills = ({ orgId }) => {
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<ActionFileCheck2 size={14} />}
|
||||
disabled={
|
||||
!versionId || row.review?.status !== 'reviewing' || !isReviewer
|
||||
@@ -256,6 +277,7 @@ const OrgPrivateSkills = ({ orgId }) => {
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
type='danger'
|
||||
disabled={
|
||||
!versionId || row.review?.status !== 'reviewing' || !isReviewer
|
||||
@@ -271,6 +293,7 @@ const OrgPrivateSkills = ({ orgId }) => {
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
disabled={!versionId || row.review?.status !== 'approved'}
|
||||
onClick={() =>
|
||||
action(`/api/org/skills/private/versions/${versionId}/publish`)
|
||||
@@ -280,6 +303,7 @@ const OrgPrivateSkills = ({ orgId }) => {
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<ActionRotateCcw size={14} />}
|
||||
disabled={!versionId}
|
||||
onClick={() =>
|
||||
@@ -384,24 +408,17 @@ const OrgPrivateSkills = ({ orgId }) => {
|
||||
closeGuide();
|
||||
}, [orgId, closeGuide]);
|
||||
return (
|
||||
<div className='org-skills-page'>
|
||||
<header className='org-skills-hero'>
|
||||
<div>
|
||||
<OrgBreadcrumb current={t('企业自研 Skill')} />
|
||||
<Title heading={3}>{t('企业自研 Skill')}</Title>
|
||||
<Text type='tertiary'>
|
||||
{t(
|
||||
'版本内容不可变;兼容扫描、双人审核、发布、回滚与紧急停用均保留审计。',
|
||||
)}
|
||||
</Text>
|
||||
</div>
|
||||
<div className='org-skills-hero-actions'>
|
||||
<PageGuideTrigger guide={guide} />
|
||||
<Button icon={<ActionCode2 size={16} />} onClick={openCreateEditor}>
|
||||
{t('创建私有 Skill')}
|
||||
</Button>
|
||||
</div>
|
||||
</header>
|
||||
<div className='org-skill-center-content'>
|
||||
<div className='org-skill-center-actions'>
|
||||
<Button
|
||||
theme='solid'
|
||||
icon={<ActionCode2 size={16} />}
|
||||
onClick={openCreateEditor}
|
||||
>
|
||||
{t('创建私有 Skill')}
|
||||
</Button>
|
||||
<PageGuideTrigger guide={guide} />
|
||||
</div>
|
||||
<PageGuidePill guide={guide} />
|
||||
<PageGuideDrawer guide={guide} />
|
||||
<OrgPanel>
|
||||
@@ -495,40 +512,35 @@ const OrgPrivateSkills = ({ orgId }) => {
|
||||
onOk={save}
|
||||
width={820}
|
||||
>
|
||||
<div className='org-private-skill-form'>
|
||||
<Input
|
||||
disabled={!!editingSkill}
|
||||
placeholder='canonical_id'
|
||||
value={form.canonical_id}
|
||||
onChange={(canonical_id) => setForm({ ...form, canonical_id })}
|
||||
/>
|
||||
{[
|
||||
'name_zh',
|
||||
'name_en',
|
||||
'description_zh',
|
||||
'description_en',
|
||||
'triggers_zh',
|
||||
'triggers_en',
|
||||
'scenarios_zh',
|
||||
'scenarios_en',
|
||||
'compact_constraint_zh',
|
||||
'compact_constraint_en',
|
||||
'tags',
|
||||
'change_statement',
|
||||
].map((key) => (
|
||||
<div className='org-private-skill-form org-private-skill-editor'>
|
||||
<label>
|
||||
<span>{t('技能标识')}</span>
|
||||
<Input
|
||||
key={key}
|
||||
placeholder={key}
|
||||
value={form[key]}
|
||||
onChange={(value) => setForm({ ...form, [key]: value })}
|
||||
disabled={!!editingSkill}
|
||||
placeholder='canonical_id'
|
||||
value={form.canonical_id}
|
||||
onChange={(canonical_id) => setForm({ ...form, canonical_id })}
|
||||
/>
|
||||
</label>
|
||||
{Object.entries(editorLabels).map(([key, label]) => (
|
||||
<label key={key}>
|
||||
<span>{label}</span>
|
||||
<Input
|
||||
placeholder={key}
|
||||
value={form[key]}
|
||||
onChange={(value) => setForm({ ...form, [key]: value })}
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
<TextArea
|
||||
rows={10}
|
||||
placeholder={I18N_TECHNICAL_TEXT.SKILL_MARKDOWN}
|
||||
value={form.body}
|
||||
onChange={(body) => setForm({ ...form, body })}
|
||||
/>
|
||||
<label className='org-private-skill-body'>
|
||||
<span>{I18N_TECHNICAL_TEXT.SKILL_MARKDOWN}</span>
|
||||
<TextArea
|
||||
rows={10}
|
||||
placeholder={I18N_TECHNICAL_TEXT.SKILL_MARKDOWN}
|
||||
value={form.body}
|
||||
onChange={(body) => setForm({ ...form, body })}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
</Modal>
|
||||
<Modal
|
||||
|
||||
Reference in New Issue
Block a user