Skip to content

Commit

Permalink
[wip] get graphql types and resolvers working for fs stats, opened an…
Browse files Browse the repository at this point in the history
… issue to track getting this supported in broccoli broccolijs/broccoli#461
  • Loading branch information
gabrielcsapo committed Apr 16, 2020
1 parent 4c723a9 commit ffa737e
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- This file is auto-generated by ember-cli-storybook -->
<meta name="broccoli-inspector/config/environment" content="%7B%22ember-websockets%22%3A%7B%22socketIO%22%3Atrue%7D%2C%22apollo%22%3A%7B%22apiURL%22%3A%22http%3A%2F%2Flocalhost%3A4200%2F_broccoli%2Fapi%2Fgraphql%22%7D%2C%22modulePrefix%22%3A%22broccoli-inspector%22%2C%22environment%22%3A%22test%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22none%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22LOG_ACTIVE_GENERATION%22%3Afalse%2C%22LOG_VIEW_LOOKUPS%22%3Afalse%2C%22rootElement%22%3A%22%23ember-testing%22%2C%22autoboot%22%3Afalse%2C%22name%22%3A%22broccoli-inspector%22%2C%22version%22%3A%220.0.0%2B64e4677d%22%7D%2C%22exportApplicationGlobal%22%3Atrue%7D" />
<meta name="broccoli-inspector/config/environment" content="%7B%22ember-websockets%22%3A%7B%22socketIO%22%3Atrue%7D%2C%22apollo%22%3A%7B%22apiURL%22%3A%22http%3A%2F%2Flocalhost%3A4200%2F_broccoli%2Fapi%2Fgraphql%22%7D%2C%22modulePrefix%22%3A%22broccoli-inspector%22%2C%22environment%22%3A%22test%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22none%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22LOG_ACTIVE_GENERATION%22%3Afalse%2C%22LOG_VIEW_LOOKUPS%22%3Afalse%2C%22rootElement%22%3A%22%23ember-testing%22%2C%22autoboot%22%3Afalse%2C%22name%22%3A%22broccoli-inspector%22%2C%22version%22%3A%220.0.0%2B4c723a99%22%7D%2C%22exportApplicationGlobal%22%3Atrue%7D" />
<link rel="stylesheet" href="./assets/vendor.css" />
<link rel="stylesheet" href="./assets/broccoli-inspector.css" />
<script>
Expand Down
1 change: 1 addition & 0 deletions app/routes/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { queryManager } from "ember-apollo-client";
const query = gql`
query query($id: ID!) {
node(id: $id) {
id
label
inputFiles
outputFiles
Expand Down
103 changes: 102 additions & 1 deletion server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ module.exports = function(app, info) {
return buildState;
},

stats:(root, args, context, info) => {
const { id } = root;
const node = getNodeById(parseInt(id));

const { stats } = node['__heimdall__'];

return stats
},

label:(root, args, context, info) => {
const { id } = root;
const { label } = getNodeById(parseInt(id));
Expand Down Expand Up @@ -102,7 +111,8 @@ module.exports = function(app, info) {
type Node {
id: ID!
label: String
buildState: BuildState,
buildState: BuildState
stats: Stat
slowestNodes: [Node]
inputFiles: [String]
outputFiles: [String]
Expand All @@ -113,6 +123,97 @@ module.exports = function(app, info) {
totalTime: Float!
}
type Stat {
fs: FS
}
type FS {
appendFile: FSMetric
appendFileSync: FSMetric
access: FSMetric
accessSync: FSMetric
chown: FSMetric
chownSync: FSMetric
chmod: FSMetric
chmodSync: FSMetric
close: FSMetric
closeSync: FSMetric
copyFile: FSMetric
copyFileSync: FSMetric
createReadStream: FSMetric
createWriteStream: FSMetric
exists: FSMetric
existsSync: FSMetric
fchown: FSMetric
fchownSync: FSMetric
fchmod: FSMetric
fchmodSync: FSMetric
fdatasync: FSMetric
fdatasyncSync: FSMetric
fstat: FSMetric
fstatSync: FSMetric
fsync: FSMetric
fsyncSync: FSMetric
ftruncate: FSMetric
ftruncateSync: FSMetric
futimes: FSMetric
futimesSync: FSMetric
lchown: FSMetric
lchownSync: FSMetric
lchmod: FSMetric
lchmodSync: FSMetric
link: FSMetric
linkSync: FSMetric
lstat: FSMetric
lstatSync: FSMetric
mkdir: FSMetric
mkdirSync: FSMetric
mkdtemp: FSMetric
mkdtempSync: FSMetric
open: FSMetric
openSync: FSMetric
opendir: FSMetric
opendirSync: FSMetric
readdir: FSMetric
readdirSync: FSMetric
read: FSMetric
readSync: FSMetric
readFile: FSMetric
readFileSync: FSMetric
readlink: FSMetric
readlinkSync: FSMetric
realpath: FSMetric
realpathSync: FSMetric
rename: FSMetric
renameSync: FSMetric
rmdir: FSMetric
rmdirSync: FSMetric
stat: FSMetric
statSync: FSMetric
symlink: FSMetric
symlinkSync: FSMetric
truncate: FSMetric
truncateSync: FSMetric
unwatchFile: FSMetric
unlink: FSMetric
unlinkSync: FSMetric
utimes: FSMetric
utimesSync: FSMetric
watch: FSMetric
watchFile: FSMetric
writeFile: FSMetric
writeFileSync: FSMetric
write: FSMetric
writeSync: FSMetric
writev: FSMetric
writevSync: FSMetric
}
type FSMetric {
count: Float
time: Float
}
schema {
query: Query
}
Expand Down

0 comments on commit ffa737e

Please sign in to comment.