-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Extra checks in UI when deleting accounts #10760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+260
−4
Merged
Changes from 15 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6aa691c
vpc fill gateway and netmask
Imvedansh 1d7fc2a
Suggestion for CIDR in placeholder instead of input
Imvedansh 217789e
netmask placeholder fix
Imvedansh 873aaa3
Abstraction of logic and few minor fixes
Imvedansh d4b11ef
Minor fix in network.js
Imvedansh 6cd108e
Removed repetitive code in VPCTierTab
Imvedansh 60acacf
Update ui/public/locales/en.json
Imvedansh a69a86a
extra check to delete account
Imvedansh 60c84d1
extra checks for deleting account
Imvedansh a968eb1
Merge branch 'apache:4.19' into 4.19
Imvedansh c6e8e47
Brute commit for warning feature disable account first
Imvedansh 52a9233
Code Quality improved
Imvedansh 33e11f3
removing Wrapper.vue
Imvedansh a730e03
New file DAW.vue added
Imvedansh 422bcc0
removed duplication in en.json
Imvedansh 99c17e9
Update ui/public/locales/en.json
Imvedansh eb5b254
Merge branch 'apache:4.19' into 4.19
Imvedansh 1d3e374
Suggested fixes
Imvedansh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| // 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. | ||
|
|
||
| <template> | ||
| <a-form | ||
| class="form" | ||
| :ref="formRef" | ||
| :model="form" | ||
| :rules="rules" | ||
| layout="vertical" | ||
| @finish="handleSubmit" | ||
| v-ctrl-enter="handleSubmit" | ||
| > | ||
| <div style="margin-bottom: 10px"> | ||
| <a-alert type="warning"> | ||
| <template #message> | ||
| <div v-html="$t('message.delete.account.warning')"></div> | ||
| </template> | ||
| </a-alert> | ||
| </div> | ||
| <div style="margin-bottom: 10px"> | ||
| <a-alert> | ||
| <template #message> | ||
| <div v-html="$t('message.delete.account.confirm')"></div> | ||
| </template> | ||
| </a-alert> | ||
| </div> | ||
| <a-form-item name="name" ref="name"> | ||
| <a-input | ||
| v-model:value="form.name" | ||
| :placeholder="$t('label.enter.account.name')" | ||
| style="width: 100%"/> | ||
| </a-form-item> | ||
| <p v-if="error" class="error">{{ error }}</p> | ||
| <div :span="24" class="actions"> | ||
| <a-button @click="closeModal">{{ $t('label.cancel') }}</a-button> | ||
| <a-button type="primary" ref="submit" @click="handleSubmit">{{ $t('label.ok') }}</a-button> | ||
| </div> | ||
| </a-form> | ||
| </template> | ||
|
|
||
| <script> | ||
| import { ref, reactive } from 'vue' | ||
| import { api } from '@/api' | ||
| export default { | ||
| name: 'DeleteAccount', | ||
| props: { | ||
| resource: { | ||
| type: Object, | ||
| required: true | ||
| } | ||
| }, | ||
| data () { | ||
| return { | ||
| error: '' | ||
| } | ||
| }, | ||
| created () { | ||
| this.initForm() | ||
| }, | ||
| methods: { | ||
| initForm () { | ||
| this.formRef = ref() | ||
| this.form = reactive({}) | ||
| this.rules = reactive({ | ||
| name: [{ required: true, message: this.$t('label.required') }] | ||
| }) | ||
| }, | ||
| closeModal () { | ||
| this.$emit('close-action') | ||
| }, | ||
| handleSubmit (e) { | ||
| e.preventDefault() | ||
| this.formRef.value.validate().then(async () => { | ||
| if (this.form.name !== this.resource.name) { | ||
| this.error = `${this.$t('message.error.account.delete.name.mismatch')}` | ||
| return | ||
| } | ||
| if (this.hasActiveResources) { | ||
| return | ||
| } | ||
| api('deleteAccount', { | ||
| id: this.resource.id | ||
| }).then(response => { | ||
| this.$pollJob({ | ||
| jobId: response.deleteaccountresponse.jobid, | ||
| title: this.$t('label.action.delete.account'), | ||
| description: this.resource.id, | ||
| successMessage: `${this.$t('message.delete.account.success')} - ${this.resource.name}`, | ||
| errorMessage: `${this.$t('message.delete.account.failed')} - ${this.resource.name}`, | ||
| loadingMessage: `${this.$t('message.delete.account.processing')} - ${this.resource.name}`, | ||
| catchMessage: this.$t('error.fetching.async.job.result') | ||
| }) | ||
| this.closeModal() | ||
DaanHoogland marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }).catch(error => { | ||
| this.$notifyError(error) | ||
| }) | ||
| }).catch((error) => { | ||
| this.formRef.value.scrollToField(error.errorFields[0].name) | ||
| }) | ||
| } | ||
| } | ||
| } | ||
| </script> | ||
|
|
||
| <style lang="scss" scoped> | ||
| .form { | ||
| width: 80vw; | ||
| @media (min-width: 500px) { | ||
| width: 400px; | ||
| } | ||
| } | ||
| .actions { | ||
| display: flex; | ||
| justify-content: flex-end; | ||
| margin-top: 20px; | ||
| button { | ||
| &:not(:last-child) { | ||
| margin-right: 10px; | ||
| } | ||
| } | ||
| } | ||
| .error { | ||
| color: red; | ||
| margin-top: 10px; | ||
| } | ||
| </style> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| // 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. | ||
|
|
||
| <template> | ||
| <div> | ||
| <!-- Show error message if account is not disabled --> | ||
| <template v-if="resource.state !== 'disabled'"> | ||
| <div style="margin-bottom: 10px"> | ||
| <a-alert type="error"> | ||
| <template #message> | ||
| <div>{{ $t('message.delete.account.not.disabled') }}</div> | ||
| </template> | ||
| </a-alert> | ||
| </div> | ||
| <div :span="24" class="actions"> | ||
| <a-button type="primary" @click="closeModal">{{ $t('label.ok') }}</a-button> | ||
| </div> | ||
| </template> | ||
| <!-- Show delete form if account is disabled --> | ||
| <delete-account | ||
| v-else | ||
| :resource="resource" | ||
| @close-action="closeModal" /> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script> | ||
| import DeleteAccount from './DeleteAccount.vue' | ||
|
|
||
| export default { | ||
| name: 'DeleteAccountWrapper', | ||
| components: { | ||
| DeleteAccount | ||
| }, | ||
| props: { | ||
| resource: { | ||
| type: Object, | ||
| required: true | ||
| } | ||
| }, | ||
| methods: { | ||
| closeModal () { | ||
| this.$emit('close-action') | ||
| } | ||
| } | ||
| } | ||
| </script> | ||
|
|
||
| <style lang="scss" scoped> | ||
| .actions { | ||
| display: flex; | ||
| justify-content: flex-end; | ||
| margin-top: 20px; | ||
| button { | ||
| &:not(:last-child) { | ||
| margin-right: 10px; | ||
| } | ||
| } | ||
| } | ||
| </style> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.