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

mgr/dashboard: Add CdDatePipe #21087

Merged
merged 1 commit into from Apr 4, 2018

Conversation

Projects
None yet
5 participants
@ricardoasmarques
Copy link
Member

ricardoasmarques commented Mar 28, 2018

This PR adds a custom date pipe that can be used to format dates on table columns (because ngx datatable doesn't support arguments for pipes) and will also guarantee that we use the same date format consistently.

this.columns = [
  {
    name: 'Created',
    prop: 'timestamp',
    pipe: cdDatePipe
  }
];

screenshot from 2018-03-28 08-30-55

(This format will change according to the configured language.)

Signed-off-by: Ricardo Marques rimarques@suse.com

@ricardoasmarques ricardoasmarques requested review from tspmelo , votdev and Devp00l Mar 28, 2018

@tchaikov tchaikov added the dashboard label Mar 28, 2018

@tspmelo

tspmelo approved these changes Apr 2, 2018

import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
name: 'cdDate'

This comment has been minimized.

@votdev

votdev Apr 3, 2018

Contributor

All current existing pipes are not using the prefix cd, so i suggest to keep this and remove it in this PR too.

This comment has been minimized.

@ricardoasmarques

ricardoasmarques Apr 3, 2018

Author Member

@votdev But angular already have a pipe named date, it will cause conflicts.

What about naming it dateTime? Is it ok for you?

This comment has been minimized.

@votdev

votdev Apr 4, 2018

Contributor

Sounds good to me.

This comment has been minimized.

@ricardoasmarques

ricardoasmarques Apr 4, 2018

Author Member

@votdev @tspmelo per our discussion today, we will keep the name cdDate.

mgr/dashboard: Add CdDatePipe
Signed-off-by: Ricardo Marques <rimarques@suse.com>

@ricardoasmarques ricardoasmarques force-pushed the ricardoasmarques:wip-date-pipe branch from b2313dc to 803dd50 Apr 3, 2018

@votdev

This comment has been minimized.

Copy link
Contributor

votdev commented Apr 4, 2018

Is this date/time format required? What about localized date formats, e.g. i want to see the date format in the notation we use in Germany. I've implemented such filter/pipe for openATTIC.

@ricardoasmarques

This comment has been minimized.

Copy link
Member Author

ricardoasmarques commented Apr 4, 2018

@votdev this pipe is using angular date pipe that already formats a date according to locale rules:

https://angular.io/api/common/DatePipe

@votdev

This comment has been minimized.

Copy link
Contributor

votdev commented Apr 4, 2018

@ricardoasmarques Cool, thx for the info.

@votdev

votdev approved these changes Apr 4, 2018

@LenzGr LenzGr merged commit 386c713 into ceph:master Apr 4, 2018

5 checks passed

Docs: build check OK - docs built
Details
Signed-off-by all commits in this PR are signed
Details
Unmodified Submodules submodules for project are unmodified
Details
make check make check succeeded
Details
make check (arm64) make check succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment