Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidated settings page #137

Merged
merged 23 commits into from
Jul 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
83d97f1
build: add build-plugins-release to `build-release`
a5huynh Jul 28, 2022
a3f655a
wip: local file indexer plugin
a5huynh Jul 28, 2022
00b03e0
client: add a trunk.toml to auto-compile tailwindcss
a5huynh Jul 28, 2022
92f0907
wip: consolidating settings pages
a5huynh Jul 29, 2022
ef94ff4
client: setting up routing for settings pages
a5huynh Jul 29, 2022
7bf790b
client: adding nav links for settings sidebar
a5huynh Jul 29, 2022
42c01d2
client: add in crawl status to consolidated settings window
a5huynh Jul 29, 2022
53eb7fb
client: update tauri windows to open to consolidated settings dash
a5huynh Jul 29, 2022
0149d40
refactor: rename settings -> admin
a5huynh Jul 29, 2022
3d60682
wip: adding user settings page & consolidating styling
a5huynh Jul 29, 2022
2183516
refactor: rename crawl_stats module
a5huynh Jul 30, 2022
0f7e9cc
minimizing padding / text sizes in sidebar
a5huynh Jul 30, 2022
3e50e0a
client: adding base form styles & starting work on user settings page
a5huynh Jul 30, 2022
0267675
wip: ability to save settings from client
a5huynh Jul 31, 2022
6239c83
settings when changes through the UI are correctly saved to user sett…
a5huynh Jul 31, 2022
cb5be7b
handle navigation w/ settings window that's already open
a5huynh Jul 31, 2022
097849b
ci: updating ci to install client deps
a5huynh Jul 31, 2022
3f7e4e3
removing build hook for trunk
a5huynh Jul 31, 2022
d034a5c
squish settings w/ configuration
a5huynh Jul 31, 2022
f39502e
fix typo in Makefile
a5huynh Jul 31, 2022
58bc604
add "open settings folder" to user settings page, relabel to just "Pr…
a5huynh Jul 31, 2022
5a314f5
bring settings window to the front if window is open & another tab is…
a5huynh Jul 31, 2022
f387197
cargo fmt
a5huynh Jul 31, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,8 @@ jobs:
- name: Install tauri system deps
run: |
sudo apt-get update -y
sudo apt-get install -y \
libwebkit2gtk-4.0-dev \
build-essential \
curl \
wget \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev
cargo install tauri-cli --version "^1.0.5"
cargo install --locked trunk

make setup-dev-linux
make setup-dev
- name: Build sidecar
uses: actions-rs/cargo@v1
with:
Expand Down
21 changes: 15 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ members = [
# Default plugins
"plugins/chrome-importer",
"plugins/firefox-importer",
"plugins/local-file-indexer",
]

[profile.release]
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ build-plugins-release:
cargo build -p firefox-importer --target wasm32-wasi --release
cp target/wasm32-wasi/release/firefox-importer.wasm assets/plugins/firefox-importer/main.wasm

build-release: build-backend build-styles
build-release: build-backend build-styles build-plugins-release
cargo tauri build

check:
Expand All @@ -46,10 +46,11 @@ test:
cargo test --all

setup-dev:
rustup target add wasm32-unknown-unknown
# Required for plugin development
rustup target add wasm32-wasi
# Install tauri-cli & trunk for client development
cargo install tauri-cli --locked --version ^1.0.0
cargo install tauri-cli --locked --version ^1.0.5
cargo install --locked trunk
# Install tailwind
cd ./crates/client && npm install
Expand All @@ -66,3 +67,6 @@ setup-dev-linux:

run-client-dev:
cargo tauri dev

run-client-headless:
cd ./crates/client && HEADLESS_CLIENT=true trunk serve
6 changes: 4 additions & 2 deletions crates/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ edition = "2021"
[dependencies]
js-sys = "0.3"
log = "0.4"
gloo = "0.7.0"
gloo = "0.8.0"
num-format = { version = "0.4", default-features = false }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
"shared" = { path = "../shared" }
wasm-bindgen = "0.2"
strum = "0.24"
strum_macros = "0.24"
wasm-bindgen = { version = "0.2", features = ["serde-serialize"] }
wasm-bindgen-futures = "0.4"
wasm-logger = "0.2.0"
web-sys = { version = "0.3", features = ["VisibilityState"] }
Expand Down
4 changes: 4 additions & 0 deletions crates/client/Trunk.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

