mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-25 04:49:05 +01:00
Further adaptions to new urql version
This commit is contained in:
parent
280d63a852
commit
374a485d69
@ -22,10 +22,8 @@
|
|||||||
|
|
||||||
const ccconfig = getContext('cc-config')
|
const ccconfig = getContext('cc-config')
|
||||||
const clusters = getContext('clusters')
|
const clusters = getContext('clusters')
|
||||||
|
const client = getContextClient();
|
||||||
const nodesQuery = queryStore({
|
const query = gql`query($cluster: String!, $nodes: [String!], $from: Time!, $to: Time!) {
|
||||||
client: getContextClient(),
|
|
||||||
query: gql`query($cluster: String!, $nodes: [String!], $from: Time!, $to: Time!) {
|
|
||||||
nodeMetrics(cluster: $cluster, nodes: $nodes, from: $from, to: $to) {
|
nodeMetrics(cluster: $cluster, nodes: $nodes, from: $from, to: $to) {
|
||||||
host
|
host
|
||||||
subCluster
|
subCluster
|
||||||
@ -42,15 +40,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}`,
|
}`;
|
||||||
variables: {
|
|
||||||
cluster: cluster,
|
|
||||||
nodes: [hostname],
|
|
||||||
from: from.toISOString(),
|
|
||||||
to: to.toISOString() }
|
|
||||||
})
|
|
||||||
|
|
||||||
$: $nodesQuery.variables = { cluster, nodes: [hostname], from: from.toISOString(), to: to.toISOString() }
|
$: nodesQuery = queryStore({
|
||||||
|
client: client,
|
||||||
|
query: query,
|
||||||
|
variables: {
|
||||||
|
cluster: cluster,
|
||||||
|
nodes: [hostname],
|
||||||
|
from: from.toISOString(),
|
||||||
|
to: to.toISOString(),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
let metricUnits = {}
|
let metricUnits = {}
|
||||||
$: if ($nodesQuery.data) {
|
$: if ($nodesQuery.data) {
|
||||||
|
@ -7,14 +7,16 @@
|
|||||||
export let metricsInHistograms
|
export let metricsInHistograms
|
||||||
export let metricsInScatterplots
|
export let metricsInScatterplots
|
||||||
|
|
||||||
const updateConfigurationMutation = ({ name, value }) => {
|
const client = getContextClient();
|
||||||
result = mutationStore({
|
|
||||||
client: getContextClient(),
|
$: updateConfigurationMutation = ({ name, value }) => {
|
||||||
query: gql`mutation($name: String!, $value: String!) {
|
mutationStore({
|
||||||
updateConfiguration(name: $name, value: $value)
|
client: client,
|
||||||
}`,
|
query: gql`mutation($name: String!, $value: String!) {
|
||||||
variables: { name, value }
|
updateConfiguration(name: $name, value: $value)
|
||||||
})
|
}`,
|
||||||
|
variables: { name, value }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
let isHistogramConfigOpen = false, isScatterPlotConfigOpen = false
|
let isHistogramConfigOpen = false, isScatterPlotConfigOpen = false
|
||||||
@ -24,11 +26,7 @@
|
|||||||
updateConfigurationMutation({
|
updateConfigurationMutation({
|
||||||
name: data.name,
|
name: data.name,
|
||||||
value: JSON.stringify(data.value)
|
value: JSON.stringify(data.value)
|
||||||
})
|
})
|
||||||
.then(res => {
|
|
||||||
if (res.error)
|
|
||||||
console.error(res.error)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
export let cluster
|
export let cluster
|
||||||
|
|
||||||
let plotWidths = [], colWidth1 = 0, colWidth2
|
let plotWidths = [], colWidth1 = 0, colWidth2
|
||||||
|
|
||||||
let from = new Date(Date.now() - 5 * 60 * 1000), to = new Date(Date.now())
|
let from = new Date(Date.now() - 5 * 60 * 1000), to = new Date(Date.now())
|
||||||
const mainQuery = queryStore({
|
|
||||||
|
$: mainQuery = queryStore({
|
||||||
client: getContextClient(),
|
client: getContextClient(),
|
||||||
query: gql`query($cluster: String!, $filter: [JobFilter!]!, $metrics: [String!], $from: Time!, $to: Time!) {
|
query: gql`query($cluster: String!, $filter: [JobFilter!]!, $metrics: [String!], $from: Time!, $to: Time!) {
|
||||||
nodeMetrics(cluster: $cluster, metrics: $metrics, from: $from, to: $to) {
|
nodeMetrics(cluster: $cluster, metrics: $metrics, from: $from, to: $to) {
|
||||||
@ -61,7 +61,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
query(mainQuery)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Loading indicator & Refresh -->
|
<!-- Loading indicator & Refresh -->
|
||||||
@ -81,13 +80,8 @@
|
|||||||
</Col>
|
</Col>
|
||||||
<Col xs="auto" style="margin-left: auto;">
|
<Col xs="auto" style="margin-left: auto;">
|
||||||
<Refresher initially={120} on:reload={() => {
|
<Refresher initially={120} on:reload={() => {
|
||||||
console.log('reload...')
|
|
||||||
|
|
||||||
from = new Date(Date.now() - 5 * 60 * 1000)
|
from = new Date(Date.now() - 5 * 60 * 1000)
|
||||||
to = new Date(Date.now())
|
to = new Date(Date.now())
|
||||||
|
|
||||||
$mainQuery.variables = { ...$mainQuery.variables, from: from, to: to }
|
|
||||||
$mainQuery.reexecute({ requestPolicy: 'network-only' })
|
|
||||||
}} />
|
}} />
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
let hostnameFilter = ''
|
let hostnameFilter = ''
|
||||||
let selectedMetric = ccconfig.system_view_selectedMetric
|
let selectedMetric = ccconfig.system_view_selectedMetric
|
||||||
|
|
||||||
const nodesQuery = queryStore({
|
$: nodesQuery = queryStore({
|
||||||
client: getContextClient(),
|
client: getContextClient(),
|
||||||
query: gql`query($cluster: String!, $metrics: [String!], $from: Time!, $to: Time!) {
|
query: gql`query($cluster: String!, $metrics: [String!], $from: Time!, $to: Time!) {
|
||||||
nodeMetrics(cluster: $cluster, metrics: $metrics, from: $from, to: $to) {
|
nodeMetrics(cluster: $cluster, metrics: $metrics, from: $from, to: $to) {
|
||||||
@ -49,7 +49,7 @@
|
|||||||
}`,
|
}`,
|
||||||
variables: {
|
variables: {
|
||||||
cluster: cluster,
|
cluster: cluster,
|
||||||
metrics: [],
|
metrics: [selectedMetric],
|
||||||
from: from.toISOString(),
|
from: from.toISOString(),
|
||||||
to: to.toISOString()}
|
to: to.toISOString()}
|
||||||
})
|
})
|
||||||
@ -66,7 +66,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$: $nodesQuery.variables = { cluster, metrics: [selectedMetric], from: from.toISOString(), to: to.toISOString() }
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
|
Loading…
Reference in New Issue
Block a user