Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
- Loading branch information
1 parent
3b99477
commit f7db6a2
Showing
11 changed files
with
247 additions
and
121 deletions.
There are no files selected for viewing
This file contains 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 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 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
52 changes: 52 additions & 0 deletions
52
packages/devtools/client/components/ModuleActionDialog.vue
This file contains 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,52 @@ | ||
<script setup lang="ts"> | ||
import { ModuleDialog } from '../composables/state' | ||
const config = useServerConfig() | ||
const openInEditor = useOpenInEditor() | ||
</script> | ||
|
||
<template> | ||
<ModuleDialog v-slot="{ resolve, args }"> | ||
<NDialog :model-value="true" @close="resolve(false)"> | ||
<ModuleItemBase :mod="{}" :info="args[0]" border="none" w-150 n-panel-grids /> | ||
<div flex="~ col gap-2" w-150 p4 border="t base"> | ||
<h2 text-xl :class="args[2] === 'install' ? 'text-primary' : 'text-red'"> | ||
<span capitalize>{{ args[2] }}</span> <code>{{ args[0].name }}</code>? | ||
</h2> | ||
|
||
<p op50> | ||
Following command will be executed in your terminal: | ||
</p> | ||
<NCodeBlock :code="args[1].commands.join(' ')" lang="bash" px4 py2 border="~ base rounded" :lines="false" /> | ||
|
||
<p op50> | ||
Then your <NLink role="button" n="primary" @click="openInEditor(config?._nuxtConfigFile)" v-text="'Nuxt config'" /> will be updated as: | ||
</p> | ||
<CodeDiff | ||
:from="args[1].configOriginal" | ||
:to="args[1].configGenerated" | ||
max-h-80 of-auto py2 border="~ base rounded" | ||
lang="ts" | ||
/> | ||
<p> | ||
<span op50>After that, Nuxt will </span><span text-orange>restart automatically</span>. | ||
</p> | ||
<div flex="~ gap-3" mt2 justify-end> | ||
<NTip n="sm purple" flex-auto icon="carbon-chemistry"> | ||
Experimental. Backup your project first. | ||
</NTip> | ||
<NButton @click="resolve(false)"> | ||
Cancel | ||
</NButton> | ||
<NButton n="solid" capitalize :class="args[2] === 'install' ? 'n-primary' : 'n-red'" @click="resolve(true)"> | ||
{{ args[2] }} | ||
</NButton> | ||
</div> | ||
</div> | ||
</NDialog> | ||
</ModuleDialog> | ||
</template> |
This file contains 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 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 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 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,38 @@ | ||
<script setup lang="ts"> | ||
import type { ModuleStaticInfo } from '../../src/types' | ||
const props = defineProps<{ | ||
item: ModuleStaticInfo | ||
}>() | ||
const installedModules = useInstalledModules() | ||
const installedInfo = computed(() => installedModules.value.find(i => i.name === props.item.npm)) | ||
const isInstalled = computed(() => installedInfo.value && installedInfo.value.isPackageModule) | ||
const isUninstallable = computed(() => installedInfo.value && installedInfo.value.isPackageModule && installedInfo.value.isUninstallable) | ||
</script> | ||
|
||
<template> | ||
<ModuleItemBase | ||
:mod="{}" | ||
:role="isInstalled ? '' : 'button'" | ||
:info="item" | ||
mb2 h-full | ||
:class="isInstalled ? 'border-dashed op75' : 'hover:bg-active!'" | ||
:compact="true" | ||
@click="isInstalled ? null : useModuleAction(item, 'install')" | ||
> | ||
<template v-if="isInstalled" #badge> | ||
<Badge bg-green-400:10 text-green-400> | ||
Installed | ||
</Badge> | ||
<NDropdown v-if="isUninstallable" n="sm green"> | ||
<template #trigger="{ click }"> | ||
<NIconButton icon="carbon-overflow-menu-vertical" @click="click()" /> | ||
</template> | ||
<NButton icon="carbon-trash-can" n="red" @click="useModuleAction(item, 'uninstall')"> | ||
Uninstall | ||
</NButton> | ||
</NDropdown> | ||
</template> | ||
</ModuleItemBase> | ||
</template> |
This file contains 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.