added configuration nav item to help reduce nav items w/ burnettk
This commit is contained in:
parent
b66e42d2b6
commit
606c61efa2
|
@ -1597,7 +1597,7 @@ def add_secret(body: Dict) -> Response:
|
||||||
|
|
||||||
def update_secret(key: str, body: dict) -> Response:
|
def update_secret(key: str, body: dict) -> Response:
|
||||||
"""Update secret."""
|
"""Update secret."""
|
||||||
SecretService().update_secret(key, body["value"], body["user_id"])
|
SecretService().update_secret(key, body["value"], g.user.id)
|
||||||
return Response(json.dumps({"ok": True}), status=200, mimetype="application/json")
|
return Response(json.dumps({"ok": True}), status=200, mimetype="application/json")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
import React from 'react';
|
|
||||||
import HttpService from '../services/HttpService';
|
|
||||||
import { modifyProcessModelPath } from '../helpers';
|
|
||||||
|
|
||||||
type Props = {
|
|
||||||
processGroupId: string;
|
|
||||||
processModelId: string;
|
|
||||||
onUploadedCallback?: (..._args: any[]) => any;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default class FileInput extends React.Component<Props> {
|
|
||||||
fileInput: any;
|
|
||||||
|
|
||||||
processGroupId: any;
|
|
||||||
|
|
||||||
processModelId: any;
|
|
||||||
|
|
||||||
onUploadedCallback: any;
|
|
||||||
|
|
||||||
constructor({ processGroupId, processModelId, onUploadedCallback }: Props) {
|
|
||||||
super({ processGroupId, processModelId, onUploadedCallback });
|
|
||||||
this.handleSubmit = this.handleSubmit.bind(this);
|
|
||||||
this.fileInput = React.createRef();
|
|
||||||
this.processGroupId = processGroupId;
|
|
||||||
this.processModelId = processModelId;
|
|
||||||
this.onUploadedCallback = onUploadedCallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleSubmit(event: any) {
|
|
||||||
event.preventDefault();
|
|
||||||
const modifiedProcessModelId = modifyProcessModelPath(
|
|
||||||
`${this.processGroupId}/${this.processModelId}`
|
|
||||||
);
|
|
||||||
const url = `/process-models/${modifiedProcessModelId}/files`;
|
|
||||||
const formData = new FormData();
|
|
||||||
formData.append('file', this.fileInput.current.files[0]);
|
|
||||||
formData.append('fileName', this.fileInput.current.files[0].name);
|
|
||||||
HttpService.makeCallToBackend({
|
|
||||||
path: url,
|
|
||||||
successCallback: this.onUploadedCallback,
|
|
||||||
httpMethod: 'POST',
|
|
||||||
postBody: formData,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<form onSubmit={this.handleSubmit}>
|
|
||||||
<label>
|
|
||||||
Upload file:
|
|
||||||
<input type="file" ref={this.fileInput} />
|
|
||||||
</label>
|
|
||||||
<button type="submit">Submit</button>
|
|
||||||
</form>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -44,10 +44,8 @@ export default function NavigationBar() {
|
||||||
newActiveKey = '/admin/process-instances/reports';
|
newActiveKey = '/admin/process-instances/reports';
|
||||||
} else if (location.pathname.match(/^\/admin\/process-instances\b/)) {
|
} else if (location.pathname.match(/^\/admin\/process-instances\b/)) {
|
||||||
newActiveKey = '/admin/process-instances';
|
newActiveKey = '/admin/process-instances';
|
||||||
} else if (location.pathname.match(/^\/admin\/secrets\b/)) {
|
} else if (location.pathname.match(/^\/admin\/configuration\b/)) {
|
||||||
newActiveKey = '/admin/secrets';
|
newActiveKey = '/admin/configuration';
|
||||||
} else if (location.pathname.match(/^\/admin\/authentications\b/)) {
|
|
||||||
newActiveKey = '/admin/authentications';
|
|
||||||
} else if (location.pathname === '/') {
|
} else if (location.pathname === '/') {
|
||||||
newActiveKey = '/';
|
newActiveKey = '/';
|
||||||
} else if (location.pathname.match(/^\/tasks\b/)) {
|
} else if (location.pathname.match(/^\/tasks\b/)) {
|
||||||
|
@ -112,16 +110,10 @@ export default function NavigationBar() {
|
||||||
Messages
|
Messages
|
||||||
</HeaderMenuItem>
|
</HeaderMenuItem>
|
||||||
<HeaderMenuItem
|
<HeaderMenuItem
|
||||||
href="/admin/secrets"
|
href="/admin/configuration"
|
||||||
isCurrentPage={isActivePage('/admin/secrets')}
|
isCurrentPage={isActivePage('/admin/configuration')}
|
||||||
>
|
>
|
||||||
Secrets
|
Configuration
|
||||||
</HeaderMenuItem>
|
|
||||||
<HeaderMenuItem
|
|
||||||
href="/admin/authentications"
|
|
||||||
isCurrentPage={isActivePage('/admin/authentications')}
|
|
||||||
>
|
|
||||||
Authentications
|
|
||||||
</HeaderMenuItem>
|
</HeaderMenuItem>
|
||||||
<HeaderMenuItem
|
<HeaderMenuItem
|
||||||
href="/admin/process-instances/reports"
|
href="/admin/process-instances/reports"
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
import { useEffect, useState } from 'react';
|
|
||||||
import Nav from 'react-bootstrap/Nav';
|
|
||||||
import { useLocation } from 'react-router-dom';
|
|
||||||
|
|
||||||
export default function SubNavigation() {
|
|
||||||
const location = useLocation();
|
|
||||||
const [activeKey, setActiveKey] = useState('');
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
let newActiveKey = '/admin/process-groups';
|
|
||||||
if (location.pathname.match(/^\/admin\/messages\b/)) {
|
|
||||||
newActiveKey = '/admin/messages';
|
|
||||||
} else if (
|
|
||||||
location.pathname.match(/^\/admin\/process-instances\/reports\b/)
|
|
||||||
) {
|
|
||||||
newActiveKey = '/admin/process-instances/reports';
|
|
||||||
} else if (location.pathname.match(/^\/admin\/process-instances\b/)) {
|
|
||||||
newActiveKey = '/admin/process-instances';
|
|
||||||
} else if (location.pathname.match(/^\/admin\/secrets\b/)) {
|
|
||||||
newActiveKey = '/admin/secrets';
|
|
||||||
} else if (location.pathname.match(/^\/admin\/authentications\b/)) {
|
|
||||||
newActiveKey = '/admin/authentications';
|
|
||||||
} else if (location.pathname === '/') {
|
|
||||||
newActiveKey = '/';
|
|
||||||
} else if (location.pathname.match(/^\/tasks\b/)) {
|
|
||||||
newActiveKey = '/';
|
|
||||||
}
|
|
||||||
setActiveKey(newActiveKey);
|
|
||||||
}, [location]);
|
|
||||||
|
|
||||||
if (activeKey) {
|
|
||||||
return (
|
|
||||||
<Nav variant="tabs" activeKey={activeKey}>
|
|
||||||
<Nav.Item data-qa="nav-home">
|
|
||||||
<Nav.Link href="/">Home</Nav.Link>
|
|
||||||
</Nav.Item>
|
|
||||||
<Nav.Item>
|
|
||||||
<Nav.Link href="/admin/process-groups">Process Models</Nav.Link>
|
|
||||||
</Nav.Item>
|
|
||||||
<Nav.Item>
|
|
||||||
<Nav.Link href="/admin/process-instances">Process Instances</Nav.Link>
|
|
||||||
</Nav.Item>
|
|
||||||
<Nav.Item>
|
|
||||||
<Nav.Link href="/admin/messages">Messages</Nav.Link>
|
|
||||||
</Nav.Item>
|
|
||||||
<Nav.Item>
|
|
||||||
<Nav.Link href="/admin/secrets">Secrets</Nav.Link>
|
|
||||||
</Nav.Item>
|
|
||||||
<Nav.Item>
|
|
||||||
<Nav.Link href="/admin/authentications">Authentications</Nav.Link>
|
|
||||||
</Nav.Item>
|
|
||||||
<Nav.Item>
|
|
||||||
<Nav.Link href="/admin/process-instances/reports">Reports</Nav.Link>
|
|
||||||
</Nav.Item>
|
|
||||||
</Nav>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
|
@ -24,6 +24,7 @@ import SecretList from './SecretList';
|
||||||
import SecretNew from './SecretNew';
|
import SecretNew from './SecretNew';
|
||||||
import SecretShow from './SecretShow';
|
import SecretShow from './SecretShow';
|
||||||
import AuthenticationList from './AuthenticationList';
|
import AuthenticationList from './AuthenticationList';
|
||||||
|
import Configuration from './Configuration';
|
||||||
|
|
||||||
export default function AdminRoutes() {
|
export default function AdminRoutes() {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
@ -110,10 +111,7 @@ export default function AdminRoutes() {
|
||||||
/>
|
/>
|
||||||
<Route path="process-instances" element={<ProcessInstanceList />} />
|
<Route path="process-instances" element={<ProcessInstanceList />} />
|
||||||
<Route path="messages" element={<MessageInstanceList />} />
|
<Route path="messages" element={<MessageInstanceList />} />
|
||||||
<Route path="secrets" element={<SecretList />} />
|
<Route path="/configuration/*" element={<Configuration />} />
|
||||||
<Route path="secrets/new" element={<SecretNew />} />
|
|
||||||
<Route path="secrets/:key" element={<SecretShow />} />
|
|
||||||
<Route path="authentications" element={<AuthenticationList />} />
|
|
||||||
</Routes>
|
</Routes>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
import { useContext, useEffect, useState } from 'react';
|
||||||
|
import { Route, Routes, useLocation, useNavigate } from 'react-router-dom';
|
||||||
|
// @ts-ignore
|
||||||
|
import { Tabs, TabList, Tab } from '@carbon/react';
|
||||||
|
import TaskShow from './TaskShow';
|
||||||
|
import ErrorContext from '../contexts/ErrorContext';
|
||||||
|
import MyTasks from './MyTasks';
|
||||||
|
import GroupedTasks from './GroupedTasks';
|
||||||
|
import CompletedInstances from './CompletedInstances';
|
||||||
|
import SecretList from './SecretList';
|
||||||
|
import SecretNew from './SecretNew';
|
||||||
|
import SecretShow from './SecretShow';
|
||||||
|
import AuthenticationList from './AuthenticationList';
|
||||||
|
|
||||||
|
export default function Configuration() {
|
||||||
|
const location = useLocation();
|
||||||
|
const setErrorMessage = (useContext as any)(ErrorContext)[1];
|
||||||
|
const [selectedTabIndex, setSelectedTabIndex] = useState<number>(0);
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setErrorMessage(null);
|
||||||
|
let newSelectedTabIndex = 0;
|
||||||
|
if (location.pathname.match(/^\/admin\/configuration\/authentications\b/)) {
|
||||||
|
newSelectedTabIndex = 1;
|
||||||
|
}
|
||||||
|
setSelectedTabIndex(newSelectedTabIndex);
|
||||||
|
}, [location, setErrorMessage]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Tabs selectedIndex={selectedTabIndex}>
|
||||||
|
<TabList aria-label="List of tabs">
|
||||||
|
<Tab onClick={() => navigate('/admin/configuration/secrets')}>
|
||||||
|
Secrets
|
||||||
|
</Tab>
|
||||||
|
<Tab onClick={() => navigate('/admin/configuration/authentications')}>
|
||||||
|
Authentications
|
||||||
|
</Tab>
|
||||||
|
</TabList>
|
||||||
|
</Tabs>
|
||||||
|
<br />
|
||||||
|
<Routes>
|
||||||
|
<Route path="/" element={<SecretList />} />
|
||||||
|
<Route path="secrets" element={<SecretList />} />
|
||||||
|
<Route path="secrets/new" element={<SecretNew />} />
|
||||||
|
<Route path="secrets/:key" element={<SecretShow />} />
|
||||||
|
<Route path="authentications" element={<AuthenticationList />} />
|
||||||
|
</Routes>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
|
@ -122,7 +122,7 @@ export default function MyTasks() {
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h1>Processes I can start</h1>
|
<h1>Recently viewed process models</h1>
|
||||||
<Table striped bordered>
|
<Table striped bordered>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -169,6 +169,7 @@ export default function MyTasks() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{tasksWaitingForMe}
|
{tasksWaitingForMe}
|
||||||
|
<br />
|
||||||
{relevantProcessModelSection}
|
{relevantProcessModelSection}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
@ -30,7 +30,7 @@ import {
|
||||||
import ProcessBreadcrumb from '../components/ProcessBreadcrumb';
|
import ProcessBreadcrumb from '../components/ProcessBreadcrumb';
|
||||||
import HttpService from '../services/HttpService';
|
import HttpService from '../services/HttpService';
|
||||||
import ErrorContext from '../contexts/ErrorContext';
|
import ErrorContext from '../contexts/ErrorContext';
|
||||||
import { modifyProcessModelPath, unModifyProcessModelPath } from '../helpers';
|
import { modifyProcessModelPath } from '../helpers';
|
||||||
import { ProcessFile, ProcessModel, RecentProcessModel } from '../interfaces';
|
import { ProcessFile, ProcessModel, RecentProcessModel } from '../interfaces';
|
||||||
import ButtonWithConfirmation from '../components/ButtonWithConfirmation';
|
import ButtonWithConfirmation from '../components/ButtonWithConfirmation';
|
||||||
import ProcessInstanceListTable from '../components/ProcessInstanceListTable';
|
import ProcessInstanceListTable from '../components/ProcessInstanceListTable';
|
||||||
|
@ -353,27 +353,6 @@ export default function ProcessModelShow() {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const processInstancesUl = () => {
|
|
||||||
const unmodifiedProcessModelId: String = unModifyProcessModelPath(
|
|
||||||
`${params.process_model_id}`
|
|
||||||
);
|
|
||||||
if (!processModel) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<Link
|
|
||||||
to={`/admin/process-instances?process_model_identifier=${unmodifiedProcessModelId}`}
|
|
||||||
data-qa="process-instance-list-link"
|
|
||||||
>
|
|
||||||
List
|
|
||||||
</Link>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleFileUploadCancel = () => {
|
const handleFileUploadCancel = () => {
|
||||||
setShowFileUploadModal(false);
|
setShowFileUploadModal(false);
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,12 +42,12 @@ export default function SecretList() {
|
||||||
return (
|
return (
|
||||||
<tr key={(row as any).key}>
|
<tr key={(row as any).key}>
|
||||||
<td>
|
<td>
|
||||||
<Link to={`/admin/secrets/${(row as any).key}`}>
|
<Link to={`/admin/configuration/secrets/${(row as any).key}`}>
|
||||||
{(row as any).id}
|
{(row as any).id}
|
||||||
</Link>
|
</Link>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Link to={`/admin/secrets/${(row as any).key}`}>
|
<Link to={`/admin/configuration/secrets/${(row as any).key}`}>
|
||||||
{(row as any).key}
|
{(row as any).key}
|
||||||
</Link>
|
</Link>
|
||||||
</td>
|
</td>
|
||||||
|
@ -96,7 +96,7 @@ export default function SecretList() {
|
||||||
<div>
|
<div>
|
||||||
<h1>Secrets</h1>
|
<h1>Secrets</h1>
|
||||||
{SecretsDisplayArea()}
|
{SecretsDisplayArea()}
|
||||||
<Button href="/admin/secrets/new">Add a secret</Button>
|
<Button href="/admin/configuration/secrets/new">Add a secret</Button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,11 @@ export default function SecretNew() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const navigateToSecret = (_result: any) => {
|
const navigateToSecret = (_result: any) => {
|
||||||
navigate(`/admin/secrets/${key}`);
|
navigate(`/admin/configuration/secrets/${key}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const navigateToSecrets = () => {
|
const navigateToSecrets = () => {
|
||||||
navigate(`/admin/secrets`);
|
navigate(`/admin/configuration/secrets`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeSpacesToDash = (someString: string) => {
|
const changeSpacesToDash = (someString: string) => {
|
||||||
|
|
|
@ -26,10 +26,6 @@ export default function SecretShow() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// const reloadSecret = (_result: any) => {
|
|
||||||
// window.location.reload();
|
|
||||||
// };
|
|
||||||
|
|
||||||
const updateSecretValue = () => {
|
const updateSecretValue = () => {
|
||||||
if (secret && secretValue) {
|
if (secret && secretValue) {
|
||||||
secret.value = secretValue;
|
secret.value = secretValue;
|
||||||
|
@ -48,7 +44,7 @@ export default function SecretShow() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const navigateToSecrets = (_result: any) => {
|
const navigateToSecrets = (_result: any) => {
|
||||||
navigate(`/admin/secrets`);
|
navigate(`/admin/configuration/secrets`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteSecret = () => {
|
const deleteSecret = () => {
|
||||||
|
|
Loading…
Reference in New Issue