-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add cli to generate and install plugin bundle #6397
base: develop
Are you sure you want to change the base?
Conversation
@@ -154,6 +154,10 @@ enum Action { | |||
}, | |||
/// Will generate a plugin bundle | |||
GeneratePluginBundle(GeneratePluginBundle), | |||
/// Will insert generated plugin bundle | |||
InstallPluginBundle(InstallPluginBundle), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was thinking maybe we just need generate and install, kept this one however as a manual was to install via CLI
@@ -0,0 +1,16 @@ | |||
pub(super) const AUTH_QUERY: &str = r#" | |||
query AuthToken($username: String!, $password: String) { | |||
root: authToken(password: $password, username: $username) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this root relates to the GraphQlResponse
struct and Root
struct, it seems cleaner to use struct with auto derived de/se and map graphql field to root, rather then manually accessing serde_json::Value type
) | ||
.await?; | ||
|
||
let token = result["token"].as_str().unwrap().to_string(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extracting and saving token, unwrap should be save as we've checked 'expected_typename' and query is const
.header("Cookie", auth_cooke_value); | ||
|
||
// Add file to request | ||
let mut file_handle = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied from
open-msupply/server/service/src/sync/api_v6/upload_file.rs
Lines 60 to 61 in 86be0d6
fn to_reqwest_multipart( | |
json_reqwest: &SyncUploadFileRequestV6, |
query: &str, | ||
variables: serde_json::Value, | ||
token: Option<&str>, | ||
expected_typename: Option<&str>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will check typename at the 'root' if specified
@@ -36,6 +42,9 @@ let plugins = { | |||
const sql_result = sql(sql_statement); | |||
const response = {}; | |||
|
|||
// Fill all item_ids with default | |||
item_ids.forEach((itemId) => (response[itemId] = { average_monthly_consumption: 1 })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is not 'consumption' then it will be zero, changed to '1' to see effect of the plugin
Fixes #6396
π©π»βπ» What does this PR do?
Add install-plugin-bundle cli and general-and-install-plugin-bundle cli, see
amc.js
on notes of how to use.π Any notes for the reviewer?
There is now API accessor in the cli (api struct), which is similar to what was done in the
report_builder
but a bit easier on the consumer, we would use this abstraction when time comes to delete report builderπ§ͺ Testing
Make changes to
amc.js
Run
cargo run --bin remote_server_cli -- generate-and-install-plugin-bundle -i './service/src/backend_plugin/examples/amc' -u 'http://localhost:8000' --username 'test' --password 'pass'
, and see your AMC values update when looking at catalogue