process MR feedback

This commit is contained in:
Maarten de Waard 2022-10-05 14:45:18 +02:00
parent 6f5ddcf527
commit 79103c21ff
No known key found for this signature in database
GPG key ID: 1D3E893A657CC8DA
5 changed files with 28 additions and 20 deletions

View file

@ -1 +1 @@
Access documentation and forum Access documentation website

View file

@ -11,13 +11,15 @@ import { showToast, ToastType } from 'src/common/util/show-toast';
import _, { debounce } from 'lodash'; import _, { debounce } from 'lodash';
import { Table } from 'src/components'; import { Table } from 'src/components';
import { App, AppStatusEnum, useApps } from 'src/services/apps'; import { App, AppStatusEnum, useApps } from 'src/services/apps';
import { AppInstallModal } from './components'; // import { AppInstallModal } from './components';
import { getConstForStatus } from './consts'; import { getConstForStatus } from './consts';
export const Apps: React.FC = () => { export const Apps: React.FC = () => {
// If you want to enable the App Install button again, uncomment this:
// const [installModalOpen, setInstallModalOpen] = useState(false);
// const [appSlug, setAppSlug] = useState(null);
const [search, setSearch] = useState(''); const [search, setSearch] = useState('');
const [installModalOpen, setInstallModalOpen] = useState(false);
const [appSlug] = useState(null);
const { apps, appTableLoading, loadApps } = useApps(); const { apps, appTableLoading, loadApps } = useApps();
const handleSearch = useCallback((event: any) => { const handleSearch = useCallback((event: any) => {
@ -80,8 +82,7 @@ export const Apps: React.FC = () => {
}, },
width: 'auto', width: 'auto',
}, },
// Uncomment this to have an "Install" or "Configure" button for // If you want to enable the App Install button again, uncomment this:
// applications.
// //
// We need to implement installation and configuration in the back-end to be // We need to implement installation and configuration in the back-end to be
// able to use those buttons. // able to use those buttons.
@ -94,12 +95,9 @@ export const Apps: React.FC = () => {
// return null; // return null;
// } // }
// const { slug } = e.cell.row.original; // const { slug } = e.cell.row.original;
// let buttonFuntion = () => navigate(`/apps/${slug}`); // let buttonFunction = () => navigate(`/apps/${slug}`);
// if (appStatus === AppStatusEnum.NotInstalled) { // if (appStatus === AppStatusEnum.NotInstalled) {
// buttonFuntion = () => { // buttonFunction = () => {
// // To make this work, change the `useState` call on top of this
// // file to this:
// // const [appSlug, setAppSlug] = useState(null);
// setAppSlug(slug); // setAppSlug(slug);
// setInstallModalOpen(true); // setInstallModalOpen(true);
// }; // };
@ -107,7 +105,7 @@ export const Apps: React.FC = () => {
// return ( // return (
// <div className="text-right opacity-0 group-hover:opacity-100 transition-opacity"> // <div className="text-right opacity-0 group-hover:opacity-100 transition-opacity">
// <button // <button
// onClick={buttonFuntion} // onClick={buttonFunction}
// type="button" // type="button"
// className="inline-flex items-center px-4 py-2 border border-gray-200 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500" // className="inline-flex items-center px-4 py-2 border border-gray-200 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500"
// > // >
@ -168,9 +166,13 @@ export const Apps: React.FC = () => {
</div> </div>
</div> </div>
{installModalOpen && ( {
<AppInstallModal appSlug={appSlug} onClose={() => setInstallModalOpen(false)} open={installModalOpen} /> // If you want to enable the App Install button again, uncomment this:
)} //
// installModalOpen && (
// <AppInstallModal appSlug={appSlug} onClose={() => setInstallModalOpen(false)} open={installModalOpen} />
// )
}
</div> </div>
); );
}; };

View file

@ -30,7 +30,7 @@ export const AdvancedTab = () => {
} }
}; };
const vertifyCode = () => { const verifyCode = () => {
if (isConfigurationValid()) { if (isConfigurationValid()) {
showToast('Configuration is valid.', ToastType.Success); showToast('Configuration is valid.', ToastType.Success);
} else { } else {
@ -161,7 +161,7 @@ export const AdvancedTab = () => {
<button <button
type="button" type="button"
onClick={vertifyCode} onClick={verifyCode}
className="mr-3 inline-flex items-center px-4 py-2 shadow-sm text-sm font-medium rounded-md text-primary-700 bg-primary-100 hover:bg-primary-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500" className="mr-3 inline-flex items-center px-4 py-2 shadow-sm text-sm font-medium rounded-md text-primary-700 bg-primary-100 hover:bg-primary-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500"
> >
Verify Verify

View file

@ -9,7 +9,7 @@ import React, { useEffect } from 'react';
import { useApps } from 'src/services/apps'; import { useApps } from 'src/services/apps';
import { AppStatusEnum } from 'src/services/apps/types'; import { AppStatusEnum } from 'src/services/apps/types';
import { DashboardCard, DashboardUtility } from './components'; import { DashboardCard, DashboardUtility } from './components';
import { DASHBOARD_QUICK_ACCESS } from './consts'; import { DASHBOARD_QUICK_ACCESS, HIDDEN_APPS, UTILITY_APPS } from './consts';
export const Dashboard: React.FC = () => { export const Dashboard: React.FC = () => {
const host = window.location.hostname; const host = window.location.hostname;
@ -35,7 +35,7 @@ export const Dashboard: React.FC = () => {
<div className="max-w-7xl mx-auto py-4 px-3 sm:px-6 lg:px-8 h-full flex-grow"> <div className="max-w-7xl mx-auto py-4 px-3 sm:px-6 lg:px-8 h-full flex-grow">
<div className="grid grid-cols-1 md:grid-cols-2 md:gap-4 lg:grid-cols-4 mb-10"> <div className="grid grid-cols-1 md:grid-cols-2 md:gap-4 lg:grid-cols-4 mb-10">
{apps {apps
.filter((app) => ['dashboard', 'monitoring'].indexOf(app.slug) === -1) .filter((app) => HIDDEN_APPS.concat(UTILITY_APPS).indexOf(app.slug) === -1)
.filter((app) => app.status !== AppStatusEnum.NotInstalled) .filter((app) => app.status !== AppStatusEnum.NotInstalled)
.map((app) => ( .map((app) => (
<DashboardCard app={app} key={app.name} /> <DashboardCard app={app} key={app.name} />
@ -51,7 +51,7 @@ export const Dashboard: React.FC = () => {
<DashboardUtility item={item} key={item.name} /> <DashboardUtility item={item} key={item.name} />
))} ))}
{apps {apps
.filter((app) => app.slug === 'monitoring' && app.url !== null) .filter((app) => UTILITY_APPS.indexOf(app.slug) !== -1 && app.url !== null)
.filter((app) => app.status !== AppStatusEnum.NotInstalled) .filter((app) => app.status !== AppStatusEnum.NotInstalled)
.map((app) => ( .map((app) => (
<DashboardUtility item={app} key={app.name} /> <DashboardUtility item={app} key={app.name} />

View file

@ -8,3 +8,9 @@ export const DASHBOARD_QUICK_ACCESS = [
icon: InformationCircleIcon, icon: InformationCircleIcon,
}, },
]; ];
/** Apps that should not be shown on the dashboard */
export const HIDDEN_APPS = ['dashboard'];
/** Apps that should be shown under "Utilities" */
export const UTILITY_APPS = ['monitoring'];