Skip to content

Commit add31d5

Browse files
Merge pull request #210 from devtron-labs/fix/plugin-list-sort
fix: sorting for parent plugin list
2 parents a91c002 + cc38fb8 commit add31d5

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.1.7-beta-1",
3+
"version": "0.1.7-beta-5",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Components/Plugin/PluginListContainer.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ const PluginListContainer = ({
103103
const {
104104
pluginStore: { parentPluginStore, pluginVersionStore },
105105
totalCount: responseTotalCount,
106+
parentPluginIdList,
106107
} = pluginResponse
107108

108109
handlePluginDataStoreUpdate(getUpdatedPluginStore(pluginDataStore, parentPluginStore, pluginVersionStore))
@@ -117,10 +118,10 @@ const PluginListContainer = ({
117118
{} as Record<number, true>,
118119
)
119120

120-
Object.keys(parentPluginStore).forEach((key) => {
121+
parentPluginIdList.forEach((key) => {
121122
if (!newPluginListMap[key]) {
122123
newPluginList.push({
123-
parentPluginId: +key,
124+
parentPluginId: key,
124125
})
125126
newPluginListMap[key] = true
126127
}

src/Shared/Components/Plugin/service.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export const getPluginStoreData = async ({
6565
return {
6666
totalCount: result?.totalCount || 0,
6767
pluginStore,
68+
parentPluginIdList: result?.parentPlugins?.map((parentPluginDetails) => parentPluginDetails.id) || [],
6869
}
6970
} catch (error) {
7071
if (!getIsRequestAborted(error)) {

src/Shared/Components/Plugin/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ export interface GetPluginListPayloadType
165165
export interface GetPluginStoreDataReturnType {
166166
totalCount: number
167167
pluginStore: PluginDataStoreType
168+
/**
169+
* Sorted on the basis of name of latest version of parent plugin
170+
*/
171+
parentPluginIdList: number[]
168172
}
169173

170174
export interface PluginListParamsType {

0 commit comments

Comments
 (0)