mirror of
https://github.com/nexus-stc/hyperboria
synced 2024-12-23 10:07:46 +01:00
- feat(cognitron): Repair JS build
1 internal commit(s) GitOrigin-RevId: a636499568b3ea7a0b979be07265e434052bffc4
This commit is contained in:
parent
6ce4308da5
commit
1ca0b80fe0
@ -26,8 +26,8 @@ http_archive(
|
||||
|
||||
http_archive(
|
||||
name = "build_bazel_rules_nodejs",
|
||||
sha256 = "1134ec9b7baee008f1d54f0483049a97e53a57cd3913ec9d6db625549c98395a",
|
||||
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.0/rules_nodejs-3.4.0.tar.gz"],
|
||||
sha256 = "a160d9ac88f2aebda2aa995de3fa3171300c076f06ad1d7c2e1385728b8442fa",
|
||||
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.1/rules_nodejs-3.4.1.tar.gz"],
|
||||
)
|
||||
|
||||
http_archive(
|
||||
|
@ -1,20 +1,22 @@
|
||||
load("//rules/nodejs:common.bzl", "js_library")
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
|
||||
|
||||
js_library(
|
||||
name = "base-client",
|
||||
package_name = "base-client",
|
||||
srcs = ["base-client.js"],
|
||||
data = [
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//library/js:utils",
|
||||
"@npm//axios",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = "utils",
|
||||
package_name = "utils",
|
||||
srcs = ["utils.js"],
|
||||
data = [
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"@npm//lodash",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { removeUndefined, toCamel, toSnake } from '~/library/js/utils'
|
||||
import { removeUndefined, toCamel, toSnake } from 'utils'
|
||||
import Axios from 'axios'
|
||||
|
||||
export default class BaseClient {
|
||||
|
@ -1,7 +0,0 @@
|
||||
load("//rules/nodejs:common.bzl", "js_library")
|
||||
|
||||
js_library(
|
||||
name = "components",
|
||||
srcs = glob(["**/*.vue"]),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
@ -1,21 +0,0 @@
|
||||
<template lang="pug">
|
||||
b-container
|
||||
b-modal(ref="newElementModal", :title="'New ' + typeName", @ok="handleAddElementOk", @cancel="handleAddElementCancel", @shown="$refs.newElement.focus()")
|
||||
p.text-modal
|
||||
b-form-input.form-control-sm(ref="newElement", v-model="newElement")
|
||||
b-badge.ml-2(v-for="(element, elementIndex) of value", :key="elementIndex")
|
||||
span {{ getDisplayName(element) }}
|
||||
i.ml-1.fa.fa-sm.fa-remove(@click="deleteElement(elementIndex)", v-if="mutable")
|
||||
b-badge.ml-2(@click="handleAddElementInit", variant="danger", v-if="mutable")
|
||||
i.fa.fa-md.fa-plus
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import BaseList from '~/library/js/components/BaseList'
|
||||
|
||||
export default {
|
||||
name: 'BadgeList',
|
||||
extends: BaseList
|
||||
}
|
||||
</script>
|
@ -1,56 +0,0 @@
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'BaseList',
|
||||
props: {
|
||||
value: {
|
||||
type: Array,
|
||||
default: function () { return [] }
|
||||
},
|
||||
typeName: {
|
||||
type: String,
|
||||
default: 'element'
|
||||
},
|
||||
getDisplayName: {
|
||||
type: Function,
|
||||
default: function (x) {
|
||||
return x
|
||||
}
|
||||
},
|
||||
afterProcess: {
|
||||
type: Function,
|
||||
default: function (x) {
|
||||
return x
|
||||
}
|
||||
},
|
||||
mutable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
newElement: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleAddElementInit () {
|
||||
this.$refs.newElementModal.show()
|
||||
},
|
||||
handleAddElementOk () {
|
||||
let processed = this.afterProcess(this.newElement)
|
||||
this.value.push(processed)
|
||||
this.$emit('added', processed)
|
||||
this.newElement = null
|
||||
},
|
||||
handleAddElementCancel () {
|
||||
this.newElement = null
|
||||
},
|
||||
deleteElement (elementIndex) {
|
||||
let deleted = this.value[elementIndex]
|
||||
this.value.splice(elementIndex, 1)
|
||||
this.$emit('deleted', deleted)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -1,21 +0,0 @@
|
||||
<template lang="pug">
|
||||
b-container
|
||||
b-modal(ref="newElementModal", :title="'New ' + typeName", @ok="handleAddElementOk", @cancel="handleAddElementCancel", @shown="$refs.newElement.focus()")
|
||||
p.text-modal
|
||||
b-form-input.form-control-sm(ref="newElement", v-model="newElement")
|
||||
div(v-for="(element, elementIndex) of value", :key="elementIndex")
|
||||
span {{ getDisplayName(element) }}
|
||||
i.ml-1.fa.fa-sm.fa-remove.float-right(@click="deleteElement(elementIndex)", v-if="mutable")
|
||||
hr
|
||||
b-button.btn-sm.float-right(@click="handleAddElementInit", variant="primary", v-if="mutable") Add
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import BaseList from '~/library/js/components/BaseList'
|
||||
|
||||
export default {
|
||||
name: 'CommonList',
|
||||
extends: BaseList
|
||||
}
|
||||
</script>
|
@ -1,45 +0,0 @@
|
||||
<template lang="pug">
|
||||
b-container(v-if="visible")
|
||||
.loader
|
||||
.message {{text}}
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Loader',
|
||||
props: {
|
||||
text: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
visible: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.loader {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
z-index: 100;
|
||||
background-color: black;
|
||||
opacity: 0.3;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
.message {
|
||||
padding: 50px 20px;
|
||||
background: white;
|
||||
width: 30%;
|
||||
text-align: center;
|
||||
position: fixed;
|
||||
left: 35%;
|
||||
top: 100px;
|
||||
z-index: 1000;
|
||||
font-size: 26px;
|
||||
}
|
||||
</style>
|
@ -2,14 +2,14 @@
|
||||
services:
|
||||
nexus-cognitron-web:
|
||||
depends_on:
|
||||
- summa
|
||||
- nexus-meta-api-envoy
|
||||
environment:
|
||||
ENV_TYPE: production
|
||||
NEXUS_COGNITRON_WEB_ipfs.gateway.url: https://cloudflare-ipfs.com
|
||||
NEXUS_COGNITRON_WEB_meta_api.url: http://nexus-meta-api:8080
|
||||
NEXUS_COGNITRON_WEB_meta_api.url: http://localhost:8080
|
||||
image: thesuperpirate/cognitron-web:latest
|
||||
ports:
|
||||
- '3000:80'
|
||||
- '3000:3000'
|
||||
nexus-meta-api:
|
||||
depends_on:
|
||||
- summa
|
||||
@ -19,15 +19,12 @@ services:
|
||||
NEXUS_META_API_grpc.port: 9090
|
||||
NEXUS_META_API_summa.url: 'http://summa:8082'
|
||||
image: thesuperpirate/meta-api:latest
|
||||
ports:
|
||||
- '9090:9090'
|
||||
nexus-meta-api-envoy:
|
||||
depends_on:
|
||||
- nexus-meta-api
|
||||
image: envoyproxy/envoy-dev:latest
|
||||
ports:
|
||||
- '8080:8080'
|
||||
- '9901:9901'
|
||||
volumes:
|
||||
- './nexus-meta-api-envoy.yaml:/etc/envoy/envoy.yaml'
|
||||
summa:
|
||||
@ -37,8 +34,6 @@ services:
|
||||
SUMMA_http.address: '0.0.0.0'
|
||||
SUMMA_http.port: '8082'
|
||||
image: izihawa/summa:latest
|
||||
ports:
|
||||
- '8082:8082'
|
||||
volumes:
|
||||
- '${DATA_PATH}:/summa/data'
|
||||
version: "3"
|
||||
|
@ -1,7 +1,18 @@
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
|
||||
load("@io_bazel_rules_docker//container:container.bzl", "container_push")
|
||||
load("@io_bazel_rules_docker//nodejs:image.bzl", "nodejs_image")
|
||||
load("@npm//nuxt:index.bzl", "nuxt")
|
||||
load("//rules/nodejs:common.bzl", "js_library")
|
||||
|
||||
files = ["nuxt.config.js"] + glob([
|
||||
"assets/**",
|
||||
"components/**/*.vue",
|
||||
"layouts/*.vue",
|
||||
"middleware/*.js",
|
||||
"pages/**/*.vue",
|
||||
"plugins/*.js",
|
||||
"static/*",
|
||||
"store/*.js",
|
||||
])
|
||||
|
||||
deps = [
|
||||
"@npm//@nuxtjs/axios",
|
||||
@ -18,27 +29,20 @@ deps = [
|
||||
]
|
||||
|
||||
js_library(
|
||||
name = "nuxt-srcs",
|
||||
srcs = ["nuxt.config.js"] + glob([
|
||||
"assets/**",
|
||||
"components/**/*.vue",
|
||||
"layouts/*.vue",
|
||||
"middleware/*.js",
|
||||
"pages/**/*.vue",
|
||||
"plugins/*.js",
|
||||
"static/*",
|
||||
"store/*.js",
|
||||
]),
|
||||
name = "nexus-cognitron-web",
|
||||
package_name = "nexus-cognitron-web",
|
||||
srcs = files,
|
||||
deps = deps,
|
||||
)
|
||||
|
||||
nuxt(
|
||||
name = "web_dev",
|
||||
name = "web-dev",
|
||||
args = [
|
||||
"-c",
|
||||
"nexus/cognitron/web/nuxt.config.js",
|
||||
"--watch-poll",
|
||||
],
|
||||
data = [":nuxt-srcs"] + deps,
|
||||
data = [":nexus-cognitron-web"],
|
||||
)
|
||||
|
||||
nuxt(
|
||||
@ -50,7 +54,8 @@ nuxt(
|
||||
"nexus/cognitron/web/nuxt.config.js",
|
||||
"--buildDir=$(@D)",
|
||||
],
|
||||
data = [":nuxt-srcs"] + deps,
|
||||
data = files + deps,
|
||||
link_workspace_root = True,
|
||||
output_dir = True,
|
||||
)
|
||||
|
||||
|
@ -5,10 +5,10 @@ if (buildDir) {
|
||||
buildDir = 'nexus/cognitron/web/.nuxt'
|
||||
}
|
||||
|
||||
export default {
|
||||
module.exports = {
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
port: 8082
|
||||
port: 3000
|
||||
},
|
||||
buildDir: buildDir,
|
||||
srcDir: 'nexus/cognitron/web',
|
||||
@ -40,11 +40,11 @@ export default {
|
||||
|
||||
publicRuntimeConfig: {
|
||||
meta_api: {
|
||||
url: process.env.NEXUS_COGNITRON_WEB_meta_api.url || 'http://nexus-meta-api:8080'
|
||||
url: process.env['NEXUS_COGNITRON_WEB_meta_api.url'] || 'http://localhost:8080'
|
||||
},
|
||||
ipfs: {
|
||||
gateway: {
|
||||
url: process.env.NEXUS_COGNITRON_WEB_ipfs.gateway.url || 'https://ipfs.io'
|
||||
url: process.env['NEXUS_COGNITRON_WEB_ipfs.gateway.url'] || 'https://ipfs.io'
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -80,6 +80,7 @@ export default {
|
||||
build: {
|
||||
extend (config) {
|
||||
config.resolve.alias['~'] = process.cwd()
|
||||
}
|
||||
},
|
||||
transpile: ['nexus-meta-api-js-client'],
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import MetaApi from '~/nexus/meta_api/js/client'
|
||||
import MetaApi from 'nexus-meta-api-js-client'
|
||||
|
||||
export default ({ $config }, inject) => {
|
||||
const metaApi = new MetaApi($config.metaApi)
|
||||
const metaApi = new MetaApi($config.meta_api)
|
||||
inject('meta_api', metaApi)
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ py3_image(
|
||||
"//library/aiopostgres",
|
||||
"//library/configurator",
|
||||
"//library/logging",
|
||||
"//nexus/meta_api/proto:meta_api_grpc_py",
|
||||
"//nexus/meta_api/proto:meta-api-grpc-py",
|
||||
"//nexus/meta_api/query_extensionner",
|
||||
"//nexus/models/proto:models_proto_py",
|
||||
"//nexus/nlptools",
|
||||
|
@ -11,8 +11,8 @@ py_library(
|
||||
requirement("tenacity"),
|
||||
requirement("aiogrpcclient"),
|
||||
requirement("aiokit"),
|
||||
"//nexus/meta_api/proto:meta_api_grpc_py",
|
||||
"//nexus/meta_api/proto:meta_api_proto_py",
|
||||
"//nexus/meta_api/proto:meta-api-grpc-py",
|
||||
"//nexus/meta_api/proto:meta-api-proto-py",
|
||||
"//nexus/models/proto:models_proto_py",
|
||||
],
|
||||
)
|
||||
|
@ -1,12 +1,11 @@
|
||||
load("//rules/nodejs:common.bzl", "js_library")
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
|
||||
|
||||
js_library(
|
||||
name = "client",
|
||||
package_name = "nexus-meta-api-js-client",
|
||||
srcs = glob(["*.js"]),
|
||||
data = [
|
||||
"//library/js:base-client",
|
||||
"//library/js:utils",
|
||||
"//nexus/meta_api/proto:meta_api_grpc_web_js",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//nexus/meta_api/proto:meta-api-grpc-web-js",
|
||||
],
|
||||
)
|
||||
|
@ -1,5 +1,5 @@
|
||||
import documentsProto from '~/nexus/meta_api/proto/documents_service_grpc_web_pb'
|
||||
import searchProto from '~/nexus/meta_api/proto/search_service_grpc_web_pb'
|
||||
import documentsProto from 'meta-api-grpc-web-js/meta-api-grpc-web-js_pb/nexus/meta_api/proto/documents_service_grpc_web_pb'
|
||||
import searchProto from 'meta-api-grpc-web-js/meta-api-grpc-web-js_pb/nexus/meta_api/proto/search_service_grpc_web_pb'
|
||||
|
||||
export default class MetaApi {
|
||||
constructor (config) {
|
||||
|
@ -6,7 +6,7 @@ load("@rules_proto_grpc//js:defs.bzl", "js_grpc_web_library")
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
proto_library(
|
||||
name = "meta_api_proto",
|
||||
name = "meta-api-proto",
|
||||
srcs = glob([
|
||||
"*.proto",
|
||||
]),
|
||||
@ -17,27 +17,29 @@ proto_library(
|
||||
)
|
||||
|
||||
py_proto_library(
|
||||
name = "meta_api_proto_py",
|
||||
deps = [":meta_api_proto"],
|
||||
name = "meta-api-proto-py",
|
||||
deps = [":meta-api-proto"],
|
||||
)
|
||||
|
||||
py_grpc_library(
|
||||
name = "meta_api_grpc_py",
|
||||
srcs = [":meta_api_proto"],
|
||||
deps = [":meta_api_proto_py"],
|
||||
name = "meta-api-grpc-py",
|
||||
srcs = [":meta-api-proto"],
|
||||
deps = [":meta-api-proto-py"],
|
||||
)
|
||||
|
||||
rust_proto_library(
|
||||
name = "meta_api_proto_rust",
|
||||
name = "meta-api-proto-rust",
|
||||
rust_deps = ["//rules/rust/cargo:protobuf"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [":meta_api_proto"],
|
||||
deps = [":meta-api-proto"],
|
||||
)
|
||||
|
||||
js_grpc_web_library(
|
||||
name = "meta_api_grpc_web_js",
|
||||
prefix_path = "../../../../",
|
||||
protos = [":meta_api_proto"],
|
||||
name = "meta-api-grpc-web-js",
|
||||
protos = [
|
||||
":meta-api-proto",
|
||||
"//nexus/models/proto:models_proto",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//nexus/models/proto:models_proto_js"],
|
||||
)
|
||||
|
@ -26,7 +26,6 @@ rust_proto_library(
|
||||
|
||||
js_proto_library(
|
||||
name = "models_proto_js",
|
||||
prefix_path = "../../../../",
|
||||
protos = [":models_proto"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user