-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
43db652
commit 1d6a208
Showing
99 changed files
with
2,060 additions
and
779 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2018, Yahoo Inc. | ||
* Licensed under the terms of the Apache License, Version 2.0. | ||
* See the LICENSE file associated with the project for terms. | ||
*/ | ||
import Component from '@ember/component'; | ||
import { inject as service } from '@ember/service'; | ||
import { alias } from '@ember/object/computed'; | ||
|
||
export default Component.extend({ | ||
querier: service(), | ||
query: null, | ||
querySnapshot: null, | ||
|
||
isRunningQuery: alias('querier.isRunningQuery').readOnly(), | ||
|
||
actions: { | ||
cancelClick() { | ||
this.sendAction('cancelClick'); | ||
}, | ||
|
||
reRunClick(query) { | ||
this.sendAction('reRunClick', query); | ||
}, | ||
|
||
queryClick(query) { | ||
this.sendAction('queryClick', query); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* Copyright 2018, Yahoo Inc. | ||
* Licensed under the terms of the Apache License, Version 2.0. | ||
* See the LICENSE file associated with the project for terms. | ||
*/ | ||
import Component from '@ember/component'; | ||
import { computed } from '@ember/object'; | ||
import { alias, and, not } from '@ember/object/computed'; | ||
import { inject as service } from '@ember/service'; | ||
import { isNone } from '@ember/utils'; | ||
|
||
export default Component.extend({ | ||
classNames: ['result-viewer'], | ||
querier: service(), | ||
|
||
query: null, | ||
result: null, | ||
selectedWindow: null, | ||
autoUpdate: true, | ||
// Tweaks the time for the window duration by this to adjust for Ember scheduling delays | ||
jitter: -300, | ||
|
||
isRunningQuery: alias('querier.isRunningQuery').readOnly(), | ||
isRaw: alias('result.isRaw').readOnly(), | ||
errorWindow: alias('result.errorWindow').readOnly(), | ||
hasData: alias('result.hasData').readOnly(), | ||
numberOfWindows: alias('result.windows.length').readOnly(), | ||
windowEmitEvery: alias('query.window.emit.every').readOnly(), | ||
isTimeWindow: alias('query.window.isTimeBased').readOnly(), | ||
isRecordWindow: not('isTimeWindow').readOnly(), | ||
isRawRecordWindow: and('isRecordWindow', 'isRaw').readOnly(), | ||
aggregateMode: alias('isRawRecordWindow').readOnly(), | ||
|
||
showAutoUpdate: computed('hasError', 'aggregateMode', 'hasData', function() { | ||
return this.get('hasData') && !this.get('hasError') && !this.get('aggregateMode'); | ||
}), | ||
|
||
hasError: computed('errorWindow', function() { | ||
return !isNone(this.get('errorWindow')); | ||
}).readOnly(), | ||
|
||
metadata: computed('hasError', 'autoUpdate', 'selectedWindow', 'result.windows.[]', function() { | ||
return this.get('hasError') ? this.get('errorWindow.metadata') : this.getSelectedWindow('metadata'); | ||
}).readOnly(), | ||
|
||
records: computed('autoUpdate', 'aggregateMode', 'selectedWindow', 'result.windows.[]', function() { | ||
return this.get('aggregateMode') ? this.getAllWindowRecords() : this.getSelectedWindow('records'); | ||
}).readOnly(), | ||
|
||
queryDuration: computed('query.duration', function() { | ||
return this.get('query.duration') * 1000; | ||
}).readOnly(), | ||
|
||
windowDuration: computed('windowEmitEvery', function() { | ||
return this.get('jitter') + (this.get('windowEmitEvery') * 1000); | ||
}).readOnly(), | ||
|
||
config: computed('result.{isRaw,isReallyRaw,isDistribution,isSingleRow}', function() { | ||
return { | ||
isRaw: this.get('result.isRaw'), | ||
isReallyRaw: this.get('result.isReallyRaw'), | ||
isDistribution: this.get('result.isDistribution'), | ||
isSingleRow: this.get('result.isSingleRow'), | ||
pivotOptions: this.get('result.pivotOptions') | ||
}; | ||
}).readOnly(), | ||
|
||
didReceiveAttrs() { | ||
this._super(...arguments); | ||
this.set('selectedWindow', null); | ||
this.set('autoUpdate', true); | ||
}, | ||
|
||
getSelectedWindow(property) { | ||
let windowProperty = this.get(`result.windows.lastObject.${property}`); | ||
if (!this.get('autoUpdate')) { | ||
let selectedWindow = this.get('selectedWindow'); | ||
windowProperty = isNone(selectedWindow) ? windowProperty : selectedWindow[property]; | ||
} | ||
return windowProperty; | ||
}, | ||
|
||
getAllWindowRecords() { | ||
return this.get('result.windows').getEach('records').reduce((p, c) => p.concat(c), []); | ||
}, | ||
|
||
actions: { | ||
changeWindow(selectedWindow) { | ||
this.set('selectedWindow', selectedWindow); | ||
this.set('autoUpdate', false); | ||
}, | ||
|
||
changeAutoUpdate(autoUpdate) { | ||
// Turn On => reset selectedWindow. Turn Off => Last window | ||
this.set('selectedWindow', autoUpdate ? null : this.get('result.windows.lastObject')); | ||
this.set('autoUpdate', autoUpdate); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright 2018, Yahoo Inc. | ||
* Licensed under the terms of the Apache License, Version 2.0. | ||
* See the LICENSE file associated with the project for terms. | ||
*/ | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
classNames: ['result-window-placeholder'], | ||
tagName: 'span', | ||
windowCount: 0 | ||
}); |
Oops, something went wrong.