Skip to content

Commit

Permalink
Merge pull request #46 from ZhaoYangyang0403/fix-draft-and-error-aler…
Browse files Browse the repository at this point in the history
…t-bugs

Fix draft and error alert bugs
  • Loading branch information
yumiguan authored Jun 27, 2023
2 parents d25dfdf + e640dc7 commit b05c045
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 16 deletions.
23 changes: 16 additions & 7 deletions frontend/src/components/BugTemplateSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
filterable
size="small"
placeholder="Select template"
not-found-text="No saved draft"
not-found-text="No Template"
>
<Option v-for="(template, index) in templates" :value="index" :key="index">{{ template.name }}</Option>
</Select>
Expand All @@ -22,18 +22,18 @@
clearable
size="small"
placeholder="Select a saved draft"
not-found-text="No Template"
not-found-text="No saved draft"
>
<Option
v-for="(template, index) in cacheList"
:value="template.cacheName"
:key="index"
class="draft-option"
>{{template.cacheName}}<Icon
v-show="template.cacheName===selectedCache"
class="icon-form"
style="float: right"
type="md-trash"
@click="isShownDeleteModal = true"
v-show="template.cacheName===selectedCache"
class="delete-icon"
type="md-trash"
@click="isShownDeleteModal = true"
/>
</Option>
</Select>
Expand Down Expand Up @@ -115,4 +115,13 @@ export default {
margin-bottom: 0px;
padding-bottom: 5px;
}
.draft-option {
white-space: normal;
position: relative;
}
.delete-icon {
position: absolute;
bottom: 10px;
margin: auto;
}
</style>
3 changes: 3 additions & 0 deletions frontend/src/components/form/CompoundTextAreaFormItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export default {
created () {
this.$bus.$on('addMessage', this.addDesc)
},
beforeDestroy () {
this.$bus.$off('addMessage')
},
methods: {
addDesc (desc) {
this.$store.commit('addExtraMsg', { index: this.index, value: desc })
Expand Down
17 changes: 10 additions & 7 deletions frontend/src/store/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,17 @@ export default {
api.createIssue(state.templates[state.selectedTemplateIndex], state.templateDetail,
state.attachmentsList, state.exportAttachmentList)
.then(response => {
for (let failAttach of response.data.export_fail_attachments) {
let extensionName = String(failAttach.split('.').slice(-1))
bus.$emit('msg.error', `Add ${failAttach} to attachment error: cannot convert data to a ${extensionName} file.`)
if (response.data.code === 1000) {
for (let failAttach of response.data.export_fail_attachments) {
let extensionName = String(failAttach.split('.').slice(-1))
bus.$emit('msg.error', `Add ${failAttach} to attachment error: cannot convert data to a ${extensionName} file.`)
}
}
bus.$emit('message', response.data.message)
commit('setSubmitLock', false)
}).catch(response => {
bus.$emit('message', response.data)
commit('setSubmitLock', false)
}).catch(error => {
bus.$emit('msg.error', 'Submit failed error: ' + error.message)
commit('setSubmitLock', false)
})
},
loadAttachment ({ state, commit }) {
Expand Down Expand Up @@ -363,8 +365,9 @@ export default {
.then(response => {
if (response.data.code === 1000) {
bus.$emit('msg.success', 'Delete success!')
commit('setSelectedCache', state.selectedCache)
commit('setSelectedCache', null)
dispatch('loadCacheList')
dispatch('loadTemplate')
} else {
bus.$emit('msg.error', 'Delete failed error: ' + response.data.message)
}
Expand Down
2 changes: 1 addition & 1 deletion lyrebird_bugit/template_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def get_workspace():
if bugit_workspace and Path(bugit_workspace).exists():
return Path(bugit_workspace)

ROOT = application._cm.root
ROOT = application._cm.ROOT
metadata_dir = ROOT/'downloads'/'lyrebird_bugit'
metadata_dir.mkdir(parents=True, exist_ok=True)
logger.warning(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name='lyrebird-bugit',
version='1.12.2',
version='1.12.3',
packages=['lyrebird_bugit'],
url='https://github.com/Meituan-Dianping/lyrebird-bugit',
author='HBQA',
Expand Down

0 comments on commit b05c045

Please sign in to comment.