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

Feature: clickable links on message bar #835

Merged
merged 10 commits into from
Feb 10, 2021

Conversation

thewahome
Copy link
Collaborator

@thewahome thewahome commented Feb 9, 2021

Overview

Makes links available in the samples clickable

Fixes #862
Fixes #705

Demo

Has clickable link:
image

Notes

Some tip messages will not be shown when the user is not signed in

Testing Instructions

Scenario 1 - External link

  • Click the list Azure AD gallery apps example from the sidebar
  • A tip message with a clickable link should be displayed
  • The click should open a new tab to the feedback survey

Scenario 2 - Graph API link

  • Run the get ediscovery case example from the sidebar
  • A tip message with a clickable link should be displayed
  • The click should populate the query input area with the clicked url

@thewahome thewahome changed the title Feature/clickable links on message bar Feature: clickable links on message bar Feb 9, 2021
package.json Outdated
@@ -81,7 +81,7 @@
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js && node versioned-build.js",
"test": "node scripts/test.js --no-watch --testPathIgnorePatterns=src/tests/accessibility",
"test": "node scripts/test.js --watch --testPathIgnorePatterns=src/tests/accessibility",
Copy link
Collaborator

Choose a reason for hiding this comment

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

why did you change this part?
won't it look for the accessibility test, which is a separate job?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the --watch flag makes the tests watch for changes as you work. So if you change a file, as long as you had ran npm run test you would see the results of the tests immediately without running it again. with the --no-watch you need to run the tests command again

The --testPathIgnorePatterns flag is a different parameter that helps the runner know which file to ignore

Copy link
Contributor

@jobala jobala left a comment

Choose a reason for hiding this comment

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

Why is the filename status.util.ts and not status.ts?

@@ -0,0 +1,46 @@
export function replaceLinks(message: string): string {
if (linkExists(message)) {
const urls = extractUrl(message);
Copy link
Contributor

Choose a reason for hiding this comment

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

It is possible to avoid the implementation of linkExists by checking the result of extractUrl.

const urls = extractUrl(message)

// instead of if linkExists(message)
if (urls.length > 0) {
...
}

return exists;
}

export function extractUrl(value: string): any {
Copy link
Contributor

Choose a reason for hiding this comment

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

The return type here should be an array of strings or an empty array

export function extractUrl(value: string): any {
const matches = value.match(/\bhttps?:\/\/\S+/gi);
if (matches) {
return matches;
Copy link
Contributor

Choose a reason for hiding this comment

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

You can achieve the same with

return value.match(...)

@@ -0,0 +1,36 @@
import { linkExists, extractUrl, replaceLinks, convertArrayToObject } from "../../app/utils/status.util";

describe('url should', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a best practise to put the test suit name here, something like URL TestSuite

@github-actions
Copy link
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://jolly-sand-0ac78c710-835.centralus.azurestaticapps.net

@github-actions
Copy link
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://jolly-sand-0ac78c710-835.centralus.azurestaticapps.net

@thewahome thewahome merged commit 4ab6fe9 into dev Feb 10, 2021
ElinorW added a commit that referenced this pull request Feb 16, 2021
* Fix: support different content types (#814)

* Feature: Add Adaptive cards  JSON Schema code (#828)

* Feature: samples testing (#833)

* Feature: Adds 'Report an Issue' menu option (#834)

* Feature: clickable links on message bar (#835)

* fix: intermittent create page error (#837)

* Fix: Add 'Maximize sidebar' aria-label (#842)

* Task: upgrade technologies (#844)

* Fix: expand maxWidth allow more humanName chars (#764)

* Fix: autocomplete options not displaying (#847)

* fix: adaptive cards destroy (#848)

* Fix: Graph Explorer link colors (#846)

* Fix: Adaptive cards instrumentation (#849)

* Fix: adjust column width (#850)

* Task: prevent storing access token (#851)

Co-authored-by: jobala <japhethobalak@gmail.com>
Co-authored-by: Charles Wahome <thewahome.cw@gmail.com>
Co-authored-by: OfficeGlobal <47977325+OfficeGlobal@users.noreply.github.com>
Co-authored-by: OfficeGlobal <OfficeGlobal@microsoft.com>
Co-authored-by: Azure Static Web Apps <opensource@microsoft.com>
Co-authored-by: Millicent Achieng <achieng.milli@gmail.com>
Co-authored-by: Sébastien Levert <sebastienlevert@users.noreply.github.com>
Co-authored-by: Ezrqn Kemboi <ezrqnkemboi@gmail.com>
Co-authored-by: Vincent Biret <vibiret@microsoft.com>
Co-authored-by: Joseph Ngugi <jngugi88@gmail.com>
Co-authored-by: Maggie Kimani <maggiekim42@gmail.com>
@thewahome thewahome deleted the feature/clickable-links-on-message-bar branch February 17, 2021 11:36
ElinorW added a commit that referenced this pull request Feb 22, 2021
* Fix: support different content types (#814)

* Feature: Add Adaptive cards  JSON Schema code (#828)

* Feature: samples testing (#833)

* Feature: Adds 'Report an Issue' menu option (#834)

* Feature: clickable links on message bar (#835)

* fix: intermittent create page error (#837)

* HB of localized GE.jsons (#830)

* Fix: Add 'Maximize sidebar' aria-label (#842)

* Task: upgrade technologies (#844)

* Fix: expand maxWidth allow more humanName chars (#764)

* Fix: autocomplete options not displaying (#847)

* fix: adaptive cards destroy (#848)

* Fix: Graph Explorer link colors (#846)

* Fix: Adaptive cards instrumentation (#849)

* Fix: adjust column width (#850)

* Task: prevent storing access token (#851)

* HB of localized GE.jsons (#854)

* chore(release): 4.3.0 (#857)

* Fix: rename component name (#859)

* chore(release): 4.4.0

Co-authored-by: jobala <japhethobalak@gmail.com>
Co-authored-by: Charles Wahome <thewahome.cw@gmail.com>
Co-authored-by: OfficeGlobal <47977325+OfficeGlobal@users.noreply.github.com>
Co-authored-by: OfficeGlobal <OfficeGlobal@microsoft.com>
Co-authored-by: Azure Static Web Apps <opensource@microsoft.com>
Co-authored-by: Millicent Achieng <achieng.milli@gmail.com>
Co-authored-by: Sébastien Levert <sebastienlevert@users.noreply.github.com>
Co-authored-by: Ezrqn Kemboi <ezrqnkemboi@gmail.com>
Co-authored-by: Vincent Biret <vibiret@microsoft.com>
Co-authored-by: Joseph Ngugi <jngugi88@gmail.com>
Co-authored-by: Maggie Kimani <maggiekim42@gmail.com>
@thewahome thewahome linked an issue Feb 24, 2021 that may be closed by this pull request
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.

Clickable message bar links Graph links in tip messages to populate the url address bar
3 participants