From: Daniel Kos Date: Tue, 7 Aug 2018 11:34:15 +0000 (+0200) Subject: refs #13856 Merge branch 'origin/13856-upload-component' X-Git-Tag: 1.2.0~12 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/40952ad86a823635968c9abc5d6feacef316cffd refs #13856 Merge branch 'origin/13856-upload-component' # Conflicts: # src/services/services.ts # src/views-components/dialog-create/dialog-collection-create.tsx # src/views-components/dialog-update/dialog-collection-update.tsx Arvados-DCO-1.1-Signed-off-by: Daniel Kos --- 40952ad86a823635968c9abc5d6feacef316cffd diff --cc src/services/services.ts index 87c668f2,6e8d0f94..e77b5d3a --- a/src/services/services.ts +++ b/src/services/services.ts @@@ -9,9 -9,9 +9,10 @@@ import { LinkService } from "./link-ser import { FavoriteService } from "./favorite-service/favorite-service"; import { AxiosInstance } from "axios"; import { CollectionService } from "./collection-service/collection-service"; +import { TagService } from "./tag-service/tag-service"; import Axios from "axios"; import { CollectionFilesService } from "./collection-files-service/collection-files-service"; + import { KeepService } from "./keep-service/keep-service"; export interface ServiceRepository { apiClient: AxiosInstance; @@@ -35,8 -36,7 +38,8 @@@ export const createServices = (baseUrl const projectService = new ProjectService(apiClient); const linkService = new LinkService(apiClient); const favoriteService = new FavoriteService(linkService, groupsService); - const collectionService = new CollectionService(apiClient); + const collectionService = new CollectionService(apiClient, keepService); + const tagService = new TagService(linkService); const collectionFilesService = new CollectionFilesService(collectionService); return { diff --cc src/services/tag-service/tag-service.ts index c3019a65,00000000..084603eb mode 100644,000000..100644 --- a/src/services/tag-service/tag-service.ts +++ b/src/services/tag-service/tag-service.ts @@@ -1,45 -1,0 +1,45 @@@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + +import { LinkService } from "../link-service/link-service"; +import { LinkClass } from "../../models/link"; +import { FilterBuilder } from "../../common/api/filter-builder"; +import { TagTailType, TagResource } from "../../models/tag"; +import { OrderBuilder } from "../../common/api/order-builder"; + +export class TagService { + + constructor(private linkService: LinkService) { } + + create(uuid: string, data: { key: string; value: string } ) { + return this.linkService + .create({ + headUuid: uuid, + tailUuid: TagTailType.COLLECTION, + linkClass: LinkClass.TAG, + name: '', + properties: data + }) + .then(tag => tag as TagResource ); + } + + list(uuid: string) { + const filters = FilterBuilder - .create() ++ .create() + .addEqual("headUuid", uuid) + .addEqual("tailUuid", TagTailType.COLLECTION) + .addEqual("linkClass", LinkClass.TAG); + + const order = OrderBuilder + .create() + .addAsc('createdAt'); + + return this.linkService + .list({ filters, order }) + .then(results => { + return results.items.map((tag => tag as TagResource )); + }); + } + - } ++} diff --cc src/views-components/dialog-create/dialog-collection-create.tsx index 874ce138,6083b640..804aae11 --- a/src/views-components/dialog-create/dialog-collection-create.tsx +++ b/src/views-components/dialog-create/dialog-collection-create.tsx @@@ -12,7 -12,11 +12,11 @@@ import DialogContent from '@material-ui import DialogTitle from '@material-ui/core/DialogTitle'; import { Button, StyleRulesCallback, WithStyles, withStyles, CircularProgress } from '@material-ui/core'; -import { COLLECTION_NAME_VALIDATION, COLLECTION_DESCRIPTION_VALIDATION } from '../../validators/create-project/create-project-validator'; +import { COLLECTION_NAME_VALIDATION, COLLECTION_DESCRIPTION_VALIDATION } from '../../validators/create-collection/create-collection-validator'; + import { FileUpload } from "../../components/file-upload/file-upload"; + import { connect, DispatchProp } from "react-redux"; + import { RootState } from "../../store/store"; + import { collectionUploaderActions, UploadFile } from "../../store/collections/uploader/collection-uploader-actions"; type CssRules = "button" | "lastButton" | "formContainer" | "textField" | "createProgress" | "dialogActions"; diff --cc src/views-components/dialog-update/dialog-collection-update.tsx index 08eee418,dc278018..febe1124 --- a/src/views-components/dialog-update/dialog-collection-update.tsx +++ b/src/views-components/dialog-update/dialog-collection-update.tsx @@@ -7,8 -7,8 +7,8 @@@ import { reduxForm, Field } from 'redux import { compose } from 'redux'; import { ArvadosTheme } from '../../common/custom-theme'; import { Dialog, DialogActions, DialogContent, DialogTitle, TextField, StyleRulesCallback, withStyles, WithStyles, Button, CircularProgress } from '../../../node_modules/@material-ui/core'; -import { COLLECTION_NAME_VALIDATION, COLLECTION_DESCRIPTION_VALIDATION } from '../../validators/create-project/create-project-validator'; +import { COLLECTION_NAME_VALIDATION, COLLECTION_DESCRIPTION_VALIDATION } from '../../validators/create-collection/create-collection-validator'; - import { COLLECTION_FORM_NAME } from '../../store/collections/updator/collection-updator-action'; + import { COLLECTION_FORM_NAME } from '../../store/collections/updater/collection-updater-action'; type CssRules = 'content' | 'actions' | 'textField' | 'buttonWrapper' | 'saveButton' | 'circularProgress';