Browse Source

[Feature-7785][UI Next] Rectify the issue about missing type in the feature of task group option. (#8083)

* prettier the codes

* fix a little issue
3.0.0/version-upgrade
calvin 3 years ago committed by GitHub
parent
commit
8c188e809b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1986
      dolphinscheduler-ui-next/pnpm-lock.yaml
  2. 3
      dolphinscheduler-ui-next/src/service/modules/task-group/types.ts
  3. 22
      dolphinscheduler-ui-next/src/views/resource/taskGroupOption/components/form-modal.tsx
  4. 3
      dolphinscheduler-ui-next/src/views/resource/taskGroupOption/use-form.ts
  5. 23
      dolphinscheduler-ui-next/src/views/resource/taskGroupOption/use-table.ts
  6. 4
      dolphinscheduler-ui-next/src/views/resource/udf/resource/index.module.scss

1986
dolphinscheduler-ui-next/pnpm-lock.yaml

File diff suppressed because it is too large Load Diff

3
dolphinscheduler-ui-next/src/service/modules/task-group/types.ts

@ -27,8 +27,9 @@ interface TaskGroupIdReq {
interface TaskGroupReq { interface TaskGroupReq {
name: string name: string
projectCode: string projectCode: number
groupSize: number groupSize: number
status: number
description: string description: string
} }

22
dolphinscheduler-ui-next/src/views/resource/taskGroupOption/components/form-modal.tsx

@ -15,12 +15,21 @@
* limitations under the License. * limitations under the License.
*/ */
import { defineComponent, PropType, toRefs, onMounted, ref, toRaw } from 'vue' import {
defineComponent,
PropType,
toRefs,
onMounted,
ref,
toRaw,
Ref
} from 'vue'
import { NForm, NFormItem, NInput, NSelect } from 'naive-ui' import { NForm, NFormItem, NInput, NSelect } from 'naive-ui'
import { useForm } from '../use-form' import { useForm } from '../use-form'
import Modal from '@/components/modal' import Modal from '@/components/modal'
import { createTaskGroup, updateTaskGroup } from '@/service/modules/task-group' import { createTaskGroup, updateTaskGroup } from '@/service/modules/task-group'
import { queryAllProjectList } from '@/service/modules/projects' import { queryAllProjectList } from '@/service/modules/projects'
import { SelectMixedOption } from 'naive-ui/lib/select/src/interface'
const props = { const props = {
show: { show: {
@ -42,12 +51,13 @@ const FormModal = defineComponent({
emits: ['confirm', 'cancel'], emits: ['confirm', 'cancel'],
setup(props, { emit }) { setup(props, { emit }) {
const { state, t } = useForm() const { state, t } = useForm()
const projectOptions = ref([]) const projectOptions: Ref<Array<SelectMixedOption>> = ref([])
onMounted(() => { onMounted(() => {
queryAllProjectList().then((res: any) => { queryAllProjectList().then((res: any[]) => {
res.map((item) => { res.map((item) => {
projectOptions.value.push({ label: item.name, value: item.code }) let option: SelectMixedOption = { label: item.name, value: item.code }
projectOptions.value.push(option)
}) })
}) })
if (props.status === 1) { if (props.status === 1) {
@ -110,7 +120,7 @@ const FormModal = defineComponent({
> >
<NSelect <NSelect
options={projectOptions} options={projectOptions}
v-model={[this.formData.projectCode, 'value']} v-model:value={this.formData.projectCode}
placeholder={t( placeholder={t(
'resource.task_group_option.please_select_project' 'resource.task_group_option.please_select_project'
)} )}
@ -121,7 +131,7 @@ const FormModal = defineComponent({
path='groupSize' path='groupSize'
> >
<NInput <NInput
v-model={[this.formData.groupSize, 'value']} v-model:value={this.formData.groupSize}
placeholder={t( placeholder={t(
'resource.task_group_option.please_enter_resource_pool_size' 'resource.task_group_option.please_enter_resource_pool_size'
)} )}

3
dolphinscheduler-ui-next/src/views/resource/taskGroupOption/use-form.ts

@ -18,6 +18,7 @@
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { reactive, ref } from 'vue' import { reactive, ref } from 'vue'
import type { FormRules } from 'naive-ui' import type { FormRules } from 'naive-ui'
import type { TaskGroupUpdateReq } from '@/service/modules/task-group/types'
export function useForm() { export function useForm() {
const { t } = useI18n() const { t } = useI18n()
@ -31,7 +32,7 @@ export function useForm() {
groupSize: 0, groupSize: 0,
status: 1, status: 1,
description: '' description: ''
}, } as TaskGroupUpdateReq,
rules: { rules: {
name: { name: {
required: true, required: true,

23
dolphinscheduler-ui-next/src/views/resource/taskGroupOption/use-table.ts

@ -15,9 +15,9 @@
* limitations under the License. * limitations under the License.
*/ */
import { useAsyncState, useAsyncQueue } from '@vueuse/core'
import { h, reactive, ref } from 'vue' import { h, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useAsyncState } from '@vueuse/core'
import { format } from 'date-fns' import { format } from 'date-fns'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import type { Router } from 'vue-router' import type { Router } from 'vue-router'
@ -92,14 +92,14 @@ export function useTable(
}) })
const getTableData = (params: any) => { const getTableData = (params: any) => {
const { state } = useAsyncState( Promise.all([queryTaskGroupListPaging(params), queryAllProjectList()]).then(
Promise.all([ (values: any[]) => {
queryTaskGroupListPaging(params),
queryAllProjectList()
]).then((values) => {
variables.totalPage = values[0].totalPage variables.totalPage = values[0].totalPage
variables.tableData = values[0].totalList.map((item, index) => { variables.tableData = values[0].totalList.map(
item.projectName = _.find(values[1], { code: item.projectCode }).name (item: any, index: number) => {
item.projectName = _.find(values[1], {
code: item.projectCode
}).name
item.createTime = format( item.createTime = format(
new Date(item.createTime), new Date(item.createTime),
'yyyy-MM-dd HH:mm:ss' 'yyyy-MM-dd HH:mm:ss'
@ -112,11 +112,10 @@ export function useTable(
index: index + 1, index: index + 1,
...item ...item
} }
}) as any }
}), )
{} }
) )
return state
} }
return { getTableData, variables, columns } return { getTableData, variables, columns }

4
dolphinscheduler-ui-next/src/views/resource/udf/resource/index.module.scss

@ -43,7 +43,8 @@
tr { tr {
height: 40px; height: 40px;
font-size: 12px; font-size: 12px;
th,td{ th,
td {
&:nth-child(1) { &:nth-child(1) {
width: 50px; width: 50px;
text-align: center; text-align: center;
@ -78,4 +79,3 @@
} }
} }
} }

Loading…
Cancel
Save