mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 14:49:07 +00:00
Fix bug in login functionality
This commit is contained in:
parent
8d35f5eb2d
commit
f5803d34ff
@ -5,7 +5,6 @@ import { JSONObject, ObjectType } from './JSON';
|
||||
import BadDataException from './Exception/BadDataException';
|
||||
|
||||
export default class Decimal extends DatabaseProperty {
|
||||
|
||||
private _value: number = 0;
|
||||
public get value(): number {
|
||||
return this._value;
|
||||
@ -36,7 +35,6 @@ export default class Decimal extends DatabaseProperty {
|
||||
return this.value.toString();
|
||||
}
|
||||
|
||||
|
||||
protected static override toDatabase(
|
||||
value: Decimal | FindOperator<Decimal>
|
||||
): string | null {
|
||||
@ -70,7 +68,6 @@ export default class Decimal extends DatabaseProperty {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static fromString(value: string): Decimal {
|
||||
return new Decimal(value);
|
||||
}
|
||||
|
@ -94,11 +94,13 @@ export class Service extends DatabaseService<Model> {
|
||||
await this.updateOneById({
|
||||
id: usageBilling.id,
|
||||
data: {
|
||||
usageCount:
|
||||
new Decimal((usageBilling.usageCount?.value || 0) + data.usageCount),
|
||||
totalCostInUSD:new Decimal(
|
||||
usageCount: new Decimal(
|
||||
(usageBilling.usageCount?.value || 0) + data.usageCount
|
||||
),
|
||||
totalCostInUSD: new Decimal(
|
||||
(usageBilling.totalCostInUSD?.value || 0) +
|
||||
totalCostOfThisOperationInUSD),
|
||||
totalCostOfThisOperationInUSD
|
||||
),
|
||||
},
|
||||
props: {
|
||||
isRoot: true,
|
||||
@ -114,7 +116,9 @@ export class Service extends DatabaseService<Model> {
|
||||
usageBilling.day = OneUptimeDate.getDateString(
|
||||
OneUptimeDate.getCurrentDate()
|
||||
);
|
||||
usageBilling.totalCostInUSD = new Decimal(totalCostOfThisOperationInUSD);
|
||||
usageBilling.totalCostInUSD = new Decimal(
|
||||
totalCostOfThisOperationInUSD
|
||||
);
|
||||
usageBilling.usageUnitName = meteredPlan.getUnitName(); // e.g. "GB"
|
||||
|
||||
await this.create({
|
||||
|
@ -94,7 +94,8 @@ const Settings: FunctionComponent<ComponentProps> = (
|
||||
getElement: (item: JSONObject) => {
|
||||
return (
|
||||
<div>{`${DiskSize.convertToDecimalPlaces(
|
||||
(item['usageCount'] as Decimal).value as number
|
||||
(item['usageCount'] as Decimal)
|
||||
.value as number
|
||||
)} ${item['usageUnitName'] as string}`}</div>
|
||||
);
|
||||
},
|
||||
@ -108,7 +109,8 @@ const Settings: FunctionComponent<ComponentProps> = (
|
||||
getElement: (item: JSONObject) => {
|
||||
return (
|
||||
<div>{`${Currency.convertToDecimalPlaces(
|
||||
(item['totalCostInUSD'] as Decimal).value as number
|
||||
(item['totalCostInUSD'] as Decimal)
|
||||
.value as number
|
||||
)} USD`}</div>
|
||||
);
|
||||
},
|
||||
|
@ -1,26 +1,26 @@
|
||||
# Install MicroK8s
|
||||
snap install microk8s --classic
|
||||
microk8s status --wait-ready
|
||||
sudo snap install microk8s --classic
|
||||
sudo microk8s status --wait-ready
|
||||
|
||||
|
||||
# Add current user to microk8s group
|
||||
microk8s kubectl config view --raw > ~/.kube/config
|
||||
sudo microk8s kubectl config view --raw > ~/.kube/config
|
||||
|
||||
# Add kubectl and helm aliases
|
||||
echo "alias kubectl='microk8s kubectl'" >> ~/.bash_aliases
|
||||
echo "alias helm='microk8s helm3'" >> ~/.bash_aliases
|
||||
sudo echo "alias kubectl='microk8s kubectl'" >> ~/.bash_aliases
|
||||
sudo echo "alias helm='microk8s helm3'" >> ~/.bash_aliases
|
||||
|
||||
# Enable MicroK8s addons
|
||||
microk8s enable dashboard
|
||||
microk8s enable dns
|
||||
microk8s enable hostpath-storage
|
||||
sudo microk8s enable dashboard
|
||||
sudo microk8s enable dns
|
||||
sudo microk8s enable hostpath-storage
|
||||
|
||||
|
||||
# Install OneUptime
|
||||
helm install oneuptime ../../HelmChart/Public/oneuptime -f ../../HelmChart/Public/oneuptime/values.yaml -f ./ci-values.yaml
|
||||
sudo helm install oneuptime ../../HelmChart/Public/oneuptime -f ../../HelmChart/Public/oneuptime/values.yaml -f ./ci-values.yaml
|
||||
|
||||
# Wait for OneUptime to be ready
|
||||
kubectl wait --for=condition=ready pod -l --timeout=300s
|
||||
sudo kubectl wait --for=condition=ready pod -l --timeout=300s
|
||||
|
||||
# Once it's ready. Run helm test.
|
||||
helm test oneuptime
|
||||
sudo helm test oneuptime
|
||||
|
@ -65,7 +65,6 @@ router.use(
|
||||
'/otel/*',
|
||||
async (req: ExpressRequest, _res: ExpressResponse, next: NextFunction) => {
|
||||
try {
|
||||
|
||||
// check header.
|
||||
|
||||
const serviceTokenInHeader: string | undefined = req.headers[
|
||||
@ -100,8 +99,6 @@ router.use(
|
||||
throw new BadRequestException('Invalid URL: ' + req.baseUrl);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const cachedServiceId: string | null = await GlobalCache.getString(
|
||||
'service-token',
|
||||
serviceTokenInHeader as string
|
||||
@ -281,7 +278,7 @@ router.post(
|
||||
(metric['sum'] as JSONObject)['dataPoints'] &&
|
||||
(
|
||||
(metric['sum'] as JSONObject)[
|
||||
'dataPoints'
|
||||
'dataPoints'
|
||||
] as JSONArray
|
||||
).length > 0
|
||||
) {
|
||||
@ -331,7 +328,7 @@ router.post(
|
||||
(metric['gauge'] as JSONObject)['dataPoints'] &&
|
||||
(
|
||||
(metric['gauge'] as JSONObject)[
|
||||
'dataPoints'
|
||||
'dataPoints'
|
||||
] as JSONArray
|
||||
).length > 0
|
||||
) {
|
||||
@ -382,7 +379,7 @@ router.post(
|
||||
(metric['histogram'] as JSONObject)['dataPoints'] &&
|
||||
(
|
||||
(metric['histogram'] as JSONObject)[
|
||||
'dataPoints'
|
||||
'dataPoints'
|
||||
] as JSONArray
|
||||
).length > 0
|
||||
) {
|
||||
|
@ -171,7 +171,7 @@ export default class UsageBilling extends AccessControlModel {
|
||||
@Column({
|
||||
nullable: false,
|
||||
type: ColumnType.Decimal,
|
||||
transformer: Decimal.getDatabaseTransformer()
|
||||
transformer: Decimal.getDatabaseTransformer(),
|
||||
})
|
||||
public usageCount?: Decimal = undefined;
|
||||
|
||||
@ -218,7 +218,7 @@ export default class UsageBilling extends AccessControlModel {
|
||||
@Column({
|
||||
nullable: false,
|
||||
type: ColumnType.Decimal,
|
||||
transformer: Decimal.getDatabaseTransformer()
|
||||
transformer: Decimal.getDatabaseTransformer(),
|
||||
})
|
||||
public totalCostInUSD?: Decimal = undefined;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user