+
+
+
-
-
- );
- }}
+ .content {
+ width: 100%;
+ }
+ `}
+
+ ))}
>
);
diff --git a/services/ui/src/pages/deployments.js b/services/ui/src/pages/deployments.js
index 1ab5ffe765..4f56812e9a 100644
--- a/services/ui/src/pages/deployments.js
+++ b/services/ui/src/pages/deployments.js
@@ -1,18 +1,20 @@
import React from 'react';
+import * as R from 'ramda';
import { withRouter } from 'next/router';
import Head from 'next/head';
import { Query } from 'react-apollo';
import MainLayout from 'layouts/main';
import EnvironmentWithDeploymentsQuery from 'lib/query/EnvironmentWithDeployments';
import DeploymentsSubscription from 'lib/subscription/Deployments';
-import LoadingPage from 'pages/_loading';
-import ErrorPage from 'pages/_error';
import Breadcrumbs from 'components/Breadcrumbs';
import ProjectBreadcrumb from 'components/Breadcrumbs/Project';
import EnvironmentBreadcrumb from 'components/Breadcrumbs/Environment';
import NavTabs from 'components/NavTabs';
import DeployLatest from 'components/DeployLatest';
import Deployments from 'components/Deployments';
+import withQueryLoading from 'lib/withQueryLoading';
+import withQueryError from 'lib/withQueryError';
+import { withEnvironmentRequired } from 'lib/withDataRequired';
import { bp } from 'lib/variables';
const PageDeployments = ({ router }) => {
@@ -25,33 +27,11 @@ const PageDeployments = ({ router }) => {
query={EnvironmentWithDeploymentsQuery}
variables={{ openshiftProjectName: router.query.openshiftProjectName }}
>
- {({
- loading,
- error,
- data: { environmentByOpenshiftProjectName: environment },
- subscribeToMore
- }) => {
- if (loading) {
- return
;
- }
-
- if (error) {
- return (
-
- );
- }
-
- if (!environment) {
- return (
-
- );
- }
-
+ {R.compose(
+ withQueryLoading,
+ withQueryError,
+ withEnvironmentRequired
+ )(({ data: { environment }, subscribeToMore }) => {
subscribeToMore({
document: DeploymentsSubscription,
variables: { environment: environment.id },
@@ -123,7 +103,7 @@ const PageDeployments = ({ router }) => {
`}
);
- }}
+ })}
>
);
diff --git a/services/ui/src/pages/environment.js b/services/ui/src/pages/environment.js
index 225fbe1ad1..53b82e750e 100644
--- a/services/ui/src/pages/environment.js
+++ b/services/ui/src/pages/environment.js
@@ -1,16 +1,18 @@
import React from 'react';
+import * as R from 'ramda';
import { withRouter } from 'next/router';
import Head from 'next/head';
import { Query } from 'react-apollo';
import MainLayout from 'layouts/main';
import EnvironmentByOpenshiftProjectNameQuery from 'lib/query/EnvironmentByOpenshiftProjectName';
-import LoadingPage from 'pages/_loading';
-import ErrorPage from 'pages/_error';
import Breadcrumbs from 'components/Breadcrumbs';
import ProjectBreadcrumb from 'components/Breadcrumbs/Project';
import EnvironmentBreadcrumb from 'components/Breadcrumbs/Environment';
import NavTabs from 'components/NavTabs';
import Environment from 'components/Environment';
+import withQueryLoading from 'lib/withQueryLoading';
+import withQueryError from 'lib/withQueryError';
+import { withEnvironmentRequired } from 'lib/withDataRequired';
import { bp } from 'lib/variables';
const PageEnvironment = ({ router }) => (
@@ -24,56 +26,35 @@ const PageEnvironment = ({ router }) => (
openshiftProjectName: router.query.openshiftProjectName
}}
>
- {({
- loading,
- error,
- data: { environmentByOpenshiftProjectName: environment }
- }) => {
- if (loading) {
- return
;
- }
-
- if (error) {
- return
;
- }
-
- if (!environment) {
- return (
-
(
+
+
+
+
- );
- }
-
- return (
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
- );
- }}
+ }
+ `}
+
+ ))}
>
);
diff --git a/services/ui/src/pages/project.js b/services/ui/src/pages/project.js
index e353894c9c..af67cceed3 100644
--- a/services/ui/src/pages/project.js
+++ b/services/ui/src/pages/project.js
@@ -5,12 +5,13 @@ import Head from 'next/head';
import { Query } from 'react-apollo';
import MainLayout from 'layouts/main';
import ProjectByNameQuery from 'lib/query/ProjectByName';
-import LoadingPage from 'pages/_loading';
-import ErrorPage from 'pages/_error';
import Breadcrumbs from 'components/Breadcrumbs';
import ProjectBreadcrumb from 'components/Breadcrumbs/Project';
import ProjectDetailsSidebar from 'components/ProjectDetailsSidebar';
import Environments from 'components/Environments';
+import withQueryLoading from 'lib/withQueryLoading';
+import withQueryError from 'lib/withQueryError';
+import { withProjectRequired } from 'lib/withDataRequired';
import { bp, color } from 'lib/variables';
const PageProject = ({ router }) => (
@@ -22,24 +23,11 @@ const PageProject = ({ router }) => (
query={ProjectByNameQuery}
variables={{ name: router.query.projectName }}
>
- {({ loading, error, data: { projectByName: project } }) => {
- if (loading) {
- return
;
- }
-
- if (error) {
- return
;
- }
-
- if (!project) {
- return (
-
- );
- }
-
+ {R.compose(
+ withQueryLoading,
+ withQueryError,
+ withProjectRequired
+ )(({ data: { project } }) => {
// Sort alphabetically by environmentType and then deployType
const environments = R.sortWith(
[
@@ -106,7 +94,7 @@ const PageProject = ({ router }) => (
`}
);
- }}
+ })}
>
);
diff --git a/services/ui/src/pages/projects.js b/services/ui/src/pages/projects.js
index 1ba5097f91..091f80e6e4 100644
--- a/services/ui/src/pages/projects.js
+++ b/services/ui/src/pages/projects.js
@@ -1,11 +1,12 @@
import React from 'react';
+import * as R from 'ramda';
import Head from 'next/head';
import { Query } from 'react-apollo';
import MainLayout from 'layouts/main';
import AllProjectsQuery from 'lib/query/AllProjects';
-import LoadingPage from 'pages/_loading';
-import ErrorPage from 'pages/_error';
import Projects from 'components/Projects';
+import withQueryLoading from 'lib/withQueryLoading';
+import withQueryError from 'lib/withQueryError';
import { bp, color, fontSize } from 'lib/variables';
const ProjectsPage = () => (
@@ -14,48 +15,41 @@ const ProjectsPage = () => (
Projects
- {({ loading, error, data }) => {
- if (loading) {
- return ;
- }
-
- if (error) {
- return ;
- }
-
- return (
-
-
-
Projects
-
+ {R.compose(
+ withQueryLoading,
+ withQueryError
+ )(({ data }) => (
+
+
+
Projects
+
-
-
- );
- }}
+ }
+ `}
+
+ ))}
>
);
diff --git a/services/ui/src/pages/task.js b/services/ui/src/pages/task.js
index 2574dd694b..6cd691390f 100644
--- a/services/ui/src/pages/task.js
+++ b/services/ui/src/pages/task.js
@@ -1,16 +1,21 @@
import React from 'react';
+import * as R from 'ramda';
import { withRouter } from 'next/router';
import Head from 'next/head';
import { Query } from 'react-apollo';
import MainLayout from 'layouts/main';
import EnvironmentWithTaskQuery from 'lib/query/EnvironmentWithTask';
-import LoadingPage from 'pages/_loading';
-import ErrorPage from 'pages/_error';
import Breadcrumbs from 'components/Breadcrumbs';
import ProjectBreadcrumb from 'components/Breadcrumbs/Project';
import EnvironmentBreadcrumb from 'components/Breadcrumbs/Environment';
import NavTabs from 'components/NavTabs';
import Task from 'components/Task';
+import withQueryLoading from 'lib/withQueryLoading';
+import withQueryError from 'lib/withQueryError';
+import {
+ withEnvironmentRequired,
+ withTaskRequired
+} from 'lib/withDataRequired';
import { bp } from 'lib/variables';
const PageTask = ({ router }) => (
@@ -25,69 +30,40 @@ const PageTask = ({ router }) => (
taskId: router.query.taskId
}}
>
- {({
- loading,
- error,
- data: { environmentByOpenshiftProjectName: environment }
- }) => {
- if (loading) {
- return
;
- }
-
- if (error) {
- return
;
- }
-
- if (!environment) {
- return (
-
- );
- }
-
- if (!environment.tasks.length) {
- return (
-
(
+
+
+
+
- );
- }
-
- return (
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
- );
- }}
+ .content {
+ width: 100%;
+ }
+ `}
+
+ ))}
>
);
diff --git a/services/ui/src/pages/tasks.js b/services/ui/src/pages/tasks.js
index 63ec1185dc..aa4af84ac3 100644
--- a/services/ui/src/pages/tasks.js
+++ b/services/ui/src/pages/tasks.js
@@ -1,18 +1,20 @@
import React from 'react';
+import * as R from 'ramda';
import { withRouter } from 'next/router';
import Head from 'next/head';
import { Query } from 'react-apollo';
import MainLayout from 'layouts/main';
import EnvironmentWithTasksQuery from 'lib/query/EnvironmentWithTasks';
import TasksSubscription from 'lib/subscription/Tasks';
-import LoadingPage from 'pages/_loading';
-import ErrorPage from 'pages/_error';
import Breadcrumbs from 'components/Breadcrumbs';
import ProjectBreadcrumb from 'components/Breadcrumbs/Project';
import EnvironmentBreadcrumb from 'components/Breadcrumbs/Environment';
import NavTabs from 'components/NavTabs';
import AddTask from 'components/AddTask';
import Tasks from 'components/Tasks';
+import withQueryLoading from 'lib/withQueryLoading';
+import withQueryError from 'lib/withQueryError';
+import { withEnvironmentRequired } from 'lib/withDataRequired';
import { bp } from 'lib/variables';
const PageTasks = ({ router }) => (
@@ -26,31 +28,11 @@ const PageTasks = ({ router }) => (
openshiftProjectName: router.query.openshiftProjectName
}}
>
- {({
- loading,
- error,
- data: { environmentByOpenshiftProjectName: environment },
- subscribeToMore
- }) => {
- if (loading) {
- return
;
- }
-
- if (error) {
- return
;
- }
-
- if (!environment) {
- return (
-
- );
- }
-
+ {R.compose(
+ withQueryLoading,
+ withQueryError,
+ withEnvironmentRequired
+ )(({ data: { environment }, subscribeToMore }) => {
subscribeToMore({
document: TasksSubscription,
variables: { environment: environment.id },
@@ -117,7 +99,7 @@ const PageTasks = ({ router }) => (
`}
);
- }}
+ })}
>
);