Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CB-5123. Added backend part, added new parameter licenseStatus to ser… #2831

Merged

Conversation

DenisSinelnikov
Copy link
Contributor

…ver config gql

Comment on lines +44 to 47
/**
* PasswordPolicyResource should be loaded before calling this method
*/
validatePassword(password: string): ValidationResult {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should add a check here. There is a chance a person would not have read the comment and used this function without the resource had been loaded before

Suggested change
/**
* PasswordPolicyResource should be loaded before calling this method
*/
validatePassword(password: string): ValidationResult {
validatePassword(password: string): ValidationResult {
if (!this.passwordPolicyResource.isLoaded()) {
throw new Error('Password policy is not loaded yet');
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can be outdated but loaded, so we need to know that we need to manage it at place

extraProps: observable.ref,
autoClose: observable.ref,
type: observable.ref,
timestamp: observable.ref,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should close to be included here? seems like potential bug if mobx does not know that some notification was closed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably don't want users to change this field

Comment on lines 69 to 77
this.update = {
hideFolders: false,
hideSchemas: false,
hideVirtualModel: false,
mergeEntities: false,
showOnlyEntities: false,
showSystemObjects: false,
showUtilityObjects: false,
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to the INITIAL_UPDATE_STATE const please

Comment on lines 21 to 28
if (
this.serverConfigResource.configurationMode ||
(this.serverLicenseStatusResource?.licenseRequired && !this.serverLicenseStatusResource.licenseValid)
) {
return true;
}

return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be simplified

Suggested change
if (
this.serverConfigResource.configurationMode ||
(this.serverLicenseStatusResource?.licenseRequired && !this.serverLicenseStatusResource.licenseValid)
) {
return true;
}
return false;
return this.serverConfigResource.configurationMode ||
(this.serverLicenseStatusResource?.licenseRequired && !this.serverLicenseStatusResource.licenseValid)

Comment on lines +51 to +53
/**
* Quotas should be manually loaded from ServerResourceQuotasResource before using this method
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as for PasswordPolicyResource comment a bit above

@@ -85,6 +86,7 @@ export class ServerConfigurationAuthenticationBootstrap extends Bootstrap {
return validation.invalidate();
}

await this.passwordPolicyResource.load();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be a better place for this in the load(): void {} method of this class?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we need to keep in mind that resources can be invalidated at any time and load executed only once on app start, we also don't need this resource to be loaded in app starting process because we only need this data in certain forms

private readonly quotasService: QuotasService,
private readonly cache: ResultSetCacheAction,
) {
super(source);

function loadQuotas() {
setTimeout(() => serverResourceQuotasResource.load(), 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to run it as soon as possible?

you can also use by the way
queueMicrotask(() => serverResourceQuotasResource.load());

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to run it as soon as possible, but we want to prevent onDataOutdated executor from blocking

Comment on lines +58 to +60
this.subscriptionDispose = () => {
this.serverResourceQuotasResource.onDataOutdated.removeHandler(loadQuotas);
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we add removeHandler only after dispose executed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you mean by that?

}
}

if (this.isChanged() && !skipConfigUpdate) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we can keep this.isChanged() here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need it (it's already in performUpdate arg)

Comment on lines +86 to +90
await this.graphQLService.sdk.setDefaultNavigatorSettings({ settings: this.update });

this.setData(await this.loader());

this.onDataOutdated.execute();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you missed this check here

if (this.isNavigatorSettingsChanged()) {

Suggested change
await this.graphQLService.sdk.setDefaultNavigatorSettings({ settings: this.update });
this.setData(await this.loader());
this.onDataOutdated.execute();
if (!isChanged()) {
return;
}
await this.graphQLService.sdk.setDefaultNavigatorSettings({ settings: this.update });
this.setData(await this.loader());
this.onDataOutdated.execute();

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I'm not cuz performUpdate will call this check again before running the callback

@alexander-skoblikov alexander-skoblikov merged commit 9254684 into devel Aug 13, 2024
8 checks passed
@alexander-skoblikov alexander-skoblikov deleted the CB-5123-license-status-insufficient-amount-users branch August 13, 2024 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants