From cc59b3ff0c6523e7b68e93e047ae17d988d164d9 Mon Sep 17 00:00:00 2001 From: Marvin9 Date: Fri, 30 Oct 2020 10:42:05 +0530 Subject: [PATCH] feat: scaffolder full screen logs --- .../src/components/JobStage/JobStage.tsx | 16 ++++++- .../src/components/JobStage/LogModal.tsx | 48 +++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 plugins/scaffolder/src/components/JobStage/LogModal.tsx diff --git a/plugins/scaffolder/src/components/JobStage/JobStage.tsx b/plugins/scaffolder/src/components/JobStage/JobStage.tsx index 5128a761ec..68a9e8ead8 100644 --- a/plugins/scaffolder/src/components/JobStage/JobStage.tsx +++ b/plugins/scaffolder/src/components/JobStage/JobStage.tsx @@ -1,3 +1,5 @@ +/* eslint-disable jsx-a11y/click-events-have-key-events */ +/* eslint-disable jsx-a11y/no-static-element-interactions */ /* * Copyright 2020 Spotify AB * @@ -31,6 +33,7 @@ import moment from 'moment'; import React, { Suspense, useEffect, useState } from 'react'; import { Job } from '../../types'; +const LogModal = React.lazy(() => import('./LogModal')); const LazyLog = React.lazy(() => import('react-lazylog/build/LazyLog')); moment.relativeTimeThreshold('ss', 0); @@ -99,6 +102,9 @@ export const JobStage = ({ endedAt, startedAt, name, log, status }: Props) => { .humanize() : null; + const [logsFullScreen, setLogsFullScreen] = useState(false); + const toggleLogsFullScreen = () => setLogsFullScreen(!logsFullScreen); + return ( { ) : ( }> -
+ +
diff --git a/plugins/scaffolder/src/components/JobStage/LogModal.tsx b/plugins/scaffolder/src/components/JobStage/LogModal.tsx new file mode 100644 index 0000000000..0eefad9b04 --- /dev/null +++ b/plugins/scaffolder/src/components/JobStage/LogModal.tsx @@ -0,0 +1,48 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import React from 'react'; +import { + Dialog, + DialogTitle, + DialogContent, + IconButton, +} from '@material-ui/core'; +import Close from '@material-ui/icons/Close'; +import LazyLog from 'react-lazylog/build/LazyLog'; + +type Props = { + log: string[]; + open?: boolean; + onClose(): void; +}; + +export const LogModal: React.FC = ({ log, open = false, onClose }) => ( + + + Logs + + + + + +
+ +
+
+
+); + +export default LogModal;