Skip to content
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

Add issues to request detail page #37

Merged
merged 11 commits into from
Jun 14, 2024
Merged

Add issues to request detail page #37

merged 11 commits into from
Jun 14, 2024

Conversation

flenter
Copy link
Member

@flenter flenter commented Jun 12, 2024

image

It also:

  • removes some unused code
  • adds support for importing svgs as react component with the react component as the default export (i.e. similar to what we do in other projects)

@brettimus
Copy link
Contributor

can you provide steps to trigger a related issue?

@brettimus
Copy link
Contributor

probably wanna add some margin between these two cards (space-x-4 or (ml-4)
image

@flenter
Copy link
Member Author

flenter commented Jun 14, 2024

You can use a script to seed the database with some requests that have related issues (though they don't always really match). The script is db:seed. I typically run my api like this:

rm mizu.db && npm run db:generate && npm run db:migrate && npm run db:seed && npm run dev

This removes the current db, runs all the db scripts and starts the server.

Copy link
Contributor

@brettimus brettimus left a comment

Choose a reason for hiding this comment

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

a few nits and minor requests - otherwise approved!


const paddedChunks = addSurroundingWords(rawChunks, text);
// const paddedChunks = rawChunks.length ? addSurroundingWords(rawChunks, issue.body) : rawChunks;
console.log(searchWords);
Copy link
Contributor

Choose a reason for hiding this comment

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

log

}).filter((chunk) => chunk.highlight);

const paddedChunks = addSurroundingWords(rawChunks, text);
// const paddedChunks = rawChunks.length ? addSurroundingWords(rawChunks, issue.body) : rawChunks;
Copy link
Contributor

Choose a reason for hiding this comment

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

dead code

if (paddedChunks.length > 0) {
console.log("before", rawChunks, "after", paddedChunks);
}
// return paddedChunks;
Copy link
Contributor

Choose a reason for hiding this comment

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

dead code

// const paddedChunks = rawChunks.length ? addSurroundingWords(rawChunks, issue.body) : rawChunks;
console.log(searchWords);
if (paddedChunks.length > 0) {
console.log("before", rawChunks, "after", paddedChunks);
Copy link
Contributor

Choose a reason for hiding this comment

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

log

}

if (!issues || issues.length === 0 || !query) {
return <div>No data</div>;
Copy link
Contributor

Choose a reason for hiding this comment

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

might wanna stylize this a bit, since it seems we'll hit this case quite frequently

image

Copy link
Contributor

Choose a reason for hiding this comment

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

ah i see below (line 48) you actually have a bit of UI for this, but it's unreachable

{issues.length === 0 && (
        <li>
          <div className="items-center gap-2 justify-center flex text-gray-500">
            <ExclamationTriangleIcon />
            No related issues found
          </div>
        </li>
      )}


return (
<div className="flex flex-row">
<Card x-chunk="dashboard-06-chunk-0" className="basis-2/3">
Copy link
Contributor

Choose a reason for hiding this comment

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

what's x-chunk from?

Copy link
Member Author

Choose a reason for hiding this comment

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

it was there originally so when i was splitting things up into separate components, I moved it. However I will remove it as i don't think it's got any value.

Copy link
Contributor

Choose a reason for hiding this comment

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

indeed - i couldn't figure it out. probably something i copy-pasted

Copy link
Member Author

Choose a reason for hiding this comment

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

I will remove it in my next PR

const status = response?.message.status;
trace.status = typeof status === "string" ? status : "unknown";
const size = response?.message.body.length;
Copy link
Contributor

Choose a reason for hiding this comment

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

nice -really improves the requests table!

});
const data = await response.json();
return GitHubIssuesSchema.parse(data);
// return data as Array<number>;
Copy link
Contributor

Choose a reason for hiding this comment

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

dead

return GitHubIssuesSchema.parse(data);
// return data as Array<number>;
} catch (e: unknown) {
console.error("Error fetching GitHub issue for a trace: ", e);
Copy link
Contributor

Choose a reason for hiding this comment

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

should still throw?

Copy link
Member Author

@flenter flenter Jun 14, 2024

Choose a reason for hiding this comment

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

yeah that makes sense. I didn't think much about it, i was just following the same logic/flow that we already have with fetchMizuLogs. I've added some throws in the code.

const data = await response.json();
return DependenciesSchema.parse(data);
} catch (e: unknown) {
console.error("Error fetching dependencies: ", e);
Copy link
Contributor

Choose a reason for hiding this comment

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

should still throw?

@flenter flenter merged commit a803f0e into main Jun 14, 2024
2 checks passed
@flenter flenter deleted the tweak_requests_table branch June 14, 2024 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants