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

Fix: Fixing formating and linting across the website code #541

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

60 changes: 60 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: 🐛 Bug
description: Create a report to help us improve
title: "🐛 Bug: "
labels: ["Type: Bug"]
body:
- type: textarea
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is
validations:
required: true
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior
placeholder: |
1. Go to'...'
2. Click on'...'
3. Scroll down to'...'
4. See error
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
description: A clear and concise description of what you expected to happen
validations:
required: true
- type: textarea
attributes:
label: Screenshots
description: |
If applicable, add screenshots to help explain your problem

Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in
validations:
required: false
- type: textarea
attributes:
label: Device Information [optional]
description: |
examples:
- **OS**: Ubuntu 20.04
- **Browser**: chrome
- **version**: 22
value: |
- OS:
- Browser:
- version:
render: markdown
validations:
required: false
- type: dropdown
attributes:
label: Are you working on this issue?
options:
- 'Yes'
- 'No'
validations:
required: true
20 changes: 0 additions & 20 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: ⭐️ Feature request
description: Suggest an idea for this project
title: "✨ Enhancement: "
labels: ["Type: Feature Request"]
body:
- type: textarea
attributes:
label: Is your feature request related to a problem? Please describe
description: A clear and concise description of what the problem is
validations:
required: true
- type: textarea
attributes:
label: Describe the solution you'd like
description: A clear and concise description of what you want to happen
validations:
required: true
- type: textarea
attributes:
label: Describe alternatives you've considered
description: A clear and concise description of any alternative solutions or features you've considered
validations:
required: false
- type: textarea
attributes:
label: Additional context
description: Add any other context about the problem here
validations:
required: false
- type: dropdown
attributes:
label: Are you working on this?
options:
- 'Yes'
- 'No'
validations:
required: true
38 changes: 38 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

<!-- In order to keep off topic discussion to a minimum, it helps if the "work to be done" is already agreed on. -->
<!-- Ideally, a GitHub Issue with the label `Status: Consensus` will have been concluded, and linked to in this PR. -->
<!--
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request.
-->

**What kind of change does this PR introduce?**

<!-- E.g. a bugfix, feature, refactoring, etc… -->

**Issue Number:**
<!-- Pick one of the below options. Please remove those which don't apply. -->
- Closes #___ <!-- Replace ___ with the issue number this PR resolves -->
- Related to #___ <!-- Use when the PR doesn't completely resolve an issue -->
- Others? <!-- Add any additional notes or references here -->


**Screenshots/videos:**

<!--Add screenshots or videos wherever possible.-->

| Before | After |
| ----- | ----- |
| | |

**If relevant, did you update the documentation?**

<!--Add link to it-->

**Summary**

<!-- Explain the motivation for making this change. What existing problem does the pull request solve? -->
<!-- Try to link to an open issue for more information. -->

**Does this PR introduce a breaking change?**

<!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->
52 changes: 52 additions & 0 deletions .github/workflows/typescript_lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Typescript Lint, Format and Type check workflow

on:
pull_request:
types: [opened, reopened, synchronize]
paths:
- "website/**"

jobs:
linting_and_type-checking:
name: Typescript Linting, Formatting and Type checking
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: yarn install --frozen-lockfile
working-directory: website

- name: Linting and Formatting checks
run: yarn run lint
working-directory: website

- name: Type checking
run: yarn run typecheck

build:
name: Build check
runs-on: ubuntu-latest
needs: linting_and_type-checking
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build
run: yarn run build
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,10 @@ docker compose up
```
docker compose -f docker-compose.prod.yml build
docker compose -f docker-compose.prod.yml up
```

### Formatting

```
npm run format
```
24 changes: 2 additions & 22 deletions go/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const (

type Exec struct {
UUID uuid.UUID
RawUUID string
AnsibleConfig ansible.Config
Source string
GitRef string
Expand Down Expand Up @@ -456,32 +457,11 @@ func GetRecentExecutions(client storage.SQLClient) ([]*Exec, error) {
}
defer result.Close()
for result.Next() {
var eUUID string
exec := &Exec{}
err = result.Scan(&eUUID, &exec.Status, &exec.GitRef, &exec.StartedAt, &exec.FinishedAt, &exec.Source, &exec.TypeOf, &exec.PullNB, &exec.GolangVersion)
err = result.Scan(&exec.RawUUID, &exec.Status, &exec.GitRef, &exec.StartedAt, &exec.FinishedAt, &exec.Source, &exec.TypeOf, &exec.PullNB, &exec.GolangVersion)
if err != nil {
return nil, err
}
exec.UUID, err = uuid.Parse(eUUID)
if err != nil {
return nil, err
}
if exec.TypeOf != "micro" {
macroResult, err := client.Select("SELECT m.vtgate_planner_version FROM macrobenchmark m, execution e WHERE e.uuid = m.exec_uuid AND e.uuid = ? LIMIT 1", eUUID)
if err != nil {
return nil, err
}
defer macroResult.Close()

var plannerVersion string
if macroResult.Next() {
err = macroResult.Scan(&plannerVersion)
if err != nil {
return nil, err
}
}
exec.VtgatePlannerVersion = plannerVersion
}
res = append(res, exec)
}
return res, nil
Expand Down
2 changes: 1 addition & 1 deletion go/server/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (s *Server) getRecentExecutions(c *gin.Context) {
recentExecs := make([]RecentExecutions, 0, len(execs))
for _, e := range execs {
recentExecs = append(recentExecs, RecentExecutions{
UUID: e.UUID.String(),
UUID: e.RawUUID,
Source: e.Source,
GitRef: e.GitRef,
Status: e.Status,
Expand Down
16 changes: 16 additions & 0 deletions go/server/cron_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,26 @@ func (s *Server) branchCronHandler() {

execElements := append(mainBranchElements, releaseBranchElements...)
for _, elem := range execElements {
s.removeBranchElementFromQueue(elem)
s.addToQueue(elem)
}
}

func (s *Server) removeBranchElementFromQueue(newElem *executionQueueElement) {
mtx.Lock()
defer mtx.Unlock()

for identifier, element := range queue {
if element.Executing {
continue
}
if identifier.PlannerVersion == newElem.identifier.PlannerVersion && identifier.BenchmarkType == newElem.identifier.BenchmarkType && identifier.Source == newElem.identifier.Source && identifier.GitRef != newElem.identifier.GitRef {
slog.Infof("%+v is removed from the queue", identifier)
delete(queue, identifier)
}
}
}

func (s *Server) mainBranchCronHandler() ([]*executionQueueElement, error) {
var elements []*executionQueueElement
configs := s.getConfigFiles()
Expand Down
2 changes: 1 addition & 1 deletion website/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"components": "@/components",
"utils": "@/library/utils"
}
}
}
2 changes: 1 addition & 1 deletion website/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
3 changes: 2 additions & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"start": "serve -s dist",
"build": "vite --mode prod build",
"lint": "eslint src --ext js,ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
"preview": "vite preview",
"format": "prettier --write \"**/*.{ts,tsx,json,scss,css}\""
},
"dependencies": {
"@nivo/core": "^0.83.0",
Expand Down
2 changes: 1 addition & 1 deletion website/postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ export default {
tailwindcss: {},
autoprefixer: {},
},
}
};
4 changes: 2 additions & 2 deletions website/src/assets/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

@import url('./tailwind.css');
@import url('./directives.css');
@import url("./tailwind.css");
@import url("./directives.css");

/* Raleway font */
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,1;0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;0,1000;1,1;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900;1,1000&display=swap");
Loading