├── .editorconfig
├── .gitignore
├── README.md
├── angular-cli.json
├── config
├── karma.conf.js
└── protractor.conf.js
├── e2e
├── app.e2e-spec.ts
├── app.po.ts
└── tsconfig.json
├── package.json
├── public
└── .npmignore
├── src
├── app
│ ├── app.component.css
│ ├── app.component.html
│ ├── app.component.spec.ts
│ ├── app.component.ts
│ ├── app.html
│ ├── app.module.ts
│ ├── app.ts
│ ├── boot.ts
│ ├── environments
│ │ ├── environment.dev.ts
│ │ ├── environment.prod.ts
│ │ └── environment.ts
│ ├── formTest.ts
│ ├── gql-args-form.html
│ ├── gql-args-form.ts
│ ├── gql-list.html
│ ├── gql-list.ts
│ ├── gql-mutation.html
│ ├── gql-mutation.ts
│ ├── gql-query-links.html
│ ├── gql-query-links.spec.ts
│ ├── gql-query-links.ts
│ ├── gql-scalar.html
│ ├── gql-scalar.ts
│ ├── graphql_builder.spec.ts
│ ├── graphql_builder.ts
│ ├── home.ts
│ ├── index.ts
│ ├── introspection_query.ts
│ ├── query.html
│ ├── query.ts
│ ├── query_type_query.ts
│ ├── routes.ts
│ ├── schema_service.spec.ts
│ ├── schema_service.ts
│ └── shared
│ │ └── index.ts
├── favicon.ico
├── fixtures
│ ├── example_schema.ts
│ ├── github_schema.ts
│ ├── graphql_hub_schema.ts
│ └── swapi_schema.ts
├── index.html
├── main.ts
├── polyfills.ts
├── test.ts
├── tsconfig.json
└── typings.d.ts
└── tslint.json
/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see http://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | indent_style = space
7 | indent_size = 2
8 | end_of_line = lf
9 | insert_final_newline = true
10 | trim_trailing_whitespace = true
11 |
12 | [*.md]
13 | max_line_length = 0
14 | trim_trailing_whitespace = false
15 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist
5 | /tmp
6 |
7 | # dependencies
8 | /node_modules
9 | /bower_components
10 |
11 | # IDEs and editors
12 | /.idea
13 | .project
14 | .classpath
15 | *.launch
16 | .settings/
17 |
18 | # misc
19 | /.sass-cache
20 | /connect.lock
21 | /coverage/*
22 | /libpeerconnection.log
23 | npm-debug.log
24 | testem.log
25 | /typings
26 |
27 | # e2e
28 | /e2e/*.js
29 | /e2e/*.map
30 |
31 | #System Files
32 | .DS_Store
33 | Thumbs.db
34 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # graphql-admin
2 |
3 | ## This project is now abandoned. Go see [the React version](http://github.com/gaslight/graphql-admin-react) instead.
4 |
5 | This is a spike of dynamically creating a front end for a graphql server using introspection.
6 | So far the following works:
7 |
8 | * Listing all queries
9 | * Executing queries that return a list
10 | * Executing queries that return a scalar value
11 | * with arguments
12 | * Mutations
13 |
14 | This project was generated with [angular-cli](https://github.com/angular/angular-cli) version 1.0.0-beta.11-webpack.2.
15 |
16 | ## setup
17 |
18 | ```
19 | npm install
20 | ```
21 |
22 | Then, you may want to modify `src/app/app.module.ts` to configure the graphql client to point to your server. Currently it's set to point at `http://graphqlhub.com/graphql`. Whatever server
23 | you point at will need to support CORS or you will get cross-origin errors.
24 |
25 | ## Development server
26 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
27 |
28 | ## GraphQL server
29 |
30 | Initial developer of this project has been tested using [our fork](https://github.com/gaslight/absinthe_example) the example [Absinthe](http://absinthe-graphql.org/) project. To try it, clone this
31 | project and run it. It already supports CORS so it should "Just Work" (TM).
32 |
--------------------------------------------------------------------------------
/angular-cli.json:
--------------------------------------------------------------------------------
1 | {
2 | "project": {
3 | "version": "1.0.0-beta.11-webpack.2",
4 | "name": "angular2-cli-spike"
5 | },
6 | "apps": [
7 | {
8 | "main": "src/main.ts",
9 | "tsconfig": "src/tsconfig.json",
10 | "mobile": false
11 | }
12 | ],
13 | "addons": [],
14 | "packages": [],
15 | "e2e": {
16 | "protractor": {
17 | "config": "config/protractor.conf.js"
18 | }
19 | },
20 | "test": {
21 | "karma": {
22 | "config": "config/karma.conf.js"
23 | }
24 | },
25 | "defaults": {
26 | "prefix": "app",
27 | "sourceDir": "src",
28 | "styleExt": "css",
29 | "prefixInterfaces": false,
30 | "lazyRoutePrefix": "+"
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/config/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/0.13/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | config.set({
6 | basePath: '..',
7 | frameworks: ['jasmine', 'angular-cli'],
8 | plugins: [
9 | require('karma-jasmine'),
10 | require('karma-chrome-launcher'),
11 | require('karma-phantomjs-launcher'),
12 | require('karma-remap-istanbul'),
13 | require('angular-cli/plugins/karma')
14 | ],
15 | customLaunchers: {
16 | // chrome setup for travis CI using chromium
17 | Chrome_travis_ci: {
18 | base: 'Chrome',
19 | flags: ['--no-sandbox']
20 | }
21 | },
22 | files: [
23 | { pattern: './src/test.ts', watched: false }
24 | ],
25 | preprocessors: {
26 | './src/test.ts': ['angular-cli']
27 | },
28 | remapIstanbulReporter: {
29 | reports: {
30 | html: 'coverage'
31 | }
32 | },
33 | angularCliConfig: './angular-cli.json',
34 | reporters: ['progress', 'karma-remap-istanbul'],
35 | port: 9876,
36 | colors: true,
37 | logLevel: config.LOG_INFO,
38 | autoWatch: true,
39 | browsers: ['PhantomJS'],
40 | singleRun: false
41 | });
42 | };
43 |
--------------------------------------------------------------------------------
/config/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // Protractor configuration file, see link for more information
2 | // https://github.com/angular/protractor/blob/master/docs/referenceConf.js
3 |
4 | /*global jasmine */
5 | var SpecReporter = require('jasmine-spec-reporter');
6 |
7 | exports.config = {
8 | allScriptsTimeout: 11000,
9 | specs: [
10 | '../e2e/**/*.e2e-spec.ts'
11 | ],
12 | capabilities: {
13 | 'browserName': 'chrome'
14 | },
15 | directConnect: true,
16 | baseUrl: 'http://localhost:4200/',
17 | framework: 'jasmine',
18 | jasmineNodeOpts: {
19 | showColors: true,
20 | defaultTimeoutInterval: 30000,
21 | print: function() {}
22 | },
23 | useAllAngular2AppRoots: true,
24 | beforeLaunch: function() {
25 | require('ts-node').register({
26 | project: 'e2e'
27 | });
28 | },
29 | onPrepare: function() {
30 | jasmine.getEnv().addReporter(new SpecReporter());
31 | }
32 | };
33 |
--------------------------------------------------------------------------------
/e2e/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { Angular2CliSpikePage } from './app.po';
2 |
3 | describe('angular2-cli-spike App', function() {
4 | let page: Angular2CliSpikePage;
5 |
6 | beforeEach(() => {
7 | page = new Angular2CliSpikePage();
8 | });
9 |
10 | it('should display message saying app works', () => {
11 | page.navigateTo();
12 | expect(page.getParagraphText()).toEqual('app works!');
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/e2e/app.po.ts:
--------------------------------------------------------------------------------
1 | export class Angular2CliSpikePage {
2 | navigateTo() {
3 | return browser.get('/');
4 | }
5 |
6 | getParagraphText() {
7 | return element(by.css('app-root h1')).getText();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/e2e/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "declaration": false,
5 | "emitDecoratorMetadata": true,
6 | "experimentalDecorators": true,
7 | "module": "commonjs",
8 | "moduleResolution": "node",
9 | "outDir": "../dist/out-tsc-e2e",
10 | "sourceMap": true,
11 | "target": "es5",
12 | "typeRoots": [
13 | "../node_modules/@types"
14 | ]
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "angular2-cli-spike",
3 | "version": "0.0.0",
4 | "license": "MIT",
5 | "angular-cli": {},
6 | "scripts": {
7 | "start": "ng serve",
8 | "lint": "tslint \"src/**/*.ts\"",
9 | "test": "ng test",
10 | "pree2e": "webdriver-manager update",
11 | "e2e": "protractor"
12 | },
13 | "private": true,
14 | "dependencies": {
15 | "@angular/common": "2.0.0-rc.5",
16 | "@angular/compiler": "2.0.0-rc.5",
17 | "@angular/core": "2.0.0-rc.5",
18 | "@angular/forms": "0.3.0",
19 | "@angular/http": "2.0.0-rc.5",
20 | "@angular/platform-browser": "2.0.0-rc.5",
21 | "@angular/platform-browser-dynamic": "2.0.0-rc.5",
22 | "@angular/router": "3.0.0-rc.1",
23 | "angular2-apollo": "^0.4.2",
24 | "apollo-client": "^0.4.11",
25 | "core-js": "^2.4.0",
26 | "lodash.pickby": "^4.6.0",
27 | "reflect-metadata": "0.1.3",
28 | "rxjs": "5.0.0-beta.6",
29 | "ts-helpers": "^1.1.1",
30 | "zone.js": "0.6.12"
31 | },
32 | "devDependencies": {
33 | "@types/jasmine": "^2.2.30",
34 | "@types/protractor": "^1.5.16",
35 | "angular-cli": "1.0.0-beta.11-webpack.2",
36 | "codelyzer": "0.0.26",
37 | "jasmine-core": "2.4.1",
38 | "jasmine-spec-reporter": "2.5.0",
39 | "karma": "0.13.22",
40 | "karma-chrome-launcher": "0.2.3",
41 | "karma-jasmine": "0.3.8",
42 | "karma-phantomjs-launcher": "^1.0.2",
43 | "karma-remap-istanbul": "^0.2.1",
44 | "protractor": "3.3.0",
45 | "ts-node": "1.2.1",
46 | "tslint": "3.13.0",
47 | "typescript": "^2.0.0"
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/public/.npmignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/launchscout/graphql-admin/5c2bcc5ed8229b1da33546fa5871153145a110e6/public/.npmignore
--------------------------------------------------------------------------------
/src/app/app.component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/launchscout/graphql-admin/5c2bcc5ed8229b1da33546fa5871153145a110e6/src/app/app.component.css
--------------------------------------------------------------------------------
/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 | {{title}}
3 |
4 |
7 |
--------------------------------------------------------------------------------
/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | /* tslint:disable:no-unused-variable */
2 |
3 | import { addProviders, async, inject } from '@angular/core/testing';
4 | import { AppComponent } from './app.component';
5 |
6 | describe('App: Angular2CliSpike', () => {
7 | // beforeEach(() => {
8 | // addProviders([AppComponent]);
9 | // });
10 | //
11 | // it('should create the app',
12 | // inject([AppComponent], (app: AppComponent) => {
13 | // expect(app).toBeTruthy();
14 | // }));
15 | //
16 | // it('should have as title \'app works!\'',
17 | // inject([AppComponent], (app: AppComponent) => {
18 | // expect(app.title).toEqual('app works!');
19 | // }));
20 | });
21 |
--------------------------------------------------------------------------------
/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 | import { Angular2Apollo } from 'angular2-apollo';
3 | import gql from 'graphql-tag';
4 |
5 | @Component({
6 | selector: 'app-root',
7 | templateUrl: 'app.component.html',
8 | styleUrls: ['app.component.css']
9 | })
10 | export class AppComponent {
11 | title = 'app works very well!';
12 | apolloClient: Angular2Apollo;
13 |
14 | constructor(apolloClient: Angular2Apollo) {
15 | this.apolloClient = apolloClient;
16 | this.apolloClient.watchQuery({
17 | query: gql`
18 | query getPosts {
19 | posts {
20 | title
21 | }
22 | }`,
23 | forceFetch: true
24 | }).subscribe((results) => {
25 | this.posts = results.data.posts;
26 | });
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/app/app.html:
--------------------------------------------------------------------------------
1 |
12 |
13 |
--------------------------------------------------------------------------------
/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { BrowserModule } from '@angular/platform-browser';
2 | import { NgModule, ApplicationRef } from '@angular/core';
3 | import { CommonModule } from '@angular/common';
4 | import { FormsModule } from '@angular/forms';
5 | import AppComponent from './app';
6 | import { routing, appRoutingProviders } from './routes';
7 | import SchemaService from './schema_service';
8 | import QueryLinks from './gql-query-links';
9 |
10 | import {
11 | defaultApolloClient,
12 | APOLLO_PROVIDERS
13 | } from 'angular2-apollo';
14 |
15 | import ApolloClient, {
16 | createNetworkInterface
17 | } from 'apollo-client';
18 |
19 | const token = 'a78feb423a5933a1c05cdf489d60c236d0435819';
20 | let networkInterface = createNetworkInterface('https://api.github.com/graphql');
21 | const client = new ApolloClient({
22 | // networkInterface: createNetworkInterface('http://localhost:53441/')
23 | networkInterface
24 | // networkInterface: createNetworkInterface('http://localhost:4000/graphql')
25 | // networkInterface: createNetworkInterface('https://www.graphqlhub.com/graphql')
26 | });
27 |
28 | networkInterface.use([{
29 | applyMiddleware(req, next) {
30 | if (!req.options.headers) {
31 | req.options.headers = {}; // Create the header object if needed.
32 | }
33 | req.options.headers.authorization = `bearer ${token}`;
34 | next();
35 | }
36 | }]);
37 |
38 | @NgModule({
39 | declarations: [
40 | AppComponent,
41 | QueryLinks
42 | ],
43 | imports: [
44 | BrowserModule,
45 | CommonModule,
46 | FormsModule,
47 | routing
48 | ],
49 | providers: [
50 | APOLLO_PROVIDERS,
51 | defaultApolloClient(client),
52 | SchemaService
53 | ],
54 | entryComponents: [AppComponent],
55 | bootstrap: [AppComponent]
56 | })
57 | export class AppModule {
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/src/app/app.ts:
--------------------------------------------------------------------------------
1 | import {Component} from '@angular/core';
2 | import { ROUTER_DIRECTIVES } from '@angular/router';
3 | import SchemaService from './schema_service';
4 |
5 | @Component({
6 | selector: 'app-root',
7 | templateUrl: 'app.html'
8 | })
9 | export default class AppComponent {
10 | schemaLoaded: boolean;
11 |
12 | constructor(public schemaService: SchemaService) {
13 | this.schemaService = schemaService;
14 | this.schemaService.loadSchema().subscribe((schema) => {
15 | this.schemaLoaded = true;
16 | });
17 | }
18 |
19 | queryType() {
20 | return this.schemaService.getQueryType();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/app/boot.ts:
--------------------------------------------------------------------------------
1 | import {bootstrap} from '@angular/platform-browser-dynamic';
2 | import AppComponent from './app';
3 | import {appRouterProviders} from './routes';
4 | import {disableDeprecatedForms, provideForms} from '@angular/forms';
5 |
6 | import {
7 | defaultApolloClient,
8 | APOLLO_PROVIDERS
9 | } from 'angular2-apollo';
10 |
11 | import ApolloClient, {
12 | createNetworkInterface
13 | } from 'apollo-client';
14 | import SchemaService from './schema_service';
15 |
16 | const client = new ApolloClient({
17 | networkInterface: createNetworkInterface('http://localhost:4000/graphql')
18 | });
19 |
20 | bootstrap(AppComponent, [
21 | appRouterProviders,
22 | disableDeprecatedForms(),
23 | provideForms(),
24 | APOLLO_PROVIDERS,
25 | SchemaService,
26 | defaultApolloClient(client)
27 | ]);
28 |
--------------------------------------------------------------------------------
/src/app/environments/environment.dev.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: false
3 | };
4 |
--------------------------------------------------------------------------------
/src/app/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/src/app/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // The file for the current environment will overwrite this one during build.
2 | // Different environments can be found in ./environment.{dev|prod}.ts, and
3 | // you can create your own and use it with the --env flag.
4 | // The build system defaults to the dev environment.
5 |
6 | export const environment = {
7 | production: false
8 | };
9 |
--------------------------------------------------------------------------------
/src/app/formTest.ts:
--------------------------------------------------------------------------------
1 | import {Component} from '@angular/core';
2 | @Component({
3 | selector: "form-test",
4 | template: `
5 | The Form
6 |
9 | {{ theForm.value | json }}
10 | `
11 | })
12 | export default class FormTestComponent {
13 | }
14 |
--------------------------------------------------------------------------------
/src/app/gql-args-form.html:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/src/app/gql-args-form.ts:
--------------------------------------------------------------------------------
1 | import { Component, EventEmitter, Input, Output } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'gql-args-form',
5 | templateUrl: 'gql-args-form.html'
6 | })
7 | export default class GqlArgsForm {
8 | @Input() args: Array