This is only incidentally a "Trump" decision.
In reality it's an affirmation of the right of the executive - any executive - to exercise ridiculously wide latitude in the name of "national security."
Actually, no. The decision turned on the proper interpretation of
an explicit and exceptionally broad statutory grant of authority to the president by Congress in the Immigration and Nationality Act:
Suspension of entry or imposition of restrictions by President
Whenever the President finds that the entry of any aliens or of any class of aliens into the United States would be detrimental to the interests of the United States, he may by proclamation, and for such period as he shall deem necessary, suspend the entry of all aliens or any class of aliens as immigrants or nonimmigrants, or impose on the entry of aliens any restrictions he may deem to be appropriate.
[8 U.S.C. §1182(f).]
The only real substantive issue was whether Trump's campaign statements about proclaiming a "total and complete shutdown of Muslims entering the United States" and other comments that similarly suggested the executive order under challenge in this litigation had an unconstitutional purpose of discriminating against one religion.
The Court concluded that Trump's executive order was "neutral on its face" (i.e., in the literal language of the order) and that it had been implemented after a rational fact-finding process to determine which nationals of specific countries would be affected. The minority argued that Trump's executive order was motivated "by religious animus."
If the issue had been national security, it's not clear that there would even have been a dissent:
If, however, its sole ratio decidendi was one of national security, then it would be unlikely to violate either the statute or the Constitution.
[Breyer and Kagan, dissenting.]
I'm personally not pleased with the Court's decision, but to claim it was based on a "ridiculously wide latitude in the name of 'national security'" is, I think, a stretch.