Skip to content

Commit

Permalink
Fix errors caused by changes to the Systems OAS
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandf committed Jan 30, 2024
1 parent 2993c69 commit 56b7881
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 28 deletions.
4 changes: 2 additions & 2 deletions src/fixtures/systems.fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ export const singularityRuntime: Systems.JobRuntime = {
version: '0.0.1',
};

export const jobRuntimes: Set<Systems.JobRuntime> = new Set([
export const jobRuntimes: Array<Systems.JobRuntime> = [
{ ...dockerRuntime },
{ ...singularityRuntime },
]);
];

export const tapisSystem: Systems.TapisSystem = {
tenant: 'tacc',
Expand Down
7 changes: 3 additions & 4 deletions src/tapis-api/systems/makeNewSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import { Systems } from '@tapis/tapis-typescript';
import { apiGenerator, errorDecoder } from 'tapis-api/utils';

const makeNewSystem = (
reqCreateSystem: Systems.ReqCreateSystem,
reqCreateSystem: Systems.CreateSystemRequest,
basePath: string,
jwt: string,
skipCredentialCheck?: boolean
jwt: string
) => {
const api: Systems.SystemsApi = apiGenerator<Systems.SystemsApi>(
Systems,
Expand All @@ -14,7 +13,7 @@ const makeNewSystem = (
jwt
);
return errorDecoder<Systems.RespBasic>(() =>
api.createSystem({ reqCreateSystem, skipCredentialCheck })
api.createSystem(reqCreateSystem)
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ const AdvancedSettings: React.FC<AdvancedSettingsProp> = ({ simplified }) => {
//reading if the systemType is S3 at its current state
const isS3 = useMemo(
() =>
(values as Partial<Systems.ReqCreateSystem>).systemType ===
(values as Partial<Systems.ReqPostSystem>).systemType ===
SystemTypeEnum.S3,
[values]
);

//reading the runtimeType at its current state
const runtimeType = (values as Partial<Systems.ReqCreateSystem>).jobRuntimes;
const runtimeType = (values as Partial<Systems.ReqPostSystem>).jobRuntimes;

if (simplified) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { LogicalQueue } from '@tapis/tapis-typescript-systems';
type BatchLQFieldProps = {
item: LogicalQueue;
index: number;
remove: (index: number) => Systems.ReqCreateSystem | undefined;
remove: (index: number) => Systems.ReqPostSystem | undefined;
};

const BatchLogicalQueuesField: React.FC<BatchLQFieldProps> = ({
Expand Down Expand Up @@ -131,7 +131,7 @@ const BatchLogicalQueuesInputs: React.FC<{
const { values } = useFormikContext();

const batchLogicalQueues =
(values as Partial<Systems.ReqCreateSystem>)?.batchLogicalQueues ?? [];
(values as Partial<Systems.ReqPostSystem>)?.batchLogicalQueues ?? [];

return (
<Collapse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ const BatchSettings: React.FC = () => {

//reading the canRunBatch at its current state
const canRunBatch = useMemo(
() => (values as Partial<Systems.ReqCreateSystem>).canRunBatch,
() => (values as Partial<Systems.ReqPostSystem>).canRunBatch,
[values]
);
//reading if the systemType is Linux at its current state
const isLinux = useMemo(
() =>
(values as Partial<Systems.ReqCreateSystem>).systemType ===
(values as Partial<Systems.ReqPostSystem>).systemType ===
SystemTypeEnum.Linux,
[values]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ const DtnSettings: React.FC = () => {

//reading the isDtn at its current state
const isDtn = useMemo(
() => (values as Partial<Systems.ReqCreateSystem>).isDtn,
() => (values as Partial<Systems.ReqPostSystem>).isDtn,
[values]
);
//reading the canExec at its current state
const canExec = useMemo(
() => (values as Partial<Systems.ReqCreateSystem>).canExec,
() => (values as Partial<Systems.ReqPostSystem>).canExec,
[values]
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const datatypes = Object.values(DatatypeEnum);
type JobCapabilitiesFieldProps = {
item: Capability;
index: number;
remove: (index: number) => Systems.ReqCreateSystem | undefined;
remove: (index: number) => Systems.ReqPostSystem | undefined;
};

const JobCapabilitiesField: React.FC<JobCapabilitiesFieldProps> = ({
Expand Down Expand Up @@ -90,7 +90,7 @@ const JobCapabilitiesInputs: React.FC<{ arrayHelpers: FieldArrayRenderProps }> =
const { values } = useFormikContext();

const jobCapabilities =
(values as Partial<Systems.ReqCreateSystem>)?.jobCapabilities ?? [];
(values as Partial<Systems.ReqPostSystem>)?.jobCapabilities ?? [];

return (
<Collapse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { KeyValuePair } from '@tapis/tapis-typescript-systems';
type JobEnvVariablesFieldProps = {
item: KeyValuePair;
index: number;
remove: (index: number) => Systems.ReqCreateSystem | undefined;
remove: (index: number) => Systems.ReqPostSystem | undefined;
};

const JobEnvVariablesField: React.FC<JobEnvVariablesFieldProps> = ({
Expand Down Expand Up @@ -57,7 +57,7 @@ const JobEnvVariablesInputs: React.FC<{ arrayHelpers: FieldArrayRenderProps }> =
const { values } = useFormikContext();

const jobEnvVariables =
(values as Partial<Systems.ReqCreateSystem>)?.jobEnvVariables ?? [];
(values as Partial<Systems.ReqPostSystem>)?.jobEnvVariables ?? [];

return (
<Collapse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const ProxySettings: React.FC = () => {

//reading the useProxy at its current state
const useProxy = useMemo(
() => (values as Partial<Systems.ReqCreateSystem>).useProxy,
() => (values as Partial<Systems.ReqPostSystem>).useProxy,
[values]
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { FieldArray, useFormikContext, FieldArrayRenderProps } from 'formik';
type TagsFieldProps = {
item: string;
index: number;
remove: (index: number) => Systems.ReqCreateSystem | undefined;
remove: (index: number) => Systems.ReqPostSystem | undefined;
};
const TagsField: React.FC<TagsFieldProps> = ({ item, index, remove }) => {
return (
Expand All @@ -32,7 +32,7 @@ const TagsInputs: React.FC<{ arrayHelpers: FieldArrayRenderProps }> = ({
}) => {
const { values } = useFormikContext();

const tags = (values as Partial<Systems.ReqCreateSystem>)?.tags ?? [];
const tags = (values as Partial<Systems.ReqPostSystem>)?.tags ?? [];

return (
<Collapse
Expand Down
6 changes: 3 additions & 3 deletions src/tapis-hooks/systems/useMakeNewSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useTapisConfig } from '../context';
import QueryKeys from './queryKeys';

type MkNewSystemHookParams = {
reqPostSystem: Systems.ReqCreateSystem;
reqPostSystem: Systems.ReqPostSystem;
skipCredentialCheck: boolean;
};

Expand All @@ -21,7 +21,7 @@ const useMakeNewSystem = () => {
useMutation<Systems.RespBasic, Error, MkNewSystemHookParams>(
[QueryKeys.makeNewSystem, basePath, jwt],
({ reqPostSystem, skipCredentialCheck }) =>
makeNewSystem(reqPostSystem, basePath, jwt, skipCredentialCheck)
makeNewSystem({reqPostSystem, skipCredentialCheck}, basePath, jwt)
);

// Return hook object with loading states and login function
Expand All @@ -33,7 +33,7 @@ const useMakeNewSystem = () => {
error,
reset,
makeNewSystem: (
reqPostSystem: Systems.ReqCreateSystem,
reqPostSystem: Systems.ReqPostSystem,
skipCredentialCheck: boolean = true,
// react-query options to allow callbacks such as onSuccess
options?: MutateOptions<Systems.RespBasic, Error, MkNewSystemHookParams>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ const SchedulerProfiles: React.FC = () => {
({
name,
description,
moduleLoadCommand,
hiddenOptions,
modulesToLoad,
moduleLoads,
owner,
tenant,
}) => (
Expand All @@ -77,8 +76,7 @@ const SchedulerProfiles: React.FC = () => {
<div>{description}</div>
<DescriptionList
data={{
moduleLoadCommand,
modulesToLoad,
moduleLoads,
hiddenOptions,
owner,
tenant,
Expand Down

0 comments on commit 56b7881

Please sign in to comment.