-
Notifications
You must be signed in to change notification settings - Fork 334
Handle multiple sources for one extension #17031
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
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
30cfefd
display repo on extension cards
e7979d0
handle install/uninstall process for multiple extenstions with the sa…
79a8894
minor style + remove log
d1aba2b
Merge branch 'master' of github.com:rancher/dashboard into multiple-e…
2ab71a0
display repo name on installed card even after repo is removed
1aacf64
Merge branch 'master' of github.com:rancher/dashboard into multiple-e…
0079cdc
Merge branch 'master' of github.com:rancher/dashboard into multiple-e…
caf0d1e
implement the final ux/ui
004f628
address feedback
6ebee15
remove unused code
bcaa943
update comments
2ac67bb
add UninstallExistingExtensionDialog to PromptModal.test.ts
190ab50
remove capitalize styling for the cards footer
6e51ea0
Merge branch 'master' of github.com:rancher/dashboard into multiple-e…
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
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 @@ | ||
| <script> | ||
| import AsyncButton from '@shell/components/AsyncButton'; | ||
| import { CATALOG } from '@shell/config/types'; | ||
| import { UI_PLUGIN_NAMESPACE } from '@shell/config/uiplugins'; | ||
|
|
||
| /** | ||
| * Dialog shown when user tries to install an extension that is already installed from a different source. | ||
| * Prompts the user to uninstall the existing version first before installing from the new source. | ||
| */ | ||
| export default { | ||
| emits: ['close'], | ||
|
|
||
| components: { AsyncButton }, | ||
|
|
||
| props: { | ||
| /** | ||
| * The installed plugin that needs to be uninstalled | ||
| */ | ||
| installedPlugin: { | ||
| type: Object, | ||
| default: () => {}, | ||
| required: true | ||
| }, | ||
| /** | ||
| * Callback to update install status on extensions main screen | ||
| */ | ||
| updateStatus: { | ||
| type: Function, | ||
| default: () => {}, | ||
| required: true | ||
| }, | ||
| /** | ||
| * Callback when modal is closed | ||
| */ | ||
| closed: { | ||
| type: Function, | ||
| default: () => {}, | ||
| required: true | ||
| } | ||
| }, | ||
|
|
||
| data() { | ||
| return { busy: false }; | ||
| }, | ||
|
|
||
| methods: { | ||
| closeDialog(result) { | ||
| this.closed(result); | ||
| this.$emit('close'); | ||
| }, | ||
| async uninstall() { | ||
| this.busy = true; | ||
|
|
||
| const plugin = this.installedPlugin; | ||
|
|
||
| this.updateStatus(plugin.id, 'uninstall'); | ||
|
|
||
| // Delete the CR if this is a developer plugin (there is no Helm App, so need to remove the CRD ourselves) | ||
| if (plugin.uiplugin?.isDeveloper) { | ||
| // Delete the custom resource | ||
| await plugin.uiplugin.remove(); | ||
| } | ||
|
|
||
| // Find the app for this plugin using direct lookup (more efficient than findAll) | ||
| let pluginApp = null; | ||
|
|
||
| try { | ||
| const appId = `${ UI_PLUGIN_NAMESPACE }/${ plugin.name }`; | ||
|
|
||
| pluginApp = await this.$store.dispatch('management/find', { | ||
| type: CATALOG.APP, | ||
| id: appId | ||
| }); | ||
| } catch (e) { | ||
| // If the app cannot be found (e.g. already removed), proceed without error | ||
| pluginApp = null; | ||
| } | ||
|
|
||
| if (pluginApp) { | ||
| try { | ||
| await pluginApp.remove(); | ||
| } catch (e) { | ||
| this.$store.dispatch('growl/error', { | ||
| title: this.t('plugins.error.generic'), | ||
| message: e.message ? e.message : e, | ||
| timeout: 10000 | ||
| }, { root: true }); | ||
|
|
||
| this.busy = false; | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| await this.$store.dispatch('management/findAll', { type: CATALOG.OPERATION }); | ||
| } | ||
|
|
||
| // Close the dialog | ||
| this.closeDialog({ uninstalled: true, plugin }); | ||
| } | ||
| } | ||
| }; | ||
| </script> | ||
|
|
||
| <template> | ||
| <div class="plugin-install-dialog"> | ||
| <h4 class="mt-10"> | ||
| {{ t('plugins.install.alreadyInstalledTitle') }} | ||
| </h4> | ||
| <div class="mt-10 dialog-panel"> | ||
| <div class="dialog-info"> | ||
| <p> | ||
| {{ t('plugins.install.alreadyInstalledPrompt') }} | ||
| </p> | ||
| </div> | ||
| <div class="dialog-buttons"> | ||
| <button | ||
| :disabled="busy" | ||
| class="btn role-secondary" | ||
| data-testid="uninstall-existing-ext-modal-cancel-btn" | ||
| @click="closeDialog(false)" | ||
| > | ||
| {{ t('generic.cancel') }} | ||
| </button> | ||
| <AsyncButton | ||
| mode="uninstall" | ||
| :action-label="t('plugins.install.uninstallExisting')" | ||
| data-testid="uninstall-existing-ext-modal-uninstall-btn" | ||
| @click="uninstall()" | ||
| /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </template> | ||
|
|
||
| <style lang="scss" scoped> | ||
| @import '@shell/assets/styles/base/_mixins.scss'; | ||
|
|
||
| .plugin-install-dialog { | ||
| @include extension-dialog; | ||
| } | ||
| </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
Oops, something went wrong.
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.