Skip to content

Commit

Permalink
mgr/dashboard: About modal proposed changes
Browse files Browse the repository at this point in the history
Fixes: http://tracker.ceph.com/issues/35693
Signed-off-by: Kanika Murarka <kmurarka@redhat.com>
  • Loading branch information
Kanika Murarka committed Jan 16, 2019
1 parent 38a99f0 commit 175b83c
Show file tree
Hide file tree
Showing 13 changed files with 414 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@ GTAGS

.idea

# dashboard
/src/pybind/mgr/dashboard/frontend/src/environments/environment.ts
/src/pybind/mgr/dashboard/frontend/src/environments/environment.prod.ts
6 changes: 6 additions & 0 deletions src/pybind/mgr/dashboard/controllers/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ def _task_permissions(self, name):
result = self._has_permissions(Permission.DELETE, Scope.RBD_IMAGE)
return result

def _get_host(self):
mgr_map = mgr.get('mgr_map')
services = mgr_map['services']
return services['dashboard']

@Endpoint()
def __call__(self):
exe_t, fin_t = TaskManager.list_serializable()
Expand All @@ -72,6 +77,7 @@ def __call__(self):
result = {
'health_status': self._health_status(),
'mgr_id': mgr.get_mgr_id(),
'mgr_host': self._get_host(),
'have_mon_connection': mgr.have_mon_connection(),
'executing_tasks': executing_tasks,
'finished_tasks': finished_tasks,
Expand Down
63 changes: 63 additions & 0 deletions src/pybind/mgr/dashboard/frontend/environment.build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
var replace = require('replace-in-file');
var buildDate = new Date();
var copyrightYear = buildDate.getFullYear();
const optionsNewYear = {
files:[
'src/environments/environment.ts',
'src/environments/environment.prod.ts'
],
from: /{COPYRIGHT_YEAR}/g,
to: copyrightYear,
allowEmptyPaths: false,
};

const optionsOldYear = {
files:[
'src/environments/environment.ts',
'src/environments/environment.prod.ts'
],
from: /year: '(.*)'/g,
to: "year: '{COPYRIGHT_YEAR}'",
allowEmptyPaths: false,
};

const optionsNewProd = {
files:[
'src/environments/environment.prod.ts'
],
from: /'{PRODUCTION}'/g,
to: true,
allowEmptyPaths: false,
};

const optionsNewDev = {
files:[
'src/environments/environment.ts'
],
from: /'{PRODUCTION}'/g,
to: false,
allowEmptyPaths: false,
};

const optionsOldProd = {
files:[
'src/environments/environment.prod.ts',
'src/environments/environment.ts'
],
from: /production: (.*)/g,
to: "production: '{PRODUCTION}',",
allowEmptyPaths: false,
};

try {
let changeOldYearFiles = replace.sync(optionsOldYear);
let changeNewYearFiles = replace.sync(optionsNewYear);
let changeOldProdFiles = replace.sync(optionsOldProd);
let changeProdFiles = replace.sync(optionsNewProd);
let changeDevFiles = replace.sync(optionsNewDev);
console.log('Environement variables has been set');
}
catch (error) {
console.error('Error occurred:', error);
throw error
}
221 changes: 221 additions & 0 deletions src/pybind/mgr/dashboard/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/pybind/mgr/dashboard/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve --host 0.0.0.0",
"build": "ng build",
"start": "npm run env_build && ng serve --host 0.0.0.0",
"build": "npm run env_build && ng build",
"env_build": "cp src/environments/environment.tpl.ts src/environments/environment.prod.ts && cp src/environments/environment.tpl.ts src/environments/environment.ts && node ./environment.build.js",
"i18n": "ng xi18n --i18n-format xlf --i18n-locale en-US --output-path locale --progress=false && ngx-extractor -i 'src/**/*.ts' -f xlf -o src/locale/messages.xlf -l en-US",
"test": "jest --watch",
"test:ci": "JEST_SILENT_REPORTER_DOTS=true jest --coverage --reporters jest-silent-reporter",
Expand Down Expand Up @@ -59,6 +60,7 @@
"bootstrap": "3.4.0",
"chart.js": "2.7.3",
"core-js": "2.6.1",
"detect-browser": "^3.0.1",
"fork-awesome": "1.1.5",
"lodash": "4.17.11",
"moment": "2.23.0",
Expand Down Expand Up @@ -92,6 +94,7 @@
"jest-silent-reporter": "0.1.1",
"prettier": "1.14.3",
"protractor": "5.4.2",
"replace-in-file": "^3.4.2",
"ts-node": "7.0.1",
"tslint": "5.12.0",
"typescript": "3.2.2"
Expand Down
Loading

0 comments on commit 175b83c

Please sign in to comment.