diff --git a/src/modules/apps/consts.tsx b/src/modules/apps/consts.tsx
index 0930407..7f58f33 100644
--- a/src/modules/apps/consts.tsx
+++ b/src/modules/apps/consts.tsx
@@ -1,5 +1,6 @@
import React from 'react';
-import { CogIcon } from '@heroicons/react/outline';
+import { CogIcon, PlusCircleIcon } from '@heroicons/react/outline';
+import _ from 'lodash';
export const initialEditorYaml = () => {
return `luck: except
@@ -25,6 +26,38 @@ search:
great: stomach`;
};
+export enum AppStatus {
+ NotInstalled = 'Not installed',
+ Installed = 'Installed',
+ Installing = 'Installing',
+}
+
+const tableConsts = [
+ {
+ status: AppStatus.Installed,
+ colorClass: 'green-600',
+ buttonTitle: 'Configure',
+ buttonIcon:
,
+ },
+ {
+ status: AppStatus.NotInstalled,
+ colorClass: 'gray-600',
+ buttonTitle: 'Install',
+ buttonIcon:
,
+ },
+ {
+ status: AppStatus.Installing,
+ colorClass: 'primary-600',
+ buttonTitle: null,
+ buttonIcon: null,
+ },
+];
+
+const getConstForStatus = (appStatus: AppStatus, paramName: string) => {
+ const tableConst = _.find(tableConsts, { status: appStatus });
+ return _.get(tableConst, paramName);
+};
+
export const columns: any = [
{
Header: 'Name',
@@ -47,10 +80,11 @@ export const columns: any = [
Header: 'Status',
accessor: 'status',
Cell: (e: any) => {
+ const appStatus = e.cell.row.original.status as AppStatus;
return (
-
-
{e.cell.row.original.status}
+
+
{appStatus}
);
},
@@ -58,7 +92,11 @@ export const columns: any = [
},
{
Header: ' ',
- Cell: () => {
+ Cell: (e: any) => {
+ const appStatus = e.cell.row.original.status as AppStatus;
+ if (appStatus === AppStatus.Installing) {
+ return null;
+ }
return (
);
@@ -80,25 +118,32 @@ export const data: any[] = [
{
id: 1,
name: 'Nextcloud',
- status: 'Active for everyone',
+ status: AppStatus.Installed,
assetSrc: './assets/nextcloud.svg',
},
{
id: 2,
name: 'Wekan',
- status: 'Active for everyone',
+ status: AppStatus.Installing,
assetSrc: './assets/wekan.svg',
},
{
id: 3,
name: 'Zulip',
- status: 'Active for everyone',
+ status: AppStatus.NotInstalled,
assetSrc: './assets/zulip.svg',
},
{
id: 4,
name: 'Wordpress',
- status: 'Active for everyone',
+ status: AppStatus.NotInstalled,
assetSrc: './assets/wordpress.svg',
},
];
+
+export interface AppInfo {
+ id: number;
+ name: string;
+ status: AppStatus;
+ assetSrc: string;
+}