Skip to content
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

Fixes after testing v3.9.3-7.3.0-rc2 #766

Merged
merged 3 commits into from
Jun 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<md-content flex layout="column" layout-align="end">
<!-- Breadcrumbs -->
<div layout="row" layout-padding>
<div layout="row" class="wz-height-35">
<!-- If you're not on the Welcome tab, show a functional breadcrumb -->
<div>
<div class='wz-breadcrumb-margin'>
<a class="wz-text-link cursor-pointer" ui-sref='agents'>Agents</a>
<span> / </span>
<span ng-if="!agent.error" ui-sref='agent-overview({id:agent.id})'
class="wz-text-link cursor-pointer">{{agent.name}} ({{agent.id}})</span>
<span ng-if="agent.error">Unknown agent</span>
<span> / </span>
<span>Docker listener</span>
</div>
<div ng-if="agent && agent.status">
<span class="wz-agent-status-indicator small" ng-class="getAgentStatusClass(agent.status)"
aria-label="Agent status indicator">{{formatAgentStatus(agent.status)}}</span>
<span ng-if="agent && agent.status">
<span class="wz-agent-status-indicator small" ng-class="getAgentStatusClass(agent.status)"
aria-label="Agent status indicator">{{formatAgentStatus(agent.status)}}</span>
</span>
</div>
<div flex></div>
<!-- Report button -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ define(['../../module'], function(controllers) {
if (index > -1) {
await this.currentDataService.remove(entry)
const usedApi = this.currentDataService.getApi()
if (entry._key === usedApi._key) {
if (entry && usedApi && entry._key === usedApi._key) {
this.currentDataService.removeCurrentApi()
}
this.scope.apiList.splice(index, 1)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,46 +1,56 @@
define(['../module'], function(module) {
'use strict'
'use strict';

class DateDiffService {
constructor() {
this.start = null
this.end = null
this.start = null;
this.end = null;
}

/**
* Returns the difference between dates
*/
getDateDiff(start, end) {
this.start = new Date(start)
this.end = new Date(end)
this.start = new Date(start);
this.end = new Date(end);
const result = {
duration: 'Unknown',
inProgress: false,
end: this.end || 'Unknown',
start: this.start || 'Unknown'
}
};
if (this.end && this.start) {
result.duration = (this.end - this.start) / 1000 / 60
result.duration = Math.round(result.duration * 100) / 100
result.duration = (this.end - this.start) / 1000 / 60;
result.duration = Math.round(result.duration * 100) / 100;
if (result.duration <= 0) {
result.inProgress = true
result.inProgress = true;
}
}
return result
return result;
}

setBrowserOffset(d) {
try {
const date = new Date(d)
const offset = new Date().getTimezoneOffset()
const offsetTime = new Date(date.getTime() - offset * 60000)
const result = offsetTime.toLocaleString('en-ZA').replace(',', '')
return result
const [day, time] = d.indexOf('T') !== -1 ? d.split('T') : d.split(' ');
const [year, month, monthDay] =
d.indexOf('-') !== -1 ? day.split('-') : day.split('/');
const [hour, minute, seconds] = time.split(':');
const date = new Date(
year,
parseInt(month) - 1,
monthDay,
hour,
minute,
seconds.split('.')[0]
);
const offset = new Date().getTimezoneOffset();
const offsetTime = new Date(date.getTime() - offset * 60000);
return offsetTime.toLocaleString('en-ZA').replace(',', '');
} catch (error) {
return Promise.reject(error)
return Promise.reject(error);
}
}
}

module.service('$dateDiffService', DateDiffService)
})
module.service('$dateDiffService', DateDiffService);
});