forked from microsoft/BotFramework-Composer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: cache the url to keep the page live (microsoft#2969)
* add sessionStoreage * check the location when jump to begin dialog * use props state to replace the store state * fix lint Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> Co-authored-by: Andy Brown <asbrown002@gmail.com>
- Loading branch information
1 parent
f02918d
commit e1627c0
Showing
6 changed files
with
162 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
import formatMessage from 'format-message'; | ||
|
||
export const topLinks = (projectId: string, openedDialogId: string) => { | ||
const botLoaded = !!projectId; | ||
let links = [ | ||
{ | ||
to: '/home', | ||
iconName: 'Home', | ||
labelName: formatMessage('Home'), | ||
exact: true, | ||
disabled: false, | ||
}, | ||
{ | ||
to: `/bot/${projectId}/dialogs/${openedDialogId}`, | ||
iconName: 'SplitObject', | ||
labelName: formatMessage('Design Flow'), | ||
exact: false, | ||
disabled: !botLoaded, | ||
}, | ||
{ | ||
to: `/bot/${projectId}/language-generation`, | ||
iconName: 'Robot', | ||
labelName: formatMessage('Bot Responses'), | ||
exact: false, | ||
disabled: !botLoaded, | ||
}, | ||
{ | ||
to: `/bot/${projectId}/language-understanding`, | ||
iconName: 'People', | ||
labelName: formatMessage('User Input'), | ||
exact: false, | ||
disabled: !botLoaded, | ||
}, | ||
{ | ||
to: `/bot/${projectId}/notifications`, | ||
iconName: 'Warning', | ||
labelName: formatMessage('Notifications'), | ||
exact: true, | ||
disabled: !botLoaded, | ||
}, | ||
{ | ||
to: `/bot/${projectId}/publish`, | ||
iconName: 'CloudUpload', | ||
labelName: formatMessage('Publish'), | ||
exact: true, | ||
disabled: !botLoaded, | ||
}, | ||
{ | ||
to: `/bot/${projectId}/skills`, | ||
iconName: 'PlugDisconnected', | ||
labelName: formatMessage('Skills'), | ||
exact: true, | ||
disabled: !botLoaded, | ||
}, | ||
{ | ||
to: `/bot/${projectId}/settings/`, | ||
iconName: 'Settings', | ||
labelName: formatMessage('Settings'), | ||
exact: false, | ||
disabled: !botLoaded, | ||
}, | ||
]; | ||
|
||
if (process.env.COMPOSER_AUTH_PROVIDER === 'abs-h') { | ||
links = links.filter(link => link.to !== '/home'); | ||
} | ||
|
||
return links; | ||
}; | ||
|
||
export const bottomLinks = [ | ||
{ | ||
to: '/about', | ||
iconName: 'info', | ||
labelName: formatMessage('About'), | ||
exact: true, | ||
disabled: false, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
import { ClientStorage } from './storage'; | ||
|
||
const KEY = 'RouterCache'; | ||
|
||
class RouterCache { | ||
private storage: ClientStorage; | ||
private _all; | ||
|
||
constructor() { | ||
this.storage = new ClientStorage(window.sessionStorage); | ||
this._all = this.storage.get(KEY, {}); | ||
} | ||
|
||
get(to: string) { | ||
return this._all[to] || {}; | ||
} | ||
|
||
getAll() { | ||
return this._all; | ||
} | ||
|
||
set(linkTo: string, uri: string) { | ||
this._all[linkTo] = uri; | ||
this.storage.set(KEY, this._all); | ||
} | ||
} | ||
|
||
export default new RouterCache(); |