[ARVADOS-WORKBENCH2] created: 1.2.0-1002-g612cc2f

Git user git at public.curoverse.com
Tue Nov 27 05:04:13 EST 2018


        at  612cc2f292c66f073e464ae321e389bb96ef1a04 (commit)


commit 612cc2f292c66f073e464ae321e389bb96ef1a04
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Nov 27 11:01:34 2018 +0100

    Add loadVocabulary dispatch to project initialization
    
    Feature #14393
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/index.tsx b/src/index.tsx
index 88fd229..62db7f0 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -50,6 +50,7 @@ import HTML5Backend from 'react-dnd-html5-backend';
 import { initAdvanceFormProjectsTree } from '~/store/search-bar/search-bar-actions';
 import { repositoryActionSet } from '~/views-components/context-menu/action-sets/repository-action-set';
 import { sshKeyActionSet } from '~/views-components/context-menu/action-sets/ssh-key-action-set';
+import { loadVocabulary } from '~/store/vocabulary/vocabulary-actions';
 
 console.log(`Starting arvados [${getBuildInfo()}]`);
 
@@ -88,6 +89,7 @@ fetchConfig()
         store.dispatch(setBuildInfo());
         store.dispatch(setCurrentTokenDialogApiHost(apiHost));
         store.dispatch(setUuidPrefix(config.uuidPrefix));
+        store.dispatch(loadVocabulary);
 
         const TokenComponent = (props: any) => <ApiToken authService={services.authService} {...props} />;
         const MainPanelComponent = (props: any) => <MainPanel {...props} />;

commit fdd79297de2d58c0e25588beb9ddf4feda908afa
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Nov 27 10:59:15 2018 +0100

    Create loadVocabulary action
    
    Feature #14393
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/store/vocabulary/vocabulary-actions.ts b/src/store/vocabulary/vocabulary-actions.ts
new file mode 100644
index 0000000..799cffa
--- /dev/null
+++ b/src/store/vocabulary/vocabulary-actions.ts
@@ -0,0 +1,20 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch } from 'redux';
+import { ServiceRepository } from '~/services/services';
+import { propertiesActions } from '~/store/properties/properties-actions';
+import { VOCABULARY_PROPERTY_NAME, DEFAULT_VOCABULARY } from './vocabulary-selctors';
+import { isVocabulary } from '~/models/vocabulary';
+
+export const loadVocabulary = async (dispatch: Dispatch, _: {}, { vocabularyService }: ServiceRepository) => {
+    const vocabulary = await vocabularyService.getVocabulary();
+
+    dispatch(propertiesActions.SET_PROPERTY({
+        key: VOCABULARY_PROPERTY_NAME,
+        value: isVocabulary(vocabulary)
+            ? vocabulary
+            : DEFAULT_VOCABULARY,
+    }));
+};

commit 960d08db813ea71f171bf24d16a9264108356ab0
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Nov 27 10:58:22 2018 +0100

    Export DEFAULT_VOCABULARY value
    
    Feature #14393
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/store/vocabulary/vocabulary-selctors.ts b/src/store/vocabulary/vocabulary-selctors.ts
index aad4608..3bb1e50 100644
--- a/src/store/vocabulary/vocabulary-selctors.ts
+++ b/src/store/vocabulary/vocabulary-selctors.ts
@@ -7,7 +7,7 @@ import { Vocabulary } from '~/models/vocabulary';
 
 export const VOCABULARY_PROPERTY_NAME = 'vocabulary';
 
