diff --git a/components/nexus-rapture/src/main/java/org/sonatype/nexus/rapture/internal/RaptureWebResourceBundle.java b/components/nexus-rapture/src/main/java/org/sonatype/nexus/rapture/internal/RaptureWebResourceBundle.java index a4d068aba2..05f5bd0e90 100644 --- a/components/nexus-rapture/src/main/java/org/sonatype/nexus/rapture/internal/RaptureWebResourceBundle.java +++ b/components/nexus-rapture/src/main/java/org/sonatype/nexus/rapture/internal/RaptureWebResourceBundle.java @@ -85,6 +85,8 @@ public class RaptureWebResourceBundle private final String cacheBuster; + private final boolean designInput; + public final static String PROPERTY_WEBRESOURCES_CACHEBUSTER = "nexus.webresources.cachebuster"; @Inject @@ -94,7 +96,8 @@ public RaptureWebResourceBundle(final ApplicationVersion applicationVersion, final TemplateHelper templateHelper, final List pluginDescriptors, final List extJsPluginDescriptors, - @Nullable @Named("${" + PROPERTY_WEBRESOURCES_CACHEBUSTER + "}") final String cacheBuster) + @Nullable @Named("${" + PROPERTY_WEBRESOURCES_CACHEBUSTER + "}") final String cacheBuster, + @Named("${nexus.design.input:-false}") final boolean designInput) { this.applicationVersion = checkNotNull(applicationVersion); this.servletRequestProvider = checkNotNull(servletRequestProvider); @@ -102,6 +105,7 @@ public RaptureWebResourceBundle(final ApplicationVersion applicationVersion, this.templateHelper = checkNotNull(templateHelper); this.pluginDescriptors = checkNotNull(pluginDescriptors); this.extJsPluginDescriptors = checkNotNull(extJsPluginDescriptors); + this.designInput = designInput; if (cacheBuster == null) { this.cacheBuster = applicationVersion.getBuildTimestamp(); } else { @@ -185,6 +189,7 @@ protected byte[] generate() throws IOException { .set("styles", getStyles()) .set("scripts", getScripts()) .set("util", new TemplateUtil()) + .set("designInput", designInput) ); } }; diff --git a/components/nexus-rapture/src/main/resources/org/sonatype/nexus/rapture/internal/index.vm b/components/nexus-rapture/src/main/resources/org/sonatype/nexus/rapture/internal/index.vm index 06d67fd704..dd924de019 100644 --- a/components/nexus-rapture/src/main/resources/org/sonatype/nexus/rapture/internal/index.vm +++ b/components/nexus-rapture/src/main/resources/org/sonatype/nexus/rapture/internal/index.vm @@ -55,6 +55,9 @@ document.getElementById('loading-msg').innerHTML=msg; } + #if ( $designInput ) + + #end #macro(message $text) #end diff --git a/components/nexus-rapture/src/test/java/org/sonatype/nexus/rapture/internal/RaptureWebResourceBundleTest.java b/components/nexus-rapture/src/test/java/org/sonatype/nexus/rapture/internal/RaptureWebResourceBundleTest.java index d4533e2870..7883ee8659 100644 --- a/components/nexus-rapture/src/test/java/org/sonatype/nexus/rapture/internal/RaptureWebResourceBundleTest.java +++ b/components/nexus-rapture/src/test/java/org/sonatype/nexus/rapture/internal/RaptureWebResourceBundleTest.java @@ -62,7 +62,7 @@ public void setup() { underTest = new RaptureWebResourceBundle(applicationVersion, Providers.of(httpServletRequest), Providers.of(stateComponent), templateHelper, asList(new UiPluginDescriptorImpl()), - asList(new ExtJsUiPluginDescriptorImpl("test-1"), new ExtJsUiPluginDescriptorImpl("test-2")), null); + asList(new ExtJsUiPluginDescriptorImpl("test-1"), new ExtJsUiPluginDescriptorImpl("test-2")), null, false); } @Test diff --git a/components/nexus-repository-services/src/main/java/org/sonatype/nexus/repository/rest/api/model/StorageAttributes.java b/components/nexus-repository-services/src/main/java/org/sonatype/nexus/repository/rest/api/model/StorageAttributes.java index dce1183f8f..12d61873ff 100644 --- a/components/nexus-repository-services/src/main/java/org/sonatype/nexus/repository/rest/api/model/StorageAttributes.java +++ b/components/nexus-repository-services/src/main/java/org/sonatype/nexus/repository/rest/api/model/StorageAttributes.java @@ -26,7 +26,7 @@ */ public class StorageAttributes { - @ApiModelProperty(value = "Blob store used to store repository contents", example = "default") + @ApiModelProperty(value = "Blob store used to store repository contents", example = "default", required = true) @NotEmpty protected String blobStoreName; diff --git a/plugins/nexus-coreui-plugin/src/frontend/src/components/pages/admin/SupportZip/HA/NodeCard.jsx b/plugins/nexus-coreui-plugin/src/frontend/src/components/pages/admin/SupportZip/HA/NodeCard.jsx index 024d2afcc7..6584d7ec38 100644 --- a/plugins/nexus-coreui-plugin/src/frontend/src/components/pages/admin/SupportZip/HA/NodeCard.jsx +++ b/plugins/nexus-coreui-plugin/src/frontend/src/components/pages/admin/SupportZip/HA/NodeCard.jsx @@ -24,6 +24,8 @@ import { NxButton, } from '@sonatype/react-shared-components'; +import {ExtJS} from '@sonatype/nexus-ui-plugin'; + import UIStrings from '../../../../../constants/UIStrings'; import { faSync, @@ -33,8 +35,6 @@ import { import './SupportZipHa.scss'; -import {URL} from './NodeCardHelper'; - const {SUPPORT_ZIP: LABELS} = UIStrings; export default function NodeCard({actor, createZip, isBlobStoreConfigured}) { @@ -73,7 +73,7 @@ export default function NodeCard({actor, createZip, isBlobStoreConfigured}) { return ( - + {LABELS.DOWNLOAD_ZIP}
{formatDate(new Date(data.lastUpdated))} diff --git a/plugins/nexus-coreui-plugin/src/frontend/src/components/pages/admin/SupportZip/HA/NodeCard.test.jsx b/plugins/nexus-coreui-plugin/src/frontend/src/components/pages/admin/SupportZip/HA/NodeCard.test.jsx index 198777c1bd..13a4ad5aef 100644 --- a/plugins/nexus-coreui-plugin/src/frontend/src/components/pages/admin/SupportZip/HA/NodeCard.test.jsx +++ b/plugins/nexus-coreui-plugin/src/frontend/src/components/pages/admin/SupportZip/HA/NodeCard.test.jsx @@ -13,6 +13,7 @@ import React from 'react'; import {spawn} from 'xstate'; import {render, screen} from '@testing-library/react'; +import {ExtJS} from '@sonatype/nexus-ui-plugin'; import userEvent from '@testing-library/user-event'; import NodeCard from './NodeCard'; import NodeCardTestData from './NodeCard.testdata'; @@ -20,6 +21,16 @@ import UIStrings from '../../../../../constants/UIStrings'; import NodeCardMachine from './NodeCardMachine'; const {SUPPORT_ZIP: LABELS} = UIStrings; +jest.mock('@sonatype/nexus-ui-plugin', () => ({ + ...jest.requireActual('@sonatype/nexus-ui-plugin'), + ExtJS: { + state: jest.fn().mockReturnValue({ + getValue: jest.fn(), + }), + urlOf: jest.fn().mockImplementation((path) => '/' + path) + }, +})); + describe('NodeCard', function () { const testNodes = NodeCardTestData; const ACTIVE_NODE_INDEX = 0; @@ -36,6 +47,7 @@ describe('NodeCard', function () { noZipCreated: () => screen.getByText(LABELS.NO_ZIP_CREATED), zipCreate: () => screen.getByText(LABELS.GENERATE_NEW_ZIP_FILE), zipCreating: () => screen.getByText(LABELS.CREATING_ZIP), + zipLink: () => screen.getByRole('link'), errorMessage: () => screen.getByText(LABELS.GENERATE_ERROR), retryButton: () => screen.getByRole('button', {name: LABELS.RETRY}), }; @@ -73,9 +85,30 @@ describe('NodeCard', function () { expect(selectors.nodeHostName(node.hostname)).toBeInTheDocument(); expect(selectors.generateZipStatus()).toBeInTheDocument(); - expect(screen.getByRole('link')).toHaveTextContent( + expect(selectors.zipLink()).toHaveTextContent( 'Download Zip Generated2022-5-7 0:0:0 (GMT-0500)' ); + expect(selectors.zipLink()).toHaveAttribute( + 'href', '/service/rest/wonderland/download/http://download.com?support-zip.zip' + ); + }); + + it('renders zip link with context path when provided', () => { + jest + .spyOn(Date.prototype, 'toTimeString') + .mockReturnValue('00:00:00 GMT-0500 (Standard Time)'); + + ExtJS.urlOf.mockImplementation((path) => '/test/' + path); + + const node = testNodes[ZIP_CREATED_NODE_INDEX]; + renderView(node); + + expect(selectors.zipLink()).toHaveTextContent( + 'Download Zip Generated2022-5-7 0:0:0 (GMT-0500)' + ); + expect(selectors.zipLink()).toHaveAttribute( + 'href', '/test/service/rest/wonderland/download/http://download.com?support-zip.zip' + ); }); it('renders zip is not created', () => { diff --git a/plugins/nexus-coreui-plugin/src/frontend/src/components/pages/admin/SupportZip/HA/NodeCardHelper.js b/plugins/nexus-coreui-plugin/src/frontend/src/components/pages/admin/SupportZip/HA/NodeCardHelper.js index 355dff7d40..655949da37 100644 --- a/plugins/nexus-coreui-plugin/src/frontend/src/components/pages/admin/SupportZip/HA/NodeCardHelper.js +++ b/plugins/nexus-coreui-plugin/src/frontend/src/components/pages/admin/SupportZip/HA/NodeCardHelper.js @@ -17,15 +17,8 @@ import Axios from 'axios'; import {APIConstants} from '@sonatype/nexus-ui-plugin'; -const downloadZipFile = (blobRef) => - `/service/rest/wonderland/download/${blobRef}`; - export const cleanNode = async (nodeId) => { return await Axios.delete( APIConstants.REST.INTERNAL.CLEAR_SUPPORT_ZIP_HISTORY + nodeId ); }; - -export const URL = { - downloadZipFile, -}; diff --git a/plugins/nexus-coreui-plugin/src/frontend/src/constants/pages/admin/repository/CleanupPoliciesStrings.jsx b/plugins/nexus-coreui-plugin/src/frontend/src/constants/pages/admin/repository/CleanupPoliciesStrings.jsx index 76b8edca94..114d32f6fd 100644 --- a/plugins/nexus-coreui-plugin/src/frontend/src/constants/pages/admin/repository/CleanupPoliciesStrings.jsx +++ b/plugins/nexus-coreui-plugin/src/frontend/src/constants/pages/admin/repository/CleanupPoliciesStrings.jsx @@ -67,8 +67,8 @@ export default { RELEASE_TYPE_DESCRIPTION: 'Remove components that are of the following release type:', ASSET_NAME_DESCRIPTION: 'Remove components that have at least one asset name matching the following regular expression pattern:', - LAST_UPDATED_SUB_LABEL: 'Components published over “x” days ago (e.g 0-999 )', - LAST_DOWNLOADED_SUB_LABEL: 'Components downloaded in “x” amount of days (e.g 0-999 )', + LAST_UPDATED_SUB_LABEL: 'Components published over “x” days ago (e.g 1-999)', + LAST_DOWNLOADED_SUB_LABEL: 'Components downloaded in “x” amount of days (e.g 1-999)', PLACEHOLDER: 'e.g 100 days', diff --git a/revision.txt b/revision.txt index ce0f0e28a5..93784a97ba 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -b=main,r=46438642abd802c3c81f8fa04ea6cec54a55aab5,t=2024-01-26-1343-01840 \ No newline at end of file +b=main,r=9c91df40b581179a8da177f2c54085bf6065862b,t=2024-02-02-1342-47865 \ No newline at end of file