Skip to content
Permalink
Browse files

Show maintenance mode updated by timestamp along with date (#5786)

  • Loading branch information...
GaneshSPatil committed Feb 19, 2019
1 parent d5b9d57 commit 33171234ed0a8550a9848e94030223db75bc7a73
@@ -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) {
@@ -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();
@@ -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);
});

@@ -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);
}
@@ -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,
@@ -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,

0 comments on commit 3317123

Please sign in to comment.
You can’t perform that action at this time.