Skip to content

Commit

Permalink
Merge pull request #139 from ride90/0.x
Browse files Browse the repository at this point in the history
v0.6.2
  • Loading branch information
ride90 authored Feb 12, 2020
2 parents 2501b27 + 3c93ad1 commit 6a5f13a
Show file tree
Hide file tree
Showing 38 changed files with 3,256 additions and 418 deletions.
11 changes: 6 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,39 @@ language: python

python: "3.5"

sudo: false
dist: trusty

services:
- mongodb
- elasticsearch
- redis-server

addons:
apt:
sources:
- mongodb-3.0-precise
- elasticsearch-2.x
packages:
- mongodb-org-server
- elasticsearch

cache:
directories:
- $HOME/.cache/pip
- $HOME/.npm

before_install:
- sudo apt-get purge elasticsearch
- sudo apt-get install -t stable elasticsearch
- nvm install 6.10
- nvm use 6.10
- node --version
- npm install -g npm@3
- npm install -g grunt-cli
- sudo systemctl start elasticsearch

install:
- cd server && pip install -r dev-requirements.txt && cd ..
- cd client && npm install && cd ..

script:
- cd server && flake8 && cd ..
- cd server && flake8 && nosetests && cd ..
- cd client && node --max_old_space_size=4098 ./node_modules/.bin/grunt build && cd ..
- cd server && python manage.py users:create -u test -p test -e test@localhost --admin && cd ..
4 changes: 3 additions & 1 deletion client/belga/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import angular from 'angular';
import {IUser} from 'superdesk-api'
import {IUser} from 'superdesk-api';
import {startApp} from 'superdesk-core/scripts/index';
import belgaImage from './image';
import belga360Archive from './360archive';
Expand All @@ -9,6 +9,7 @@ import markForUserExtension from 'superdesk-core/scripts/extensions/markForUser/
import datetimeFieldExtension from 'superdesk-core/scripts/extensions/datetimeField/dist/src/extension';
import belgaCoverageExtension from '../extensions/belgaCoverage/dist/index';
import updateArticleOnProfileChangeExtension from '../extensions/updateArticleOnProfileChange/dist/src/extension';
import iptcExtension from '../extensions/iptc/dist/extension'

class UserAvatar extends React.Component<{user: IUser}> {
render() {
Expand All @@ -29,6 +30,7 @@ setTimeout(() => {
datetimeFieldExtension,
belgaCoverageExtension,
updateArticleOnProfileChangeExtension,
iptcExtension,
],{UserAvatar});
});

Expand Down
4 changes: 2 additions & 2 deletions client/extensions/belgaCoverage/package-lock.json

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

1 change: 1 addition & 0 deletions client/extensions/iptc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
14 changes: 14 additions & 0 deletions client/extensions/iptc/package-lock.json

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

13 changes: 13 additions & 0 deletions client/extensions/iptc/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"private": true,
"main": "dist/extension.js",
"name": "iptc",
"version": "1.0.0",
"scripts": {
"compile": "tsc",
"watch": "tsc -watch"
},
"devDependencies": {
"typescript": "3.7.2"
}
}
58 changes: 58 additions & 0 deletions client/extensions/iptc/src/extension.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import {IExtension, IExtensionActivationResult, ISuperdesk, IArticle, ISubject} from 'superdesk-api';

type Scheme = 'media-credit' | 'belga-keywords' | 'country';

const CVS: Array<Scheme> = ['media-credit', 'belga-keywords', 'country'];

const DEFAULT_SUBJECT = {
'media-credit': ['BELGA_ON_THE_SPOT'],
'belga-keywords': ['RUSHES', 'BELGAILLUSTRATION', 'BELGAINTERVIEW', 'BELGAINSERT'],
'country': ['COUNTRY_BEL'],
};

const extension: IExtension = {
id: 'iptc',
activate: (superdesk: ISuperdesk) => {
const result: IExtensionActivationResult = {
contributions: {
iptcMapping: (data, item: IArticle) => Promise.all<Array<ISubject>>(
CVS.map((id) => superdesk.entities.vocabulary.getVocabulary(id)),
).then((cvItems) => {
const subject: Array<ISubject> = [];
const items = {
'media-credit': cvItems[0],
'belga-keywords': cvItems[1],
'country': cvItems[2],
};

for (let scheme of CVS) {
items[scheme]
.filter((subj) => DEFAULT_SUBJECT[scheme].includes(subj.qcode.toUpperCase()))
.forEach((subj) => {
subject.push({
name: subj.name,
qcode: subj.qcode,
scheme: scheme,
translations: subj.translations,
});
});
}

Object.assign(item, {
source: 'Belga',
subject: subject,
extra: {
city: data.City || 'Brussels',
},
});

return item;
}),
},
};

return Promise.resolve(result);
},
};

export default extension;
1 change: 1 addition & 0 deletions client/extensions/iptc/src/typings/refs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference path='../../../../node_modules/superdesk-core/scripts/core/superdesk-api.d.ts' />
28 changes: 28 additions & 0 deletions client/extensions/iptc/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"compilerOptions": {
"outDir": "dist",
"module": "commonjs",
"target": "es6",
"lib": [
"dom",
"es2017"
],
"skipLibCheck": true,
"jsx": "react",

"strict": true,
"alwaysStrict": true,
"strictBindCallApply": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"strictNullChecks": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,

"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true
}
}
4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
},
"dependencies": {
"superdesk-analytics": "github:tomaskikutis/superdesk-analytics#next",
"superdesk-core": "github:superdesk/superdesk-client-core#2915ba304",
"superdesk-core": "github:superdesk/superdesk-client-core#67d8fc6",
"superdesk-planning-extension": "1.0.1",
"superdesk-planning": "github:tomaskikutis/superdesk-planning#move-planning-extension-from-core"
}
}
}
Loading

0 comments on commit 6a5f13a

Please sign in to comment.