You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "WuChuSheng1 (via GitHub)" <gi...@apache.org> on 2023/09/10 10:38:29 UTC

[GitHub] [skywalking-banyandb] WuChuSheng1 opened a new pull request, #328: Add Property CRUD Function

WuChuSheng1 opened a new pull request, #328:
URL: https://github.com/apache/skywalking-banyandb/pull/328

   ### <Add Property CRUD Function>
   - [Add Property CRUD Function]
   ![image](https://github.com/apache/skywalking-banyandb/assets/107111186/5d7973de-6f95-419c-a29a-e67674587cd1)
   ![image](https://github.com/apache/skywalking-banyandb/assets/107111186/0c840ba0-1bca-4ce8-89e1-753e9b1a86a2)
   ![image](https://github.com/apache/skywalking-banyandb/assets/107111186/24d75548-7c2b-4d37-a245-a52fbbbb1263)
   


-- 
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: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking-banyandb] codecov-commenter commented on pull request #328: Add Property CRUD Function

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #328:
URL: https://github.com/apache/skywalking-banyandb/pull/328#issuecomment-1712780885

   ## [Codecov](https://app.codecov.io/gh/apache/skywalking-banyandb/pull/328?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   > Merging [#328](https://app.codecov.io/gh/apache/skywalking-banyandb/pull/328?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (de9bc4b) into [main](https://app.codecov.io/gh/apache/skywalking-banyandb/commit/eecd29e71bc07d07f22aea1496d80dc76a2b2f90?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (eecd29e) will **decrease** coverage by `0.02%`.
   > The diff coverage is `n/a`.
   
   ```diff
   @@            Coverage Diff             @@
   ##             main     #328      +/-   ##
   ==========================================
   - Coverage   41.04%   41.02%   -0.02%     
   ==========================================
     Files         108      108              
     Lines       11438    11438              
   ==========================================
   - Hits         4695     4693       -2     
   - Misses       6273     6275       +2     
     Partials      470      470              
   ```
   
   
   [see 1 file with indirect coverage changes](https://app.codecov.io/gh/apache/skywalking-banyandb/pull/328/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   


-- 
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: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking-banyandb] hanahmily merged pull request #328: Add Property CRUD Function

Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily merged PR #328:
URL: https://github.com/apache/skywalking-banyandb/pull/328


-- 
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: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking-banyandb] hanahmily commented on a diff in pull request #328: Add Property CRUD Function

Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily commented on code in PR #328:
URL: https://github.com/apache/skywalking-banyandb/pull/328#discussion_r1320893057


##########
ui/src/components/Property/PropertyEditror.vue:
##########
@@ -0,0 +1,211 @@
+<script setup>
+import { applyProperty } from '@/api';
+import { reactive, ref } from 'vue';
+import { getCurrentInstance } from '@vue/runtime-core'
+import TagEditor from './TagEditor.vue';
+import { ElMessage } from 'element-plus';
+const $loadingCreate = getCurrentInstance().appContext.config.globalProperties.$loadingCreate
+const $loadingClose = getCurrentInstance().appContext.config.globalProperties.$loadingClose
+const showDialog = ref(false)
+const title = ref('')
+const tagEditorRef = ref()
+const ruleForm = ref()
+const formData = reactive({
+    strategy: 'STRATEGY_UNSPECIFIED',
+    group: '',
+    name: '',
+    containerID: 0,
+    modRevision: 0,
+    createRevision: 0,
+    id: '',
+    tags: []
+})
+const validateTags = (rule, value, callback) => {
+    if (value.length <= 0) {
+        callback(new Error('Please add the tags'))
+    } else {
+        callback()
+    }
+}
+const rules = {
+    strategy: [{ required: true, message: 'please select the apply method.', trigger: 'blur' }],
+    group: [{ required: true, message: 'Please enter the group.', trigger: 'blur' }],
+    name: [{ required: true, message: 'Please enter the name.', trigger: 'blur' }],
+    containerID: [{ required: true, message: 'Please enter the container id.', trigger: 'blur' }],
+    modRevision: [{ required: true, message: 'Please enter the container Mod Revision.', trigger: 'blur' }],
+    createRevision: [{ required: true, message: 'Please enter the container Create Revision.', trigger: 'blur' }],
+    id: [{ required: true, message: 'Please enter the ID.', trigger: 'blur' }],
+    tags: [{ required: true, validator: validateTags, trigger: 'blur' }],
+}
+const strategyGroup = [
+    { label: 'STRATEGY_UNSPECIFIED', value: 'STRATEGY_UNSPECIFIED' },
+    { label: 'STRATEGY_MERGE', value: 'STRATEGY_MERGE' },
+    { label: 'STRATEGY_REPLACE', value: 'STRATEGY_REPLACE' }
+]
+const formConfig = [
+    { label: 'Strategy', prop: 'strategy', type: 'select', selectGroup: strategyGroup },
+    { label: 'Container Group', prop: 'group', type: 'input', disabled: true },
+    { label: 'Container Name', prop: 'name', type: 'input' },
+    { label: 'Container ID', prop: 'containerID', type: 'number' },
+    { label: 'Container ModRevision', prop: 'modRevision', type: 'number' },
+    { label: 'Container CreateRevision', prop: 'createRevision', type: 'number' },
+    { label: 'ID', prop: 'id', type: 'input' },
+]
+let promiseResolve
+
+const initData = () => {
+    formData.strategy = 'STRATEGY_UNSPECIFIED'
+    formData.group = ''
+    formData.name = ''
+    formData.containerID = 0

Review Comment:
   ```suggestion
       formData.containerID = ''
   ```



##########
ui/src/components/Property/TagEditor.vue:
##########
@@ -0,0 +1,76 @@
+<script setup>

Review Comment:
   Added files should contain the license header



##########
ui/src/components/Property/PropertyEditror.vue:
##########
@@ -0,0 +1,211 @@
+<script setup>

Review Comment:
   Added files should contain the license header



##########
ui/src/components/Property/PropertyEditror.vue:
##########
@@ -0,0 +1,211 @@
+<script setup>
+import { applyProperty } from '@/api';
+import { reactive, ref } from 'vue';
+import { getCurrentInstance } from '@vue/runtime-core'
+import TagEditor from './TagEditor.vue';
+import { ElMessage } from 'element-plus';
+const $loadingCreate = getCurrentInstance().appContext.config.globalProperties.$loadingCreate
+const $loadingClose = getCurrentInstance().appContext.config.globalProperties.$loadingClose
+const showDialog = ref(false)
+const title = ref('')
+const tagEditorRef = ref()
+const ruleForm = ref()
+const formData = reactive({
+    strategy: 'STRATEGY_UNSPECIFIED',
+    group: '',
+    name: '',
+    containerID: 0,
+    modRevision: 0,
+    createRevision: 0,
+    id: '',
+    tags: []
+})
+const validateTags = (rule, value, callback) => {
+    if (value.length <= 0) {
+        callback(new Error('Please add the tags'))
+    } else {
+        callback()
+    }
+}
+const rules = {
+    strategy: [{ required: true, message: 'please select the apply method.', trigger: 'blur' }],
+    group: [{ required: true, message: 'Please enter the group.', trigger: 'blur' }],
+    name: [{ required: true, message: 'Please enter the name.', trigger: 'blur' }],
+    containerID: [{ required: true, message: 'Please enter the container id.', trigger: 'blur' }],
+    modRevision: [{ required: true, message: 'Please enter the container Mod Revision.', trigger: 'blur' }],
+    createRevision: [{ required: true, message: 'Please enter the container Create Revision.', trigger: 'blur' }],
+    id: [{ required: true, message: 'Please enter the ID.', trigger: 'blur' }],
+    tags: [{ required: true, validator: validateTags, trigger: 'blur' }],
+}
+const strategyGroup = [
+    { label: 'STRATEGY_UNSPECIFIED', value: 'STRATEGY_UNSPECIFIED' },
+    { label: 'STRATEGY_MERGE', value: 'STRATEGY_MERGE' },
+    { label: 'STRATEGY_REPLACE', value: 'STRATEGY_REPLACE' }
+]
+const formConfig = [
+    { label: 'Strategy', prop: 'strategy', type: 'select', selectGroup: strategyGroup },
+    { label: 'Container Group', prop: 'group', type: 'input', disabled: true },
+    { label: 'Container Name', prop: 'name', type: 'input' },
+    { label: 'Container ID', prop: 'containerID', type: 'number' },

Review Comment:
   ```suggestion
       { label: 'Container ID', prop: 'containerID', type: 'input' },
   ```



##########
ui/src/components/Property/PropertyEditror.vue:
##########
@@ -0,0 +1,211 @@
+<script setup>
+import { applyProperty } from '@/api';
+import { reactive, ref } from 'vue';
+import { getCurrentInstance } from '@vue/runtime-core'
+import TagEditor from './TagEditor.vue';
+import { ElMessage } from 'element-plus';
+const $loadingCreate = getCurrentInstance().appContext.config.globalProperties.$loadingCreate
+const $loadingClose = getCurrentInstance().appContext.config.globalProperties.$loadingClose
+const showDialog = ref(false)
+const title = ref('')
+const tagEditorRef = ref()
+const ruleForm = ref()
+const formData = reactive({
+    strategy: 'STRATEGY_UNSPECIFIED',
+    group: '',
+    name: '',
+    containerID: 0,

Review Comment:
   ```suggestion
       containerID: '',
   ```



##########
ui/src/components/Property/PropertyEditror.vue:
##########
@@ -0,0 +1,211 @@
+<script setup>
+import { applyProperty } from '@/api';
+import { reactive, ref } from 'vue';
+import { getCurrentInstance } from '@vue/runtime-core'
+import TagEditor from './TagEditor.vue';
+import { ElMessage } from 'element-plus';
+const $loadingCreate = getCurrentInstance().appContext.config.globalProperties.$loadingCreate
+const $loadingClose = getCurrentInstance().appContext.config.globalProperties.$loadingClose
+const showDialog = ref(false)
+const title = ref('')
+const tagEditorRef = ref()
+const ruleForm = ref()
+const formData = reactive({
+    strategy: 'STRATEGY_UNSPECIFIED',
+    group: '',
+    name: '',
+    containerID: 0,
+    modRevision: 0,
+    createRevision: 0,
+    id: '',
+    tags: []
+})
+const validateTags = (rule, value, callback) => {
+    if (value.length <= 0) {
+        callback(new Error('Please add the tags'))
+    } else {
+        callback()
+    }
+}
+const rules = {
+    strategy: [{ required: true, message: 'please select the apply method.', trigger: 'blur' }],
+    group: [{ required: true, message: 'Please enter the group.', trigger: 'blur' }],
+    name: [{ required: true, message: 'Please enter the name.', trigger: 'blur' }],
+    containerID: [{ required: true, message: 'Please enter the container id.', trigger: 'blur' }],
+    modRevision: [{ required: true, message: 'Please enter the container Mod Revision.', trigger: 'blur' }],
+    createRevision: [{ required: true, message: 'Please enter the container Create Revision.', trigger: 'blur' }],
+    id: [{ required: true, message: 'Please enter the ID.', trigger: 'blur' }],
+    tags: [{ required: true, validator: validateTags, trigger: 'blur' }],
+}
+const strategyGroup = [
+    { label: 'STRATEGY_UNSPECIFIED', value: 'STRATEGY_UNSPECIFIED' },
+    { label: 'STRATEGY_MERGE', value: 'STRATEGY_MERGE' },
+    { label: 'STRATEGY_REPLACE', value: 'STRATEGY_REPLACE' }
+]
+const formConfig = [
+    { label: 'Strategy', prop: 'strategy', type: 'select', selectGroup: strategyGroup },
+    { label: 'Container Group', prop: 'group', type: 'input', disabled: true },
+    { label: 'Container Name', prop: 'name', type: 'input' },
+    { label: 'Container ID', prop: 'containerID', type: 'number' },
+    { label: 'Container ModRevision', prop: 'modRevision', type: 'number' },
+    { label: 'Container CreateRevision', prop: 'createRevision', type: 'number' },
+    { label: 'ID', prop: 'id', type: 'input' },
+]
+let promiseResolve
+
+const initData = () => {
+    formData.strategy = 'STRATEGY_UNSPECIFIED'
+    formData.group = ''
+    formData.name = ''
+    formData.containerID = 0
+    formData.modRevision = 0
+    formData.createRevision = 0
+    formData.id = ''
+    formData.tags = []
+}
+const closeDialog = () => {
+    showDialog.value = false
+    initData()
+}
+const openEditTag = (index) => {
+    tagEditorRef.value.openDialog(formData.tags[index])
+        .then(res => {
+            formData.tags[index].key = res.key
+            formData.tags[index].value = res.value
+        })
+}
+const deleteTag = (index) => {
+    formData.tags.splice(index, 1)
+}
+const openAddTag = () => {
+    tagEditorRef.value.openDialog()
+        .then(res => {
+            formData.tags.push(res)
+        })
+}
+const confirmApply = async () => {
+    if (!ruleForm.value) return
+    await ruleForm.value.validate((valid) => {
+        if (valid) {
+            $loadingCreate()
+            const param = {
+                strategy: formData.strategy,
+                property: {
+                    metadata: {
+                        container: {
+                            createRevision: formData.createRevision,
+                            group: formData.group,
+                            id: formData.containerID,
+                            modRevision: formData.modRevision,
+                            name: formData.name
+                        },
+                        id: formData.id
+                    },
+                    tags: formData.tags.map(item => {
+                        return {
+                            key: item.key,
+                            value: JSON.parse(item.value)
+                        }
+                    })
+                }
+            }
+            applyProperty(formData.group, formData.name, formData.id, param)
+                .then(res => {
+                    if (res.status == 200) {
+                        ElMessage({
+                            message: 'successed',
+                            type: "success",
+                            duration: 5000
+                        })
+                        showDialog.value = false
+                        promiseResolve()
+                    }
+                })
+                .catch(err => {
+                    ElMessage({
+                        message: 'Please refresh and try again. Error: ' + err,
+                        type: "error",
+                        duration: 3000
+                    })
+                })
+                .finally(() => {
+                    $loadingClose()
+                })
+        }
+    })
+}
+const openDialog = (edit, data) => {
+    showDialog.value = true
+    if (edit === true) {
+        title.value = 'Edit Property'
+    } else {
+        title.value = 'Apply Property'
+    }
+    formData.group = data?.group || ''
+    formData.name = data?.name || ''
+    formData.containerID = data?.containerID || 0

Review Comment:
   ```suggestion
       formData.containerID = data?.containerID || ''
   ```



##########
ui/src/components/Property/PropertyRead.vue:
##########
@@ -0,0 +1,170 @@
+<script setup>

Review Comment:
   Added files should contain the license header



-- 
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: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [skywalking-banyandb] WuChuSheng1 commented on a diff in pull request #328: Add Property CRUD Function

Posted by "WuChuSheng1 (via GitHub)" <gi...@apache.org>.
WuChuSheng1 commented on code in PR #328:
URL: https://github.com/apache/skywalking-banyandb/pull/328#discussion_r1321600559


##########
ui/src/components/Property/TagEditor.vue:
##########
@@ -0,0 +1,76 @@
+<script setup>

Review Comment:
   ok



##########
ui/src/components/Property/PropertyRead.vue:
##########
@@ -0,0 +1,170 @@
+<script setup>

Review Comment:
   ok



##########
ui/src/components/Property/PropertyEditror.vue:
##########
@@ -0,0 +1,211 @@
+<script setup>

Review Comment:
   ok



-- 
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: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org