Browse Source

[Refactor][UI] Refactor task group option using NSpace component. (#11209)

3.1.0-release
songjianet 2 years ago committed by GitHub
parent
commit
163df5f1a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 55
      dolphinscheduler-ui/src/views/resource/task-group/option/index.module.scss
  2. 52
      dolphinscheduler-ui/src/views/resource/task-group/option/index.tsx

55
dolphinscheduler-ui/src/views/resource/task-group/option/index.module.scss

@ -1,55 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.toolbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 0 0 0;
.left {
align-items: center;
}
.right {
display: flex;
justify-content: space-between;
align-items: center;
button {
margin-left: 10px;
}
}
}
.table-card {
margin-top: 2px;
.table-action {
display: flex;
justify-content: center;
align-items: center;
button {
margin: 0 2px 0 0;
}
div {
margin: 0 2px 0 0;
}
}
.pagination {
margin-top: 20px;
display: flex;
justify-content: center;
}
}

52
dolphinscheduler-ui/src/views/resource/task-group/option/index.tsx

@ -20,14 +20,13 @@ import {
NButton, NButton,
NIcon, NIcon,
NInput, NInput,
NCard,
NDataTable, NDataTable,
NPagination NPagination,
NSpace
} from 'naive-ui' } from 'naive-ui'
import Card from '@/components/card' import Card from '@/components/card'
import { SearchOutlined } from '@vicons/antd' import { SearchOutlined } from '@vicons/antd'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import styles from './index.module.scss'
import { useTable } from './use-table' import { useTable } from './use-table'
import FormModal from './components/form-modal' import FormModal from './components/form-modal'
@ -146,21 +145,19 @@ const taskGroupOption = defineComponent({
const { columns } = useTable(updateItem, resetTableData) const { columns } = useTable(updateItem, resetTableData)
return ( return (
<div> <NSpace vertical>
<NCard> <Card>
<div class={styles.toolbar}> <NSpace justify='space-between'>
<div class={styles.left}> <NButton
<NButton size='small'
size='small' type={'primary'}
type={'primary'} onClick={() => this.onCreate()}
onClick={() => this.onCreate()} >
> {t('resource.task_group_option.create')}
{t('resource.task_group_option.create')} </NButton>
</NButton> <NSpace>
</div>
<div class={styles.right}>
<NInput <NInput
allowInput={this.trim} allowInput={this.trim}
size='small' size='small'
v-model={[this.name, 'value']} v-model={[this.name, 'value']}
placeholder={t( placeholder={t(
@ -172,14 +169,11 @@ const taskGroupOption = defineComponent({
<SearchOutlined /> <SearchOutlined />
</NIcon> </NIcon>
</NButton> </NButton>
</div> </NSpace>
</div> </NSpace>
</NCard> </Card>
<Card <Card title={t('resource.task_group_option.option')}>
class={styles['table-card']} <NSpace vertical>
title={t('resource.task_group_option.option')}
>
<div>
<NDataTable <NDataTable
loading={loadingRef} loading={loadingRef}
columns={columns} columns={columns}
@ -188,7 +182,7 @@ const taskGroupOption = defineComponent({
striped striped
scrollX={this.tableWidth} scrollX={this.tableWidth}
/> />
<div class={styles.pagination}> <NSpace justify='center'>
<NPagination <NPagination
v-model:page={this.page} v-model:page={this.page}
v-model:page-size={this.pageSize} v-model:page-size={this.pageSize}
@ -199,8 +193,8 @@ const taskGroupOption = defineComponent({
onUpdatePage={resetTableData} onUpdatePage={resetTableData}
onUpdatePageSize={onUpdatePageSize} onUpdatePageSize={onUpdatePageSize}
/> />
</div> </NSpace>
</div> </NSpace>
</Card> </Card>
{showModalRef && ( {showModalRef && (
<FormModal <FormModal
@ -211,7 +205,7 @@ const taskGroupOption = defineComponent({
status={modelStatusRef} status={modelStatusRef}
/> />
)} )}
</div> </NSpace>
) )
} }
}) })

Loading…
Cancel
Save