easy_ml 0.2.0.pre.rc93 → 0.2.0.pre.rc95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f402f4f0d35dd702c8e97c841f22681626cff3c1ac030991cde884788b31833b
4
- data.tar.gz: 1666649bca8f2ab7bae0ec7a5faa3a4561f85db5b22ffdda92e472f7661fab85
3
+ metadata.gz: 7c7bb2e3e683bfa64b859db712827e9c3f0253dfdbb0ca0ed1454a21c9eaced2
4
+ data.tar.gz: 7ed6cfa37a0723b2d2eeb7da2a98e5fa38608ac60e82536022949bcf6a4cf121
5
5
  SHA512:
6
- metadata.gz: fa77810edaf759b75240f57a8f6dcc99a54043326ba92ff95c6df6732bd614bb932a5558722d690544367b21c929755b249ff8ede56581bbb6c7abe37688db63
7
- data.tar.gz: 7df62d34d6fd6dcd83eef86ab27dea0581bcbbe5c384c9fae00399661a62a882d3f163807171128d0efcc1026cd887789f961d9ce9e99ecaace8f91432f9193b
6
+ metadata.gz: 0125002301a9455366d06397b75b991ab39b32d35f26c5a6130e133be6148dc8229240d3a7202914376bf407481b301faac35c72bf3c979923b2544230c0a3b3
7
+ data.tar.gz: f4233cfb23f8638507af07ba8806837dd89c4e7ba4c9b67f4c21ed0b78ceaa5e44d10a2a263dc573a649d9cdd0cb60f59212a065973df8dee942322b71b80f31
@@ -41,7 +41,8 @@ module EasyML
41
41
  rescue ActiveRecord::RecordNotFound
42
42
  render json: { error: "Model not found" }, status: :not_found
43
43
  rescue => e
44
- render json: { error: e.message }, status: :unprocessable_entity
44
+ EasyML::ErrorLogger.error(e)
45
+ render json: { error: "Internal server error" }, status: 500
45
46
  end
46
47
  end
47
48
  end
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from 'react';
2
2
  import { usePage } from '@inertiajs/react'
3
3
  import { useInertiaForm } from 'use-inertia-form';
4
- import { Settings2, Save, AlertCircle, Key, Globe2, Database } from 'lucide-react';
4
+ import { Settings2, Save, AlertCircle, Key, Globe2, Database, GitBranch } from 'lucide-react';
5
5
  import { PluginSettings } from '../components/settings/PluginSettings';
6
6
 
7
7
  interface Settings {
@@ -9,6 +9,8 @@ interface Settings {
9
9
  timezone: string;
10
10
  s3_bucket: string;
11
11
  s3_region: string;
12
+ git_sha: string;
13
+ version: string;
12
14
  }
13
15
  }
14
16
 
@@ -156,6 +158,31 @@ export default function SettingsPage({ settings: initialSettings }: { settings:
156
158
  </div>
157
159
  </div>
158
160
 
161
+ {/* Deployment Information */}
162
+ <div className="space-y-4">
163
+ <div className="flex items-center gap-2 mb-4">
164
+ <GitBranch className="w-5 h-5 text-gray-500" />
165
+ <h3 className="text-lg font-medium text-gray-900">Deployment Information</h3>
166
+ </div>
167
+
168
+ <div className="bg-gray-50 rounded-lg p-4">
169
+ <div className="space-y-1">
170
+ <div className="flex items-center gap-2">
171
+ <span className="text-sm font-medium text-gray-700">Git SHA</span>
172
+ <span className="text-sm font-mono bg-gray-100 px-2 py-1 rounded text-gray-600">
173
+ {initialSettings?.settings?.git_sha || 'Not available'}
174
+ </span>
175
+ </div>
176
+ <div className="flex items-center gap-2">
177
+ <span className="text-sm font-medium text-gray-700">EasyML Version</span>
178
+ <span className="text-sm font-mono bg-gray-100 px-2 py-1 rounded text-gray-600">
179
+ {initialSettings?.settings?.version || 'Not available'}
180
+ </span>
181
+ </div>
182
+ </div>
183
+ </div>
184
+ </div>
185
+
159
186
  <div className="pt-6 border-t flex items-center justify-between">
160
187
  {saved && (
161
188
  <div className="flex items-center gap-2 text-green-600">
@@ -5,5 +5,23 @@ module EasyML
5
5
  include JSONAPI::Serializer
6
6
 
7
7
  attributes *EasyML::Settings.configuration_attributes
8
+
9
+ attribute :version do |object|
10
+ EasyML::VERSION
11
+ end
12
+
13
+ attribute :git_sha do |object|
14
+ # Get git SHA of the main app
15
+ if Rails.root.join('.git').exist?
16
+ sha = `cd #{Rails.root} && git rev-parse HEAD`.strip
17
+ sha.presence || "Git SHA unavailable"
18
+ elsif ENV["GIT_REVISION"]
19
+ ENV["GIT_REVISION"]
20
+ else
21
+ "Not a git repository"
22
+ end
23
+ rescue
24
+ "Error determining git SHA"
25
+ end
8
26
  end
9
27
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EasyML
4
+ module ErrorLogger
5
+ class Adapter
6
+ require_relative "rollbar_adapter"
7
+
8
+ ADAPTERS = [RollbarAdapter]
9
+
10
+ def pick
11
+ adapter_class = ADAPTERS.find { |a| a.use? }
12
+ adapter_class.new
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EasyML
4
+ module ErrorLogger
5
+ class RollbarAdapter < Adapter
6
+ def error(e)
7
+ Rollbar.error(e)
8
+ end
9
+
10
+ def warning(e)
11
+ Rollbar.warning(e)
12
+ end
13
+
14
+ def info(e)
15
+ Rollbar.info(e)
16
+ end
17
+
18
+ def self.use?
19
+ ENV["ROLLBAR_ACCESS_TOKEN"].present?
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ module EasyML
2
+ module ErrorLogger
3
+ require_relative "error_logger/adapter"
4
+
5
+ def self.error(e)
6
+ adapter.error(e)
7
+ end
8
+
9
+ private
10
+
11
+ def self.adapter
12
+ @adapter ||= EasyML::ErrorLogger::Adapter.new.pick
13
+ end
14
+ end
15
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EasyML
4
- VERSION = "0.2.0-rc93"
4
+ VERSION = "0.2.0-rc95"
5
5
 
6
6
  module Version
7
7
  end
data/lib/easy_ml.rb CHANGED
@@ -15,6 +15,7 @@ module EasyML
15
15
  class Error < StandardError; end
16
16
 
17
17
  require_relative "easy_ml/configuration"
18
+ require_relative "easy_ml/error_logger"
18
19
  require_relative "easy_ml/reasons"
19
20
  require_relative "easy_ml/deep_compact"
20
21
  require_relative "easy_ml/timing"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "entrypoints/Application.tsx": {
3
- "file": "assets/entrypoints/Application.tsx-KENNRQpC.js",
3
+ "file": "assets/entrypoints/Application.tsx-BXwsBCuQ.js",
4
4
  "name": "entrypoints/Application.tsx",
5
5
  "src": "entrypoints/Application.tsx",
6
6
  "isEntry": true,