-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support personal access token and can drop down to select table…
… and base (#2) * feat: support personal access token and can drop down to select table and base * chore: update .gitignore and widget.config.json * 0.0.28 * chore: refactor GetBases API call and handle error responses * 0.0.29 * chore: refactor error handling in GetBases API * 0.0.30 * Remove unused API function * chore: update CSS, Prettier configuration, and file imports * chore: modify widget.config.json and update package version
- Loading branch information
XuKecheng
authored
Dec 14, 2023
1 parent
03a1c27
commit 370dbcb
Showing
39 changed files
with
1,897 additions
and
1,316 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: Submit | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the main branch | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'package.json' | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
inputs: | ||
allow_error: | ||
description: 'allow a workflow run from failing when a job fails' | ||
required: false | ||
default: false | ||
type: boolean | ||
jobs: | ||
submit_widget_develop: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
# persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. | ||
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | ||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::node_modules" | ||
|
||
- uses: actions/cache@v3 | ||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Install NPM dependencies | ||
run: yarn install | ||
|
||
- name: | ||
run: | | ||
echo "Modify widget.config.json" | ||
sed -i "s/\"globalPackageId\": \"[a-zA-Z0-9]*\"/\"globalPackageId\": \"${{ secrets.DEVELOP_PACKAGE_ID }}\"/g" widget.config.json | ||
git add widget.config.json | ||
git commit -m "Modify widget.config.json" | ||
- name: Get submit version | ||
id: version | ||
uses: ashley-taylor/read-json-property-action@v1.0 | ||
with: | ||
path: ./package.json | ||
property: version | ||
|
||
- name: Submit Widget develop | ||
continue-on-error: ${{ inputs.allow_error }} | ||
run: | | ||
echo "Submit Widget develop" | ||
npx -y @apitable/widget-cli submit --version ${{steps.version.outputs.value}} --host ${{ secrets.DEVELOP_HOST }} --token ${{ secrets.DEVELOP_TOKEN }} | ||
submit_widget_production: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
# persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. | ||
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | ||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::node_modules" | ||
|
||
- uses: actions/cache@v3 | ||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Install NPM dependencies | ||
run: yarn install | ||
|
||
- name: Get submit version | ||
id: version | ||
uses: ashley-taylor/read-json-property-action@v1.0 | ||
with: | ||
path: ./package.json | ||
property: version | ||
|
||
# production submit | ||
- name: Submit Widget production | ||
continue-on-error: ${{ inputs.allow_error }} | ||
run: | | ||
echo "Submit Widget production" | ||
npx -y @apitable/widget-cli submit --version ${{steps.version.outputs.value}} --host ${{ secrets.PRODUCTION_HOST }} --token ${{ secrets.PRODUCTION_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"bracketSpacing": true, | ||
"printWidth": 150, | ||
"semi": true, | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"trailingComma": "all", | ||
"useTabs": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,4 +33,4 @@ | |
|
||
.importAddRecordFail { | ||
color: var(--textDangerDefault); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,37 @@ | ||
import { Typography } from '@vikadata/components'; | ||
import { t, useDatasheet } from '@vikadata/widget-sdk'; | ||
import { Typography } from '@apitable/components'; | ||
import { t, useDatasheet } from '@apitable/widget-sdk'; | ||
import React, { useState } from 'react'; | ||
import { useEffect } from 'react' | ||
import { useEffect } from 'react'; | ||
import { IFieldMap, IRecord } from '../types'; | ||
import { addField, sleep, Strings } from '../utils'; | ||
import { AddRecord } from './add-record'; | ||
import style from './index.css'; | ||
|
||
interface IAirTableImport { | ||
fieldMap: IFieldMap; | ||
records?: IRecord[] | ||
records?: IRecord[]; | ||
} | ||
|
||
export const AirTableImport: React.FC<IAirTableImport> = props => { | ||
export const AirTableImport: React.FC<IAirTableImport> = (props) => { | ||
const { fieldMap, records } = props; | ||
const [importing, setImporting] = useState(true); | ||
const datasheet = useDatasheet(); | ||
useEffect(() => { | ||
console.log('创建列...'); | ||
console.log('Create field ...'); | ||
setImporting(true); | ||
const sync = async () => { | ||
await addField(fieldMap, datasheet); | ||
await sleep(3000); | ||
setImporting(false); | ||
} | ||
}; | ||
sync(); | ||
}, []) | ||
}, []); | ||
if (!importing) { | ||
return <AddRecord records={records} fieldMap={fieldMap} /> | ||
return <AddRecord records={records} fieldMap={fieldMap} />; | ||
} | ||
return ( | ||
<div className={style.importAddField}> | ||
<Typography variant="h3"> | ||
{t(Strings.create_fields)}... | ||
</Typography> | ||
<Typography variant="h3">{t(Strings.create_fields)}...</Typography> | ||
</div> | ||
) | ||
} | ||
); | ||
}; |
Oops, something went wrong.