Skip to content

Commit

Permalink
Release v1 (#1169)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesDoberer authored Mar 19, 2020
1 parent ccdac39 commit 270469f
Show file tree
Hide file tree
Showing 23 changed files with 490 additions and 146 deletions.
54 changes: 32 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
version: ~> 1.0 # enables build config validation beta feature: https://docs.travis-ci.com/user/build-config-validation
language: node_js
node_js:
- '11.14' #TODO: change it to 'node' once Travis supports the newest version
Expand All @@ -14,6 +15,29 @@ cache:
notifications:
slack:
secure: wiOchVgoiKNUikjCeIhsuv3Y5jolFud6ercdZdO3+JigQqkmoAC95f2jKTYEdplJWyJr8JY6z0+UJNceHyr5YJx/l1wpm6Zq+3H4dq/V0yUXH1uhw2eaTzweX2vjfw0bzewEdc1CGl4kSfdyTajnbKgt+mtnrAV9lPqiXYSOOJTu5BCFomi7u2GhAz1JjBK6P4Ar2jXm+oc81nYjj40P8bZFlA7Rjm0hNN42MMkKvnD8OHztL3EwezKHXlQW7fN4eOrhPOMbT3NRU72g9Nir+lfoKJlch1zPoHXQ7DRp41uGyHV/qfvfRLzXwxftZK6kdvzMe0eI0i1aIm0R6AE0bLphB2o/klJzyQpqSiQgETTH0qJN+3px2kddGrw7Me+UNC/1zZrt1MJfWf0h6WjXTsPDJf3ajLsn8OoIeBTRZbAb9as3UWQZcknuuMf8oGUzZkrZNMWYqo3py0+qWm4wSbWXWVUCgVAIYA6oEADwq37z59HySGkyHI4gEPzxsYODfCuvO4pJX1h4vEyH7w2IigwhDAPq5G4Vdez9ZFS96p/LSCF+iH8yWMy294u8wk5ofWUutFFv0JC45LQBXu51a2TeQkalwVn4DiuxxHE6jZieREw75YFjra4jpWsyziWkzshGT75NCra6cKAbNa4T8n6Pm3ogjEPeeWAO3psgSdo=


integration-testing: &integration-testing
script:
- export CYPRESS_CACHE_FOLDER=$TRAVIS_BUILD_DIR/cypress-binary-cache
- ls $CYPRESS_CACHE_FOLDER
- bash ./test/e2e.sh
addons:
apt:
packages:
# Ubuntu 16+ does not install this dependency by default, so we need to install it ourselves
- libgconf-2-4
#- chromium-browser=79.0.3945.130-0ubuntu0.16.04.1 # update also if you upgrade from Xenial
chrome: beta
before_install:
#- chromium-browser --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
- google-chrome-beta --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
before_cache:
- rm -rf ~/.npm/_logs
- rm -rf ~/.npm/_cacache
- rm -rf ~/.cache/Cypress/cy/production/browsers #it is individual for each run anyway so caching it slows down the job


jobs:
include:
- stage: 'Precache & Unit Tests'
Expand Down Expand Up @@ -72,28 +96,14 @@ jobs:
- rm -rf ~/.npm/_cacache

# ----- INTEGRATION -----
- &integration-testing
name: 'Integration Testing'
script:
- export CYPRESS_CACHE_FOLDER=$TRAVIS_BUILD_DIR/cypress-binary-cache
- ls $CYPRESS_CACHE_FOLDER
- bash ./test/e2e.sh
addons:
apt:
packages:
# Ubuntu 16+ does not install this dependency by default, so we need to install it ourselves
- libgconf-2-4
#- chromium-browser=79.0.3945.130-0ubuntu0.16.04.1 # update also if you upgrade from Xenial
chrome: beta
before_install:
#- chromium-browser --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
- google-chrome-beta --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
before_cache:
- rm -rf ~/.npm/_logs
- rm -rf ~/.npm/_cacache
- rm -rf ~/.cache/Cypress/cy/production/browsers #it is individual for each run anyway so caching it slows down the job
- <<: *integration-testing
- <<: *integration-testing
- name: 'Integration Testing 1'
<<: *integration-testing

- name: 'Integration Testing 2'
<<: *integration-testing

- name: 'Integration Testing 3'
<<: *integration-testing

# ----- NPM PUBLISH -----
- stage: 'Publish'
Expand Down
165 changes: 111 additions & 54 deletions client/luigi-client.d.ts

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions core/src/core-api/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ class LuigiAuth {
* @property {string} idToken - id token, used for renewing authentication
*/
get store() {
if (!LuigiConfig.initialized) {
console.warn(
'Luigi Core is not initialized yet. Consider moving your code to the luigiAfterInit lifecycle hook. ' +
'Documentation: https://docs.luigi-project.io/docs/lifecycle-hooks'
);
}
return {
/**
* Retrieves the key name that is used to store the auth data.
Expand Down
4 changes: 4 additions & 0 deletions core/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ const configReadyCallback = () => {
return app.$$.ctx.pathExists(path);
};

Luigi.pathExists = path => {
return app.$$.ctx.pathExists(path);
};

Luigi.hasBack = () => {
return app.$$.ctx.hasBack();
};
Expand Down
7 changes: 4 additions & 3 deletions core/src/navigation/ContextSwitcher.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ <h5 class="fd-action-bar__title fd-has-type-1">
import ContextSwitcherNav from './ContextSwitcherNav.html';
import { LuigiConfig } from '../core-api';
import { Routing } from '../services/routing';
import { NodeDataManagementStorage } from '../services/node-data-management';
import {
IframeHelpers,
RoutingHelpers,
Expand Down Expand Up @@ -139,7 +140,7 @@ <h5 class="fd-action-bar__title fd-has-type-1">
StateHelpers.doOnStoreChange(
store,
async () => {
LuigiConfig._configModificationTimestamp = new Date();
NodeDataManagementStorage.deleteCache();
const contextSwitcherConfig = LuigiConfig.getConfigValue(
'navigation.contextSwitcher'
);
Expand Down Expand Up @@ -278,7 +279,7 @@ <h5 class="fd-action-bar__title fd-has-type-1">

export function goToPath(path) {
getUnsavedChangesModalPromise().then(() => {
LuigiConfig._configModificationTimestamp = new Date();
NodeDataManagementStorage.deleteCache();
Routing.navigateTo(path);
});
}
Expand All @@ -287,7 +288,7 @@ <h5 class="fd-action-bar__title fd-has-type-1">
let option = event.detail.option;
let selectedOption = event.detail.selectedOption;
getUnsavedChangesModalPromise().then(() => {
LuigiConfig._configModificationTimestamp = new Date();
NodeDataManagementStorage.deleteCache();
if (preserveSubPathOnSwitch && selectedOption) {
Routing.navigateTo(
ContextSwitcherHelpers.getNodePathFromCurrentPath(
Expand Down
19 changes: 15 additions & 4 deletions core/src/navigation/services/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ class NavigationClass {
return filteredChildren;
}

/**
* returns filtered children from cache if present otherwise calculates them.
* */
async getFilteredChildren(node) {
return NodeDataManagementStorage.hasChildren(node)
? Navigation.getChildrenFromCache(node)
: await Navigation.getChildren(node);
}

getChildrenFromCache(node) {
let data = NodeDataManagementStorage.getChildren(node);
return data ? data.filteredChildren : [];
Expand Down Expand Up @@ -271,10 +280,12 @@ class NavigationClass {
Object.assign(newChild, {
pathSegment: ':virtualSegment_' + _virtualPathIndex,
label: ':virtualSegment_' + _virtualPathIndex,
viewUrl: this.buildVirtualViewUrl(
_virtualViewUrl,
pathParams,
_virtualPathIndex
viewUrl: GenericHelpers.trimTrailingSlash(
this.buildVirtualViewUrl(
_virtualViewUrl,
pathParams,
_virtualPathIndex
)
),
_virtualTree: true,
_virtualPathIndex,
Expand Down
38 changes: 22 additions & 16 deletions core/src/services/iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,25 @@ class IframeClass {
return newActiveIframe;
}

setOkResponseHandler(config, component, node) {
/**
* check if luigi responded
* if not, callback again to replace the iframe
*/
this.timeoutHandle = setTimeout(() => {
if (config.navigateOk) {
config.navigateOk = undefined;
} else {
config.iframe = undefined;
config.isFallbackFrame = true;
console.info(
'navigate: luigi-client did not respond, using fallback by replacing iframe'
);
this.navigateIframe(config, component, node);
}
}, this.iframeNavFallbackTimeout);
}

navigateIframe(config, component, node) {
clearTimeout(this.timeoutHandle);
const componentData = component.get();
Expand Down Expand Up @@ -264,6 +283,8 @@ class IframeClass {
const message = ['init', JSON.stringify(componentData.context)];
IframeHelpers.sendMessageToIframe(config.iframe, message);
});
} else if (!config.isFallbackFrame) {
this.setOkResponseHandler(config, component, node);
}
}
} else {
Expand All @@ -290,29 +311,14 @@ class IframeClass {
if (withSync) {
// default, send navigation event to client
IframeHelpers.sendMessageToIframe(config.iframe, message);
this.setOkResponseHandler(config, component, node);
} else {
// `withoutSync()` used. client navigation was skipped, reset after one-time use.
component.set({ isNavigationSyncEnabled: true });
}

// clear goBackContext and reset navigateBack after sending it to the client
component.set({ goBackContext: undefined, isNavigateBack: false });

/**
* check if luigi responded
* if not, callback again to replace the iframe
*/
this.timeoutHandle = setTimeout(() => {
if (config.navigateOk) {
config.navigateOk = undefined;
} else {
config.iframe = undefined;
console.info(
'navigate: luigi-client did not respond, using fallback by replacing iframe'
);
this.navigateIframe(config, component, node);
}
}, this.iframeNavFallbackTimeout);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/utilities/helpers/navigation-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { LuigiAuth, LuigiConfig } from '../../core-api';
import { AuthHelpers } from './';
import { Navigation } from '../../navigation/services/navigation';

import { NodeDataManagementStorage } from '../../services/node-data-management';
class NavigationHelpersClass {
constructor() {
this.EXP_CAT_KEY = 'luigi.preferences.navigation.expandedCategories';
Expand Down Expand Up @@ -150,7 +150,7 @@ class NavigationHelpersClass {
}

async generateTopNavNodes(pathData) {
const rawChildren = await Navigation.getChildrenFromCache(pathData[0]);
const rawChildren = await Navigation.getFilteredChildren(pathData[0]);
let selectedNode = null;
let visibleNodeCount = 0;
let cats = {};
Expand Down
Loading

0 comments on commit 270469f

Please sign in to comment.