Skip to content

Commit

Permalink
Show maintenance mode updated by timestamp along with date (#5786)
Browse files Browse the repository at this point in the history
  • Loading branch information
GaneshSPatil committed Feb 19, 2019
1 parent d5b9d57 commit 3317123
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Expand Up @@ -206,11 +206,11 @@ export class RunningSystem {

export class MaintenanceModeMetadata {
updatedBy: string;
updatedOn: Date;
updatedOn: string;

constructor(updatedBy: string, updatedOn: string) {
this.updatedBy = updatedBy;
this.updatedOn = TimeFormatter.formatInDate(updatedOn);
this.updatedOn = TimeFormatter.format(updatedOn);
}

static fromJSON(json: MaintenanceModeMetadataJSON) {
Expand Down
Expand Up @@ -24,6 +24,8 @@ describe("Maintenance Mode Widget", () => {
const toggleMaintenanceMode = jasmine.createSpy("onToggle");
const onCancelStage = jasmine.createSpy("onCancelStage");

const TimeFormatter = require("helpers/time_formatter");

beforeEach(() => {
// @ts-ignore
[$root, root] = window.createDomElementForTest();
Expand All @@ -48,7 +50,8 @@ describe("Maintenance Mode Widget", () => {
});

it("should provide the maintenance mode updated information", () => {
const expectedUpdatedByInfo = `${TestData.info().metdata.updatedBy} changed the maintenance mode state on ${TestData.info().metdata.updatedOn}.`;
const updatedOn = TimeFormatter.format(TestData.UPDATED_ON);
const expectedUpdatedByInfo = `${TestData.info().metdata.updatedBy} changed the maintenance mode state on ${updatedOn}.`;
expect(find("maintenance-mode-updated-by-info")).toContainText(expectedUpdatedByInfo);
});

Expand Down
Expand Up @@ -17,6 +17,8 @@
import {MaintenanceModeInfo, MaintenanceModeInfoJSON} from "models/maintenance_mode/types";

export class TestData {
static UPDATED_ON = "2018-12-10T04:19:31Z";

static info(hasRunningSystems: boolean = true) {
return MaintenanceModeInfo.fromJSON(this.infoJSON(hasRunningSystems) as MaintenanceModeInfoJSON);
}
Expand All @@ -30,7 +32,7 @@ export class TestData {
is_maintenance_mode: true,
metadata: {
updated_by: "Admin",
updated_on: "2018-12-10T04:19:31Z"
updated_on: this.UPDATED_ON
},
attributes: {
has_running_systems: true,
Expand All @@ -47,7 +49,7 @@ export class TestData {
is_maintenance_mode: hasRunningSystems,
metadata: {
updated_by: "Admin",
updated_on: "2018-12-10T04:19:31Z"
updated_on: this.UPDATED_ON
},
attributes: {
has_running_systems: true,
Expand Down

0 comments on commit 3317123

Please sign in to comment.