Skip to content

Commit

Permalink
Merge pull request #2759 from DenverCoder544/publisher_sidebar_reacti…
Browse files Browse the repository at this point in the history
…fication

Publisher sidebar reactification
  • Loading branch information
ZakarFin authored Dec 19, 2024
2 parents feeb464 + 77ff4f5 commit 2a53cee
Show file tree
Hide file tree
Showing 26 changed files with 1,076 additions and 1,264 deletions.
96 changes: 96 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL Advanced"

on:
push:
branches: [ "master", "develop" ]
paths-ignore:
- 'tests/jest/fileTransformer.js'
pull_request:
branches: [ "master", "develop" ]
paths-ignore:
- 'tests/jest/fileTransformer.js'
schedule:
- cron: '36 8 * * 0'

jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
permissions:
# required for all workflows
security-events: write

# required to fetch internal or private CodeQL packs
packages: read

# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
include:
- language: javascript-typescript
build-mode: none
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
11 changes: 11 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Release Notes

## 2.14.1

For a full list of changes see:
https://github.com/oskariorg/oskari-frontend/milestone/52?closed=1

Fixed an issue where layers with URL templates couldn't be added with the admin UI.

Removed postinstall script that did not work properly when dev-mode was not used. It was replaced with a Babel-plugin that can handle Cesium quirks.

Updated dompurify 2.3.6 -> 2.5.8

## 2.14.0

For a full list of changes see:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ export const cleanUrl = (url) => {
keysToDelete.forEach((key) => urlObj.searchParams.delete(key));

const parts = urlObj.toString().split('://');
if (parts.length > 1) {
return parts[1];
}

return urlObj.toString();
const retValString = parts.length > 1 ? parts[1] : urlObj.toString();
const decoded = decodeURIComponent(retValString);
return decoded;
};
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,13 @@ describe('ServiceUrlInputHelper Tests ', () => {
const url = 'www.com/';
expect(cleanUrl(url)).toBe(url);
});

it('should NOT encode URL params', () => {
const url = 'avoin-karttakuva.maanmittauslaitos.fi/kiinteisto-avoin/tiles/wmts/1.0.0/kiinteistojaotus/default/v3/ETRS-TM35FIN/{z}/{y}/{x}.pbf';
expect(cleanUrl(url)).toBe(url);

const url2 = 'www.com/?first=1&SECOND=2&thiRd=3';
expect(cleanUrl(url2)).toBe(url2);
});
});
});
2 changes: 1 addition & 1 deletion bundles/catalogue/metadata/resources/locale/sv.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Oskari.registerLocalization({
"basic": "Grundläggande information",
"inspire": "Inspire metadata",
"jhs": "ISO 19115 metadata",
"quality": "Data kvalität",
"quality": "Datakvalitet",
"actions": "Handlingar"
},
"actions": {
Expand Down
2 changes: 1 addition & 1 deletion bundles/catalogue/metadataflyout/resources/locale/sv.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Oskari.registerLocalization({
"abstract": "Grundläggande information",
"inspire": "Inspire metadata",
"jhs": "ISO 19115 metadata",
"quality": "Data kvalität",
"quality": "Datakvalitet",
"actions": "Handlingar",
"xml": "ISO 19139 XML fil",
"coverage": {
Expand Down
89 changes: 89 additions & 0 deletions bundles/framework/publisher2/handler/PanelGeneralInfoHandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import { StateHandler, controllerMixin } from 'oskari-ui/util';
import { PUBLISHER_BUNDLE_ID } from '../view/PublisherSideBarHandler';

class UIHandler extends StateHandler {
constructor () {
super();
this.state = {
name: null,
domain: null,
language: null
};
}

init (data) {
const { name, domain, language } = data?.metadata || {};
this.updateState({
name: name || null,
domain: domain || null,
language: language || Oskari.getLang()
});
}

getValues () {
return {
metadata: {
...this.getState()
}
};
};

onChange (key, value) {
const { oldState } = this.getState();
const newState = {
...oldState
};
newState[key] = value;
this.updateState({
...newState
});
}

validate () {
let errors = [];
const { name, domain } = this.state;
errors = errors.concat(this.validateName(name));
errors = errors.concat(this.validateDomain(domain));
return errors;
}

validateName (value) {
const errors = [];
const sanitizedValue = Oskari.util.sanitize(value);
if (!value || !value.trim().length) {
errors.push({
field: name,
error: Oskari.getMsg(PUBLISHER_BUNDLE_ID, 'BasicView.error.name')
});
return errors;
}
if (sanitizedValue !== value) {
errors.push({
field: name,
error: Oskari.getMsg(PUBLISHER_BUNDLE_ID, 'BasicView.error.nameIllegalCharacters')
});
return errors;
}
return errors;
}

validateDomain (name, value) {
const errors = [];
if (value && value.indexOf('://') !== -1) {
errors.push({
field: name,
error: Oskari.getMsg(PUBLISHER_BUNDLE_ID, 'BasicView.error.domainStart')
});
return errors;
}
return errors;
}
}

const wrapped = controllerMixin(UIHandler, [
'validate',
'getValues',
'onChange'
]);

export { wrapped as PanelGeneralInfoHandler };
Loading

0 comments on commit 2a53cee

Please sign in to comment.