Thank you for your reply, yes of course.
docker run -p 80:80 -v baserow_data:/baserow/data my-customized-baserow:1.33.2
is the command for running it.
After the start I can see this output
The Dockerfile looks like this
FROM baserow/baserow:1.33.2
COPY ./my-baserow-plugin/ /baserow/data/plugins/my_baserow_plugin/
COPY ./app-type-plugin/ /baserow/data/plugins/app_type_plugin/
COPY ./integer-field-plugin/ /baserow/data/plugins/integer_field_plugin/
RUN /baserow/plugins/install_plugin.sh --folder /baserow/data/plugins/my_baserow_plugin
RUN /baserow/plugins/install_plugin.sh --folder /baserow/data/plugins/app_type_plugin
RUN /baserow/plugins/install_plugin.sh --folder /baserow/data/plugins/integer_field_plugin
The output from baserow/plugins directory are only the shell scripts
and list plugins shows all plugins which I have inside my Dockerfile.
Im gonna show you just one plugin now because the message will be too long.
baserow/integer-field-plugin/plugins/integer_field_plugin/backend/src/integer_field_plugin
apps.py
from django.apps import AppConfig
from baserow.core.registries import plugin_registry
from baserow.contrib.database.fields.registries import field_type_registry
class IntegerFieldConfig(AppConfig):
name = "integer_field_plugin"
def ready(self):
from .plugins import IntegerFieldPlugin
from .field_types import IntegerFieldType
plugin_registry.register(IntegerFieldPlugin())
field_type_registry.register(IntegerFieldType())
field_types
from django.db import models
from django.core.exceptions import ValidationError
from rest_framework import serializers
from baserow.contrib.database.fields.registries import FieldType
from .models import IntegerField
class IntegerFieldType(FieldType):
type = 'integer'
model_class = IntegerField
allowed_fields = ['integer_negative']
serializer_field_names = ['integer_negative']
def prepare_value_for_db(self, instance, value):
if value and not instance.integer_negative and value < 0:
raise ValidationError(f'The value for field {instance.id} cannot be '
f'negative.')
return value
def get_serializer_field(self, instance, **kwargs):
return serializers.IntegerField(required=False, allow_null=True)
def get_model_field(self, instance, **kwargs):
return models.IntegerField(null=True, blank=True)
models.py
from django.db import models
from baserow.contrib.database.fields.models import Field
class IntegerField(Field):
integer_negative = models.BooleanField(default=False)
plugins.py
from loguru import logger
from baserow.core.registries import Plugin
from django.urls import path, include
from .api import urls as api_urls
class IntegerFieldPlugin(Plugin):
type = "integer_field_plugin"
def get_api_urls(self):
return [
path(
"integer_field_plugin/",
include(api_urls, namespace=self.type),
),
]
baserow/integer-field-plugin/plugins/integer_field_plugin/web-frontend/plugin.js
import { PluginNamePlugin } from "@integer-field-plugin/plugins";
import { IntegerFieldType } from "@integer-field-plugin/fieldTypes";
export default (context) => {
const { app } = context;
app.$registry.register("plugin", new PluginNamePlugin(context));
app.$registry.register("field", new IntegerFieldType(context));
};
fieldTypes.js
import { FieldType } from "@baserow/modules/database/fieldTypes";
import SubFormIntegerField from "@integer-field-type/components/SubFormIntegerField";
import GridViewIntegerField from "@integer-field-type/components/GridViewIntegerField";
import RowEditIntegerField from "@integer-field-type/components/RowEditIntegerField";
export class IntegerFieldType extends FieldType {
static getType() {
return "integer";
}
getIconClass() {
return "iconoir-numbered-list-left";
}
getName() {
return "Integer";
}
getFormComponent() {
return SubFormIntegerField;
}
getGridViewFieldComponent() {
return GridViewIntegerField;
}
getRowEditFieldComponent(field) {
return RowEditIntegerField;
}
}
/modules/components
GridViewIntegerField.vue
<template>
<div class="grid-view__cell" :class="{ active: selected }">
<div>Hello World</div>
</div>
</template>
<script>
import gridField from "@baserow/modules/database/mixins/gridField";
export default {
mixins: [gridField],
};
</script>
RowEditIntegerField.vue
<template>
<div class="control__elements">Hello World</div>
</template>
<script>
import rowEditField from "@baserow/modules/database/mixins/rowEditField";
export default {
mixins: [rowEditField],
};
</script>
SubFormIntegerField.vue
template>
<div>
<div class="control">
<div class="control__elements">
<Checkbox v-model="values.integer_negative"
>Allow negative</Checkbox
>
</div>
</div>
</div>
</template>
<script>
import form from "@baserow/modules/core/mixins/form";
export default {
name: "SubFormIntegerField",
mixins: [form],
data() {
return {
allowedValues: ["integer_negative"],
values: { integer_negative: false },
};
},
methods: {
isFormValid() {
return true;
},
},
};
</script>