-const DEFAULT_VOCABULARY: Vocabulary = {
+export const DEFAULT_VOCABULARY: Vocabulary = {
     strict: false,
     tags: [],
 };

commit 1022c7ee7dadce002b00144eaacb5742ea0a7058
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Nov 27 10:57:31 2018 +0100

    Add function that validates whether a given value is a correct vcabulary
    
    Feature #14393
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/models/vocabulary.ts b/src/models/vocabulary.ts
index 3dbd475..c1c3c1e 100644
--- a/src/models/vocabulary.ts
+++ b/src/models/vocabulary.ts
@@ -2,6 +2,8 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
+import { isObject, has, every } from 'lodash/fp';
+
 export interface Vocabulary {
     strict: boolean;
     tags: Tag[];
@@ -11,3 +13,12 @@ export interface Tag {
     strict: boolean;
     values: string[];
 }
+
+const VOCABULARY_VALIDATORS = [
+    isObject,
+    has('strict'),
+    has('tags'),
+];
+
+export const isVocabulary = (value: any) =>
+    every(validator => validator(value), VOCABULARY_VALIDATORS);
\ No newline at end of file

commit b8bba11c446b95f2e82a397e0c55486d16fbb97f
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Nov 27 10:20:00 2018 +0100

    Add vocabularyService to ServiceRepository
    
    Feature #14393
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/services/services.ts b/src/services/services.ts
index 308505c..b0d3ba6 100644
--- a/src/services/services.ts
+++ b/src/services/services.ts
@@ -26,6 +26,7 @@ import { SearchService } from '~/services/search-service/search-service';
 import { PermissionService } from "~/services/permission-service/permission-service";
 import { RepositoriesService } from '~/services/repositories-service/repositories-service';
 import { AuthorizedKeysService } from '~/services/authorized-keys-service/authorized-keys-service';
+import { VocabularyService } from '~/services/vocabulary-service/vocabulary-service';
 
 export type ServiceRepository = ReturnType<typeof createServices>;
 
@@ -56,6 +57,7 @@ export const createServices = (config: Config, actions: ApiActions) => {
     const favoriteService = new FavoriteService(linkService, groupsService);
     const tagService = new TagService(linkService);
     const searchService = new SearchService();
+    const vocabularyService = new VocabularyService(config.vocabularyUrl);
 
     return {
         ancestorsService,
@@ -79,6 +81,7 @@ export const createServices = (config: Config, actions: ApiActions) => {
         userService,
         webdavClient,
         workflowService,
+        vocabularyService,
     };
 };
 

commit 042fbd69136d8f7090ac0295645d24dbc2a9f4a4
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Nov 27 10:18:25 2018 +0100

    Add VOCABULARY_URL to config schema in readme
    
    Feature #14393
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/README.md b/README.md
index 998d424..ea9bc02 100644
--- a/README.md
+++ b/README.md
@@ -40,7 +40,8 @@ The app will fetch runtime configuration when starting. By default it will try t
 Currently this configuration schema is supported:
 ```
 {
-    "API_HOST": "string"
+    "API_HOST": "string",
+    "VOCABULARY_URL": "string"
 }
 ```
 

commit 85c93508dc959ca5491998283565a8e125a56a86
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Nov 27 10:15:07 2018 +0100

    Add vocabulary url to config
    
    Feature #14393
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/common/config.ts b/src/common/config.ts
index 1ab7329..c74277e 100644
--- a/src/common/config.ts
+++ b/src/common/config.ts
@@ -49,6 +49,7 @@ export interface Config {
     version: string;
     websocketUrl: string;
     workbenchUrl: string;
+    vocabularyUrl: string;
 }
 
 export const fetchConfig = () => {
@@ -58,7 +59,10 @@ export const fetchConfig = () => {
         .catch(() => Promise.resolve(getDefaultConfig()))
         .then(config => Axios
             .get<Config>(getDiscoveryURL(config.API_HOST))
-            .then(response => ({ config: response.data, apiHost: config.API_HOST })));
+            .then(response => ({ 
+                config: {...response.data, vocabularyUrl: config.VOCABULARY_URL }, 
+                apiHost: config.API_HOST, 
+            })));
 
 };
 
@@ -105,15 +109,18 @@ export const mockConfig = (config: Partial<Config>): Config => ({
     version: '',
     websocketUrl: '',
     workbenchUrl: '',
+    vocabularyUrl: '',
     ...config
 });
 
 interface ConfigJSON {
     API_HOST: string;
+    VOCABULARY_URL: string;
 }
 
 const getDefaultConfig = (): ConfigJSON => ({
     API_HOST: process.env.REACT_APP_ARVADOS_API_HOST || "",
+    VOCABULARY_URL: "",
 });
 
 const getDiscoveryURL = (apiHost: string) => `${window.location.protocol}//${apiHost}/discovery/v1/apis/arvados/v1/rest`;

commit 54bc9553ec46b8f8244900fd19efca6030a6398a
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Nov 27 09:58:58 2018 +0100

    Create vocabulary service
    
    Feature #14393
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/services/vocabulary-service/vocabulary-service.ts b/src/services/vocabulary-service/vocabulary-service.ts
new file mode 100644
index 0000000..57bdd7c
--- /dev/null
+++ b/src/services/vocabulary-service/vocabulary-service.ts
@@ -0,0 +1,18 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import Axios from 'axios';
+import { Vocabulary } from '~/models/vocabulary';
+
+export class VocabularyService {
+    constructor(
+        private url: string
+    ) { }
+
+    getVocabulary() {
+        return Axios
+            .get<Vocabulary>(this.url)
+            .then(response => response.data);
+    }
+}

commit e843169bf01229e8735c3fb784441e9de2c23a14
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Nov 27 09:52:03 2018 +0100

    Create getVocabulary selector
    
    Feature #14393
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/store/vocabulary/vocabulary-selctors.ts b/src/store/vocabulary/vocabulary-selctors.ts
new file mode 100644
index 0000000..aad4608
--- /dev/null
+++ b/src/store/vocabulary/vocabulary-selctors.ts
@@ -0,0 +1,16 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { PropertiesState, getProperty } from '~/store/properties/properties';
+import { Vocabulary } from '~/models/vocabulary';
+
+export const VOCABULARY_PROPERTY_NAME = 'vocabulary';
+
+const DEFAULT_VOCABULARY: Vocabulary = {
+    strict: false,
+    tags: [],
+};
+
+export const getVocabulary = (state: PropertiesState) =>
+    getProperty<Vocabulary>(VOCABULARY_PROPERTY_NAME)(state) || DEFAULT_VOCABULARY;

commit 80fab904a6ea3f81465e70d879d9d0b722d072e6
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Nov 27 09:03:14 2018 +0100

    Create vocabulary model
    
    Feature #14393
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/models/vocabulary.ts b/src/models/vocabulary.ts
new file mode 100644
index 0000000..3dbd475
--- /dev/null
+++ b/src/models/vocabulary.ts
@@ -0,0 +1,13 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+export interface Vocabulary {
+    strict: boolean;
+    tags: Tag[];
+}
+
+export interface Tag {
+    strict: boolean;
+    values: string[];
+}

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list