sketchmind commented on code in PR #11203:
URL: https://github.com/apache/dolphinscheduler/pull/11203#discussion_r955017614
##########
dolphinscheduler-ui/src/views/resource/components/resource/upload/use-form.ts:
##########
@@ -18,13 +18,17 @@
import { reactive, ref, unref } from 'vue'
import { useI18n } from 'vue-i18n'
import type { FormRules } from 'naive-ui'
+import { ResourceType } from "@/views/resource/components/resource/types";
const defaultValue = () => ({
+ id: -1,
name: '',
file: '',
description: '',
+ type: undefined as unknown as ResourceType,
pid: -1,
- currentDir: '/'
+ currentDir: '/',
+ isReupload: false
})
Review Comment:
> It is better to define an interface for the defaultValue.
resolved
##########
dolphinscheduler-ui/src/views/resource/components/resource/table/use-table.ts:
##########
@@ -0,0 +1,230 @@
+/*
+ * 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.
+ */
+
+import { h, reactive, ref } from 'vue'
+import { useI18n } from 'vue-i18n'
+import type { Router } from 'vue-router'
+import { useRouter } from 'vue-router'
+import { bytesToSize } from '@/common/common'
+import { useFileStore } from '@/store/file/file'
+import TableAction from './table-action'
+import { IUpdateResouseInfo, ResourceType } from '../types'
+import ButtonLink from '@/components/button-link'
+import { NEllipsis } from 'naive-ui'
+import { calculateTableWidth, COLUMN_WIDTH_CONFIG, DefaultTableWidth } from
'@/common/column-width-config'
+import type { TableColumns } from 'naive-ui/es/data-table/src/interface'
+import { useFileState } from "@/views/resource/components/resource/use-file";
+
+
+const goSubFolder = (router: Router, item: any) => {
+ const fileStore = useFileStore()
+ fileStore.setFileInfo(`${item.alias}|${item.size}`)
+
+ if (item.directory) {
+ fileStore.setCurrentDir(`${item.fullName}`)
+ router.push({
+ name: item.type === 'UDF' ? 'resource-sub-manage' :
'resource-file-subdirectory',
+ params: { id: item.id }
+ })
+ } else if (item.type === 'FILE') {
+ router.push({ name: 'resource-file-list', params: { id: item.id } })
+ }
+}
+
+
+export function useTable() {
+ const { t } = useI18n()
+ const router: Router = useRouter()
+
+ const fileId = ref(Number(router.currentRoute.value.params.id) || -1)
+ const resourceTypeRef = ref<ResourceType>()
+ const resourceListRef = ref()
+ const folderShowRef = ref(false)
+ const uploadShowRef = ref(false)
+ const isReuploadRef = ref(false)
+ const renameShowRef = ref(false)
+ const searchRef = ref()
+ const breadListRef = ref<Array<string>>(
+ [resourceTypeRef.value === 'UDF'
+ ? t('resource.udf.udf_resources')
+ : t('resource.file.file_manage')]
+ )
Review Comment:
resolved
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]