diff --git a/.env b/.env index 3fe941f..a9d5c56 100644 --- a/.env +++ b/.env @@ -1 +1,2 @@ -VUE_APP_GENERATE_ID="http://localhost:5000/generateid" +VUE_APP_GENERATE_ID="https://generateid.dev.ror.org/generateid" +VUE_APP_GEONAMES_URL="https://generateid.dev.ror.org/address" diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 0000000..c8e489b --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,45 @@ +name: Deploy Dev +on: + push: + branches: + - "dev" + paths-ignore: + - '**/README.md' + - '**/workflows/**' +jobs: + run: + runs-on: ubuntu-latest + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + steps: + - uses: actions/checkout@v2 + - name: Install + run: npm ci + - name: Build + run: | + cp src/env.dev.ts src/env.ts; + npm run build + - name: Deploy + uses: reggionick/s3-deploy@v3.1.1 + with: + folder: dist + bucket: ${{ secrets.S3_BUCKET_CURATORFORM_DEV}} + bucket-region: ${{ secrets.S3_BUCKET_REGION }} + dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID_CURATORFORM_DEV }} + invalidation: /* + delete-removed: true + - name: Notify Slack + if: always() + uses: edge/simple-slack-notify@master + with: + channel: "#deployment-updates" + color: 'good' + text: "A new version of the is deployed to dev." + failure_text: '${env.GITHUB_WORKFLOW} (${env.GITHUB_RUN_NUMBER}) build failed' + fields: | + [{ "title": "Committed by", "value": "", "short": true }, + { "title": "Commit SHA", "value": "", "short": true }, + { "title": "Repository", "value": "", "short": true }, + { "title": "Branch", "value": "", "short": true }] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7f5e9d3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,42 @@ +name: Release +on: + release: + types: [published] +jobs: + run: + runs-on: ubuntu-latest + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + steps: + - uses: actions/checkout@v2 + - name: Install + run: npm ci + - name: Build + run: | + cp src/env.prod.ts src/env.ts; + npm run build + - name: Deploy + uses: reggionick/s3-deploy@v3.1.1 + with: + folder: dist + bucket: ${{ secrets.S3_BUCKET_CURATORFORM_PROD}} + bucket-region: ${{ secrets.S3_BUCKET_REGION }} + dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID_CURATORFORM_PROD }} + invalidation: /* + delete-removed: true + - name: Notify Slack + if: always() + uses: edge/simple-slack-notify@master + with: + channel: "#deployment-updates" + color: 'good' + text: "A new version of the is deployed to production." + failure_text: '${env.GITHUB_WORKFLOW} (${env.GITHUB_RUN_NUMBER}) build failed' + fields: | + [{ "title": "Commit message", "value": "${{ steps.extract_variables.outputs.MESSAGE }}" }, + { "title": "Committed by", "value": "", "short": true }, + { "title": "Commit SHA", "value": "", "short": true }, + { "title": "Repository", "value": "", "short": true }, + { "title": "Branch", "value": "", "short": true }] \ No newline at end of file diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml new file mode 100644 index 0000000..e872aba --- /dev/null +++ b/.github/workflows/staging.yml @@ -0,0 +1,46 @@ +name: Deploy Staging +on: + push: + branches: + - "staging" + paths-ignore: + - '**/README.md' + - '**/workflows/**' +jobs: + run: + runs-on: ubuntu-latest + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + steps: + - uses: actions/checkout@v2 + - name: Install + run: npm ci + - name: Build + run: | + cp src/env.staging.ts src/env.ts; + npm run build + - name: Deploy + uses: reggionick/s3-deploy@v3.1.1 + with: + folder: dist + bucket: ${{ secrets.S3_BUCKET_CURATORFORM_STAGING}} + bucket-region: ${{ secrets.S3_BUCKET_REGION }} + dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID_CURATORFORM_STAGING }} + invalidation: /* + delete-removed: true + - name: Notify Slack + if: always() + uses: edge/simple-slack-notify@master + with: + channel: "#deployment-updates" + color: 'good' + text: "A new version of the is deployed to staging." + failure_text: '${env.GITHUB_WORKFLOW} (${env.GITHUB_RUN_NUMBER}) build failed' + fields: | + [{ "title": "Commit message", "value": "${{ steps.extract_variables.outputs.MESSAGE }}" }, + { "title": "Committed by", "value": "", "short": true }, + { "title": "Commit SHA", "value": "", "short": true }, + { "title": "Repository", "value": "", "short": true }, + { "title": "Branch", "value": "", "short": true }] diff --git a/Dockerfile b/Dockerfile index 77841e2..9113d9b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ WORKDIR /app COPY package*.json ./ # install and cache project dependencies -RUN npm install +RUN npm ci # copy project files and folders to the current working directory (i.e. 'app' folder) COPY . . diff --git a/src/App.vue b/src/App.vue index 95bdd50..0f356b9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -29,4 +29,3 @@ - diff --git a/src/components/CustomRenderer.vue b/src/components/CustomRenderer.vue index e577816..d3c61f1 100644 --- a/src/components/CustomRenderer.vue +++ b/src/components/CustomRenderer.vue @@ -20,7 +20,7 @@ :required="control.required" :error-messages="control.errors" :value="control.data" - @change="onChange" + @change="getAddress" @focus="isFocused = true" @blur="isFocused = false" /> @@ -40,183 +40,140 @@ import { and, Tester, optionIs, -} from '@jsonforms/core'; -import { defineComponent, inject} from '@vue/composition-api' + CoreActions +} from '@jsonforms/core' +import { defineComponent, inject } from '@vue/composition-api' import { rendererProps, useJsonFormsControl, - RendererProps, -} from '@jsonforms/vue2'; -import { ControlWrapper } from '@jsonforms/vue2-vuetify'; -import { useVuetifyControl } from '@jsonforms/vue2-vuetify'; -import { VTextField } from 'vuetify/lib'; -import { CoreActions } from '@jsonforms/core'; -import set from 'lodash/fp/set'; -import { env } from '../env'; + RendererProps +} from '@jsonforms/vue2' +import { ControlWrapper, useVuetifyControl } from '@jsonforms/vue2-vuetify' + +import { VTextField } from 'vuetify/lib' + +import set from 'lodash/fp/set' +import { env } from '../env' export const customRenderer = defineComponent({ name: 'custom-renderer', components: { ControlWrapper, - VTextField, + VTextField }, props: { - ...rendererProps(), + ...rendererProps() }, - setup(props: RendererProps) { - const dispatch = inject>('dispatch'); - const jsonforms = inject('jsonforms'); - const s = jsonforms?.core?.schema; - const ui = jsonforms?.core?.uischema; + setup (props: RendererProps) { + const dispatch = inject>('dispatch') + const jsonforms = inject('jsonforms') + const s = jsonforms?.core?.schema + const ui = jsonforms?.core?.uischema const vControl = useVuetifyControl( useJsonFormsControl(props), (value) => parseInt(value, 10) || undefined - ); - return { ...vControl, dispatch, jsonforms, s, ui }; + ) + return { ...vControl, dispatch, jsonforms, s, ui } + }, + mounted () { + // if it's an existing record update the address + if (this.jsonforms?.core?.data.addresses[0].geonames_city.id) { + this.getAddress(this.jsonforms?.core?.data.addresses[0].geonames_city.id) + } }, methods: { - mapDict(path: string) { - return [ - { path: path+'lat', geoname: 'lat', type: 'float' }, - { path: path+'lng', geoname: 'lng', type: 'float' }, - { - path: path+'country_geonames_id', - geoname: 'countryId', - type: 'int', - }, - { - path: path+'geonames_city.city', - geoname: 'name', - type: 'string', - }, - { - path: path+'city', - geoname: 'name', - type: 'string', - }, - { - path: 'country.country_name', - geoname: 'countryName', - type: 'string', - }, - { - path: 'country.country_code', - geoname: 'countryCode', - type: 'string', - }, - ]; - }, - checkData(data: string, type: string) { - switch (type) { - case 'float': - return parseFloat(data); - case 'int': - return parseInt(data); - default: - return data; - } - }, - mapGeoNamesAdmin(level: string) { - return [ - { ror: 'name', geoname: 'adminName' + level, type: 'string' }, - { ror: 'ascii_name', geoname: 'adminName' + level, type: 'string' }, - { ror: 'id', geoname: 'adminId' + level, type: 'int' }, - ]; + ignoreFields() { + return ["line", "postcode", "primary", "state", "state_code"] }, - processGeoNamesAdmin( - p: string, - geonameResponse: any, - data: any, - level: string, - fields: string[] - ) { - let path = p + 'geonames_city.geonames_admin' + level + '.'; - let geonamesAdmin = this.mapGeoNamesAdmin(level); - for (const admin of geonamesAdmin) { - data = set( - path + admin.ror, - this.checkData(geonameResponse[admin.geoname], admin.type), - data - ); + clearAddress(path: string) { + const rootData = this.jsonforms?.core?.data + if (this.dispatch) { + let updatedData = rootData + updatedData = set( + 'addresses.0', + {}, + updatedData + ) + updatedData = set( + 'country', + {}, + updatedData + ) + this.dispatch( + Actions.updateCore(updatedData, this.s as JsonSchema, this.ui)); } - data = set(path + 'code', fields.join('.'), data); - return data; }, - fetchAddress(id: string, path: string) { - const url = new URL(env().GEONAMES_URL); - const username = env().GEONAMES_USERNAME - const params = { geonameId: id, username: username }; // or: - url.search = new URLSearchParams(params).toString(); - const rootData = this.jsonforms?.core?.data; + fetchAddress (id: string) { + const url = new URL(env().ADDRESS_URL) + const params = { locationid: id } // or: + url.search = new URLSearchParams(params).toString() + const rootData = this.jsonforms?.core?.data fetch(url.toString()).then((response) => { response.json().then((data) => { - if (data.geonameId) { + if (data.address.geonames_city.id) { if (this.dispatch) { - let mapping = this.mapDict(path); - let updatedData = rootData; - updatedData = set( - path+'geonames_city.id', + let updatedData = rootData + updatedData = set( + 'addresses.0', + data.address, + updatedData + ) + updatedData = set( + 'addresses.0.geonames_city.id', parseInt(id), updatedData - ); - for (const entry of mapping) { - updatedData = set( - entry.path, - this.checkData(data[entry.geoname], entry.type), - updatedData - ); - } - if (data.adminId1) { - updatedData = this.processGeoNamesAdmin(path, data, updatedData, '1', [ - data.countryCode, - data.adminCode1, - ]); - if (data.adminId2) { - updatedData = this.processGeoNamesAdmin( - path, - data, - updatedData, - '2', - [data.countryCode, data.adminCode1, data.adminCode2] - ); - } - } - this.dispatch( + ) + updatedData = set( + 'country.country_name', + data.country.country_name, + updatedData + ) + updatedData = set( + 'country.country_code', + data.country.country_code, + updatedData + ) + this.dispatch( Actions.updateCore(updatedData, this.s as JsonSchema, this.ui) - ); + ) } + } else { + alert('No geoname results found for id: ' + id) } - else { - alert("No geoname results found for id: " + id); - } - }); - }); - }, - onChange(e: number) { - const regex = /(.*?addr.*?\d\.)/ - const path = regex.exec(this.control.path) - let strPath = path ? path[0]: '' - const id = e.toString(); - this.fetchAddress(id, strPath); + }) + }) }, + getAddress (e: number) { + const id = e.toString() + const lat = this.jsonforms?.core?.data.addresses[0].lat + const strPath = 'addresses.0' + if (lat) { + this.clearAddress(strPath) + } + if(id) + this.fetchAddress(id) + else { + this.clearAddress(strPath) + } + } }, computed: { - step(): number { - const options: any = this.appliedOptions; - return options.step ?? 1; - }, - }, -}); + step (): number { + const options: any = this.appliedOptions + return options.step ?? 1 + } + } +}) export default customRenderer const locationIDTester: Tester = and( isIntegerControl, optionIs('locationId', true) -); +) export const entry: JsonFormsRendererRegistryEntry = { renderer: customRenderer, - tester: rankWith(10, locationIDTester), -}; + tester: rankWith(10, locationIDTester) +} diff --git a/src/components/ExistingRecord.vue b/src/components/ExistingRecord.vue index 50a71fb..a4022ff 100644 --- a/src/components/ExistingRecord.vue +++ b/src/components/ExistingRecord.vue @@ -22,37 +22,37 @@ import router from '@/router' import { defineComponent, ref, Ref } from '@vue/composition-api' import { ErrorObject } from 'ajv' import { JsonForms, JsonFormsChangeEvent } from '@jsonforms/vue2' -import { createAjv,vuetifyRenderers } from '@jsonforms/vue2-vuetify' -import { entry } from './CustomRenderer.vue'; -import { langEntry } from './ShowLanguageRenderer.vue'; -import { typeEntry } from './ShowTypes.vue'; -import { genListEntry } from './GenerateListRenderer.vue'; -import { input as rorSchema } from "@/jsonSchema/rorSchema"; +import { createAjv, vuetifyRenderers } from '@jsonforms/vue2-vuetify' +import { entry, customRenderer } from './CustomRenderer.vue' +import { langEntry } from './ShowLanguageRenderer.vue' +import { typeEntry } from './ShowTypes.vue' +import { genListEntry } from './GenerateListRenderer.vue' +import { input as rorSchema } from '@/jsonSchema/rorSchema' const renderers = [ ...vuetifyRenderers, -entry, -langEntry, -typeEntry, -genListEntry -]; -const handleDefaultsAjv = createAjv({useDefaults: true}); + entry, + langEntry, + typeEntry, + genListEntry +] +const handleDefaultsAjv = createAjv({ useDefaults: true }) export default defineComponent({ name: 'ExistingRecord', components: { JsonForms }, - setup() { + setup () { // declare a reactive property within the composition API's setup method const ror = ref(rorSchema) // return properties - these get merged with data() below return { ror } }, data () { - //const data: Record = {}; + // const data: Record = {}; const errors: any = ref(undefined) - const validForm: boolean = errors?.value?.length == 0 ? true : false + const validForm: boolean = errors?.value?.length === 0 return { // freeze renderers for performance gains renderers: Object.freeze(renderers), @@ -60,18 +60,24 @@ export default defineComponent({ id: this.$route.query.id, data: this.$route.params.item, errors: errors, - validForm + validForm, } }, - mounted() { + mounted () { if (this.data === undefined) { router.push({ name: 'NewRecord' }) + } else { + //hack to force CustomRenderer component to render so that address can be updated on existing record + const listEl = document.querySelector(".v-list-item.v-list-item--dense.v-list-item--link.theme--light.list-with-detail-item") + if(listEl){ + listEl.dispatchEvent(new Event("click")) + } } }, methods: { - download() { + download () { var dataStr = 'data:application/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(this.data, null, 2)) return dataStr }, @@ -82,7 +88,7 @@ export default defineComponent({ onChange (event: JsonFormsChangeEvent) { this.data = event.data this.errors.value = event.errors - this.validForm = this.errors.value?.length == 0 ? true : false + this.validForm = this.errors.value?.length === 0 } } }) diff --git a/src/components/GenerateListRenderer.vue b/src/components/GenerateListRenderer.vue index 254f6a3..d1fd0d8 100644 --- a/src/components/GenerateListRenderer.vue +++ b/src/components/GenerateListRenderer.vue @@ -42,18 +42,17 @@ import { optionIs, isPrimitiveArrayControl, and -} from '@jsonforms/core'; + , CoreActions +} from '@jsonforms/core' import { defineComponent, inject } from '@vue/composition-api' import { rendererProps, useJsonFormsControl, - RendererProps, -} from '@jsonforms/vue2'; -import { ControlWrapper } from '@jsonforms/vue2-vuetify'; -import { useVuetifyControl } from '@jsonforms/vue2-vuetify'; -import { VCombobox, VHover } from 'vuetify/lib'; -import { CoreActions } from '@jsonforms/core'; + RendererProps +} from '@jsonforms/vue2' +import { ControlWrapper, useVuetifyControl } from '@jsonforms/vue2-vuetify' +import { VCombobox, VHover } from 'vuetify/lib' export const genListRenderer = defineComponent({ name: 'list-renderer', @@ -64,39 +63,38 @@ export const genListRenderer = defineComponent({ VHover }, props: { - ...rendererProps(), + ...rendererProps() }, - setup(props: RendererProps) { - const dispatch = inject>('dispatch'); + setup (props: RendererProps) { + const dispatch = inject>('dispatch') const vControl = useVuetifyControl( useJsonFormsControl(props), (value) => parseInt(value, 10) || undefined - ); - return { ...vControl, dispatch }; + ) + return { ...vControl, dispatch } }, computed: { - step(): number { - const options: any = this.appliedOptions; + step (): number { + const options: any = this.appliedOptions console.log(this.appliedOptions) - return options.step ?? 1; - }, + return options.step ?? 1 + } }, methods: { - onChange(e: string) { - if (this.dispatch ) { - this.dispatch(Actions.update(this.control.path, () => e)); - } + onChange (e: string) { + if (this.dispatch) { + this.dispatch(Actions.update(this.control.path, () => e)) + } } } -}); +}) export default genListRenderer const genListTester: Tester = and(optionIs('genList', true), isPrimitiveArrayControl) - export const genListEntry: JsonFormsRendererRegistryEntry = { renderer: genListRenderer, - tester: rankWith(10, genListTester), -}; + tester: rankWith(10, genListTester) +} diff --git a/src/components/Main.vue b/src/components/Main.vue index 1fc93a6..451ebef 100644 --- a/src/components/Main.vue +++ b/src/components/Main.vue @@ -33,9 +33,6 @@ export default { methods: { showTypeAhead () { this.isExisting = true - }, - passRorId () { - return '/exist/1234' } } } diff --git a/src/components/NewRecord.vue b/src/components/NewRecord.vue index 8f68739..709fb60 100644 --- a/src/components/NewRecord.vue +++ b/src/components/NewRecord.vue @@ -25,39 +25,38 @@ diff --git a/src/components/ShowTypes.vue b/src/components/ShowTypes.vue index 886cce1..f558e22 100644 --- a/src/components/ShowTypes.vue +++ b/src/components/ShowTypes.vue @@ -38,18 +38,17 @@ import { Actions, Tester, optionIs, -} from '@jsonforms/core'; + CoreActions +} from '@jsonforms/core' import { defineComponent, inject } from '@vue/composition-api' import { rendererProps, useJsonFormsControl, - RendererProps, -} from '@jsonforms/vue2'; -import { ControlWrapper } from '@jsonforms/vue2-vuetify'; -import { useVuetifyControl } from '@jsonforms/vue2-vuetify'; -import { VSelect, VHover } from 'vuetify/lib'; -import { CoreActions } from '@jsonforms/core'; + RendererProps +} from '@jsonforms/vue2' +import { ControlWrapper, useVuetifyControl } from '@jsonforms/vue2-vuetify' +import { VSelect, VHover } from 'vuetify/lib' export const showTypeRenderer = defineComponent({ name: 'type-renderer', @@ -60,38 +59,37 @@ export const showTypeRenderer = defineComponent({ VHover }, props: { - ...rendererProps(), + ...rendererProps() }, - setup(props: RendererProps) { - const dispatch = inject>('dispatch'); + setup (props: RendererProps) { + const dispatch = inject>('dispatch') const vControl = useVuetifyControl( useJsonFormsControl(props), (value) => parseInt(value, 10) || undefined - ); - return { ...vControl, dispatch }; + ) + return { ...vControl, dispatch } }, computed: { - step(): number { - const options: any = this.appliedOptions; - return options.step ?? 1; - }, + step (): number { + const options: any = this.appliedOptions + return options.step ?? 1 + } }, methods: { - onChange(e: string) { - if (this.dispatch) { - this.dispatch(Actions.update(this.control.path, () => e)); - } + onChange (e: string) { + if (this.dispatch) { + this.dispatch(Actions.update(this.control.path, () => e)) + } } } -}); +}) export default showTypeRenderer const typeTester: Tester = optionIs('type', true) - export const typeEntry: JsonFormsRendererRegistryEntry = { renderer: showTypeRenderer, - tester: rankWith(10, typeTester), -}; + tester: rankWith(10, typeTester) +} diff --git a/src/env.dev.ts b/src/env.dev.ts new file mode 100644 index 0000000..47f8751 --- /dev/null +++ b/src/env.dev.ts @@ -0,0 +1,9 @@ +export const env = () => { + const { + VUE_APP_BASE_ROUTE: BASE_ROUTE = '/', + VUE_APP_GENERATE_ID: GENERATE_ID = 'https://generateid.dev.ror.org/generateid', + VUE_APP_ADDRESS_URL: ADDRESS_URL = 'https://generateid.dev.ror.org/address', + NODE_ENV + } = process.env + return { BASE_ROUTE, GENERATE_ID, ADDRESS_URL, NODE_ENV } +} diff --git a/src/env.prod.ts b/src/env.prod.ts new file mode 100644 index 0000000..731ca3c --- /dev/null +++ b/src/env.prod.ts @@ -0,0 +1,9 @@ +export const env = () => { + const { + VUE_APP_BASE_ROUTE: BASE_ROUTE = '/', + VUE_APP_GENERATE_ID: GENERATE_ID = 'https://generateid.ror.org/generateid', + VUE_APP_ADDRESS_URL: ADDRESS_URL = 'https://generateid.ror.org/address', + NODE_ENV + } = process.env + return { BASE_ROUTE, GENERATE_ID, ADDRESS_URL, NODE_ENV } +} diff --git a/src/env.staging.ts b/src/env.staging.ts new file mode 100644 index 0000000..31663af --- /dev/null +++ b/src/env.staging.ts @@ -0,0 +1,9 @@ +export const env = () => { + const { + VUE_APP_BASE_ROUTE: BASE_ROUTE = '/', + VUE_APP_GENERATE_ID: GENERATE_ID = 'https://generateid.staging.ror.org/generateid', + VUE_APP_ADDRESS_URL: ADDRESS_URL = 'https://generateid.staging.ror.org/address', + NODE_ENV + } = process.env + return { BASE_ROUTE, GENERATE_ID, ADDRESS_URL, NODE_ENV } +} diff --git a/src/env.ts b/src/env.ts index 5fe1e5d..dffb8a7 100644 --- a/src/env.ts +++ b/src/env.ts @@ -1,10 +1,9 @@ export const env = () => { - const { - VUE_APP_BASE_ROUTE: BASE_ROUTE = '/', - VUE_APP_GENERATE_ID: GENERATE_ID = 'http://localhost:5000/generateid?mode=dev', - VUE_APP_GEONAMES_URL: GEONAMES_URL = 'http://api.geonames.org/getJSON', - VUE_APP_GEONAMES_USERNAME: GEONAMES_USERNAME = 'roradmin', - NODE_ENV - } = process.env; - return { BASE_ROUTE, GENERATE_ID, GEONAMES_URL, GEONAMES_USERNAME, NODE_ENV }; - }; \ No newline at end of file + const { + VUE_APP_BASE_ROUTE: BASE_ROUTE = '/', + VUE_APP_GENERATE_ID: GENERATE_ID = 'http://localhost:5000/generateid', + VUE_APP_ADDRESS_URL: ADDRESS_URL = 'http://localhost:5000/address', + NODE_ENV + } = process.env + return { BASE_ROUTE, GENERATE_ID, ADDRESS_URL, NODE_ENV } +} diff --git a/src/jsonSchema/rorSchema/index.ts b/src/jsonSchema/rorSchema/index.ts index eec4d94..c743b56 100644 --- a/src/jsonSchema/rorSchema/index.ts +++ b/src/jsonSchema/rorSchema/index.ts @@ -1,11 +1,10 @@ -import schema from "./schema.json"; -import data from "./data.json"; -import uischema from "./uischema.json"; -import { UISchemaElement, JsonSchema } from "@jsonforms/core"; +import schema from './schema.json' +import data from './data.json' +import uischema from './uischema.json' +import { UISchemaElement, JsonSchema } from '@jsonforms/core' export const input: { schema: JsonSchema; uischema: UISchemaElement; data: any; - } = { schema, uischema, data }; - + } = { schema, uischema, data } diff --git a/src/jsonSchema/rorSchema/schema.json b/src/jsonSchema/rorSchema/schema.json index 444145b..2bc5869 100644 --- a/src/jsonSchema/rorSchema/schema.json +++ b/src/jsonSchema/rorSchema/schema.json @@ -106,22 +106,22 @@ "properties": { "ascii_name": { "readOnly": true, - "type": "string", + "type": ["string","null"], "default": null }, "name": { "readOnly": true, - "type": "string", + "type": ["string","null"], "default": null }, "id": { - "type": "integer", "readOnly": true, + "type": ["integer","null"], "default": null }, "code": { "readOnly": true, - "type": "string", + "type": ["string","null"], "default": null } } @@ -132,19 +132,23 @@ "properties": { "ascii_name": { "readOnly": true, - "type": ["string","null"] + "type": ["string","null"], + "default": null }, "name": { "readOnly": true, - "type": ["string","null"] + "type": ["string","null"], + "default": null }, "id": { + "readOnly": true, "type": ["integer","null"], - "readOnly": true + "default": null }, "code": { "readOnly": true, - "type": ["string","null"] + "type": ["string","null"], + "default": null } } }, @@ -447,5 +451,5 @@ "minLength": 1 } }, - "required": ["name", "types", "addresses"] + "required": ["name", "types"] } diff --git a/src/router/index.ts b/src/router/index.ts index f952b54..80b1db9 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -10,9 +10,9 @@ export default new Router({ base: process.env.BASE_URL, routes: [ { - path: '/', - name: 'Main', - component: Main + path: '/', + name: 'Main', + component: Main }, { path: '/new', @@ -20,10 +20,10 @@ export default new Router({ component: NewRecord }, { - path: '/exist', - name: 'ExistingRecord', - component: ExistingRecord, - props: true + path: '/exist', + name: 'ExistingRecord', + component: ExistingRecord, + props: true } ] })