Skip to content

Commit

Permalink
fix(ui): Change path to "root" when path is root directory (#14949)
Browse files Browse the repository at this point in the history
* change path to display root

Signed-off-by: Eshwar Hebbur Shivakumar <[email protected]>

* Fix inequality typo

Signed-off-by: Eshwar Hebbur Shivakumar <[email protected]>

* Fix lint issues

Signed-off-by: Eshwar Hebbur Shivakumar <[email protected]>

---------

Signed-off-by: Eshwar Hebbur Shivakumar <[email protected]>
  • Loading branch information
eshwarhs authored Feb 6, 2024
1 parent 228eda5 commit 0b22a11
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ function swap(array: any[], a: number, b: number) {
return array;
}

function processPath(path: string) {
if (path !== null && path !== undefined) {
if (path === '.') {
return '(root)';
}
return path;
}
return '';
}

export interface ApplicationSummaryProps {
app: models.Application;
updateApp: (app: models.Application, query: {validate?: boolean}) => Promise<any>;
Expand Down Expand Up @@ -239,7 +249,7 @@ export const ApplicationSummary = (props: ApplicationSummaryProps) => {
title: 'PATH',
view: (
<Revision repoUrl={source.repoURL} revision={source.targetRevision || 'HEAD'} path={source.path} isForPath={true}>
{source.path ?? ''}
{processPath(source.path)}
</Revision>
),
edit: (formApi: FormApi) =>
Expand Down

0 comments on commit 0b22a11

Please sign in to comment.