Skip to content

Commit

Permalink
Feat: #72 create insert data react table into users page smb (#650)
Browse files Browse the repository at this point in the history
* fix: #72 create insert data react table into users page smb
  • Loading branch information
Vu Nguyen authored Mar 19, 2020
1 parent 2e0aaa6 commit 3c154a0
Show file tree
Hide file tree
Showing 20 changed files with 41,065 additions and 12,607 deletions.
6 changes: 6 additions & 0 deletions packages/elements/src/styles/components/spreadsheet.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ span.data-grid-container:focus {
text-align: right;
border: 1px solid #ddd;
padding: 0;
&.hidden {
display: none;
}
}
.data-grid-container .data-grid .cell.selected {
border: 1px double rgb(33, 133, 208);
Expand Down Expand Up @@ -90,6 +93,9 @@ span.data-grid-container:focus {
.data-grid-container .data-grid .cell .value-viewer,
.data-grid-container .data-grid .cell .data-editor {
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

/* custom style */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { isNumberOnly } from '../validate-number'

interface ValueTypes {
validEmail: string
invalidEmail: string
}

describe('validate-number', () => {
describe('isNumber', () => {
it('should return true', () => {
const input = '980123111'
const output = true
const result = isNumberOnly(input)
expect(result).toEqual(output)
})

it('should return false', () => {
const input = '109310s12'
const output = false
const result = isNumberOnly(input)
expect(result).toEqual(output)
})

it('should return false', () => {
const input = null
const output = false
const result = isNumberOnly(input)
expect(result).toEqual(output)
})
})
})
1 change: 1 addition & 0 deletions packages/elements/src/utils/validators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export {
validateMaxCharacterLength,
} from './validate-character-length'
export { validateEmail, isEmail } from './validate-email'
export { isNumberOnly } from './validate-number'
export { validateRequire, fieldValidateRequire } from './validate-require'
export { validateURI } from './validate-uri'
export { validatePassword, isValidPassword } from './validate-password'
4 changes: 4 additions & 0 deletions packages/elements/src/utils/validators/validate-number.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const isNumberOnly = string => {
const re = /^\d+$/
return re.test(string)
}
10 changes: 6 additions & 4 deletions packages/graphql-server/src/resolvers/negotiators/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ export const callGetNegotiatorByIdAPI = async (
const traceId = context.traceId
logger.info('callGetNegotiatorByIdAPI', { traceId, args })
try {
const { id, ...rest } = args
const params = qs.stringify(rest)
const response = await createPlatformAxiosInstance().get<GetNegotiatorByIdReturn>(
`${URLS.negotiators}/${args.id}`,
`${URLS.negotiators}/${id}?${params}`,
{
headers: {
Authorization: context.authorization,
Expand Down Expand Up @@ -69,7 +71,7 @@ export const callCreateNegotiatorAPI = async (
})
const id = getIdFromCreateHeaders({ headers: response.headers })
if (id) {
return callGetNegotiatorByIdAPI({ id }, context)
return callGetNegotiatorByIdAPI({ id, embed: ['office'] }, context)
}
return null
} catch (error) {
Expand All @@ -95,8 +97,8 @@ export const callUpdateNegotiatorAPI = async (
},
},
)
if (updateResponse?.data) {
return callGetNegotiatorByIdAPI({ id: args.id }, context)
if (updateResponse) {
return callGetNegotiatorByIdAPI({ id: args.id, embed: ['office'] }, context)
}
return errors.generateUserInputError(traceId)
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type UpdateNegotiatorArgs = { id: string; _eTag: string } & UpdateNegotia

export type GetNegotiatorByIdArgs = {
id: string
embed?: string[]
}

export type GetNegotiatorsArgs = {
Expand Down
Loading

0 comments on commit 3c154a0

Please sign in to comment.