diff --git a/package.json b/package.json
index 3ef072d3..2da950a5 100644
--- a/package.json
+++ b/package.json
@@ -39,14 +39,17 @@
"c3": "^0.4.11",
"codemirror": "^5.25.0",
"d3": "^4.7.4",
+ "dotenv": "^8.1.0",
"jquery": "^3.2.1",
"ng-file-upload": "^12.2.13",
"ng-toast": "^2.0.0",
+ "ngbootbox": "^0.2.0",
"node-sass": "^4.12.0",
"oclazyload": "^1.1.0",
"sass-loader": "^7.3.1",
"spectrum-colorpicker": "^1.8.0",
- "ui-select": "^0.19.6"
+ "ui-select": "^0.19.6",
+ "webpack-dotenv-plugin": "^2.1.0"
},
"devDependencies": {
"angular-mocks": "^1.5.0",
diff --git a/webpack.config.js b/webpack.config.js
index 4ca58c38..d9fe84a1 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -13,9 +13,15 @@ const WebpackChunkHash = require("webpack-chunk-hash");
const InlineManifestWebpackPlugin = require("inline-manifest-webpack-plugin");
const InlineChunksManifestPlugin = require('./inline-chunks-manifest');
+const dotenv = require('dotenv').config({
+ path: __dirname + '/.env'
+});
+const DotenvPlugin = require('webpack-dotenv-plugin');
+
const path = require('path');
process.traceDeprecation = true;
+process.noDeprecation = true;
/**
* Env
@@ -69,7 +75,8 @@ module.exports = function makeWebpackConfig() {
'ng-toast',
'angular-translate',
- 'angular-translate-loader-partial'
+ 'angular-translate-loader-partial',
+ 'ngbootbox'
]
};
/**
@@ -241,6 +248,18 @@ module.exports = function makeWebpackConfig() {
* List: http://webpack.github.io/docs/list-of-plugins.html
*/
config.plugins = [
+
+ /**
+ * Dotenv
+ * Reference: https://github.com/nwinch/webpack-dotenv-plugin
+ * Add dotenv support
+ */
+ new DotenvPlugin({
+ path: '.env',
+ sample: '.env.example',
+ allowEmptyValues: true,
+ }),
+
/**
* Angular annotate
* Reference: https://github.com/jeffling/ng-annotate-webpack-plugin
From ae111a826a57a945f175b5cabf7d63c05a6fe630 Mon Sep 17 00:00:00 2001
From: Sergey Safronov
Date: Fri, 30 Aug 2019 22:40:12 +0300
Subject: [PATCH 2/8] Fix multiple view
---
.env | 2 +-
app/scripts/components/webUI/manage/webUIManage.controller.js | 2 +-
app/scripts/components/webUI/select/webUISelect.controller.js | 2 ++
app/scripts/components/webUI/select/webUISelect.html | 2 +-
4 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/.env b/.env
index 89191b8a..e4a708c0 100644
--- a/.env
+++ b/.env
@@ -1 +1 @@
-WEBUI_MULTIPLE=true
\ No newline at end of file
+WEBUI_MULTIPLE=false
\ No newline at end of file
diff --git a/app/scripts/components/webUI/manage/webUIManage.controller.js b/app/scripts/components/webUI/manage/webUIManage.controller.js
index dc01e29b..7c890107 100644
--- a/app/scripts/components/webUI/manage/webUIManage.controller.js
+++ b/app/scripts/components/webUI/manage/webUIManage.controller.js
@@ -16,7 +16,7 @@ class WebUIManageController {
this.current = webUIService.current;
this.editable = null;
- this.isMultiple = process.env.WEBUI_MULTIPLE;
+ this.isMultiple = process.env.WEBUI_MULTIPLE === 'true';
if (!this.isMultiple) {
this.editable = this.current;
}
diff --git a/app/scripts/components/webUI/select/webUISelect.controller.js b/app/scripts/components/webUI/select/webUISelect.controller.js
index 7e05123c..f48aa736 100644
--- a/app/scripts/components/webUI/select/webUISelect.controller.js
+++ b/app/scripts/components/webUI/select/webUISelect.controller.js
@@ -13,6 +13,8 @@ class AccountSelectController {
this.accounts = webUIService.accounts;
this.current = webUIService.current;
+ this.isMultiple = process.env.WEBUI_MULTIPLE === 'true';
+
$scope.$watch('$ctrl.current', (newValue, oldValue) => {
if (newValue !== oldValue) {
this.login(newValue);
diff --git a/app/scripts/components/webUI/select/webUISelect.html b/app/scripts/components/webUI/select/webUISelect.html
index 76d1adb7..2797d4b7 100644
--- a/app/scripts/components/webUI/select/webUISelect.html
+++ b/app/scripts/components/webUI/select/webUISelect.html
@@ -1,4 +1,4 @@
-
+
{{ $select.selected.name }}
From 1fef519ded12d383b7bc7981eeec81dad9c93487 Mon Sep 17 00:00:00 2001
From: Sergey Safronov
Date: Sun, 1 Sep 2019 22:41:38 +0300
Subject: [PATCH 3/8] Fix webpack, copy i18n
---
webpack.config.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/webpack.config.js b/webpack.config.js
index d9fe84a1..aaa988eb 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -372,6 +372,7 @@ module.exports = function makeWebpackConfig() {
// Reference: https://github.com/kevlened/copy-webpack-plugin
new CopyWebpackPlugin([
{from: path.join(__dirname, 'app', 'images'), to: 'images'},
+ {from: path.join(__dirname, 'app', 'scripts/i18n'), to: 'scripts/i18n'},
{from: path.join(__dirname, 'app', '404.html'), to: '404.html'},
{from: path.join(__dirname, 'app', 'favicon.ico'), to: 'favicon.ico'},
{from: path.join(__dirname, 'app', 'robots.txt'), to: 'robots.txt'}
From 4ef24b646e462f6ddfc2d02c5c569111d0a6c2fe Mon Sep 17 00:00:00 2001
From: Sergey Safronov
Date: Mon, 2 Sep 2019 20:13:16 +0300
Subject: [PATCH 4/8] Add button in select account component Change name
account to not required option
---
app/scripts/app.routes.js | 7 +++++
.../webUI/manage/webUIManage.controller.js | 12 +++++++--
.../components/webUI/manage/webUIManage.html | 4 +--
.../webUI/select/webUISelect.controller.js | 27 +++++++++++++++++--
.../components/webUI/select/webUISelect.html | 6 ++---
.../webUI/services/webUI.service.js | 8 ++++--
app/scripts/components/webUI/webUI.scss | 12 ++++++++-
app/scripts/i18n/webUI/ru.json | 8 ++++++
8 files changed, 72 insertions(+), 12 deletions(-)
diff --git a/app/scripts/app.routes.js b/app/scripts/app.routes.js
index 104aa79c..29859bc0 100644
--- a/app/scripts/app.routes.js
+++ b/app/scripts/app.routes.js
@@ -1,3 +1,5 @@
+'use strict';
+
import uiRouter from 'angular-ui-router';
import homeTemplateUrl from 'ngtemplate-loader?relativeTo=/app!../views/home.html';
@@ -43,6 +45,11 @@ function routing($stateProvider, $locationProvider, $urlRouterProvider) {
templateUrl: webUITemplateUrl,
controller: 'WebUICtrl as $ctrl'
})
+ .state('webUIAdd', {
+ url: '/web-ui/add',
+ templateUrl: webUITemplateUrl,
+ controller: 'WebUICtrl as $ctrl'
+ })
.state('system', {
url: '/system',
templateUrl: systemTemplateUrl,
diff --git a/app/scripts/components/webUI/manage/webUIManage.controller.js b/app/scripts/components/webUI/manage/webUIManage.controller.js
index 7c890107..5d1c46b5 100644
--- a/app/scripts/components/webUI/manage/webUIManage.controller.js
+++ b/app/scripts/components/webUI/manage/webUIManage.controller.js
@@ -2,11 +2,12 @@
class WebUIManageController {
- constructor ($scope, $window, $translate, $ngBootbox, rolesFactory, webUIService) {
+ constructor ($scope, $window, $state, $translate, $ngBootbox, rolesFactory, webUIService) {
'ngInject';
this.$scope = $scope;
this.$window = $window;
+ this.$state = $state;
this.$translate = $translate;
this.$ngBootbox = $ngBootbox;
this.rolesFactory = rolesFactory;
@@ -20,6 +21,9 @@ class WebUIManageController {
if (!this.isMultiple) {
this.editable = this.current;
}
+ else if ($state.current.name === 'webUIAdd') {
+ this.create();
+ }
$scope.$watch('$ctrl.service.getCurrent()', (newValue, oldValue) => {
if (newValue !== oldValue) {
@@ -52,12 +56,16 @@ class WebUIManageController {
}
if (this.isMultiple) {
- this.editable = false;
+ this.cancel();
}
}
cancel() {
this.editable = null;
+
+ if (this.$state.current.name === 'webUIAdd') {
+ this.$state.go('webUI');
+ }
}
login(account) {
diff --git a/app/scripts/components/webUI/manage/webUIManage.html b/app/scripts/components/webUI/manage/webUIManage.html
index 18674b13..3fcc005a 100644
--- a/app/scripts/components/webUI/manage/webUIManage.html
+++ b/app/scripts/components/webUI/manage/webUIManage.html
@@ -41,9 +41,9 @@