Skip to content
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

Feature/create app #362

Merged
merged 5 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/tapis-api/apps/createApp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Apps } from '@tapis/tapis-typescript';
import { apiGenerator, errorDecoder } from 'tapis-api/utils';

const createApp = (
createAppVersionRequest: Apps.CreateAppVersionRequest,
basepath: string,
jwt: string
) => {
const api: Apps.ApplicationsApi = apiGenerator<Apps.ApplicationsApi>(
Apps,
Apps.ApplicationsApi,
basepath,
jwt
);
return errorDecoder<Apps.RespBasic>(() =>
api.createAppVersion(createAppVersionRequest)
);
};

export default createApp;
1 change: 1 addition & 0 deletions src/tapis-api/apps/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { default as list } from './list';
export { default as detail } from './detail';
export { default as createApp } from './createApp';
2 changes: 2 additions & 0 deletions src/tapis-app/Apps/_Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import {
LayoutHeader,
LayoutNavWrapper,
} from 'tapis-ui/_common';
import AppsToolbar from '../_components/AppsToolbar';

import { Router } from '../_Router';

const Layout: React.FC = () => {
const header = (
<LayoutHeader>
<div>Apps</div>
<AppsToolbar />
</LayoutHeader>
);

Expand Down
20 changes: 20 additions & 0 deletions src/tapis-app/Apps/_components/AppsToolbar/AppsToolbar.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.toolbar-wrapper {
padding: 0;
margin: 0;
margin-top: 0.5em;
display: flex !important;
}

.toolbar-btn {
height: 2rem;
align-items: center;
margin-left: 0.5em;
font-size: 0.7em !important;
border-radius: 0 !important;
background-color: #f4f4f4 !important;
color: #333333 !important;
}

.toolbar-btn:disabled {
color: #999999 !important;
}
67 changes: 67 additions & 0 deletions src/tapis-app/Apps/_components/AppsToolbar/AppsToolbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import React, { useState } from 'react';
import { Button } from 'reactstrap';
import { Icon } from 'tapis-ui/_common';
import styles from './AppsToolbar.module.scss';
import { useLocation } from 'react-router-dom';
import CreateAppModal from './CreateAppModal';

type ToolbarButtonProps = {
text: string;
icon: string;
onClick: () => void;
disabled: boolean;
};

export type ToolbarModalProps = {
toggle: () => void;
};

export const ToolbarButton: React.FC<ToolbarButtonProps> = ({
text,
icon,
onClick,
disabled = true,
...rest
}) => {
return (
<div>
<Button
disabled={disabled}
onClick={onClick}
className={styles['toolbar-btn']}
{...rest}
>
<Icon name={icon}></Icon>
<span> {text}</span>
</Button>
</div>
);
};

const AppsToolbar: React.FC = () => {
const [modal, setModal] = useState<string | undefined>(undefined);
const { pathname } = useLocation();

const toggle = () => {
setModal(undefined);
};
return (
<div id="file-operation-toolbar">
{pathname && (
<div className={styles['toolbar-wrapper']}>
<ToolbarButton
text="Create a New App"
icon="add"
disabled={false}
onClick={() => setModal('createApp')}
aria-label="createApp"
/>

{modal === 'createApp' && <CreateAppModal toggle={toggle} />}
</div>
)}
</div>
);
};

export default AppsToolbar;
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.modal-settings {
max-height: 38rem;
overflow-y: scroll;
}

.item {
border: 1px dotted lightgray;
padding: 0.5em 0.5em 0.5em 0.5em;
margin-bottom: 1em;
}

.array {
border: 1px solid gray;
padding: 0.5em 0.5em 0.5em 0.5em;
margin-bottom: 0.5em;
}

.hidden {
display: none;
}

.section-divider {
margin-bottom: 100px;
}
Loading
Loading