Skip to content

Commit

Permalink
fix: improve headers (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
mosoriob authored May 20, 2024
1 parent d260b79 commit dd67020
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
8 changes: 1 addition & 7 deletions src/tapis-app/Apps/AppDetail/_Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,13 @@ const Layout: React.FC<{ appId: string; appVersion: string }> = ({
appId,
appVersion,
}) => {
const header = (
<LayoutHeader type={'sub-header'}>
{appId} - {appVersion}
</LayoutHeader>
);

const body = (
<div style={{ flex: 1 }}>
<AppDetail appId={appId} appVersion={appVersion} />
</div>
);

return <PageLayout top={header} right={body} />;
return <PageLayout right={body} />;
};

export default React.memo(Layout);
2 changes: 1 addition & 1 deletion src/tapis-app/Apps/_Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const Layout: React.FC = () => {

return (
<AppsProvider>
<PageLayout top={header} right={body} />;
<PageLayout top={header} right={body} />
</AppsProvider>
);
};
Expand Down
4 changes: 4 additions & 0 deletions src/tapis-ui/components/apps/AppDetail/AppDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { QueryWrapper } from 'tapis-ui/_wrappers';
import { useDetail as useAppDetail } from 'tapis-hooks/apps';
import Markdown from 'react-markdown';
import { LayoutHeader } from 'tapis-ui/_common';

type AppDetailProps = {
appId: string;
Expand All @@ -21,6 +22,9 @@ const AppDetail: React.FC<AppDetailProps> = ({ appId, appVersion }) => {
const notes = app?.notes as AppDetailNotes;
return (
<QueryWrapper isLoading={isLoading} error={error}>
<LayoutHeader type={'sub-header'}>
{notes && notes.label ? notes.label : appId} - {appVersion}
</LayoutHeader>
{notes && notes.helpTextMarkdown ? (
<Viewer text={notes.helpTextMarkdown} />
) : (
Expand Down
17 changes: 16 additions & 1 deletion src/tapis-ui/components/apps/AppListing/CookbookListing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { faSquare } from '@fortawesome/free-regular-svg-icons';
import styles from './CookbookListing.module.scss';
import { formatDateTimeFromValue } from 'utils/timeFormat';
import { Link } from 'react-router-dom';
import { useTapisConfig } from 'tapis-hooks';

export type OnSelectCallback = (apps: Array<Apps.TapisApp>) => any;
export type OnNavigateCallback = (app: Apps.TapisApp) => any;
Expand Down Expand Up @@ -244,7 +245,21 @@ const AppListing: React.FC<AppListingProps> = ({
}) => {
const { isLoading, error, data } = useList();

const apps: Array<Apps.TapisApp> = data?.result ?? [];
const { claims } = useTapisConfig();
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 selectedAppDict: SelectAppDictType = React.useMemo(() => {
const result: SelectAppDictType = {};
Expand Down
19 changes: 3 additions & 16 deletions src/tapis-ui/components/apps/AppNotesEdit/AppNotesEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,6 @@ async function convertMarkdownToHtml(doc: string) {
return String(file);
}

type AppDetailNotes = {
icon: string;
label: string;
helpUrl: string;
category: string;
helpText: string;
helpTextHtml: string;
helpTextMarkdown: string;
queueFilter: string[];
isInteractive: boolean;
hideNodeCountAndCoresPerNode: boolean;
};

type AppEditorProps = {
app: Apps.TapisApp;
};
Expand All @@ -51,7 +38,7 @@ const AppEditor = ({ app }: AppEditorProps) => {
const { submit, isLoading, error, isSuccess, reset } = usePatch();
const notes = app.notes as AppDetailNotes;

const initText = notes.helpTextMarkdown;
const initText = notes.helpTextMarkdown || notes.helpText;
const [text, setText] = React.useState(initText);

const editorTab = (
Expand Down Expand Up @@ -96,8 +83,8 @@ const AppEditor = ({ app }: AppEditorProps) => {
icon="save"
disabled={!hasPermissions}
onClick={async () => {
const helpText = await convertMarkdownToHtml(text);
const helpTextHtml = helpText;
const helpTextHtml = await convertMarkdownToHtml(text);
const helpText = helpTextHtml;
const helpTextMarkdown = text;
submit({
appId: app.id as string,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/resloveBasePath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const resolveBasePath = () => {
// .replace(/^https:\/\/ui\./, 'https://');
// Direct request from local dev env to dev.develop
if (/127\.0\.0\.1|localhost|0\.0\.0\.0/.test(baseUrl)) {
return 'https://tacc.tapis.io';
return 'https://portals.tapis.io';
}
return 'https://portals.tapis.io';
};

0 comments on commit dd67020

Please sign in to comment.