Skip to content

feat(site): display build logs on template creation #12271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Feb 23, 2024

Conversation

BrunoQuaresma
Copy link
Collaborator

Demo:

Screen.Recording.2024-02-22.at.11.40.12.mov

Close #12083

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This component needs to be refactored to make it easier to extend and use #12272

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracted from ImportStarterTemplateView

@BrunoQuaresma BrunoQuaresma requested review from a team and aslilac and removed request for a team February 22, 2024 16:53
@BrunoQuaresma
Copy link
Collaborator Author

FYI: Tests are on the way, I'm going to re-ask for review when pushing them but I would like to get as early feedback as possible.

@BrunoQuaresma BrunoQuaresma enabled auto-merge (squash) February 23, 2024 14:43
@@ -49,6 +49,8 @@ global.TextDecoder = TextDecoder as any;
global.Blob = Blob as any;
global.scrollTo = jest.fn();

window.HTMLElement.prototype.scrollIntoView = function () {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
window.HTMLElement.prototype.scrollIntoView = function () {};
window.HTMLElement.prototype.scrollIntoView = jest.fn();

templateVersion: TemplateVersion | undefined,
options?: { onDone: () => Promise<unknown> },
) => {
const [logs, setLogs] = useState<ProvisionerJobLog[] | undefined>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should've been more specific, but my original issue was really more wondering why we need undefined to be a unique state from []. We could reset the state by just saying setLogs([]) and the onMessage handler wouldn't need to check if logs is defined or not, it could just be simplified to setLogs((logs) => [...logs, log]).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use the following:

  • undefined - connecting
  • [] - connected but empty

Wdyt? I use the same idea for fetching server data. query.data && <Loader /> and so on.

);
};

const MissingVariablesBanner: FC<{ onFillVariables: () => void }> = ({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no inline prop types pls

@BrunoQuaresma BrunoQuaresma merged commit 79480ca into main Feb 23, 2024
@BrunoQuaresma BrunoQuaresma deleted the bq/show-build-logs-on-template-create branch February 23, 2024 19:23
@github-actions github-actions bot locked and limited conversation to collaborators Feb 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feat: Display build logs while creating the template
2 participants