Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine conprof #1102

Merged
merged 17 commits into from
Dec 29, 2021
Merged
Prev Previous commit
Next Next commit
i18n
  • Loading branch information
baurine committed Dec 16, 2021
commit e9cf8cc742a7ae025d6af50d71e67861baf54571
7 changes: 1 addition & 6 deletions ui/dashboardApp/layout/main/Sider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,7 @@ function Sider({
'',
true
)
const conprofMenuItem = useAppMenuItem(
registry,
'continuous_profiling',
'',
true
)
const conprofMenuItem = useAppMenuItem(registry, 'conprof', '', true)
const profilingSubMenuItems = [instanceProfilingMenuItem]
if (supportConprof) {
profilingSubMenuItems.push(conprofMenuItem)
Expand Down
2 changes: 1 addition & 1 deletion ui/lib/apps/ContinuousProfiling/index.meta.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AimOutlined } from '@ant-design/icons'

export default {
id: 'continuous_profiling',
id: 'conprof',
routerPrefix: '/continuous_profiling',
icon: AimOutlined,
translations: require.context('./translations/', false, /\.yaml$/),
Expand Down
43 changes: 19 additions & 24 deletions ui/lib/apps/ContinuousProfiling/pages/ConProfSettingForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function translateSecToDay(seconds: number, t: TFunction) {
console.warn(`${seconds} is not the mulitple of one day seconds`)
}
const day = seconds / ONE_DAY_SECONDS
return t('continuous_profiling.settings.profile_retention_duration_option', {
return t('conprof.settings.profile_retention_duration_option', {
d: day,
})
}
Expand Down Expand Up @@ -102,11 +102,11 @@ function ConProfSettingForm({ onClose, onConfigUpdated }: Props) {
if (!values.enable) {
// confirm
Modal.confirm({
title: t('continuous_profiling.settings.close_feature'),
title: t('conprof.settings.close_feature'),
icon: <ExclamationCircleOutlined />,
content: t('continuous_profiling.settings.close_feature_confirm'),
okText: t('continuous_profiling.settings.actions.close'),
cancelText: t('continuous_profiling.settings.actions.cancel'),
content: t('conprof.settings.close_feature_confirm'),
okText: t('conprof.settings.actions.close'),
cancelText: t('conprof.settings.actions.cancel'),
okButtonProps: { danger: true },
onOk: () => updateConfig(values),
})
Expand All @@ -129,8 +129,8 @@ function ConProfSettingForm({ onClose, onConfigUpdated }: Props) {
>
<Form.Item
valuePropName="checked"
label={t('continuous_profiling.settings.switch')}
extra={t('continuous_profiling.settings.switch_tooltip')}
label={t('conprof.settings.switch')}
extra={t('conprof.settings.switch_tooltip')}
>
<Form.Item noStyle name="enable" valuePropName="checked">
<Switch disabled={!isWriteable} />
Expand All @@ -144,19 +144,16 @@ function ConProfSettingForm({ onClose, onConfigUpdated }: Props) {
getFieldValue('enable') && (
<>
<Form.Item
label={t('continuous_profiling.settings.profile_targets')}
extra={t(
'continuous_profiling.settings.profile_targets_tooltip',
{
n: estimateSize?.instance_count || '?',
size: estimateSize?.profile_size
? getValueFormat('decbytes')(
estimateSize.profile_size,
0
)
: '?',
}
)}
label={t('conprof.settings.profile_targets')}
extra={t('conprof.settings.profile_targets_tooltip', {
n: estimateSize?.instance_count || '?',
size: estimateSize?.profile_size
? getValueFormat('decbytes')(
estimateSize.profile_size,
0
)
: '?',
})}
>
<InstanceSelect
defaultSelectAll={true}
Expand All @@ -167,11 +164,9 @@ function ConProfSettingForm({ onClose, onConfigUpdated }: Props) {
</Form.Item>

<Form.Item
label={t(
'continuous_profiling.settings.profile_retention_duration'
)}
label={t('conprof.settings.profile_retention_duration')}
extra={t(
'continuous_profiling.settings.profile_retention_duration_tooltip'
'conprof.settings.profile_retention_duration_tooltip'
)}
>
<Input.Group>
Expand Down
18 changes: 9 additions & 9 deletions ui/lib/apps/ContinuousProfiling/pages/Detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ export default function Page() {
const columns = useMemo(
() => [
{
name: t('continuous_profiling.detail.table.columns.instance'),
name: t('conprof.detail.table.columns.instance'),
key: 'instance',
minWidth: 150,
maxWidth: 400,
onRender: (record) => record.target.address,
},
{
name: t('continuous_profiling.detail.table.columns.kind'),
name: t('conprof.detail.table.columns.kind'),
key: 'kind',
minWidth: 100,
maxWidth: 150,
Expand All @@ -45,7 +45,7 @@ export default function Page() {
},
},
{
name: t('continuous_profiling.detail.table.columns.content'),
name: t('conprof.detail.table.columns.content'),
key: 'content',
minWidth: 150,
maxWidth: 300,
Expand All @@ -58,7 +58,7 @@ export default function Page() {
},
},
{
name: t('continuous_profiling.detail.table.columns.status'),
name: t('conprof.detail.table.columns.status'),
key: 'status',
minWidth: 150,
maxWidth: 200,
Expand All @@ -69,7 +69,7 @@ export default function Page() {
return (
<Badge
status="success"
text={t('continuous_profiling.detail.table.status.finished')}
text={t('conprof.detail.table.status.finished')}
/>
)
}
Expand Down Expand Up @@ -115,23 +115,23 @@ export default function Page() {
return (
<div>
<Head
title={t('continuous_profiling.detail.head.title')}
title={t('conprof.detail.head.title')}
back={
<Link to={`/continuous_profiling`}>
<ArrowLeftOutlined /> {t('continuous_profiling.detail.head.back')}
<ArrowLeftOutlined /> {t('conprof.detail.head.back')}
</Link>
}
titleExtra={
<Button type="primary" onClick={handleDownloadGroup}>
{t('continuous_profiling.detail.download')}
{t('conprof.detail.download')}
</Button>
}
>
{groupProfileDetail && (
<Descriptions>
<Descriptions.Item
span={2}
label={t('continuous_profiling.detail.head.start_at')}
label={t('conprof.detail.head.start_at')}
>
<DateTime.Long unixTimestampMs={groupProfileDetail.ts! * 1000} />
</Descriptions.Item>
Expand Down
41 changes: 20 additions & 21 deletions ui/lib/apps/ContinuousProfiling/pages/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default function Page() {
const historyTableColumns = useMemo(
() => [
{
name: t('continuous_profiling.list.table.columns.targets'),
name: t('conprof.list.table.columns.targets'),
key: 'targets',
minWidth: 150,
maxWidth: 250,
Expand All @@ -98,7 +98,7 @@ export default function Page() {
},
},
{
name: t('continuous_profiling.list.table.columns.status'),
name: t('conprof.list.table.columns.status'),
key: 'status',
minWidth: 100,
maxWidth: 150,
Expand All @@ -108,32 +108,30 @@ export default function Page() {
return (
<Badge
status="error"
text={t('continuous_profiling.list.table.status.failed')}
text={t('conprof.list.table.status.failed')}
/>
)
} else if (rec.state === 'success') {
baurine marked this conversation as resolved.
Show resolved Hide resolved
// all success
return (
<Badge
status="success"
text={t('continuous_profiling.list.table.status.finished')}
text={t('conprof.list.table.status.finished')}
/>
)
} else {
// partial failed
return (
<Badge
status="warning"
text={t(
'continuous_profiling.list.table.status.partial_finished'
)}
text={t('conprof.list.table.status.partial_finished')}
/>
)
}
},
},
{
name: t('continuous_profiling.list.table.columns.start_at'),
name: t('conprof.list.table.columns.start_at'),
key: 'ts',
minWidth: 160,
maxWidth: 220,
Expand All @@ -142,7 +140,7 @@ export default function Page() {
},
},
{
name: t('continuous_profiling.list.table.columns.duration'),
name: t('conprof.list.table.columns.duration'),
key: 'duration',
minWidth: 100,
maxWidth: 150,
Expand Down Expand Up @@ -185,22 +183,25 @@ export default function Page() {
onFinish={handleFinish}
initialValues={{ rangeEndTime }}
>
<Form.Item name="rangeEndTime" label="Range End Time">
<Form.Item
name="rangeEndTime"
label={t('conprof.list.toolbar.range_end')}
>
<DatePicker showTime />
</Form.Item>
<Form.Item label="Range Duration">
<Form.Item label={t('conprof.list.toolbar.range_duration')}>
<span>-2h</span>
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit" loading={listLoading}>
Query
{t('conprof.list.toolbar.query')}
</Button>
</Form.Item>
</Form>
</Space>
<Space>
<Tooltip
title={t('continuous_profiling.list.toolbar.refresh')}
title={t('conprof.list.toolbar.refresh')}
placement="bottom"
>
{listLoading ? (
Expand All @@ -210,7 +211,7 @@ export default function Page() {
)}
</Tooltip>
<Tooltip
title={t('continuous_profiling.list.toolbar.settings')}
title={t('conprof.list.toolbar.settings')}
placement="bottom"
>
<SettingOutlined onClick={() => setShowSettings(true)} />
Expand All @@ -222,7 +223,7 @@ export default function Page() {
{conprofIsDisabled && historyTable && historyTable.length > 0 && (
<div className={styles.alert_container}>
<Alert
message={t('continuous_profiling.settings.disabled_with_history')}
message={t('conprof.settings.disabled_with_history')}
type="info"
showIcon
/>
Expand All @@ -231,13 +232,11 @@ export default function Page() {

{conprofIsDisabled && historyTable?.length === 0 ? (
<Result
title={t('continuous_profiling.settings.disabled_result.title')}
subTitle={t(
'continuous_profiling.settings.disabled_result.sub_title'
)}
title={t('conprof.settings.disabled_result.title')}
subTitle={t('conprof.settings.disabled_result.sub_title')}
extra={
<Button type="primary" onClick={() => setShowSettings(true)}>
{t('continuous_profiling.settings.open_settings')}
{t('conprof.settings.open_settings')}
</Button>
}
/>
Expand All @@ -257,7 +256,7 @@ export default function Page() {
)}

<Drawer
title={t('continuous_profiling.settings.title')}
title={t('conprof.settings.title')}
width={300}
closable={true}
visible={showSettings}
Expand Down
5 changes: 4 additions & 1 deletion ui/lib/apps/ContinuousProfiling/translations/en.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
continuous_profiling:
conprof:
nav_title: Continuous Profiling
list:
toolbar:
refresh: Refresh
settings: Settings
range_end: Range End Time
range_duration: Range Duration
query: Query
control_form:
title: Start Profiling Instances
enable_tooltip: This feature is enabled, you can disable it in the settings
Expand Down
5 changes: 4 additions & 1 deletion ui/lib/apps/ContinuousProfiling/translations/zh.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
continuous_profiling:
conprof:
nav_title: 持续分析
toolbar:
refresh: Refresh
list:
toolbar:
refresh: 刷新
settings: 设置
range_end: 区间结束时间
range_duration: 区间长度
query: 查询
control_form:
title: 开始性能分析
enable_tooltip: 该功能已开启,你可以在设置中关闭
Expand Down