Skip to content

Commit

Permalink
Merge pull request #311 from smartdevicelink/develop
Browse files Browse the repository at this point in the history
sdl_server - Release 3.1.0
  • Loading branch information
RaedAlmomani authored Oct 26, 2022
2 parents 52dd3a3 + 76949f9 commit 3d66fd1
Show file tree
Hide file tree
Showing 10 changed files with 4,195 additions and 7,120 deletions.
19 changes: 11 additions & 8 deletions app/v1/messages/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function validatePost (req, res) {
return;
}
for (let i = 0; i < req.body.messages.length; i++) {
let foundEnUsObj = false;
const msg = req.body.messages[i];
if (!check.string(msg.message_category) || !check.boolean(msg.is_deleted) ) {
res.parcel
Expand All @@ -35,24 +36,26 @@ function validatePost (req, res) {
}
for (let j = 0; j < msg.languages.length; j++) {
const lang = msg.languages[j];
if (lang.language_id === 'en-us' && lang.selected === true) {
foundEnUsObj = true;
}
if (
!check.string(lang.language_id)
|| !check.boolean(lang.selected)
|| (
!check.string(lang.line1)
&& !check.string(lang.line2)
&& !check.string(lang.tts)
&& !check.string(lang.text_body)
&& !check.string(lang.label)
)
)
{
res.parcel
.setStatus(400)
.setMessage("Required for language: language_id, selected, and at least one of the following: line1, line2, tts, text_body, label");
.setMessage("Required for language: language_id, selected");
return;
}
}
if (!foundEnUsObj) {
res.parcel
.setStatus(400)
.setMessage("There must be a en-us language object defined");
return;
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3.9"
version: "2.1"
services:
server:
build:
Expand Down Expand Up @@ -36,4 +36,4 @@ services:
POSTGRES_USER: "${DB_USER:-postgres}"
POSTGRES_DB: "${DB_DATABASE:-postgres}"
volumes:
data:
data:
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ function start (overrideApp) {
}

//load up the html, js and css content that makes up the UI
app.use(express.static(__dirname + '/dist'));
// do not serve the compiled version of the code if we are running in dev mode
// we want hot reloading managed by the webpack dev server instead
if (process.env.RUN_STATE !== 'dev') {
app.use(express.static(__dirname + '/dist'));
}
//expose everything in the static folder
app.use(express.static(__dirname + '/static'));

Expand Down
11,239 changes: 4,143 additions & 7,096 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sdl_policy_server",
"version": "3.0.1",
"version": "3.1.0",
"license": "BSD-3-Clause",
"description": "Integrates with SHAID to allow managing app permissions through policy tables",
"author": "Livio",
Expand All @@ -27,7 +27,7 @@
"bootstrap": "4.5.2",
"bootstrap-vue": "2.17.3",
"check-types": "7.3.0",
"core-js": "^3.6.5",
"core-js": "^3.22.8",
"cors": "^2.8.5",
"cron": "1.3.0",
"db-migrate": "^0.11.10",
Expand All @@ -37,7 +37,7 @@
"helmet": "^3.15.1",
"jquery": "^3.4.1",
"lodash": "^4.17.21",
"moment": "^2.29.3",
"moment": "^2.29.4",
"mustache": "^3.0.1",
"nodemailer": "^6.6.1",
"pem": "^1.14.2",
Expand All @@ -53,25 +53,25 @@
"vue": "^2.6.11",
"vue-json-pretty": "1.3.5",
"vue-ladda": "0.0.13",
"vue-resource": "1.3.4",
"vue-resource": "1.5.3",
"vue-router": "2.7.0",
"vue-scrollto": "2.11.0",
"vue-session": "0.9.10",
"winston": "2.3.1",
"xml2js": "0.4.19"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/cli-plugin-babel": "5.0.4",
"@vue/cli-plugin-eslint": "5.0.4",
"@vue/cli-service": "5.0.4",
"babel-eslint": "^10.1.0",
"chai": "^4.2.0",
"chai-http": "^4.2.1",
"chai-json-schema": "^1.5.0",
"chalk": "2.0.1",
"connect-history-api-fallback": "1.3.0",
"cssnano": "^5.0.17",
"eslint": "^6.7.2",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^6.2.2",
"eventsource-polyfill": "0.9.6",
"express": "4.16.0",
Expand Down
5 changes: 5 additions & 0 deletions src/components/ConsumerMessageDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@
if (parsed.data.messages && parsed.data.messages.length) {
this.message = parsed.data.messages[0];
console.log(this.message);
// force en-us to exist in the webpage
if (this.message && this.message.languages) {
const lang = this.message.languages.find(element => element.language_id === 'en-us');
lang.selected = true;
}
} else {
console.log("No message data returned");
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/common/MessageItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
<div v-if="item.selected" class="white-box rpc-container">
<h5></h5>
<h5>{{ item.language_id }}
<!-- Do not allow en-us to be deletable. It is required by core -->
<i
v-on:click="removeLanguage()"
v-if="!fieldsDisabled"
v-if="!fieldsDisabled && item.language_id !== 'en-us'"
class="pointer pull-right fa fa-times hover-color-red"
aria-hidden="true">
</i>
Expand Down
12 changes: 10 additions & 2 deletions src/components/common/VehicleDataItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
<div class="form-group row">
<label class="col-sm-2 col-form-label">{{ propsDisplay[propName].display.toUpperCase() }}</label>
<div class="col-sm-10">
<input v-model="item[propName]" :disabled="fieldsDisabled || (level === 1 && item.id)" class="form-control">
<input v-model="item[propName]" :disabled="fieldsDisabled || (level === 1 && item.id)" class="form-control"
@input="updateNameOrKey(propName, $event.target.value)">
</div>
<p v-if="findCommonParams(item[propName]) === 'CUSTOM'">
<br>A parent or top level vehicle data item with this name already exists! By saving, you will overwrite the previously existing vehicle data.
Expand Down Expand Up @@ -55,7 +56,8 @@
<div class="form-group row">
<label class="col-sm-2 col-form-label">{{ propsDisplay[propName].display.toUpperCase() }}</label>
<div class="col-sm-10">
<input v-model="item[propName]" :disabled="fieldsDisabled" class="form-control">
<input v-model="item[propName]" :disabled="fieldsDisabled" class="form-control"
@input="updateNameOrKey(propName, $event.target.value)">
</div>
</div>
</template>
Expand Down Expand Up @@ -170,6 +172,12 @@
}
this.item[propName] = Math.max(0, Math.round(val));
},
updateNameOrKey: function (propName, val) {
// Checks for the invalid characters "!@#$%^&*", and whitespace characters that would be rejected by SDL Core
if (/[!@#$%^&*\s]/g.test(val)) {
return this.item[propName] = null;
}
},
updateIntegerNumber: function (propName, val) {
if (val === "-") {
return val;
Expand Down
6 changes: 5 additions & 1 deletion test/api/v1/messages/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ common.startTest('should create new message', async function () {
{
message_category: 'Blarg',
is_deleted: false,
languages: []
languages: [{
language_id: 'en-us',
selected: true,
line1: ''
}]
}
]
});
Expand Down
5 changes: 4 additions & 1 deletion vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ const app = require('./index.js');

module.exports = {
devServer: {
before: app,
setupMiddlewares: (middleware, server) => {
app(server.app);
return middleware;
},
port: settings.policyServerPort
}
}

0 comments on commit 3d66fd1

Please sign in to comment.