[build]
target = "index.html"
dist = "dist"
8 changes: 8 additions & 0 deletions crates/client/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Example custom build script.
fn main() {
// Tell Cargo that if the given file changes, to rerun this build script.
let is_headless = option_env!("HEADLESS_CLIENT");
if is_headless.is_some() {
println!("cargo:rustc-cfg=headless");
}
}
37 changes: 37 additions & 0 deletions crates/client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/client/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"devDependencies": {
"@tailwindcss/forms": "^0.5.2",
"tailwindcss": "^3.0.24"
}
}
159 changes: 159 additions & 0 deletions crates/client/public/fixtures.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
export let invoke = async (func_name, params) => {
console.log(`calling: ${func_name} w/`, params);

if (func_name == "search_docs") {
return [{
doc_id: "123",
domain: "google.com",
title: "This is an example title",
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam et vulputate urna, sit amet semper metus.",
url: "https://google.com/this/is/a/path",
score: 1.0
}, {
doc_id: "123",
domain: "example.com",
title: "This is an example title",
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam et vulputate urna, sit amet semper metus.",
url: "https://example.com/this/is/a/path",
score: 1.0
}];
} else if (func_name == "search_lenses") {
return [{
author: "a5huynh",
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam et vulputate urna, sit amet semper metus.",
title: "fake_lense",
html_url: null,
download_url: null,
}, {
author: "a5huynh",
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam et vulputate urna, sit amet semper metus.",
title: "fake_lense_2_boogaloo",
html_url: null,
download_url: null,
}];
} else if (func_name == "list_installed_lenses") {
return [{
author: "a5huynh",
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam et vulputate urna, sit amet semper metus.",
title: "fake_lense",
html_url: null,
download_url: null,
}, {
author: "a5huynh",
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam et vulputate urna, sit amet semper metus.",
title: "fake_lense_2_boogaloo",
html_url: null,
download_url: null,
}];
} else if (func_name == "list_installable_lenses") {
return [{
author: "testing",
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam et vulputate urna, sit amet semper metus.",
name: "2007scape",
sha: "12345678990",
download_url: "",
html_url: "",
}, {
author: "testing",
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam et vulputate urna, sit amet semper metus.",
name: "2007scape",
sha: "12345678990",
download_url: "",
html_url: "",
}, {
author: "testing",
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam et vulputate urna, sit amet semper metus.",
name: "2007scape",
sha: "12345678990",
download_url: "",
html_url: "",
}, {
author: "testing",
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam et vulputate urna, sit amet semper metus.",
name: "2007scape",
sha: "12345678990",
download_url: "",
html_url: "",
}, {
author: "testing",
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam et vulputate urna, sit amet semper metus.",
name: "2007scape",
sha: "12345678990",
download_url: "",
html_url: "",
}];
} else if (func_name == "list_plugins") {
return [{
author: "a5huynh",
title: "chrome-exporter",
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam et vulputate urna, sit amet semper metus.",
is_enabled: true,
}];
} else if (func_name == "crawl_stats") {
return {
by_domain: [
['oldschool.runescape.wiki', { num_queued: 0, num_processing: 0, num_completed: 31413, num_indexed: 35453 }],
['en.wikipedia.org', { num_queued: 0, num_processing: 0, num_completed: 31413, num_indexed: 35453 }]
]
};
} else if (func_name == "load_user_settings") {
return {
"user.data_directory": {
label: "Data Directory",
value: "/Users/a5huynh/Library/Application Support/com.athlabs.spyglass-dev",
form_type: "Text",
help_text: "The data directory is where your index, lenses, plugins, and logs are stored. This will require a restart.",
}
};
}

return [];
};

export let listen = async () => {
return {};
};

export async function deleteDoc(id) {
return await invoke('delete_doc', { id });
}

export async function delete_domain(domain) {
return await invoke('delete_domain', { domain });
}

export async function install_lens(downloadUrl) {
return await invoke('install_lens', { downloadUrl })
}

export async function network_change(isOffline) {
return await invoke('network_change', { isOffline });
}

export async function recrawl_domain(domain) {
return await invoke('recrawl_domain', { domain });
}

export async function save_user_settings(settings) {
return await invoke('save_user_settings', { settings });
}

export async function searchDocs(lenses, query) {
return await invoke('search_docs', { lenses, query });
}

export async function searchLenses(query) {
return await invoke('search_lenses', { query });
}

export async function openResult(url) {
return await invoke('open_result', { url });
}

export async function resizeWindow(height) {
return await invoke('resize_window', { height });
}

export async function toggle_plugin(name) {
return await invoke('toggle_plugin', { name })
}
Loading