Skip to content

UIP-35, URO-95: Europa legacy-kbase-ui image #1661

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions release-notes/RELEASE_NOTES_NEXT.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# KBase kbase-ui NEXT Release Notes

none
The main change here is to update the call to Google Analytics to anonymize the user id sent.

## CHANGES

Expand All @@ -18,7 +18,7 @@ none

### IMPROVEMENTS

none
- UIP-35: sends an anonymous id to Google Analytics instead of a user name

### FIXES

Expand Down
2 changes: 1 addition & 1 deletion src/client/js/gtagSupport.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ function main() {

const auth = await getAuth();
if (auth) {
pageView.user_id = auth.user;
pageView.user_id = auth.anonid;
}

pushGTag('event', 'page_view', pageView);
Expand Down
45 changes: 45 additions & 0 deletions src/client/modules/app/services/europa.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { Runtime } from '../../lib/types';

// TODO: DO NOT MERGE WITHOUT SAFER TARGET ORIGIN
const europaTargetOrigin = '*'; // 'https://ci-europa.kbase.us'

export const initEuropa = (runtime: Runtime) => {
runtime.receive('app', 'route-component', (payload) => {
if (window.parent) {
window.parent.postMessage(
{ source: 'kbase-ui.app.route-component', payload },
europaTargetOrigin
);
}
});
runtime.receive('ui', 'setTitle', (payload) => {
if (window.parent) {
window.parent.postMessage(
{ source: 'kbase-ui.ui.setTitle', payload },
europaTargetOrigin
);
}
});
runtime.receive('session', 'loggedin', () => {
if (window.parent) {
window.parent.postMessage(
{
source: 'kbase-ui.session.loggedin',
payload: {
token: runtime.service('session').getAuthToken(),
},
},
europaTargetOrigin
);
}
});
window.addEventListener('message', (message) => {
if (message.source !== window.parent) return;
if (
message?.data?.source &&
message?.data?.source == 'europa.navigate'
) {
runtime.send('app', 'navigate', message.data.payload);
}
});
};
2 changes: 2 additions & 0 deletions src/client/modules/app/services/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
RoutingLocation,
} from "./router";
import { Receiver, Runtime, Service, SimpleMap } from "../../lib/types";
import { initEuropa } from "./europa";

type RouteHandler = RoutedRequest;

Expand Down Expand Up @@ -71,6 +72,7 @@ export class RouteService extends Service<RouteServiceConfig> {
this.currentRouteHandler = null;
this.receivers = [];
this.eventListeners = [];
initEuropa(this.runtime);
}

doRoute() {
Expand Down
13 changes: 0 additions & 13 deletions src/client/modules/lib/kb_lib/Auth2Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -674,19 +674,6 @@ export class Auth2Session {
new Cookie(this.cookieName, '').setPath('/')
);

// Also remove the domain level cookie in case it was in advertently
// created. This can be a cause for a corrupt token, since the old auth
// system tokens are invalid, and it could create domain level cookies.
// New auth code does not (other than the backup cookie.)
const domainParts = window.location.hostname.split('.');
let domain;
for (let len = 2; len <= domainParts.length; len += 1) {
domain = domainParts.slice(-len).join('.');
this.cookieManager.removeItem(
new Cookie(this.cookieName, '').setPath('/').setDomain(domain)
);
}

if (this.extraCookies) {
this.extraCookies.forEach((cookieConfig) => {
this.cookieManager.removeItem(
Expand Down
3 changes: 3 additions & 0 deletions src/client/modules/lib/messenger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ export class Messenger {
const channelName = publishDef.channel;
const message = publishDef.message;

const console_workaround = console;
console_workaround.log("Messenger.send",publishDef)

const channel = this.channels.get(channelName);
if (!channel) {
return;
Expand Down
1 change: 1 addition & 0 deletions src/client/modules/pluginSupport/AutoPostForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ define([
return html`
<form method="post"
ref=${this.ref}
target="_top"
id=${formID}
action=${action}
style=${{display: 'hidden'}}
Expand Down
10 changes: 7 additions & 3 deletions src/client/modules/reactComponents/MainWindow/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
flex: 0 0 75px;
}

.MainWindow .-header, .MainWindow .-nav {
display: none;
}

.MainWindow .-body > .-content {
flex: 1 1 0px;
display: flex;
Expand Down Expand Up @@ -136,7 +140,7 @@

/* Navbar */

/*
/*
* Main Navigation Bar
*/

Expand Down Expand Up @@ -245,8 +249,8 @@

/* Body */

/* Tweak navbar, sidebar and main content areas to fit together
The navbar and sidebar are fixed -- so out of flow and need absolute positioning
/* Tweak navbar, sidebar and main content areas to fit together
The navbar and sidebar are fixed -- so out of flow and need absolute positioning
Although the sidebar is partially positioned with part of the navbar.
The content area is normal flow and just needs to have a matching top margin.
*/
Expand Down