mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-25 20:40:36 +03:00
B: Fix substitution UI error
Some checks failed
Frontend CI / build (22.x) (push) Has been cancelled
Some checks failed
Frontend CI / build (22.x) (push) Has been cancelled
This commit is contained in:
parent
8bec236f0f
commit
945459cede
|
@ -95,7 +95,7 @@ function DlgEditOperation({ hideWindow, oss, target, onSubmit }: DlgEditOperatio
|
|||
}, [schemasIDs, needPreload, cache]);
|
||||
|
||||
useEffect(() => {
|
||||
if (cache.loading || schemas.length !== schemasIDs.length) {
|
||||
if (cache.loading || schemas.length !== schemasIDs.length || schemas.length === 0) {
|
||||
return;
|
||||
}
|
||||
setSubstitutions(prev =>
|
||||
|
@ -114,7 +114,7 @@ function DlgEditOperation({ hideWindow, oss, target, onSubmit }: DlgEditOperatio
|
|||
}, [schemasIDs, schemas, cache.loading, getSchemaByCst]);
|
||||
|
||||
useEffect(() => {
|
||||
if (cache.loading || schemas.length !== schemasIDs.length) {
|
||||
if (cache.loading || schemas.length !== schemasIDs.length || schemas.length === 0) {
|
||||
return;
|
||||
}
|
||||
const validator = new SubstitutionValidator(schemas, substitutions);
|
||||
|
|
|
@ -44,7 +44,7 @@ function TabSynthesis({
|
|||
disabled
|
||||
value={validationText}
|
||||
rows={4}
|
||||
style={{ borderColor: isCorrect ? undefined : APP_COLORS.fgRed }}
|
||||
style={{ borderColor: isCorrect ? undefined : APP_COLORS.fgRed, borderWidth: isCorrect ? undefined : '2px' }}
|
||||
/>
|
||||
</div>
|
||||
</DataLoader>
|
||||
|
|
|
@ -75,6 +75,7 @@ export class RSFormLoader {
|
|||
const order = this.graph.topologicalOrder();
|
||||
order.forEach(cstID => {
|
||||
const cst = this.cstByID.get(cstID)!;
|
||||
cst.schema = this.schema.id;
|
||||
cst.status = inferStatus(cst.parse.status, cst.parse.valueClass);
|
||||
cst.is_template = inferTemplate(cst.definition_formal);
|
||||
cst.cst_class = inferClass(cst.cst_type, cst.is_template);
|
||||
|
|
|
@ -70,9 +70,10 @@ export class SubstitutionValidator {
|
|||
constructor(schemas: IRSForm[], substitutions: ICstSubstitute[]) {
|
||||
this.schemas = schemas;
|
||||
this.substitutions = substitutions;
|
||||
if (this.substitutions.length === 0) {
|
||||
if (schemas.length === 0 || substitutions.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
schemas.forEach(schema => {
|
||||
this.schemaByID.set(schema.id, schema);
|
||||
this.mapping.set(schema.id, {});
|
||||
|
|
|
@ -65,7 +65,6 @@ export interface TermForm {
|
|||
*/
|
||||
export interface IConstituentaMeta {
|
||||
id: ConstituentaID;
|
||||
schema: LibraryItemID;
|
||||
alias: string;
|
||||
convention: string;
|
||||
cst_type: CstType;
|
||||
|
@ -101,6 +100,9 @@ export interface IConstituentaData extends IConstituentaMeta {
|
|||
* Represents Constituenta.
|
||||
*/
|
||||
export interface IConstituenta extends IConstituentaData {
|
||||
/** {@link LibraryItemID} of this {@link IConstituenta}. */
|
||||
schema: LibraryItemID;
|
||||
|
||||
/** {@link CstClass} of this {@link IConstituenta}. */
|
||||
cst_class: CstClass;
|
||||
/** {@link ExpressionStatus} of this {@link IConstituenta}. */
|
||||
|
@ -135,7 +137,7 @@ export interface IConstituenta extends IConstituentaData {
|
|||
/**
|
||||
* Represents {@link IConstituenta} reference.
|
||||
*/
|
||||
export interface IConstituentaReference extends Pick<IConstituentaMeta, 'id' | 'schema'> {}
|
||||
export interface IConstituentaReference extends Pick<IConstituenta, 'id' | 'schema'> {}
|
||||
|
||||
/**
|
||||
* Represents Constituenta list.
|
||||
|
|
Loading…
Reference in New Issue
Block a user