added to tenant fields isolatedTbCore and isolatedTbRuleEngine (#2611)
Co-authored-by: Andrew Shvayka <ashvayka@thingsboard.io>
This commit is contained in:
parent
8442159811
commit
7869fb5ef4
@ -290,6 +290,20 @@ public class CassandraDatabaseUpgradeService extends AbstractCassandraDatabaseUp
|
|||||||
log.info("Attributes updated.");
|
log.info("Attributes updated.");
|
||||||
} catch (InvalidQueryException e) {
|
} catch (InvalidQueryException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String updateTenantCoreTableStmt = "alter table tenant add isolated_tb_core boolean";
|
||||||
|
String updateTenantRuleEngineTableStmt = "alter table tenant add isolated_tb_rule_engine boolean";
|
||||||
|
|
||||||
|
try {
|
||||||
|
log.info("Updating tenant...");
|
||||||
|
cluster.getSession().execute(updateTenantCoreTableStmt);
|
||||||
|
Thread.sleep(2500);
|
||||||
|
|
||||||
|
cluster.getSession().execute(updateTenantRuleEngineTableStmt);
|
||||||
|
Thread.sleep(2500);
|
||||||
|
log.info("Tenant updated.");
|
||||||
|
} catch (InvalidQueryException e) {
|
||||||
|
}
|
||||||
log.info("Schema updated.");
|
log.info("Schema updated.");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -221,6 +221,7 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
conn.createStatement().execute("ALTER TABLE tenant ADD COLUMN isolated_tb_core boolean DEFAULT (false), ADD COLUMN isolated_tb_rule_engine boolean DEFAULT (false)");
|
||||||
log.info("Schema updated.");
|
log.info("Schema updated.");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -29,6 +29,8 @@ public class Tenant extends ContactBased<TenantId> implements HasTenantId {
|
|||||||
|
|
||||||
private String title;
|
private String title;
|
||||||
private String region;
|
private String region;
|
||||||
|
private boolean isolatedTbCore;
|
||||||
|
private boolean isolatedTbRuleEngine;
|
||||||
|
|
||||||
public Tenant() {
|
public Tenant() {
|
||||||
super();
|
super();
|
||||||
@ -72,6 +74,22 @@ public class Tenant extends ContactBased<TenantId> implements HasTenantId {
|
|||||||
this.region = region;
|
this.region = region;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isIsolatedTbCore() {
|
||||||
|
return isolatedTbCore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsolatedTbCore(boolean isolatedTbCore) {
|
||||||
|
this.isolatedTbCore = isolatedTbCore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isIsolatedTbRuleEngine() {
|
||||||
|
return isolatedTbRuleEngine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsolatedTbRuleEngine(boolean isolatedTbRuleEngine) {
|
||||||
|
this.isolatedTbRuleEngine = isolatedTbRuleEngine;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSearchText() {
|
public String getSearchText() {
|
||||||
return getTitle();
|
return getTitle();
|
||||||
@ -84,6 +102,10 @@ public class Tenant extends ContactBased<TenantId> implements HasTenantId {
|
|||||||
builder.append(title);
|
builder.append(title);
|
||||||
builder.append(", region=");
|
builder.append(", region=");
|
||||||
builder.append(region);
|
builder.append(region);
|
||||||
|
builder.append(", isolatedTbCore=");
|
||||||
|
builder.append(isolatedTbCore);
|
||||||
|
builder.append(", isolatedTbRuleEngine=");
|
||||||
|
builder.append(isolatedTbRuleEngine);
|
||||||
builder.append(", additionalInfo=");
|
builder.append(", additionalInfo=");
|
||||||
builder.append(getAdditionalInfo());
|
builder.append(getAdditionalInfo());
|
||||||
builder.append(", country=");
|
builder.append(", country=");
|
||||||
|
|||||||
@ -112,6 +112,8 @@ public class ModelConstants {
|
|||||||
public static final String TENANT_TITLE_PROPERTY = TITLE_PROPERTY;
|
public static final String TENANT_TITLE_PROPERTY = TITLE_PROPERTY;
|
||||||
public static final String TENANT_REGION_PROPERTY = "region";
|
public static final String TENANT_REGION_PROPERTY = "region";
|
||||||
public static final String TENANT_ADDITIONAL_INFO_PROPERTY = ADDITIONAL_INFO_PROPERTY;
|
public static final String TENANT_ADDITIONAL_INFO_PROPERTY = ADDITIONAL_INFO_PROPERTY;
|
||||||
|
public static final String TENANT_ISOLATED_TB_CORE = "isolated_tb_core";
|
||||||
|
public static final String TENANT_ISOLATED_TB_RULE_ENGINE = "isolated_tb_rule_engine";
|
||||||
|
|
||||||
public static final String TENANT_BY_REGION_AND_SEARCH_TEXT_COLUMN_FAMILY_NAME = "tenant_by_region_and_search_text";
|
public static final String TENANT_BY_REGION_AND_SEARCH_TEXT_COLUMN_FAMILY_NAME = "tenant_by_region_and_search_text";
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.thingsboard.server.common.data.Tenant;
|
import org.thingsboard.server.common.data.Tenant;
|
||||||
import org.thingsboard.server.common.data.id.TenantId;
|
import org.thingsboard.server.common.data.id.TenantId;
|
||||||
|
import org.thingsboard.server.dao.model.ModelConstants;
|
||||||
import org.thingsboard.server.dao.model.SearchTextEntity;
|
import org.thingsboard.server.dao.model.SearchTextEntity;
|
||||||
import org.thingsboard.server.dao.model.type.JsonCodec;
|
import org.thingsboard.server.dao.model.type.JsonCodec;
|
||||||
|
|
||||||
@ -89,6 +90,12 @@ public final class TenantEntity implements SearchTextEntity<Tenant> {
|
|||||||
@Column(name = TENANT_ADDITIONAL_INFO_PROPERTY, codec = JsonCodec.class)
|
@Column(name = TENANT_ADDITIONAL_INFO_PROPERTY, codec = JsonCodec.class)
|
||||||
private JsonNode additionalInfo;
|
private JsonNode additionalInfo;
|
||||||
|
|
||||||
|
@Column(name = ModelConstants.TENANT_ISOLATED_TB_CORE)
|
||||||
|
private boolean isolatedTbCore;
|
||||||
|
|
||||||
|
@Column(name = ModelConstants.TENANT_ISOLATED_TB_RULE_ENGINE)
|
||||||
|
private boolean isolatedTbRuleEngine;
|
||||||
|
|
||||||
public TenantEntity() {
|
public TenantEntity() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
@ -108,6 +115,8 @@ public final class TenantEntity implements SearchTextEntity<Tenant> {
|
|||||||
this.phone = tenant.getPhone();
|
this.phone = tenant.getPhone();
|
||||||
this.email = tenant.getEmail();
|
this.email = tenant.getEmail();
|
||||||
this.additionalInfo = tenant.getAdditionalInfo();
|
this.additionalInfo = tenant.getAdditionalInfo();
|
||||||
|
this.isolatedTbCore = tenant.isIsolatedTbCore();
|
||||||
|
this.isolatedTbRuleEngine = tenant.isIsolatedTbRuleEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getUuid() {
|
public UUID getUuid() {
|
||||||
@ -206,6 +215,22 @@ public final class TenantEntity implements SearchTextEntity<Tenant> {
|
|||||||
this.additionalInfo = additionalInfo;
|
this.additionalInfo = additionalInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isIsolatedTbCore() {
|
||||||
|
return isolatedTbCore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsolatedTbCore(boolean isolatedTbCore) {
|
||||||
|
this.isolatedTbCore = isolatedTbCore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isIsolatedTbRuleEngine() {
|
||||||
|
return isolatedTbRuleEngine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsolatedTbRuleEngine(boolean isolatedTbRuleEngine) {
|
||||||
|
this.isolatedTbRuleEngine = isolatedTbRuleEngine;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSearchTextSource() {
|
public String getSearchTextSource() {
|
||||||
return getTitle();
|
return getTitle();
|
||||||
@ -235,6 +260,8 @@ public final class TenantEntity implements SearchTextEntity<Tenant> {
|
|||||||
tenant.setPhone(phone);
|
tenant.setPhone(phone);
|
||||||
tenant.setEmail(email);
|
tenant.setEmail(email);
|
||||||
tenant.setAdditionalInfo(additionalInfo);
|
tenant.setAdditionalInfo(additionalInfo);
|
||||||
|
tenant.setIsolatedTbCore(isolatedTbCore);
|
||||||
|
tenant.setIsolatedTbRuleEngine(isolatedTbRuleEngine);
|
||||||
return tenant;
|
return tenant;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -72,6 +72,12 @@ public final class TenantEntity extends BaseSqlEntity<Tenant> implements SearchT
|
|||||||
@Column(name = ModelConstants.EMAIL_PROPERTY)
|
@Column(name = ModelConstants.EMAIL_PROPERTY)
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
|
@Column(name = ModelConstants.TENANT_ISOLATED_TB_CORE)
|
||||||
|
private boolean isolatedTbCore;
|
||||||
|
|
||||||
|
@Column(name = ModelConstants.TENANT_ISOLATED_TB_RULE_ENGINE)
|
||||||
|
private boolean isolatedTbRuleEngine;
|
||||||
|
|
||||||
@Type(type = "json")
|
@Type(type = "json")
|
||||||
@Column(name = ModelConstants.TENANT_ADDITIONAL_INFO_PROPERTY)
|
@Column(name = ModelConstants.TENANT_ADDITIONAL_INFO_PROPERTY)
|
||||||
private JsonNode additionalInfo;
|
private JsonNode additionalInfo;
|
||||||
@ -95,6 +101,8 @@ public final class TenantEntity extends BaseSqlEntity<Tenant> implements SearchT
|
|||||||
this.phone = tenant.getPhone();
|
this.phone = tenant.getPhone();
|
||||||
this.email = tenant.getEmail();
|
this.email = tenant.getEmail();
|
||||||
this.additionalInfo = tenant.getAdditionalInfo();
|
this.additionalInfo = tenant.getAdditionalInfo();
|
||||||
|
this.isolatedTbCore = tenant.isIsolatedTbCore();
|
||||||
|
this.isolatedTbRuleEngine = tenant.isIsolatedTbRuleEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -126,6 +134,8 @@ public final class TenantEntity extends BaseSqlEntity<Tenant> implements SearchT
|
|||||||
tenant.setPhone(phone);
|
tenant.setPhone(phone);
|
||||||
tenant.setEmail(email);
|
tenant.setEmail(email);
|
||||||
tenant.setAdditionalInfo(additionalInfo);
|
tenant.setAdditionalInfo(additionalInfo);
|
||||||
|
tenant.setIsolatedTbCore(isolatedTbCore);
|
||||||
|
tenant.setIsolatedTbRuleEngine(isolatedTbRuleEngine);
|
||||||
return tenant;
|
return tenant;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -110,6 +110,8 @@ CREATE TABLE IF NOT EXISTS thingsboard.tenant (
|
|||||||
phone text,
|
phone text,
|
||||||
email text,
|
email text,
|
||||||
additional_info text,
|
additional_info text,
|
||||||
|
isolated_tb_core boolean,
|
||||||
|
isolated_tb_rule_engine boolean,
|
||||||
PRIMARY KEY (id, region)
|
PRIMARY KEY (id, region)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -183,7 +183,9 @@ CREATE TABLE IF NOT EXISTS tenant (
|
|||||||
search_text varchar(255),
|
search_text varchar(255),
|
||||||
state varchar(255),
|
state varchar(255),
|
||||||
title varchar(255),
|
title varchar(255),
|
||||||
zip varchar(255)
|
zip varchar(255),
|
||||||
|
isolated_tb_core boolean,
|
||||||
|
isolated_tb_rule_engine boolean
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS user_credentials (
|
CREATE TABLE IF NOT EXISTS user_credentials (
|
||||||
|
|||||||
@ -183,7 +183,9 @@ CREATE TABLE IF NOT EXISTS tenant (
|
|||||||
search_text varchar(255),
|
search_text varchar(255),
|
||||||
state varchar(255),
|
state varchar(255),
|
||||||
title varchar(255),
|
title varchar(255),
|
||||||
zip varchar(255)
|
zip varchar(255),
|
||||||
|
isolated_tb_core boolean,
|
||||||
|
isolated_tb_rule_engine boolean
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS user_credentials (
|
CREATE TABLE IF NOT EXISTS user_credentials (
|
||||||
|
|||||||
@ -1508,7 +1508,11 @@
|
|||||||
"idCopiedMessage": "Tenant Id has been copied to clipboard",
|
"idCopiedMessage": "Tenant Id has been copied to clipboard",
|
||||||
"select-tenant": "Select tenant",
|
"select-tenant": "Select tenant",
|
||||||
"no-tenants-matching": "No tenants matching '{{entity}}' were found.",
|
"no-tenants-matching": "No tenants matching '{{entity}}' were found.",
|
||||||
"tenant-required": "Tenant is required"
|
"tenant-required": "Tenant is required",
|
||||||
|
"isolated-tb-core": "Processing in isolated ThingsBoard Core container",
|
||||||
|
"isolated-tb-rule-engine": "Processing in isolated ThingsBoard Rule Engine container",
|
||||||
|
"isolated-tb-core-details": "Requires separate microservice(s) per isolated Tenant",
|
||||||
|
"isolated-tb-rule-engine-details": "Requires separate microservice(s) per isolated Tenant"
|
||||||
},
|
},
|
||||||
"timeinterval": {
|
"timeinterval": {
|
||||||
"seconds-interval": "{ seconds, plural, 1 {1 second} other {# seconds} }",
|
"seconds-interval": "{ seconds, plural, 1 {1 second} other {# seconds} }",
|
||||||
|
|||||||
@ -15,32 +15,50 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<md-button ng-click="onManageUsers({event: $event})" ng-show="!isEdit" class="md-raised md-primary">{{ 'tenant.manage-tenant-admins' | translate }}</md-button>
|
<md-button ng-click="onManageUsers({event: $event})" ng-show="!isEdit" class="md-raised md-primary">{{
|
||||||
<md-button ng-click="onDeleteTenant({event: $event})" ng-show="!isEdit" class="md-raised md-primary">{{ 'tenant.delete' | translate }}</md-button>
|
'tenant.manage-tenant-admins' | translate }}
|
||||||
|
</md-button>
|
||||||
|
<md-button ng-click="onDeleteTenant({event: $event})" ng-show="!isEdit" class="md-raised md-primary">{{ 'tenant.delete'
|
||||||
|
| translate }}
|
||||||
|
</md-button>
|
||||||
|
|
||||||
<div layout="row">
|
<div layout="row">
|
||||||
<md-button ngclipboard data-clipboard-action="copy"
|
<md-button ngclipboard data-clipboard-action="copy"
|
||||||
ngclipboard-success="onTenantIdCopied(e)"
|
ngclipboard-success="onTenantIdCopied(e)"
|
||||||
data-clipboard-text="{{tenant.id.id}}" ng-show="!isEdit"
|
data-clipboard-text="{{tenant.id.id}}" ng-show="!isEdit"
|
||||||
class="md-raised">
|
class="md-raised">
|
||||||
<md-icon md-svg-icon="mdi:clipboard-arrow-left"></md-icon>
|
<md-icon md-svg-icon="mdi:clipboard-arrow-left"></md-icon>
|
||||||
<span translate>tenant.copyId</span>
|
<span translate>tenant.copyId</span>
|
||||||
</md-button>
|
</md-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<md-content class="md-padding" layout="column">
|
<md-content class="md-padding" layout="column">
|
||||||
<fieldset ng-disabled="$root.loading || !isEdit">
|
<fieldset ng-disabled="$root.loading || !isEdit">
|
||||||
<md-input-container class="md-block">
|
<md-input-container class="md-block">
|
||||||
<label translate>tenant.title</label>
|
<label translate>tenant.title</label>
|
||||||
<input required name="title" ng-model="tenant.title">
|
<input required name="title" ng-model="tenant.title">
|
||||||
<div ng-messages="theForm.title.$error">
|
<div ng-messages="theForm.title.$error">
|
||||||
<div translate ng-message="required">tenant.title-required</div>
|
<div translate ng-message="required">tenant.title-required</div>
|
||||||
</div>
|
</div>
|
||||||
</md-input-container>
|
</md-input-container>
|
||||||
<md-input-container class="md-block">
|
<md-input-container class="md-block">
|
||||||
<label translate>tenant.description</label>
|
<label translate>tenant.description</label>
|
||||||
<textarea ng-model="tenant.additionalInfo.description" rows="2"></textarea>
|
<textarea ng-model="tenant.additionalInfo.description" rows="2"></textarea>
|
||||||
</md-input-container>
|
</md-input-container>
|
||||||
<tb-contact contact="tenant" the-form="theForm" is-edit="isEdit"></tb-contact>
|
<tb-contact contact="tenant" the-form="theForm" is-edit="isEdit"></tb-contact>
|
||||||
</fieldset>
|
<md-input-container class="md-block">
|
||||||
|
<md-checkbox ng-disabled="$root.loading || !isEdit"
|
||||||
|
ng-model="tenant.isolatedTbCore">
|
||||||
|
{{'tenant.isolated-tb-core' | translate}}<br/>
|
||||||
|
<span style="font-size: 10px">{{'tenant.isolated-tb-core-details' | translate}}</span>
|
||||||
|
</md-checkbox>
|
||||||
|
</md-input-container>
|
||||||
|
<md-input-container class="md-block">
|
||||||
|
<md-checkbox ng-disabled="$root.loading || !isEdit"
|
||||||
|
ng-model="tenant.isolatedTbRuleEngine">
|
||||||
|
{{'tenant.isolated-tb-rule-engine' | translate}}<br/>
|
||||||
|
<span style="font-size: 10px">{{'tenant.isolated-tb-rule-engine-details' | translate}}</span>
|
||||||
|
</md-checkbox>
|
||||||
|
</md-input-container>
|
||||||
|
</fieldset>
|
||||||
</md-content>
|
</md-content>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user