Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@camomile/camomile-ui

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@camomile/camomile-ui - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

bundle.css

12

build/rollup.config.dist.js

@@ -27,8 +27,6 @@ import resolve from 'rollup-plugin-node-resolve'

vue({
compileTemplate: true,
css: '../dist/styles.css'
compileTemplate: true
}),
postcss({
plugins: postcssPlugins,
extract: '../dist/styles.css'
extract: true
}),

@@ -49,8 +47,6 @@ buble({

vue({
compileTemplate: true,
css: 'dist/styles.css'
compileTemplate: true
}),
postcss({
plugins: postcssPlugins,
extract: 'dist/styles.css'
extract: true
}),

@@ -57,0 +53,0 @@ buble({

@@ -0,1 +1,3 @@

const path = require('path')
module.exports = {

@@ -25,3 +27,4 @@ module: {

alias: {
vue$: 'vue/dist/vue.esm.js'
vue$: 'vue/dist/vue.esm.js',
'~': path.resolve(__dirname, '../src/')
}

@@ -28,0 +31,0 @@ },

@@ -7,3 +7,3 @@ const path = require('path')

module.exports = merge(webpackConfigBase, {
const webpackConfigDev = {
devtool: 'cheap-module-eval-source-map',

@@ -58,2 +58,4 @@ entry: [

]
})
}
module.exports = merge(webpackConfigBase, webpackConfigDev)

@@ -9,9 +9,8 @@ const path = require('path')

const MinifyPlugin = require('babel-minify-webpack-plugin')
const WebpackMonitor = require('webpack-monitor')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
.BundleAnalyzerPlugin
// const WebpackMonitor = require('webpack-monitor')
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const npmPackage = require('../package.json')
const date = new Date().toISOString().slice(0, 10)
module.exports = merge(webpackConfigBase, {
const webpackConfigDist = {
devtool: false,

@@ -67,13 +66,2 @@ entry: {

new webpack.ExtendedAPIPlugin(),
new MinifyPlugin(
{
mangle: {
keepFnName: true, // should be false, but creates an error on process.nextTick. wtf?
topLevel: true
},
removeConsole: true,
removeDebugger: true
},
{ comments: false }
),
new ExtractTextPlugin({

@@ -94,2 +82,14 @@ filename: 'styles.[hash].css',

new HtmlWebpackExcludeAssetsPlugin(),
new MinifyPlugin(
{
mangle: {
keepFnName: true, // should be false, but creates an error on process.nextTick. wtf?
topLevel: true
},
removeConsole: true,
removeDebugger: true
},
{ comments: false }
),
new webpack.optimize.ModuleConcatenationPlugin()
// new WebpackMonitor({

@@ -114,4 +114,5 @@ // capture: true, // -> default 'true'

// }),
new webpack.optimize.ModuleConcatenationPlugin()
]
})
}
module.exports = merge(webpackConfigBase, webpackConfigDist)

@@ -5,4 +5,4 @@ import Vue from 'vue'

new Vue({
template: '<app/>',
components: { app }
components: { app },
template: '<app/>'
}).$mount('#app')
{
"name": "@camomile/camomile-ui",
"version": "0.1.8",
"version": "0.1.9",
"description": "UI Component library for Camomile",

@@ -26,3 +26,9 @@ "license": "MIT",

"browser": "dist/camomile-ui.umd.js",
"keywords": ["camomile", "ui", "collaborative", "annotation", "platform"],
"keywords": [
"camomile",
"ui",
"collaborative",
"annotation",
"platform"
],
"scripts": {

@@ -34,6 +40,4 @@ "jest": "jest --verbose --coverage --watch",

"build": "rollup -c build/rollup.config.dist.js",
"styleguide":
"vue-styleguidist --config build/webpack.styleguide.config.js server",
"styleguide:build":
"vue-styleguidist --config build/webpack.styleguide.config.js build"
"styleguide": "vue-styleguidist --config build/webpack.styleguide.config.js server",
"styleguide:build": "vue-styleguidist --config build/webpack.styleguide.config.js build"
},

@@ -47,9 +51,10 @@ "dependencies": {

"devDependencies": {
"@babel/core": "^7.0.0-beta.37",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.37",
"@babel/preset-env": "^7.0.0-beta.37",
"@types/jest": "^22.0.1",
"autoprefixer": "^7.2.4",
"@babel/core": "^7.0.0-beta.39",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.39",
"@babel/preset-env": "^7.0.0-beta.39",
"@types/jest": "^22.1.1",
"@vue/test-utils": "^1.0.0-beta.11",
"autoprefixer": "^7.2.5",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^22.0.4",
"babel-jest": "^22.1.0",
"babel-loader": "^8.0.0-beta.0",

@@ -60,12 +65,9 @@ "babel-minify-webpack-plugin": "^0.2.0",

"cross-env": "^5.1.3",
"css-loader": "^0.28.8",
"eslint": "^4.15.0",
"eslint-config-standard": "^11.0.0-beta.0",
"eslint-friendly-formatter": "^3.0.0",
"eslint-plugin-compat": "^2.1.0",
"eslint-plugin-html": "^4.0.1",
"css-loader": "^0.28.9",
"eslint": "^4.16.0",
"eslint-plugin-compat": "^2.2.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-vue": "^4.2.2",
"extract-text-webpack-plugin": "^3.0.2",

@@ -76,5 +78,6 @@ "file-loader": "^1.1.6",

"imports-loader": "^0.7.1",
"jest": "^22.0.5",
"jest": "^22.1.4",
"jest-serializer-vue": "^0.3.0",
"jest-vue-preprocessor": "^1.3.1",
"json-fn": "^1.1.1",
"json-loader": "^0.5.7",

@@ -84,3 +87,2 @@ "object-fit-images": "^3.2.3",

"pleeease-filters": "^4.0.0",
"plyr": "^2.0.18",
"postcss": "^6.0.16",

@@ -101,3 +103,3 @@ "postcss-attribute-case-insensitive": "^2.0.0",

"postcss-custom-selectors": "^4.0.1",
"postcss-font-family-system-ui": "^2.1.2",
"postcss-font-family-system-ui": "^3.0.0",
"postcss-font-variant": "^3.0.0",

@@ -124,11 +126,11 @@ "postcss-grid-fluid": "^0.1.19",

"rimraf": "^2.6.2",
"rollup": "^0.53.4",
"rollup": "^0.55.3",
"rollup-plugin-buble": "^0.18.0",
"rollup-plugin-commonjs": "^8.2.6",
"rollup-plugin-commonjs": "^8.3.0",
"rollup-plugin-json": "^2.3.0",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-postcss": "^0.5.6",
"rollup-plugin-node-resolve": "^3.0.2",
"rollup-plugin-postcss": "^1.2.8",
"rollup-plugin-vue": "^3.0.0",
"style-loader": "^0.19.1",
"style-loader": "^0.20.1",
"stylelint": "^8.4.0",

@@ -140,11 +142,10 @@ "stylelint-config-standard": "^18.0.0",

"vue-html-loader": "^1.2.4",
"vue-loader": "^13.7.0",
"vue-loader": "^14.0.3",
"vue-server-renderer": "^2.5.13",
"vue-style-loader": "^3.0.3",
"vue-styleguidist": "^1.4.4",
"vue-style-loader": "^3.1.2",
"vue-styleguidist": "^1.4.5",
"vue-template-compiler": "^2.5.13",
"vue-test-utils": "^1.0.0-beta.9",
"webpack": "^3.10.0",
"webpack-bundle-analyzer": "^2.9.2",
"webpack-dev-server": "^2.10.1",
"webpack-dev-server": "^2.11.1",
"webpack-merge": "^4.1.1",

@@ -154,15 +155,11 @@ "webpack-monitor": "^1.0.14"

"eslintConfig": {
"extends": "standard",
"extends": "plugin:vue/recommended",
"env": {
"browser": true
},
"plugins": ["html", "compat"],
"rules": {
"compat/compat": 2,
"arrow-parens": 0,
"generator-star-spacing": 0
}
},
"stylelint": {
"processors": ["stylelint-processor-html"],
"processors": [
"stylelint-processor-html"
],
"extends": "stylelint-config-standard",

@@ -173,7 +170,13 @@ "rules": {

{
"ignoreProperties": ["typescale", "gf", "/button-/"]
"ignoreProperties": [
"typescale",
"gf",
"/button-/"
]
}
]
},
"ignoreFiles": ["./dist/**/*"]
"ignoreFiles": [
"./dist/**/*"
]
},

@@ -192,3 +195,7 @@ "browserslist": [

},
"moduleFileExtensions": ["js", "json", "vue"],
"moduleFileExtensions": [
"js",
"json",
"vue"
],
"transform": {

@@ -199,4 +206,8 @@ "^.+\\.js$": "babel-jest",

"mapCoverage": true,
"snapshotSerializers": ["jest-serializer-vue"],
"roots": ["<rootDir>/src/"],
"snapshotSerializers": [
"jest-serializer-vue"
],
"roots": [
"<rootDir>/src/"
],
"coverageDirectory": "<rootDir>/coverage/",

@@ -203,0 +214,0 @@ "collectCoverage": true

@@ -12,6 +12,9 @@ import './css/styles.css'

import cmlMediaYoutube from './components/media-youtube.vue'
import cmlMediaController from './components/media-controller.vue'
import cmlMediasYoutube from './components/medias/youtube.vue'
import cmlMediasVideo from './components/medias/video.vue'
import cmlMediasVideozoning from './components/medias/videozoning.vue'
import cmlMediasController from './components/medias/controller.vue'
import cmlLayerTimeline from './components/layers/timeline.vue'
import cmlAnnotationsButtons from './components/annotations/buttons.vue'
import cmlAnnotationsTimeline from './components/annotations/timeline.vue'

@@ -26,5 +29,8 @@ export {

cmlAnnotations,
cmlMediaYoutube,
cmlMediaController,
cmlLayerTimeline
cmlMediasYoutube,
cmlMediasVideo,
cmlMediasVideozoning,
cmlMediasController,
cmlAnnotationsButtons,
cmlAnnotationsTimeline
}

@@ -1,2 +0,2 @@

import { mount, shallow, createLocalVue } from 'vue-test-utils'
import { mount, shallow, createLocalVue } from '@vue/test-utils'
import { createRenderer } from 'vue-server-renderer'

@@ -3,0 +3,0 @@ import Vuex from 'vuex'

@@ -124,3 +124,3 @@ let user = {

const api = {
login (username, password) {
login(username, password) {
return new Promise((resolve, reject) => {

@@ -141,3 +141,3 @@ process.nextTick(() => {

me () {
me() {
return new Promise((resolve, reject) => {

@@ -154,3 +154,3 @@ process.nextTick(() => {

logout () {
logout() {
return new Promise((resolve, reject) => {

@@ -168,3 +168,3 @@ process.nextTick(() => {

createUser (name, password, description, role) {
createUser(name, password, description, role) {
return new Promise((resolve, reject) => {

@@ -188,3 +188,3 @@ process.nextTick(() => {

deleteUser (userId) {
deleteUser(userId) {
return new Promise((resolve, reject) => {

@@ -201,3 +201,3 @@ process.nextTick(() => {

updateUser (id, { password, description, role }) {
updateUser(id, { password, description, role }) {
return new Promise((resolve, reject) => {

@@ -222,3 +222,3 @@ process.nextTick(() => {

getUsers () {
getUsers() {
return new Promise((resolve, reject) => {

@@ -231,3 +231,3 @@ process.nextTick(() => {

createGroup (name, description) {
createGroup(name, description) {
return new Promise((resolve, reject) => {

@@ -251,3 +251,3 @@ process.nextTick(() => {

deleteGroup (groupId) {
deleteGroup(groupId) {
return new Promise((resolve, reject) => {

@@ -264,3 +264,3 @@ process.nextTick(() => {

updateGroup (id, { description }) {
updateGroup(id, { description }) {
return new Promise((resolve, reject) => {

@@ -285,3 +285,3 @@ process.nextTick(() => {

getGroups () {
getGroups() {
return new Promise((resolve, reject) => {

@@ -294,3 +294,3 @@ process.nextTick(() => {

addUserToGroup (userId, groupId) {
addUserToGroup(userId, groupId) {
return new Promise((resolve, reject) => {

@@ -315,3 +315,3 @@ process.nextTick(() => {

removeUserFromGroup (userId, groupId) {
removeUserFromGroup(userId, groupId) {
return new Promise((resolve, reject) => {

@@ -336,3 +336,3 @@ process.nextTick(() => {

createCorpus (name, description) {
createCorpus(name, description) {
return new Promise((resolve, reject) => {

@@ -355,3 +355,3 @@ process.nextTick(() => {

deleteCorpus (groupId) {
deleteCorpus(groupId) {
return new Promise((resolve, reject) => {

@@ -368,3 +368,3 @@ process.nextTick(() => {

updateCorpus (id, { name, description }) {
updateCorpus(id, { name, description }) {
return new Promise((resolve, reject) => {

@@ -388,3 +388,3 @@ process.nextTick(() => {

getCorpora () {
getCorpora() {
return new Promise((resolve, reject) => {

@@ -397,3 +397,3 @@ process.nextTick(() => {

setCorpusPermissionsForGroup (corpuId, groupId, permission) {
setCorpusPermissionsForGroup(corpuId, groupId, permission) {
return new Promise((resolve, reject) => {

@@ -413,3 +413,3 @@ process.nextTick(() => {

removeCorpusPermissionsForGroup (corpuId, groupId) {
removeCorpusPermissionsForGroup(corpuId, groupId) {
return new Promise((resolve, reject) => {

@@ -434,3 +434,3 @@ process.nextTick(() => {

setCorpusPermissionsForUser (corpuId, userId, permission) {
setCorpusPermissionsForUser(corpuId, userId, permission) {
return new Promise((resolve, reject) => {

@@ -450,3 +450,3 @@ process.nextTick(() => {

removeCorpusPermissionsForUser (corpuId, userId) {
removeCorpusPermissionsForUser(corpuId, userId) {
return new Promise((resolve, reject) => {

@@ -471,3 +471,3 @@ process.nextTick(() => {

createMedium (corpuId, name, url, description) {
createMedium(corpuId, name, url, description) {
return new Promise((resolve, reject) => {

@@ -492,3 +492,3 @@ process.nextTick(() => {

deleteMedium (mediaId) {
deleteMedium(mediaId) {
return new Promise((resolve, reject) => {

@@ -505,3 +505,3 @@ process.nextTick(() => {

updateMedium (mediaId, { name, url, description }) {
updateMedium(mediaId, { name, url, description }) {
return new Promise((resolve, reject) => {

@@ -527,3 +527,3 @@ process.nextTick(() => {

getMedia () {
getMedia() {
return new Promise((resolve, reject) => {

@@ -536,3 +536,3 @@ process.nextTick(() => {

createLayer (
createLayer(
corpuId,

@@ -566,3 +566,3 @@ name,

deleteLayer (layerId) {
deleteLayer(layerId) {
return new Promise((resolve, reject) => {

@@ -579,3 +579,3 @@ process.nextTick(() => {

updateLayer (layerId, { name, fragment_type, data_type, description }) {
updateLayer(layerId, { name, fragment_type, data_type, description }) {
return new Promise((resolve, reject) => {

@@ -601,3 +601,3 @@ process.nextTick(() => {

getLayers () {
getLayers() {
return new Promise((resolve, reject) => {

@@ -610,3 +610,3 @@ process.nextTick(() => {

setLayerPermissionsForGroup (layerId, groupId, permission) {
setLayerPermissionsForGroup(layerId, groupId, permission) {
return new Promise((resolve, reject) => {

@@ -626,3 +626,3 @@ process.nextTick(() => {

removeLayerPermissionsForGroup (layerId, groupId) {
removeLayerPermissionsForGroup(layerId, groupId) {
return new Promise((resolve, reject) => {

@@ -647,3 +647,3 @@ process.nextTick(() => {

setLayerPermissionsForUser (layerId, userId, permission) {
setLayerPermissionsForUser(layerId, userId, permission) {
return new Promise((resolve, reject) => {

@@ -663,3 +663,3 @@ process.nextTick(() => {

removeLayerPermissionsForUser (layerId, userId) {
removeLayerPermissionsForUser(layerId, userId) {
return new Promise((resolve, reject) => {

@@ -684,3 +684,3 @@ process.nextTick(() => {

createAnnotation (layerId, mediaId, fragment, data) {
createAnnotation(layerId, mediaId, fragment, data) {
return new Promise((resolve, reject) => {

@@ -706,3 +706,3 @@ process.nextTick(() => {

deleteAnnotation (annotationId) {
deleteAnnotation(annotationId) {
return new Promise((resolve, reject) => {

@@ -719,3 +719,3 @@ process.nextTick(() => {

updateAnnotation (annotationId, { fragment, data }) {
updateAnnotation(annotationId, { fragment, data }) {
return new Promise((resolve, reject) => {

@@ -741,6 +741,10 @@ process.nextTick(() => {

getAnnotations ({ filter: { id_layer } }) {
getAnnotations({ filter: { id_layer, id_media } }) {
return new Promise((resolve, reject) => {
process.nextTick(() => {
resolve({ data: annotations })
if (id_layer) {
resolve({ data: annotations })
} else {
reject(new Error('Api'))
}
})

@@ -747,0 +751,0 @@ })

@@ -1,2 +0,2 @@

import { createLocalVue } from 'vue-test-utils'
import { createLocalVue } from '@vue/test-utils'
import Vuex from 'vuex'

@@ -100,27 +100,29 @@ import corpus from '../corpus'

actives: {
default: {
'mocks-layer-id-1': ['mocks-annotation-id-1']
}
default: 'mocks-annotation-id-1'
},
lists: {
default: {
'mocks-layer-id-1': [
{
id: 'mocks-annotation-id-1',
fragment: { fragment: 'Maecenas faucibus mollis interdum.' },
metadata: { metadata: 'Maecenas faucibus mollis interdum.' },
mediaId: 'mocks-media-id-1',
layerId: 'mocks-layer-id-1'
},
{
id: 'mocks-annotation-id-2',
fragment: {
fragment: 'Etiam porta sem malesuada magna mollis euismod.'
layersUid: 'default',
mediaUid: 'default',
layers: {
'mocks-layer-id-1': [
{
id: 'mocks-annotation-id-1',
fragment: { fragment: 'Maecenas faucibus mollis interdum.' },
metadata: { metadata: 'Maecenas faucibus mollis interdum.' },
mediaId: 'mocks-media-id-1',
layerId: 'mocks-layer-id-1'
},
metadata: {
metadata: 'Etiam porta sem malesuada magna mollis euismod.'
},
layerId: 'mocks-layer-id-1'
}
]
{
id: 'mocks-annotation-id-2',
fragment: {
fragment: 'Etiam porta sem malesuada magna mollis euismod.'
},
metadata: {
metadata: 'Etiam porta sem malesuada magna mollis euismod.'
},
layerId: 'mocks-layer-id-1'
}
]
}
}

@@ -156,4 +158,3 @@ }

fragment: { fragment: 'Egestas Euismod Quam Condimentum' },
metadata: { data: 'Egestas Euismod Quam Condimentum' },
mediaLink: true
metadata: { data: 'Egestas Euismod Quam Condimentum' }
}

@@ -164,3 +165,5 @@ const layerId = 'mocks-layer-id-1'

return store.dispatch('cml/annotations/add', { element }).then(r => {
expect(store.state.cml.annotations.lists['default'][layerId]).toEqual([
expect(
store.state.cml.annotations.lists['default'].layers[layerId]
).toEqual([
{

@@ -214,3 +217,5 @@ fragment: { fragment: 'Maecenas faucibus mollis interdum.' },

return store.dispatch('cml/annotations/remove', { id }).then(r => {
expect(store.state.cml.annotations.lists['default'][layerId]).toEqual([
expect(
store.state.cml.annotations.lists['default'].layers[layerId]
).toEqual([
{

@@ -258,3 +263,5 @@ fragment: {

return store.dispatch('cml/annotations/update', { element }).then(r => {
expect(store.state.cml.annotations.lists['default'][layerId]).toEqual([
expect(
store.state.cml.annotations.lists['default'].layers[layerId]
).toEqual([
{

@@ -302,8 +309,16 @@ fragment: {

const layerId = 'mocks-layer-id-1'
const mediaId = 'mocks-media-id-1'
expect.assertions(1)
return store
.dispatch('cml/annotations/list', { layerId, uid: 'default' })
.dispatch('cml/annotations/list', {
uid: 'default',
layerId,
layersUid: 'default',
mediaId
})
.then(r => {
expect(store.state.cml.annotations.lists['default'][layerId]).toEqual([
expect(
store.state.cml.annotations.lists['default'].layers[layerId]
).toEqual([
{

@@ -333,24 +348,16 @@ fragment: { fragment: 'Maecenas faucibus mollis interdum.' },

const layerId = ''
const mediaId = 'mocks-media-id-1'
expect.assertions(1)
return store
.dispatch('cml/annotations/list', { layerId, uid: '' })
.dispatch('cml/annotations/list', {
uid: 'default',
layerId,
layersUid: '',
mediaId
})
.catch(e => {
expect(e.message).toEqual('missing uid')
expect(e.message).toEqual('Api')
})
})
it('sets selected annotation', () => {
const id = 'mocks-annotation-id-2'
const layerId = 'mocks-layer-id-1'
expect.assertions(1)
return store
.dispatch('cml/annotations/set', { id, layerId, uid: 'default' })
.then(r => {
expect(store.state.cml.annotations.actives['default']).toEqual({
'mocks-layer-id-1': ['mocks-annotation-id-1', 'mocks-annotation-id-2']
})
})
})
})

@@ -363,5 +370,3 @@

state.actives = {
default: {
'mocks-layer-id-1': ['mocks-annotation-id']
}
default: 'mocks-annotation-id'
}

@@ -395,2 +400,9 @@

})
it('sets selected annotation', () => {
const id = 'mocks-annotation-id-2'
annotations.mutations.set(state, { id, uid: 'default' })
expect(state.actives['default']).toEqual('mocks-annotation-id-2')
})
})

@@ -1,2 +0,2 @@

import { createLocalVue } from 'vue-test-utils'
import { createLocalVue } from '@vue/test-utils'
import Vuex from 'vuex'

@@ -3,0 +3,0 @@ import corpus from '../corpus'

@@ -1,2 +0,2 @@

import { createLocalVue } from 'vue-test-utils'
import { createLocalVue } from '@vue/test-utils'
import Vuex from 'vuex'

@@ -3,0 +3,0 @@ import messages from '../messages'

@@ -1,2 +0,2 @@

import { createLocalVue } from 'vue-test-utils'
import { createLocalVue } from '@vue/test-utils'
import Vuex from 'vuex'

@@ -68,3 +68,3 @@ import popup from '../popup'

actives: {
default: ['mocks-layer-id-2']
default: { corpuUid: 'default-corpu', ids: ['mocks-layer-id-2'] }
},

@@ -299,32 +299,41 @@ lists: {

expect.assertions(1)
return store.dispatch('cml/layers/list', { uid: 'default' }).then(r => {
expect(store.state.cml.layers.lists['default']).toEqual([
{
annotations: { annotations: 'Ornare Malesuada Fermentum Parturient' },
description: { desc: 'Ornare Malesuada Fermentum Parturient' },
fragmentType: { fragment: 'Ornare Malesuada Fermentum Parturient' },
id: 'mocks-layer-id-1',
metadataType: { data: 'Ornare Malesuada Fermentum Parturient' },
name: 'layer-1',
permission: 1,
permissions: {
groups: { 'mocks-group-id-1': 0, 'mocks-group-id-2': 2 },
users: { 'mocks-user-id-lu': 1, 'mocks-user-id-ji': 0 }
return store
.dispatch('cml/layers/list', {
corpuId: 'mocks-corpu-id',
corpuUid: 'default'
})
.then(r => {
expect(store.state.cml.layers.lists['default']).toEqual([
{
annotations: {
annotations: 'Ornare Malesuada Fermentum Parturient'
},
description: { desc: 'Ornare Malesuada Fermentum Parturient' },
fragmentType: { fragment: 'Ornare Malesuada Fermentum Parturient' },
id: 'mocks-layer-id-1',
metadataType: { data: 'Ornare Malesuada Fermentum Parturient' },
name: 'layer-1',
permission: 1,
permissions: {
groups: { 'mocks-group-id-1': 0, 'mocks-group-id-2': 2 },
users: { 'mocks-user-id-lu': 1, 'mocks-user-id-ji': 0 }
}
},
{
annotations: {
annotations: 'Ornare Malesuada Fermentum Parturient'
},
description: { desc: 'Condimentum Elit Mattis Quam' },
fragmentType: { fragment: 'Ornare Malesuada Fermentum Parturient' },
id: 'mocks-layer-id-2',
metadataType: { data: 'Ornare Malesuada Fermentum Parturient' },
name: 'layer-2',
permission: 2,
permissions: {
groups: { 'mocks-group-id-1': 2, 'mocks-group-id-2': 0 },
users: { 'mocks-user-id-lu': 0, 'mocks-user-id-ji': 3 }
}
}
},
{
annotations: { annotations: 'Ornare Malesuada Fermentum Parturient' },
description: { desc: 'Condimentum Elit Mattis Quam' },
fragmentType: { fragment: 'Ornare Malesuada Fermentum Parturient' },
id: 'mocks-layer-id-2',
metadataType: { data: 'Ornare Malesuada Fermentum Parturient' },
name: 'layer-2',
permission: 2,
permissions: {
groups: { 'mocks-group-id-1': 2, 'mocks-group-id-2': 0 },
users: { 'mocks-user-id-lu': 0, 'mocks-user-id-ji': 3 }
}
}
])
})
])
})
})

@@ -570,8 +579,13 @@

expect.assertions(1)
return store.dispatch('cml/layers/set', { id, uid: 'default' }).then(r => {
expect(store.state.cml.layers.actives['default']).toEqual([
'mocks-layer-id-2',
'mocks-layer-id-1'
])
})
return store
.dispatch('cml/layers/set', {
id,
uid: 'default'
})
.then(r => {
expect(store.state.cml.layers.actives['default']).toEqual({
corpuUid: 'default-corpu',
ids: ['mocks-layer-id-2', 'mocks-layer-id-1']
})
})
})

@@ -586,3 +600,6 @@

.then(r => {
expect(store.state.cml.layers.actives['default']).toEqual([])
expect(store.state.cml.layers.actives['default']).toEqual({
corpuUid: 'default-corpu',
ids: []
})
})

@@ -610,7 +627,2 @@ })

it('inits one layer list', () => {
layers.mutations.init(state, 'default')
expect(state.lists['default']).toEqual([])
})
it('resets all layer lists', () => {

@@ -617,0 +629,0 @@ layers.mutations.resetAll(state)

@@ -1,2 +0,2 @@

import { createLocalVue } from 'vue-test-utils'
import { createLocalVue } from '@vue/test-utils'
import Vuex from 'vuex'

@@ -71,3 +71,3 @@ import sync from '../sync'

actives: {
default: 'mocks-media-id-1'
default: { id: 'mocks-media-id-1', corpuUid: 'default' }
},

@@ -223,9 +223,9 @@ lists: {

it('removes a media (error)', () => {
const id = '' // throw an error
// it('removes a media (error)', () => {
// const id = '' // throw an error
return expect(store.dispatch('cml/medias/remove', { id })).rejects.toThrow(
'Api'
)
})
// return expect(store.dispatch('cml/medias/remove', { id })).rejects.toThrow(
// 'Api'
// )
// })

@@ -304,7 +304,14 @@ it('updates a media', () => {

expect.assertions(1)
return store.dispatch('cml/medias/set', { id, uid: 'default' }).then(r => {
expect(store.state.cml.medias.actives['default']).toEqual(
'mocks-media-id-2'
)
})
return store
.dispatch('cml/medias/set', {
id,
corpuUid: 'default-corpu',
uid: 'default-media'
})
.then(r => {
expect(store.state.cml.medias.actives['default-media']).toEqual({
id: 'mocks-media-id-2',
corpuUid: 'default-corpu'
})
})
})

@@ -319,3 +326,3 @@ })

actives: {
default: 'mocks-media-id-2'
default: { id: 'mocks-media-id-2', corpuUid: 'default' }
},

@@ -345,3 +352,5 @@ lists: {

it('returns the id of the active medias', () => {
expect(store.getters.id('default')).toEqual('mocks-media-id-2')
expect(store.getters.id({ corpuUid: 'default', uid: 'default' })).toEqual(
'mocks-media-id-2'
)
})

@@ -348,0 +357,0 @@ })

@@ -1,2 +0,2 @@

import { createLocalVue } from 'vue-test-utils'
import { createLocalVue } from '@vue/test-utils'
import Vuex from 'vuex'

@@ -3,0 +3,0 @@ import messages from '../messages'

@@ -1,2 +0,2 @@

import { createLocalVue } from 'vue-test-utils'
import { createLocalVue } from '@vue/test-utils'
import Vuex from 'vuex'

@@ -3,0 +3,0 @@

@@ -1,2 +0,2 @@

import { createLocalVue } from 'vue-test-utils'
import { createLocalVue } from '@vue/test-utils'
import Vuex from 'vuex'

@@ -3,0 +3,0 @@ import { actions, mutations } from '../index'

@@ -1,2 +0,2 @@

import { createLocalVue } from 'vue-test-utils'
import { createLocalVue } from '@vue/test-utils'
import Vuex from 'vuex'

@@ -3,0 +3,0 @@ import messages from '../messages'

@@ -10,3 +10,3 @@ import Vue from 'vue'

export const actions = {
add ({ commit, dispatch }, { element }) {
add({ commit, dispatch }, { element }) {
dispatch('cml/sync/start', `annotationsAdd`, { root: true })

@@ -16,3 +16,3 @@ return api

element.layerId,
element.mediaLink ? element.mediaId : null,
element.mediaId || null,
element.fragment,

@@ -43,3 +43,3 @@ element.metadata

remove ({ commit, dispatch }, { id }) {
remove({ commit, dispatch }, { id }) {
dispatch('cml/sync/start', `annotationsRemove`, { root: true })

@@ -63,3 +63,3 @@ return api

update ({ commit, dispatch }, { element }) {
update({ commit, dispatch }, { element }) {
dispatch('cml/sync/start', `annotationsUpdate`, { root: true })

@@ -89,17 +89,53 @@ return api

listAll ({ rootState, dispatch }, { uid }) {
rootState.cml.layers.actives[uid].forEach(layerId => {
dispatch('list', { layerId, uid })
layerSet({ state, dispatch, rootState }, { layersUid, layerId }) {
Object.keys(state.lists).forEach(uid => {
if (
state.lists[uid].layersUid === layersUid &&
rootState.cml.medias.actives[state.lists[uid].mediaUid]
) {
dispatch('list', {
uid,
layerId,
layersUid,
mediaId: rootState.cml.medias.actives[state.lists[uid].mediaUid].id
})
}
})
},
list ({ dispatch, commit }, { layerId, uid }) {
layerUnset({ commit }, { layersUid, layerId }) {
commit('reset', { layersUid, layerId })
},
mediaSet({ state, dispatch, rootState }, { mediaUid, mediaId }) {
Object.keys(state.lists).forEach(uid => {
if (
state.lists[uid].mediaUid === mediaUid &&
rootState.cml.layers.actives[state.lists[uid].layersUid]
) {
Object.keys(state.lists[uid].layers).forEach(layerId => {
dispatch('list', {
uid,
layerId,
layersUid: state.lists[uid].layersUid,
mediaId
})
})
}
})
},
list({ state, dispatch, commit }, { uid, layerId, layersUid, mediaId }) {
dispatch('cml/sync/start', `annotationsList-${uid}`, { root: true })
return api
.getAnnotations({ filter: { id_layer: layerId } })
.getAnnotations({
filter: {
id_layer: layerId,
id_medium: mediaId
}
})
.then(r => {
if (!uid) {
throw new Error('missing uid')
}
dispatch('cml/sync/stop', `annotationsList-${uid}`, { root: true })
dispatch('cml/sync/stop', `annotationsList-${uid}`, {
root: true
})
const annotations = r.data.map(a => ({

@@ -112,4 +148,4 @@ id: a._id,

}))
commit('list', { annotations, layerId, uid })
dispatch('setAll', { layerId, uid })
commit('list', { annotations, uid, layerId, layersUid })
// commit('reset', { layerId, layersUid })

@@ -119,3 +155,5 @@ return annotations

.catch(e => {
dispatch('cml/sync/stop', `annotationsList-${uid}`, { root: true })
dispatch('cml/sync/stop', `annotationsList-${layersUid}`, {
root: true
})
dispatch('cml/messages/error', e.message, { root: true })

@@ -127,14 +165,4 @@

setAll ({ state, dispatch, commit }, { layerId, uid }) {
state.lists[uid][layerId].forEach(i => {
dispatch('set', { id: i.id, layerId, uid })
})
},
set ({ commit }, { id, layerId, uid }) {
commit('set', { id, layerId, uid })
},
unset ({ dispatch, commit }, { id, layerId, uid }) {
commit('unset', { id, layerId, uid })
register({ commit }, { uid, mediaUid, layersUid }) {
commit('register', { uid, mediaUid, layersUid })
}

@@ -144,13 +172,8 @@ }

export const mutations = {
init (state, { uid }) {
Vue.set(state.lists, uid, {})
Vue.set(state.actives, uid, {})
register(state, { uid, mediaUid, layersUid }) {
Vue.set(state.actives, uid, null)
Vue.set(state.lists, uid, { mediaUid, layersUid, layers: {} })
},
reset (state, { layerId, uid }) {
Vue.delete(state.lists[uid], layerId)
Vue.delete(state.actives[uid], layerId)
},
resetAll (state) {
resetAll(state) {
Vue.set(state, 'lists', {})

@@ -160,5 +183,19 @@ Vue.set(state, 'actives', {})

add (state, { annotation, layerId }) {
reset(state, { layersUid, layerId }) {
Object.keys(state.lists).forEach(uid => {
const list = state.lists[uid][layerId]
if (state.lists[uid].layersUid === layersUid) {
Vue.delete(state.lists[uid], layerId)
}
})
Object.keys(state.actives).forEach(uid => {
if (state.actives[uid] && state.actives[uid].layerId === layerId) {
Vue.set(state.actives, uid, null)
}
})
},
add(state, { annotation, layerId }) {
Object.keys(state.lists).forEach(uid => {
const list = state.lists[uid].layers[layerId]
if (list) {

@@ -170,7 +207,7 @@ Vue.set(list, list.length, annotation)

update (state, { annotation, layerId }) {
update(state, { annotation, layerId }) {
Object.keys(state.lists).forEach(uid => {
const list = state.lists[uid][layerId]
const list = state.lists[uid].layers[layerId]
if (list) {
const index = list.findIndex(m => m.id === annotation.id)
const index = list.findIndex(a => a.id === annotation.id)
Vue.set(list, index, annotation)

@@ -181,6 +218,6 @@ }

remove (state, { id }) {
remove(state, { id }) {
Object.keys(state.lists).forEach(uid => {
Object.keys(state.lists[uid]).forEach(layerId => {
const list = state.lists[uid][layerId]
Object.keys(state.lists[uid].layers).forEach(layerId => {
const list = state.lists[uid].layers[layerId]
if (list) {

@@ -192,38 +229,22 @@ const listsIndex = list.findIndex(a => a.id === id)

}
const actives = state.actives[uid][layerId]
console.log('annotations-remove-actives', actives)
if (actives) {
const activeIndex = actives.indexOf(id)
console.log('annotations-remove-actives-index', activeIndex)
if (activeIndex !== -1) {
Vue.delete(actives, activeIndex)
}
}
})
})
Object.keys(state.actives).forEach(uid => {
if (state.actives[uid] && state.actives[uid].id === id) {
Vue.set(state.actives, uid, null)
}
})
},
list (state, { annotations, layerId, uid }) {
Vue.set(state.lists[uid], layerId, annotations)
list(state, { annotations, uid, layerId, layersUid }) {
Vue.set(state.lists[uid].layers, layerId, annotations)
},
set (state, { id, layerId, uid }) {
if (!state.actives[uid][layerId]) {
Vue.set(state.actives[uid], layerId, [id])
} else {
Vue.set(
state.actives[uid][layerId],
state.actives[uid][layerId].length,
id
)
}
set(state, { id, uid }) {
Vue.set(state.actives, uid, id)
},
unset (state, { id, layerId, uid }) {
if (state.actives[uid][layerId]) {
const index = state.actives[uid][layerId].indexOf(id)
if (index !== -1) {
Vue.delete(state.actives[uid][layerId], index)
}
}
unset(state, { id, uid }) {
Vue.set(state.actives, uid, null)
}

@@ -230,0 +251,0 @@ }

@@ -10,3 +10,3 @@ import Vue from 'vue'

export const actions = {
add ({ commit, dispatch, rootState, rootGetters }, { element }) {
add({ commit, dispatch, rootState, rootGetters }, { element }) {
dispatch('cml/sync/start', `corpusAdd`, { root: true })

@@ -41,3 +41,3 @@ return api

remove ({ commit, dispatch, state }, { id }) {
remove({ commit, dispatch, state }, { id }) {
dispatch('cml/sync/start', `corpusRemove`, { root: true })

@@ -62,3 +62,3 @@ return api

update ({ commit, dispatch, state }, { element }) {
update({ commit, dispatch, state }, { element }) {
dispatch('cml/sync/start', `corpusUpdate`, { root: true })

@@ -88,3 +88,3 @@ return api

groupPermissionSet (
groupPermissionSet(
{ commit, dispatch, rootGetters },

@@ -133,3 +133,3 @@ { id, groupId, permission }

groupPermissionRemove ({ commit, dispatch, rootGetters }, { id, groupId }) {
groupPermissionRemove({ commit, dispatch, rootGetters }, { id, groupId }) {
dispatch('cml/sync/start', `corpusGroupPermissionRemove`, {

@@ -170,3 +170,3 @@ root: true

userPermissionSet (
userPermissionSet(
{ commit, dispatch, rootGetters },

@@ -212,3 +212,3 @@ { id, userId, permission }

userPermissionRemove ({ commit, dispatch, rootGetters }, { id, userId }) {
userPermissionRemove({ commit, dispatch, rootGetters }, { id, userId }) {
dispatch('cml/sync/start', `corpusUserPermissionRemove`, {

@@ -249,3 +249,3 @@ root: true

listAll ({ state, dispatch }) {
listAll({ state, dispatch }) {
Object.keys(state.lists).forEach(uid => {

@@ -256,3 +256,3 @@ dispatch('list', uid)

list ({ commit, dispatch, rootGetters }, uid) {
list({ commit, dispatch, rootGetters }, uid) {
dispatch('cml/sync/start', `corpusList-${uid}`, { root: true })

@@ -290,3 +290,3 @@ return api

setAll ({ state, dispatch }, { id }) {
setAll({ state, dispatch }, { id }) {
Object.keys(state.actives).forEach(uid => {

@@ -299,10 +299,11 @@ if (state.actives[uid] === id) {

set ({ state, getters, dispatch, commit }, { id, uid }) {
set({ state, getters, dispatch, commit }, { id, uid }) {
commit('set', { id: id || getters.id(uid), uid })
commit('cml/medias/init', uid, { root: true })
commit('cml/layers/init', uid, { root: true })
// media needs to be set
// before layers/set triggers annotations/lists
if (state.actives[uid]) {
dispatch(
'cml/medias/list',
{ corpuId: state.actives[uid], uid },
{ corpuId: state.actives[uid], corpuUid: uid },
{ root: true }

@@ -312,3 +313,3 @@ )

'cml/layers/list',
{ corpuId: state.actives[uid], uid },
{ corpuId: state.actives[uid], corpuUid: uid },
{ root: true }

@@ -319,4 +320,4 @@ )

register ({ state, commit }, uid) {
commit('init', uid)
register({ state, commit }, uid) {
commit('register', uid)
}

@@ -328,4 +329,3 @@ }

(state.actives[uid] &&
state.lists[uid].map(c => c.id).indexOf(state.actives[uid]) !== -1 &&
state.actives[uid]) ||
state.lists[uid].find(c => c.id === state.actives[uid]).id) ||
(state.lists[uid][0] && state.lists[uid][0].id) ||

@@ -336,3 +336,3 @@ null

export const mutations = {
init (state, uid) {
register(state, uid) {
Vue.set(state.lists, uid, [])

@@ -342,3 +342,3 @@ Vue.set(state.actives, uid, null)

resetAll (state) {
resetAll(state) {
Vue.set(state, 'lists', {})

@@ -348,3 +348,3 @@ Vue.set(state, 'actives', {})

add (state, { corpu }) {
add(state, { corpu }) {
Object.keys(state.lists).forEach(uid => {

@@ -356,3 +356,3 @@ const index = state.lists[uid].length

update (state, { corpu }) {
update(state, { corpu }) {
Object.keys(state.lists).forEach(uid => {

@@ -366,3 +366,3 @@ const index = state.lists[uid].findIndex(m => m.id === corpu.id)

remove (state, { id }) {
remove(state, { id }) {
Object.keys(state.lists).forEach(uid => {

@@ -376,3 +376,3 @@ const index = state.lists[uid].findIndex(c => c.id === id)

groupAdd (state, groupId) {
groupAdd(state, groupId) {
Object.keys(state.lists).forEach(uid => {

@@ -385,3 +385,3 @@ state.lists[uid].forEach(c => {

groupRemove (state, groupId) {
groupRemove(state, groupId) {
Object.keys(state.lists).forEach(uid => {

@@ -394,3 +394,3 @@ state.lists[uid].forEach(c => {

userAdd (state, userId) {
userAdd(state, userId) {
Object.keys(state.lists).forEach(uid => {

@@ -403,3 +403,3 @@ state.lists[uid].forEach(c => {

userRemove (state, userId) {
userRemove(state, userId) {
Object.keys(state.lists).forEach(uid => {

@@ -412,3 +412,3 @@ state.lists[uid].forEach(c => {

groupPermissionsUpdate (state, { id, groupId, permission }) {
groupPermissionsUpdate(state, { id, groupId, permission }) {
Object.keys(state.lists).forEach(uid => {

@@ -422,3 +422,3 @@ const index = state.lists[uid].findIndex(m => m.id === id)

userPermissionsUpdate (state, { id, userId, permission }) {
userPermissionsUpdate(state, { id, userId, permission }) {
Object.keys(state.lists).forEach(uid => {

@@ -432,7 +432,7 @@ const index = state.lists[uid].findIndex(m => m.id === id)

list (state, { corpus, uid }) {
list(state, { corpus, uid }) {
Vue.set(state.lists, uid, corpus)
},
set (state, { id, uid }) {
set(state, { id, uid }) {
Vue.set(state.actives, uid, id)

@@ -439,0 +439,0 @@ }

@@ -7,3 +7,3 @@ export const state = {

export const mutations = {
close (state) {
close(state) {
state.visible = false

@@ -13,3 +13,3 @@ state.config = {}

open (state, config) {
open(state, config) {
state.visible = true

@@ -16,0 +16,0 @@ state.config = config

@@ -10,3 +10,3 @@ import Vue from 'vue'

export const actions = {
add ({ commit, dispatch, state }, { element }) {
add({ commit, dispatch, state }, { element }) {
dispatch('cml/sync/start', 'groupsAdd', { root: true })

@@ -33,3 +33,3 @@ return api

remove ({ commit, dispatch, state }, { id }) {
remove({ commit, dispatch, state }, { id }) {
dispatch('cml/sync/start', 'groupsRemove', { root: true })

@@ -55,3 +55,3 @@ return api

update ({ commit, dispatch, state }, { element }) {
update({ commit, dispatch, state }, { element }) {
dispatch('cml/sync/start', 'groupsUpdate', { root: true })

@@ -76,3 +76,3 @@ return api

list ({ commit, dispatch, state }) {
list({ commit, dispatch, state }) {
dispatch('cml/sync/start', 'groupsList', { root: true })

@@ -96,3 +96,3 @@ return api

userAdd ({ commit, dispatch, state, rootState }, { userId, group }) {
userAdd({ commit, dispatch, state, rootState }, { userId, group }) {
dispatch('cml/sync/start', 'groupsUserAdd', { root: true })

@@ -125,3 +125,3 @@ return api

userRemove ({ commit, dispatch, state, rootState }, { userId, group }) {
userRemove({ commit, dispatch, state, rootState }, { userId, group }) {
dispatch('cml/sync/start', 'groupsUserRemove', { root: true })

@@ -169,11 +169,11 @@ return api

export const mutations = {
reset (state) {
reset(state) {
Vue.set(state, 'list', [])
},
add (state, group) {
add(state, group) {
state.list.push(group)
},
update (state, group) {
update(state, group) {
const index = state.list.findIndex(g => g.id === group.id)

@@ -183,3 +183,3 @@ Vue.set(state.list, index, group)

remove (state, groupId) {
remove(state, groupId) {
const index = state.list.findIndex(g => g.id === groupId)

@@ -189,3 +189,3 @@ Vue.delete(state.list, index)

list (state, groups) {
list(state, groups) {
Vue.set(state, 'list', groups)

@@ -192,0 +192,0 @@ }

@@ -39,3 +39,3 @@ import Vue from 'vue'

export const actions = {
set ({ dispatch }) {
set({ dispatch }) {
Promise.all([

@@ -52,3 +52,3 @@ ...['users', 'groups'].map(type =>

reset ({ commit }) {
reset({ commit }) {
commit('cml/user/reset', null, { root: true })

@@ -55,0 +55,0 @@ commit('cml/users/reset', null, { root: true })

@@ -10,3 +10,3 @@ import Vue from 'vue'

export const actions = {
add ({ state, commit, dispatch, rootState, rootGetters }, { element }) {
add({ state, commit, dispatch, rootState, rootGetters }, { element }) {
dispatch('cml/sync/start', `layersAdd`, { root: true })

@@ -39,6 +39,11 @@ return api

Object.keys(state.lists).forEach(uid => {
if (rootGetters['cml/corpus/id'](uid) === element.corpuId) {
commit('add', { layer, uid })
Object.keys(state.lists).forEach(corpuUid => {
if (rootGetters['cml/corpus/id'](corpuUid) === element.corpuId) {
commit('add', { layer, corpuUid })
}
Object.keys(state.actives).forEach(uid => {
if (state.actives[uid].corpuUid === corpuUid) {
dispatch('set', { uid, id: layer.id })
}
})
})

@@ -57,3 +62,3 @@ dispatch('cml/messages/success', 'Layer added', { root: true })

remove ({ state, commit, dispatch, rootState }, { id }) {
remove({ state, commit, dispatch, rootState }, { id }) {
dispatch('cml/sync/start', `layersRemove`, { root: true })

@@ -64,5 +69,10 @@ return api

dispatch('cml/sync/stop', `layersRemove`, { root: true })
Object.keys(state.lists).forEach(uid => {
commit('remove', { id, uid })
Object.keys(state.lists).forEach(corpuUid => {
commit('remove', { id, corpuUid })
})
Object.keys(state.actives).forEach(uid => {
if (state.actives[uid].ids.findIndex(l => l.id === id) !== -1) {
dispatch('unset', { id, uid })
}
})
dispatch('cml/messages/success', 'Layer removed', { root: true })

@@ -80,3 +90,3 @@

update ({ state, commit, dispatch, rootGetters }, { element }) {
update({ state, commit, dispatch, rootGetters }, { element }) {
dispatch('cml/sync/start', `layersUpdate`, { root: true })

@@ -97,5 +107,5 @@ return api

Object.keys(state.lists).forEach(uid => {
if (rootGetters['cml/corpus/id'](uid) === element.corpuId) {
commit('update', { layer, uid })
Object.keys(state.lists).forEach(corpuUid => {
if (rootGetters['cml/corpus/id'](corpuUid) === element.corpuId) {
commit('update', { layer, corpuUid })
}

@@ -115,3 +125,3 @@ })

groupPermissionSet (
groupPermissionSet(
{ commit, dispatch, rootState, rootGetters },

@@ -159,3 +169,3 @@ { id, groupId, permission }

groupPermissionRemove (
groupPermissionRemove(
{ commit, dispatch, rootState, rootGetters },

@@ -199,3 +209,3 @@ { id, groupId }

userPermissionSet (
userPermissionSet(
{ commit, dispatch, rootState, rootGetters },

@@ -241,3 +251,3 @@ { id, userId, permission }

userPermissionRemove (
userPermissionRemove(
{ commit, dispatch, rootState, rootGetters },

@@ -281,14 +291,17 @@ { id, userId }

listAll ({ state, dispatch, rootState }) {
Object.keys(state.lists).forEach(uid => {
dispatch('list', { corpuId: rootState.cml.corpus.actives[uid], uid })
listAll({ state, dispatch, rootState }) {
Object.keys(state.lists).forEach(corpuUid => {
dispatch('list', {
corpuId: rootState.cml.corpus.actives[corpuUid],
corpuUid
})
})
},
list ({ dispatch, commit, rootGetters }, { corpuId, uid }) {
dispatch('cml/sync/start', `layersList-${uid}`, { root: true })
list({ dispatch, commit, rootGetters }, { corpuId, corpuUid }) {
dispatch('cml/sync/start', `layersList-${corpuUid}`, { root: true })
return api
.getLayers({ filter: { id_corpus: corpuId } })
.then(r => {
dispatch('cml/sync/stop', `layersList-${uid}`, { root: true })
dispatch('cml/sync/stop', `layersList-${corpuUid}`, { root: true })
const layers = r.data.map(l => ({

@@ -311,9 +324,10 @@ name: l.name,

}))
commit('list', { layers, uid })
dispatch('setAll', { uid })
commit('list', { layers, corpuUid })
dispatch('setAll', { corpuUid })
return layers
})
.catch(e => {
dispatch('cml/sync/stop', `layersList-${uid}`, { root: true })
dispatch('cml/sync/stop', `layersList-${corpuUid}`, { root: true })
dispatch('cml/messages/error', e.message, { root: true })

@@ -325,17 +339,30 @@

setAll ({ state, dispatch, commit }, { uid }) {
commit('cml/annotations/init', { uid }, { root: true })
state.lists[uid].forEach(l => {
dispatch('set', { id: l.id, uid })
setAll({ state, dispatch, commit }, { corpuUid }) {
Object.keys(state.actives).forEach(uid => {
state.lists[corpuUid].forEach(l => {
dispatch('set', { id: l.id, corpuUid, uid })
})
})
},
set ({ dispatch, commit }, { id, uid }) {
set({ dispatch, commit }, { id, uid }) {
commit('set', { id, uid })
dispatch('cml/annotations/list', { layerId: id, uid }, { root: true })
dispatch(
'cml/annotations/layerSet',
{ layersUid: uid, layerId: id },
{ root: true }
)
},
unset ({ dispatch, commit }, { id, uid }) {
unset({ dispatch, commit }, { id, uid }) {
commit('unset', { id, uid })
commit('cml/annotations/reset', { layerId: id, uid }, { root: true })
dispatch(
'cml/annotations/layerUnset',
{ layersUid: uid, layerId: id },
{ root: true }
)
},
register({ state, commit }, { uid, corpuUid }) {
commit('register', { uid, corpuUid })
}

@@ -345,8 +372,7 @@ }

export const mutations = {
init (state, uid) {
Vue.set(state.lists, uid, [])
Vue.set(state.actives, uid, [])
register(state, { uid, corpuUid }) {
Vue.set(state.actives, uid, { corpuUid, ids: [] })
},
resetAll (state) {
resetAll(state) {
Vue.set(state, 'lists', {})

@@ -356,27 +382,29 @@ Vue.set(state, 'actives', {})

add (state, { layer, uid }) {
const index = state.lists[uid].length
Vue.set(state.lists[uid], index, layer)
add(state, { layer, corpuUid }) {
const index = state.lists[corpuUid].length
Vue.set(state.lists[corpuUid], index, layer)
},
remove (state, { id, uid }) {
const listIndex = state.lists[uid].findIndex(e => e.id === id)
remove(state, { id, corpuUid }) {
const listIndex = state.lists[corpuUid].findIndex(e => e.id === id)
if (listIndex !== -1) {
Vue.delete(state.lists[uid], listIndex)
Vue.delete(state.lists[corpuUid], listIndex)
}
const activeIndex = state.actives[uid].findIndex(e => e.id === id)
if (activeIndex !== -1) {
Vue.delete(state.actives[uid], activeIndex)
}
Object.keys(state.actives).forEach(uid => {
const activeIndex = state.actives[uid].ids.indexOf(id)
if (activeIndex !== -1) {
Vue.delete(state.actives[corpuUid], activeIndex)
}
})
},
update (state, { layer, uid }) {
const index = state.lists[uid].findIndex(l => l.id === layer.id)
Vue.set(state.lists[uid], index, layer)
update(state, { layer, corpuUid }) {
const index = state.lists[corpuUid].findIndex(l => l.id === layer.id)
Vue.set(state.lists[corpuUid], index, layer)
},
groupAdd (state, groupId) {
Object.keys(state.lists).forEach(uid => {
state.lists[uid].forEach(e => {
groupAdd(state, groupId) {
Object.keys(state.lists).forEach(corpuUid => {
state.lists[corpuUid].forEach(e => {
Vue.set(e.permissions.groups, groupId, 0)

@@ -387,5 +415,5 @@ })

groupRemove (state, groupId) {
Object.keys(state.lists).forEach(uid => {
state.lists[uid].forEach(e => {
groupRemove(state, groupId) {
Object.keys(state.lists).forEach(corpuUid => {
state.lists[corpuUid].forEach(e => {
Vue.delete(e.permissions.groups, groupId)

@@ -396,5 +424,5 @@ })

userAdd (state, userId) {
Object.keys(state.lists).forEach(uid => {
state.lists[uid].forEach(e => {
userAdd(state, userId) {
Object.keys(state.lists).forEach(corpuUid => {
state.lists[corpuUid].forEach(e => {
Vue.set(e.permissions.users, userId, 0)

@@ -405,5 +433,5 @@ })

userRemove (state, userId) {
Object.keys(state.lists).forEach(uid => {
state.lists[uid].forEach(e => {
userRemove(state, userId) {
Object.keys(state.lists).forEach(corpuUid => {
state.lists[corpuUid].forEach(e => {
Vue.delete(e.permissions.users, userId)

@@ -414,7 +442,11 @@ })

groupPermissionsUpdate (state, { id, groupId, permission }) {
Object.keys(state.lists).forEach(uid => {
const index = state.lists[uid].findIndex(e => e.id === id)
groupPermissionsUpdate(state, { id, groupId, permission }) {
Object.keys(state.lists).forEach(corpuUid => {
const index = state.lists[corpuUid].findIndex(e => e.id === id)
if (index !== -1) {
Vue.set(state.lists[uid][index].permissions.groups, groupId, permission)
Vue.set(
state.lists[corpuUid][index].permissions.groups,
groupId,
permission
)
}

@@ -424,7 +456,11 @@ })

userPermissionsUpdate (state, { id, userId, permission }) {
Object.keys(state.lists).forEach(uid => {
const index = state.lists[uid].findIndex(e => e.id === id)
userPermissionsUpdate(state, { id, userId, permission }) {
Object.keys(state.lists).forEach(corpuUid => {
const index = state.lists[corpuUid].findIndex(e => e.id === id)
if (index !== -1) {
Vue.set(state.lists[uid][index].permissions.users, userId, permission)
Vue.set(
state.lists[corpuUid][index].permissions.users,
userId,
permission
)
}

@@ -434,17 +470,15 @@ })

list (state, { layers, uid }) {
Vue.set(state.lists, uid, layers)
list(state, { layers, corpuUid }) {
Vue.set(state.lists, corpuUid, layers)
},
set (state, { id, uid }) {
if (!state.actives[uid]) {
Vue.set(state.actives, uid, [id])
} else {
Vue.set(state.actives[uid], state.actives[uid].length, id)
}
set(state, { id, uid }) {
Vue.set(state.actives[uid].ids, state.actives[uid].ids.length, id)
},
unset (state, { id, uid }) {
const index = state.actives[uid].indexOf(id)
Vue.delete(state.actives[uid], index)
unset(state, { id, uid }) {
const index = state.actives[uid].ids.findIndex(layerId => layerId === id)
if (index !== -1) {
Vue.delete(state.actives[uid].ids, index)
}
}

@@ -451,0 +485,0 @@ }

@@ -14,3 +14,3 @@ import Vue from 'vue'

export const actions = {
add ({ state, commit, dispatch, rootGetters }, { element }) {
add({ state, commit, dispatch, rootGetters }, { element }) {
dispatch('cml/sync/start', `mediasAdd`, { root: true })

@@ -27,8 +27,10 @@ return api

const media = mediaFormat(r.data)
Object.keys(state.lists).forEach(uid => {
if (rootGetters['cml/corpus/id'](uid) === element.corpuId) {
commit('add', { media, uid })
if (!state.actives[uid]) {
commit('set', { id: media.id, uid })
}
Object.keys(state.lists).forEach(corpuUid => {
if (rootGetters['cml/corpus/id'](corpuUid) === element.corpuId) {
commit('add', { media, corpuUid })
Object.keys(state.actives).forEach(uid => {
if (state.actives[uid].corpuUid === corpuUid) {
commit('set', { id: media.id, corpuUid, uid })
}
})
}

@@ -48,3 +50,3 @@ })

remove ({ state, commit, dispatch }, { id }) {
remove({ state, commit, dispatch }, { id }) {
dispatch('cml/sync/start', `mediasRemove`, { root: true })

@@ -55,7 +57,10 @@ return api

dispatch('cml/sync/stop', `mediasRemove`, { root: true })
Object.keys(state.lists).forEach(uid => {
commit('remove', { id, uid })
Object.keys(state.lists).forEach(corpuUid => {
const listIndex = state.lists[corpuUid].findIndex(m => m.id === id)
if (listIndex !== -1) {
commit('remove', { listIndex, corpuUid })
}
})
dispatch('unsetAll', { id })
dispatch('cml/messages/success', 'Medium removed', { root: true })
dispatch('setAll', { id })

@@ -72,3 +77,3 @@ return id

update ({ state, commit, dispatch, rootGetters }, { element }) {
update({ state, commit, dispatch, rootGetters }, { element }) {
dispatch('cml/sync/start', `mediasUpdate`, { root: true })

@@ -87,6 +92,5 @@ return api

media.description = r.data.description || {}
Object.keys(state.lists).forEach(uid => {
if (rootGetters['cml/corpus/id'](uid) === element.corpuId) {
console.log('media-update', uid, media)
commit('update', { media, uid })
Object.keys(state.lists).forEach(corpuUid => {
if (rootGetters['cml/corpus/id'](corpuUid) === element.corpuId) {
commit('update', { media, corpuUid })
}

@@ -106,18 +110,21 @@ })

list ({ dispatch, commit }, { corpuId, uid }) {
dispatch('cml/sync/start', `mediasList-${uid}`, { root: true })
list({ dispatch, commit }, { corpuId, corpuUid }) {
dispatch('cml/sync/start', `mediasList-${corpuUid}`, { root: true })
return api
.getMedia({ filter: { id_corpus: corpuId } })
.then(r => {
dispatch('cml/sync/stop', `mediasList-${uid}`, { root: true })
dispatch('cml/sync/stop', `mediasList-${corpuUid}`, { root: true })
const medias = r.data.map(media => {
return mediaFormat(media)
})
commit('list', { medias, uid })
dispatch('set', { uid })
commit('list', { medias, corpuUid })
Object.keys(state.actives).forEach(uid => {
dispatch('set', { corpuUid, uid })
})
return medias
})
.catch(e => {
dispatch('cml/sync/stop', `mediasList-${uid}`, { root: true })
dispatch('cml/sync/stop', `mediasList-${corpuUid}`, { root: true })
dispatch('cml/messages/error', e.message, { root: true })

@@ -129,23 +136,33 @@

setAll ({ state, dispatch }, { id }) {
register({ state, commit }, uid) {
commit('register', uid)
},
unsetAll({ state, dispatch }, { id }) {
Object.keys(state.actives).forEach(uid => {
if (state.actives[uid] === id) {
dispatch('set', { uid })
if (state.actives[uid].id === id) {
dispatch('set', { corpuUid: state.actives[uid].corpuUid, uid })
}
dispatch('cml/annotations/listAll', { uid }, { root: true })
})
},
set ({ state, getters, dispatch, commit }, { id, uid }) {
set({ state, getters, dispatch, commit }, { id, corpuUid, uid }) {
if (state.properties[uid] && state.properties[uid].isPlaying) {
dispatch('pause', uid)
dispatch('pause', { uid })
}
commit('set', { id: id || getters.id(uid), uid })
commit('set', { id: id || getters.id({ corpuUid, uid }), corpuUid, uid })
dispatch(
'cml/annotations/mediaSet',
{
mediaId: state.actives[uid].id,
mediaUid: uid
},
{ root: true }
)
},
play ({ state, commit }, uid) {
play({ state, commit }, { uid }) {
const timeStart = Date.now()
const timeCurrent = state.properties[uid].timeCurrent
interval = setInterval(() => {
state.properties[uid].interval = setInterval(() => {
var timeEllapsed = Date.now() - timeStart

@@ -155,23 +172,27 @@ // commit('timeCurrent', { time: timeCurrent + timeEllapsed, uid })

}, 0)
commit('play', uid)
commit('play', { uid })
},
pause ({ commit }, uid) {
clearInterval(interval)
commit('pause', uid)
pause({ state, commit }, { uid }) {
clearInterval(state.properties[uid].interval)
commit('pause', { uid })
},
buffering ({ commit }, uid) {
clearInterval(interval)
buffering({ state, commit }, { uid }) {
clearInterval(state.properties[uid].interval)
},
stop ({ commit, dispatch }, uid) {
clearInterval(interval)
commit('pause', uid)
dispatch('seek', { options: { ratio: 0, serverRequest: true }, uid })
stop({ state, commit, dispatch }, { uid }) {
clearInterval(state.properties[uid].interval)
commit('pause', { uid })
dispatch('seek', {
ratio: 0,
serverRequest: true,
uid
})
},
seek ({ state, commit, dispatch }, { ratio, serverRequest, uid }) {
seek({ state, commit, dispatch }, { ratio, serverRequest, uid }) {
if (state.properties[uid].isPlaying) {
clearInterval(interval)
clearInterval(state.properties[uid].interval)
}

@@ -193,7 +214,7 @@ // commit('timeCurrent', {

export const getters = {
id: state => uid =>
id: state => ({ corpuUid, uid }) =>
(state.actives[uid] &&
state.lists[uid].map(c => c.id).indexOf(state.actives[uid]) !== -1 &&
state.actives[uid]) ||
(state.lists[uid][0] && state.lists[uid][0].id) ||
state.lists[corpuUid].find(c => c.id === state.actives[uid].id) &&
state.actives[uid].id) ||
(state.lists[corpuUid][0] && state.lists[corpuUid][0].id) ||
null

@@ -203,9 +224,8 @@ }

export const mutations = {
init (state, uid) {
Vue.set(state.lists, uid, [])
register(state, uid) {
Vue.set(state.actives, uid, null)
Vue.set(state.properties, uid, {})
Vue.set(state.properties, uid, null)
},
resetAll (state) {
resetAll(state) {
Vue.set(state, 'lists', {})

@@ -216,25 +236,22 @@ Vue.set(state, 'actives', {})

add (state, { media, uid }) {
const index = state.lists[uid].length
Vue.set(state.lists[uid], index, media)
add(state, { media, corpuUid }) {
const index = state.lists[corpuUid].length
Vue.set(state.lists[corpuUid], index, media)
},
update (state, { media, uid }) {
const index = state.lists[uid].findIndex(m => m.id === media.id)
Vue.set(state.lists[uid], index, media)
update(state, { media, corpuUid }) {
const index = state.lists[corpuUid].findIndex(m => m.id === media.id)
Vue.set(state.lists[corpuUid], index, media)
},
remove (state, { id, uid }) {
const listIndex = state.lists[uid].findIndex(m => m.id === id)
if (listIndex !== -1) {
Vue.delete(state.lists[uid], listIndex)
}
remove(state, { listIndex, corpuUid }) {
Vue.delete(state.lists[corpuUid], listIndex)
},
list (state, { medias, uid }) {
Vue.set(state.lists, uid, medias)
list(state, { medias, corpuUid }) {
Vue.set(state.lists, corpuUid, medias)
},
set (state, { id, uid }) {
Vue.set(state.actives, uid, id)
set(state, { id, corpuUid, uid }) {
Vue.set(state.actives, uid, { corpuUid, id })
Vue.set(state.properties, uid, {

@@ -249,19 +266,19 @@ timeTotal: 0,

loaded (state, { isLoaded, uid }) {
loaded(state, { isLoaded, uid }) {
Vue.set(state.properties[uid], 'isLoaded', isLoaded)
},
play (state, uid) {
play(state, { uid }) {
Vue.set(state.properties[uid], 'isPlaying', true)
},
pause (state, uid) {
pause(state, { uid }) {
Vue.set(state.properties[uid], 'isPlaying', false)
},
timeTotal (state, { time, uid }) {
timeTotal(state, { time, uid }) {
Vue.set(state.properties[uid], 'timeTotal', time)
},
seek (state, { options, uid }) {
seek(state, { options, uid }) {
Vue.set(state.properties[uid], 'seek', options)

@@ -268,0 +285,0 @@ }

@@ -8,3 +8,3 @@ import { dateCurrent } from './_helpers'

export const actions = {
success ({ commit }, content) {
success({ commit }, content) {
commit('add', { content, type: 'success', id: dateCurrent() })

@@ -16,3 +16,3 @@ setTimeout(_ => {

error ({ commit }, content) {
error({ commit }, content) {
commit('add', { content, type: 'error', id: dateCurrent() })

@@ -26,7 +26,7 @@ setTimeout(_ => {

export const mutations = {
remove (state) {
remove(state) {
state.list.shift()
},
add (state, message) {
add(state, message) {
state.list.push(message)

@@ -33,0 +33,0 @@ }

@@ -10,3 +10,3 @@ import Vue from 'vue'

export const mutations = {
open (state, { config, element }) {
open(state, { config, element }) {
state.visible = true

@@ -17,3 +17,3 @@ state.config = config

close (state) {
close(state) {
state.visible = false

@@ -23,3 +23,3 @@ state.config = {}

fieldUpdate (state, { name, value }) {
fieldUpdate(state, { name, value }) {
Vue.set(state.element, name, value)

@@ -26,0 +26,0 @@ }

@@ -6,3 +6,3 @@ export const state = {

export const actions = {
all ({ dispatch }) {
all({ dispatch }) {
dispatch(`cml/set`, {}, { root: true }).then(r => {

@@ -13,7 +13,7 @@ dispatch('cml/messages/success', 'Synced with server', { root: true })

start ({ state }, name) {
start({ state }, name) {
state.list.push(name)
},
stop ({ state }, name) {
stop({ state }, name) {
state.list = state.list.filter(n => n !== name)

@@ -20,0 +20,0 @@ }

@@ -15,3 +15,3 @@ import api from './_api'

export const actions = {
login ({ commit, dispatch }, config) {
login({ commit, dispatch }, config) {
dispatch('cml/sync/start', 'userLogin', { root: true })

@@ -36,3 +36,3 @@ return api

set ({ commit, dispatch }) {
set({ commit, dispatch }) {
dispatch('cml/sync/start', 'userSet', { root: true })

@@ -64,3 +64,3 @@ return api

logout ({ state, commit, dispatch }) {
logout({ state, commit, dispatch }) {
dispatch('cml/sync/start', 'userLogout', { root: true })

@@ -134,3 +134,3 @@ return api

export const mutations = {
set (state, user) {
set(state, user) {
state.isLogged = true

@@ -146,3 +146,3 @@ state.isAdmin = user.role === 'admin'

reset (state) {
reset(state) {
state.isLogged = false

@@ -158,7 +158,7 @@ state.isAdmin = false

groupAdd (state, groupId) {
groupAdd(state, groupId) {
state.groupIds.push(groupId)
},
groupRemove (state, groupId) {
groupRemove(state, groupId) {
state.groupIds = state.groupIds.filter(id => id !== groupId)

@@ -165,0 +165,0 @@ }

@@ -10,3 +10,3 @@ import Vue from 'vue'

export const actions = {
add ({ commit, dispatch }, { element }) {
add({ commit, dispatch }, { element }) {
dispatch('cml/sync/start', 'usersAdd', { root: true })

@@ -38,3 +38,3 @@ return api

update ({ commit, dispatch, rootState }, { element }) {
update({ commit, dispatch, rootState }, { element }) {
dispatch('cml/sync/start', 'usersUpdate', { root: true })

@@ -66,3 +66,3 @@ return api

remove ({ commit, dispatch }, { id }) {
remove({ commit, dispatch }, { id }) {
dispatch('cml/sync/start', 'usersRemove', { root: true })

@@ -88,3 +88,3 @@ return api

list ({ commit, dispatch }) {
list({ commit, dispatch }) {
dispatch('cml/sync/start', 'usersList', { root: true })

@@ -123,11 +123,11 @@ return api

export const mutations = {
reset (state) {
reset(state) {
Vue.set(state, 'list', [])
},
add (state, user) {
add(state, user) {
state.list.push(user)
},
update (state, user) {
update(state, user) {
const index = state.list.findIndex(u => u.id === user.id)

@@ -137,3 +137,3 @@ Vue.set(state.list, index, user)

remove (state, userId) {
remove(state, userId) {
const index = state.list.findIndex(u => u.id === userId)

@@ -143,3 +143,3 @@ Vue.delete(state.list, index)

list (state, users) {
list(state, users) {
Vue.set(state, 'list', users)

@@ -146,0 +146,0 @@ }

@@ -16,3 +16,3 @@ import log from '../js/log'

export const actions = {
set ({ state, commit }) {
set({ state, commit }) {
const width = window.innerWidth

@@ -44,3 +44,3 @@ const height = window.innerHeight

export const mutations = {
set (state, { animate, name, width, height }) {
set(state, { animate, name, width, height }) {
state.name = name

@@ -47,0 +47,0 @@ state.animate = animate

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc