From 2f53c8c6e2fec2911bb8a59bb81945699dd606a3 Mon Sep 17 00:00:00 2001 From: Ravi Pendurty Date: Mon, 18 Dec 2023 13:15:28 +0530 Subject: Web Client context menu item display Irrespective of connection state of the mountpoint Issue-ID: CCSDK-3975 Change-Id: I10f785024c7cca42e4c6dfe568ecb9f2412de213 Signed-off-by: Ravi Pendurty (cherry picked from commit de91a1ce57b39449d49b3a33da53190da2a364da) Signed-off-by: Ravi Pendurty --- .../database/sqldb/data/SqlDBDataProvider.java | 47 ++++++++++++++-------- .../src/actions/commonNetworkElementsActions.ts | 6 +-- .../src/handlers/networkElementsHandler.ts | 2 +- 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDBDataProvider.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDBDataProvider.java index e04e109cd..02930304b 100644 --- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDBDataProvider.java +++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDBDataProvider.java @@ -28,6 +28,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.concurrent.TimeUnit; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.SqlDBClient; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.SqlDBConfig; @@ -87,6 +88,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.UpdateNetworkElementConnectionInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.UpdateNetworkElementConnectionOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.Filter; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.FilterKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.mediator.server.list.output.Data; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -474,27 +476,27 @@ public class SqlDBDataProvider extends HtDatabaseEventsService implements Databa @Override public ReadGuiCutThroughEntryOutputBuilder readGuiCutThroughEntry(EntityInput input) { ReadGuiCutThroughEntryOutputBuilder outputBuilder = new ReadGuiCutThroughEntryOutputBuilder(); - QueryResult result = - this.guicutthroughRW.getData(input); if (!guicutthroughOverride.isEmpty()) { - List gcData = - result.getResult(); - List updatedGcData = - new ArrayList<>(); - for (int i = 0; i < gcData.size(); i++) { - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.gui.cut.through.entry.output.Data gcDataItem = - gcData.get(i); - Guicutthrough gcItem = - new GuicutthroughBuilder().setId(gcDataItem.getId()).setName(gcDataItem.getName()) - .setWeburi(guicutthroughOverride + "/" + gcDataItem.getId()).build(); - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.gui.cut.through.entry.output.DataBuilder gcDataBuilder = - new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.gui.cut.through.entry.output.DataBuilder( - gcItem); - updatedGcData.add(gcDataBuilder.build()); + if (input.getFilter() != null) { + // Iterate through the Filter map, get the ID and populate the GuicutThrough object accordingly. + Map inputFilter = input.getFilter(); + List gcData = + new ArrayList<>(); + for (FilterKey fk : inputFilter.keySet()) { + String fkVal = inputFilter.get(fk).getFiltervalue(); + if (fkVal != null) { + addGcItem(gcData, fkVal); + } + for (String fkVals : inputFilter.get(fk).getFiltervalues()) { + addGcItem(gcData, fkVals); + } + } + outputBuilder.setData(gcData); } - outputBuilder.setData(updatedGcData); } else { + QueryResult result = + this.guicutthroughRW.getData(input); outputBuilder.setData(result.getResult()); } outputBuilder.setPagination( @@ -503,6 +505,17 @@ public class SqlDBDataProvider extends HtDatabaseEventsService implements Databa return outputBuilder; } + private void addGcItem( + List gcData, + String value) { + Guicutthrough gcItem = new GuicutthroughBuilder().setId(value).setName(value) + .setWeburi(guicutthroughOverride + "/" + value).build(); + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.gui.cut.through.entry.output.DataBuilder gcDataBuilder = + new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.gui.cut.through.entry.output.DataBuilder( + gcItem); + gcData.add(gcDataBuilder.build()); + } + @Override public boolean waitForYellowDatabaseStatus(long timeout, TimeUnit unit) { return true; diff --git a/sdnr/wt/odlux/apps/connectApp/src/actions/commonNetworkElementsActions.ts b/sdnr/wt/odlux/apps/connectApp/src/actions/commonNetworkElementsActions.ts index 948f2aada..f1965269f 100644 --- a/sdnr/wt/odlux/apps/connectApp/src/actions/commonNetworkElementsActions.ts +++ b/sdnr/wt/odlux/apps/connectApp/src/actions/commonNetworkElementsActions.ts @@ -1,4 +1,3 @@ - /** * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt odlux @@ -82,7 +81,7 @@ export const findWebUrisForGuiCutThroughAsyncAction = (networkElementIds: string networkElementIds.forEach(id => { const item = networkElements.rows.find((ne) => ne.id === id); if (item) { - if (item.status === 'Connected') { + if (item.status) { // if (item.coreModelCapability !== "Unsupported") { // element is connected and is added to search list, if it doesn't exist already @@ -118,7 +117,7 @@ export const findWebUrisForGuiCutThroughAsyncAction = (networkElementIds: string }); - if (elementsToSearch.length > 0 || notConnectedElements.length > 0 || unsupportedElements.length > 0) { + if (elementsToSearch.length > 0 || unsupportedElements.length > 0) { const result = await connectService.getAllWebUriExtensionsForNetworkElementListAsync(elementsToSearch); dispatcher(new AddWebUriList(result, notConnectedElements, unsupportedElements, prevFoundElements)); } @@ -138,4 +137,3 @@ export const updateCurrentViewAsyncAction = () => (dispatch: Dispatch, getState: return dispatch(connectionStatusLogReloadAction); } }; - diff --git a/sdnr/wt/odlux/apps/connectApp/src/handlers/networkElementsHandler.ts b/sdnr/wt/odlux/apps/connectApp/src/handlers/networkElementsHandler.ts index 42d2824b9..71d62f94b 100644 --- a/sdnr/wt/odlux/apps/connectApp/src/handlers/networkElementsHandler.ts +++ b/sdnr/wt/odlux/apps/connectApp/src/handlers/networkElementsHandler.ts @@ -42,7 +42,7 @@ export const { appState.connect.networkElements.rows.forEach(element => { - if (element.status === 'Connected') { + if (element.status) { const webUri = webUris.find(item => item.id === element.id as string); if (webUri) { element.weburi = webUri.weburi; -- cgit 1.2.3-korg