Browse Source

[Refactor][UI] Refactor workflow instance using NSpace component. (#11446)

* [Refactor][UI] Refactor workflow instance using NSpace component.

* [Refactor][UI] Refactor workflow instance using NSpace component.
3.1.0-release
songjianet 2 years ago committed by GitHub
parent
commit
32361f4fef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 88
      dolphinscheduler-ui/src/views/projects/workflow/instance/components/process-instance-condition.tsx
  2. 80
      dolphinscheduler-ui/src/views/projects/workflow/instance/index.module.scss
  3. 65
      dolphinscheduler-ui/src/views/projects/workflow/instance/index.tsx

88
dolphinscheduler-ui/src/views/projects/workflow/instance/components/process-instance-condition.tsx

@ -17,13 +17,12 @@
import { SearchOutlined } from '@vicons/antd' import { SearchOutlined } from '@vicons/antd'
import { import {
NGrid,
NGridItem,
NInput, NInput,
NButton, NButton,
NDatePicker, NDatePicker,
NSelect, NSelect,
NIcon NIcon,
NSpace
} from 'naive-ui' } from 'naive-ui'
import { defineComponent, getCurrentInstance, ref } from 'vue' import { defineComponent, getCurrentInstance, ref } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
@ -79,51 +78,46 @@ export default defineComponent({
render() { render() {
const { t } = useI18n() const { t } = useI18n()
const options = stateType(t) const options = stateType(t)
return ( return (
<NGrid xGap={6} cols={24}> <NSpace justify='end'>
<NGridItem offset={5} span={3}> <NInput
<NInput allowInput={this.trim}
allowInput={this.trim} size='small'
v-model:value={this.searchValRef} v-model:value={this.searchValRef}
placeholder={t('project.workflow.name')} placeholder={t('project.workflow.name')}
/> />
</NGridItem> <NInput
<NGridItem span={3}> allowInput={this.trim}
<NInput size='small'
allowInput={this.trim} v-model:value={this.executorNameRef}
v-model:value={this.executorNameRef} placeholder={t('project.workflow.executor')}
placeholder={t('project.workflow.executor')} />
/> <NInput
</NGridItem> allowInput={this.trim}
<NGridItem span={3}> size='small'
<NInput v-model:value={this.hostRef}
allowInput={this.trim} placeholder={t('project.workflow.host')}
v-model:value={this.hostRef} />
placeholder={t('project.workflow.host')} <NSelect
/> options={options}
</NGridItem> size='small'
<NGridItem span={3}> style={{width: '210px'}}
<NSelect defaultValue={''}
options={options} v-model:value={this.stateTypeRef}
defaultValue={''} />
v-model:value={this.stateTypeRef} <NDatePicker
/> type='datetimerange'
</NGridItem> size='small'
<NGridItem span={6}> clearable
<NDatePicker v-model:value={this.startEndTimeRef}
type='datetimerange' />
clearable <NButton type='primary' size='small' onClick={this.handleSearch}>
v-model:value={this.startEndTimeRef} <NIcon>
/> <SearchOutlined />
</NGridItem> </NIcon>
<NGridItem span={1}> </NButton>
<NButton type='primary' onClick={this.handleSearch}> </NSpace>
<NIcon>
<SearchOutlined />
</NIcon>
</NButton>
</NGridItem>
</NGrid>
) )
} }
}) })

80
dolphinscheduler-ui/src/views/projects/workflow/instance/index.module.scss

@ -1,80 +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.
*/
.content {
width: 100%;
.card {
margin-bottom: 8px;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin: 10px 0;
.right {
> .search {
.list {
float: right;
margin: 3px 0 3px 4px;
}
}
}
}
}
.table {
table {
width: 100%;
tr {
height: 40px;
font-size: 12px;
th,
td {
&:nth-child(1) {
width: 50px;
text-align: center;
}
}
th {
&:nth-child(1) {
width: 60px;
text-align: center;
}
> span {
font-size: 12px;
color: #555;
}
}
}
}
}
.pagination {
display: flex;
justify-content: center;
align-items: center;
margin-top: 20px;
}
.startup {
align-items: center;
> div:first-child {
width: 86%;
}
}

65
dolphinscheduler-ui/src/views/projects/workflow/instance/index.tsx

@ -17,18 +17,18 @@
import { defineComponent, onMounted, onUnmounted, toRefs, watch } from 'vue' import { defineComponent, onMounted, onUnmounted, toRefs, watch } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import Card from '@/components/card'
import { import {
NButton, NButton,
NDataTable, NDataTable,
NPagination, NPagination,
NPopconfirm, NPopconfirm,
NTooltip NTooltip,
NSpace
} from 'naive-ui' } from 'naive-ui'
import { useTable } from './use-table' import { useTable } from './use-table'
import Card from '@/components/card'
import ProcessInstanceCondition from './components/process-instance-condition' import ProcessInstanceCondition from './components/process-instance-condition'
import { IWorkflowInstanceSearch } from './types' import type { IWorkflowInstanceSearch } from './types'
import styles from './index.module.scss'
export default defineComponent({ export default defineComponent({
name: 'WorkflowInstanceList', name: 'WorkflowInstanceList',
@ -92,37 +92,36 @@ 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}> <ProcessInstanceCondition onHandleSearch={this.handleSearch} />
<ProcessInstanceCondition onHandleSearch={this.handleSearch} />
</div>
</Card> </Card>
<Card title={t('project.workflow.workflow_instance')}> <Card title={t('project.workflow.workflow_instance')}>
<NDataTable <NSpace vertical>
loading={loadingRef} <NDataTable
rowKey={(row) => row.id} loading={loadingRef}
columns={this.columns} rowKey={(row) => row.id}
data={this.tableData} columns={this.columns}
striped data={this.tableData}
size={'small'} striped
class={styles.table} size={'small'}
scrollX={this.tableWidth} scrollX={this.tableWidth}
v-model:checked-row-keys={this.checkedRowKeys} v-model:checked-row-keys={this.checkedRowKeys}
row-class-name='items-workflow-instances' row-class-name='items-workflow-instances'
/>
<div class={styles.pagination}>
<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}
/> />
</div> <NSpace justify='center'>
<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>
<NTooltip> <NTooltip>
{{ {{
default: () => t('project.workflow.delete'), default: () => t('project.workflow.delete'),
@ -145,7 +144,7 @@ export default defineComponent({
}} }}
</NTooltip> </NTooltip>
</Card> </Card>
</div> </NSpace>
) )
} }
}) })

Loading…
Cancel
Save