File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,12 @@ public static function getColumns(): array
3636 return $ record ->isp ;
3737 })
3838 ->enabledByDefault (false ),
39+ ExportColumn::make ('server_location ' )
40+ ->label ('Server Location ' )
41+ ->state (function (Result $ record ): ?string {
42+ return $ record ->server_location ;
43+ })
44+ ->enabledByDefault (false ),
3945 ExportColumn::make ('service ' ),
4046 ExportColumn::make ('server_id ' )
4147 ->label ('Server ID ' )
Original file line number Diff line number Diff line change @@ -102,6 +102,9 @@ public static function form(Form $form): Form
102102 Forms \Components \Placeholder::make ('isp ' )
103103 ->label ('ISP ' )
104104 ->content (fn (Result $ result ): ?string => $ result ->isp ),
105+ Forms \Components \Placeholder::make ('server_location ' )
106+ ->label ('Server Location ' )
107+ ->content (fn (Result $ result ): ?string => $ result ->server_location ),
105108 Forms \Components \Placeholder::make ('server_host ' )
106109 ->content (fn (Result $ result ): ?string => $ result ->server_host ),
107110 Forms \Components \Checkbox::make ('scheduled ' ),
@@ -148,6 +151,13 @@ public static function table(Table $table): Table
148151 ->sortable (query: function (Builder $ query , string $ direction ): Builder {
149152 return $ query ->orderBy ('data->isp ' , $ direction );
150153 }),
154+ Tables \Columns \TextColumn::make ('data.server.location ' )
155+ ->label ('Server Location ' )
156+ ->toggleable ()
157+ ->toggledHiddenByDefault ()
158+ ->sortable (query: function (Builder $ query , string $ direction ): Builder {
159+ return $ query ->orderBy ('data->server->location ' , $ direction );
160+ }),
151161 Tables \Columns \TextColumn::make ('data.server.name ' )
152162 ->toggleable ()
153163 ->sortable (query: function (Builder $ query , string $ direction ): Builder {
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ public function formatForInfluxDB2()
7272 'isp ' => $ this ?->isp,
7373 'server_host ' => $ this ?->server_host,
7474 'server_name ' => $ this ?->server_name,
75+ 'server_location ' => $ this ?->server_location,
7576 'scheduled ' => $ this ->scheduled ,
7677 'successful ' => $ this ->status === ResultStatus::Completed,
7778 'packet_loss ' => (float ) $ this ->packet_loss ,
@@ -228,6 +229,16 @@ protected function serverName(): Attribute
228229 );
229230 }
230231
232+ /**
233+ * Get the result's server location.
234+ */
235+ protected function serverLocation (): Attribute
236+ {
237+ return Attribute::make (
238+ get: fn () => Arr::get ($ this ->data , 'server.location ' ),
239+ );
240+ }
241+
231242 /**
232243 * Get the result's upload in bits.
233244 */
You can’t perform that action at this time.
0 commit comments