Skip to content

Commit

Permalink
fix: 修复配置中心变量问题
Browse files Browse the repository at this point in the history
  • Loading branch information
tingfuyeh committed Oct 29, 2024
1 parent 8339fb0 commit d86067e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 3 additions & 5 deletions web/src/polaris/configuration/fileGroup/detail/file/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
notification,
Alert,
} from 'tea-component'
import { FileStatus, FileStatusMap, NeedCheckFormat } from './constants'
import { FileStatus, FileStatusMap } from './constants'
import { autotip, radioable, scrollable } from 'tea-component/lib/table/addons'
import FileDiff from './FileDiff'
import MonacoEditor from '@src/polaris/common/components/MocacoEditor'
Expand Down Expand Up @@ -57,7 +57,7 @@ const getHandlers = memorize(({ creators }: Duck, dispatch) => ({
select: v => dispatch(creators.select(v)),
cancel: () => dispatch(creators.cancel()),
getTemplate: v => dispatch(creators.getTemplate(v)),
checkFileFormatValid: v => dispatch(creators.checkFileFormatValid(v)),
checkFileFormatValid: () => dispatch(creators.checkFileFormatValid()),
}))

insertCSS(
Expand Down Expand Up @@ -439,9 +439,7 @@ export default function Page(props: DuckCmpProps<Duck>) {
width={'100%'}
onChange={v => {
handlers.setEditContent(v)
if (NeedCheckFormat.includes(currentNode?.format as FileFormat)) {
handlers.checkFileFormatValid({ content: v, format: currentNode.format })
}
handlers.checkFileFormatValid()
}}
/>
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export default class PageDuck extends Base {
select: createToPayload<string[]>(types.SELECT),
cancel: createToPayload<void>(types.CANCEL),
getTemplate: createToPayload<ConfigFile>(types.GET_FILE_TEMPLATE),
checkFileFormatValid: createToPayload<{ content: string; format: string }>(types.CHECK_FILE_FORMAT),
checkFileFormatValid: createToPayload<void>(types.CHECK_FILE_FORMAT),
}
}

Expand Down Expand Up @@ -300,9 +300,11 @@ export default class PageDuck extends Base {
yield put({ type: types.SET_EDITING, payload: true })
yield put(creators.setEditContent(currentNode.content))
})
yield takeLatest(types.CHECK_FILE_FORMAT, function*(action) {
yield takeLatest(types.CHECK_FILE_FORMAT, function*() {
yield delay(500)
const { format, content } = action.payload
const currentNode = selectors.currentNode(yield select())
const { editContent: content } = selector(yield select())
const { format } = currentNode
if (format === FileFormat.YAML) {
try {
jsYaml.load(content)
Expand Down

0 comments on commit d86067e

Please sign in to comment.