czy006 commented on code in PR #3216:
URL: https://github.com/apache/amoro/pull/3216#discussion_r1772703676
##########
amoro-web/src/views/resource/index.vue:
##########
@@ -92,6 +98,17 @@ export default defineComponent({
state.showGroupModal = true
}
+ const createOptimizer = (editRecord: any | null) => {
+ console.log('createOptimizer function called') // 添加日志
Review Comment:
can be remove console
##########
amoro-web/src/views/resource/components/CreateOptimizerModal.vue:
##########
@@ -0,0 +1,127 @@
+
+<!--
+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.
+/-->
+
+<script lang="ts" setup>
+import { onMounted, reactive, ref } from 'vue'
+import { Modal as AModal } from 'ant-design-vue'
+import { usePlaceholder } from '@/hooks/usePlaceholder'
+import { createOptimizerResource, getOptimizerGroups } from
'@/services/optimize.service'
+
+interface FormState {
+ resourceGroup: string
+ parallelism: number
+}
+
+const emit = defineEmits<{ (e: 'cancel'): void; (e: 'refresh'): void }>()
+
+const confirmLoading = ref<boolean>(false)
+const placeholder = reactive(usePlaceholder())
+const formRef = ref()
+const formState: FormState = reactive({
+ resourceGroup: '',
+ parallelism: 1,
+})
+
+const resourceGroupOptions = ref<{ label: string, value: string }[]>([])
+
+async function loadResourceGroups() {
+ try {
+ const response = await getOptimizerGroups()
+ resourceGroupOptions.value = response.map((group: any) => ({
+ label: group.optimizerGroupName,
+ value: group.optimizerGroupName,
+ }))
+ console.log('Parsed resourceGroupOptions:', resourceGroupOptions.value)
+ } catch (error) {
+ console.error('Failed to load resource groups:', error)
+ }
+}
+
+function handleOk() {
+ formRef.value
+ .validateFields()
+ .then(async () => {
+ confirmLoading.value = true
+ await createOptimizerResource({
+ optimizerGroup: formState.resourceGroup || '',
+ parallelism: Number(formState.parallelism),
+ })
+ formRef.value.resetFields()
+ emit('cancel')
+ emit('refresh')
+ confirmLoading.value = false
+ })
+ .catch(() => {
+ confirmLoading.value = false
+ })
+}
+
+function handleCancel() {
+ formRef.value.resetFields()
+ emit('cancel')
+}
+
+onMounted(() => {
+ console.log('Component mounted') // 添加日志
Review Comment:
can be remove console
--
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]