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

Metabase init always imports new dashboards #143

Merged
merged 2 commits into from May 6, 2022
Merged

Conversation

thomas-gerber
Copy link
Contributor

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 in resources/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

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist

  • Have you checked to there aren't other open Pull Requests for the same update/change?
  • Have you lint your code locally before submission?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you successfully run tests with your changes locally?

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a new line

@@ -8,7 +8,7 @@ export interface Dashboard {
readonly template: string;
}

export async function loadDashboards(): Promise<ReadonlyArray<Dashboard>> {
export async function loadDashboards(): Promise<Dashboard[]> {
Copy link
Contributor

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>?


for (const item of existingDashboards) {
existingDashboardNames.add(item.name);
this.logger.info('existing dashboard: %s', item.name);
Copy link
Contributor

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)

Copy link
Contributor

@tovbinm tovbinm left a 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

@thomas-gerber thomas-gerber merged commit a27e585 into main May 6, 2022
@thomas-gerber thomas-gerber deleted the import_new_only branch May 6, 2022 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better import of new canned dashboards
3 participants