Skip to content

Commit

Permalink
add: show latest version of app (#40)
Browse files Browse the repository at this point in the history
* add: version

* fix: add version

* fix: improve css
  • Loading branch information
mosoriob authored May 28, 2024
1 parent 76e7fae commit ddbbe35
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 50 deletions.
144 changes: 108 additions & 36 deletions src/tapis-ui/components/apps/AppListing/CookbookListing.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,22 @@
}
/* name */
tr > *:nth-child(2) {
width: 47%;
width: 37%;
}
/* owner */
/* version */
tr > *:nth-child(3) {
width: 10%;
}
/* owner */
tr > *:nth-child(4) {
width: 15%;
}
/* visibility */
tr > *:nth-child(4) {
tr > *:nth-child(5) {
width: 15%;
}
/* lastModified */
tr > *:nth-child(5) {
tr > *:nth-child(6) {
width: 20%;
}
}
Expand All @@ -43,18 +47,22 @@
}
/* name */
tr > *:nth-child(2) {
width: 47%;
width: 37%;
}
/* owner */
/* version */
tr > *:nth-child(3) {
width: 10%;
}
/* owner */
tr > *:nth-child(4) {
width: 15%;
}
/* visibility */
tr > *:nth-child(4) {
tr > *:nth-child(5) {
width: 15%;
}
/* lastModified */
tr > *:nth-child(5) {
tr > *:nth-child(6) {
width: 20%;
}
}
Expand All @@ -67,15 +75,23 @@
}
/* name */
tr > *:nth-child(2) {
width: 57%;
width: 48%;
}
/* visibility */
/* version */
tr > *:nth-child(3) {
width: 17.5%;
width: 10%;
}
/* lastModified */
/* owner */
tr > *:nth-child(4) {
width: 19.5%;
width: 15%;
}
/* visibility */
tr > *:nth-child(5) {
width: 10%;
}
/* lastModified */
tr > *:nth-child(6) {
width: 13%;
}
}
}
Expand All @@ -87,15 +103,51 @@
}
/* name */
tr > *:nth-child(2) {
width: 62%;
width: 50%;
}
/* visibility */
/* version */
tr > *:nth-child(3) {
width: 15.5%;
width: 10%;
}
/* owner */
tr > *:nth-child(4) {
width: 15%;
}
/* visibility */
tr > *:nth-child(5) {
width: 10%;
}
/* lastModified */
tr > *:nth-child(6) {
width: 10%;
}
}
}
@media only screen and (max-width: 780px) {
.app-list {
/* icon */
tr > *:nth-child(1) {
width: 5%;
}
/* name */
tr > *:nth-child(2) {
width: 40%;
}
/* version */
tr > *:nth-child(3) {
width: 10%;
}
/* owner */
tr > *:nth-child(4) {
width: 17.5%;
width: 15%;
}
/* visibility */
tr > *:nth-child(5) {
width: 10%;
}
/* lastModified */
tr > *:nth-child(6) {
width: 20%;
}
}
}
Expand All @@ -113,14 +165,18 @@
}
/* name */
tr > *:nth-child(3) {
width: 40%;
width: 35%;
}
/* visibility */
/* version */
tr > *:nth-child(4) {
width: 10%;
}
/* visibility */
tr > *:nth-child(5) {
width: 20%;
}
/* lastModified */
tr > *:nth-child(5) {
tr > *:nth-child(6) {
width: 14%;
}
}
Expand All @@ -137,14 +193,18 @@
}
/* name */
tr > *:nth-child(3) {
width: 40%;
width: 35%;
}
/* visibility */
/* version */
tr > *:nth-child(4) {
width: 10%;
}
/* visibility */
tr > *:nth-child(5) {
width: 20%;
}
/* lastModified */
tr > *:nth-child(5) {
tr > *:nth-child(6) {
width: 14%;
}
}
Expand All @@ -161,14 +221,18 @@
}
/* name */
tr > *:nth-child(3) {
width: 30%;
width: 27%;
}
/* visibility */
/* version */
tr > *:nth-child(4) {
width: 10%;
}
/* visibility */
tr > *:nth-child(5) {
width: 16.5%;
}
/* lastModified */
tr > *:nth-child(5) {
tr > *:nth-child(6) {
width: 18.5%;
}
}
Expand All @@ -185,14 +249,18 @@
}
/* name */
tr > *:nth-child(3) {
width: 59%;
width: 49%;
}
/* visibility */
/* version */
tr > *:nth-child(4) {
width: 10%;
}
/* visibility */
tr > *:nth-child(5) {
width: 14.5%;
}
/* lastModified */
tr > *:nth-child(5) {
tr > *:nth-child(6) {
width: 16.5%;
}
}
Expand All @@ -209,19 +277,23 @@
}
/* name */
tr > *:nth-child(3) {
width: 45.5%;
width: 40%;
}
/* owner */
/* version */
tr > *:nth-child(4) {
width: 14.5%;
width: 10%;
}
/* owner */
tr > *:nth-child(5) {
width: 15%;
}
/* visibility */
tr > *:nth-child(4) {
width: 14.5%;
tr > *:nth-child(6) {
width: 10%;
}
/* lastModified */
tr > *:nth-child(5) {
width: 16.5%;
tr > *:nth-child(7) {
width: 15%;
}
}
}
Expand Down
25 changes: 11 additions & 14 deletions src/tapis-ui/components/apps/AppListing/CookbookListing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ type AppListingTableProps = {
location?: string;
className?: string;
selectMode?: SelectMode;
fields?: Array<'updated' | 'isPublic' | 'owner'>;
fields?: Array<'version' | 'updated' | 'isPublic' | 'owner'>;
};

export const AppListingTable: React.FC<AppListingTableProps> = React.memo(
Expand Down Expand Up @@ -144,6 +144,13 @@ export const AppListingTable: React.FC<AppListingTableProps> = React.memo(
},
];

if (fields?.some((field) => field === 'version')) {
tableColumns.push({
Header: 'Version',
accessor: 'version',
});
}

if (fields?.some((field) => field === 'owner')) {
tableColumns.push({
Header: 'Owner',
Expand Down Expand Up @@ -229,7 +236,7 @@ interface AppListingProps {
onUnselect?: OnSelectCallback;
onNavigate?: OnNavigateCallback;
className?: string;
fields?: Array<'updated' | 'isPublic' | 'owner'>;
fields?: Array<'updated' | 'isPublic' | 'owner' | 'version'>;
selectedApps?: Array<Apps.TapisApp>;
selectMode?: SelectMode;
}
Expand All @@ -239,7 +246,7 @@ const AppListing: React.FC<AppListingProps> = ({
onUnselect = undefined,
onNavigate = undefined,
className,
fields = ['updated', 'isPublic', 'owner'],
fields = ['updated', 'isPublic', 'owner', 'version'],
selectedApps = [],
selectMode,
}) => {
Expand All @@ -249,17 +256,7 @@ const AppListing: React.FC<AppListingProps> = ({
const username = claims['tapis/username'];

// sort the apps by the owner
const apps = data?.result
? data?.result.sort((a, b) => {
if (a.owner === username) {
return -1;
}
if (b.owner === username) {
return 1;
}
return 0;
})
: [];
const apps = data?.result || [];

const selectedAppDict: SelectAppDictType = React.useMemo(() => {
const result: SelectAppDictType = {};
Expand Down

0 comments on commit ddbbe35

Please sign in to comment.