diff --git a/src/components/Addon/AddonCardInstance.vue b/src/components/Addon/AddonCardInstance.vue index a13034bf26..16628a2714 100644 --- a/src/components/Addon/AddonCardInstance.vue +++ b/src/components/Addon/AddonCardInstance.vue @@ -5,10 +5,10 @@ import { useI18n } from 'vue-i18n' import AddonCard from '@/components/Addon/AddonCard' import { useCore } from '@/composables/core' +import { ADDON_TYPE, addonTypeValidator } from '@/enums/addons' -const EXTENSION = 'extension' const props = defineProps({ - addonType: { type: String, validator: (s) => ['extension', 'plugin'].includes(s.toLowerCase()) }, + addonType: { type: String, validator: addonTypeValidator }, id: { type: String, required: true }, name: { type: String, required: true }, version: { type: String, required: true }, @@ -49,10 +49,10 @@ const recommendedVersion = computed(() => { const homepage = computed(() => props.deliverableFromRegistry?.homepage ?? null) const addonInstallFn = computed(() => { - return props.addonType === EXTENSION ? core.api.installExtensionFromId : core.api.installPluginFromId + return props.addonType === ADDON_TYPE.EXTENSION ? core.api.installExtensionFromId : core.api.installPluginFromId }) const addonUninstallFn = computed(() => { - return props.addonType === EXTENSION ? core.api.uninstallExtension : core.api.uninstallPlugin + return props.addonType === ADDON_TYPE.EXTENSION ? core.api.uninstallExtension : core.api.uninstallPlugin }) async function install() { const toast = { diff --git a/src/enums/addons.js b/src/enums/addons.js new file mode 100644 index 0000000000..9321567c84 --- /dev/null +++ b/src/enums/addons.js @@ -0,0 +1,21 @@ +// SINGULAR +const EXTENSION = 'extension' +const PLUGIN = 'plugin' +export const ADDON_TYPE = Object.freeze({ + EXTENSION, + PLUGIN +}) +export const ADDON_TYPES = Object.values(ADDON_TYPE) + +export const addonTypeValidator = (s) => ADDON_TYPES.includes(s.toLowerCase()) + +// PLURAL +const EXTENSIONS = 'extensions' +const PLUGINS = 'plugins' +export const ADDONS_TYPE = Object.freeze({ + EXTENSIONS, + PLUGINS +}) +export const ADDONS_TYPES = Object.values(ADDONS_TYPE) + +export const addonsTypeValidator = (s) => ADDONS_TYPES.includes(s) diff --git a/src/lang/en.json b/src/lang/en.json index 31351f6f4e..73c817a73e 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -1162,17 +1162,21 @@ }, "document-processing":{"title": "Document Processing" }, "batch-tasks":{"title": "Batch Tasks" }, - "plugins":{"title": "Plugins" }, + "addons": { "installFromUrl": "Install from a URL", - "install": "Install" - }, - "extensions":{ - "title": "Extensions", - "info": "Extensions are programs that you add to Datashare's back-end to add new features to store and manipulate data.", - "searchPlaceholder": "Search extensions" + "install": "Install", + "plugins":{ + "title": "Plugins", + "info": "Plugins are front-end modules to add new features in Datashare's user interface.", + "searchPlaceholder": "Search plugins" + }, + "extensions":{ + "title": "Extensions", + "info": "Extensions are back-end modules to add new features to store and manipulate data with Datashare.", + "searchPlaceholder": "Search extensions" + } } - }, "serverSettings": { "title": "Server Settings", diff --git a/src/router/index.js b/src/router/index.js index 476118fd1c..d6c44b6677 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -429,7 +429,8 @@ export const routes = [ { name: 'settings.plugins', path: 'plugins', - component: () => import('@/views/Settings/SettingsViewPlugins'), + component: () => import('@/views/Settings/SettingsViewAddons'), + props: { addonsType: 'plugins' }, meta: { title: 'Plugins', breadcrumb: false @@ -438,7 +439,8 @@ export const routes = [ { name: 'settings.extensions', path: 'extensions', - component: () => import('@/views/Settings/SettingsViewExtensions'), + component: () => import('@/views/Settings/SettingsViewAddons'), + props: { addonsType: 'extensions' }, meta: { title: 'Extensions', breadcrumb: false diff --git a/src/views/Settings/SettingsView.vue b/src/views/Settings/SettingsView.vue index 3d1c2ed925..079587c62d 100644 --- a/src/views/Settings/SettingsView.vue +++ b/src/views/Settings/SettingsView.vue @@ -11,8 +11,8 @@ const tabs = computed(() => [ { icon: 'moon', title: t('settings.appearance.title'), name: 'settings.appearance' }, { icon: 'file-text', title: t('settings.document-processing.title'), name: 'settings.document-processing' }, { icon: 'rocket-launch', title: t('settings.batch-tasks.title'), name: 'settings.batch-tasks' }, - { icon: 'monitor', title: t('settings.plugins.title'), name: 'settings.plugins' }, - { icon: 'database', title: t('settings.extensions.title'), name: 'settings.extensions' } + { icon: 'monitor', title: t('settings.addons.plugins.title'), name: 'settings.plugins' }, + { icon: 'database', title: t('settings.addons.extensions.title'), name: 'settings.extensions' } ]) diff --git a/src/views/Settings/SettingsViewAddons.vue b/src/views/Settings/SettingsViewAddons.vue new file mode 100644 index 0000000000..ca99448211 --- /dev/null +++ b/src/views/Settings/SettingsViewAddons.vue @@ -0,0 +1,116 @@ + + + + diff --git a/src/views/Settings/SettingsViewPlugins.vue b/src/views/Settings/SettingsViewPlugins.vue deleted file mode 100644 index fa810a3268..0000000000 --- a/src/views/Settings/SettingsViewPlugins.vue +++ /dev/null @@ -1,12 +0,0 @@ - - - -