Class: Karafka::Web::Ui::Lib::Paginations::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/karafka/web/ui/lib/paginations/base.rb

Overview

Note:

We do not use _page explicitly to indicate, that the page scope may not operate on numerable pages (1,2,3,4) but can operate on offsets or times, etc. _offset is more general and may refer to many types of pagination.

Abstraction on top of pagination, so we can alter pagination key and other things for non-standard pagination views (non page based, etc)

Direct Known Subclasses

OffsetBased, PageBased, WatermarkOffsetsBased

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#current_offsetObject (readonly)

Returns the value of attribute current_offset.



16
17
18
# File 'lib/karafka/web/ui/lib/paginations/base.rb', line 16

def current_offset
  @current_offset
end

#next_offsetObject (readonly)

Returns the value of attribute next_offset.



16
17
18
# File 'lib/karafka/web/ui/lib/paginations/base.rb', line 16

def next_offset
  @next_offset
end

#previous_offsetObject (readonly)

Returns the value of attribute previous_offset.



16
17
18
# File 'lib/karafka/web/ui/lib/paginations/base.rb', line 16

def previous_offset
  @previous_offset
end

Instance Method Details

#current_offset?Boolean

Returns Should we show current offset. If false, the current offset link will not be visible at all. Useful for non-linear pagination.

Returns:

  • (Boolean)

    Should we show current offset. If false, the current offset link will not be visible at all. Useful for non-linear pagination.

Raises:

  • (NotImplementedError)


42
43
44
# File 'lib/karafka/web/ui/lib/paginations/base.rb', line 42

def current_offset?
  raise NotImplementedError, 'Implement in a subclass'
end

#first_offsetString

Returns first offset url value.

Returns:

  • (String)

    first offset url value

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/karafka/web/ui/lib/paginations/base.rb', line 30

def first_offset
  raise NotImplementedError, 'Implement in a subclass'
end

#first_offset?Boolean

Returns Should first offset link be active. If false, the first offset link will be disabled.

Returns:

  • (Boolean)

    Should first offset link be active. If false, the first offset link will be disabled

Raises:

  • (NotImplementedError)


25
26
27
# File 'lib/karafka/web/ui/lib/paginations/base.rb', line 25

def first_offset?
  raise NotImplementedError, 'Implement in a subclass'
end

#next_offset?Boolean

Returns Should we show next offset pagination. If false, next offset link will be disabled.

Returns:

  • (Boolean)

    Should we show next offset pagination. If false, next offset link will be disabled.

Raises:

  • (NotImplementedError)


48
49
50
# File 'lib/karafka/web/ui/lib/paginations/base.rb', line 48

def next_offset?
  raise NotImplementedError, 'Implement in a subclass'
end

#offset_keyString

Returns the url offset key.

Returns:

  • (String)

    the url offset key

Raises:

  • (NotImplementedError)


53
54
55
# File 'lib/karafka/web/ui/lib/paginations/base.rb', line 53

def offset_key
  raise NotImplementedError, 'Implement in a subclass'
end

#paginate?Boolean

Returns Should we show pagination at all.

Returns:

  • (Boolean)

    Should we show pagination at all

Raises:

  • (NotImplementedError)


19
20
21
# File 'lib/karafka/web/ui/lib/paginations/base.rb', line 19

def paginate?
  raise NotImplementedError, 'Implement in a subclass'
end

#previous_offset?Boolean

Returns Should previous offset link be active. If false, the previous offset link will be disabled.

Returns:

  • (Boolean)

    Should previous offset link be active. If false, the previous offset link will be disabled

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/karafka/web/ui/lib/paginations/base.rb', line 36

def previous_offset?
  raise NotImplementedError, 'Implement in a subclass'
end