Skip to content

Commit

Permalink
id 支持 字符串格式 #3
Browse files Browse the repository at this point in the history
  • Loading branch information
baozhoutao committed Jul 26, 2023
1 parent c8434ed commit 6c03f36
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Dashboard extends Component {
isAdditionalInfoVisible: PropTypes.bool,

dashboard: PropTypes.object,
dashboardId: PropTypes.number,
dashboardId: PropTypes.string, //PropTypes.number
parameters: PropTypes.array,
parameterValues: PropTypes.object,
editingParameter: PropTypes.object,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const DashboardApp = props => {
const { isRunning, isLoadingComplete, dashboard } = props;

const [editingOnLoad] = useState(options.edit);
const [addCardOnLoad] = useState(options.add && parseInt(options.add));
const [addCardOnLoad] = useState(options.add && options.add); //@steedos useState(options.add && parseInt(options.add));

const [isShowingToaster, setIsShowingToaster] = useState(false);

Expand Down
4 changes: 3 additions & 1 deletion frontend/src/metabase/lib/urls/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
export function appendSlug(path: string | number, slug?: string) {
return slug ? `${path}-${slug}` : String(path);
return String(path);
// return slug ? `${path}-${slug}` : String(path);
}

export function extractEntityId(slug = "") {
return slug;
const id = parseInt(slug, 10);
return Number.isSafeInteger(id) ? id : undefined;
}
Expand Down

0 comments on commit 6c03f36

Please sign in to comment.