diff --git a/dashboard/src/components/AppNav.tsx b/dashboard/src/components/AppNav.tsx index 9170ffdf1..712740b24 100644 --- a/dashboard/src/components/AppNav.tsx +++ b/dashboard/src/components/AppNav.tsx @@ -34,7 +34,7 @@ const AppNavContainer = styled('div', { display: 'flex', flexDirection: 'row', gap: '20px', - } + }, }) export interface AppNavProps { @@ -56,10 +56,14 @@ export const AppNav = (props: AppNavProps): JSXElement => { - + - + diff --git a/dashboard/src/components/BuildStatusIcon.tsx b/dashboard/src/components/BuildStatusIcon.tsx index bdbd17e5c..f78ed7c73 100644 --- a/dashboard/src/components/BuildStatusIcon.tsx +++ b/dashboard/src/components/BuildStatusIcon.tsx @@ -23,7 +23,5 @@ interface Props { } export const BuildStatusIcon = (props: Props): JSXElement => { - return ( - - ) + return } diff --git a/dashboard/src/components/Log.tsx b/dashboard/src/components/Log.tsx index d1ecc4c04..22facc5d8 100644 --- a/dashboard/src/components/Log.tsx +++ b/dashboard/src/components/Log.tsx @@ -23,10 +23,10 @@ export const LogContainer = styled('div', { scroll: { whiteSpace: 'nowrap', overflowX: 'scroll', - } - } + }, + }, }, defaultVariants: { overflowX: 'wrap', - } + }, }) diff --git a/dashboard/src/components/RepositoryRow.tsx b/dashboard/src/components/RepositoryRow.tsx index d13ff45c0..05e6fd4e5 100644 --- a/dashboard/src/components/RepositoryRow.tsx +++ b/dashboard/src/components/RepositoryRow.tsx @@ -147,23 +147,26 @@ export const RepositoryRow = ({ repo, apps }: Props): JSXElement => {
Add branch
- ( - - - - - {app.name} - -
{shortSha(app.currentCommit)}
- -
{app.websites[0]?.fqdn || ''}
- -
-
-
-
-
- )} /> + ( + + + + + {app.name} + +
{shortSha(app.currentCommit)}
+ +
{app.websites[0]?.fqdn || ''}
+ +
+
+
+
+
+ )} + /> ) } diff --git a/dashboard/src/components/StatusIcon.tsx b/dashboard/src/components/StatusIcon.tsx index c4d590878..be36a8221 100644 --- a/dashboard/src/components/StatusIcon.tsx +++ b/dashboard/src/components/StatusIcon.tsx @@ -21,7 +21,5 @@ interface Props { } export const StatusIcon = (props: Props): JSXElement => { - return ( - - ) + return } diff --git a/dashboard/src/libs/buffers.ts b/dashboard/src/libs/buffers.ts index a7eca84eb..b651de990 100644 --- a/dashboard/src/libs/buffers.ts +++ b/dashboard/src/libs/buffers.ts @@ -10,16 +10,17 @@ export const concatBuffers = (a: Uint8Array, b: Uint8Array): Uint8Array => { const utf8Decoder = new TextDecoder('utf-8') const ansiDecoder = new Convert() -const escapeHTML = (s: string): string => s.replace(/[&'`"<>]/g, function (match) { - return { - '&': '&', - '\'': ''', - '`': '`', - '"': '"', - '<': '<', - '>': '>', - }[match] -}) +const escapeHTML = (s: string): string => + s.replace(/[&'`"<>]/g, function (match) { + return { + '&': '&', + "'": ''', + '`': '`', + '"': '"', + '<': '<', + '>': '>', + }[match] + }) export const toUTF8WithAnsi = (arr: Uint8Array): string => { const rawStr = utf8Decoder.decode(arr.buffer) diff --git a/dashboard/src/libs/sleep.ts b/dashboard/src/libs/sleep.ts index db705eef2..ae7945734 100644 --- a/dashboard/src/libs/sleep.ts +++ b/dashboard/src/libs/sleep.ts @@ -1 +1 @@ -export const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)) +export const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)) diff --git a/dashboard/src/pages/apps.tsx b/dashboard/src/pages/apps.tsx index 9d40902b5..9c1eb9f37 100644 --- a/dashboard/src/pages/apps.tsx +++ b/dashboard/src/pages/apps.tsx @@ -171,9 +171,10 @@ export default () => { - ( - - )} /> + } + /> diff --git a/dashboard/src/pages/apps/[id].tsx b/dashboard/src/pages/apps/[id].tsx index edf26d05f..5d881a5e4 100644 --- a/dashboard/src/pages/apps/[id].tsx +++ b/dashboard/src/pages/apps/[id].tsx @@ -124,7 +124,7 @@ export default () => { () => app()?.deployType === DeployType.RUNTIME && app()?.id, (id) => client.getOutput({ applicationId: id, before: Timestamp.fromDate(now) }), ) - const reversedLog = createMemo(() => log() && [...log().outputs].reverse() as ApplicationOutput[]) + const reversedLog = createMemo(() => log() && ([...log().outputs].reverse() as ApplicationOutput[])) const [logStream] = createResource( () => app()?.container === Application_ContainerState.RUNNING && app()?.id, (id) => client.getOutputStream({ applicationId: id, after: Timestamp.fromDate(now) }), @@ -139,7 +139,7 @@ export default () => { const iterate = async () => { for await (const log of stream) { - setStreamedLog(prev => prev.concat(log.log)) + setStreamedLog((prev) => prev.concat(log.log)) } await sleep(1000) await refetchApp() @@ -217,11 +217,14 @@ export default () => { - ( - - {getWebsiteURL(website)} - - )} /> + ( + + {getWebsiteURL(website)} + + )} + /> @@ -284,7 +287,8 @@ export default () => { Build Type {buildTypeStr[app().config.buildConfig.buildConfig.case]} - A + + A @@ -304,12 +308,10 @@ export default () => { Container Log - ( - {l.log} - )} /> - ( - {line} - )} /> + {/* rome-ignore lint: Avoid passing children using a prop */} + {l.log}} /> + {/* rome-ignore lint: Avoid passing children using a prop */} + {line}} /> diff --git a/dashboard/src/pages/apps/[id]/builds.tsx b/dashboard/src/pages/apps/[id]/builds.tsx index 566e10d47..66f065f0e 100644 --- a/dashboard/src/pages/apps/[id]/builds.tsx +++ b/dashboard/src/pages/apps/[id]/builds.tsx @@ -15,7 +15,7 @@ const BuildsContainer = styled('div', { marginTop: '24px', borderRadius: '4px', border: `1px solid ${vars.bg.white4}`, - } + }, }) const BuildContainer = styled('div', { @@ -92,11 +92,15 @@ export default () => { ) const loaded = () => !!(app() && repo() && builds()) - const sortedBuilds = createMemo(() => builds() && [...builds().builds].sort((b1, b2) => { - if (!b1.startedAt.valid) return -1 - if (!b2.startedAt.valid) return 1 - return b2.startedAt.timestamp.toDate().getTime() - b1.startedAt.timestamp.toDate().getTime() - })) + const sortedBuilds = createMemo( + () => + builds() && + [...builds().builds].sort((b1, b2) => { + if (!b1.startedAt.valid) return -1 + if (!b2.startedAt.valid) return 1 + return b2.startedAt.timestamp.toDate().getTime() - b1.startedAt.timestamp.toDate().getTime() + }), + ) return ( @@ -104,25 +108,28 @@ export default () => { - ( - - 0 && i() < sortedBuilds().length-1 ? 'line' : 'none'}> - - - Build {b.id} - -
{shortSha(b.commit)}
- - {/* TODO: use queued_at */} - - - - -
-
-
-
- )} /> + ( + + 0 && i() < sortedBuilds().length - 1 ? 'line' : 'none'}> + + + Build {b.id} + +
{shortSha(b.commit)}
+ + {/* TODO: use queued_at */} + + + + +
+
+
+
+ )} + />
diff --git a/dashboard/src/pages/apps/[id]/builds/[id].tsx b/dashboard/src/pages/apps/[id]/builds/[id].tsx index c9a5fa070..8dff12dd3 100644 --- a/dashboard/src/pages/apps/[id]/builds/[id].tsx +++ b/dashboard/src/pages/apps/[id]/builds/[id].tsx @@ -54,7 +54,7 @@ export default () => { const iterate = async () => { for await (const log of stream) { - setStreamedLog(prev => concatBuffers(prev, log.log)) + setStreamedLog((prev) => concatBuffers(prev, log.log)) } await sleep(1000) await refetchBuild() // refetch build on stream end @@ -122,7 +122,7 @@ export default () => { Started at - + @@ -130,7 +130,7 @@ export default () => { Finished at - + @@ -138,15 +138,15 @@ export default () => { Duration - {durationHuman(build().finishedAt.timestamp.toDate().getTime() - build().startedAt.timestamp.toDate().getTime())} + {durationHuman( + build().finishedAt.timestamp.toDate().getTime() - build().startedAt.timestamp.toDate().getTime(), + )} Retried - - {build().retriable ? 'Yes' : 'No'} - + {build().retriable ? 'Yes' : 'No'} diff --git a/pkg/usecase/api_app_config_service.go b/pkg/usecase/api_app_config_service.go index 1ba2db796..6346db7e3 100644 --- a/pkg/usecase/api_app_config_service.go +++ b/pkg/usecase/api_app_config_service.go @@ -5,6 +5,7 @@ import ( "time" "github.com/friendsofgo/errors" + log "github.com/sirupsen/logrus" "github.com/traPtitech/neoshowcase/pkg/domain" "github.com/traPtitech/neoshowcase/pkg/util/optional" @@ -63,6 +64,7 @@ func (s *APIServerService) GetOutputStream(ctx context.Context, id string, after return errors.Wrap(err, "failed to send log") } case <-ctx.Done(): + log.Infof("closing output stream") return nil } }