FEAT_META_INSIGHT_CHECK
This commit is contained in:
parent
26e1b39d42
commit
7c54f11e9e
@ -22,6 +22,7 @@ $routes->get('/swagger', 'SwaggerController::index', ['filter' => 'authMVC']);
|
||||
$routes->get('/fedeploy', 'DeployController::fedeploy_view', ['filter' => 'authMVC']);
|
||||
$routes->post('/fedeploy', 'DeployController::fedeploy', ['filter' => 'authMVC']);
|
||||
$routes->get('/visitOffBoardCheck', 'EmployeeController::visitOffBoardCheck');
|
||||
$routes->get('/metaDashboardDemo', 'TestingController::metaDashboardDemo');
|
||||
|
||||
// Reminder Mail Notification
|
||||
|
||||
|
||||
@ -17,6 +17,8 @@ use PhpOffice\PhpSpreadsheet\Style\Alignment;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Fill;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Border;
|
||||
|
||||
use Firebase\JWT\JWT;
|
||||
|
||||
class TestingController extends BaseController
|
||||
{
|
||||
use ResponseTrait;
|
||||
@ -983,5 +985,44 @@ class TestingController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
public function metaDashboardDemo()
|
||||
{
|
||||
|
||||
// 🔐 Move this to .env in real projects
|
||||
$METABASE_SECRET_KEY = '6a9ec3d833576923ea04078188fe26cad17b5de351ab3ce349dd2c2d07b5d0cd';
|
||||
|
||||
$payload = [
|
||||
'resource' => [
|
||||
'dashboard' => 1
|
||||
],
|
||||
'params' => (object)[], // MUST be object for Metabase
|
||||
'exp' => time() + (10 * 60) // 10 minutes
|
||||
];
|
||||
|
||||
$token = JWT::encode($payload, $METABASE_SECRET_KEY, 'HS256');
|
||||
|
||||
// // You can either return token only
|
||||
// return $this->response->setJSON([
|
||||
// 'token' => $token,
|
||||
// 'iframe_url' => "https://your-metabase-domain/embed/dashboard/{$token}#bordered=true&titled=true"
|
||||
// ]);
|
||||
if($this->request->getGet('api') == 1)
|
||||
{
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'message' => 'Form data received successfully!',
|
||||
'data' => [
|
||||
'metabaseToken' => $token,
|
||||
'metabaseUrl' => 'https://nsights.nhanceindia.in']
|
||||
]);
|
||||
}
|
||||
|
||||
return view('meta_dashboard_demo_one', [
|
||||
'metabaseToken' => $token,
|
||||
'metabaseUrl' => 'https://nsights.nhanceindia.in',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
33
app/Views/meta_dashboard_demo_one.php
Normal file
33
app/Views/meta_dashboard_demo_one.php
Normal file
@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Metabase Dashboard</title>
|
||||
|
||||
<!-- Metabase embed script -->
|
||||
<script defer src="<?= esc($metabaseUrl) ?>/app/embed.js"></script>
|
||||
|
||||
<script>
|
||||
function defineMetabaseConfig(config) {
|
||||
window.metabaseConfig = config;
|
||||
}
|
||||
|
||||
defineMetabaseConfig({
|
||||
theme: {
|
||||
preset: "light"
|
||||
},
|
||||
isGuest: true,
|
||||
instanceUrl: "<?= esc($metabaseUrl) ?>"
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<metabase-dashboard
|
||||
token="<?= esc($metabaseToken) ?>"
|
||||
with-title="true"
|
||||
with-downloads="true">
|
||||
</metabase-dashboard>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue
Block a user