Skip to content

Commit

Permalink
feat(run): Add Lumi Run (#1504)
Browse files Browse the repository at this point in the history
  • Loading branch information
JPSchellenberg committed May 14, 2021
1 parent 81b6858 commit e9fa47f
Show file tree
Hide file tree
Showing 45 changed files with 1,492 additions and 680 deletions.
89 changes: 89 additions & 0 deletions .bitmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/* THIS IS A BIT-AUTO-GENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. */

{
"lumieducation.lumi/auth@1.0.5": {
"files": [
{
"relativePath": "client/src/views/components/Auth.tsx",
"test": false,
"name": "Auth.tsx"
}
],
"mainFile": "client/src/views/components/Auth.tsx",
"origin": "AUTHORED",
"exported": true
},
"lumieducation.lumi/h5p-avatar@1.0.4": {
"files": [
{
"relativePath": "client/src/views/components/H5PAvatar.tsx",
"test": false,
"name": "H5PAvatar.tsx"
}
],
"mainFile": "client/src/views/components/H5PAvatar.tsx",
"origin": "AUTHORED",
"exported": true
},
"lumieducation.lumi/logo@1.0.5": {
"files": [
{
"relativePath": "client/src/views/components/Logo.tsx",
"test": false,
"name": "Logo.tsx"
}
],
"mainFile": "client/src/views/components/Logo.tsx",
"origin": "AUTHORED",
"exported": true
},
"lumieducation.lumi/run-link@1.0.5": {
"files": [
{
"relativePath": "client/src/views/components/RunLink.tsx",
"test": false,
"name": "RunLink.tsx"
}
],
"mainFile": "client/src/views/components/RunLink.tsx",
"origin": "AUTHORED",
"exported": true
},
"lumieducation.lumi/run-list@1.0.6": {
"files": [
{
"relativePath": "client/src/views/components/RunList.tsx",
"test": false,
"name": "RunList.tsx"
}
],
"mainFile": "client/src/views/components/RunList.tsx",
"origin": "AUTHORED",
"exported": true
},
"lumieducation.lumi/run-setup-dialog@1.0.5": {
"files": [
{
"relativePath": "client/src/views/components/RunSetupDialog.tsx",
"test": false,
"name": "RunSetupDialog.tsx"
}
],
"mainFile": "client/src/views/components/RunSetupDialog.tsx",
"origin": "AUTHORED",
"exported": true
},
"lumieducation.lumi/run-upload-dialog@1.0.5": {
"files": [
{
"relativePath": "client/src/views/components/RunUploadDialog.tsx",
"test": false,
"name": "RunUploadDialog.tsx"
}
],
"mainFile": "client/src/views/components/RunUploadDialog.tsx",
"origin": "AUTHORED",
"exported": true
},
"version": "14.8.8"
}
112 changes: 112 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Build

on:
push:
branches:
- build

jobs:
build-mac:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js 10.x
uses: actions/setup-node@v1
with:
node-version: 10.x
- name: NPM Setup
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: install
run: npm ci && (cd client && npm ci) && (cd reporter-client && npm ci)
- name: Build macOS
run: npm run build:mac
env:
CI: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_LINK: ${{ secrets.mac_certs }}
CSC_KEY_PASSWORD: ${{ secrets.mac_certs_password }}
APPLEID: ${{ secrets.apple_id }}
APPLEIDPASSWORD: ${{ secrets.apple_id_password }}
- run: rm -rf dist/mac/
- name: Upload macOS artifacts
uses: actions/upload-artifact@v2
with:
name: macOS
path: dist/

build-win:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js 10.x
uses: actions/setup-node@v1
with:
node-version: 10.x
- name: NPM Setup
uses: filipstefansson/set-npm-token-action@v1
with:
token: ${{ secrets.NPM_TOKEN }}
- name: install server
run: npm ci
env:
NPM_TOKEN: $${ secrets.NPM_TOKEN }
- name: Copy NPM config
run: cp ./.npmrc ./client/.npmrc && cp ./.npmrc ./reporter-client/.npmrc
- name: install client(s)
run: (cd client && npm ci) && (cd ../reporter-client && npm ci)
env:
NPM_TOKEN: $${ secrets.NPM_TOKEN }
- name: Build Windows
run: npm run build:win
env:
CI: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPX_APPLICATION_ID: ${{ secrets.APPX_APPLICATION_ID }}
APPX_DISPLAY_NAME: ${{ secrets.APPX_DISPLAY_NAME }}
APPX_IDENTITY_NAME: ${{ secrets.APPX_IDENTITY_NAME }}
APPX_PUBLISHER: ${{ secrets.APPX_PUBLISHER }}
APPX_PUBLISHER_DISPLAY_NAME: ${{ secrets.APPX_PUBLISHER_DISPLAY_NAME }}
- run: Remove-Item 'dist\win-unpacked' -Recurse -Force
- name: Upload Windows artifacts
uses: actions/upload-artifact@v2
with:
name: Windows
path: dist

build-linux:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js 10.x
uses: actions/setup-node@v1
with:
node-version: 10.x
- name: NPM Setup
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: install labarchive-tools
run: sudo apt install libarchive-tools
- name: install
run: npm ci && (cd client && npm ci) && (cd reporter-client && npm ci)
- name: Build
run: npm run build
- name: Install Snapcraft
uses: samuelmeuli/action-snapcraft@v1
with:
snapcraft_token: ${{ secrets.snapcraft_token }}
- name: Build Linux
run: npm run build:linux:dev
env:
CI: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Linux artifacts
uses: actions/upload-artifact@v2
with:
name: Linux
path: dist/
20 changes: 20 additions & 0 deletions client/src/helpers/LumiError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export type ErrorCodes = 'user-abort' | 'h5p-not-found';

export default class LumiError {
constructor(
code: ErrorCodes,
message: string,
status: number = 500,
error?: Error
) {
this.code = code;
this.message = message;
this.status = status;
this.error = new Error(message);
}

public code: ErrorCodes;
public error: Error;
public message: string;
public status: number;
}
6 changes: 3 additions & 3 deletions client/src/state/H5PEditor/H5PEditorActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,21 +461,21 @@ export function save(
Sentry.captureException(error);
}

dispatch({
return dispatch({
// tslint:disable-next-line: object-shorthand-properties-first
payload: { id: data.contentId, ...response.body },
type: H5PEDITOR_SAVE_SUCCESS
});
} catch (error) {
if (error.status === 499) {
dispatch({
return dispatch({
payload: {},
type: H5PEDITOR_SAVE_CANCEL
});
} else {
Sentry.captureException(error);

dispatch({
return dispatch({
error,
payload: { path },
type: H5PEDITOR_SAVE_ERROR
Expand Down
31 changes: 30 additions & 1 deletion client/src/state/Notifications/NotificationsActions.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import {
CLOSE_SNACKBAR,
ENQUEUE_SNACKBAR,
IShowErrorDialog,
NotificationActionTypes,
NotificationTypes,
REMOVE_SNACKBAR
REMOVE_SNACKBAR,
SHOW_ERROR_DIALOG,
ErrorTypes,
ICloseErrorDialog,
CLOSE_ERROR_DIALOG
} from './NotificationsTypes';

import shortid from 'shortid';
Expand All @@ -24,6 +29,30 @@ export function notify(
};
}

export function showErrorDialog(
code: ErrorTypes,
message: string,
redirect?: string
): IShowErrorDialog {
return {
payload: {
error: {
code,
message,
redirect
}
},
type: SHOW_ERROR_DIALOG
};
}

export function closeErrorDialog(): ICloseErrorDialog {
return {
payload: {},
type: CLOSE_ERROR_DIALOG
};
}

export function closeSnackbar(key: string): NotificationActionTypes {
return {
key,
Expand Down
33 changes: 31 additions & 2 deletions client/src/state/Notifications/NotificationsReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import {
REMOVE_SNACKBAR,
INotifyAction,
ICloseSnackbar,
IRemoveSnackbar
IRemoveSnackbar,
SHOW_ERROR_DIALOG,
IShowErrorDialog,
ICloseErrorDialog,
CLOSE_ERROR_DIALOG
} from './NotificationsTypes';

import {
Expand Down Expand Up @@ -36,7 +40,12 @@ import i18next from 'i18next';
import shortid from 'shortid';

export const initialState: INotificationsState = {
notifications: []
notifications: [],
showErrorDialog: false,
error: {
code: 'init',
message: ''
}
};

export default function notificationsReducer(
Expand All @@ -53,9 +62,29 @@ export default function notificationsReducer(
| IH5PImportErrorAction
| IAnalyticsImportSuccessAction
| IAnalyticsImportErrorAction
| IShowErrorDialog
| ICloseErrorDialog
): INotificationsState {
try {
switch (action.type) {
case SHOW_ERROR_DIALOG:
return {
...state,
showErrorDialog: true,
error: action.payload.error
};

case CLOSE_ERROR_DIALOG:
return {
...state,
error: {
code: 'init',
message: '',
redirect: undefined
},
showErrorDialog: false
};

case ANALYTICS_IMPORT_ERROR:
return {
...state,
Expand Down
Loading

0 comments on commit e9fa47f

Please sign in to comment.