Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • clients/wotwizard-ui
  • manutopik/wotwizard-ui
  • wellno1/wotwizard-ui
3 results
Show changes
Showing
with 1136 additions and 383 deletions
<template> <template>
<aside class="menu shadow position-fixed"> <aside class="menu position-fixed d-flex flex-column border-end">
<div class="nav_header pb-3 mb-4"> <div class="mb-4">
<nuxt-link :to="localePath('/')" class="d-flex"> <nuxt-link
<img src="@/assets/img/logo.png" alt="Accueil" class="logo" /> @click.native="
if (screenwidth < 1200) {
toggleMenu()
}
"
:to="localePath('/')"
class="logo d-flex px-3 pt-3">
<img :src="$icon(512)" alt="Accueil" />
<div> <div>
<h1 class="h2">Wotwizard</h1> <h1 class="h3">Wotwizard</h1>
<small class="text-muted">{{ $t("slogan") }}</small> <small class="text-muted">{{ $t("slogan") }}</small>
</div> </div>
</nuxt-link> </nuxt-link>
<div <div class="p-3 border-bottom border-2 text-muted">
class="d-flex text-info justify-content-between align-items-baseline mt-3 mx-2"> <ApolloList />
<div class="">v0.05</div> <div class="small mt-2">API graphQL v{{ version }}</div>
<div class="small" v-if="countMax"> <div class="small" v-if="countMax">
{{ $t("bloc.title") }}<span class="font-weight-bold">{{ {{ $t("bloc.title") }}<span class="font-weight-bold">{{
countMax.number countMax.number
}}</span> }}</span>
({{ $d(new Date(countMax.utc0 * 1000), "short") }} {{ $t("time.a") }} ({{ $d(new Date(countMax.utc0 * 1000)) }} {{ $t("time.a") }}
{{ $d(new Date(countMax.utc0 * 1000), "time") }}) {{ new Date(countMax.utc0 * 1000).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) }})
</div> </div>
</div> </div>
<button <button
type="button" type="button"
class="close position-absolute d-xl-none" class="btn-close position-absolute d-xl-none"
aria-label="Close" :aria-label="$t('aria.close')"
@click="toggleMenu"> @click="toggleMenu"></button>
<span aria-hidden="true">&times;</span>
</button>
</div> </div>
<nav class="pt-4 rounded"> <nav class="py-2 rounded flex-grow-1">
<NavigationMenuGroup <NavigationMenuGroup
v-for="menu in menus" v-for="menu in menus"
:key="menu.title" :key="menu.title"
:menu="menu" :menu="menu"
@toggleMenu="toggleMenu" /> @toggleMenu="toggleMenu" />
</nav> </nav>
<div class="py-3 text-center">
<button
class="btn btn-secondary btn-sm"
@click="
if (screenwidth < 1200) {
toggleMenu()
}
$router.push(localePath('a-propos'))
">
<solid-terminal-icon
style="width: 0.9rem"
aria-hidden="true" />&nbsp;v{{ version_ww }} |
{{ $t("apropos.title") }}
</button>
</div>
</aside> </aside>
</template> </template>
<script> <script>
import pkg from "~/package.json"
import { LAST_BLOCK } from "@/graphql/queries.js" import { LAST_BLOCK } from "@/graphql/queries.js"
import { VERSION } from "@/graphql/queries.js"
export default { export default {
data() {
return {
screenwidth: 0,
version_ww: pkg.version
}
},
props: { props: {
menus: Array menus: Array
}, },
methods: { methods: {
toggleMenu() { toggleMenu() {
this.$emit("toggleMenu") this.$emit("toggleMenu")
},
onResize() {
this.$favourites.fixColumns()
this.screenwidth = window.innerWidth
} }
}, },
apollo: { apollo: {
$client() {
return this.getApolloClient
},
countMax: { countMax: {
query: LAST_BLOCK, query: LAST_BLOCK
error(err) { },
this.error = err.message version: {
} query: VERSION
} }
},
mounted() {
this.screenwidth = window.innerWidth
this.$nextTick(function () {
this.onResize()
})
window.addEventListener("resize", this.onResize)
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
aside {
background: var(--bg-menu-color);
}
nav { nav {
background: var(--background-color-secondary); overflow-x: hidden;
overflow-y: auto;
scrollbar-width: thin;
} }
</style> </style>
<template>
<div class="container pt-5">
<div class="row suivis">
<div class="col">
<div v-if="members && members.length != 0">
<BtnSearch
@erase="search = ''"
v-model="search"
class="col-sm-7 col-md-6 col-lg-5 col-xl-4 mx-auto mb-4" />
<MemberFilter
:selectedStatus.sync="filterStatus"
:selectedCertifStatus.sync="filterCerts"
:type="type" />
<MemberList
defaultSort="date_membership"
:members="filteredMembers"
:id="type" />
<input
type="checkbox"
class="btn-check"
:id="'seeAll' + _uid"
:checked="displayAll"
@click="displayAll = !displayAll" />
<label class="btn mb-3 btn-outline-secondary" :for="'seeAll' + _uid">
<span v-if="!displayAll">{{ $t("suivis.display.all") }}</span>
<span v-else>{{ $t("suivis.display.out") }}</span>
</label>
<button
class="btn btn-danger d-block m-auto mb-3"
v-if="type == 'favoris'"
@click="deleteAllFavorites">
<solid-trash-icon class="icon" aria-hidden="true" />
{{ $t("suivis.supprimer_tous") }}
</button>
</div>
<div class="alert alert-info" v-if="members && members.length == 0">
{{ $t("suivis.none") }}
</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
search: "",
filterStatus: [],
filterCerts: "",
displayAll: false,
nbItems: 0
}
},
props: {
type: {
type: String,
default: ""
},
members: {
type: Array,
required: true
}
},
computed: {
filteredMembers() {
return this.members.filter(
(el) =>
(this.displayAll ||
!(
el.status == "MEMBER" &&
this.$options.filters.dateStatus(el.certsLimit) == "success"
)) &&
el.uid.toLowerCase().includes(this.search.toLowerCase()) &&
this.filterStatus.includes(el.status) &&
el.expired == (this.filterCerts == "outdated")
)
}
},
methods: {
deleteAllFavorites() {
if (window.confirm(this.$t("suivis.confirm"))) {
this.$favourites.list = []
localStorage.removeItem("favourites")
}
}
},
mounted() {
this.$emit("update:nbItems", this.filteredMembers.length)
},
watch: {
filteredMembers(n, o) {
this.$emit("update:nbItems", n.length)
},
filterCerts(n, o) {
this.displayAll = n == "outdated"
}
}
}
</script>
<style lang="scss">
.suivis .table-responsive tbody {
max-height: 43.5vh;
}
</style>
{
"AxiomTeam": "https://gql.wotwizard.axiom-team.fr/",
"trentesaux": "https://gql.wotwizard.trentesaux.fr/",
"Pini": "https://wotwizard.pini.fr/"
}
...@@ -25,6 +25,12 @@ export const cache = new InMemoryCache({ ...@@ -25,6 +25,12 @@ export const cache = new InMemoryCache({
return `${object.member.hash}:${object.date}:${object.after}:${object.proba}` return `${object.member.hash}:${object.date}:${object.after}:${object.proba}`
case "GroupId": case "GroupId":
return `${object.id.hash}` return `${object.id.hash}`
case "CertHist":
return `${object.id.uid}:${object.hist[0].block.number}`
case "CertEvent":
return `${object.in}:${object.block.number}`
case "Block":
return `${object.number}`
default: default:
return defaultDataIdFromObject(object) // fall back to default handling return defaultDataIdFromObject(object) // fall back to default handling
} }
......
import { HttpLink } from 'apollo-link-http'
import { setContext } from 'apollo-link-context'
import { from } from 'apollo-link'
import { ENDPOINT1 } from './endpoints'
import { cache } from '../cache'
export default ctx => {
const ssrMiddleware = setContext((_, { headers }) => {
if (process.client) return headers
return {
headers
}
})
const httpLink = new HttpLink({
uri: ENDPOINT1
})
const link = from([ssrMiddleware, httpLink])
return {
link,
cache,
// https://github.com/nuxt-community/apollo-module/issues/306#issuecomment-607225431
defaultHttpLink: false
}
}
\ No newline at end of file
module.exports = {
ENDPOINT1: 'https://wwgql.coinduf.eu',
ENDPOINT2: 'https://myserver.com'
}
\ No newline at end of file
import { HttpLink } from 'apollo-link-http'
import { setContext } from 'apollo-link-context'
import { from } from 'apollo-link'
import { ENDPOINT2 } from './endpoints'
import { cache } from '../cache'
export default ctx => {
const ssrMiddleware = setContext((_, { headers }) => {
if (process.client) return headers
return {
headers
}
})
const httpLink = new HttpLink({
uri: ENDPOINT2
})
const link = from([ssrMiddleware, httpLink])
return {
link,
cache,
// https://github.com/nuxt-community/apollo-module/issues/306#issuecomment-607225431
defaultHttpLink: false
}
}
\ No newline at end of file
# WotWizard GraphQL TypeSystem # WotWizard GraphQL TypeSystem
# https://git.duniter.org/gerard94/WotWizard/-/blob/master/Help/TypeSystem.txt
type Query { type Query {
...@@ -29,14 +30,14 @@ type Query { ...@@ -29,14 +30,14 @@ type Query {
"'wwResult' displays the content of the WotWizard window" "'wwResult' displays the content of the WotWizard window"
wwResult: WWResult! wwResult: WWResult!
"'memEnds' displays the list of members, among the reference list 'group', who are about to loose their memberships, in the increasing order of event dates (bct); 'startFromNow' gives the period (in seconds) before the beginning of the list (0 if absent or null) , and 'period' gives the period covered by the list (infinite if absent or null). If 'group' is null or empty, the reference list is the whole Web Of Trust; if any string in 'group' is empty or doesn't refer to a known identity, it's not taken into account for the calculation, and, furthermore, if it is not empty and unknown, an error is raised" "'memEnds' displays the list of members, among the reference list 'group', who are about to loose their memberships, in the increasing order of event dates (bct); 'startFromNow' gives the period (in seconds) before the beginning of the list (0 if absent or null) , and 'period' gives the period covered by the list (infinite if absent or null). If 'group' is null or empty, the reference list is the whole Web Of Trust; if any string in 'group' is empty or doesn't refer to an identity known by the blockchain, it's not taken into account for the calculation, and, furthermore, if it is not empty and unknown to the blockchain, an error is raised"
memEnds (group: [String!], startFromNow: Int64, period: Int64): [Identity!]! memEnds (group: [String!], startFromNow: Int64, period: Int64): [Identity!]!
"'missEnds' displays the list of identities, among the reference list 'group', who are MISSING and about to be revoked, in the increasing order of event dates (bct); 'startFromNow' gives the period (in seconds) before the beginning of the list (0 if absent or null) , and 'period' gives the period covered by the list (infinite if absent or null). If 'group' is null or empty, the reference list is the whole Web Of Trust; if any string in 'group' is empty or doesn't refer to a known identity, it's not taken into account for the calculation, and, furthermore, if it is not empty and unknown, an error is raised" "'missEnds' displays the list of identities, among the reference list 'group', who are MISSING and about to be revoked, in the increasing order of event dates (bct); 'startFromNow' gives the period (in seconds) before the beginning of the list (0 if absent or null) , and 'period' gives the period covered by the list (infinite if absent or null). If 'group' is null or empty, the reference list is the whole Web Of Trust; if any string in 'group' is empty or doesn't refer to an identity known by the blockchain, it's not taken into account for the calculation, and, furthermore, if it is not empty and unknown to the blockchain, an error is raised"
missEnds (group: [String!], startFromNow: Int64, period: Int64): [Identity!]! missEnds (group: [String!], startFromNow: Int64, period: Int64): [Identity!]!
"'certEnds' displays the list of identities , among the reference list 'group', who are MEMBER or (possibly) MISSING and about to loose their 'ParameterName.sigQty'th oldest certification, in the increasing order of event dates (bct); 'startFromNow' gives the period (in seconds) before the beginning of the list (0 if absent or null) , and 'period' gives the period covered by the list (infinite if absent or null). If 'group' is null or empty, the reference list is the whole Web Of Trust; if any string in 'group' is empty or doesn't refer to a known identity, it's not taken into account for the calculation, and, furthermore, if it is not empty and unknown, an error is raised" "'certEnds' displays the list of identities , among the reference list 'group', who are MEMBER or (possibly) MISSING and about to loose their 'ParameterName.sigQty'th oldest certification, in the increasing order of event dates (bct); 'startFromNow' gives the period (in seconds) before the beginning of the list (0 if absent or null) , and 'period' gives the period covered by the list (infinite if absent or null). If 'group' is null or empty, the reference list is the whole Web Of Trust; if any string in 'group' is empty or doesn't refer to an identity known by the blockchain, it's not taken into account for the calculation, and, furthermore, if it is not empty and unknown to the blockchain, an error is raised"
certEnds (group: [String!], startFromNow: Int64, period: Int64, missingIncluded: Boolean! = true): [DatedIdentity!]! certEnds (group: [String!], startFromNow: Int64, period: Int64, missingIncluded: Boolean! = true): [Identity!]!
"'countMin' gives the first block of the blockchain" "'countMin' gives the first block of the blockchain"
countMin: Block! countMin: Block!
...@@ -80,16 +81,16 @@ type Query { ...@@ -80,16 +81,16 @@ type Query {
"'version' returns a string describing the version of the graphQL server" "'version' returns a string describing the version of the graphQL server"
version: String! version: String!
"'calcDist' returns the distance of the identity whose pseudo is 'uid' when the members 'certifiers' are added to her own certifiers. 'uid' may be any string, even null or empty; if 'uid' is null or empty or doesn't refer to a known identity, it's not taken into account for the calculation, and, furthermore, if it is not null, not empty and unknown, an error is raised; the same for any string in 'certifiers'" "'calcDist' returns the distance of the identity whose pseudo is 'uid' when the members 'certifiers' are added to her own certifiers. 'uid' may be any string, even null or empty; if 'uid' is null or empty or doesn't refer to a known identity, it's not taken into account for the calculation, and, furthermore, if it is not null, not empty and unknown, an error is raised; the same for any string in 'certifiers', which must also correspond to a member"
calcDist (uid: String, certifiers: [String!]): Distance! calcDist (uid: String, certifiers: [String!]): Distance!
"'calcQual' returns the quality of the identity whose pseudo is 'uid' when the members 'certifiers' are added to her own certifiers. 'uid' may be any string, even null or empty; if 'uid' is null or empty or doesn't refer to a known identity, it's not taken into account for the calculation, and, furthermore, if it is not null, not empty and unknown, an error is raised; the same for any string in 'certifiers'" "'calcQual' returns the quality of the identity whose pseudo is 'uid' when the members 'certifiers' are added to her own certifiers. 'uid' may be any string, even null or empty; if 'uid' is null or empty or doesn't refer to a known identity, it's not taken into account for the calculation, and, furthermore, if it is not null, not empty and unknown, an error is raised; the same for any string in 'certifiers', which must also correspond to a member"
calcQual (uid: String, certifiers: [String!]): Fraction! calcQual (uid: String, certifiers: [String!]): Fraction!
"'bestDist' returns a list of members, among the reference list 'group', who could certify the identity whose pseudo is 'uid', together with the distance such a certification would give to the identity. 'certifiers' is a list of members supposed having already certified the identity in addition to her own certifiers. If 'group' is null or empty, the reference list is the whole Web Of Trust. 'uid' may be any string, even null or empty; if 'uid' is null or empty or doesn't refer to a known identity, it's not taken into account for the calculation, and, furthermore, if it is not null, not empty and unknown, an error is raised; the same for any string in 'group' or 'certifiers', and, furthermore, if the latter is not empty, it should refer to a member. 'answerNb' is the greatest number of answers in the result. If 'answerNb' is null, zero or negative, all answers are returned. Answers are sorted in the decreasing order of 'IdDist.dist.value.ratio'" "'bestDist' returns a list of members, among the reference list 'group', who could certify the identity whose pseudo is 'uid', together with the distance such a certification would give to the identity. 'certifiers' is a list of members supposed having already certified the identity in addition to her own certifiers. If 'group' is null or empty, the reference list is the whole Web Of Trust. 'uid' may be any string, even null or empty; if 'uid' is null or empty or doesn't refer to an identity known by the blockchain, it's not taken into account for the calculation, and, furthermore, if it is not null, not empty and unknown to the blockchain, an error is raised; the same for any string in 'group' or 'certifiers', and, furthermore, if the latter is not empty, it should refer to a member. 'answerNb' is the greatest number of answers in the result. If 'answerNb' is null, zero or negative, all answers are returned. Answers are sorted in the decreasing order of 'IdDist.dist.value.ratio'"
bestDist (group: [String!], uid: String, certifiers: [String!], answerNb: Int): [IdDist!]! bestDist (group: [String!], uid: String, certifiers: [String!], answerNb: Int): [IdDist!]!
"'bestQual' returns a list of members, among the reference list 'group', who could certify the identity whose pseudo is 'uid', together with the quality such a certification would give to the identity. 'certifiers' is a list of members supposed having already certified the identity in addition to her own certifiers. If 'group' is null or empty, the reference list is the whole Web Of Trust. 'uid' may be any string, even null or empty; if 'uid' is null or empty or doesn't refer to a known identity, it's not taken into account for the calculation, and, furthermore, if it is not null, not empty and unknown, an error is raised; the same for any string in 'group' or 'certifiers', and, furthermore, if the latter is not empty, it should refer to a member. 'answerNb' is the greatest number of answers in the result. If 'answerNb' is null, zero or negative, all answers are returned. Answers are sorted in the decreasing order of 'IdQual.qual.ratio'" "'bestQual' returns a list of members, among the reference list 'group', who could certify the identity whose pseudo is 'uid', together with the quality such a certification would give to the identity. 'certifiers' is a list of members supposed having already certified the identity in addition to her own certifiers. If 'group' is null or empty, the reference list is the whole Web Of Trust. 'uid' may be any string, even null or empty; if 'uid' is null or empty or doesn't refer to an identity known by the blockchain, it's not taken into account for the calculation, and, furthermore, if it is not null, not empty and unknown to the blockchain, an error is raised; the same for any string in 'group' or 'certifiers', and, furthermore, if the latter is not empty, it should refer to a member. 'answerNb' is the greatest number of answers in the result. If 'answerNb' is null, zero or negative, all answers are returned. Answers are sorted in the decreasing order of 'IdQual.qual.ratio'"
bestQual (group: [String!], uid: String, certifiers: [String!], answerNb: Int): [IdQual!]! bestQual (group: [String!], uid: String, certifiers: [String!], answerNb: Int): [IdQual!]!
} #Query } #Query
...@@ -123,28 +124,42 @@ type Subscription { ...@@ -123,28 +124,42 @@ type Subscription {
} #Subscription } #Subscription
"Output of Query.filterGroup, used with a list of statuses; 'selected' owns the uid(s) of identities whose statuses are in the list, 'others' owns those who are not in the list, and 'unknown' corresponds to unknown identities." "Output of Query.filterGroup, used with a list of statuses; 'selected' owns the uid(s) of identities whose statuses are in the list, 'others' owns those who are not in the list, and 'unknown' corresponds to unknown identities; 'duplicate' displays all uid(s) with multiple occurrences in the original list."
type GroupFilter { type GroupFilter {
selected: [String!]!
others: [Error!]! "List of identities in the group whose statuses have been selected"
unknown: [Error!]! selected: [GroupId!]!
duplicate: [Error!]!
"List of identities in the group whose statuses have not been selected"
others: [GroupId!]!
"List of uid(s) in the group who were not found"
unknown: [GroupString!]!
"List of uid(s) with multiple occurrences in the original group"
duplicate: [GroupString!]!
} #Group_Filter } #Group_Filter
type Error { type GroupId {
mes: String!
path: [FieldOrRank!]! "Found Identity"
} #Error id: Identity!
"Index in the original list, starting from 0"
index: Int!
union FieldOrRank = Field | Rank } #GroupId
type Field { type GroupString {
name: String!
} #Field
type Rank { "Uid whose identity has or has not been found"
uid: String!
"Index in the original list, starting from 0"
index: Int! index: Int!
} #Rank
} #GroupString
"WoT identity" "WoT identity"
type Identity { type Identity {
...@@ -179,6 +194,9 @@ type Identity { ...@@ -179,6 +194,9 @@ type Identity {
"Limit date of the membership application; null for REVOKED; limit date before revocation for MISSING" "Limit date of the membership application; null for REVOKED; limit date before revocation for MISSING"
limitDate: Int64 limitDate: Int64
"Limit date of the 'ParameterName.sigQty'th oldest received certification; or null if less than 'ParameterName.sigQty' certifications received; null for REVOKED and NEWCOMER"
certsLimit: Int64
"Member is leaving? null for REVOKED or NEWCOMER" "Member is leaving? null for REVOKED or NEWCOMER"
isLeaving: Boolean isLeaving: Boolean
...@@ -186,7 +204,7 @@ type Identity { ...@@ -186,7 +204,7 @@ type Identity {
sentry: Boolean sentry: Boolean
"Active received certifications, sorted by increasing pubkeys" "Active received certifications, sorted by increasing pubkeys"
received_certifications: Received_Certifications! received_certifications: [Certification!]!
"Active sent certifications, sorted by increasing pubkeys" "Active sent certifications, sorted by increasing pubkeys"
sent_certifications: [Certification!]! sent_certifications: [Certification!]!
...@@ -229,17 +247,6 @@ type Identity { ...@@ -229,17 +247,6 @@ type Identity {
} #Identity } #Identity
"The association of 'Identity' and date"
type DatedIdentity {
"Identity"
id: Identity!
"Associated date"
date: Int64!
}
"Status of an identity in WoT" "Status of an identity in WoT"
enum Identity_Status { enum Identity_Status {
...@@ -299,17 +306,6 @@ type IdSearchOutput { ...@@ -299,17 +306,6 @@ type IdSearchOutput {
} #IdSearchOutput } #IdSearchOutput
"Certifications received by an identity"
type Received_Certifications {
"List of all valid received certifications"
certifications: [Certification!]!
"Limit date of the 'ParameterName.sigQty'th oldest received certification; or null if less than 'ParameterName.sigQty' certifications received"
limit: Int64
} #received_Certifications
"Certification sent by 'from' and received by 'to'" "Certification sent by 'from' and received by 'to'"
type Certification { type Certification {
...@@ -595,7 +591,7 @@ type Forecast { ...@@ -595,7 +591,7 @@ type Forecast {
"Entry or exit of an identity" "Entry or exit of an identity"
type EventId { type EventId {
member: Identity! id: Identity!
"Entry or exit; true if entry" "Entry or exit; true if entry"
inOut: Boolean! inOut: Boolean!
...@@ -734,16 +730,16 @@ type Fraction { ...@@ -734,16 +730,16 @@ type Fraction {
} #fraction } #fraction
"64 bits signed integer" "64 bits signed integer"
scalar Int64 scalar Int64 @specifiedBy(url: "https://go.dev/ref/spec#Numeric_types")
"Avatar of String" "Avatar of String"
scalar Hash scalar Hash @specifiedBy(url: "https://git.duniter.org/nodes/common/doc/blob/master/rfc/0009_Duniter_Blockchain_Protocol_V11.md")
"Avatar of String" "Avatar of String"
scalar Pubkey scalar Pubkey @specifiedBy(url: "https://git.duniter.org/nodes/common/doc/blob/master/rfc/0009_Duniter_Blockchain_Protocol_V11.md#public-key")
"Empty result" "Empty result"
scalar Void scalar Void
"Int, Int64 or Float" "Int, Int64 or Float"
scalar Number scalar Number @specifiedBy(url: "https://ieeexplore.ieee.org/document/4610935")
\ No newline at end of file
const { HttpLink } = require("apollo-link-http");
const { setContext } = require("apollo-link-context");
const { from } = require("apollo-link");
const { cache } = require("../cache");
const ssrMiddleware = setContext((_, { headers }) => {
if (process.client) return headers;
return { headers };
});
const httpLink = new HttpLink({ uri: "https://gql.wotwizard.axiom-team.fr/" });
const link = from([ssrMiddleware, httpLink]);
module.exports = () => ({
link,
cache,
defaultHttpLink: false
});
const { HttpLink } = require("apollo-link-http");
const { setContext } = require("apollo-link-context");
const { from } = require("apollo-link");
const { cache } = require("../cache");
const ssrMiddleware = setContext((_, { headers }) => {
if (process.client) return headers;
return { headers };
});
const httpLink = new HttpLink({ uri: "https://wotwizard.pini.fr/" });
const link = from([ssrMiddleware, httpLink]);
module.exports = () => ({
link,
cache,
defaultHttpLink: false
});
const { HttpLink } = require("apollo-link-http");
const { setContext } = require("apollo-link-context");
const { from } = require("apollo-link");
const { cache } = require("../cache");
const ssrMiddleware = setContext((_, { headers }) => {
if (process.client) return headers;
return { headers };
});
const httpLink = new HttpLink({ uri: "https://gql.wotwizard.trentesaux.fr/" });
const link = from([ssrMiddleware, httpLink]);
module.exports = () => ({
link,
cache,
defaultHttpLink: false
});
{ {"__schema":{"types":[{"kind":"UNION","name":"CertifOrDossier","possibleTypes":[{"name":"MarkedDatedCertification"},{"name":"MarkedDossier"}]},{"kind":"INTERFACE","name":"File","possibleTypes":[{"name":"FileS"}]},{"kind":"INTERFACE","name":"WWResult","possibleTypes":[{"name":"WWResultS"}]}]}}
"__schema": { \ No newline at end of file
"types": [
{
"kind": "UNION",
"name": "CertifOrDossier",
"possibleTypes": [
{ "name": "MarkedDatedCertification" },
{ "name": "MarkedDossier" }
]
},
{
"kind": "INTERFACE",
"name": "File",
"possibleTypes": [{ "name": "FileS" }]
},
{
"kind": "INTERFACE",
"name": "WWResult",
"possibleTypes": [{ "name": "WWResultS" }]
}
]
}
}
const fs = require('fs');
const path = require('path');
const endpoints = require('../endpoints.json');
const endpointDir = path.join(__dirname, 'endpoints');
const recreateDirectory = (directory) => {
if (fs.existsSync(directory)) {
fs.rmSync(directory, { recursive: true, force: true });
}
fs.mkdirSync(directory, { recursive: true });
};
recreateDirectory(endpointDir);
const configTemplate = (uri) => `
const { HttpLink } = require("apollo-link-http");
const { setContext } = require("apollo-link-context");
const { from } = require("apollo-link");
const { cache } = require("../cache");
const ssrMiddleware = setContext((_, { headers }) => {
if (process.client) return headers;
return { headers };
});
const httpLink = new HttpLink({ uri: "${uri}" });
const link = from([ssrMiddleware, httpLink]);
module.exports = () => ({
link,
cache,
defaultHttpLink: false
});
`;
Object.keys(endpoints).forEach(key => {
const filePath = path.join(endpointDir, `${key}.js`);
const fileContent = configTemplate(endpoints[key]);
fs.writeFileSync(filePath, fileContent);
});
import gql from "graphql-tag" import gql from "graphql-tag"
export const VERSION = gql`
query Version {
version
}
`
// Pour la sidebar // Pour la sidebar
export const LAST_BLOCK = gql` export const LAST_BLOCK = gql`
query LastBlock { query LastBlock {
...@@ -23,7 +29,14 @@ export const LAST_EVENTS = gql` ...@@ -23,7 +29,14 @@ export const LAST_EVENTS = gql`
uid uid
status status
hash hash
minDatePassed
minDate
certsLimit
limitDate limitDate
quality {
__typename
ratio
}
history { history {
__typename __typename
in in
...@@ -32,9 +45,9 @@ export const LAST_EVENTS = gql` ...@@ -32,9 +45,9 @@ export const LAST_EVENTS = gql`
number number
} }
} }
received_certifications { sent_certifications {
__typename __typename
limit pending
} }
} }
inOut inOut
...@@ -43,6 +56,7 @@ export const LAST_EVENTS = gql` ...@@ -43,6 +56,7 @@ export const LAST_EVENTS = gql`
__typename __typename
number number
} }
number
} }
} }
` `
...@@ -63,11 +77,8 @@ export const NEWCOMERS = gql` ...@@ -63,11 +77,8 @@ export const NEWCOMERS = gql`
uid uid
status status
hash hash
certsLimit
limitDate limitDate
received_certifications {
__typename
limit
}
} }
date date
after after
...@@ -77,7 +88,7 @@ export const NEWCOMERS = gql` ...@@ -77,7 +88,7 @@ export const NEWCOMERS = gql`
} }
` `
// Pour la page membres/index // Pour la page membre
export const SEARCH_MEMBERS = gql` export const SEARCH_MEMBERS = gql`
query SearchMember($hint: String) { query SearchMember($hint: String) {
idSearch(with: { hint: $hint }) { idSearch(with: { hint: $hint }) {
...@@ -87,18 +98,25 @@ export const SEARCH_MEMBERS = gql` ...@@ -87,18 +98,25 @@ export const SEARCH_MEMBERS = gql`
pubkey pubkey
uid uid
status status
minDate
minDatePassed
hash hash
certsLimit
limitDate limitDate
received_certifications { quality {
__typename __typename
limit ratio
}
sent_certifications {
__typename
pending
} }
} }
} }
} }
` `
// Pour la page membres/_hash // Pour la page membre
export const SEARCH_MEMBER = gql` export const SEARCH_MEMBER = gql`
query SearchMemberWithHash($hash: Hash!) { query SearchMemberWithHash($hash: Hash!) {
idFromHash(hash: $hash) { idFromHash(hash: $hash) {
...@@ -107,6 +125,12 @@ export const SEARCH_MEMBER = gql` ...@@ -107,6 +125,12 @@ export const SEARCH_MEMBER = gql`
isLeaving isLeaving
sentry sentry
membership_pending membership_pending
all_certifiersIO {
...IO
}
all_certifiedIO {
...IO
}
distanceE { distanceE {
__typename __typename
value { value {
...@@ -125,14 +149,11 @@ export const SEARCH_MEMBER = gql` ...@@ -125,14 +149,11 @@ export const SEARCH_MEMBER = gql`
} }
received_certifications { received_certifications {
__typename __typename
certifications { from {
__typename ...attr
from {
...attr
}
expires_on
pending
} }
expires_on
pending
} }
sent_certifications { sent_certifications {
__typename __typename
...@@ -148,7 +169,9 @@ export const SEARCH_MEMBER = gql` ...@@ -148,7 +169,9 @@ export const SEARCH_MEMBER = gql`
__typename __typename
uid uid
hash hash
pubkey
status status
certsLimit
limitDate limitDate
minDate minDate
minDatePassed minDatePassed
...@@ -156,9 +179,24 @@ export const SEARCH_MEMBER = gql` ...@@ -156,9 +179,24 @@ export const SEARCH_MEMBER = gql`
__typename __typename
ratio ratio
} }
received_certifications { sent_certifications {
__typename
pending
}
}
fragment IO on CertHist {
__typename
id {
...attr
}
hist {
__typename __typename
limit in
block {
__typename
number
utc0
}
} }
} }
` `
...@@ -174,9 +212,9 @@ export const PARAMS = gql` ...@@ -174,9 +212,9 @@ export const PARAMS = gql`
} }
} }
` `
// Pour la page favoris // Pour la page des suivis
export const FAVORIS = gql` export const MEMBERS = gql`
query getFavoris($group: [String!]!) { query getMembers($group: [String!]!) {
filterGroup(group: $group) { filterGroup(group: $group) {
__typename __typename
selected { selected {
...@@ -199,27 +237,75 @@ export const FAVORIS = gql` ...@@ -199,27 +237,75 @@ export const FAVORIS = gql`
uid uid
status status
hash hash
certsLimit
limitDate limitDate
received_certifications { minDatePassed
minDate
quality {
__typename
ratio
}
sent_certifications {
__typename __typename
limit pending
} }
} }
` `
// Pour la page index // Pour la page previsions/futures_sorties
export const NEXT_EXITS = gql` export const NEXT_EXITS = gql`
query NextExits($group: [String!], $start: Int64, $period: Int64) { query NextExits($group: [String!], $start: Int64, $period: Int64) {
memEnds (group: $group, startFromNow: $start, period: $period) { memEnds(group: $group, startFromNow: $start, period: $period) {
__typename __typename
pubkey pubkey
uid uid
status status
hash hash
minDatePassed
minDate
certsLimit
limitDate limitDate
received_certifications { quality {
__typename __typename
limit ratio
}
sent_certifications {
__typename
pending
}
}
}
`
// Pour la page previsions/futures_sorties
export const NEXT_LOOSE_CERTS = gql`
query NextLoseCerts(
$group: [String!]
$start: Int64
$period: Int64
$missingIncluded: Boolean
) {
certEnds(
group: $group
startFromNow: $start
period: $period
missingIncluded: $missingIncluded
) {
__typename
pubkey
uid
status
hash
minDatePassed
minDate
certsLimit
limitDate
quality {
__typename
ratio
}
sent_certifications {
__typename
pending
} }
} }
} }
......
const { ENDPOINT1 } = require('./clients/endpoints'); const fetch = (...args) => import('node-fetch').then(({ default: fetch }) => fetch(...args));
const fetch = require('node-fetch'); const fs = require("fs")
const fs = require('fs');
fetch(ENDPOINT1, { fetch("https://gql.wotwizard.trentesaux.fr/", {
method: 'POST', method: "POST",
headers: { 'Content-Type': 'application/json' }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ body: JSON.stringify({
variables: {}, variables: {},
query: ` query: `
{ {
__schema { __schema {
types { types {
...@@ -19,21 +18,28 @@ fetch(ENDPOINT1, { ...@@ -19,21 +18,28 @@ fetch(ENDPOINT1, {
} }
} }
} }
`, `
}), })
}) })
.then(result => result.json()) .then((result) => result.json())
.then(result => { .then((result) => {
const filteredData = result.data.__schema.types.filter( const filteredData = result.data.__schema.types.filter(
type => type.possibleTypes !== null (type) => type.possibleTypes !== null
) )
result.data.__schema.types = filteredData; result.data.__schema.types = filteredData
fs.writeFile('./graphql/fragmentTypes.json', JSON.stringify(result.data), err => { fs.writeFile(
if (err) { "./graphql/fragmentTypes.json",
console.error('Error writing fragmentTypes file', err); JSON.stringify(result.data),
} else { (err) => {
console.log('Fragment types successfully extracted!'); if (err) {
} console.error("Error writing fragmentTypes file", err)
}); } else {
}); console.log("Fragment types successfully extracted!")
\ No newline at end of file }
}
)
})
.catch(function (error) {
console.log(error.message)
})
import en from './locales/en.json' import { dateTimeFormats } from "./locales/dateTimeFormats"
import fr from './locales/fr.json'
import es from './locales/es.json'
import { dateTimeFormats } from './locales/dateTimeFormats'
export default { export default {
fallbackLocale: 'en', dateTimeFormats
dateTimeFormats, }
messages: { en, fr, es }
}
\ No newline at end of file
const objTime = {
short: {
day: "2-digit",
month: "2-digit",
year: "2-digit"
},
long: {
day: "numeric",
month: "long",
year: "numeric"
},
hour: {
hour: "numeric"
},
min: {
minute: "2-digit"
},
time: {
hour: "numeric",
minute: "2-digit",
hour12: false
}
}
export const dateTimeFormats = { export const dateTimeFormats = {
'fr': { de: objTime,
short: { en: objTime,
day: 'numeric', es: objTime,
month: 'short', fr: objTime,
year: '2-digit' it: objTime
}, }
long: {
day: 'numeric',
month: 'long',
year: 'numeric',
},
hour: {
hour: 'numeric'
},
min: {
minute: '2-digit'
},
time: {
hour: 'numeric',
minute: '2-digit',
hour12: false,
}
},
'en': {
short: {
day: 'numeric',
month: 'short',
year: '2-digit'
},
long: {
month: 'long',
day: 'numeric',
year: 'numeric',
},
hour: {
hour: 'numeric'
},
min: {
minute: '2-digit'
},
time: {
hour: 'numeric',
minute: '2-digit',
hour12: true,
}
},
'es': {
short: {
day: 'numeric',
month: 'short',
year: '2-digit'
},
long: {
day: 'numeric',
month: 'long',
year: 'numeric',
},
hour: {
hour: 'numeric'
},
min: {
minute: '2-digit'
},
time: {
hour: 'numeric',
minute: '2-digit',
hour12: false,
}
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.