Skip to content

Commit a02b43b

Browse files
committed
Drastically improve bundle size
1 parent 2f048fb commit a02b43b

18 files changed

Lines changed: 241 additions & 105 deletions

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
FROM node:latest
1+
FROM node:lts
22
# FROM node:10.16.0-jessie
33
EXPOSE 80
44
EXPOSE 5858
55
WORKDIR /data
66
COPY docker-package.json ./package.json
77
RUN npm install
8+
# RUN npm install --force
89
COPY dist ./
910

1011
ENTRYPOINT ["/usr/local/bin/node", "--inspect=0.0.0.0:5858", "index.js"]

OpenFlow/src/DatabaseConnection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,8 +1122,8 @@ export class DatabaseConnection {
11221122
}
11231123
return q;
11241124
}
1125-
private async _DeleteFile(id: string): Promise<string> {
1126-
return new Promise<string>(async (resolve, reject) => {
1125+
private async _DeleteFile(id: string): Promise<void> {
1126+
return new Promise<void>(async (resolve, reject) => {
11271127
try {
11281128
const _id = new ObjectID(id);
11291129
const bucket = new GridFSBucket(this.db);

OpenFlow/src/public/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vendor

OpenFlow/src/public/CommonControllers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export class textarea implements ng.IDirective {
125125
async function getString(locale: any, lib: string, key: string): Promise<any> {
126126
return new Promise((resolve) => {
127127
try {
128-
if (locale === null || locale === undefined) { return resolve(); }
128+
if (locale === null || locale === undefined) { return }
129129
locale.ready(lib).then(function () {
130130
const value = locale.getString(lib + "." + key);
131131
if (value !== null && value !== undefined && value !== "") {

OpenFlow/src/public/Controllers.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,12 +746,12 @@ export class LoginCtrl {
746746
}
747747
function errorCallback(error) {
748748
console.debug(error);
749-
resolve();
749+
resolve(null);
750750
}
751751
});
752752
}
753753
writefile(filename: string, content: string) {
754-
return new Promise<string>(async (resolve, reject) => {
754+
return new Promise<void>(async (resolve, reject) => {
755755
const win: any = window;
756756
//const type = win.TEMPORARY;
757757
const type = win.PERSISTENT;
@@ -904,6 +904,13 @@ export class MenuCtrl {
904904
console.debug("MenuCtrl::constructor");
905905
$scope.$root.$on('$routeChangeStart', (...args) => { this.routeChangeStart.apply(this, args); });
906906
this.path = this.$location.path();
907+
// const navMain = $(".navbar-collapse"); // avoid dependency on #id
908+
// // "a:not([data-toggle])" - to avoid issues caused
909+
// // when you have dropdown inside navbar
910+
// navMain.on("click", "a:not([data-toggle])", null, function () {
911+
// (navMain as any).collapse('hide');
912+
// });
913+
907914
const cleanup = this.$scope.$on('signin', (event, data) => {
908915
if (event && data) { }
909916
this.user = data;
@@ -1583,6 +1590,8 @@ export class FormsCtrl extends entitiesCtrl<Base> {
15831590
});
15841591
}
15851592
}
1593+
const formBuilder = require('formBuilder');
1594+
const formRender = require('formBuilder/dist/form-render.min');
15861595
export class EditFormCtrl extends entityCtrl<Form> {
15871596
public message: string = "";
15881597
public charts: chartset[] = [];

OpenFlow/src/public/Payment.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
width: 350px;
44
}
55
</style>
6+
<!-- <script src="https://js.stripe.com/v3/"></script> -->
67

78
<!-- <section ng-show="ctrl.WebSocketClientService.stripe_api_key != ''" ng-show="ctrl.allowpayment">
89
<label for="card-element">Card</label>

OpenFlow/src/public/WebSocketClientService.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ export class WebSocketClientService {
3333
this.websocket_package_size = data.websocket_package_size;
3434
this.stripe_api_key = data.stripe_api_key;
3535

36+
if (this.stripe_api_key != null && this.stripe_api_key != "") {
37+
console.debug("loading stripe script")
38+
$.getScript("//js.stripe.com/v3/");
39+
}
40+
3641
if (WebSocketClient.instance == null) {
3742
const cli: WebSocketClient = new WebSocketClient(this.logger, wsurl);
3843
cli.agent = "webapp";

OpenFlow/src/public/angular-sanitize.min.js

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OpenFlow/src/public/app.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@import "node_modules/bootstrap/dist/css/bootstrap.min.css";
2+
@import "site.css";
3+
@import "openflow-font/styles.css";
4+
@import "node_modules/@fortawesome/fontawesome-free/css/all.css";
5+
@import "formio.full.min.css";

OpenFlow/src/public/app.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@ import angular = require("angular");
33
import { timesince, translate, textarea, fileread, userdata, api, copytext } from "./CommonControllers";
44
import { MenuCtrl, ProvidersCtrl, MainCtrl, LoginCtrl, ProviderCtrl, UsersCtrl, UserCtrl, RolesCtrl, RoleCtrl, RPAWorkflowsCtrl, RPAWorkflowCtrl, WorkflowsCtrl, ReportsCtrl, jslogCtrl, EditFormCtrl, FormsCtrl, FormCtrl, FilesCtrl, EntitiesCtrl, EntityCtrl, HistoryCtrl, SocketCtrl, NoderedCtrl, hdrobotsCtrl, RobotsCtrl, AuditlogsCtrl, SignupCtrl, PaymentCtrl, QueuesCtrl, SocketsCtrl, QueueCtrl, CredentialsCtrl, CredentialCtrl, DuplicatesCtrl, OAuthClientsCtrl, OAuthClientCtrl } from "./Controllers";
55

6+
require('bootstrap');
7+
require('angular-route');
8+
require('angular-sanitize');
9+
require('@fortawesome/fontawesome-free');
10+
require('chart.js');
11+
require('angular-chart.js');
12+
// require('./angular-localization.min');
13+
14+
require('./formio.full.min');
15+
16+
var css = require('./app.css');
17+
18+
// require('./angular-localization.min')
619
/**
720
* @type {angular.Module}
821
*/
@@ -12,6 +25,7 @@ module openflow {
1225
// ChartJsProvider.setOptions({ responsive: true });
1326
// ChartJsProvider.setOptions('Line', { responsive: true });
1427
// })
28+
//
1529
const webApp: any = angular.module("webApp", ['ngRoute', 'chart.js', 'ngLocalize', 'ngLocalize.Config'])
1630
.controller("MenuCtrl", MenuCtrl)
1731
.controller("Providers", ProvidersCtrl)

0 commit comments

Comments
 (0)