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

[ML] Reorganize ML navigation with top and sub level tabs #45220

Merged
merged 11 commits into from
Sep 12, 2019

Conversation

alvarezmelissa87
Copy link
Contributor

@alvarezmelissa87 alvarezmelissa87 commented Sep 10, 2019

Summary

Reorganize navigation into 4 main areas: Anomaly Detection, Transforms, Data Frame Analytics, and Data Visualizer.

Each main area has sub-navigation pertaining to that area.
When clicking on a main area for the first time the default subsection selected will be the one to the far left.

Updated breadcrumbs to include main tab.

  • follow up coming for addingOverview main tab which will contain an overview of all jobs.

image

image

image

image

image

image

image

image

image

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

- [ ] This was checked for breaking API changes and was labeled appropriately
- [ ] This includes a feature addition or change that requires a release note and was labeled appropriately

@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@spalger
Copy link
Contributor

spalger commented Sep 10, 2019

Please merge master

@alvarezmelissa87 alvarezmelissa87 changed the title WIP [ML] Reorganize ML navigation with top and sub level tabs [ML] Reorganize ML navigation with top and sub level tabs Sep 10, 2019
@alvarezmelissa87
Copy link
Contributor Author

retest

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@walterra
Copy link
Contributor

About the breadcrumbs, in the screenshot there's:

Breadcrumb Page
Machine Learning Anomaly Detection Job Management page
Machine Learning > Anomaly Detection Anomaly Explorer page
Machine Learning > Anomaly Detection > Settings Anomaly Detection Settings page

I'm not sure about the start page but I think the Anomaly Explorer page should be Machine Learning > Anomaly Detection > Anomaly Explorer what do you think? For consistency I'm leaning towards having the start page also the full breadcrumb like Machine Learning > Anomaly Detection > Job Management esp. since we're getting the new overview page later.

@jgowdyelastic
Copy link
Member

jgowdyelastic commented Sep 11, 2019

i agree with @walterra, we should be consistent. even if that now means the "root" of the main tabs will always have a page after it
e.g. Clicking on "Anomaly Detection" will auto select "Job Management", so the breadcrumbs will be "Machine Learning / Anomaly Detection / Job Management" by default.

@walterra
Copy link
Contributor

@peteharverson It's definitely worth doing but I think we should do the analytics breadcrumbs in a follow up, they haven't been considered/implemented at all besides the main page for now.

@jgowdyelastic
Copy link
Member

jgowdyelastic commented Sep 11, 2019

When a page doesn't include the time filter at the top right, the main tabs are lower.
The Data Visualizer page demonstrates this:
image

image

@jgowdyelastic
Copy link
Member

I think the sub tabs look better condensed with a left margin to align them with the main tabs above.

image

vs current
image

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

A couple of extra tweaks to the Data Visualizer steps if possible, plus agree with @jgowdyelastic suggestions about the left margin for the sub menus, and the slight style difference on pages where there is no date picker. Otherwise looking good.

DATA_VISUALIZER_BREADCRUMB,
{
text: i18n.translate('xpack.ml.dataVisualizer.fileBasedLabel', {
defaultMessage: 'File based'
Copy link
Contributor

Choose a reason for hiding this comment

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

Now I see it, I think maybe just File is better than File based!

ML_BREADCRUMB,
DATA_VISUALIZER_BREADCRUMB,
// @ts-ignore
} from '../../breadcrumbs';

export function getDataVisualizerBreadcrumbs() {
Copy link
Contributor

Choose a reason for hiding this comment

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

For the main page, is is possible for the breadcrumbs to be Machine Learning / Data Visualizer / Index here:

image

pathId?: string;
}

const TAB_DATA: { [key: string]: TabData } = {
Copy link
Member

@jgowdyelastic jgowdyelastic Sep 11, 2019

Choose a reason for hiding this comment

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

this could be a Record
const TAB_DATA: Record<TabId, TabData> = {

<EuiTabs display="condensed">
{tabs.map((tab: Tab) => {
const id = tab.id;
const testSubject = TAB_DATA[id as TAB_DATA_PROPERTY].testSubject;
Copy link
Member

Choose a reason for hiding this comment

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

these type assertions aren't needed, id is a string.

];
export type TabId = string;

const tabSupport = {
Copy link
Member

Choose a reason for hiding this comment

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

giving this a type of:
type TabSupport = Record<string, string | null>;
means you don't need type assertion on lines 41 and 43.

explorer: 'anomaly_detection',
};

type tabSupportId = keyof typeof tabSupport;
Copy link
Member

Choose a reason for hiding this comment

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

this isn't needed with the above suggested change

}

export const NavigationMenu: FC<Props> = ({ tabId }) => {
const disableLinks = isFullLicense() === false;
const showTabs = tabSupport.includes(tabId);
const showTabs = Object.keys(tabSupport).includes(tabId);
Copy link
Member

Choose a reason for hiding this comment

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

nit, could be const showTabs = typeof tabSupport[tabId] !== 'undefined';

},
];
function getTabs(tabId: TabId, disableLinks: boolean): Tab[] {
const TAB_MAP = {
Copy link
Member

Choose a reason for hiding this comment

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

could be const TAB_MAP: Record<TabId, Tab[]> = {


type TAB_MAP_ID = keyof typeof TAB_MAP;

return TAB_MAP[tabId as TAB_MAP_ID];
Copy link
Member

Choose a reason for hiding this comment

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

with the suggested change above this type assertion isn't needed

@elasticmachine
Copy link
Contributor

💔 Build Failed

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested with latest edits, including on IE11, and LGTM

@elasticmachine
Copy link
Contributor

💔 Build Failed

@alvarezmelissa87
Copy link
Contributor Author

retest

@elasticmachine
Copy link
Contributor

💔 Build Failed

@alvarezmelissa87
Copy link
Contributor Author

retest

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

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

LGTM

@alvarezmelissa87 alvarezmelissa87 merged commit 9e3a3dc into elastic:master Sep 12, 2019
alvarezmelissa87 added a commit to alvarezmelissa87/kibana that referenced this pull request Sep 12, 2019
)

* Add main nav tabs with sub tabs for new nav

* move transforms to top level main nav

* Make top nav normal font weight

* Update breadcrumbs to take top nav into account

* proper spacing when settings selected

* fix localization error

* Fix functional tests. Update breadcrumbs

* revert analytics breadcrumb update. save for follow up

* ensure main/sub tabs align left

* update dataVisualizer breadcrumbs

* update typescript for tabs
@alvarezmelissa87 alvarezmelissa87 deleted the ml-nav-reorg branch September 12, 2019 14:20
alvarezmelissa87 added a commit that referenced this pull request Sep 12, 2019
…45517)

* Add main nav tabs with sub tabs for new nav

* move transforms to top level main nav

* Make top nav normal font weight

* Update breadcrumbs to take top nav into account

* proper spacing when settings selected

* fix localization error

* Fix functional tests. Update breadcrumbs

* revert analytics breadcrumb update. save for follow up

* ensure main/sub tabs align left

* update dataVisualizer breadcrumbs

* update typescript for tabs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants