Changeset View
Changeset View
Standalone View
Standalone View
src/applications/fact/controller/PhabricatorFactChartController.php
<?php | <?php | ||||
final class PhabricatorFactChartController extends PhabricatorFactController { | final class PhabricatorFactChartController extends PhabricatorFactController { | ||||
public function handleRequest(AphrontRequest $request) { | public function handleRequest(AphrontRequest $request) { | ||||
$viewer = $request->getViewer(); | $viewer = $request->getViewer(); | ||||
$chart_key = $request->getURIData('chartKey'); | $chart_key = $request->getURIData('chartKey'); | ||||
if ($chart_key === null) { | if ($chart_key === null) { | ||||
return $this->newDemoChart(); | return $this->newDemoChart(); | ||||
} | } | ||||
$chart = id(new PhabricatorFactChart())->loadOneWhere( | $engine = id(new PhabricatorChartEngine()) | ||||
'chartKey = %s', | ->setViewer($viewer); | ||||
$chart_key); | |||||
$chart = $engine->loadChart($chart_key); | |||||
if (!$chart) { | if (!$chart) { | ||||
return new Aphront404Response(); | return new Aphront404Response(); | ||||
} | } | ||||
$engine = id(new PhabricatorChartEngine()) | |||||
->setViewer($viewer) | |||||
->setChart($chart); | |||||
// When drawing a chart, we send down a placeholder piece of HTML first, | // When drawing a chart, we send down a placeholder piece of HTML first, | ||||
// then fetch the data via async request. Determine if we're drawing | // then fetch the data via async request. Determine if we're drawing | ||||
// the structure or actually pulling the data. | // the structure or actually pulling the data. | ||||
$mode = $request->getURIData('mode'); | $mode = $request->getURIData('mode'); | ||||
$is_draw_mode = ($mode === 'draw'); | $is_draw_mode = ($mode === 'draw'); | ||||
// TODO: For now, always pull the data. We'll throw it away if we're just | // TODO: For now, always pull the data. We'll throw it away if we're just | ||||
// drawing the frame, but this makes errors easier to debug. | // drawing the frame, but this makes errors easier to debug. | ||||
▲ Show 20 Lines • Show All 79 Lines • Show Last 20 Lines |