Added GraphQL types section in docs

This commit is contained in:
Andrew Bastin
2019-11-18 15:17:33 -05:00
parent 2d995b87b1
commit 34be6ce795

View File

@@ -58,6 +58,13 @@
</div> </div>
</div> </div>
<input v-if="gqlTypes.length > 0" id="gqltypes-tab" type="radio" name="side" checked="checked" />
<label v-if="gqlTypes.length > 0" for="gqltypes-tab">Types</label>
<div v-if="gqlTypes.length > 0" class="tab">
<div v-for="type in gqlTypes" :key="type.name">
<gql-type :gqlType="type" />
</div>
</div>
</section> </section>
</pw-section> </pw-section>
</div> </div>
@@ -74,6 +81,7 @@ export default {
components: { components: {
"pw-section": () => import("../components/section"), "pw-section": () => import("../components/section"),
"gql-field": () => import("../components/graphql/field"), "gql-field": () => import("../components/graphql/field"),
"gql-type": () => import("../components/graphql/type"),
Editor: AceEditor Editor: AceEditor
}, },
data() { data() {
@@ -82,7 +90,8 @@ export default {
schemaString: "", schemaString: "",
queryFields: [], queryFields: [],
mutationFields: [], mutationFields: [],
subscriptionFields: [] subscriptionFields: [],
gqlTypes: []
}; };
}, },
methods: { methods: {
@@ -132,6 +141,14 @@ export default {
this.subscriptionFields = sFields; this.subscriptionFields = sFields;
} }
const typeMap = schema.getTypeMap();
const types = [];
for (const type in typeMap) {
types.push(typeMap[type]);
}
this.gqlTypes = types;
console.log(this.gqlTypes);
this.$nuxt.$loading.finish(); this.$nuxt.$loading.finish();
const duration = Date.now() - startTime; const duration = Date.now() - startTime;
this.$toast.info(`Finished in ${duration}ms`, { this.$toast.info(`Finished in ${duration}ms`, {