DRY up shortRevision stuff
This commit is contained in:
parent
29aa098ca7
commit
ca2bac96cd
|
@ -6,13 +6,13 @@ import { ready } from "./config/actions";
|
|||
import { detectLanguage } from "./i18n";
|
||||
import * as i18next from "i18next";
|
||||
import "./npm_addons";
|
||||
import { stopIE, attachToRoot } from "./util";
|
||||
import { stopIE, attachToRoot, shortRevision } from "./util";
|
||||
|
||||
stopIE();
|
||||
interface DebugStuff {
|
||||
ip_address: string;
|
||||
}
|
||||
let r = (process.env.REVISION as string) || "REVISION INFO NOT AVAILABLE";
|
||||
let r = shortRevision();
|
||||
console.log(r);
|
||||
|
||||
/** For external device debugging purposes
|
||||
|
|
|
@ -8,7 +8,7 @@ import { Markdown } from "../ui";
|
|||
import * as moment from "moment";
|
||||
import { SyncButton } from "./sync_button";
|
||||
import { history } from "../history";
|
||||
import { updatePageInfo } from "../util";
|
||||
import { updatePageInfo, shortRevision } from "../util";
|
||||
|
||||
let DropDown = ({ user, onClick }: DropDownProps) => {
|
||||
// Just checking if user is logged in, otherwise nothing is returned.
|
||||
|
@ -50,7 +50,7 @@ let DropDown = ({ user, onClick }: DropDownProps) => {
|
|||
<span>{t("Application")}:
|
||||
<a href="https://github.com/FarmBot/Farmbot-Web-API"
|
||||
target="_blank">
|
||||
{(process.env.SHORT_REVISION || "NONE").slice(0, 8)}
|
||||
{shortRevision()}
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -151,7 +151,7 @@ export class NavBar extends React.Component<NavBarProps, NavBarState> {
|
|||
<a href="https://github.com/FarmBot/farmbot-web-frontend"
|
||||
target="_blank">
|
||||
{/** SHORT_REVISION is the last frontend commit. */}
|
||||
{process.env.SHORT_REVISION}
|
||||
{shortRevision()}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -293,9 +293,9 @@ export function isUndefined(x: any): x is undefined {
|
|||
*/
|
||||
export function betterCompact<T>(input: (T | undefined)[]): T[] {
|
||||
let output: T[] = [];
|
||||
input.forEach(x => x ? output.push(x) : "")
|
||||
input.forEach(x => x ? output.push(x) : "");
|
||||
return output;
|
||||
};
|
||||
}
|
||||
|
||||
/** Sorts a list of tagged resources. Unsaved resource get put on the end. */
|
||||
export function sortResourcesById<T extends TaggedResource>(input: T[]): T[] {
|
||||
|
@ -468,6 +468,8 @@ export interface HttpData<T> extends AxiosResponse {
|
|||
* TODO: Write farmbot-resource library or something like that to do real
|
||||
* runtime type checking.
|
||||
*/
|
||||
export interface HttpPromise<T> extends Promise<HttpData<T>> {
|
||||
export interface HttpPromise<T> extends Promise<HttpData<T>> { }
|
||||
|
||||
export function shortRevision() {
|
||||
return (process.env.SHORT_REVISION || "NONE").slice(0, 8);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue