Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion admin-ui/src/api/github_build_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export function get () {
}

export function save (data) {
return request({ url: '/github_build_config/save', method: 'post', data })
return request({ url: '/github_build_config/save', method: 'post', data, skipErrorMessage: true })
}

export function getWorkflowTags () {
Expand Down
3 changes: 3 additions & 0 deletions admin-ui/src/utils/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@
"WorkflowApprovalRequestFailed": {
"One": "Approval was not recorded. Try again after reviewing the provider status."
},
"GithubBuildSaveError": {
"One": "GitHub build settings could not be saved. Check the configuration and try again."
},
"Status": {
"One": "Status"
},
Expand Down
3 changes: 3 additions & 0 deletions admin-ui/src/utils/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@
"WorkflowApprovalRequestFailed": {
"One": "Подтверждение не записано. Проверьте состояние провайдера и повторите попытку."
},
"GithubBuildSaveError": {
"One": "Не удалось сохранить настройки GitHub Build. Проверьте конфигурацию и повторите попытку."
},
"Status": {
"One": "Статус"
},
Expand Down
3 changes: 3 additions & 0 deletions admin-ui/src/utils/i18n/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@
"WorkflowApprovalRequestFailed": {
"One": "审批未记录。请查看服务商状态后重试。"
},
"GithubBuildSaveError": {
"One": "无法保存 GitHub 构建设置。请检查配置后重试。"
},
"Status": {
"One": "状态"
},
Expand Down
25 changes: 22 additions & 3 deletions admin-ui/src/views/server/github-build.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@
<el-button @click="onDispatchTest" :loading="dispatching">Trigger test build</el-button>
</el-form-item>

<el-alert v-if="saveError" type="error" :closable="false" show-icon role="alert" aria-live="assertive">
{{ saveError }}
</el-alert>
<el-alert v-if="testResult" :type="testResult.ok ? 'success' : 'error'" :closable="false">
{{ testResult.message }}
</el-alert>
Expand Down Expand Up @@ -208,6 +211,7 @@ const form = reactive({
const generatedKey = ref('')
const testResult = ref(null)
const dispatchResult = ref(null)
const saveError = ref('')

async function load () {
loading.value = true
Expand Down Expand Up @@ -300,18 +304,33 @@ const workflowRefStatusType = computed(() => {

async function onSave () {
saving.value = true
saveError.value = ''
try {
await api.save({
repo: form.repo,
token: form.token,
payload_key: form.payload_key,
})
form.token = ''
form.payload_key = ''
await load()
} catch (e) {
saveError.value = extractSaveError(e)
return
} finally {
saving.value = false
}
form.token = ''
form.payload_key = ''
await load()
}

function extractSaveError (error) {
const envelopes = [error, error?.response?.data]
for (const envelope of envelopes) {
if (Number.isInteger(envelope?.code) && envelope.code !== 0
&& typeof envelope.message === 'string' && envelope.message.trim()) {
return envelope.message.trim()
}
}
return T('GithubBuildSaveError')
}

async function onGenerate () {
Expand Down