class DashboardController extends Controller

Traits

AuthorizesRequests
ValidatesRequests

Constants

ACTIVITY_SCAN_LIMIT

Number of annotation labels that are inspected to find recently annotated files.

Methods

bool
isAutomatedRequest(Request|null $request = null)

Determines if the request was done by an automated script (with API token or ajax).

__construct()

Create a new instance.

index(Guard $auth)

Show the application dashboard to the user.

indexDashboard(User $user)

Show the dashboard for a logged in user.

array
volumesActivityItems(User $user, int $limit = 3, string $newerThan = null)

Get the most recently created volume a user.

array
annotationsActivityItems(User $user, int $limit = 3, string $newerThan = null)

Get the most recently annotated images of a user.

array
videosActivityItems(User $user, int $limit = 3, string $newerThan = null)

Get the most recently annotated videos of a user.

array
recentlyAnnotatedFiles(string $labelTable, string $annotationTable, string $fileKey, User $user, int $limit, string $newerThan = null)

Get the files that a user annotated most recently.

array
buildActivityItems(string $model, array $timestamps, string $include)

Assemble the dashboard activity items for the given files.

indexLandingPage()

Show the landing page if no user is authenticated.

Details

in Controller at line 21
bool isAutomatedRequest(Request|null $request = null)

Determines if the request was done by an automated script (with API token or ajax).

Parameters

Request|null $request

Return Value

bool

at line 26
__construct()

Create a new instance.

at line 38
index(Guard $auth)

Show the application dashboard to the user.

Parameters

Guard $auth

at line 52
protected indexDashboard(User $user)

Show the dashboard for a logged in user.

Parameters

User $user

at line 94
array volumesActivityItems(User $user, int $limit = 3, string $newerThan = null)

Get the most recently created volume a user.

Parameters

User $user
int $limit
string $newerThan

Return Value

array

at line 120
array annotationsActivityItems(User $user, int $limit = 3, string $newerThan = null)

Get the most recently annotated images of a user.

Parameters

User $user
int $limit
string $newerThan

Return Value

array

at line 147
array videosActivityItems(User $user, int $limit = 3, string $newerThan = null)

Get the most recently annotated videos of a user.

Parameters

User $user
int $limit
string $newerThan

Return Value

array

at line 183
protected array recentlyAnnotatedFiles(string $labelTable, string $annotationTable, string $fileKey, User $user, int $limit, string $newerThan = null)

Get the files that a user annotated most recently.

Aggregating all annotation labels of a user is prohibitively expensive for users with many annotations. Instead, only the most recent ACTIVITY_SCAN_LIMIT annotation labels are inspected, which is cheap with the user_id/created_at index. A user who spread fewer than $limit files over more annotation labels than that may see fewer activity items.

Parameters

string $labelTable
string $annotationTable
string $fileKey

Name of the file ID column of the annotation table.

User $user
int $limit
string $newerThan

Return Value

array

Map of file ID to the timestamp of the most recent annotation label.

at line 216
protected array buildActivityItems(string $model, array $timestamps, string $include)

Assemble the dashboard activity items for the given files.

Parameters

string $model

Class name of the file model.

array $timestamps

Map of file ID to timestamp, ordered most recent first.

string $include

Name of the view to render the item with.

Return Value

array

at line 238
protected indexLandingPage()

Show the landing page if no user is authenticated.