diff --git a/extension/src/App.vue b/extension/src/App.vue
index ee7b41d..de4151a 100644
--- a/extension/src/App.vue
+++ b/extension/src/App.vue
@@ -6,16 +6,18 @@
import Requests from './components/Requests.vue'
import { fakeEvents } from './fixtures/fakeEvents'
import { useEventsStore } from './stores/events';
+import { useSettingsStore } from './stores/settings';
import { onMounted, onUnmounted, nextTick } from 'vue'
-const store = useEventsStore()
+const eventsStore = useEventsStore();
+const settingsStore = useSettingsStore();
-onUnmounted(() => store.clear())
+onUnmounted(() => eventsStore.clear());
onMounted(() => {
if (typeof chrome.devtools == 'undefined') {
- console.log("STANDALONE mode... mocking requests")
- fakeEvents.forEach((data) => store.pushEvents(data.request_id, data.events));
+ console.log("STANDALONE mode... mocking requests");
+ fakeEvents.forEach((data) => eventsStore.pushEvents(data.request_id, data.events));
} else {
chrome.devtools.network.onRequestFinished.addListener(function(request) {
var headers = request.response.headers;
@@ -28,9 +30,12 @@ onMounted(() => {
url.search = "";
console.log(url)
chrome.runtime.sendMessage({action:'getJSON',url:url}, (data) => {
- store.pushEvents(requestId, data);
+ const autoReselect = !settingsStore.lockOn;
+ eventsStore.pushEvents(requestId, data, autoReselect);
nextTick(() => {
- document.querySelectorAll('[data-pc-section="wrapper"]')[0].scrollTop = 1000000
+ if (autoReselect) {
+ document.querySelectorAll('[data-pc-section="wrapper"]')[0].scrollTop = 1000000;
+ }
})
});
};
diff --git a/extension/src/components/Requests.vue b/extension/src/components/Requests.vue
index ae6bec1..ef2842e 100644
--- a/extension/src/components/Requests.vue
+++ b/extension/src/components/Requests.vue
@@ -44,7 +44,7 @@ function classForStatus(status) {
cls = "bg-red-700/80"
break;
default:
- cls = "bg-purple-700/70"
+ cls = "bg-blue-700/80"
}
return cls + " text-white p-1 rounded text-xs"
}
diff --git a/extension/src/components/Toolbar.vue b/extension/src/components/Toolbar.vue
index f948934..c7ed0be 100644
--- a/extension/src/components/Toolbar.vue
+++ b/extension/src/components/Toolbar.vue
@@ -1,18 +1,22 @@
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/extension/src/components/wrappers/SelectionTable.vue b/extension/src/components/wrappers/SelectionTable.vue
index dde3e82..eef8617 100644
--- a/extension/src/components/wrappers/SelectionTable.vue
+++ b/extension/src/components/wrappers/SelectionTable.vue
@@ -1182,7 +1182,7 @@ const preset = {
class: [
// Color
'dark:text-white/80',
- { 'bg-slate-800 text-white dark:bg-surface-500/30': context.selected && context.stripedRows },
+ { 'bg-gray-700 text-white dark:bg-surface-500/30': context.selected && context.stripedRows },
// { 'bg-surface-0 text-surface-600 dark:bg-surface-800': !context.selected },
{ 'odd:bg-surface-0 odd:text-surface-600 dark:odd:bg-surface-800 even:bg-surface-100 even:text-surface-600 dark:even:bg-surface-900/60': context.stripedRows && !context.selected },
diff --git a/extension/src/components/wrappers/ToolbarButton.vue b/extension/src/components/wrappers/ToolbarButton.vue
new file mode 100644
index 0000000..9969285
--- /dev/null
+++ b/extension/src/components/wrappers/ToolbarButton.vue
@@ -0,0 +1,85 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/extension/src/components/wrappers/ToolbarToggle.vue b/extension/src/components/wrappers/ToolbarToggle.vue
new file mode 100644
index 0000000..4df27ee
--- /dev/null
+++ b/extension/src/components/wrappers/ToolbarToggle.vue
@@ -0,0 +1,113 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/extension/src/stores/events.js b/extension/src/stores/events.js
index 28c388e..9f21e2b 100644
--- a/extension/src/stores/events.js
+++ b/extension/src/stores/events.js
@@ -31,7 +31,7 @@ export const useEventsStore = defineStore('events', () => {
const selectedCacheCalls = computed(() => cacheCalls.value.get(selectedRequest.value.id));
const selectedParams = computed(() => selectedRequest.value.params);
- function pushEvents(requestId, newEvents) {
+ function pushEvents(requestId, newEvents, autoReselect = true) {
const actionEvent = newEvents.find((event) => event.name == "process_action.action_controller")
const action = {
id: requestId,
@@ -44,7 +44,10 @@ export const useEventsStore = defineStore('events', () => {
params: Object.entries(actionEvent.payload.params).map(([name, value]) => ({ name, value }) )
}
actions.value.set(requestId, action);
- selectedRequest.value = action;
+
+ if (actions.value.size == 1 || autoReselect) {
+ selectedRequest.value = action;
+ }
activeRecordQueries.value.set(requestId, newEvents.flatMap((event) => {
if (event.name == "sql.active_record" && event.payload.name != "SCHEMA" && event.payload.name != "EXPLAIN") {
diff --git a/extension/src/stores/settings.js b/extension/src/stores/settings.js
index aed28c4..7b3d472 100644
--- a/extension/src/stores/settings.js
+++ b/extension/src/stores/settings.js
@@ -7,6 +7,7 @@ const defaultEditor = editors[0].id;
export const useSettingsStore = defineStore('settings', () => {
const filepathLinkBehaviour = ref(localStorage.getItem('railspanel.filepathLinkBehaviour') || 'copy');
const editor = ref(editors.find((e) => e.id == (localStorage.getItem('railspanel.editor') || defaultEditor)) || defaultEditor);
+ const lockOn = ref(localStorage.getItem('railspanel.lockOn') === "true");
watch(editor, (newVal, oldVal) => {
localStorage.setItem('railspanel.editor', newVal.id);
@@ -16,9 +17,14 @@ export const useSettingsStore = defineStore('settings', () => {
localStorage.setItem('railspanel.filepathLinkBehaviour', newVal);
});
+ watch(lockOn, (newVal, oldVal) => {
+ localStorage.setItem('railspanel.lockOn', newVal);
+ });
+
return {
editors,
editor,
- filepathLinkBehaviour
+ filepathLinkBehaviour,
+ lockOn
}
})
\ No newline at end of file