Browse Source

[Refactor][UI] Refactor project workflow definition using NSpace component. (#11398)

3.1.0-release
songjianet 2 years ago committed by GitHub
parent
commit
f76520c07e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 73
      dolphinscheduler-ui/src/views/projects/workflow/definition/index.tsx

73
dolphinscheduler-ui/src/views/projects/workflow/definition/index.tsx

@ -15,7 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
import Card from '@/components/card'
import { SearchOutlined } from '@vicons/antd' import { SearchOutlined } from '@vicons/antd'
import { import {
NButton, NButton,
@ -30,14 +29,14 @@ import {
import { defineComponent, getCurrentInstance, onMounted, toRefs, watch } from 'vue' import { defineComponent, getCurrentInstance, onMounted, toRefs, watch } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useTable } from './use-table' import { useTable } from './use-table'
import { useRouter, useRoute } from 'vue-router'
import Card from '@/components/card'
import ImportModal from './components/import-modal' import ImportModal from './components/import-modal'
import StartModal from './components/start-modal' import StartModal from './components/start-modal'
import TimingModal from './components/timing-modal' import TimingModal from './components/timing-modal'
import VersionModal from './components/version-modal' import VersionModal from './components/version-modal'
import CopyModal from './components/copy-modal' import CopyModal from './components/copy-modal'
import { useRouter, useRoute } from 'vue-router'
import type { Router } from 'vue-router' import type { Router } from 'vue-router'
import styles from './index.module.scss'
export default defineComponent({ export default defineComponent({
name: 'WorkflowDefinitionList', name: 'WorkflowDefinitionList',
@ -117,66 +116,51 @@ export default defineComponent({
const { loadingRef } = this const { loadingRef } = this
return ( return (
<div class={styles.content}> <NSpace vertical>
<Card class={styles.card}> <Card>
<div class={styles.header}> <NSpace justify='space-between'>
<NSpace> <NSpace>
<NButton <NButton
type='primary' type='primary'
size='small'
onClick={this.createDefinition} onClick={this.createDefinition}
class='btn-create-process' class='btn-create-process'
> >
{t('project.workflow.create_workflow')} {t('project.workflow.create_workflow')}
</NButton> </NButton>
<NButton strong secondary onClick={() => (this.showRef = true)}> <NButton strong secondary size='small' onClick={() => (this.showRef = true)}>
{t('project.workflow.import_workflow')} {t('project.workflow.import_workflow')}
</NButton> </NButton>
</NSpace> </NSpace>
<div class={styles.right}> <NSpace>
<div class={styles.search}>
<div class={styles.list}>
<NButton type='primary' onClick={this.handleSearch}>
<NIcon>
<SearchOutlined />
</NIcon>
</NButton>
</div>
<div class={styles.list}>
<NInput <NInput
allowInput={this.trim} allowInput={this.trim}
size='small'
placeholder={t('resource.function.enter_keyword_tips')} placeholder={t('resource.function.enter_keyword_tips')}
v-model={[this.searchVal, 'value']} v-model={[this.searchVal, 'value']}
/> />
</div> <NButton type='primary' size='small' onClick={this.handleSearch}>
</div> <NIcon>
</div> <SearchOutlined />
</div> </NIcon>
</NButton>
</NSpace>
</NSpace>
</Card> </Card>
<Card title={t('project.workflow.workflow_definition')}> <Card title={t('project.workflow.workflow_definition')}>
<NSpace vertical>
<NDataTable <NDataTable
loading={loadingRef} loading={loadingRef}
rowKey={(row) => row.code} rowKey={(row) => row.code}
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
striped striped
class={styles.table}
v-model:checked-row-keys={this.checkedRowKeys} v-model:checked-row-keys={this.checkedRowKeys}
row-class-name='items' row-class-name='items'
scrollX={this.tableWidth} scrollX={this.tableWidth}
/> />
<div class={styles.pagination}> <NSpace justify='space-between'>
<NPagination <NSpace>
v-model:page={this.page}
v-model:page-size={this.pageSize}
page-count={this.totalPage}
show-size-picker
page-sizes={[10, 30, 50]}
show-quick-jumper
onUpdatePage={this.requestData}
onUpdatePageSize={this.handleChangePageSize}
/>
</div>
<div class={styles['batch-button']}>
<NTooltip> <NTooltip>
{{ {{
default: () => t('project.workflow.delete'), default: () => t('project.workflow.delete'),
@ -187,6 +171,7 @@ export default defineComponent({
trigger: () => ( trigger: () => (
<NButton <NButton
tag='div' tag='div'
size='small'
type='primary' type='primary'
disabled={this.checkedRowKeys.length <= 0} disabled={this.checkedRowKeys.length <= 0}
class='btn-delete-all' class='btn-delete-all'
@ -205,6 +190,7 @@ export default defineComponent({
trigger: () => ( trigger: () => (
<NButton <NButton
tag='div' tag='div'
size='small'
type='primary' type='primary'
disabled={this.checkedRowKeys.length <= 0} disabled={this.checkedRowKeys.length <= 0}
onClick={this.batchExportWorkflow} onClick={this.batchExportWorkflow}
@ -221,6 +207,7 @@ export default defineComponent({
trigger: () => ( trigger: () => (
<NButton <NButton
tag='div' tag='div'
size='small'
type='primary' type='primary'
disabled={this.checkedRowKeys.length <= 0} disabled={this.checkedRowKeys.length <= 0}
onClick={() => (this.copyShowRef = true)} onClick={() => (this.copyShowRef = true)}
@ -231,7 +218,19 @@ export default defineComponent({
) )
}} }}
</NTooltip> </NTooltip>
</div> </NSpace>
<NPagination
v-model:page={this.page}
v-model:page-size={this.pageSize}
page-count={this.totalPage}
show-size-picker
page-sizes={[10, 30, 50]}
show-quick-jumper
onUpdatePage={this.requestData}
onUpdatePageSize={this.handleChangePageSize}
/>
</NSpace>
</NSpace>
</Card> </Card>
<ImportModal <ImportModal
v-model:show={this.showRef} v-model:show={this.showRef}
@ -257,7 +256,7 @@ export default defineComponent({
v-model:show={this.copyShowRef} v-model:show={this.copyShowRef}
onUpdateList={this.handleCopyUpdateList} onUpdateList={this.handleCopyUpdateList}
/> />
</div> </NSpace>
) )
} }
}) })

Loading…
Cancel
Save