mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2026-01-06 04:26:57 +00:00
fix(ui): sort services on create page (#7745)
* fix(ui): sort services on create page * address review comments
This commit is contained in:
parent
92aea1c179
commit
bcbe1ec8e5
@ -117,7 +117,9 @@ const SelectServiceType = ({
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<p className="break-word text-center">{type}</p>
|
||||
<p className="break-word text-center">
|
||||
{type.includes('Custom') ? startCase(type) : type}
|
||||
</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@ -66,7 +66,8 @@ const TeamsSelectable = ({
|
||||
|
||||
return (
|
||||
<TreeNode disabled={disabled} key={value} title={teamName} value={value}>
|
||||
{team.children && team.children.map((n) => getTreeNodes(n))}
|
||||
{team.children &&
|
||||
team.children.map((n: TeamHierarchy) => getTreeNodes(n))}
|
||||
</TreeNode>
|
||||
);
|
||||
};
|
||||
|
||||
@ -70,6 +70,7 @@ import { DatabaseServiceType } from '../generated/entity/services/databaseServic
|
||||
import { MessagingServiceType } from '../generated/entity/services/messagingService';
|
||||
import { MlModelServiceType } from '../generated/entity/services/mlmodelService';
|
||||
import { PipelineServiceType } from '../generated/entity/services/pipelineService';
|
||||
import { customServiceComparator } from '../utils/StringsUtils';
|
||||
|
||||
export const NoDataFoundPlaceHolder = noDataFound;
|
||||
export const AddPlaceHolder = addPlaceHolder;
|
||||
@ -126,12 +127,23 @@ export const PIPELINE_DEFAULT = pipelineDefault;
|
||||
export const PLUS = plus;
|
||||
export const NOSERVICE = noService;
|
||||
export const excludedService = [MlModelServiceType.Sklearn];
|
||||
|
||||
export const serviceTypes: Record<ServiceTypes, Array<string>> = {
|
||||
databaseServices: Object.values(DatabaseServiceType),
|
||||
messagingServices: Object.values(MessagingServiceType),
|
||||
dashboardServices: Object.values(DashboardServiceType),
|
||||
pipelineServices: Object.values(PipelineServiceType),
|
||||
mlmodelServices: Object.values(MlModelServiceType),
|
||||
databaseServices: (Object.values(DatabaseServiceType) as string[]).sort(
|
||||
customServiceComparator
|
||||
),
|
||||
messagingServices: (Object.values(MessagingServiceType) as string[]).sort(
|
||||
customServiceComparator
|
||||
),
|
||||
dashboardServices: (Object.values(DashboardServiceType) as string[]).sort(
|
||||
customServiceComparator
|
||||
),
|
||||
pipelineServices: (Object.values(PipelineServiceType) as string[]).sort(
|
||||
customServiceComparator
|
||||
),
|
||||
mlmodelServices: (Object.values(MlModelServiceType) as string[]).sort(
|
||||
customServiceComparator
|
||||
),
|
||||
};
|
||||
|
||||
export const arrServiceTypes: Array<ServiceTypes> = [
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
justify-content: space-between;
|
||||
}
|
||||
.break-word {
|
||||
word-break: break-all;
|
||||
word-break: break-word;
|
||||
}
|
||||
.justify-center {
|
||||
justify-content: center;
|
||||
|
||||
@ -161,3 +161,17 @@ export const getDecodedFqn = (fqn: string, plusAsSpace = false) => {
|
||||
export const isExternalUrl = (url = '') => {
|
||||
return /^https?:\/\//.test(url);
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param a compare value one
|
||||
* @param b compare value two
|
||||
* @returns sorted array (A-Z) which will have custom value at last
|
||||
*/
|
||||
export const customServiceComparator = (a: string, b: string): number => {
|
||||
if (a.includes('Custom') || b.includes('Custom')) {
|
||||
return a.includes('Custom') ? 1 : -1;
|
||||
} else {
|
||||
return a.localeCompare(b);
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user