-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(bulk-import): adding sorting based on column in /imports #178
base: main
Are you sure you want to change the base?
Changes from all commits
67f413d
8b6d5cc
57e2c59
59bd3e3
d21cfb2
de3defc
817b20a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@red-hat-developer-hub/backstage-plugin-bulk-import-backend': patch | ||
'@red-hat-developer-hub/backstage-plugin-bulk-import': patch | ||
--- | ||
|
||
Sort based on column name |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ | |
export * from './auth'; | ||
export * from './loggingUtils'; | ||
export * from './pagination'; | ||
export * from './utils'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright 2024 The Backstage Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
export function getNestedValue<T>(obj: T, path: string): any { | ||
return path | ||
.split('.') | ||
.reduce( | ||
(acc, key) => | ||
acc && (acc as Record<string, any>)[key] | ||
? (acc as Record<string, any>)[key] | ||
: undefined, | ||
obj, | ||
); | ||
} |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -176,7 +176,8 @@ paths: | |||
- $ref: '#/components/parameters/sizePerIntegrationQueryParamDeprecated' | ||||
- $ref: '#/components/parameters/pageQueryParam' | ||||
- $ref: '#/components/parameters/sizeQueryParam' | ||||
|
||||
- $ref: '#/components/parameters/sortOrderQueryParam' | ||||
- $ref: '#/components/parameters/sortColumnQueryParam' | ||||
- $ref: '#/components/parameters/searchQueryParam' | ||||
|
||||
responses: | ||||
|
@@ -360,6 +361,40 @@ components: | |||
schema: | ||||
type: integer | ||||
default: 1 | ||||
sortColumnQueryParam: | ||||
in: query | ||||
name: sortColumn | ||||
description: | | ||||
The allowed values for sorting columns: | ||||
- `repository.name`: Sort by repository name. | ||||
- `repository.organization`: Sort by organization URL. | ||||
- `repository.url`: Sort by repository URL. | ||||
- `lastUpdate`: Sort by the last time the catalog-info.yaml was updated. | ||||
- `status`: Sort by the status of the catalog-info.yaml. | ||||
required: false | ||||
schema: | ||||
enum: | ||||
its-mitesh-kumar marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
- repository.name | ||||
- repository.organization | ||||
- repository.url | ||||
- lastUpdate | ||||
- status | ||||
- '' | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to support empty columnName . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it make sense to sort by empty column name? What does it mean sorting by empty column name? |
||||
default: repository.name | ||||
|
||||
sortOrderQueryParam: | ||||
in: query | ||||
name: sortOrder | ||||
description: The order of sorting asc for ascending or desc for descending | ||||
required: false | ||||
schema: | ||||
type: string | ||||
enum: | ||||
- asc | ||||
- desc | ||||
- '' | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
default: asc | ||||
|
||||
sizePerIntegrationQueryParamDeprecated: | ||||
in: query | ||||
name: sizePerIntegration | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got permission denied for making changes. Just remove this change and prettier should be fixed :).