Skip to content

Commit d966718

Browse files
authored
Merge branch 'master' into 8816-fix-couchdb-admin-search
2 parents 0c76d2f + afcfb72 commit d966718

153 files changed

Lines changed: 13492 additions & 1193 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ jobs:
242242
strategy:
243243
fail-fast: false
244244
matrix:
245-
cmd: ['ci-integration-all', 'ci-integration-sentinel', 'ci-webdriver-default-mobile']
245+
cmd: ['ci-integration-all', 'ci-integration-sentinel', 'ci-webdriver-default-mobile', 'wdio-performance']
246246
chrome-version: ['107', 'latest']
247247
suite: [all]
248248
include:
@@ -271,6 +271,8 @@ jobs:
271271
chrome-version: 107
272272
- cmd: ci-webdriver-default-mobile
273273
chrome-version: 107
274+
- cmd: wdio-performance
275+
chrome-version: 107
274276
steps:
275277
- name: Login to Docker Hub
276278
uses: docker/login-action@v3

admin/package-lock.json

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

admin/src/js/controllers/edit-language.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const _ = require('lodash/core');
22
const constants = require('@medic/constants');
33
const DOC_TYPES = constants.DOC_TYPES;
4+
const PREFIXES = constants.PREFIXES;
45

56
angular.module('controllers').controller('EditLanguageCtrl',
67
function (
@@ -43,7 +44,7 @@ angular.module('controllers').controller('EditLanguageCtrl',
4344
if (!$scope.errors) {
4445
$scope.setProcessing();
4546
if (!$scope.language._id) {
46-
$scope.language._id = 'messages-' + $scope.language.code;
47+
$scope.language._id = PREFIXES.TRANSLATIONS + $scope.language.code;
4748
}
4849
DB().put($scope.language)
4950
.then(function() {

admin/src/js/controllers/edit-user.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ const moment = require('moment');
22
const passwordTester = require('simple-password-tester');
33
const phoneNumber = require('@medic/phone-number');
44
const CHT = require('@medic/cht-datasource');
5+
const constants = require('@medic/constants');
6+
const USER_ROLES = constants.USER_ROLES;
57
const PASSWORD_MINIMUM_LENGTH = 8;
68
const PASSWORD_MINIMUM_SCORE = 50;
79
const SHOW_PASSWORD_ICON = '/login/images/show-password.svg';
810
const HIDE_PASSWORD_ICON = '/login/images/hide-password.svg';
911
const USERNAME_ALLOWED_CHARS = /^[a-z0-9_-]+$/;
10-
const ADMIN_ROLE = '_admin';
12+
const ADMIN_ROLE = USER_ROLES.COUCHDB_ADMIN;
1113
const FIELDS_TO_IGNORE = [
1214
'currentPassword',
1315
'passwordConfirm',

admin/src/js/controllers/images-branding.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
const constants = require('@medic/constants');
2+
const DOC_IDS = constants.DOC_IDS;
3+
14
angular.module('controllers').controller('ImagesBrandingCtrl',
25
function(
36
$log,
@@ -11,7 +14,7 @@ angular.module('controllers').controller('ImagesBrandingCtrl',
1114
'ngInject';
1215
'use strict';
1316

14-
const DOC_ID = 'branding';
17+
const DOC_ID = DOC_IDS.BRANDING;
1518
const MAX_FILE_SIZE = 100000; // 100KB
1619

1720
$('#images-branding .choose').on('click', ev => {

admin/src/js/filters/resource-icon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ angular.module('inboxFilters').filter('headerLogo',
2121
'use strict';
2222
'ngInject';
2323
return function(name) {
24-
return $sce.trustAsHtml(ResourceIcons.getImg(name, 'branding'));
24+
return $sce.trustAsHtml(ResourceIcons.getImg(name, DOC_IDS.BRANDING));
2525
};
2626
});
2727

admin/src/js/services/languages.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
/*
22
* Get all enabled languages
33
*/
4+
const constants = require('@medic/constants');
5+
const PREFIXES = constants.PREFIXES;
6+
47
angular.module('inboxServices').factory('Languages',
58
function(
69
DB
@@ -9,7 +12,7 @@ angular.module('inboxServices').factory('Languages',
912
'ngInject';
1013
return function() {
1114
return DB()
12-
.allDocs({ start_key: 'messages-', end_key: 'messages-\ufff0', include_docs: true })
15+
.allDocs({ start_key: PREFIXES.TRANSLATIONS, end_key: PREFIXES.TRANSLATIONS + '\ufff0', include_docs: true })
1316
.then(function(result) {
1417
return result.rows.map(row => ({ code: row.doc.code, name: row.doc.name }));
1518
});

admin/src/js/services/resource-icons.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ angular.module('inboxServices').factory('ResourceIcons',
1212
'ngInject';
1313

1414
const CSS_CLASS = ['resource-icon', 'header-logo', 'partner-image'];
15-
const ICON_DOC_IDS = [DOC_IDS.RESOURCES, 'branding', DOC_IDS.PARTNERS];
15+
const ICON_DOC_IDS = [DOC_IDS.RESOURCES, DOC_IDS.BRANDING, DOC_IDS.PARTNERS];
1616

1717
const cache = {
1818
resources: {

admin/src/js/services/session.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
const _ = require('lodash/core');
22
const constants = require('@medic/constants');
3+
const USER_ROLES = constants.USER_ROLES;
34
const COOKIE_NAME = 'userCtx';
4-
const ONLINE_ROLE = constants.USER_ROLES.ONLINE;
5+
const ONLINE_ROLE = USER_ROLES.ONLINE;
56

67
(function () {
78

@@ -96,7 +97,7 @@ const ONLINE_ROLE = constants.USER_ROLES.ONLINE;
9697

9798
const isAdmin = function(userCtx) {
9899
userCtx = userCtx || getUserCtx();
99-
return hasRole(userCtx, '_admin');
100+
return hasRole(userCtx, USER_ROLES.COUCHDB_ADMIN);
100101
};
101102

102103
return {

admin/src/js/services/translation-loader.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
const translationUtils = require('@medic/translation-utils');
22

33
const DEFAULT_LOCALE = 'en';
4-
const DOC_ID_PREFIX = 'messages-';
4+
const constants = require('@medic/constants');
5+
const PREFIXES = constants.PREFIXES;
6+
const DOC_ID_PREFIX = PREFIXES.TRANSLATIONS;
57

68
angular.module('inboxServices').factory('TranslationLoader',
79
function(

0 commit comments

Comments
 (0)