Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vmui: add explore tab for exploration of metrics, which belong to a p…
…articular job/instance (#3470) * feat: add "Explore" page * feat: add graphs for explore page * vmui: add explore tab for exploration of metrics, which belong to a particular job/instance * refactor: rename variables * refactor: extract graph to ExploreMetricItemGraph.tsx * feat: add searchable for Select.tsx * feat: improve metrics explorer * feat: set document title by page * feat: add page to view icons * fix: improve styles * fix: add encodeURIComponent to query
- Loading branch information
Showing
37 changed files
with
1,020 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FAST_REFRESH=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { TimeParams } from "../types"; | ||
|
||
export const getJobsUrl = (server: string, period: TimeParams): string => | ||
`${server}/api/v1/label/job/values?start=${period.start}&end=${period.end}`; | ||
|
||
export const getInstancesUrl = (server: string, period: TimeParams, job: string): string => | ||
`${server}/api/v1/label/instance/values?match[]={job="${encodeURIComponent(job)}"}&start=${period.start}&end=${period.end}`; | ||
|
||
export const getNamesUrl = (server: string, job: string, instance: string): string => { | ||
const match = Object.entries({ job, instance }) | ||
.filter(val => val[1]) | ||
.map(([key, val]) => `${key}="${val}"`) | ||
.join(","); | ||
|
||
return `${server}/api/v1/label/__name__/values?match[]={${encodeURIComponent(match)}}`; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
app/vmui/packages/vmui/src/components/Main/Icons/PreviewIcons.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React, { FC } from "preact/compat"; | ||
import * as icons from "./index"; | ||
import { useSnack } from "../../../contexts/Snackbar"; | ||
import "./style.scss"; | ||
|
||
const PreviewIcons: FC = () => { | ||
const { showInfoMessage } = useSnack(); | ||
|
||
const handleClickIcon = (copyValue: string) => { | ||
navigator.clipboard.writeText(`<${copyValue}/>`); | ||
showInfoMessage({ text: `<${copyValue}/> has been copied`, type: "success" }); | ||
}; | ||
|
||
const createHandlerClickIcon = (key: string) => () => { | ||
handleClickIcon(key); | ||
}; | ||
|
||
return ( | ||
<div className="vm-preview-icons"> | ||
{Object.entries(icons).map(([iconKey, icon]) => ( | ||
<div | ||
className="vm-preview-icons-item" | ||
onClick={createHandlerClickIcon(iconKey)} | ||
key={iconKey} | ||
> | ||
<div className="vm-preview-icons-item__svg"> | ||
{icon()} | ||
</div> | ||
<div className="vm-preview-icons-item__name"> | ||
{`<${iconKey}/>`} | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default PreviewIcons; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
app/vmui/packages/vmui/src/components/Main/Icons/style.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
@use "src/styles/variables" as *; | ||
|
||
.vm-preview-icons { | ||
display: grid; | ||
align-items: flex-start; | ||
justify-content: center; | ||
grid-template-columns: repeat(auto-fill, 100px); | ||
gap: $padding-global; | ||
|
||
&-item { | ||
display: grid; | ||
grid-template-rows: 1fr auto; | ||
align-items: stretch; | ||
justify-content: center; | ||
gap: $padding-small; | ||
height: 100px; | ||
padding: $padding-global $padding-small; | ||
border-radius: $border-radius-small; | ||
border: 1px solid transparent; | ||
cursor: pointer; | ||
transition: box-shadow 200ms ease-in-out; | ||
|
||
&:hover { | ||
box-shadow: rgba(0, 0, 0, 0.16) 0 1px 4px; | ||
} | ||
|
||
&:active &__svg { | ||
transform: scale(0.9); | ||
} | ||
|
||
&__name { | ||
overflow: hidden; | ||
white-space: nowrap; | ||
text-overflow: ellipsis; | ||
text-align: center; | ||
font-size: $font-size-small; | ||
line-height: 2; | ||
} | ||
|
||
&__svg { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
height: 100%; | ||
transition: transform 100ms ease-out; | ||
|
||
svg { | ||
width: auto; | ||
height: 24px | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
@import 'src/styles/variables'; | ||
@use "src/styles/variables" as *; | ||
|
||
$padding-modal: 22px; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.