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
Metabase init always imports new dashboards #143
Conversation
Clarified import methods
init/scripts/metabase-init.sh
Outdated
fi | ||
|
||
echo "Attached Faros database to Metabase" | ||
|
||
echo "Importing dashboards" | ||
node ../lib/metabase/init.js --metabase-url "$mb_url" --username "$mb_user" --password "$mb_password" --database "$db_name" --import-new |
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.
add a new line
init/src/metabase/config.ts
Outdated
@@ -8,7 +8,7 @@ export interface Dashboard { | |||
readonly template: string; | |||
} | |||
|
|||
export async function loadDashboards(): Promise<ReadonlyArray<Dashboard>> { | |||
export async function loadDashboards(): Promise<Dashboard[]> { |
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.
what was wrong with ReadonlyArray<Dashboard>
?
init/src/metabase/dashboards.ts
Outdated
|
||
for (const item of existingDashboards) { | ||
existingDashboardNames.add(item.name); | ||
this.logger.info('existing dashboard: %s', item.name); |
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.logger.debug('Existing dashboard: %s', item.name)
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.
lgtm, some minor comments
Description
Metabase init always imports dashboards (
--import-new
option), but only non-existing ones.if one uses the
--import-one
option, the name (with the extension) of a file existing inresources/metabase/dashboards
is expected. A new dashboard will be created (possibly a named duplicate) in the corresponding collection.Card behavior is unchanged: all cards needed by created dashboards will be added to the corresponding collection, possibly overwriting cards located them based on the name.
Fixes #136
Type of change
Checklist