diff --git a/cypress/e2e/plugins/1-available-plugins-tests/install-available-plugin.cypress.js b/cypress/e2e/plugins/1-available-plugins-tests/install-available-plugin.cypress.js index 35fe6416fc..526e518610 100644 --- a/cypress/e2e/plugins/1-available-plugins-tests/install-available-plugin.cypress.js +++ b/cypress/e2e/plugins/1-available-plugins-tests/install-available-plugin.cypress.js @@ -9,7 +9,8 @@ const { managePluginsPagePath, getTemplateLink, loadInstalledPluginsPage, - loadPluginsPage, manageInstalledPluginsPagePath + loadPluginsPage, + manageInstalledPluginsPagePath } = require('../plugin-utils') const { showHideAllLinkQuery, assertVisible, assertHidden } = require('../../step-by-step-utils') diff --git a/cypress/e2e/plugins/2-prototype-kit-plugin-tests/handle-plugin-update-when-a-dependency-is-now-required.cypress.js b/cypress/e2e/plugins/2-prototype-kit-plugin-tests/handle-plugin-update-when-a-dependency-is-now-required.cypress.js index c740237b5f..dc62095b6a 100644 --- a/cypress/e2e/plugins/2-prototype-kit-plugin-tests/handle-plugin-update-when-a-dependency-is-now-required.cypress.js +++ b/cypress/e2e/plugins/2-prototype-kit-plugin-tests/handle-plugin-update-when-a-dependency-is-now-required.cypress.js @@ -30,7 +30,7 @@ describe('Handle a plugin update', () => { waitForApplication(pluginsPage) - cy.get('[data-plugin-group-status="available"]') + cy.get('[data-plugin-group-status="search"]') .find(`[data-plugin-package-name="${dependencyPlugin}"]`) .find('button') .contains('Install') diff --git a/lib/manage-prototype-handlers.js b/lib/manage-prototype-handlers.js index e88338cd49..2b086c7adc 100644 --- a/lib/manage-prototype-handlers.js +++ b/lib/manage-prototype-handlers.js @@ -17,7 +17,7 @@ const syncChanges = require('./sync-changes') const { lookupPackageInfo, getInstalledPackages, - getAvailablePackages, + getAllPackages, getDependentPackages, getDependencyPackages, waitForPackagesCache @@ -419,18 +419,18 @@ function buildPluginData (pluginData) { } async function prepareForPluginPage (isInstalledPage, search) { - const availablePlugins = await getAvailablePackages() + const allPlugins = await getAllPackages() const installedPlugins = await getInstalledPackages() const plugins = isInstalledPage ? installedPlugins - : availablePlugins.filter(plugin => { + : allPlugins.filter(plugin => { const pluginName = plugin.packageName?.toLowerCase() return pluginName.indexOf(search.toLowerCase()) >= 0 }) return { - status: isInstalledPage ? 'installed' : 'available', + status: isInstalledPage ? 'installed' : 'search', plugins: plugins.map(buildPluginData), found: plugins.length, updates: installedPlugins.filter(plugin => plugin.installedVersion !== plugin.latestVersion).length @@ -510,7 +510,7 @@ async function getPluginsHandler (req, res) { currentSection: pageName, links: managementLinks, isInstalledPage, - isAvailablePage: !isInstalledPage, + isSearchPage: !isInstalledPage, search, plugins, updatesMessage, diff --git a/lib/manage-prototype-handlers.test.js b/lib/manage-prototype-handlers.test.js index 4b5e35c5de..06be2ea4ab 100644 --- a/lib/manage-prototype-handlers.test.js +++ b/lib/manage-prototype-handlers.test.js @@ -33,7 +33,8 @@ const { postPluginsStatusHandler, postPluginsModeMiddleware, getPluginsModeHandler, - postPluginsModeHandler, postPluginsHandler + postPluginsModeHandler, + postPluginsHandler } = require('./manage-prototype-handlers') const { projectDir } = require('./utils/paths') @@ -108,7 +109,7 @@ jest.mock('./plugins/packages', () => { } }), getInstalledPackages: jest.fn().mockResolvedValue([]), - getAvailablePackages: jest.fn().mockResolvedValue([availablePackage]), + getAllPackages: jest.fn().mockResolvedValue([availablePackage]), getDependentPackages: jest.fn().mockResolvedValue([]), getDependencyPackages: jest.fn().mockResolvedValue([]) } @@ -442,7 +443,7 @@ describe('manage-prototype-handlers', () => { 'views/manage-prototype/plugins.njk', expect.objectContaining({ currentSection: 'Plugins', - isAvailablePage: false, + isSearchPage: false, isInstalledPage: true, plugins: [], status: 'installed' @@ -457,10 +458,10 @@ describe('manage-prototype-handlers', () => { 'views/manage-prototype/plugins.njk', expect.objectContaining({ currentSection: 'Plugins', - isAvailablePage: true, + isSearchPage: true, isInstalledPage: false, plugins: [availablePlugin], - status: 'available' + status: 'search' }) ) }) diff --git a/lib/nunjucks/views/manage-prototype/plugins.njk b/lib/nunjucks/views/manage-prototype/plugins.njk index 3f4ba44c06..6d3d48e0cb 100644 --- a/lib/nunjucks/views/manage-prototype/plugins.njk +++ b/lib/nunjucks/views/manage-prototype/plugins.njk @@ -17,7 +17,7 @@
+ {{ govukTag({ + text: "Installed", + classes: "govuk-tag--grey" + }) }} +
+ {% endif %} {% if plugin.description %}